Jump to content

Question

Posted

Hello maxcheaters.

Got a question: Is it possible to make items like Blue Eva or Golden Dragon etc etc to be dropped at all players in the party, if its random, for example if 3 members in the party and the blue eva are 3 then everyone will get from 1 and not someone will get all the 3?

Thx in advance!

2 answers to this question

Recommended Posts

  • 0
Posted

write a script...

... or split them in more categories with every cat having 100% drop chance. this way no one will get all of them but its possible for someone to get more than one, or nothing...

  • 0
Posted (edited)

You just have to calculate item count / players.

 

If you are using acis :

Take a look in method distributeItem in Party.java and then check distributeAdena method.

 

public void distributeAdena(Player player, int adena, Creature target)
{
	 // We will hold here the players that will be rewarded
	List<Player> toReward = new ArrayList<>(_members.size());
	
	// We are looping each player in the party
	for (Player member : _members) 
	{
		// Checking the maximum range that allowed and the player's adena 
		if (!MathUtil.checkIfInRange(Config.PARTY_RANGE, target, member, true) || member.getAdena() == Integer.MAX_VALUE)
			continue;
		
		// Pass the check so will be rewarded.
		toReward.add(member);
	}
	
	// After all playes checked we got them in the list
	// Avoid divisions by 0. so checking for atleast 1 member
	if (toReward.isEmpty())
		return;
	
	//lets say we got 4 people that must be rewarded
	
	// Calculation for drop  in example of 1kk adena's. 1kk / 4 = 250k
	final int count = adena / toReward.size(); //250k
	
	// Adding 250k for each player
	for (Player member : toReward)
		member.addAdena("Party", count, player, true);
}

 

You can actually c/p that and create your own method. just change this

member.getAdena() == Integer.MAX_VALUE

and this

member.addAdena("Party", count, player, true);

with the proper methods.

 

How and where you have to put your new custom method?

 

Party.java method distributeItem.

 

if (item.getId() == 57)
{
	distributeAdena(player, item.getValue(), target);
	return;
}

add your own after that something like

 

if (item.getId() == XX)
{
	distributeCustomItem(player, item.getValue(), target);
	return;
}

 

Edited by melron
  • Upvote 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..