-
Member
Giving items to only limited players in a map
So in takedamagehandler, I have this
if (monsteridfrom == 9400551) {
c.getPlayer().setHpMp(0);
return;
}
chunk of code,is it possible to make 9400551 give a certain item to the map it's spawned at? But limited to only like 5 players.
-
-
Re: Giving items to only limited players in a map
within the if-statement, add all the players from the map to an arraylist and create 5 randoms through the range of 0~[size of the arraylist], and then the 5 randoms will be selected indexes from the list. Then, with the 5 randoms, access the list (ex: chrs.get(random[0]) or something if you use arrays, do w/e u want) and give the player an item. Make sure the list is a reference of MapleCharacter objects.