Rpg maker mv damage formula
We’ll use the if method and then use the rand(x) method which returns a number from 0 to x-1 meaning we will add 1 to it to simulate dice. This one has a lot in it so we’ll look at it closely. It does double if he rolls a double and 10000 if he rolls snake eyes. he rolls two six sided dice, the skill does 100 times the combined number of the faces. Scenario: I have a gamber and I want him to use dice skills e.g.
#Rpg maker mv damage formula how to#
Here’s how to do 10 times the value of the variable. Scenario: I have a skill whose power I want to control through a variableĮasy enough. I’ve also included in it an example of how to include the default formula so you can see how to incorporate it. Scenario: You have a thunder skill which doors more damage when outside, which you control with a switch So let’s just talk it through, if Eric gain 200HP, if Natalie add status number 2 (poison) otherwise restore 100HP. So it was a bit more complicated this time so I went the route of the if statement, elsif is a way of checking another condition if the first one wasn’t met. If b.id=1 200 elsif b.id=2 b.add_state(2) 0 else 100 end So the way I’m going to implement it is that Eric gets a bonus 100 health when he eat the sandwich but Natalie is afflicted by poison when she eats one. Scenario: One character’s favourite food is peanut butter sandwiches but another character is allergic to peanuts. The other feature is the ors they act like you’d expect but be careful when using and because it has a bit more to it. I have omitted the spaces on both sides of = because when we’re space conscious they are wasted characters. (b.id=1 or b.id=3 or b.id=4) ? 500 : 0Ī couple of things I would like to draw your attention to. So the solution I offer just checks the ids again. There are some quite creative solutions to this problem but for the sake of this tutorial I want to keep is simple. Scenario: Half your party are demi-humans or robots and require different healing items than the rest of your party. I personally find having a lot of examples to work from quite helpful so this next section is going to be a problem and solution section and hopefully one of them will be close enough to what you hope to achieve that you can adapt it. Right so that concludes the explanation section of this tutorial. The last thing two things I want to say before moving on are firstly that for more complicated situations you are probably better going the if statement route and the last thing is that while the formula box is pretty powerful you need to be aware that it is capped at a certain length (let’s be grateful that we use a & b and not attacker & defender) and if there is an error in your formula the skill will just miss repeatedly rather than crash the game.
#Rpg maker mv damage formula code#
It still has the conditional, it is still checking if the item is being used on Eric but the rest of the code you could say has been condensed. The other version achieves the same result but might be a little less clear if you are not overly familiar with ruby. So what this means is when the character id equals 1, heal 500HP otherwise heal 100HP. Were we not restricted to a single line then we could have written it like this: If you’re confused about the presence of the semi-colons then let me quickly explain that they are like a way of inserting a new line.
If you’ve done any programming before you will recognise this as a standard if statement. Now let’s look at the rest of those lines. So essentially we are checking that the person who the item is being used on is first in the database (Eric by default). Please note that this example is about an item which should be usable on party members only and therefore b is always going to be an actor (party member in English). They both check a conditional statement, namely:įor the formula box in general a refers to the attacker or user and b refers to the defender or recipient, who may or may not be the same.Īny way what we are checking is that the recipient’s id is equal to 1. Let us first look at exactly what they are doing. That formula box alone has tremendous potential. RPG Maker Ace once again proves just how versatile it is because this feature can be implemented in a single input box.
So earlier today in rpgmaker’s irc chat the conversation moved to the scripts someone desired for their game which included:įavorite foods – i can specify each actors favorite food and when the item is used on them, they heal extra hp or somethingĪnyhow I pretty quickly realised a script was not needed to implement this feature.