Will this code work?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
User avatar
TrashMan
Posts: 593
Joined: April 30th, 2008, 8:04 pm
Contact:

Will this code work?

Post by TrashMan » October 21st, 2013, 9:10 am

I have a scenario in which every unit that dies is riased back as undead... unless it's already undead or a holy type unit (paladin, priest)

And I'm horribly out of practice. Haven't done anything wesnoth relatd in months.

Code: Select all

#define RISE_DEAD X Y
    [filter]
        [not]
            race=undead
        [/not]    
    [/filter]

    [store_unit]
        variable=dead_store
        kill=yes
        [filter]
            x={X}
            y={Y}
        [/filter]
    [/store_unit]

#ifdef EASY
    [unit]
        name= _ "Risen Dead"
        type=Walking Corpse
        side=2
        x={X}
        y={Y}
        moves=0
        [modifications]
            {TRAIT_UNDEAD}
            {TRAIT_LOYAL}
        [/modifications]
    [/unit]
#endif
#ifdef NORMAL
    [unit]
        name= _ "Risen Dead"
        type=Soulless
        side=2
        x={X}
        y={Y}
        moves=0
        [modifications]
            {TRAIT_UNDEAD}
            {TRAIT_LOYAL}
        [/modifications]
    [/unit]
#endif
#ifdef HARD
    [unit]
        name= _ "Risen Dead"
        type=Ghoul
        side=2
        x={X}
        y={Y}
        moves=0
        [modifications]
            {TRAIT_UNDEAD}
            {TRAIT_LOYAL}
        [/modifications]
    [/unit]

    {CLEAR_VARIABLE dead_store}
#endif
#enddef

I'm not sure if this needs to be called by a "die" event.. I forgot almsot everything

Code: Select all


[event]
      name=die
 	[filter]
             [not]
               type=Paladin
             [/not]
             [not]
               type=Crusader
             [/not]      
 	[/filter]

      {RISE_DEAD x1 y1}
[/event]
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

AssassinT90
Posts: 39
Joined: December 20th, 2007, 9:47 am

Re: Will this code work?

Post by AssassinT90 » October 21st, 2013, 10:29 am

The only problem I saw was:
{RISE_DEAD x1 y1}

I think it should be:
{RISE_DEAD $x1 $y1}

User avatar
Ravana
Forum Moderator
Posts: 2262
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Will this code work?

Post by Ravana » October 21st, 2013, 1:15 pm

^.
But I do not see where you use dead_store, is that store_unit required?

User avatar
TrashMan
Posts: 593
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Will this code work?

Post by TrashMan » October 21st, 2013, 6:09 pm

I have no idea...
I think the X and Y values from the store are used...
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

Post Reply