How to change a side's defeat conditions mid-scenario ?

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
Wendek
Posts: 72
Joined: February 24th, 2007, 6:27 pm
Location: In a chaotic world

How to change a side's defeat conditions mid-scenario ?

Post by Wendek »

Hello,

I want to do the following things :
-The player kills the enemy leader and places his leader on the enemy keep
-At this point enemy reinforcements arrive and attack the player
-The scenario ends when said reinforcements are all beaten

The problem I have is that none of the standard defeat conditions are really fitting :
-Default one means that the scenario will end when the enemy leader dies, which is not what I want
-"no_units_left" would be good except that there's a small point where there won't be any enemy units (between the moment where the player kills all the units and the one where reinforcements arrive) so it'll end.
-"never" makes it impossible to win and "always", I'm having trouble seeing the point of that one

What I wanted to do was to give the enemy a defeat condition of "never" and then change it to "no_units_left" during the event that spawns the reinforcements. Except that [modify_side] cannot change the defeat conditions apparently. Inserting a [side] or a [scenario] tag (I tried fiddling with the "victory_when_enemes_defeated" thingy too) inside the event obviously does not work at all. So what can I do ? My last solution would be to pre-create the reinforcement units and then "hide" them on the edge of the map, but a curious player could find (and possibly kill) them before the moment where they're supposed to appear, which is not good. Also they would probably still move and stuff so I'd have to find some way to lock them in place before the event.

Is there any "cleaner" way to do this that I'm overlooking ? It's my first scenario ever so of course there's a lot of WML stuff that I don't know about/don't understand yet, especially everything related to storing. Perhaps I could use another side allied with the normal enemies for that ?

Thanks for your answers.
"You see, it's not about what you take with you, it's about what you leave behind." (Turisas, The Bosphorus Freezes Over)
"A man chooses, a slave obeys." (Andrew Ryan, BioShock)
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: How to change a side's defeat conditions mid-scenario ?

Post by iceiceice »

We wanted to add defeat condition to be modified by modify_side but it was prohibited because of the feature freeze on 1.12 branch, and I was asked to revert my patch for that. In 1.11 you can only modify defeat condition from lua.
User avatar
Wendek
Posts: 72
Joined: February 24th, 2007, 6:27 pm
Location: In a chaotic world

Re: How to change a side's defeat conditions mid-scenario ?

Post by Wendek »

... duh, I had forgotten about that whole Lua thing. Solving this actually ended up being trivial. x) Thanks for the quick answer anyway.
"You see, it's not about what you take with you, it's about what you leave behind." (Turisas, The Bosphorus Freezes Over)
"A man chooses, a slave obeys." (Andrew Ryan, BioShock)
Post Reply