【resolved】Help, how to stop a running event A in event B?

How to stop a running event A in event B?

I have made a autorun opening animation by using Yami_SikpTitle. So the animation was made in a autorun event A.
Then i want make a function that when the player presses "ok" button, the animation will be skipped.
The button checking may be made in event B, but how to stop the event A?

Thank you!
In event B turn on a switch. On event A put a second page conditioned by that switch and leave everything else the way it is.
In event B turn on a switch. On event A put a second page conditioned by that switch and leave everything else the way it is.

I've tried this. The first page will continue run to end even after the switch for sencod page turns on,
Please show your events.
Please show your events.

The event is shown in Chinese and may not be convinently read.
The event A consists of 1)player moving, 2)picture moving, 3)map rolling, 4)map changing and 5)Cross Pang
I found
1) The picture moving can be stopped by picture removing.
2) The player moving can be stoppe by the moving trace resetup.
But
3) the map rolling will continue even map changing
4) Map changing will occur again make player back to the initial position
5) Cross Pang will occur.

The switch as you said is be trying like this.
1583730034089.png


1583730053493.png
Is that event 1 on your map?

From event 2, try turning on the switch, then something like this as a script call:

Code:
$gameMap.event(1)._interpreter._index = $gameMap.event(1)._interpreter._list.length

You could also try this:

Code:
$gameMap.event(1)._interpreter.terminate()
Is that event 1 on your map?

From event 2, try turning on the switch, then something like this as a script call:

Code:
$gameMap.event(1)._interpreter._index = $gameMap.event(1)._interpreter._list.length

You could also try this:

Code:
$gameMap.event(1)._interpreter.terminate()

Yes, the events A and B are on the first map 001. When animation ends players will be transported to map 002.

Because the ID of event A is 002, so I use 'event(2)' in these codes.
Then, I tried these two codes in event B.
For the 1st code, error "cannot read property '_list' of null" occurs.
For the 2nd code, error "cannot read property 'terminate' of undefined" occurs.

When I use 'event(1)', no error but nothing happens.
The event A is set as autorun.
the selected event is following
1583740604368.png
Oh - try turning on the switch AFTER the script call. Does that make any difference?
two possibilities for the cause:

either event B does not turn on switch 1 correctly, or the switch 1 is being turned off again by something else.
because in all other cases the event A would stop as soon as switch 1 is ON.

so please show us how event B is triggered and what its commands are, that will allow us to check the first possibility.

as for the second possibility, just search with the search function where switch 1 is used in your game.
and ALWAYS name your switches as soon as you use them - that will not only help you later identifying what happens where, it will also prevent you from re-using switches for different purposes (if a switch is already named, you already have used it when looking for the next switch to use.

It is also a possibility that one of your plugins uses switch 1, that will not be detected by the search function but needs to be checke manually in plugin properties.
Oh - try turning on the switch AFTER the script call. Does that make any difference?

no different...
I found the code with ‘event(1)’ works, so the event B is end right now
but var 'event(2)' doesnot exist, which I very confuse..
two possibilities for the cause:

either event B does not turn on switch 1 correctly, or the switch 1 is being turned off again by something else.
because in all other cases the event A would stop as soon as switch 1 is ON.

so please show us how event B is triggered and what its commands are, that will allow us to check the first possibility.

as for the second possibility, just search with the search function where switch 1 is used in your game.
and ALWAYS name your switches as soon as you use them - that will not only help you later identifying what happens where, it will also prevent you from re-using switches for different purposes (if a switch is already named, you already have used it when looking for the next switch to use.

It is also a possibility that one of your plugins uses switch 1, that will not be detected by the search function but needs to be checke manually in plugin properties.


I use a very simple project in test. And I change the lauguage into Eng. now.
There are only event A and B in map 1.
002 Event A is following.
1583744600827.png

1583744571094.png


001 Event B is following parallol running, trigged by pressbutton checking.
1583744686353.png


Then I use F9 to check in debug.
When event B is running and player is trans into map 001, the swtich 18 is on, but player continues to walk up (as event A)

1583744674614.png


The plugins used as follows, sw 18 isnot used.
1583746772782.png
where did you get command115 from? I didn't say to put that in.

So if you've almost got it working, just do another Set Move Route on the player with no movement commands. That will cancel the move route that's already in place.
The nature of event is that it run in game interpreter. It has to finish the command of the current page. But that is not the case if the event is in Parallel Process. Parallel Process IMMEDIATELY active when the condition are met, and IMMEDIATELY inactive when the condition cut off disregarding current running game interpreter.

Making use of that nature, to make a skippable event possible, it require an event with 2 page. One is an autorun which contain a loop that's only waiting for input check, and another one is a parallel process that run your real event, which is your animation. Activate the condition of the parallel process page in your autorun and BAM! You just run 2 page in 1 event at once.

Check out one of my tutorial, Skippable Event for further detail. Link on my signature.

Meanwhile I will just posted the screenshot here :

1. This is the first page of your event. In your case, it's supposed to be an autorun which contain a loop for the purpose of checking input button.
1583746835965.png


2. This is the second page of your event. It's a parallel process that contain your real event which are skippable. In your case it's your animation.
1583747103308.png


I must say again, please check out my tutorial Skippable Event for further detail if you are not too lazy to do that. It's a breakthrough that I invent myself.
There's the link : https://forums.rpgmakerweb.com/index.php?threads/dcupu-eventing-skippable-event.112937/

I hope I'm finally noticable and able to help this time.
where did you get command115 from? I didn't say to put that in.

So if you've almost got it working, just do another Set Move Route on the player with no movement commands. That will cancel the move route that's already in place.

I tried two codes as you said, and then find command115 from rpg_object.js by refer to
"$gameMap.event(1)._interpreter", all of they cannot stop the event A....

Yes movement can be cancel by another movement setup. But if I used many movements in event A, it may just cancel the running one, and another movement will continue....
Yes movement can be cancel by another movement setup. But if I used many movements in event A,
you misunderstodd - the empty moveroute should be in event B to cancel that what you placed in the other event.
after all you want B to cancel what you ordered in A when the button is pressed.

EDIT:
And please, always name your switches even if it is only for test projects.
It should be : [0018: intro off] and not [0018]
there are very few things that cause bughunts to be worse than switches and variables that are accidentally used twice, and naming them is the easiest way to prevent that.

And only the switch can cause the event to stop, no interpretercommand can do that
And please, always name your switches even if it is only for test projects.

Thanks, I named them properly now.


you misunderstodd - the empty moveroute should be in event B to cancel that what you placed in the other event.
after all you want B to cancel what you ordered in A when the button is pressed.

Yes, I mean, if there are movement M1, M2, M3, M4 in event A, and now the M2 is running.
Then I press 'ok' button to trig event B (empty movement in event B ), M2 will be cancel, but M3 M4 will continue, even after the sw [0018: intro off] is on.

Check out one of my tutorial, Skippable Event for further detail. Link on my signature.

Thank you for detailed tutorial. It works perfertly for opening animation.
I found there need to be another empty movement in pape 1 for cancelling the running movement, because the running movement will not immediately be canceled after self-sw is off.

you misunderstodd - the empty moveroute should be in event B to cancel that what you placed in the other event.
after all you want B to cancel what you ordered in A when the button is pressed.

EDIT:
And please, always name your switches even if it is only for test projects.
It should be : [0018: intro off] and not [0018]
there are very few things that cause bughunts to be worse than switches and variables that are accidentally used twice, and naming them is the easiest way to prevent that.

And only the switch can cause the event to stop, no interpretercommand can do that


Thank you for guidance, I find the reason.
When I change event B from "parallel" into "autorun"
and change event A from "autorun" into "parallel" .
Then the sw [0018: intro off] can cancel the event A.

where did you get command115 from? I didn't say to put that in.

So if you've almost got it working, just do another Set Move Route on the player with no movement commands. That will cancel the move route that's already in place.

Thank you for guidance.
I find following code works for parallel event.

EDIT:
I find the code works perfectly for parallel event, not useful for autorun event.
And the running movement will be cancelled in the while.

Code:
$gameMap.event(Prallel_Event_ID)._interpreter.terminate()
Thank you for detailed tutorial. It works perfertly for opening animation.
I found there need to be another empty movement in pape 1 for cancelling the running movement, because the running movement will not immediately be canceled after self-sw is off.

If it's to stop a move route, couldn't you just override the command with a new move route command?
EDIT : Oh, you just explained that

@Beecu , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.


If your problem is fully solved, please report your post and we'll close it.

Original thread: https://forums.rpgmakerweb.com/threads/resolved-help-how-to-stop-a-running-event-a-in-event-b.118957/