No xp when moving units at scenario end

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
Numero
Posts: 59
Joined: August 7th, 2018, 2:11 pm

No xp when moving units at scenario end

Post by Numero »

I have a bug, that I do not understand. When killing the enemy leader my scenario ends and for story reasons I move some of the players units afterwards. But if I happen to also move the unit, that killed the enemy leader, the unit doesn't get the 16 xp for killing. I don't understand why. This is my code:

Code: Select all

	
    #Victory
    [event]
        name=die
        [filter]
            id=Hermann
        [/filter]
        [message]
            speaker=Umaduro
            message= _ "We have far fewer men we should go."
        [/message]
        [if]
            [have_unit]
                side = 1
                type_adv_tree =Orcish Archer, Orcish Grunt, Wolf Rider 
                [not]
                    id = Umaduro, Tragtrad
                [/not]
            [/have_unit]
            [then]
                [modify_unit]
                    [filter]
                        side = 1
                        type_adv_tree =Orcish Archer, Orcish Grunt, Wolf Rider 
                        [not]
                            id = Umaduro, Tragtrad
                        [/not]
                    [/filter]
                    role = rallied
                [/modify_unit]
                [message]
                    role=rallied
                    message= _ "YES! FOR TRAGTRAD! FOR THE BLOODTHORNS!"
                [/message]                
            [/then]
        [/if]
        [move_unit]
            id=Tragtrad
            to_x = 40
            to_y = 30
        [/move_unit]        
        [move_unit]
            id=Umaduro
            to_x = 40
            to_y = 30
        [/move_unit]
        [role]
            side= 1
            [not]
                id=Tragtrad,Umaduro,Marast the lost
            [/not]
            [not]
                role=move
            [/not]
            role= move
        [/role]
        [role]
            side= 1
            [not]
                id=Tragtrad,Umaduro,Marast the lost
            [/not]
            [not]
                role=move
            [/not]
            role= move
        [/role]
        [move_unit]
            role=move
            to_x = 40
            to_y = 30
        [/move_unit]
        [message]
            speaker=Fal Khag
            message= _ "Yeah, you coward! Flee with your feeblelings and cravens. You, 'chief of renegades', pah!"
        [/message]
        [message]
            speaker=narrator
            image="wesnoth-icon.png"
            message= _ "Please don't forget to give feedback (good and bad)! The link is in the campaign overview."
        [/message]
        [endlevel]
            result=victory
            bonus=yes
            {NEW_GOLD_CARRYOVER 20}
        [/endlevel]
    [/event]
Author of 'An Orcish Might' viewtopic.php?t=57032
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: No xp when moving units at scenario end

Post by white_haired_uncle »

Is 40,30 on the map?

Is it the move that causes the problem, or the modify_unit ?

Could you use a victory event instead?
Speak softly, and carry Doombringer.
Numero
Posts: 59
Joined: August 7th, 2018, 2:11 pm

Re: No xp when moving units at scenario end

Post by Numero »

40,30 is in the map at the edge, but all units are moved to a valid tile.

I am pretty sure the move is the cause, because only when they kill the get no xp

I have never used a victory event would it be called after the [endlevel?] because there a still enemy leaders on the map after the death of Hermann
Author of 'An Orcish Might' viewtopic.php?t=57032
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: No xp when moving units at scenario end

Post by white_haired_uncle »

Numero wrote: June 20th, 2024, 11:33 am
I have never used a victory event would it be called after the [endlevel?] because there a still enemy leaders on the map after the death of Hermann
Yes, it's called by the result=victory in [endlevel] if I'm reading the wiki right
Speak softly, and carry Doombringer.
Numero
Posts: 59
Joined: August 7th, 2018, 2:11 pm

Re: No xp when moving units at scenario end

Post by Numero »

using the victory event has worked!

thank you:)
Author of 'An Orcish Might' viewtopic.php?t=57032
Post Reply