News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Variable shared by multiple helpers

Started by SaltAddict, June 10, 2016, 11:15:48 PM

Previous topic - Next topic

SaltAddict

So, I have a beam move, and I divided the actual beam into three helpers:
The first helper is the start of the beam.
The second helper is the end of beam.
The third helper is a part of the trail of the beam, and a new one is created every tick by the second helper to form a trail.

All of the helpers have hitboxes.

I want the beam as a whole to deal exactly seven hits. Is it possible to share a variable between the three to store the number of hits?

Cyanide

Well, you can redirect the variable at the parent assuming your character creates all 3. Or you can uniquely ID each helper and when

helper(0), var(1) + helper(1), var(1) + helper(2), var(1) >= 6

Stop.

Alternatively, target, gethitvar(hitcount) >= 6 should also work iirc.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

SaltAddict

Quote from: Cyanide on June 11, 2016, 12:42:55 AM
Well, you can redirect the variable at the parent assuming your character creates all 3. Or you can uniquely ID each helper and when

helper(0), var(1) + helper(1), var(1) + helper(2), var(1) >= 6

Stop.

Alternatively, target, gethitvar(hitcount) >= 6 should also work iirc.


My character doesn't create all three. The character creates the first helper, which creates the second, which creates the third. Isn't there a way to check the variables of the parent?

Cyanide

Check, yes. Set, no. Not for the root. No rootvarset, only parentvarset.

If you wanted to do that you have to cascade parentvarsets, it takes extra ticks, in which time another projectile could hit.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

SaltAddict

Quote from: Cyanide on June 11, 2016, 02:48:33 AM
Check, yes. Set, no. Not for the root. No rootvarset, only parentvarset.

If you wanted to do that you have to cascade parentvarsets, it takes extra ticks, in which time another projectile could hit.

I found a way to make it work. Thank you for your help.