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
695
Reaction score
451
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,201
Reaction score
853
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.

Latest Threads

Latest Posts

Latest Profile Posts

"sorry it took me so long to respond" - can we please agree not to say that anymore unless it actually took a long time?! (Like 36hrs at least) I mean, I'm running out of funny responses here xD
Ugh... 4:53AM over here and I can't sleep so why not just game make.
I just love the MV feature that allows you to create your own animations!
I typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!

Forum statistics

Threads
115,912
Messages
1,093,929
Members
151,163
Latest member
stulfie
Top