Sides

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.
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Sides

Post by smchronos »

I was wondering if it was possible to add a unit to a new side (not listed previously). For example, on multiplayer, I want to have an automatic computer-controlled team that comes into the game. However, when I create a 5th side (and set it so that it is automatically controlled by ai), other players can still select that side, and I can't even see it available to manually set to a computer player.

So, what I'm really asking is if I can create a new side in the middle of a multiplayer scenario. Is that possible?
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

No, currently any side you use must have a starting location.
Btw it's easy to mask in the scenario some starting location, using something like this :

Code: Select all

#define HIDE_STARTUP_LOCATION SIDE REPLACEMENT_TERRAIN
	[store_starting_location]
		side={SIDE}
		variable=starting_location		
	[/store_starting_location]
	[terrain]
		x=$starting_location.x
		y=$starting_location.y
		letter={REPLACEMENT_TERRAIN}
	[/terrain]
	[clear_variable]
		name=starting_location
	[/clear_variable]
#enddef
Use this trick with no_leader=yes / canrecruit=0 sides to make additional sides that do not appear at the begining of the scenario.
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Alright, thanks. This is off my original title's topic, but I've already made a few topics in here, so I'll post my problem in this last one.

Code: Select all

	[event]
	name=side turn

	[if]
	 [variable]
	 name=turn_number
	 equals=3
	 [/variable]
	 [variable]
	 name=side_number
	 equals=5
	 [/variable]
	
	[then]
	 [unit]
	 type=Goblin Wolf
	 generate_description=yes
	 x,y=1,2
	 side=5
	 [/unit]
	 
	 [unit]
	 type=Goblin Wolf
	 generate_description=yes
	 x,y=3,3
	 side=5
	 [/unit]

	 [unit]
	 type=Goblin Knight
	 description=Fasal
	 x,y=2,2
	 side=5
	 [/unit]

	[message]
	description=Fasal
	message= _ "Bwahaha! Did you really think you had it that easy?! We'll kill you all!"
	[/message]
	[/then]
	[/if]

	[if]
	 [variable]
	 name=turn_number
	 equals=6
	 [/variable]
	 [variable]
	 name=side_number
	 equals=5
	 [/variable]
	
	[then]
	 [unit]
	 type=Goblin Wolf
	 generate_description=yes
	 x,y=1,2
	 side=5
	 [/unit]
	 
	 [unit]
	 type=Goblin Wolf
	 generate_description=yes
	 x,y=3,3
	 side=5
	 [/unit]

	 [unit]
	 type=Goblin Wolf
	 generate_description=yes
	 x,y=2,3
	 side=5
	 [/unit]

	 [unit]
	 type=Goblin Wolf
	 generate_description=yes
	 x,y=2,1
	 side=5
	 [/unit]

	 [unit]
	 type=Goblin Knight
	 description=Javar
	 x,y=2,2
	 side=5
	 [/unit]

	[message]
	description=Javar
	message= _ "It's time you feel my wrath! Cringe below me in terror!"
	[/message]
	[/then]
	[/if]

	[/event]
The units never appear during their turn...or at all.
What did I do wrong this time? ;)
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

Put a [redraw][/redraw] before the [message]s to make the new units appear.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

And shouldn´t be the second variable condition in an [and] tag? Else, what is this good for?
First read, then think. Read again, think again. And then post!
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

So, something more like this:

Code: Select all

 [event]
   name=side turn

   [if]
    [variable]
    name=turn_number
    equals=3
    [/variable]
   [and]
    [variable]
    name=side_number
    equals=5
    [/variable]
   [/and]
   
   [then]
    [unit]
    type=Goblin Wolf
    generate_description=yes
    x,y=1,2
    side=5
    [/unit]
   
    [unit]
    type=Goblin Wolf
    generate_description=yes
    x,y=3,3
    side=5
    [/unit]

    [unit]
    type=Goblin Knight
    description=Fasal
    x,y=2,2
    side=5
    [/unit]

   [redraw]
   [message]
   description=Fasal
   message= _ "Bwahaha! Did you really think you had it that easy?! We'll kill you all!"
   [/message]
   [/redraw]
   [/then]
   [/if]

   [if]
    [variable]
    name=turn_number
    equals=6
    [/variable]
   [and
    [variable]
    name=side_number
    equals=5
    [/variable]
   [/and]
   
   [then]
    [unit]
    type=Goblin Wolf
    generate_description=yes
    x,y=1,2
    side=5
    [/unit]
   
    [unit]
    type=Goblin Wolf
    generate_description=yes
    x,y=3,3
    side=5
    [/unit]

    [unit]
    type=Goblin Wolf
    generate_description=yes
    x,y=2,3
    side=5
    [/unit]

    [unit]
    type=Goblin Wolf
    generate_description=yes
    x,y=2,1
    side=5
    [/unit]

    [unit]
    type=Goblin Knight
    description=Javar
    x,y=2,2
    side=5
    [/unit]

   [redraw]
   [message]
   description=Javar
   message= _ "It's time you feel my wrath! Cringe below me in terror!"
   [/message]
   [/redraw]
   [/then]
   [/if]

   [/event]
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Yes, but [and] is in trunk only, not in the stable version. There you can trick it with
[if]
(variable stuff)
[then]
[if]
(variable stuff)
[then]
(units)
[/then]
[/if]
[/then]
[/if]

General WML question: What happens to an [or] in [and]? Is this possible?
First read, then think. Read again, think again. And then post!
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Well, you've confused me now...
But I am using the most recent release from Yogi (1.1.2)
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I´m vers sorry if I confused you. On your version, the tag should work. :wink:
First read, then think. Read again, think again. And then post!
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Well, I'm now getting this error when I start multiplayer (but after this message, the server loads and I connect) and the script still doesn't work.
Picture You may need to use the zoom button to view the image properly.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Pleas send the related files, then someone can check it out.
First read, then think. Read again, think again. And then post!
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

If what you mean is the three files which were:
4p_Crossroads

Game

Multiplayer
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I didn´t mean the files in the wesnoth root directory. I should have articulated clearer, I meant you file where you give the path to the MP scenario, and the scenario file itself (wich you posted)

Then, I found some things.
You can´t set any recruits and names/descriptions in MP. When you start a game, you always have your username, and choose the era.(recruitment!)
This can be fixed when you use this code in the start event:

Code: Select all

[disallow_recruit]
    side=5
    type="Bowman,Cavalryman,Horseman,Mage,Heavy Infantryman,Fencer,Spearman,Merman Fighter"
  [/disallow_recruit]
  [disallow_recruit]
    side=5
    type="Goblin Spearman,Orcish Grunt,Orcish Archer,Wolf Rider,Troll Whelp,Orcish Assassin,Naga Fighter"
  [/disallow_recruit]
  [disallow_recruit]
    side=5
    type="Dwarvish Fighter,Dwarvish Guardsman,Dwarvish Thunderer,Dwarvish Ulfserker,Gryphon Rider,Poacher,Thug,Thief,Footpad"
  [/disallow_recruit]
  [disallow_recruit]
    side=5
    type="Elvish Archer,Elvish Fighter,Elvish Scout,Elvish Shaman,Wose,Merman Hunter"
  [/disallow_recruit]
  [disallow_recruit]
    side=5
    type="Drake Fighter,Drake Burner,Drake Glider,Drake Clasher,Saurian Skirmisher,Saurian Tribalist"
  [/disallow_recruit]
  [disallow_recruit]
    side=5
    type="Dark Adept,Skeleton,Skeleton Archer,Ghoul,Ghost,Vampire Bat,Walking Corpse"
  [/disallow_recruit]
to disallow all standard units. Then insert an [allow_recruit] and list all the units he should be able to recruit. also you will need this to fix a leader type and a description.

Code: Select all

[store_unit]
variable=side_modify
kill=yes
 [filter]
 side=5
 canrecruit=1 #not essential, just to make sure
 [/filter]
[/store_unit]
{VARIABLE side_modify.description Barvolis}
{VARIABLE side_modify.type (Orcish Ruler)}
[unstore_unit]
variable=side_modify
[/unstore_unit]
And all this in the start event, as the first.

And then, you always only have [/redraw]. But it should be [redraw] [/redraw]. I know WML is sometimes a bit weird. This may help you somewhere:
#define RERAW
[redraw] [/redraw]
#enddef
And better define things inside your scenario.

And the last I noticed:

Code: Select all

[village]
x,y=2,1
[/village]
I don´t know if this command actually exists, but I´d advice you to use this

Code: Select all

#define CAPTURE_VILLAGE SIDE X Y
[capture_village]
side={SIDE}
x,y={X},{Y}
[/capture_village]
#enddef
or the built-in macro STARTING_VILLAGES SIDE RADIUS to get all villages in a given area.

And about the [element] stuff: I´m quite sure that´s in the file wich tells the wesnoth engine to load the scenario.
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Code: Select all

[redraw]
   [message]
   description=Javar
   message= _ "It's time you feel my wrath! Cringe below me in terror!"
   [/message]
   [/redraw]
Nothing goes inside a [redraw]. Just use [redraw][/redraw].

Code: Select all

[if]
    [variable]
    name=turn_number
    equals=6
    [/variable]
   [and
    [variable]
    name=side_number
    equals=5
    [/variable]
   [/and]
Find the missing ]! :) (I don't know if the new [and] is supposed to be used like that, so I'll just assume the idea is correct here)
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Thanks to both of you.
As for the village tags, it does work in my case and the reason I didn't use a macro is because those villages are on the opposite side of the map. As for the recruit problem, I'll happily see if your solution works, Toms. Thanks for clarifying things guys.

I'm trying to swallow all of this quickly. ;)
Post Reply