Damage calculation in ability descriptions

Status
Not open for further replies.

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
The script is very simple and does not support multiple evals, nested evals, or anything beyond a single statement.

It also doesn't support multiple convert codes within the same message.

I have no solution for that.

EDIT:

actually I just updated the script with something that might work.

The syntax is now

\eval{< YOUR FORMULA HERE >}Note the special delimiters.Still does not allow you to say something like

\eval{< \eval{< something }> }>But at least you can say

Code:
\eval{< first formula >} - \eval{< second formula }>
Obviously this is just a big hack to get things to work, but regular expressions are too limited to support bracket matching. These codes were never to meant to be anything complicated, with nested variables like

Code:
\n[\v[\v[3]]]
being the most complex kind of code nesting that you'd probably use (and even that doesn't work properly)The thing is evaluated recursively though, which is kind of interesting.
 
Last edited by a moderator:

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
Works great! I put in:

Deals \eval{<(($game_actors[1].mat*1.8+17)*0.8).to_i>} to \eval{<(($game_actors[1].mat*1.8+17)*1.2).to_i>} holy damage to a single enemy.
Deals additional 2% max HP over 2 turns.

And this is the result:



Thank you very much Tsukihime and Engr. Adiktuzmiko, this is exactly what I was hoping for. You've been a big help.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Seems to be working for me.

The script is just

class Window_Base < Window alias :th_convert_code_eval_convert_escape_characters :convert_escape_characters def convert_escape_characters(text) result = th_convert_code_eval_convert_escape_characters(text) result.gsub!(/\eEVAL{<(.*?)>}/i) { eval_convert_code($1) } result end def eval_convert_code(formula, p=$game_party, t=$game_troop, s=$game_switches, v=$game_variables) eval(formula) endendThe reason why the thing is on separate lines is because the engine doesn't automatically re-calculate the position of the text after replacement.You need a word-wrapping script to go and re-structure your message.
 
Last edited by a moderator:

Zevia

Veteran
Veteran
Joined
Aug 4, 2012
Messages
640
Reaction score
353
First Language
English
Primarily Uses
RMMV
Yeah, when I originally deleted the old script and put in the new one, it wasn't working right - but I deleted it again and put in the new one again, and it seemed to work just fine. I edited my post to show everything's working great.

I tried a word-wrapping script once, but I found it tended to mess with certain things I wanted my message windows to do. I just manually check all the line edges with everything. You can see in the screenshot that it displays perfectly now.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
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:

Forum statistics

Threads
105,855
Messages
1,017,007
Members
137,563
Latest member
MinyakaAeon
Top