how to use event variable

Started by madmanu on Thu, 05/09/2013 - 13:05

Topic category: Help with MCreator modding

Last seen on 12:33, 6. May 2017
Joined May 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
how to use event variable
Thu, 05/09/2013 - 13:05

when you creat a mod , when you are in the event selection , you can set a variable . How can I use it ? How to make condition with these variable ? How to add 1 in a variable and not set a value ?

Last seen on 23:30, 23. Jan 2017
Joined May 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I was gonna ask the same
Fri, 09/02/2016 - 17:09

I was gonna ask the same question, but I'll post here so both of use get the answer- How can I make something happen when the variable reaches a certain value?

Last seen on 21:22, 22. Jun 2019
Joined Aug 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
You can use variable to let
Mon, 09/05/2016 - 09:51

You can use variable to let happen some event only if you need another condition (that are not in the default mcreator conditions).

For example, you nwant a sword that gives you a potion effect only when you right click a certain block.

create your variable with a value you want (e.g. a = 1), then create your sword and set that when the variable is = 2 and when it's in your hand, add potion effect. Then, when the sword is in your inventory (or when it breaks), make the variable goes to 1.
Next create your block and set, when right clicked (maybe possible only when you have that sword in your hand) the variable (a) goes to 2. 

So you have a little cycle (that you can trick if you, for example, drop the sword somewhere :P) that uses a variable.

It's quite a "difficult" way to add something so simple as a potion effect but if you need more conditions...

Variables can be used to get a potion effect when you wear a full armor set too for example (one of the best way to use them)

Last seen on 23:30, 23. Jan 2017
Joined May 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:You can use variable to let
Mon, 09/05/2016 - 19:22

@#2 can I use it to make random explosions?

Last seen on 21:22, 22. Jun 2019
Joined Aug 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:RE:You can use variable to let
Mon, 09/05/2016 - 21:17

@#2.1 It depends from what, how many etc..

But it should be possible if you create a "cycle" .

For example, with the variable at 1 --> exmplosion. Then you set something that make the variable go from 0 to 5 and then again to 0.

But remember that if the the cycle is continuous (so that the variable go from 0 to 5 immediatly cuz all the conditions are activated), you get an infinite fast explosion chain!

Last seen on 14:35, 27. Jun 2019
Joined Dec 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
for the explosions you could
Tue, 09/06/2016 - 22:31

for the explosions you could set each explosion to only happen, lets say, 50% when your variable (a) equals, for example, 2. If you where to do this is would make the chance very small and mabye use a staked event to make it an even smaller chance. For where the explosions happen you could make tons of different explosion events like the first one, but just mess with the i, j, k. Do get the same result you could use code to make a constanly changing number variable, and add that variable to the i, j, k, in the code.

Last seen on 21:22, 22. Jun 2019
Joined Aug 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:for the explosions you could
Wed, 09/07/2016 - 11:31

@#3 Oh I forgot about the chance conditions! Gj :D

For a smaller chance you can just change that 50% in whatever you want :P

Last seen on 03:59, 8. Mar 2019
Joined Aug 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Well I have a quick question:
Fri, 09/30/2016 - 04:03

Well I have a quick question: Does anyone know how to make a custom counter in an overlay? For instance, Everytime I right-click an item the counter adds one?

Last seen on 05:14, 22. Jul 2019
Joined Aug 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:Well I have a quick question:
Fri, 09/30/2016 - 22:50

@#4 This might be a little round about, but you could make an overlay for each individual number. Set the events so that right-click causes the first overlay to appear, then set an argument for the variable for each number. (right click = overlay #1 IF overlay #1 is false, right click = overlay #2 IF overlay #1 is true, right click = overlay #3 IF overlay #2 is true, etc) 

I'm sure you could make an ACTUAL counter string in mCreator, it would just require a bit of code editing that I'm assuming you're not looking to do ;P