Is there a way to dynamically change state rates?

mdqp

Veteran
Veteran
Joined
Jun 2, 2014
Messages
45
Reaction score
8
First Language
Italian
Primarily Uses
Let's say I wanted a skill to lose its effectiveness over time. Specifically, its stun effect should apply 100% of the times on first use, then 70% of the times on second use, then 40, then 10... You get the idea.

Is there a way to achieve this per enemy? A way to give them additional resistance to stun with each use, for example? Or any other way you can think of to emulate such behaviour in practice?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
technically yes, but it would be related to the definition of the battler (namely the loading of properties as the battler is created) and it may become messy.

what you could do, which should be much easier to change if you have to, is create a number of states controlled by a common event and a bunch of variables.
on the first attack, you call the common event, the event checks for resistance, and adds the full effect.
second attack, call the common event, the common event finds the full effect, cancels it, and applies the lesser effect.
maybe with some further planning, you won't even need actual states, you could make a state on the fly according to a variable that would keep count of how much resistance that battler has.
since "resistance" is based on percentage, you'd always multiply the same number by the same factor, and it'll further reduce itself: 100 * 0.8 = 80, * 0.8 = 64, * 0.8 = 51 etc
 

mdqp

Veteran
Veteran
Joined
Jun 2, 2014
Messages
45
Reaction score
8
First Language
Italian
Primarily Uses
...you won't even need actual states, you could make a state on the fly according to a variable that would keep count of how much resistance that battler has.
I am sorry, how would you make a state on the fly? I know I could obtain this effect through common events and creating multiple states, but I figured this would create an excessive number of common events and states (if I ever wanted to extend it to other states), so I was wondering if there was a simpler way.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
I am sorry, how would you make a state on the fly? I know I could obtain this effect through common events and creating multiple states, but I figured this would create an excessive number of common events and states (if I ever wanted to extend it to other states), so I was wondering if there was a simpler way.
Just guessing, but I believe you can create a new state directly at run time, and edit it's properties.
All states are State objects, and the properties are Feature objects, which are numbered according to what specific bonus they give.
The number ID, the amount, the target battler, the effect and the duration, they're all gather-able from various functions, so it's all a matter of tapping into the correct functions.
You could create a new object State as it comes, and then add a new Feature to it, based on the resistance you're monitoring.
Again, just theorizing because I've never done it myself, but it should be possible, because that's what happens as the game runs normally.

And you only need one common event, not multiple.
Provided you structure it correctly, you only need to pass a variable to it that would say how much you want a resistance modified (and which resistance out of the lot, if you want), and the event will do the calculations by itself.
This, I have done, so I know it can be done.
With this procedure, you could make it so that it doesn't need states at all: you could tap directly into the battler's properties and edit them accordingly (which is the most invasive method, but it's closer to what you wanted from the beginning without editing the source code directly)
 

mdqp

Veteran
Veteran
Joined
Jun 2, 2014
Messages
45
Reaction score
8
First Language
Italian
Primarily Uses
So you are suggesting to script it from beginning to end in the common event, am I understanding you correctly? I guess I'll have to take my time to think it through.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
yes and no.
you can make the calculations part with the controls of the editor, but you'll need plain scripting to create the states (if you even want to) and assign the objects.
creating the state is nothing more than
Code:
state = RPG:State.new()
state.property1 = value
state.property2 = value
state.property3 = value
etc
it's not that hard to code.

for the calculations, you'll need scripting to grab the target battler and the active battler.
once grabbed, you can put them into regular variables and use the regular controls to operate with them.

*doing it* is not hard, because it's already done: it's how the game works.
*grabbing the data you need* is the hard part.
 

mdqp

Veteran
Veteran
Joined
Jun 2, 2014
Messages
45
Reaction score
8
First Language
Italian
Primarily Uses
I see. Thanks for your help! :)
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D

Forum statistics

Threads
106,051
Messages
1,018,551
Members
137,837
Latest member
Dabi
Top