How to force IA factions to start playing when spotted?
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.
Re: How to force IA factions to start playing when spotted?
If you mean leader death, in filter use canrecruit=yes. If you mean last unit of side, then it probably needs to be [have_unit] check for units of that side.
Instead of team_name, filter by side.
filter means unit who dies, filter_second means unit who kills.
Instead of team_name, filter by side.
filter means unit who dies, filter_second means unit who kills.
Re: How to force IA factions to start playing when spotted?
Well, I want this event to fire after allRavana wrote: ↑November 28th, 2022, 11:13 am If you mean leader death, in filter use canrecruit=yes. If you mean last unit of side, then it probably needs to be [have_unit] check for units of that side.
Instead of team_name, filter by side.
filter means unit who dies, filter_second means unit who kills.
bandits
team units die. Regarding the defeat condition, is something I already did setting defeat_condition=no_units_left
to all these sides.Returning to the event, following your suggestion, I tried to do something like this:
Code: Select all
[event]
name=die
[filter]
side=3
side=4
side=5
[/filter]
# what has to happen...
[/event]
Oh, and for the
filter
and filter_second
keywords, thanks for the clarification! I completely misunderstand this concept. - Spannerbag
- Posts: 535
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: How to force IA factions to start playing when spotted?
Have you looked at setting victory_when_enemies_defeated=no in
[scenario]
?Code: Select all
[scenario]
id=my_scenario
name=_"my_scenario"
next_scenario=my_next_scenario
map_file=my_scenario.map
{TURNS easy_turn_limit normal_turn_limit hard_turn_limit}
victory_when_enemies_defeated=no
... WML ...
[/scenario]
A simple way to catch the victory condition (no enemies left) would be to do what Ravana mentioned: have a condition that fires when no enemy units remain on the map.
So if your enemy sides were, say, 3,4 and 5 then you could use:
Code: Select all
[event]
name=die
[filter]
side=3,4,5
[/filter]
[filter_condition]
[have_unit]
side=3,4,5
count=0 # Does not count the dying-but-not-yet-dead unit caught by [filter]
[/have_unit]
[/filter_condition]
... WML ...
[/event]
Hope this helps!
Cheers!
-- Spannerbag
Re: How to force IA factions to start playing when spotted?
It works perfectly! Thanks again for all the support!Spannerbag wrote: ↑November 28th, 2022, 1:58 pmHave you looked at setting victory_when_enemies_defeated=no in[scenario]
?
For example if you want victory to occur when all enemy units are defeated you'd need to do the above otherwise the scenario will end when the last enemy leader dies, even if other enemy units are on the map.Code: Select all
[scenario] id=my_scenario name=_"my_scenario" next_scenario=my_next_scenario map_file=my_scenario.map {TURNS easy_turn_limit normal_turn_limit hard_turn_limit} victory_when_enemies_defeated=no ... WML ... [/scenario]
A simple way to catch the victory condition (no enemies left) would be to do what Ravana mentioned: have a condition that fires when no enemy units remain on the map.
So if your enemy sides were, say, 3,4 and 5 then you could use:
Of course there are lots of other things you can do such as test each turn if there are no enemies on the map (I've used this once or twice for slightly unusual situations).Code: Select all
[event] name=die [filter] side=3,4,5 [/filter] [filter_condition] [have_unit] side=3,4,5 count=0 # Does not count the dying-but-not-yet-dead unit caught by [filter] [/have_unit] [/filter_condition] ... WML ... [/event]
Hope this helps!
Cheers!
-- Spannerbag
Cheers!
Re: How to force IA factions to start playing when spotted?
I love it when I think I have to write a lot of code that may or may not work, and then I learn that WML already has a tag or key that completely addresses whatever it is I'm trying to do.Spannerbag wrote: ↑November 28th, 2022, 1:58 pm Have you looked at setting victory_when_enemies_defeated=no in[scenario]
?
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: How to force IA factions to start playing when spotted?
I am not sure if I understood your question right, but if you are trying to set up a victory if the "bandits" are defeated, I see two main ways.Alopex95 wrote: ↑November 28th, 2022, 11:04 am Hey, everyone!
Just another (and last, I promise! ) little query I'm wondering while finalizing my scenario: I'm trying to implement a condition when thebandits
team is defeated because the scenario has to continue after our hero frees the city from them.
Here's what I've tried so far, but without any great results:
First, I tried with aname=die
event with a filterteam_name="bandits"
;
Second, I tried with the same event but putting afilter
withid=OneBandit
and afilter_second
withid=AnotherBandit
(despite the bandit's leaders being three, but I was doing some tests).
I think that thedie
event can be applied only to single units, so is this maybe the problem in my code?
So, how can I set an event which will be fired after the defeat of a particular team?
Thanks always for your precious pieces of advice!
P.S.: I can open a new thread for this question if using this is against the forum rules.
- victory_when_enemies_defeated=yes and a name=victory event
- last_breath event with side=3,4,5 in [filter] and a
Code: Select all
[if]
[not]
[have_unit]
side=3,4,5
can_recruit=yes
[/have_unit]
[/not]
[/if]