Help with state mechanic (upgrading states and Tsukihime's Conditional State)

hram

Villager
Member
Joined
Oct 2, 2022
Messages
13
Reaction score
11
First Language
Portuguese
Primarily Uses
RMVXA
Hello, everyone!

I'm looking to create this specific mechanic:

If enemy is hit with a weakness, apply state 1.
If enemy is hit with a weakness again, applies state 2. Removes state 1. That can happen 3 times, from state 1 to state 4, which is the last one.

For applying a state when the enemy is hit with a weakness, I'm using this in the damage formula b.element_rate(element_id) > 1 ? b.add_state(state_id): damage. For the state upgrade, I'm using Tsukihime's Conditional State (can be found here) and the following formula:
<conditional state>
if a.state?(state1)
state2
else
state1
end
</conditional state>

So I have 2 questions/requests:

1) that applying state formula in the damage formula seems clunky. Is there any other way to do it? (if not or this is the best way, I'm happy to use it because it worked, but I'm afraid it can be troublesome later)

2) I wasn't able to make state2 upgrade to state3 and so on when applying state1 again. How could I do it?

Thanks in advance!
 

hram

Villager
Member
Joined
Oct 2, 2022
Messages
13
Reaction score
11
First Language
Portuguese
Primarily Uses
RMVXA

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
45,990
Reaction score
16,776
First Language
English
Primarily Uses
RMMV

I've moved this thread to RGSSx Script Support. Thank you.

 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,819
Reaction score
1,368
First Language
English
Primarily Uses
RMVXA
What you have should be fine. I don't have any scripts that do what you want specifically.
So keep going with what you have.
However I'm curious to know if you have it set the way TsukiHime describes in the script?
If so then this would be on state 14
<conditional state>
if a.state?(12)
13
elsif a.state?(11)
12
elsif a.state?(10)
11
else
10
end
</conditional state>
 

hram

Villager
Member
Joined
Oct 2, 2022
Messages
13
Reaction score
11
First Language
Portuguese
Primarily Uses
RMVXA
Oh, it worked! I got the syntax and the order of states wrong lol
There's still some things to figure out, but I guess I can do it on my own. Thank you so much for the help!!!
 

Latest Threads

Latest Profile Posts

Ooops ended up trying out making my own A2 tile page instead of testing doors everywhere. Went well so far I think.
I guess I'm done making a blue squirrel's life difficult for posting new threads on different forums.
That's just for today so don't get used to this, squirrel-ish friend! :p
Got new hard drive, now trying to install the softwares I lost to the dead drive, and more than half of them won't install because they're already installed on the dead drive, and uninstallers won't run because they can't find where their programs are installed. So I take it having a drive die on you screws you in more ways than just data loss. >:\
PC got fixed finally. Back online again. Turns out I have no business trying to self repair pcs because it was getting to like 176F / 80C. Shop installed a totally new cooling system and now it runs fine and is super quiet.
When you're making major progress, but have to stop to go to work.

Forum statistics

Threads
131,487
Messages
1,220,216
Members
173,225
Latest member
ZecaVn
Top