# MV-equivalent of VX formula

#### Indinera

##### Indie Dev
In VX you could use the following line in the damage formula of a skill to apply a buff on a character:
(just an example)

This doesn't seem to work anymore in the damage field of MV. Is there any equivalent for it?

[a.atk*1-b.def*1, 1+rand(2)].max
(again, just an example)

This was working on Ace but no longer is on MV. Any equivalent?

And finally (sorry for the many questions) what is the way (if any) to use a variable and to test a condition (for instance if a switch is on) through the damage formula?

#### caethyril

##### ^_^
(Original - rpgmakercentral)

Give the skill user a 3-turn buff to param 2 (atk):
Code:
``a.addBuff(2, 3);``
Code:
``a.addBuff(2,3); a.mat*1.5-b.mdf*1``

Get a random number from 0~1:
Code:
``Math.randomInt(2)``
Code:
``Math.max(a.atk - b.def, 1 + Math.randomInt(2))``

Get the value of game variable 15 (these two lines are equivalent, first one is a shortcut for the damage formula box):
Code:
``v[15]``
Code:
``\$gameVariables.value(15)``
Get the value of game switch 8:
Code:
``\$gameSwitches.value(8)``
Return 100 if switch 8 is on, else return 10:
Code:
``\$gameSwitches.value(8) ? 100 : 10``
Or you can use an "if" statement, e.g. do the addBuff thing above only if the value of variable 15 is more than 20:
Code:
``if (v[15] > 20) { a.addBuff(2, 3); }; a.mat * 1.5 - b.mdf``

Last edited:

You're welcome!

### Latest Profile Posts

Here we are....REMIND is out and what am I doing?
Still Playing Kingdom Hearts 3.....
Escort quest is one of the worst quest ever because the AI tend to be suck and suicidal.
AddCancelCommand, AutoshadowEx, BgImageScreenShot, BindEvents, ChangeEventGraphic, DroppingGame, EscapeCodesEx, EventTriggersEx, FortuneCookie, GameoverEx, InputEx, InsertValues, LastCalledEvent, LevelUpEx, MapData, MemoryGame, MessageSetSwitch, MogCharPosesEx, MonstersCaught, MovementEx, ...
... continued below...
Feeling playful.