Storing Formulas in unicode/non-latin characters

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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.
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
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...)
 
Last edited by a moderator:

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
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
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
so would that work (with my example) like

Code:
class Game_Character < Game_CharacterBase  def Mf   return (v[3]%v[1])+(2*a.mat)   endend
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
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.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
I tried to plug this in



but no matter what, the enemy still takes no damage, what am i doing wrong?

Edit, also here it is in context

 
Last edited by a moderator:

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
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.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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.
 
Last edited by a moderator:

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
Read my answer above...

Could it be simpler than that?

What's the point of asking when you don't read other answers?!?!?
 
Last edited by a moderator:

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I tried to plug this in





but no matter what, the enemy still takes no damage, what am i doing wrong?


Edit, also here it is in context


If that is your exact code, it's not going to work, because you don't have the change to game variables happening within a class or method. It will run that as soon as you launch the game - in fact I'm surprised it doesn't crash because those variables are undefined.


Also, v is not an attribute of Game_Character. It is used only in the damage formula.


a is a Game_Battler, not a Game_Character.


You need to spend more time looking at what classes are used during a battle, or rather what classes use the damage formula. And make sure your changes are made within class methods, and within the correct ones.
 
Last edited by a moderator:

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
Oops, I forgot...

I wasn't testing this code so, you may want something like this :

Code:
class Game_Battler < Game_BattlerBase  def Mf    return ($game_variables[3] % $game_variables[1]) + (2 * @mat)  endend
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
I still can't get it to work. I don't get it...
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
If you do a script call (do not edit it in a script!) to this :

Code:
puts $game_actors[1].Mf
Look carefully at the console, and tell us what you see. If you encounter an error, tell us the error, but if you don't and damage is still 0, then something in your formula is wrong...
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
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
 
Last edited by a moderator:

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses
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...
Nah, Ruby is fine with it.

Also:

Code:
​='hello world'puts ​
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
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.
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
569
Reaction score
153
First Language
Serbian
Primarily Uses
N/A
Oh, yeah... I didn't check any of this code, again, so I *think* this will work :

Code:
class Game_Battler < Game_BattlerBase  def Mf    return ($game_variables[3] % $game_variables[1]) + (2 * mat)  endend
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top