I was wondering if, in order to streamline formulas for damage and custom objects, if its ok to store the value of a formula in a unicode character (like Japanese kanji or Greek letters). For example say i want to add a formula modifier that is exclusive to fire element skills, I want to know if its possible to store the modifier like so:
火 = (v[3]%v[1])+(2*a.mat)that way when I have a fire element skill instead of having to write all of that every single time, i could just plug it in as part of the formula (this is just an example though)
I wasn't sure if this went here or in RGSS3 so if its in the wrong place its ok to move it.
I think not.
Although Ruby was made in Japan, I think it does not support naming variables after japanese characters, because it would be very questionable what would happen on the lower level of the computer...
How would the larger formula look like?
Why don't you simply use q, p or even zhnj.
(I know, I would also very like that I could name my variables šerpa and turšija, but it's not how things work...)
It would be the basic damage formula plus a situational modifier. I wanted to see if i could simply narrow it down to one character. Though trying to test it out, i came up with a new problem, how do i bind a formula to a character in the first place? Its not working for me
If I understood correctly, 'binding a formula to the character' can be done like :
class Game_Character < Game_CharacterBase
# A simple formula that returns character's HP divided by 100.
def your_formula_method
return @hp / 100
end
end
Not really.
First, you need to have you v[] array defined.
What is v[]?
Next, you don't use a.mat, you use @mat.
Next, this is just a one-character formula, so you might want to define your formula as "myformula" in Game_Character, but in the damage formula you should put "a.myformula - b.myformula" or something like that.
Of course it takes no damage, because internal error happened, that means your Mf formula is wrong. What is your damage formula and try replacing v with $game_variables.
I wonder what is the problem. I plug the formula directly into the damage formula and it works (though i had ot replace modulus with multiply), but trying to call it from script and it fails.
If i can't make it work, i think i'll just save the formula tidbit in a file and just copy paste it.
Read my answer above...
Could it be simpler than that?
What's the point of asking when you don't read other answers?!?!?
I read the answer, but it still gives me the same result of no damage, no matter how many times and ways i move numbers around.
I still can't get it to work. I don't get it...
Nothing is showing up in the console. I think i may have to look into the scripting tutorials again before i come back to this
Just saying, there is no such thing as '@mat' in Game_Battler, nor in it's superclass, nor in Game_Actor/Game_Enemy.
You use 'mat' for that if you must, or 'param(4)'. 'mat' is a method defined in Game_Battler, not an instance variable.
Another thing to mention...
If your $game_variable[1] is 0, you will get a nice 'DividedByZero' error, so make sure to add a zero check for that part in your custom method as well.