Jump to content
  • 0
crazyarashi

A getunitdata question.

Question

OnMinionSummon:
[email protected]_id = 1002;
[email protected]_count = 20;
monster "prontera",255,55,"Pink Evil Minions",.minion_id,.minion_count,strnpcinfo(0)+"::OnMinionKill";
for ([email protected] = 0; [email protected] < .minion_count; [email protected]++){
	.gid[[email protected]] = [email protected][[email protected]];
	//= store data
}
                         


		

Good day rathena, I have a question regarding getunitdata. I want to summon a multiple monster and get their data later on. ( specifically the x and y) during the KillEvent
Tried several ways to get the data and yet failed. hopefully anyone can enlighten me on what to do. Thanks in advance
 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
3 hours ago, crazyarashi said:
OnMinionSummon:
[email protected]_id = 1002;
[email protected]_count = 20;
monster "prontera",255,55,"Pink Evil Minions",.minion_id,.minion_count,strnpcinfo(0)+"::OnMinionKill";
for ([email protected] = 0; [email protected] < .minion_count; [email protected]++){
	.gid[[email protected]] = [email protected][[email protected]];
	//= store data
}
                         


		

Good day rathena, I have a question regarding getunitdata. I want to summon a multiple monster and get their data later on. ( specifically the x and y) during the KillEvent
Tried several ways to get the data and yet failed. hopefully anyone can enlighten me on what to do. Thanks in advance
 

Here there might be a better way of doing this but this is the method I've come up with tested and it's working quite well.

prontera,260,69,1	script	monsterspawner	100,{

OnMinionSummon:
	[email protected]_id = 1002;
	[email protected]_count = 10;
	monster "prontera",255,55,"Pink Evil Minions",[email protected]_id,[email protected]_count,strnpcinfo(0)+"::OnMinionKill";
	copyarray .gid[getarraysize(.gid)], [email protected][0], [email protected]_count;
	end;

OnMinionKill:
	[email protected] = getarraysize(.gid);
	for([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
		if(unitexists(.gid[[email protected]])) {
			getunitdata(.gid[[email protected]],[email protected]);
			if([email protected][UMOB_HP]) {
				dispbottom [email protected][UMOB_X]+" "[email protected][UMOB_Y]+" HP:"[email protected][UMOB_HP];
				deletearray .gid[[email protected]], 1;
				break;
			}
		} else {
			deletearray .gid[[email protected]], 1;
			[email protected];
		}
	}
	
}

 

Edited by Skorm
  • Upvote 1
Link to comment
Share on other sites

  • 0
1 hour ago, Skorm said:

Here there might be a better way of doing this but this is the method I've come up with tested and it's working quite well.

prontera,260,69,1	script	monsterspawner	100,{

OnMinionSummon:
	[email protected]_id = 1002;
	[email protected]_count = 10;
	monster "prontera",255,55,"Pink Evil Minions",[email protected]_id,[email protected]_count,strnpcinfo(0)+"::OnMinionKill";
	copyarray .gid[getarraysize(.gid)], [email protected][0], [email protected]_count;
	end;

OnMinionKill:
	[email protected] = getarraysize(.gid);
	for([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
		if(unitexists(.gid[[email protected]])) {
			getunitdata(.gid[[email protected]],[email protected]);
			if([email protected][UMOB_HP]) {
				dispbottom [email protected][UMOB_X]+" "[email protected][UMOB_Y]+" HP:"[email protected][UMOB_HP];
				deletearray .gid[[email protected]], 1;
				break;
			}
		} else {
			deletearray .gid[[email protected]], 1;
			[email protected];
		}
	}
	
}

 

Big thanks! going to try it out :))

Link to comment
Share on other sites

  • 0

@crazyarashi Not sure if you suggested this one, but it's something I've been wanting for awhile, and it looks like @Capuche just added it. In anycase it would be much better to update your server and use the killedgid variable instead of all this mumbo jumbo.

 

https://github.com/rathena/rathena/commit/c856b07c45aed6c5842ee19a940f7e76f780221c

Link to comment
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.   Paste as plain text instead

  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.



×
×
  • Create New...

Important Information

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