defeat_condition=never query

The place to post your WML questions and answers.

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.
Post Reply
User avatar
Spannerbag
Posts: 761
Joined: December 18th, 2016, 6:14 pm
Location: Yes

defeat_condition=never query

Post by Spannerbag »

Hi,
Bit puzzled and would appreciate some clarification before I go down rabbit-holes...

I have a scenario which includes an evacuation element.
At this point the player controls two sides; 1 and 3.

Side 1 needs to evacuate all units via [put_to_recall_list] which works fine.

However for gameplay reasons I wanted the player to be able to evacuate leaders first (if they wished to do so) and then as many other units as possible before time runs out.

When the last leader (this side has multiple leaders) is [put_to_recall_list] this code kicks in:

Code: Select all

...
          [have_unit]
            id=$this_item.id
            canrecruit=yes
          [/have_unit]
          [have_unit]
            side=1
            canrecruit=yes
            count=1
          [/have_unit]
        [then]		# Current unit is last side 1 leader on map
          [modify_side]
            side=1
            defeat_condition=never
          [/modify_side]
...
Which according to :debug :inspect also works.
However the next side 1 turn auto-loses, I'm guessing because there are no leaders for side 1, even tho' (I thought) defeat_condition=never would stop this.
The lose isn't coming from the leader die events because if that were the case the lose should occur immediately the first leader is removed from the map?

I've also used this in my other campaign (been on hold for 6+ months now) where I start a scenario with defeat_condition=never because one player side's leader doesn't appear until later on. That worked fine (tested on 1.16, not tried 1.18 yet).

So... am I doing something stupid here?
Have I misunderstood something?

Any clarification greatly appreciated.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: defeat_condition=never query

Post by white_haired_uncle »

Any clues from

Code: Select all

wesnoth --log-debug=engine
Speak softly, and carry Doombringer.
User avatar
Spannerbag
Posts: 761
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: defeat_condition=never query

Post by Spannerbag »

white_haired_uncle wrote: July 3rd, 2024, 3:02 am Any clues from

Code: Select all

wesnoth --log-debug=engine
Thanks for the suggestion, as no-one said I'd done anything obviously wrong I spent some time digging deeper into the logic.

It's possible in this scenario for multiple leaders to be killed almost simultaneously.
However when 2+ leaders died at once this caused issues.
So I wrote some code to bypass the global die events I'd put in _main.cfg.
This all worked.

However... this bypass code was also trapping this situation, which I'd never envisaged happening when I wrote it (I'm always having "good ideas" :roll:).
Sooo, I've bypassed the bypass with yet more tortuous code and will test shortly.

Basically, as expected, it was my gnarly code as usual!

Thanks again for taking the trouble to reply, much appreciated.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply