Making non-human players side 1 in campaigns

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
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Making non-human players side 1 in campaigns

Post by Ken_Oh »

Why lock a thread? If it's really done, then no one will post in it. If it isn't actually done, then why not just leave it open so users don't have to make new, redundant threads. What's the use of locking it?

Anyway, here: http://www.wesnoth.org/forum/viewtopic.php?t=10781

I'm trying to make scenarios with the human player as the highest possible team number throughout a campaign. Noyga pointed out my problem in the first scenario (I wasn't listing the sides in order).

That worked, but now I've got a new problem. I think everything is fine for the next scenario that I'm working on, but instead of putting the human player's character on #2, it switches 1 for 2. It's not even giving me an error message. Can anyone figure out if I'm doing this wrong? I think the game just isn't allowing for it on a second scenario.

(Notes: This is just a rough draft of a scenario. In the chance that the WC macro is causing a problem, I included it. Also, the player's unit is a campaign unit).

Code: Select all

[scenario]
    id=Skelz
    #textdomain wesnoth-skelz
    name= _ "Skelz"
map_data="fffffffffffffffffffgfgRggfffffffffffffff
fffffffffffffgfggggffgRgfgffffffffffffff
ffffffggfgfgggvgggggggRRggvgggfgfgffffff
fffffffgggggggggggvggCCCggggggggtfffffff
ffggffggggtggggggggRCvtvCRgggggggggggfff
ffgggggggggggggRRRRgCCtCCgRRRRgggggggfff
fgfggggggggggRRggggvgg1gggvgggRRgggggggf
fggggggggggRRggggggggcgcccccggggRRgggvgg
ggggtggggnRRRngcccccccccccccccggggRRgggg
gggggggggckkkccccccscsssssssccccggggRggg
ggggggggcckkkccsssssssssssssssccccggRRgg
gggggggccckkkccsssssssssssssssssccccggRg
gggccccccckkkccsssssssssssssssssssccccRR
gccccccscckkkccsssssssssssssssssssscc//c
cccscssscckkkccsssssssssssssssssscc//ccs
cssssssscckkkccssssssssssssssssscg/ccsss
sssssssscckkkccssssssssssssssssscgggccss
sssssssscckkkccssssssssssssssssscgCvgcss
sssssssscckkkcccccccccccccscssssccgggcss
sssssssccckRkccccgcgcgccccccccscc//ccsss
sssssssccgRRRgcggggnnnggggcgccc//ccsssss
sssssscccgrRrggggggn2nggvggggR/cccccssss
ssssscccggtRrgggvgggnggggggRRgggcgccccss
sssccccggggrRggggggggggggggRrgggggggcccc
sccccgggggggRrgggggggggggggrggggggggggcc
"
    music="underground.ogg" 
    turns=30

    [story]
    [part]
        story="blah, blah"
    [/part]
    [/story]

    {DAWN}
    {MORNING}
    {AFTERNOON}
    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}

next_scenario=Rotting_Flesh_Stir

    [event]
    name=prestart
    [objectives]
    summary="Defeat the humans."
    note="sup"
    side=2
        [objective]
            description="Defeat human leaders."
            condition="win"
        [/objective]
        [objective]
            description="Your redeath."
            condition="lose"
        [/objective]
        [objective]
            description="Turns Run Out."
            condition="lose"
        [/objective]
      [/objectives]
      [/event]
    
[event]
name=prestart
    {STARTING_VILLAGES 1 9}
    
        [unit]
        type=Spearman
        x=10
        y=9
        description=Mmur
        user_description= _ "Mmur"
        ai_special=guardian
        side=2
        [modifications]
            {TRAIT_LOYAL}
        [/modifications]
        [/unit]
        [unit]
        type=Spearman
        x=14
        y=9
        description=Barc
        user_description= _ "Barc"
        ai_special=guardian
        side=2
        [modifications]
            {TRAIT_LOYAL}
        [/modifications]
        [/unit]
        [unit]
        description=Jakc
        user_description= _ "Jakc"
        type=Spearman
        x=35
        y=18
        side=2
        [modifications]
            {TRAIT_LOYAL}
        [/modifications]
        [/unit]
[/event]  

    [side]
    side=1
    type=Swordsman
    description=Gibley
    controller=ai
    user_description= _ "Gibley"
    team_name=Humans
    canrecruit=1
    gold=300
    recruit=Bowman, Spearman, Heavy Infantry, Horseman, Cavalry, Fencer, Mage
    income=2
        [ai]
            aggression=0.95
            grouping=aggressive
        [/ai]
    [/side]

    [side]
    side=2
    type=Disturbed
    controller=human
    description=????
    user_description= _ "????"
    unrenamable=yes
    team_name=you
    canrecruit=1
    recruit=Skeleton, Skeleton Archer, Ghost, Ghoul, Walking Corpse
    gold=50 
    [/side]


#define VILLAGES_DUPLICATE_CORPSES SIDE    
    [event]
        name=side turn
        first_time_only=no

        {IF side_number equals {SIDE} (
            [then]
                [store_unit]
                    [filter]
                        side={SIDE}
                        type=Walking Corpse
                    [/filter]

                    variable=temp
                    kill=no
                [/store_unit]

                {FOREACH temp i}
                    {VARIABLE_OP spawn_x format "$temp[$i].x"}
                    {VARIABLE_OP spawn_y format "$temp[$i].y"}

                    {IF_TERRAIN $spawn_x $spawn_y AaBbDeLptUVvYZ (
                        [then]
                            [unit]
                                type=Walking Corpse
                                upkeep=full
                                side={SIDE}
                                x=$spawn_x
                                y=$spawn_y
                            [/unit]
                        [/then]
                    )}
                {NEXT i}

                {CLEAR_VARIABLE temp}
            [/then]
        )}
    [/event]
#enddef

#define VILLAGES_DUPLICATE_SOULLESS SIDE
    [event]
        name=side turn
        first_time_only=no

        {IF side_number equals {SIDE} (
            [then]
                [store_unit]
                    [filter]
                        side={SIDE}
                        type=Walking Corpse
                    [/filter]

                    variable=temp
                    kill=no
                [/store_unit]

                {FOREACH temp i}
                    {VARIABLE_OP spawn_x format "$temp[$i].x"}
                    {VARIABLE_OP spawn_y format "$temp[$i].y"}

                    {IF_TERRAIN $spawn_x $spawn_y AaBbDeLptUVvYZ (
                        [then]
                            [unit]
                                type=Walking Corpse
                                upkeep=full
                                side={SIDE}
                                x=$spawn_x
                                y=$spawn_y
                            [/unit]
                        [/then]
                    )}
                {NEXT i}

                {CLEAR_VARIABLE temp}
            [/then]
        )}
    [/event]
#enddef

#define IF VAR OP VAL CONTENTS
    [if]
        [variable]
            name={VAR}
            {OP}={VAL}
        [/variable]

        {CONTENTS}
    [/if]
#enddef

#define IF_TERRAIN X Y TYPES CONTENTS
    [store_locations]
        x={X}
        y={Y}
        terrain={TYPES}
        variable=IF_TERRAIN_temp
    [/store_locations]
 
    [if]
        [variable]
            name=IF_TERRAIN_temp.length
            not_equals=0
        [/variable]
 
        {CONTENTS}
    [/if]
 
    {CLEAR_VARIABLE IF_TERRAIN_temp}
#enddef

{VILLAGES_DUPLICATE_CORPSES 2}
{VILLAGES_DUPLICATE_SOULLESS 2}

[/scenario]
Thanks.
Last edited by Ken_Oh on April 7th, 2006, 7:31 pm, edited 1 time in total.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

No direct reason for the side exchange seen, just two minor things.

In the recruit list, make no spaces after the comma. Against all layout basics. :P
The space is treated as it belongs to the id of the unit.

I´ve never seen capitals in team names, so I don´t know if it hurts. Better don´t use any when you don´t have dire need of them.
First read, then think. Read again, think again. And then post!
Post Reply