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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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