Can someone tell me what i did wrong?

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
projecttemp
Posts: 16
Joined: June 1st, 2013, 1:21 am

Can someone tell me what i did wrong?

Post by projecttemp »

Neither of these will work. I am using stable version(10.6)

Code: Select all

#define ABILITY_ZZ_EXPERIENCED
    [dummy]
        id=zzexperienced
        name= _ "experienced"
        description= _ "When advancing, this unit will 10 experience points."
    [/dummy]
[/abilities]

[event]
    first_time_only=no
    name=post advance
    [filter_second]
		side=$side_number
		ability=zzexperienced
    [/filter_second]
    [set_variable]
		name=second_unit.experience
		add=10
    [/set_variable]
[/event]
[+abilities]
#enddef

Code: Select all

#define ABILITY_ZZ_EXPERIENCED
    [dummy]
        id=zzexperienced
        name= _ "experienced"
        description= _ "When advancing, this unit will 10 experience points."
    [/dummy]
[/abilities]

[event]
    first_time_only=no
    name=post advance
    [filter]
		side=$side_number
		ability=id=zzexperienced
    [/filter]
    [set_variable]
		name=unit.experience
		add=10
    [/set_variable]

[/event]
[+abilities]
#enddef
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Can someone tell me what i did wrong?

Post by Ceres »

After modifying a stored unit with [set_variable], you have to unstore it to make the changes come into effect.
projecttemp
Posts: 16
Joined: June 1st, 2013, 1:21 am

Re: Can someone tell me what i did wrong?

Post by projecttemp »

Even after unstoring, that did not work. I even try storing the unit at that location, change exp and unstore again, still don't work.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Can someone tell me what i did wrong?

Post by Ceres »

I reread your code, and noticed a few things that I seem to have missed the last time:
The first one doesn't work because you're refering to the secondary unit which doesn't really exist in an advance event. It should be [filter] and unit.experience.
The second one doesn't work because of ability=id=zzexperienced in the filter, that id= really shouldn't be in there, ability=zzexperienced was correct.
projecttemp
Posts: 16
Joined: June 1st, 2013, 1:21 am

Re: Can someone tell me what i did wrong?

Post by projecttemp »

Well after bunch of messing around, i got it working, so thank you.
Post Reply