DarkCore Posted March 8, 2011 Posted March 8, 2011 Hello, i want to make one thing, but i don't really know how. I want to make PVP reward by chance, not to always give reward, but like 20%, how is it possible? How should code look like? here the code that i use: addItem("Loot", 57, 10000000, this, true); sendMessage("You won 10kk for PVP kill!"); Quote
0 Matim Posted March 8, 2011 Posted March 8, 2011 Simple sample random: if (Rnd.get(100) > 90) { addItem("Loot", 57, 10000000, this, true); sendMessage("You won 10kk for PVP kill!"); } Self-explanatory. Quote
0 DarkCore Posted March 8, 2011 Author Posted March 8, 2011 Simple sample random: Self-explanatory. Thank you. Which number is chance to drop ? Quote
0 Matim Posted March 8, 2011 Posted March 8, 2011 Use your brain, and You will understand it. We are getting random number (max 100) So lets say, it will give random number 95 95 is > 90 so code from brackets will be executed (when rnd will return random 91,92,93,94,95,96,97,98,99,100) - ten bumbers, so guess what? Chance in this case is ...10% Quote
Question
DarkCore
Hello, i want to make one thing, but i don't really know how.
I want to make PVP reward by chance, not to always give reward, but like 20%, how is it possible?
How should code look like?
here the code that i use:
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.