Modifing Default Monsters?

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
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Modifing Default Monsters?

Post by Ryuuzaki52 »

I'm looking to set a "Special ability" on a few random monsters on my map. I know how to PLACE the monsters, but if I were to say, want to put Ambush on a Giant Spider, how would I put it in this script?

Code: Select all

#textdomain wesnoth-multiplayer

#define MPWILD_UNIT X Y TYPE
    [unit]
        type={TYPE}
        side=5
        x={X}
        y={Y}
        random_traits=no
    [/unit]
#enddef

#define MPWILD_WALKING_CORPSE X Y VARIATION_NAME
    [unit]
        type=Walking Corpse
        side=5
        x={X}
        y={Y}
        variation={VARIATION_NAME}
        #random_traits=no
    [/unit]
#enddef

#define MPWILD_SOULLESS X Y VARIATION_NAME
    [unit]
        type=Soulless
        side=5
        x={X}
        y={Y}
        variation={VARIATION_NAME}
        #random_traits=no
    [/unit]
#enddef

[multiplayer]
    id=multiplayer_The_Autumn_Void
    name= _ "5p — The Autumn Void"
    description= _ "A visit to the multicolored plains of the Autumn Void."
    map_data="{~add-ons/maps/The_Autumn_Void}"

    {DEFAULT_SCHEDULE}
    {DEFAULT_MUSIC_PLAYLIST}

    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=1
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=2
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=3
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=4
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_value=0
        [/ai]
        side=5
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]

    [event]
        name=prestart
        [if]
            [have_unit]
                side=5
            [/have_unit]
            [then]
                [kill]
                    animate=no
                    fire_event=no
                    side=5
                [/kill]
                {MPWILD_UNIT 4 100 (Yeti)}
                {MPWILD_UNIT 36 97 (Yeti)}
                {MPWILD_UNIT 50 50 (Skeletal Dragon)}
                {MPWILD_UNIT 97 1 (Skeletal Dragon)}
                {MPWILD_UNIT 98 100 (Giant Spider)}
                {MPWILD_UNIT 26 72 (Giant Spider)}
                {MPWILD_UNIT 35 67 (Giant Spider)}
                {MPWILD_UNIT 47 47 (Giant Spider)}
                {MPWILD_UNIT 95 60 (Giant Spider)}
                {MPWILD_UNIT 74 94 (Giant Spider)}
                {MPWILD_UNIT 67 85 (Giant Spider)}
                {MPWILD_UNIT 70 8 (Giant Scorpion)}
                {MPWILD_UNIT 79 15 (Giant Scorpion)}
                {MPWILD_UNIT 46 15 (Giant Scorpion)}
                {MPWILD_UNIT 42 30 (Giant Scorpion)}
                {MPWILD_UNIT 59 84 (Cuttle Fish)}
                {MPWILD_UNIT 76 51 (Cuttle Fish)}
                {MPWILD_UNIT 96 31 (Cuttle Fish)}
                {MPWILD_UNIT 42 5 (Cuttle Fish)}
                {MPWILD_UNIT 68 73 (Cuttle Fish)}
                {MPWILD_UNIT 5 32 (Cuttle Fish)}
                {MPWILD_UNIT 3 1 (Cuttle Fish)}
                {MPWILD_UNIT 39 1 (Tentacle of the Deep)}
                {MPWILD_UNIT 38 1 (Tentacle of the Deep)}
                {MPWILD_UNIT 44 2 (Tentacle of the Deep)}
                {MPWILD_UNIT 19 26 (Tentacle of the Deep)}
                {MPWILD_UNIT 4 37 (Tentacle of the Deep)}
                {MPWILD_UNIT 5 38 (Tentacle of the Deep)}
                {MPWILD_UNIT 4 38 (Tentacle of the Deep)}
                {MPWILD_UNIT 4 33 (Tentacle of the Deep)}
                {MPWILD_UNIT 6 42 (Tentacle of the Deep)}
                {MPWILD_UNIT 7 50 (Tentacle of the Deep)}
                {MPWILD_UNIT 8 59 (Tentacle of the Deep)}
                {MPWILD_UNIT 7 59 (Tentacle of the Deep)}          
                {MPWILD_UNIT 8 58 (Tentacle of the Deep)}
                {MPWILD_UNIT 9 59 (Tentacle of the Deep)}
                {MPWILD_UNIT 14 55 (Tentacle of the Deep)}
                {MPWILD_UNIT 60 56 (Tentacle of the Deep)}
                {MPWILD_UNIT 83 58 (Tentacle of the Deep)}
                {MPWILD_UNIT 60 87 (Tentacle of the Deep)}
                {MPWILD_UNIT 42 92 (Tentacle of the Deep)}
                {MPWILD_UNIT 41 92 (Tentacle of the Deep)}
                {MPWILD_UNIT 66 94 (Tentacle of the Deep)}

                {MPWILD_WALKING_CORPSE 68 19 saurian}
                {MPWILD_WALKING_CORPSE 68 18 saurian}
                {MPWILD_SOULLESS 67 19 saurian}
                {MPWILD_WALKING_CORPSE 67 18 saurian}
                {MPWILD_WALKING_CORPSE 69 20 saurian}

                {MPWILD_WALKING_CORPSE 21 20 saurian}
                {MPWILD_WALKING_CORPSE 21 21 saurian}
                {MPWILD_SOULLESS 25 21 saurian}
                {MPWILD_WALKING_CORPSE 29 22 saurian}
                
                {MPWILD_WALKING_CORPSE 91 39 saurian}
                {MPWILD_WALKING_CORPSE 91 32 saurian}

                {MPWILD_WALKING_CORPSE 35 42 saurian}
                {MPWILD_WALKING_CORPSE 34 42 saurian}

                {MPWILD_WALKING_CORPSE 95 68 saurian}
                {MPWILD_SOULLESS 96 68 saurian}
                {MPWILD_WALKING_CORPSE 97 68 saurian}

                {MPWILD_WALKING_CORPSE 9 55 swimmer}
                {MPWILD_SOULLESS 3 56 swimmer}
                {MPWILD_WALKING_CORPSE 7 62 swimmer}
                {MPWILD_WALKING_CORPSE 29 61 swimmer}
                {MPWILD_WALKING_CORPSE 44 77 swimmer}
                {MPWILD_WALKING_CORPSE 62 88 swimmer}

                [set_recruit]
                    side=5
                    recruit=""
                [/set_recruit]
                {MODIFY_UNIT x,y=50,50 canrecruit yes}
            [/then]
        [/if]
    [/event]

    [event]
        name=die
        first_time_only=no
        [filter]
            canrecruit=yes
            side=5
        [/filter]
        [store_unit]
            [filter]
                side=5
                canrecruit=no
            [/filter]
            variable=newleader
            kill=no
        [/store_unit]
        [if]
            [variable]
                name=newleader.length
                greater_than=0
            [/variable]
            [then]
                {VARIABLE newleader.canrecruit yes}
                [unstore_unit]
                    variable=newleader
                [/unstore_unit]
            [/then]
        [/if]
    [/event]
[/multiplayer]

#undef MPWILD_UNIT
#undef MPWILD_WALKING_CORPSE
#undef MPWILD_SOULLESS
Note: That isn't the script. I haven't written it yet. But it'd look almost exactly like that.

EDIT: I'm pretty sure it'd go in here or something

Code: Select all

    [unit]
        type=Soulless
        side=5
        x={X}
        y={Y}
        variation={VARIATION_NAME}
        #random_traits=no
    [/unit]
But not sure of the terms to use x.x
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Modifing Default Monsters?

Post by Alarantalara »

Add a [modifications] tag to the unit. Inside that tag, add any traits or abilities you like.
An example of a spider with ambush:

Code: Select all

[unit]
    type=Giant Spider
    x,y=10,10
    side=2
    [modifications]
        [object]
            [effect]
                apply_to=new_ability
                [abilities]
                    {ABILITY_AMBUSH}
                [/abilities]
            [/effect]
        [/object]
    [/modifications]
[/unit]
For other abilities or traits, I recommend the WML reference guide.
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Modifing Default Monsters?

Post by bigkahuna »

Alarantalara wrote:Add a [modifications] tag to the unit. Inside that tag, add any traits or abilities you like.
You could do that for other effects (hp and such I suppose), but for this specific case this would be less wieldy IMO. (Has been tested and works.)

Code: Select all

[unit]
    type=Giant Spider
    x,y=10,10
    side=2
    [abilities]
        {ABILITY_AMBUSH}
    [/abilities]
[/unit]
Check out my campaign Sweet Revenge!
Join the new R2D forum!
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Modifing Default Monsters?

Post by Ryuuzaki52 »

Where exactly would I put that? I'm trying to shove it in it's own

Code: Select all

    [unit]
        type=Soulless
        side=5
        x={X}
        y={Y}
        variation={VARIATION_NAME}
        #random_traits=no
    [/unit]
Type thing o.o Is that wrong?
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Modifing Default Monsters?

Post by bigkahuna »

This has not been tested, but I believe that [abilities] can be left empty for no extra abilities. I'd test it first, though.

Code: Select all

#define MP_WILD_UNIT TYPE X Y ABILITIES
    [unit]
        type={TYPE}
        side=5
        x={X}
        y={Y}
        [abilities]
            {ABILITIES}
        [/abilities]
    [/unit]
#enddef
If the unit has an ability - {MP_WILD_UNIT Spearman 45 23 ({ABILITY_AMBUSH})}
If the unit does NOT have an ability - {MP_WILD_UNIT Spearman 45 23 ()}
Check out my campaign Sweet Revenge!
Join the new R2D forum!
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Modifing Default Monsters?

Post by Ryuuzaki52 »

This is what I have but it's giving me an "Expects 3 arguments but sees 4" error. Sorry, I'm really new to this scripting x.x

Code: Select all

#textdomain wesnoth-multiplayer

#define MPABILITY_UNIT X Y TYPE
    [unit]
        type={TYPE}
        side=5
        x={X}
        y={Y}
        [abilities]
          {ABILITIES}
        [/abilities]
    [/unit]
#enddef

#define MPWILD_UNIT X Y TYPE
    [unit]
        type={TYPE}
        side=5
        x={X}
        y={Y}
        random_traits=no
    [/unit]
#enddef

#define MPWILD_WALKING_CORPSE X Y VARIATION_NAME
    [unit]
        type=Walking Corpse
        side=5
        x={X}
        y={Y}
        variation={VARIATION_NAME}
        #random_traits=no
    [/unit]
#enddef

#define MPWILD_SOULLESS X Y VARIATION_NAME
    [unit]
        type=Soulless
        side=5
        x={X}
        y={Y}
        variation={VARIATION_NAME}
        #random_traits=no
    [/unit]
#enddef

[multiplayer]
    id=multiplayer_Wetlands
    name= _ "5p — Wetlands"
    description= _ "Dangerous Marshes Fill This Realm"
    map_data="{~add-ons/DRPRyuu/maps/Wetlands}"

    {DEFAULT_SCHEDULE}
    {DEFAULT_MUSIC_PLAYLIST}

    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=1
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=2
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=3
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_per_scout=16
        [/ai]
        side=4
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]
    [side]
        [ai]
            villages_value=0
        [/ai]
        side=5
        canrecruit=yes
        controller=human
        village_gold=2
        fog=yes
    [/side]

    [event]
        name=prestart
        [if]
            [have_unit]
                side=5
            [/have_unit]
            [then]
                [kill]
                    animate=no
                    fire_event=no
                    side=5
                [/kill]
                {MPWILD_UNIT 20 20 (Skeletal Dragon)}
                {MPABILITY_UNIT 38 45 (Giant Spider)({ABILITY_AMBUSH})}

                {MPWILD_SOULLESS 22 1 saurian}
                {MPWILD_WALKING_CORPSE 22 2 saurian}
                {MPWILD_WALKING_CORPSE 22 3 saurian}
                {MPWILD_WALKING_CORPSE 22 4 saurian}
                {MPWILD_WALKING_CORPSE 22 5 saurian}
                
                {MPWILD_SOULLESS 12 22 swimmer}
                {MPWILD_WALKING_CORPSE 12 23 swimmer}

                [set_recruit]
                    side=5
                    recruit=""
                [/set_recruit]
                {MODIFY_UNIT x,y=50,50 canrecruit yes}
            [/then]
        [/if]
    [/event]

    [event]
        name=die
        first_time_only=no
        [filter]
            canrecruit=yes
            side=5
        [/filter]
        [store_unit]
            [filter]
                side=5
                canrecruit=no
            [/filter]
            variable=newleader
            kill=no
        [/store_unit]
        [if]
            [variable]
                name=newleader.length
                greater_than=0
            [/variable]
            [then]
                {VARIABLE newleader.canrecruit yes}
                [unstore_unit]
                    variable=newleader
                [/unstore_unit]
            [/then]
        [/if]
    [/event]
[/multiplayer]

#undef MPWILD_UNIT
#undef MPWILD_WALKING_CORPSE
#undef MPWILD_SOULLESS
#undef MPABILITY_UNIT
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Modifing Default Monsters?

Post by bigkahuna »

Ryuuzaki52 wrote:#define MPABILITY_UNIT X Y TYPE
This should be changed to:

Code: Select all

#define MPABILITY_UNIT X Y TYPE ABILITY
As I had previously posted.
Check out my campaign Sweet Revenge!
Join the new R2D forum!
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Modifing Default Monsters?

Post by Ryuuzaki52 »

Ah, alright. My bad. I got that in there and now it's informing me that it can't find an abilities folder in my standard "Scenario-Map" area...(There ISN'T one)
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Modifing Default Monsters?

Post by bigkahuna »

See my reply to your PM.
Check out my campaign Sweet Revenge!
Join the new R2D forum!
Post Reply