Annoying error: <lua> Repeated [endlevel] execution, ignored
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Annoying error: <lua> Repeated [endlevel] execution, ignored
Hi,
I have a situation where a number of units may be
The scenario also has multiple leaders and if any leader dies the player loses.
If 2+ leaders are
Their last breaths are all delivered then an on-screen message appears saying <lua> Repeated [endlevel] execution, ignored (1 less than number of leaders killed, which makes sense to me).
I can see why the message appears; there will indeed be several encounters with the same endlevel code:
Thinking it was maybe because I had this code in the
If I reduce the number of leaders to 1 everything works fine.
So I know (I hope) why the error is occurring but I'd like to know if there is any way to suppress it or change the code so it doesn't appear on screen?
Options I can think of:
Am I missing something obvious?
Cheers,
-- Spannerbag
I have a situation where a number of units may be
[kill]
ed simultaneously.Code: Select all
[kill]
[filter_location]
find_in=fb
[/filter_location]
animate=yes
fire_event=yes # Player loses if leader killed
[primary_attack]
type=fire
[/primary_attack]
[/kill]
If 2+ leaders are
[kill]
ed simultaneously their respective last breath
and die
events fire.Their last breaths are all delivered then an on-screen message appears saying <lua> Repeated [endlevel] execution, ignored (1 less than number of leaders killed, which makes sense to me).
I can see why the message appears; there will indeed be several encounters with the same endlevel code:
Code: Select all
[endlevel]
result=defeat
[/endlevel]
last breath
I moved it into a separate die
event, but I'm still seeing the message.If I reduce the number of leaders to 1 everything works fine.
So I know (I hope) why the error is occurring but I'd like to know if there is any way to suppress it or change the code so it doesn't appear on screen?
Options I can think of:
- Downgrade all but one leaders to heroes, but it wouldn't fit with the story.
- Kill units individually so die events fire do the same.
This would work (I imagine) but it would look odd in the context of the scenario where multiple units are clearly affected at once. - Use
harm_unit
to animate damage but do not kill any units.
Then manually kill them singly afterwards, but this seems a bit messy and awkward.
Am I missing something obvious?
Cheers,
-- Spannerbag
Re: Annoying error: <lua> Repeated [endlevel] execution, ignored
[fire_event] the [endlevel] call, but have the event containing [end_level] first_time_only=yes.
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
[RESOLVED]<lua> Repeated [endlevel] execution, ignored
Thanks for the reply, much appreciated!
Heh, was just going to post to say I'd fixed it; as often happens right after posting, I had a bit of inspiration.
Wish I had it before posting...
The
die
events were "global" (in _main.cfg
) so I bodged it by adding a flag to leave the last breath
s alone but suppress the die
event whilst multiple kill
s were being actioned.The I tested to see if at least one leader was missing with
[have_unit]
and if so fire a losing endlevel.It's an 'orrible hack but this was my solution (bear in mind I wanted the
die
events to work as they used to elsewhere).Haven't rigorously tested the logic yet but it works as expected in other parts of this scenario when a single leader dies so I'm pretty confident.
Thanks again for taking the trouble to reply and sorry I wasted your time.
Cheers!
-- Spannerbag
- lhybrideur
- Posts: 379
- Joined: July 9th, 2019, 1:46 pm
Re: Annoying error: <lua> Repeated [endlevel] execution, ignored
The horrible way I did it was to set a variable in the event and have an if at the beginning of the event that was triggering its content only if the variable is not set. I then clear the variable later.
Code: Select all
[event]
name=last breath
first_time_only=no
[...]
[if]
[variable]
name=todo
equals=no
[/variable]
[else]
{VARIABLE todo no}
[...]
[/else]
[/if]
[/event]
- Spannerbag
- Posts: 562
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Annoying error: <lua> Repeated [endlevel] execution, ignored
Yep, similar concept/logic.
Great minds...
Cheers!
-- Spannerbag