Variable help

Started by Modman5 on Sun, 12/25/2016 - 22:34

Topic category: Help with MCreator modding

Last seen on 18:42, 4. Jan 2017
Joined Feb 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Variable help
Sun, 12/25/2016 - 22:34

So i am currently making a casino mod for 1.10 and i made an item "Lottery ticket". how do i make it so when i right click it rolls a random number between 1 and 50 and if that numver is 15 it gives the player who right clicked 10 diamond blocks? or is that impossible by mcreator standards??? i did see a tag for "when item is right-clicked in air" and it said execute variable but when ever i click that it says "no variables detected"?

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
For random number : (int)
Sun, 12/25/2016 - 23:44

For random number : (int)(Math.random() * 50)
For detecting the value if(YOUR_VARIABLE == 15)

Last seen on 18:42, 4. Jan 2017
Joined Feb 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
thanks (insert smily face
Sun, 12/25/2016 - 23:46

thanks (insert smily face here)

 

Last seen on 18:42, 4. Jan 2017
Joined Feb 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
also which category do i add
Mon, 12/26/2016 - 00:02

also which category do i add these to...custom code???

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
In case use mcreator's eventy
Mon, 12/26/2016 - 00:42

In case use mcreator's eventy system you can simply use something like "add item to inventory" and use as a condition (int)(Math.random() * 50) == 15