Wilderlands Style?

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

Wilderlands Style?

Post by Ryuuzaki52 »

So I've been working on a map like Wilderlands...I have NO experience in WML at all. I mean I've tried really hard to get the map stuff, I just can't x.x. Would someone mind helping me out with like, a template? I'm just doing two players that start at a certain position, and I want monsters throughout the island...It'd be cool if someone could tell me how to make the leader switch between them too :\
Brilliand
Posts: 80
Joined: July 11th, 2009, 12:15 am

Re: Wilderlands Style?

Post by Brilliand »

What I suggest: Copy the Wilderlands scenario file (from "data/multiplayer/scenarios" in your Wesnoth install directory) - that's your template. Add/remove sides as needed, but keep the monster side as side 5 to make things easy (that means you have to have at least 5 sides, including that one - although you can always stick "allow_player=no" and "no_leader=yes" on sides 3 and 4 if you really want only 2 sides). Then look at all of the lines like this:

Code: Select all

                {MPWILD_WALKING_CORPSE 20 14 saurian}
                {MPWILD_SOULLESS 23 15 saurian}
                {MPWILD_UNIT 46 24 (Wolf)}
All that you need to change there are the two numbers (X and Y coordinates) and the last bit - which is either the undead_variation (for WALKING_CORPSE and SOULLESS) or the type (for UNIT). Make as many lines like that as you like, but keep them in that same section. Note that the ones that you list first will be chosen as leaders before those that you list later.

Finally, go to this line:

Code: Select all

                {MODIFY_UNIT x,y=38,36 canrecruit yes}
Change the two numbers to the X and Y coordinates of the first unit that you listed (the first leader for side 5).

Of course you'll also want to change the id, name, description and map_data lines.

If you want to know more specifics, the part that does the actual work of making the leader switch is the event at the bottom, that starts with:

Code: Select all

    [event]
        name=die
and ends with:

Code: Select all

    [/event]
The event right above it ("prestart") changes side 5 into a monsters-only side, and creates the monsters by triggering that stuff that's above the "[multiplayer]" line.
You are a Dark Adept: you dimmerse yourself in the dark arts...potentially with great rewards....
-JW's personality quiz
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Wilderlands Style?

Post by Ryuuzaki52 »

Problem is, I can't find that folder :< All I have is Add-Ons...Is it because I'm running Mac?

Nevermind! I got it :D Thank you VERY much! Does it need converted back to .cfg or is .txt fine? If so, how do I convert it back? o.o
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: Wilderlands Style?

Post by pauxlo »

If it is really a plain text file (not rtf or something, which some Mac text editors produce if you are not careful), just change the file name to ".cfg" (in the file manager).

(For all who still don't know where to find the files: EditingWesnoth - the Wilderlands original file is in the "game data" directory, the copied (and renamed) one should be in a new directory in your addon-folder.)
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Wilderlands Style?

Post by Ryuuzaki52 »

Alright, so here's my 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_Journey
    name= _ "5p — The Journey"
    description= _ "A Journey"
    map_data="{~add-ons/The_Journey}"

    {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]
                {UNIT 41 2 (Yeti)}
                {UNIT 42 2 (Yeti)}
                {UNIT 39 2 (Yeti)}
                {UNIT 40 2 (Yeti)}
                {UNIT 38 2 (Yeti)}
                {UNIT 39 3 (Yeti)}
                {UNIT 41 3 (Yeti)}
                {UNIT 42 3 (Yeti)}
                {UNIT 43 4 (Yeti)}
                {UNIT 41 4 (Yeti)}
                {UNIT 42 4 (Yeti)}

                [set_recruit]
                    side=5
                    recruit=""
                [/set_recruit]
                {MODIFY_UNIT x,y=38,36 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
It keeps giving me an error about "Expecting 5 arguments but only finding 3"...What'd I do wrong?

EDIT: Nevermind! I fixed it! Thank you all very much for you help! :D
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Wilderlands Style?

Post by Ryuuzaki52 »

Not sure how to delete this...So since my question is answered, I'll wait on a mod...
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: Wilderlands Style?

Post by pauxlo »

You don't delete it - simply do not add more posts.

This way, others having similar problems can find your's and the solution. By the way, it would be nice if you added your solution, and not only "Oh, I solved it".
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Wilderlands Style?

Post by Ryuuzaki52 »

Ah, alright. Thanks again!

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

[multiplayer]
    id=multiplayer_The_Journey
    name= _ "5p — The Journey"
    description= _ "A Journey"
    map_data="{~add-ons/DRPRyuu/maps/The_Journey}"

    {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 41 2 (Yeti)}
                {MPWILD_UNIT 42 2 (Yeti)}
                {MPWILD_UNIT 39 2 (Yeti)}
                {MPWILD_UNIT 40 2 (Yeti)}
                {MPWILD_UNIT 38 2 (Yeti)}
                {MPWILD_UNIT 39 3 (Yeti)}
                {MPWILD_UNIT 41 3 (Yeti)}
                {MPWILD_UNIT 42 3 (Yeti)}
                {MPWILD_UNIT 43 4 (Yeti)}
                {MPWILD_UNIT 41 4 (Yeti)}
                {MPWILD_UNIT 42 4 (Yeti)}

                [set_recruit]
                    side=5
                    recruit=""
                [/set_recruit]
                {MODIFY_UNIT x,y=42,4 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
That'll put a bunch of YETIS in the top right.
User avatar
Ryuuzaki52
Posts: 34
Joined: November 25th, 2010, 8:24 pm

Re: Wilderlands Style?

Post by Ryuuzaki52 »

I once again, looked around and can't seem to find the digit to use for a random x, y...What would it be?
User avatar
StDrake
Posts: 996
Joined: July 21st, 2009, 6:50 am

Re: Wilderlands Style?

Post by StDrake »

i think you'll have to work separately with x and y, but may someone correct me if wrong
overall see how the {RANDOM} macro works and apply the output to your x,y corrdinate variables

Code: Select all

[set_variable]
name=<your x or y variable name, or some temporary variable name>
rand=<starting number>..<ending number>
[/set_variable]
Like cats? I've made a whole faction of them to kick ass with!
Don't like cats? I've made a whole faction of them to kick their asses! So everyone's happy :)
Felinian faction is part of the Beyond Southern Hells era
kitties need sprites! art topic here
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Wilderlands Style?

Post by bigkahuna »

More like this (where x_end and y_end are the last co-ordinates on your map... put these in manually because idk the size of your map):

Code: Select all

{RANDOM 1..x_end}
{VARIABLE x_co $random}
{RANDOM 1..y_end}
{VARIABLE y_co $random}

[unit]
    x,y=$x_co,$y_co
    ...
[/unit]
{CLEAR_VARIABLE x_co,y_co,random}
Check out my campaign Sweet Revenge!
Join the new R2D forum!
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Wilderlands Style?

Post by Sapient »

bigk - that won't work...

{RANDOM 1..x_end}

should be :

{RANDOM 1..$x_end}

but better would be to use :

Code: Select all

[store_map_dimensions]
  variable=map
[/store_map_dimensions]
[set_variable]
  name=random_x
  rand="1..$map.width"
[/set_variable]
[set_variable]
  name=random_y
  rand="1..$map.height"
[/set_variable]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Wilderlands Style?

Post by bigkahuna »

Sapient wrote:bigk - that won't work...
See my last post:
bigkahuna wrote:where x_end and y_end are the last co-ordinates on your map
I asked him to replace x_end and y_end with the numbers of the last co-ordinates of his map... I never meant for it to be placed directly into the random macro...
Sapient wrote:but better would be to use :
Yeah I knew there was such a tag out there but didn't remember its usage. Thanks.
Check out my campaign Sweet Revenge!
Join the new R2D forum!
Brilliand
Posts: 80
Joined: July 11th, 2009, 12:15 am

Re: Wilderlands Style?

Post by Brilliand »

The SCATTER_UNITS macro might also be suitable.
You are a Dark Adept: you dimmerse yourself in the dark arts...potentially with great rewards....
-JW's personality quiz
Post Reply