Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Event Commands Playing Twice

Status
Not open for further replies.

YGM7

Villager
Xy$
0.00
Hi, new here. I have an issue where an event command is running twice. It is on a parallel event that is only set to run if a switch is on. I have similar events throughout my game, but the problem only occurs here. I have 2 events on this map that have this issue. Any help would be appreciated.
Thanks
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Yes I agree with @Hello! It makes it much easier for us to help you. We need to see the basis of the logic and seeing the event page in question should help a lot.
 

YGM7

Villager
Xy$
0.00
Okay, so the long row of events on the map turn on the switch Guard_Sight via player touch, and the single event above the ladder turns off the switch Guard_Sight also via player touch (as seen in the picture).
The event that is open on the side is the NPC (that you can see to left on the map). There is also another NPC on the right side of the map (that cannot be seen from this picture) that has the same exact setup with all of the same commands and switches. The problem is that when the player is "spotted" by the NPC, the two text commands in the event run twice. (one, then the other, one, then the other) and continues normally. This happens with both NPCs on this map, but not any other map.

[doublepost=1458300696,1458300357][/doublepost]Just checked again. The only difference between the two NPCs on the map are their autonomous move routes. Just if that matters.
[doublepost=1458301322][/doublepost]Okay, just playtested several times, and found out that it sometimes (depending on which switch tile I cross) runs perfectly with the command going only once as planned, or twice but in a different order.
[doublepost=1458316437][/doublepost]Oh, and the switches are set so if you are facing one way, it turns on, and if you are facing another way, it turns off. If that helps in any way.
Thanks
 

Xilefian

Adventurer
Xy$
0.00
Parallel processes are very weird when it comes to messages, movement events and teleports. It's a nightmare using them for anything that isn't pure logic.

Autorun is what you want for serial, expected logic. However autorun disables player movement.

To get around these shortcomings without a plugin, split up your event so the parallel process is on a dedicated page and do your logic there, don't do any procedures.

Here's a self-contained guard event;






The way pages work is the runtime will crawl through all the pages in order, checking each condition. The last condition that is true will be called. Knowing this, we can set our pages up so what you want to happen in serial order (Autorun) can be set on the last page with a self-contained condition (self-switch).

Page 1 is the default page, as all the pages after it have conditions that are default to false.
Page 2 is where the event spins and detects if it is facing right when guard_sight is set to true (Parallel). Because it's parallel, we have to set our switches last whilst the event is still valid.
Page 3 is where the guard will walk up to the player and say their message (Autorun). Because it's autorun, we can set our switches whenever we want.

Study and experiment these event pages as they are pretty complex for what they actually do.

Someone should make a Plugin that allows player movement during Autorun events. Would make things a lot simpler. I might make a Plugin that does this myself.
 

YGM7

Villager
Xy$
0.00
Wow, that is exactly what I needed. Thanks. But when the switch is off, the guard isn't "off duty" or whatever, and therefore will be moving, so I should just have the autonomous movement set to the route I want on the first page, right? Also, is there a reason why the 2nd page has a custom (not fixed) movement, and the other 2 pages don't?
Thanks so much.
 

Xilefian

Adventurer
Xy$
0.00
Also, is there a reason why the 2nd page has a custom (not fixed) movement, and the other 2 pages don't?
Oh yeah, that 2nd page's custom movement is the turn-right 90 degrees. I suppose this could be moved to the parallel process with a wait of N frames between each turn, but it makes no difference (unless you want complex movement, such as following a path).

You can set the not-fixed movement of the first page to whatever you want. That's the default nothing-happening page (I just chose to have an off-duty message for the lols). The 3rd page's movement should be overridden by moving towards the player (it's set to repeat), so even if you change that nothing will happen.
 

YGM7

Villager
Xy$
0.00
I did everything you listed, and things work fine, until the scene reloads because of the transfer event. The NPC freezes and you are no longer able to move your character because it (I assume) is trapped in the autorun...? When I change the 3rd page to a parallel, the NPC freezes when the scene is reloaded. And then, other events in the scene (that are used to get rid of the guard) dont function as needed. (the guard will just disapear instead of walk out of the room, etc.)
 

Xilefian

Adventurer
Xy$
0.00
Post your event pages again please. The event I posted should be water-tight for a togglable guard.

Page order and the use of self-switches are critical, as are the page conditions.
 

YGM7

Villager
Xy$
0.00
The 4th page is just a blank page with a switch to make the NPC go away after a different interaction in the scene. (That event has a set move route for this event. Will that be a problem?)

1)


2)


3)
 

Xilefian

Adventurer
Xy$
0.00
Page 4 will be the primary event if it's page conditions are met. What does page 4 look like? Try moving page 4 to page 2 (there's no easy way to do this sadly, a feature gap in MV)
 

YGM7

Villager
Xy$
0.00
And thats the source of the problems you think?
Thanks
(page 4 is just an empty page that will be activated when a certain switch is turned on)
 

Xilefian

Adventurer
Xy$
0.00
I looked at your images again. The source of your problem is that you're setting self-switch A to On with Page 3, you need to be setting it Off.

Because you leave it on, Page 3 is always going to be active until you turn on Page 4's switch, which will make it disappear. So that explains why Page 3 is always running for you; you're never turning it off!


Also, an unrelated comment, you are referencing the event directly as Labcoat_NPC with the Page 2 conditional branch and the Page 3 move-route, you are aware that "this event" makes the event copyable and is probably the better choice to make for guard events?
 

YGM7

Villager
Xy$
0.00
Okay, thanks. Now it works, but I still have the problem of the event commands running twice. And I'm having other problems with this event interacting with other events in the map, so the original event that I originally made seems like a better idea at the moment. But still, the problem persists.
Thanks
 

Xilefian

Adventurer
Xy$
0.00
I implemented your original event and had problems with it running twice (as well as cancelling half-way and other weird parallel process quirks), the event I implemented didn't have that problem.

Are you using any Plugins that change the behaviour of events?
 

YGM7

Villager
Xy$
0.00
These are my plugins:

Thanks
[doublepost=1458443372,1458443250][/doublepost]Just got rid of both GALV_JumpAbility plugins, as I wasn't using them. (Don't know why there were two in the first place.)
 

Xilefian

Adventurer
Xy$
0.00
A lot of these Plugins do look like they mess with Event behaviour (turn before movement, script commands within move routes, action indicator).

Turn off your Plugins (make a backup first if you've messed about with the settings of each one) and see if that changes the behaviour here.

The fact that this "messes with other events" is an alarm bell that something 3rd party is screwing about. It's a very self-contained event that you have. Actually, make sure to change that conditional branch and move route to "this event", that's the only thing (along with the toggle switch) that's making this event not self-contained, a similarly named event could be messing about and all sorts of confusion occurring.
 

YGM7

Villager
Xy$
0.00
Okay. I switched all of the move routes to "this event," and I just turned off all of my plugins, and I still have the problem.
Thanks
 

Xilefian

Adventurer
Xy$
0.00
Okay. I switched all of the move routes to "this event," and I just turned off all of my plugins, and I still have the problem.
Thanks
Yeah I'm stumped then. I'll have to give up, sorry.

If you were to remake the event in a fresh project, do you still get the problem? If you're desperate, zip up a minimal project that has this problem and ask someone to take a look.
 

YGM7

Villager
Xy$
0.00
Okay, its fine. Thanks so much.
[doublepost=1458444657,1458444220][/doublepost]But now, I switched it back to my original event, and I'm unable to move my player after it runs. There's no autorun in it, and I changed everything to "this event".
Thanks
[doublepost=1458515680][/doublepost]I have tried everything at this point. Aside from the double event commands, now I'm unable to move the character. Any help would be appreciated.
Thanks
[doublepost=1458559762][/doublepost]Fixed the problem. Thanks for all your help.
 
Status
Not open for further replies.
Top