The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => MUGEN Class => Topic started by: Odb718 on September 22, 2015, 03:57:15 am

Title: VarAdd (SCTRLs)
Post by: Odb718 on September 22, 2015, 03:57:15 am
Adds to one of the player's working variables. Either a float variable or an int variable can be added to by this controller.

Required parameters (int version):
    v = var_no (int)
        var_no specifies the number of the variable to affect. It must evaluate to an integer between 0 and 59.
    value = int_expr (int)
        int_expr specifies the value to add to the int variable indexed by var_no.

Required parameters (float version):
    fv = var_no (int)
        var_no specifies the number of the variable to affect. It must evaluate to an integer between 0 and 39.
    value = float_expr (float)
        float_expr is the value to add to the float variable indexed by var_no.

Optional parameters:
    none in both cases
Alternate syntax:
    var(var_no) = int_expr (int version)
    fvar(var_no) = float_expr (float version)
Notes:

    Due to historical reasons, note that the alternate VarAdd syntax listed above matches neither the syntax for variable assignment within an expression, nor the syntax for variable addition within an expression.

    If you have placed P2 in a custom state through a successful hit, do not use variable assignment within the custom states. Otherwise, you will overwrite P2's variables, which can cause unintended malfunction of the opponent player.
Example:
Code:
[State 0, VarAdd]
type = VarAdd
trigger1 = time = 1
v = 1
value = -3

Related SCTRL: 
VarRandom (SCTRLs) (http://mugenguild.com/forum/topics/varrandom-sctrls-169279.0.html)
VarRangeSet (SCTRLs) (http://mugenguild.com/forum/topics/varrangeset-sctrls-169277.0.html)
VarSet (SCTRLs) (http://mugenguild.com/forum/topics/varset-sctrls-169278.0.html)

Related Triggers:
Var and FVar (Triggers) (http://mugenguild.com/forum/topics/var-and-fvar-triggers-169438.0.html)
SysVar (Triggers) (http://mugenguild.com/forum/topics/sysvar-triggers-169234.0.html)
SysFVar (Triggers) (http://mugenguild.com/forum/topics/sysfvar-triggers-169870.0.html)
StageVar(*,***) (Triggers) (http://mugenguild.com/forum/topics/stagevar-triggers-169871.0.html)

Related CNS:
IntPersistIndex & FloatPersistIndex  -  Player Variables (CNS) (http://mugenguild.com/forum/topics/player-variables-cns-169341.0.html)