Adding the same state after first removing it

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
This was giving me some problems yesterday.  I thought I had figured it out - and while I did identify the problem, I still don't understand why it occurs.  So I'm hoping someone can enlighten me about this.  And I'm going to try and do this without posting a screen shot so people don't have to wade through a morass of variable conditions since I already know where the problem is.  But if posting one becomes necessary I will.

It seems that when removing and adding states on this program - if I try to add the same state after first removing it - the command doesn't function. 

Conditional Branch: [1. ] is [stateA] Inflicted

Change Enemy State: [1. ], - [stateA]

Branch End

Change Enemy State: [1. ], + [stateA]

In this example, if StateA is inflicted I remove it.  Then I attempt to apply it again - but for some reason I don't understand it doesn't let me add the identical state I just removed.  Is this normal?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You're talking about enemies, so this is in a troop tab? I just tried it, and it removes it once only, and then continues to add it. Are you sure it's removing it in the first place?


Please post a screenshot of your troops tab, with the code you have above visible.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
You're talking about enemies, so this is in a troop tab? I just tried it, and it removes it once only, and then continues to add it. Are you sure it's removing it in the first place?

Please post a screenshot of your troops tab, with the code you have above visible.
I'm pretty sure it's removing it.  I have a conditional branch after I remove it that triggers a text message if no States are inflicted, and the message comes up.  It's hard for me to show you the screen shot you describe, because my event is layered in common events but I will attempt it to show it in pieces.

Screen Shot.png

This is my troop tab.  At the bottom you'll see a common event called Troop1:Trait.  It looks like this:

Screen Shot_1.png

Before I add the State you will see two common events called Show E:Stances and Remove Stances.  They look like this:

ScreenShot_2.png

ScreenShot_3.png

The [show E:Stances] event is mostly just for testing purposes and just tells me when a State is inflicted or when no states are inflicted.  So you can probably ignore that one.  But I included it just in case you wanted to see it.

The [Remove Stances] is the event that actually checks if a state is inflicted them removes it.  But it's going to be important for you to keep in mind when viewing that event that I made some changes to it since I made this thread that might complicate this some. 

Since I was unable to add "Thrusting Stance" to my enemy if "Thrusting Stance" was inflicted before I removed it, I created a work around and do a check to see if Thrusting Stance was on the enemy previously.  If it was I don't remove it, because I was unable to figure out how to add the same state after I remove it.  So when you look at that event try to imagine it without the two conditional branches that check my Random Tactics Variable.  The ones underneath the comments ====If Thrusting Attack NOT Being Used ====If Thrusting Attack IS Being Used====.  I added those conditional branches as a work around since I couldn't for the life of me figure out why I couldn't add the same state after I just removed it.

Thanks for trying to help me.  It's weird it works for you but not me.

Edit#

To make things easier I rewrote the event in it's original form without the work-around conditional branches.  Maybe easier that way to see if you can figure out why it isn't working.

Screen Shot_4.png
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
btw, what would you want to achieve via removing a state then adding it again right away?
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
btw, what would you want to achieve via removing a state then adding it again right away?
It doesn't happen because I'm trying to achieve anything.  The way my battle event works is it randomly selects States to inflict on the enemy.  But I only want one of them to be inflicted at a time.  So I have a common event that removes all of the inflicted States before adding a new one.  Sometimes - due to the random nature of it - it ends up inflicting the same state on the enemy back to back.  And when that happens - for some reason I don't understand - the Change/Add State command doesn't work after my common event removes the inflicted state.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Try adding a Wait 1 Frame in there.


As I said, when I did the test, it added the state, then removed it, then added it, then it kept on adding it. It didn't remove it a second time for me.


So that might indicate that it WASN'T adding the state for me either. Maybe you need to let it come up for air between removing and adding.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
Try adding a Wait 1 Frame in there.

As I said, when I did the test, it added the state, then removed it, then added it, then it kept on adding it. It didn't remove it a second time for me.

So that might indicate that it WASN'T adding the state for me either. Maybe you need to let it come up for air between removing and adding.
Guess I misunderstood you then. I thought you were saying it was working.

I tried the Wait 1 Frame idea and it was a no go.  I tried 60 frames just to be safe, and still didn't work.  So I don't think it's an issue with the event moving too fast for the program to keep up.  It may be a bug in the code or something?  I don't know.

At first it was a serious problem.  Now it's more of a nuisance since I have found a work around.  Though a lot of my make-shift fixes can come back to haunt me later on as the code matures.  I hope that's not the case with this one.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top