temporary slow movement event state

Status
Not open for further replies.

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
Here's the scenario: You are fighting a spider and it throws a web over you, making you 'sticky'. I want this effect to last for 5 movements after the battle has ended, slowing the character's movement speed slightly.

There's no way I can find to change the movement speed of a character in 'States', so I made the web attack give the player a 'SlowMove' state. I made an event on the map with a conditional branch that asks if the player is inflicted with that state and, if so, to reduce the movement speed. I made this a parallel process because I want it to check constantly for the state, and remove it when it is no longer present (after 5 moves).

However, doing this makes my character unable to move at all on that map because it is is constantly checking for the state.

Is there a way of doing this effectively?

thanks for any help.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
yes - add waits to the parallel process.
you'll need to experiment to find the correct number of waits - too few and the computer lag, too many and the computer reacts too late to any change in the state.

the explanation is a bit too complex, it is due to the way the wait state works internally - but basically you need your parallel processes to wait to free processing power for the rest of the game, otherwise nothing but the parallel processes will work.
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
Alternatively you can bypass the event on every map and use a common event with a Parallel Process trigger and a conditional switch "check for sticky" or something similarly named.

Now on every troop that has a spider, turn on the "check for sticky" switch. It'll guarantee the common event triggers on whatever map you're on. From there it should be self explanatory, plus the wait command Andar mentioned above to allow movement. Just make sure to turn off the switch at the end of the common event to make sure it doesn't stay on.
 

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
thanks. can u be more specific?

Without waits I have:

Conditional branch: [Player] is [SlowMove] Inflicted
Set Move Route: Player
Change Speed: 3
else
Set Move Route: Player
Change Speed: 4
branch end
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
I mocked one real quick. I haven't tested it though, but it looks solid to me at least.

sticky_test_rpg.PNG

EDIT: I forgot to change the players move speed >_> you can slow it down right before loop, then speed it back up right before the "break loop" command.
 

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
thanks. i'll give it a go.

Is 'petula' the name of the spider?

and won't exit event processing stop all events? should i use 'erase event'?
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
petula is the name of the player that's afflicted with sticky.
exit event processing is there just as a redundancy(and habit of mine), I don't think you really need it. It won't affect anything else
 

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
but the player won't be inflicted with death.

the player will survive the battle but be inflicted with the sticky state which slows their movement.

Ignore that. I didn't read ur comments properly
 
Last edited:

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
OK, it's not working :(

Here are the screenshots of my state, common event and event page for the spider troop.

Can you spot what is wrong?
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
the troop events will not be executed after the last enemy has been killed.
If there is another enemy still alife after the spider gets to HP=0, then the event will process.
If the spider is the only enemy in that battle or if all other enemies have been killed before the spider (making the spider the last enemy alife), then the battle will be aborted before the switch can be turned.

in that case, you'll need another construct, either involving a check on the mapevent that starts the battleprocessing or two troop invents involving the immortal state to let the spider survive at HP=0 before the troop event that turns the switch also removes the immortal state to kill the spider only after the switch was turned.
 

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
i changed it so the check switch turns on after the battle is over, but now the slow move state doesn't wear off until i leave the map.

EDIT - I don't think it's the slow move effect slowing me down, but the parallel process. i changed the movement speed and it's the same.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
yes, that is true - because the wait is inside the logic loop, it should be either the first or last command instead. Then you wouldn't need a loop at all
 

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
ok. Also, the conditional branch should be less than or equal to - i changed that and it works better. Will try what u said about the wait now. almost there!

although I'm not really sure what u mean. where should i put the wait command?
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
Guys, why are you all using common events? My method is not to use common events and since you want to alter the move speed, here's a snippet instead:

Code:
class Game_Player < Game_Character
  def real_move_speed
    c = @move_speed + (dash? ? 1 : 0)
    c -= 1 if actor.state?(13) #or your number for sticky
    return c
  end
end
real_move_speed is what RPG Maker uses in speed calculations, though it's more relevant to the player as you know that dash makes you a bit faster. This code here means that if you have the Sticky state, you will go a bit slower.

Of course, you can experiment a bit more here, like states that make you faster, region_id that slow you down, or perhaps disable dash.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
@Harosata because every script added increases the chance for an engine broken through script incompatibility, especially if people use snippets like yours that override the existing functions instead of aliasing them.
If the OP has another script that affects the same function, one of them will no longer work.

But events can't break the engine itself, so they are much safer for simple things to use.
 

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
Harosata: thanks for the input. I'm not good with scripting, so you'll need to explain exactly how to implement your suggestion.

Everything works with scripting except that once the effect wears off, the player moves slightly slower than usual due to lag from somewhere.
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
A good point, Andar. Anyways, most scripts, from small snippets to large ABS, are usually placed in the Script Database near the end (under Materials and above the very very final script page)

---

I do recall that some of my projects (including current) does work with progressing the story when a state wears off, so I do apologize for writing this off so quickly. So here's what should happen assuming you decide to use events instead of the snippet:

State: Remove By Walking : 5

Common Event: Parallel Process / Switch: 118

Conditional branch: [Player] is [SlowMove] Inflicted
-Conditional branch: Script: $game_player.move_speed != 3
--Set Move Route: Player
--*Change Speed: 3
-branch end
-Wait : X
else
-Set Move Route: Player
-*Change Speed: 4
-Switch : 118 : OFF
branch end

I feel that things happen if the move speed is set to 3 multiple times, so I would just have that thing happen once by checking the speed
 
Last edited:

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
140
Reaction score
10
First Language
English
Primarily Uses
RMVXA
thanks. i'll try it.

What value should i put as X for the wait command - this seems to be the problem with it at the moment - the lag it creates while running the parallel process.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
You have to experiment with the waits - not enough and you'll get lag, too many and the parallel process will be delayed.
Start with values of 5 or 10 and then go from there.
The correct number also depends on what the parallel process does and where in it the wait happens - sometimes it goes down to 1 or 2 for the number and other times it goes up to 60 or more.
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
Not sure if you managed to fix it already or not, but the conditional branch in the loop is backwards. It should be checking to see if 179 is more than or equal to 178. Also, for the troop command, it doesn't matter where or when the switch is toggled on. The point is that it's switched on no matter what so that once you enter your map, it will trigger the common event. If he's not inflicted, then it'll turn off immediately. Otherwise, it'll work.

I also forgot to add, you may want to remove the 'slow move' state from the player once the slow movement is finished.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

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
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top