• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Is it possible to remove an Event during run time?

D

Dani

Guest
Hello!

I would like to remove the Step Event for some objects during run time (i.e, while playing the game) via code, is it possible?

For example, let's say I have an object with Step Event defined in IDE. Then I run the game, start playing, an instance of that object is created, and later I call a script that removes the Step Event for that instance. Is that possible?

Thanks.
 
½

½ a cup

Guest
No.

Deactivating an instance is the closest you will get, but that disables all events.
 

Smiechu

Member
Hello!

I would like to remove the Step Event for some objects during run time (i.e, while playing the game) via code, is it possible?

For example, let's say I have an object with Step Event defined in IDE. Then I run the game, start playing, an instance of that object is created, and later I call a script that removes the Step Event for that instance. Is that possible?

Thanks.
Yes.
You can make a big "if" on the very beginning of the step with some global parameter which controlls if it's on or off.
Or a small "if" statement on the begginig of the step with exit function inside.
 
D

Dani

Guest
Ok, so it's not possible. I'll have that into account.

You can make a big "if" on the very beginning of the step with some global parameter which controlls if it's on or off.
Or a small "if" statement on the begginig of the step with exit function inside.
Yes, that's what I do at the beginning of the step event, but the call to the step event is still happening. I wanted to avoid the call. Anyway, I can solve this issue duplicating the parent object without step event for this particular case.

Thanks.
 

Smiechu

Member
Ok, so it's not possible. I'll have that into account.



Yes, that's what I do at the beginning of the step event, but the call to the step event is still happening. I wanted to avoid the call. Anyway, I can solve this issue duplicating the parent object without step event for this particular case.

Thanks.
OK... and what would you practically gain if it would be possible?

There are also two other options:
- as you mentioned use parenting and then parent_inherit
- use a user event and launch it at the end of the step_begin
 
Top