Enemy Leader appear one after another
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.
Enemy Leader appear one after another
Hi,
How can I do the following:
All enemy Leader appear one after another. So: Player 1(human) kills Player 2, than Player 3 appears, after that is killed Player 4 and so on.
How can I do the following:
All enemy Leader appear one after another. So: Player 1(human) kills Player 2, than Player 3 appears, after that is killed Player 4 and so on.
Code: Select all
#textdomain wesnoth-orc_campaign
[scenario]
id=try_outs
next_scenario=null
name=_"Try Outs"
map_data="{~add-ons/orc_campaign/maps/try_outs_map.map}"
turns=30
[side]
side=1
controller=human
team_name="good"
user_team_name= _ "My Team"
id=MyLeader
name= _ "Sabo"
type="Orcish Leader"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman, Naga Fighter"
gold=150
[/side]
[side]
side=2
controller=ai
team_name="bad2"
user_team_name= _ "Bad Guys 2"
id=EnemyLeader2
name= _ "Pragdush"
type= "Orcish Leader"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=50
[/side]
[side]
side=3
controller=ai
team_name="bad3"
user_team_name= _ "Bad Guys 3"
id=EnemyLeader3
name= _ "Rigro"
type= "Goblin Knight"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=50
[/side]
[side]
side=4
controller=ai
team_name="bad4"
user_team_name= _ "Bad Guys 4"
id=EnemyLeader4
name= _ "Domag"
type= "Orcish Slayer"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=50
[/side]
[side]
side=5
controller=ai
team_name="bad5"
user_team_name= _ "Bad Guys 5"
id=EnemyLeader5
name= _ "Azgo"
type= "Orcish Crossbowman"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=50
[/side]
[side]
side=6
controller=ai
team_name="bad6"
user_team_name= _ "Bad Guys 6"
id=EnemyLeader6
name= _ "Vunu"
type= "Orcish Warrior"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=50
[/side]
[side]
side=7
controller=ai
team_name="bad7"
user_team_name= _ "Bad Guys 7"
id=EnemyLeader7
name= _ "Xasal"
type= "Naga Myrmidon"
unrenamable=yes
canrecruit=yes
recruit="Naga Fighter"
gold=50
[/side]
[event]
name=start
[message]
speaker=MyLeader
message= _ "I will prove myself worthy!"
[/message]
[message]
speaker=EnemyLeader2
message= _ "Grrrr!"
[/message]
[objectives]
[objective]
description= _ "Defeat the enemy leader"
condition="win"
[/objective]
[objective]
description= _ "Death of your leader"
condition="lose"
[/objective]
[objective]
description= _ "Turns run out"
condition="lose"
[/objective]
[/objectives]
[/event]
[/scenario]
Re: Enemy Leader appear one after another
Use
The side definitions for all your sides that should appear later should look like:
Then add an die
Of course you have to do that for all sides.
Edit: added missing
no_leader=yes
The side definitions for all your sides that should appear later should look like:
Code: Select all
[side]
side=3
controller=ai
no_leader=yes
team_name="bad3"
user_team_name= _ "Bad Guys 3"
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=50
[/side]
[event]
that creates the next leader when the first enemy-leader dies:
Code: Select all
[event]
name=die
[filter]
id=EnemyLeader2
[/filter]
[unit]
id=EnemyLeader3
name= _ "Rigro"
type= "Goblin Knight"
unrenamable=yes
canrecruit=yes
side=3
x=
y= # add coordinates here
[/unit]
[/event]
Edit: added missing
side=3
Last edited by Straff on April 29th, 2023, 6:40 am, edited 1 time in total.
Re: Enemy Leader appear one after another
Thank you for your answer!
I must have made some mistake inserting the code. It starts correctly with me and the first enemy leader but after he is killed, I win instead of the next enemy leader being summend.
My code:
I must have made some mistake inserting the code. It starts correctly with me and the first enemy leader but after he is killed, I win instead of the next enemy leader being summend.
My code:
Code: Select all
#textdomain wesnoth-orc_campaign
[scenario]
id=try_outs
next_scenario=null
name=_"Try Outs"
map_data="{~add-ons/orc_campaign/maps/try_outs_map.map}"
turns=100
[side]
side=1
controller=human
team_name="good"
user_team_name= _ "My Team"
id=MyLeader
name= _ "Sabo"
type="Orcish Leader"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman, Naga Fighter"
gold=1000
[/side]
[side]
side=2
controller=ai
team_name="bad2"
user_team_name= _ "Bad Guys 2"
id=EnemyLeader2
name= _ "Pragdush"
type= "Orcish Leader"
unrenamable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=10
[/side]
[event]
name=die
[filter]
id=EnemyLeader2
[/filter]
[unit]
id=EnemyLeader3
name= _ "Rigro"
type= "Goblin Knight"
unrenamable=yes
canrecruit=yes
x=38
y=24
[/unit]
[/event]
[side]
side=3
controller=ai
no_leader=yes
team_name="bad3"
user_team_name= _ "Bad Guys 3"
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=10
[/side]
[event]
name=die
[filter]
id=EnemyLeader3
[/filter]
[unit]
id=EnemyLeader4
name= _ "Domag"
type= "Orcish Slayer"
unrenamable=yes
canrecruit=yes
x=41
y=15
[/unit]
[/event]
[side]
side=4
controller=ai
no_leader=yes
team_name="bad3"
user_team_name= _ "Bad Guys 4"
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=10
[/side]
[event]
name=die
[filter]
id=EnemyLeader4
[/filter]
[unit]
id=EnemyLeader5
name= _ "azgo"
type= "Orcish Crossbowman"
unrenamable=yes
canrecruit=yes
x=40
y=3
[/unit]
[/event]
[side]
side=5
controller=ai
no_leader=yes
team_name="bad3"
user_team_name= _ "Bad Guys 5"
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=10
[/side]
[event]
name=die
[filter]
id=EnemyLeader5
[/filter]
[unit]
id=EnemyLeader6
name= _ "Vunu"
type= "Orcish Warrior"
unrenamable=yes
canrecruit=yes
x=6
y=4
[/unit]
[/event]
[side]
side=6
controller=ai
no_leader=yes
team_name="bad3"
user_team_name= _ "Bad Guys 6"
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider, Goblin Spearman"
gold=10
[/side]
[event]
name=die
[filter]
id=EnemyLeader6
[/filter]
[unit]
id=EnemyLeader7
name= _ "Xasal"
type= "Naga Myrmidon"
unrenamable=yes
canrecruit=yes
x=6
y=30
[/unit]
[/event]
[side]
side=7
controller=ai
no_leader=yes
team_name="bad3"
user_team_name= _ "Bad Guys 7"
recruit="Naga Fighter"
gold=10
[/side]
[event]
name=start
[message]
speaker=MyLeader
message= _ "I will prove myself worthy!"
[/message]
[message]
speaker=EnemyLeader2
message= _ "Grrrr!"
[/message]
[objectives]
[objective]
description= _ "Defeat the enemy leader"
condition="win"
[/objective]
[objective]
description= _ "Death of your leader"
condition="lose"
[/objective]
[objective]
description= _ "Turns run out"
condition="lose"
[/objective]
[/objectives]
[/event]
[/scenario]
Re: Enemy Leader appear one after another
You need to add to the scenario definition. Otherwise you always win when your enemy is defeated, and no other enemy is (already) on the map.
And also you have to trigger victory when the last enemy leader is defeated.
And you should add all events under the side definitions, sot between them, for better readability.
The created enemy leaders have no side defined, you have to add them, otherwise they will always be created as
Code: Select all
victory_when_enemies_defeated=no
And also you have to trigger victory when the last enemy leader is defeated.
Code: Select all
# add this in the die event of the last enemy
[endlevel]
result=victory
bonus=no
{NEW_GOLD_CARRYOVER 40}
[/endlevel]
The created enemy leaders have no side defined, you have to add them, otherwise they will always be created as
side=1
units- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Enemy Leader appear one after another
While Straff's answer would work, I'm not sure it's necessary. First of all, did the second leader get spawned despite you getting a victory? If the answer is "no", then that's probably the issue right there, and you need to figure out why the die event didn't trigger. If the answer is "yes", try changing it to
name=last breath
instead of name=die
.Re: Enemy Leader appear one after another
You shouldn't need
What you need is to specify the
no_leader=yes
, no_leader is iirc only requited in Multiplayer games to prevent the multiplayer engine to add a leader from a multiplayer faction. victory_when_enemies_defeated=no
shouldn't be necessary either because the engine only checks for a sides defeat after all events have been fired.What you need is to specify the
side
when creating the unit.Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Enemy Leader appear one after another
You need
It sounds like gfgtdf spotted the real issue – the die event needs to specify the side of the next leader.
no_leader=yes
when there is no leader specified directly in the side tag, otherwise the game will raise an error or something like that. I think it still works despite the error, but still.It sounds like gfgtdf spotted the real issue – the die event needs to specify the side of the next leader.
Re: Enemy Leader appear one after another
This would be new to me, are you sure this is the case? I'm pretty sure it wasn't the case the last time I worked on that part of the code.Celtic_Minstrel wrote: ↑April 29th, 2023, 12:15 am You needno_leader=yes
when there is no leader specified directly in the side tag, otherwise the game will raise an error
Actually i think
no_leader
is implemented as just an alias for leader_lock
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Enemy Leader appear one after another
There are a bunch of places that deal with the no leader flag, but basically you're half right, in that it does set
There's also a TODO comment that suggests that
leader_lock
to true. I can't find the check I was thinking of though, maybe it was removed? Isn't there a check somewhere about whether [side]
has a type
key?There's also a TODO comment that suggests that
no_leader
should maybe be used more than it is. It actually looks really messy…Re: Enemy Leader appear one after another
Well there is a check whether it has a type= key and if it has a type attribute ilt creates a unit. (Although i believe we should move towards using [leader] as the usual practice.)Celtic_Minstrel wrote: ↑April 29th, 2023, 2:05 am There are a bunch of places that deal with the no leader flag, but basically you're half right, in that it does setleader_lock
to true. I can't find the check I was thinking of though, maybe it was removed? Isn't there a check somewhere about whether[side]
has atype
key?
Hmm maybe the comment means what I said above (move towards [leader]). Although i would not think it's messy, it's basically "no type attribute"="create no leader", pretty simple to me, and no_leader=leader_lockCeltic_Minstrel wrote: ↑April 29th, 2023, 2:05 am There's also a TODO comment that suggests thatno_leader
should maybe be used more than it is. It actually looks really messy…
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Enemy Leader appear one after another
Although it is clearly the case at present, this doesn't make sense to me at all.
Re: Enemy Leader appear one after another
Hmm well, if you know that all that no_leadsr does it to prevent the mo code from adding a leader then it makes a lot of sense to me. Basically no_leader= "don't change the specified leader (none)"
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: Enemy Leader appear one after another
Thank you all for your help! It worked.