[VX Ace] Help with Hime's conditional states script

Status
Not open for further replies.

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
Hello, I'm using Hime's conditional states script and I'm trying to create an attack adds a differente state depending of user's speed, the condition would be this (not sure if it's relevant, but it's a skill does damage as well):

if user's AGI/10 = to 1, it'd add the state id 11
if AGI/10 = 2, it'd add the state id 12
if AGI/10 = 3, it'd add the state id 13
if AGI/10 = 4, it'd add the state id 14
if AGI/10 = 5 or superior, it'd add the state id 15

I tried to implement it this way

Code:
<conditional state>
if (a.agi / 10) == 1
11
else
if (a.agi / 10) == 2
12
else
if (a.agi / 10) == 3
13
else
if (a.agi / 10) == 4
14
else
15
end
</conditional state>
However, when I use the attack, it's not applying any state at all, so I'm sure I'm making something wrong with this formula, could please someone help me to make a proper formula to apply those states? Thank you
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
681
Reaction score
446
First Language
English
Primarily Uses
RMVXA
A couple of things:
  1. Try adding .to_i at the end of each parentheses? E.g. (a.agi / 10).to_i. This turns the number into an integer.
  2. Do elsif rather than else then if:
Code:
<conditional state>
if (a.agi / 10).to_i == 1
11
elsif (a.agi / 10).to_i == 2
12
elsif (a.agi / 10).to_i == 3
13
elsif (a.agi / 10).to_i == 4
14
else
15
end
</conditional state>
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
I tested and it didn't work either, and now I checked, a. referes to target's conditions and I need it for user's condition checks, so that script won't help me at all, thanks anyways, but I'll ask for this script to be closed
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
An integer divided by another integer results in an integer by default, so no need to call to_i here.

I am surprised that you didn't get any crashes with that note-tag you tried, it has syntax errors (missing end lines).
Using elsif or case (I prefer case statements in these... cases :D) is what you should do here like mentioned above.

Ohh, I should refresh the page before answering, right? :D
But the provided code from above should work. But if it's not what you need (you want to check the user's stats, right?), no point in investigating further, I guess.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
An integer divided by another integer results in an integer by default, so no need to call to_i here.

I am surprised that you didn't get any crashes with that note-tag you tried, it has syntax errors (missing end lines).
Using elsif or case (I prefer case statements in these... cases :D) is what you should do here like mentioned above.

Ohh, I should refresh the page before answering, right? :D
But the provided code from above should work. But if it's not what you need (you want to check the user's stats, right?), no point in investigating further, I guess.
Well, now you mention it, I'm surprised as well hahaha

But I made a mistake about this thread, I thought a refered to caster's conditions (which is what I need to check) but actually it means target's conditions, so trying to solve it this way won't help at all...
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
First Language
Español
Primarily Uses
RMVXA
After I checked the damage formula I put as script to create a base formula, I decided to test adding some checks, with satisfactory results

Code:
#-------------------------------------------------------------------------------
#Conditional state magical attack (Defense check)
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Game_Battler < Game_BattlerBase
  def state_magic(a, b, base, state_chance, state)
#---------------------------------------------------- 
#Damage Formula
#---------------------------------------------------- 
    x0 = base * 4
    dmg = x0 + ((a.level * a.mat * base) / 32)
    dmg *= ((100 - b.mdf) / 101.0)
    dmg += 1
#---------------------------------------------------- 
#Check user's AGI to increase state's ID
#---------------------------------------------------- 
    if (a.agi / 10) == 2 then state += 1 end
    if (a.agi / 10) == 3 then state += 2 end
    if (a.agi / 10) == 4 then state += 3 end
    if (a.agi / 10) >= 5 then state += 4 end
#---------------------------------------------------- 
#Adding the state (checking LUK's effect and state rate
#----------------------------------------------------
    chance = state_chance
    chance *= b.state_rate(state)
    chance *= b.luk_effect_rate(a)
    b.add_state(state) if rand(100) <= chance
    return dmg.round.to_i
  end
end

Basically I put all the necessary stats together in database as you can see in next picture, and I chose as base state id the first one (14 in this case)

Database.png
After that, I added the agility checks and I made each one increase base state id depending of the result. This formula could be optimized I guess but for now is a satisfactory result
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
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'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top