Jump to content
  • 0
Sign in to follow this  
petyrbaelish

get mob id on event

Question

Hello Guys, im trying to do something like this, but i dont know how to get the mob id inside the event, and then inside the timer too...

 

prontera,0,0,0,0	monster	Testing Mob	3102,1,5000,0,mobScripts::OnMobSpawn


-	script	mobScripts	-1,{

OnMobSpawn:
	getunitdata($@mobid[0],UDT_HP, .mobhp);
	getunitdata($@mobid[0],UDT_MAXHP, .mobmaxhp);
	// do something with the data
	addtimer(2000, strnpcinfo(NPC_NAME_UNIQUE)+"::OnRecheck");
	end;

OnRecheck:
	getunitdata($@mobid[0],UDT_HP, .mobhp);
	getunitdata($@mobid[0],UDT_MAXHP, .mobmaxhp);
	// do something with the data
	end;
}

 

Can someone help me? im new on ragnarok scripting.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
prontera,155,185,5	script	jsdfksdjf	1_F_MARIA,{
	if ( .mobid ) end;
	.mobid = monster( "this", -1, -1, "--ja--", 1002, 1, strnpcinfo(3)+"::Onaaa" );
	setunitdata .mobid, UDT_MAXHP, 1000000;
	setunitdata .mobid, UDT_HP, 1000000;
	while ( .mobid ) {
		npctalk "Poring HP is now "+( getunitdata( .mobid, UDT_HP ) / 10000 )+"%";
		sleep 2000;
	}
	end;
Onaaa:
	.mobid = 0;
	end;
}

... although this script is working but ... my map-server.exe spam error ...

check the script command in script.c

... Line 19671
	}
		break;
	default:
		ShowError("buildin_getunitdata: Unknown object!\n");
		script_pushint(st, 0);
		return false;
	} // end of bl->type switch

#undef getunitdata_sub

	return false; <<----- WTF PUT A RETURN FALSE FOR WHAT REASON !!!
}

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.