Jump to content
  • 0

Random chance pvp rewards?


brett16

Question

I'm looking for a guide that could help me add random chance a player can get an item reward for a pvp kill. Example would be something like

Player 1 Kills Player 2:

10% chance of getting gold bar.

25% chance of getting AA

 

I would like to have a few items that have a random chance to get or maybe add all those items to a custom compressed pack that has a random chance to open into 1 of those items.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

int itemReward = Config.MOD_GVE_AMOUNT_PACK_BY_PVP;

addItem("Loot", 5139, itemReward, this, true);

                        if (Rnd.get(100) > 50)

                        {

                          //give reward

                        }

would that be correct?

Link to comment
Share on other sites

  • 0

                        if (Rnd.get(100) > 50)

                        {

                          addItem("Loot", 5139, itemReward, this, true);

                        }

that would be probably correct(i dont remember all parameters of addItem method, so i am not sure about that)

Link to comment
Share on other sites

  • 0

int itemReward = Config.MOD_GVE_AMOUNT_PACK_BY_PVP;

addItem("Loot", 5139, itemReward, this, true);

                        if (Rnd.get(100) > 50)

                        {

                          //give reward

                        }

would that be correct?

 

Did that work id like to try to make something like this for my server?

Link to comment
Share on other sites

  • 0

I added

int itemReward = Config.MOD_GVE_AMOUNT_PACK_BY_PVP;

        if (Rnd.get(100) > 50)

        addItem("Loot", 5139, itemReward, this, true);

                       {

                        }

 

still gives me 5139 100%

Link to comment
Share on other sites

  • 0

Using brain doesn't hurt.

 

         int itemReward = Config.MOD_GVE_AMOUNT_PACK_BY_PVP;

         if (Rnd.get(100) > 50)
         {
                addItem("Loot", 5139, itemReward, this, true);
         }

Link to comment
Share on other sites

  • 0

Using brain doesn't hurt.

 

        int itemReward = Config.MOD_GVE_AMOUNT_PACK_BY_PVP;

        if (Rnd.get(100) > 50)
        {
               addItem("Loot", 5139, itemReward, this, true);
        }

I typed the code in my post wrong, The only thing different from what you posted and what I had was there was no space between

int itemReward = Config.MOD_GVE_AMOUNT_PACK_BY_PVP; and

if (Rnd.get(100) >50)

 

but adding the space between the 2 made it work, so thank you.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...