State Add/Remove Commands

Anruth

Villager
Member
Joined
Jan 19, 2014
Messages
17
Reaction score
0
First Language
English
Primarily Uses
Hi, Shaz.

Thanks for the quick reply.

No the test message doesn't print to the console and there are no line breaks in the note tags.

That is why I think the script is being interfered with by another.

As for applying it during battle ... No, to test I was just applying the state with a skill outside of battle. The state applies but the note tags don't.

But creating "battle" skills was exactly what I wanted to do with the script.

Example: Focus Attack - Adds +10 to the actors Attack for 3 rounds.

I prefer to add a constant to the parameters instead of percentages through buffs.

So, I guess I'm back to square one.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
I wonder if one of the other scripts is completely changing what happens when states are added. You SHOULD at least see the console output. Are you just using the Change Actor State event?


Can you do a global search (control+shift+f) for def add_new_state and see how many scripts redefine it? There should be at least Game_Battler and SHAZ - State Commands. If there are any others, then yes, there may be incompatibilities between the scripts. There could also be incompatibilities if other scripts have changed the methods that previously called Game_Battler.add_new_state to no longer call it. That could certainly explain why NOTHING is happening.
 

Anruth

Villager
Member
Joined
Jan 19, 2014
Messages
17
Reaction score
0
First Language
English
Primarily Uses
Hi, Shaz

Yea, in the common event I'm just using the Change Actor State event. Which now that your asking I guess I could change the parameter right in the onadd: command, if I can get the script to work. That way it won't need to run a common event during battle processing. 

I did a search as you suggested and found that the following 3 scripts have the def add_new state method:

Game_Battler

Yea - Battle Engine

And Your script.

So my guess is the Yea - Battle Engine is messing with it.

This weekend I'll start a test project without the YEA - Battle Engine and I'll bet it works.

Then I just need to figure out how to get your script to point to the def add_new_state in the Yea - Battle Engine script.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
Just disable the YEA Battle Engine temporarily, give the state to your actor on the map, and see if it works. If it does, then it's likely something about the battle engine script and mine conflicting.
 

Super121830

Play-fighter
Veteran
Joined
Jul 24, 2014
Messages
107
Reaction score
55
First Language
Spanish
Primarily Uses
I need a hand with removing states.

States A and B nullify each other, like this:

When using a skill that applies A.
If B is not applied, add A.

If B is applied, remove both A and B, or directly not add A and delete B.

When using a skill that applies B.
If A is not applied, add B.

If A is applied, remove both B and A, or directly not add B and delete A.

How it's possible to do this?
 

geoffok

Villager
Member
Joined
Dec 7, 2013
Messages
9
Reaction score
2
First Language
English
Primarily Uses
I was wondering if you could help me out.

What I am trying to do:

After a state wears off of the target a spell is cast damaging the target and its allies. Like a time bomb or something

*Edit:

I got it.

Used onremove: $game_temp.reserve_common_event(x)

and used a force action in the common event for the spell I wanted to cast
 
Last edited by a moderator:

Miyoko

Villager
Member
Joined
May 9, 2014
Messages
19
Reaction score
0
First Language
English
Primarily Uses
I seem to be having the same issue as Zero was earlier. Neither onadd: remove_state(id) or onadd: erase_state(id) seem to do anything... Am I missing something obvious?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
Can you zip up your project and load it up somewhere for me to take a look at?
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
252
Reaction score
65
Primarily Uses
Is there any way to get this to trigger on death? For example, a move where enemy does X if left alone for an amount of turns, Y if they die before that specified turn was met. So far I'm using:

onremove: if hp_rate = 0; $game_temp.reserve_common_event(33); else; $game_temp.reserve_common_event(34); end;However, when the enemy dies, it never calls common event 33, it just continues on.

This script is beyond incredibly useful, by the way. Absolutely excellent.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
It probably doesn't happen because the state is not removed on death - is it?


I don't see an option to remove a state on death - does it exist? The closest I can find is damage, but it doesn't let you state how much damage.


I think that'd be a new script, if there's not already a way to do it.
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
252
Reaction score
65
Primarily Uses
I didn't think it happened either, however when I googled it this script

http://rpgmaker.net/scripts/200/popped up. So, as far as I can tell, it DOES remove states on death, it just doesn't process anything regarding the script?

Edit: ah, you mean the "remove by restriction" thing that death would cause. I'd try it, but I ended up using a different method. Thank you for your speedy response regardless! :)
 
Last edited by a moderator:

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
252
Reaction score
65
Primarily Uses
I seem to be having the same issue as Zero was earlier. Neither onadd: remove_state(id) or onadd: erase_state(id) seem to do anything... Am I missing something obvious?
I can confirm I'm having issues with "onadd" commands. SPECIFICALLY "onadd" commands.

onadd: $game_variables[72] +1onadd: p 'state added'The above does not work.

onadd: $game_variables[72] +1;onadd: p 'state added';Nor does this. Can't get it to call a common event, either. However, onremove works absolutely fine.

https://drive.google.com/file/d/0Bz2RmvCWmPrhVTFsY0tTR3ladm8/view?usp=sharing

The above is a demo of the situation, no scripts installed except for this one. The state is added via consumable item.

Edit: Also, the statement that "common events don't run in battle" is completely false in my testing. You can call a common event in battle without any issues. Whether or not it *does* anything depends on the structure, but I've personally used it countless times to "force action."
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
$game_variables[27] += 1


Yes, you can CALL a common event in battle. Common events set to parallel process or autorun will not run in battle.
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
252
Reaction score
65
Primarily Uses
$game_variables[27] += 1

Yes, you can CALL a common event in battle. Common events set to parallel process or autorun will not run in battle.
Ah, ok. Must've misread while skimming the thread lol.

onadd: $game_variables[27] += 1

also does not work. Thanks for the correction on the syntax fail, though :)

Honestly, I can't see a reason why onadd's don't work. Same code in the script as onremove, which work fine. Thought it was a script conflict, but the problem is reproducible with just this script in a blank new project. I'm at a loss.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
Strangely enough, it looks like lines 64 and 65 are in the wrong order in the script. The way it currently is, EVERYONE who is trying to use this version of the script to add states would be having issues.


I cannot figure out why I put them in that order. I know there was a problem with resist_states and I may have changed the order to solve that issue, but there's no note in the thread here or in the script comments or revisions to indicate that I ever did that (and I don't recall writing a solution).


So, for the time being, please just swap those two lines around in the script, and let me know if it has any unusual side effects.


I'm about to convert this script to MV, and have been looking through the issues people have mentioned, but I either can't quite understand them, or I can't reproduce them. So if anyone is using this script and it's not behaving correctly (in relation to state_resist, turn duration, or commands not being executed), can you please post again with screenshots of your states, steps to reproduce the problem, and an indication of what you expect to happen and what's really happening? If I can figure out the issues as I port the script, I can also fix the Ace version at the same time.
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
252
Reaction score
65
Primarily Uses
Lines 64/65 are commented out.

http://pastebin.com/gA8dqg3b

So, I'm gonna assume you mean making

def add_new_state(state_id) shaz_state_commands_add_new_state(state_id) state_add_command(state_id) if !state?(state_id) endinto this:

def add_new_state(state_id) state_add_command(state_id) if !state?(state_id) shaz_state_commands_add_new_state(state_id) endWhen changing the order of these two, onadd commands do work. Couldn't seem to find anything wrong with onremove commands, either. Unfortunately, my game doesn't use resist_states too often so couldn't tell you if those have changed. Duration also seems to be fine, I will post again if I find any issues :) . Thank you very much for the help!

Edit: This is completely unrelated to these changes, but this script interacts with http://forums.rpgmakerweb.com/index.php?/topic/14110-stacking-states/ strangely. Removing any stack removes all of em, and if the state is already applied, adding another stack won't cause the onadd's to go off. I'll try swapping their placement in the editor. Edit2: Nope, but this isn't really something you probably ever intended for, so I apologize for bringing it up.
 
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
Yeah, unfortunately I'm not aware of all the other scripts out there that would affect this one, and I don't have time to write compatibility patches. You're very welcome to make a thread in RGSSx Script Support with links to the two scripts, explaining the issue, to see if someone can make a compatibility patch. (and if you do get someone to make it, you're also welcome to post a link to that thread here so others in the same situation can benefit).


Sorry I can't offer much help.


That's interesting about the line numbers - they're 64/65 in my version of the script, and I don't think there's a difference. Maybe there's something in the comments that pushed it down - or maybe I DID start working on the other issue at some point and didn't realize they're not quite the same. At least you knew what I was talking about :)
 

Dragon Brother

Survive, Adapt, Infest.
Veteran
Joined
Dec 30, 2015
Messages
100
Reaction score
127
First Language
English
Primarily Uses
RMVXA
I'll give this a shot, Credit will be given.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
536
Reaction score
249
First Language
German
Primarily Uses
(Since ZServ didn't create another topic yet I hope it's okay to post this here)


Edit: Aaaaand I didn't look at the posting date... Sorry


"adding another stack won't cause the onadd's to go off"


I think it's safe to recommend to remove the
if !state?(state_id)
part from the code section you posted above. The method is alredy written in a way that it shouldn't be called unless there really is a new state to add anyway, so removing the second check should not break it.

"Removing any stack removes all of em"


That's how the "Stacking States" script is written, it has nothing to do with the "Add/Remove Commands" script. I once wrote a quick "fix" for this for another user of a german forum, but since it wouldn't work with this script you could try this adapted version: link
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,310
Reaction score
11,912
First Language
English
Primarily Uses
RMMV
No, I'm pretty sure that line has to be there.  I think I added it when there was a problem when you equip/unequip armor that has a state resistance.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Finally the new pc is working!! But it seems a lost my license to Windows 10 because of the hardware changing :(
Tune in next time for our newest Episode: "PC issues return! Palm uses every swear in the lexicon!"
gotta update my game project thread page later
So trying out Ultra Mode 7 was a bad idea. How do I not include this in my game? XD
Stumbled upon an RPG Maker game on Steam called 'Boobs vs Zombies' while looking for a zombie themed fantasy RTS. lol

Forum statistics

Threads
93,558
Messages
913,449
Members
123,094
Latest member
HimitsuYuki
Top