Please help this scripting noob

Status
Not open for further replies.

Ultima01

Unhinged
Veteran
Joined
Mar 13, 2013
Messages
69
Reaction score
11
First Language
English
Primarily Uses
N/A
I am having problems with the below script, intended to check for the critical flag when called from the formula box.
 
  def is_this_critical?
    if @result.critical
      true
    else
      false
    end
  end
 
As an example, I'm using one of the formulas for an attack that ignores DEF on critical hit.
 
( is_this_critical? ) ? a.atk * 4 : a.atk * 4 - b.def * 2

When I call it in the formula box though, the skill suddenly does no damage whatsoever.  What am I doing wrong, and where?
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
There is already a critical system in RPG Maker.

So... I'm curious as to what your purpose is?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Two problems with this.


Why do you want to create a method when you could just say

@result.criticalfor exactly the same thing?
@result.critical doesn't get set until after the damage formula is evaluated. So it will ALWAYS be false and the second part of the equation would be returned.


As to why it's always doing no damage ... what are the ATK and DEF values of your actor and target respectively?
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
Code:
b.result.critical ? a.atk * 4 : a.atk * 4 - b.def * 2
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Doesn't change the fact that critical is not set until AFTER the damage formula has been evaluated, so is of no use IN the damage formula.
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
critical is set before damage formula is evaluated
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
wow, you learn something new every day. I would have thought critical would be based somehow on the actual damage caused. That means you can get really low hits that are critical, and much higher hits that are not. Maybe I just misunderstand what "critical" means ...


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,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top