Trying to create a stacking state.

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
324
Reaction score
75
First Language
English
Hi everyone,

I'm trying to replicate a little mechanic from the game Final Fantasy X, whereby a character's skill can stack on the enemy up to 5 times.

For example, I'm trying to come up with a skill that applies a state to an enemy that adds the trait of "Parameter - Defense 105%", which from what I understand, will reduce the enemy's DEF stat by 5% (not taking into other potential factors, anyway).

This is all good and well, but the next steps would be to

A ) Make this stack-able

and

B ) Make sure that after this has been applied to the enemy 5 times, there is no longer any advantage of using this skill on the same target again.

The idea is that it would remove 5% DEF each time, making a total reduction of 25% from their original DEF stat possible.

Open to using plugins, if anyone has any solutions.

Thanks!
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
542
Reaction score
255
First Language
German
Primarily Uses
RMMV
first thing:
"Parameter - Defense 105%",
i think that adds 5% def
(Parameter - Defense 95% should reduce 5%)

second thing:
The idea is that it would remove 5% DEF each time, making a total reduction of 25% from their original DEF stat possible.
I think it woks better to use different States, and the "stack counter" Variable should decide which state gets added..
for example.. :
-if "stack counter" Var = 1 add State with Parameter - Defense 95%
(and remove any other Parameter - Defense State if affected)
-if "stack counter" Var = 2 add State with Parameter - Defense 90%
(and remove any other Parameter - Defense State if affected)
.. and so on, ect.


EDIT 2 ( i figured out a better way to solve this in a Common Event)
In that Case you want the State to change with each Skill Usage, you can do that with using a Common Event which is attached to The Skill
JavaScript:
var target = ???

if (target.isStateAffected(4)) {
     target.addState(5);
     target.removeState(4);
};

if (target.isStateAffected(3)) {
     target.addState(4);
     target.removeState(3);
};

if (target.isStateAffected(2)) {
     target.addState(3);
     target.removeState(2);
};

if (target.isStateAffected(1)) {
     target.addState(2);
     target.removeState(1);
};

if (!target.isStateAffected(1)) {
    if (!target.isStateAffected(2)) {
        if (!target.isStateAffected(3)) {
            if (!target.isStateAffected(4)) {
                if (!target.isStateAffected(5)) {
                    target.addState(1);
                }
            }
        }
    }
};
You need the right Code for the var "target" ..
(in SRPG that would be :
"$gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1];"
,
but i dont know the Similar Code for normal RPG Projects..sry)

if that is solved , this Code above will ask about, what state is affected and add or remove The States how its needed
(EDIT INFO, the right order/sequence is important to avoid unwanted chain reaction)
- if State 4 is affected it will remove it and add State 5
- if State 3 is affected it will remove it and add State 4
- if State 2 is affected it will remove it and add State 3
- if State 1 is affected it will remove it and add State 2
- if none of the 5 states is affected it will add State 1, that should happen at the End of the Common Event.


Edit 3
If you cant figure out the Code for "var target" ,you could also use the Plugin Hime placeHolder States instead.
 
Last edited:

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
542
Reaction score
255
First Language
German
Primarily Uses
RMMV
sry for double posting i had to edit the previous Code, because the order in which the Script Parts are set is Important to avoid a Chain Reaction which isnt wanted.
I just wanted to make sure this Issue is recognized..
( thats why the Code Now ask&remove first state 4&adds5 if affected, than 3&adds4 if affected than 2&adds3 if affected than 1&adds2 if affected.. and set State 1 at the end if none of the States is affected )
 
Last edited:

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
324
Reaction score
75
First Language
English
Hi there again @Dopan ,

Yes, this may work. The script call in question is:

Code:
BattleManager._action._targetIndex
I'm going to give it a test.

However - and I just saw your second message - the conditional branch segment still confuses me a bit.

At no point does it check "If enemy does NOT have state", so I think I need to start there, right?
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
542
Reaction score
255
First Language
German
Primarily Uses
RMMV
At no point does it check "If enemy does NOT have state", so I think I need to start there, right?
sure it Does thats the last Code part.. this one:
(thats why that part has to be at the end to avoid chain reaction which could be started with adding state 1 to early)
-> i realized later that all other code parts needs also to be in the right order ,because of the same reason

JavaScript:
if (!target.isStateAffected(1)) {
    if (!target.isStateAffected(2)) {
        if (!target.isStateAffected(3)) {
            if (!target.isStateAffected(4)) {
                if (!target.isStateAffected(5)) {
                    target.addState(1);
                }
            }
        }
    }
};
Puting " ! " before " target.isStateAffected(2) " for Example means:
" NOT target.isStateAffected(2) "
! negates the target.isStateAffected(2)
 
Last edited:

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
324
Reaction score
75
First Language
English
Ah! Certainly, I missed that. Sorry! Thanks a bunch!

Secondly, I decided to change the DEF parameter to elemental resistance instead.

So I changed the states to:

State #1: 105% Element X
State #2: 110% Element X
State #3: 115% Element X
State #4: 120% Element X
State #5: 125% Element X

That makes sense right? Because in the case of elemental resistance, the higher the number, the greater the weakness to that element. That all makes sense right?
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
542
Reaction score
255
First Language
German
Primarily Uses
RMMV
That makes sense right? Because in the case of elemental resistance, the higher the number, the greater the weakness to that element. That all makes sense right?
I think yes , atleast thats what the system says when hovering over it^^
i hope it works but i think it should anyway^^
 

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
324
Reaction score
75
First Language
English
Hi again @Dopan ,

I did the test, but the state doesn't even seem to be applying to the enemy. I added an animation to the state to make sure it was at least applying, but that doesn't seem to be the case. Perhaps the code for the enemy index is not working.
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
542
Reaction score
255
First Language
German
Primarily Uses
RMMV
Hi again @Dopan ,

I did the test, but the state doesn't even seem to be applying to the enemy. I added an animation to the state to make sure it was at least applying, but that doesn't seem to be the case. Perhaps the code for the enemy index is not working.
If you cant figure out the target part try hime Placeholder states, you have to Setup them in a similar way like its explained earlier for the Common Event..
(that plugin allows to use state notes to make conditions what state gets affected,but its a bit tricky to setup to get a longer chain)
Both solutions should work..

also if something doesnt work you can also always hit F8 to open the console and look if there is an error that gives some extra info
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,455
Members
137,821
Latest member
Capterson
Top