Dialogue between characters

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Post Reply
Kadel_007
Posts: 16
Joined: November 21st, 2021, 9:14 pm

Dialogue between characters

Post by Kadel_007 »

There is a scenario, where a player fights against 2 enemy leaders.
I try to make the dialogue between MyLeader and Unit, that killed the second enemy leader (additional condition: after the death of first enemy leader)

The code:

Code: Select all


[event]
    name="last breath"
    first_time_only=no
    [filter]
        id=EnemyLeader
		id=EnemyLeader2
    [/filter]
    [filter_second]
        side=2
    [/filter_second]
    [message]
        speaker=second_unit
        message= _ "Message"
    [/message]
	[message]
        speaker=MyLeader
        message= _ "Message."
    [/message]
	[/event]

So, how can I do it properly?
An additional question is: "What IDE should I use for WML?" I use notepad, but I can't see the colored syntax.
User avatar
Straff
Posts: 86
Joined: September 27th, 2020, 2:53 pm

Re: Dialogue between characters

Post by Straff »

Code: Select all

    [event]
        name=die
        first_time_only=no
        [filter]
            id=EnemyLeader
            [or]
                id=EnemyLeader2
            [/or]
        [/filter]
        # I guess you are side=1
        [filter_second]
            side=1
        [/filter_second]
        [message]
            speaker=second_unit
            message= _ "Message"
        [/message]
        [message]
            speaker=MyLeader
            message= _ "Message."
        [/message]
    [/event]


viewtopic.php?t=44392

I recommend Notepad++ instead of Notepad
Last edited by Straff on November 22nd, 2021, 6:15 pm, edited 1 time in total.
Kadel_007
Posts: 16
Joined: November 21st, 2021, 9:14 pm

Re: Dialogue between characters

Post by Kadel_007 »

Straff wrote: November 22nd, 2021, 4:49 pm

Code: Select all

    [event]
        name=die
        first_time_only=no
        [filter]
            id=EnemyLeader
            [or]
                id=EnemyLeader2
            [/or]
        [/filter]
        # I guess yo are side=1
        [filter_second]
            side=1
        [/filter_second]
        [message]
            speaker=second_unit
            message= _ "Message"
        [/message]
        [message]
            speaker=MyLeader
            message= _ "Message."
        [/message]
    [/event]
Thank you very much.

viewtopic.php?t=44392

I recommend Notepad++ instead of Notepad
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Dialogue between characters

Post by Spannerbag »

Kadel_007 wrote: November 22nd, 2021, 4:27 pm There is a scenario, where a player fights against 2 enemy leaders.
I try to make the dialogue between MyLeader and Unit, that killed the second enemy leader (additional condition: after the death of first enemy leader)

The code:

Code: Select all


[event]
    name="last breath"
    first_time_only=no
    [filter]
        id=EnemyLeader
		id=EnemyLeader2
    [/filter]
    [filter_second]
        side=2
    [/filter_second]
    [message]
        speaker=second_unit
        message= _ "Message"
    [/message]
	[message]
        speaker=MyLeader
        message= _ "Message."
    [/message]
	[/event]

So, how can I do it properly?
An additional question is: "What IDE should I use for WML?" I use notepad, but I can't see the colored syntax.
I don't know how you have set up the game but the following should work whether the enemy leaders are on the same or different sides.
The logic should also work if the enemies are killed by an ai (non-player) unit and for 1 or more enemy leaders; the last enemy leader to die will always fire this event. (If you want, say, the second leader to die to fire this event just alter count in [have_unit] accordingly.)
You can extend the logic if you want to, e.g. to issue different messages depending on the side of the unit that killed the enemy leader.
Here, regardless of which unit kills the (only remaining) enemy leader:
- the second (killing) unit always says "Killing_Unit_Message"
- the player leader always says "Player_Leader_Message"

There are many variations and different ways to do what you want so doubtless other folk will post other examples.
Just choose which one works best for you :-)

<<enemy_sides>> is the list of sides containing the enemy leader(s) you want to include in this event (e.g. 2,3).

Code: Select all

[event]
    name="last breath"
    [filter_condition]
        [have_unit]
          side=<<enemy_sides>>
          canrecruit=yes
          count=0
        [/have_unit]
    [/filter_condition]
    [message]
        speaker=second_unit
        message= _ "Killing_Unit_Message"
    [/message]
	[message]
        speaker=MyLeader
        message= _ "Player_Leader_Message"
    [/message]
[/event]
Hope this helps/makes sense!

Edit: under some circumstances this might not work as you want it to, e.g. if the death of the last leader spawns/reveals another.
I'm assuming this isn't the case here.

Cheers!
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, 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...
Kadel_007
Posts: 16
Joined: November 21st, 2021, 9:14 pm

Re: Dialogue between characters

Post by Kadel_007 »

Spannerbag wrote: November 23rd, 2021, 2:33 pm
Kadel_007 wrote: November 22nd, 2021, 4:27 pm There is a scenario, where a player fights against 2 enemy leaders.
I try to make the dialogue between MyLeader and Unit, that killed the second enemy leader (additional condition: after the death of first enemy leader)

The code:

Code: Select all


[event]
    name="last breath"
    first_time_only=no
    [filter]
        id=EnemyLeader
		id=EnemyLeader2
    [/filter]
    [filter_second]
        side=2
    [/filter_second]
    [message]
        speaker=second_unit
        message= _ "Message"
    [/message]
	[message]
        speaker=MyLeader
        message= _ "Message."
    [/message]
	[/event]

So, how can I do it properly?
An additional question is: "What IDE should I use for WML?" I use notepad, but I can't see the colored syntax.
I don't know how you have set up the game but the following should work whether the enemy leaders are on the same or different sides.
The logic should also work if the enemies are killed by an ai (non-player) unit and for 1 or more enemy leaders; the last enemy leader to die will always fire this event. (If you want, say, the second leader to die to fire this event just alter count in [have_unit] accordingly.)
You can extend the logic if you want to, e.g. to issue different messages depending on the side of the unit that killed the enemy leader.
Here, regardless of which unit kills the (only remaining) enemy leader:
- the second (killing) unit always says "Killing_Unit_Message"
- the player leader always says "Player_Leader_Message"

There are many variations and different ways to do what you want so doubtless other folk will post other examples.
Just choose which one works best for you :-)

<<enemy_sides>> is the list of sides containing the enemy leader(s) you want to include in this event (e.g. 2,3).

Code: Select all

[event]
    name="last breath"
    [filter_condition]
        [have_unit]
          side=<<enemy_sides>>
          canrecruit=yes
          count=0
        [/have_unit]
    [/filter_condition]
    [message]
        speaker=second_unit
        message= _ "Killing_Unit_Message"
    [/message]
	[message]
        speaker=MyLeader
        message= _ "Player_Leader_Message"
    [/message]
[/event]
Hope this helps/makes sense!

Edit: under some circumstances this might not work as you want it to, e.g. if the death of the last leader spawns/reveals another.
I'm assuming this isn't the case here.

Cheers!
--Spannerbag
Hah, Thank You too. I managed on my own with another code, but I will try this too
Post Reply