Jump to content
The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades. ×
  • 0

Mob kill reward in certain maps


Mabuhay

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   232
  • Joined:  03/20/12
  • Last Seen:  

As title says, can someone make a script where it gives random items to players who kills monster only in a certain map like prt_fild08 with a chance of 20%. sample items 607 608 609 610. Thanks

 

 

EDIT:

I ended up making it myself, how is this? Not tested because im currently not home.

-	script	test	-1,{
OnNPCKillEvent:
	getmapxy (.@map$, .@x, .@y, 0);
	set .@t_maps$[0],"prt_fild08","prt_fild09";
	set .@t_reward$[0],607,608;
	  for (set .@a, 0; .@a < getarraysize(.@t_maps$); set .@a, .@a + 1) {
		if( .@map$ == .@t_maps$[.@a]) {
		   getitem getarraysize(.@t_reward$),1;
		   end;
		}
	  }
}
Edited by MrVandalBus
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

change this line

getitem getarraysize(.@t_reward$),1;

to

getitem .@t_reward$[rand(getarraysize(.@t_reward$)],1;

 

remove this line

getmapxy (.@map$, .@x, .@y, 0);

 

then change 

if( .@map$ == .@t_maps$[.@a])

to

if(strcharinfo(3) == .@t_maps$[.@a] && rand(5) < 2)

to add 20% chance only

 

Kindly test it too xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   232
  • Joined:  03/20/12
  • Last Seen:  

Thanks for the quick response! Sorry I still learning to script though. LOL. Anyways, i'll try it when i get home

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...