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
46,014
Reaction score
16,832
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,826
Reaction score
1,372
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

I am new here first day ,how to make a game for google play store on Android I am using android mobile .I don't have coding knowledge too .so what are steps to create a game on mobile Android I don't have PC or laptop .any suggestions or guide please .
Does anybody want to get weirded out? If so, I have a weird fact for them in the top comments.
Creating the mood, coloring, and lighting for this gonna need a big brain moment.1685936069202.png

Forum statistics

Threads
131,654
Messages
1,221,912
Members
173,399
Latest member
xuprmpau
Top