Multiplayer Scenario

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

Multiplayer Scenario

Post by smchronos »

Yes, this is something I've just recently started on. I basically wanted to implement a few interesting characteristics into a multiplayer scenario. First off, I invisioned 4 human players and 1-2 ai's. Mostly, everything looked fine except that I have to set my fifth side (the ai side) as the orcs and computer controled every time. I've tried several attempts to correct this, even having the leader killed after placing down another "unit-recruitable" character on the ai's side. Here is a section of my script.

Code: Select all

	[event] 
	name=prestart 

	[unit] 
	type=Orcish Warrior 
	description=Baskal	
	x,y=14,16 
	side=5 
	[/unit]

	[unit] 
	type=Orcish Warrior 
	description=Marvolon	
	x,y=5,4 
	side=5 
	[/unit]

	[unit] 
	type=Orcish Archer 
	generate_description=yes	
	x,y=4,4 
	side=5 
	[/unit]

	[unit] 
	type=Orcish Archer 
	generate_description=yes	
	x,y=4,3 
	side=5 
	[/unit]
	[/event]

	[event]
	name=start
	
	[scroll_to_unit]
	description=Baskal
	x=14
	y=16
	[/scroll_to_unit]

	[message]
	description=Baskal
	message= _ "Bah! What have we here? Some meddlesome sleuths?"
	[/message]

	[scroll_to_unit]
	description=Marvolon
	x=5
	y=4
	[/scroll_to_unit]

	[message]
	description=Marvolon
	message= _ "None of you will make it out of here alive..."
	[/message]

	[scroll_to_unit]
	description=Unit
	x=2
	y=17
	[/scroll_to_unit]

	[message]
	description=Unit
	message= _ "Blast! We've walked right into a trap!"
	[/message]
	[/event]

	[event]
	name=start

	[scroll_to_unit]
	description=unit
	x=4
	y=19
	[/scroll_to_unit]

	[message]
	description=unit
	message= _ "This isn't good. It seems that another band of warriors has camped out in the northeast as well."
	[/message]

	[scroll_to_unit]
	description=second_unit
	x=17
	y=2
	[/scroll_to_unit]

	[message]
	description=second_unit
	message= _ "What the- Where did all of these orcs come from?!"
	[/message]

	[scroll_to_unit]
	description=second_unit
	x=19
	y=3
	[/scroll_to_unit]

	[message]
	description=second_unit
	message= _ "This isn't good."
	[/message]	
	[/event]
	
	[event]
	name=start

	[unit]
	type=Orcish Ruler
	description=Borvalis
	x,y=17,19
	side=5
	canrecruit=1
	recruit=Orcish Grunt,Orcish Warrior,Troll Whelp,Troll,Troll Rocklobber,Wolf Rider,Goblin Knight,Goblin Pillager,Orcish Archer,Orcish Crossbowman,Orcish Assassin,Orcish Slayer,Naga Fighter,Naga Warrior,Goblin Spearman,Goblin Impaler
	[/unit]
	
	[filter]
	x=18
	y=19
	[/filter]
	[kill]
	description=Computer Player
	animate=yes
	[/kill]
	[message]
	description=unit
	message= _ "Gah!"
	[/message]
	
	[scroll_to_unit]
	description=Borvalis
	x=17
	y=19
	[/scroll_to_unit]

	[message]
	description=unit
	message _ "Sorry, but I can't let you screw things up. These intruders have to be annihilated now."
	[/message]

	[/event]
	
	[label]
	x,y=18,19
	text=Tasox Castle Ruins
	[/label]

[/multiplayer]
Also, the scripts after the message, "Blast, we've walked into a trap!" don't appear except the label code still works. I've spent several hours trying to read the wml wikis, etc. but it is just too confusing for me at the moment.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Your name=start events have some odd stuff in them.

Let's take this for an example:

Code: Select all

 [event]
   name=start

   [scroll_to_unit]
   description=unit
   x=4
   y=19
   [/scroll_to_unit]

   [message]
   description=unit
   message= _ "This isn't good. It seems that another band of warriors has camped out in the northeast as well."
   [/message]

   [scroll_to_unit]
   description=second_unit
   x=17
   y=2
   [/scroll_to_unit]

   [message]
   description=second_unit
   message= _ "What the- Where did all of these orcs come from?!"
   [/message]

   [scroll_to_unit]
   description=second_unit
   x=19
   y=3
   [/scroll_to_unit]

   [message]
   description=second_unit
   message= _ "This isn't good."
   [/message]   
   [/event] 
It's a name=start event, so it triggers at the start of the scenario, so it does not have any units (primary_unit or secondary_unit) associated with it. Therefore, description=unit does not refer to any unit, and that's why none of those [scroll_to_unit]s or [message]s work. Filter for units speaking by using their descriptions instead like you do in your prestart event, for example, like this: description=Marvolon.

Also, there's no real need to have multiple name=start events. I think it's even possible (not sure about this) that when you have multiple events of the same type triggering at the same time (like those name=start events, which all trigger at the start of the scenario), they might get executed in an arbitrary order.

And finally:

Code: Select all

   [event]
   name=start

   [unit]
   type=Orcish Ruler
   description=Borvalis
   x,y=17,19
   side=5
   canrecruit=1
   recruit=Orcish Grunt,Orcish Warrior,Troll Whelp,Troll,Troll Rocklobber,Wolf Rider,Goblin Knight,Goblin Pillager,Orcish Archer,Orcish Crossbowman,Orcish Assassin,Orcish Slayer,Naga Fighter,Naga Warrior,Goblin Spearman,Goblin Impaler
   [/unit]
   
   [filter]
   x=18
   y=19
   [/filter] 
You can't set a recruit list in a [unit] tag, it must be done in a [side] tag. If you want this to always be an AI-controlled side and if you're also using Wesnoth 1.1.1 or newer, just create the [side] definition for it just like you do for the human-controlled sides (directly inside the [scenario] or [multiplayer] and obviously adding the recruit= etc keys to it) and also put allow_player=no inside the [side] tag.
http://www.wesnoth.org/wiki/SideWML wrote: * allow_player if equal to 'no', then the game creation will not allow this player to be modified. (v1.1.1+ or SVN trunk only)
A [filter] inside a name=start event does not make sense, as mentioned before. A [filter] in an event just gives more control over when the event will trigger. Example: a name=moveto event triggers only when a unit matching the [filter] given moves, never when a unit not matching the [filter] moves.
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

zookeeper wrote:You can't set a recruit list in a [unit] tag, it must be done in a [side] tag. If you want this to always be an AI-controlled side and if you're also using Wesnoth 1.1.1 or newer, just create the [side] definition for it just like you do for the human-controlled sides (directly inside the [scenario] or [multiplayer] and obviously adding the recruit= etc keys to it) and also put allow_player=no inside the [side] tag.
One last question then (until I try to finalize what you've explained to me). If I am using the current 1.1.1 or newer version, and someone else isn't, will they receive an error with this scenario? Or will it work?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

smchronos wrote:One last question then (until I try to finalize what you've explained to me). If I am using the current 1.1.1 or newer version, and someone else isn't, will they receive an error with this scenario? Or will it work?
If you play by connecting to the default multiplayer lobby, then you should be ok, since Wesnoth should connect to the correct multiplayer server by default. So, anyone you find in the lobby should have a compatible version. I'm not 100% sure if this applies between all development versions, but at least 1.0.2 and the latest releases connect to different lobbies.
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Alright, I reread what you first posted, about my name=start events.
The one problem I have with it is that I don't know the "description" of the indicated units. The units I've been pointing to that aren't associated with an actual name are players.

My player message, which was the "Blast! We've walked right into a trap!", works; however, the other player leaders, who are being targeted in the messages below, currently do not display their messages.

I am actually a little confused at the "unit" and "second_unit" descriptions and how they are supposed to work.
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

smchronos wrote:Alright, I reread what you first posted, about my name=start events.
The one problem I have with it is that I don't know the "description" of the indicated units. The units I've been pointing to that aren't associated with an actual name are players.

My player message, which was the "Blast! We've walked right into a trap!", works; however, the other player leaders, who are being targeted in the messages below, currently do not display their messages.

I am actually a little confused at the "unit" and "second_unit" descriptions and how they are supposed to work.
Some events are triggered when unit x does something. Sometimes, unit x does something to unit y. In those instances, unit x is called "unit" and unit y is called "second_unit." This is only true for SOME BUT NOT ALL events.

For example:
- A moveto event is triggered when unit x moves to a location (specified by the [filter]).
- A die event is triggered when unit x is killed by unit y.
- An attack event is triggered when unit x attacks unit y.

Some events do not require the participation of any unit in particular. Start, new turn, side turn, victory, and defeat events happen to all units, not just one unit. In this case it doesn't make sense to designate any unit to be "unit" or "second_unit." In the EventWML reference page, these events are segregated from those that are associated with a particular unit.


When you want a unit to talk, you need to use the unit's actual name. If the unit's name is Joe, the message tag will look like this:
[message]
description=Joe
message= _ "Hello, Mike."
[/message]

The start event is used to show some dialog or story when the scenario starts. When the start event is over, you can start playing. If you want something to happen when a unit moves somewhere, you need a separate moveto event. In a moveto event, you can use "unit" to specify whichever unit did the moving when writing messages.
Hope springs eternal.
Wesnoth acronym guide.
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Code: Select all

[side] 
	type=Orcish Ruler
	description=Borvalis
	side=5
	canrecruit=1
	controller=ai
	team_name=Orcs
	user_team_name=Orcs
	recruit=Orcish Grunt,Orcish Warrior,Troll Whelp,Troll,Troll Rocklobber,Wolf Rider,Goblin Knight,Goblin 

Pillager,Orcish Archer,Orcish Crossbowman,Orcish Assassin,Orcish Slayer,Naga Fighter,Naga Warrior,Goblin Spearman,Goblin 

Impaler
	allow_player=no
	[/side]
This is the code I designed for the 5th side, which I was trying to make as an automatic computer player with the leader as provided. Yet, every time I test this scenario online, I see the same results with something new added. First off, the 5 sides are still there, all choosable, except that under the 5th side, the name Borvalis exists. Also, when I took out a few things from my start event (such as the part with the invalid unit tags) and combined the messages, my leader nows says nothing as well. It stops right after the two described units speak.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

smchronos wrote:Alright, I reread what you first posted, about my name=start events.
The one problem I have with it is that I don't know the "description" of the indicated units. The units I've been pointing to that aren't associated with an actual name are players.

My player message, which was the "Blast! We've walked right into a trap!", works; however, the other player leaders, who are being targeted in the messages below, currently do not display their messages.
If you want the player 2 leader to speak, you can use the following, for example:

Code: Select all

[message]
    side=2
    canrecruit=1
    message= _ "Blast it!"
[/message]
Since you can use all keys of a standard unit filter to specify the speaking unit in a [message], that's a valid way of doing it.
smchronos
Posts: 37
Joined: March 21st, 2006, 7:01 pm
Contact:

Post by smchronos »

Well, the beginning of my mp scenario works now! Thanks to all of you (especially zookeeper) who helped me work through this. I know I still have plenty to learn and I will continue to do so. My next task is to edit a unit's stats on-game to what I want...

(Don't think I forgot you, Scott. Thanks for the help as well.)
Post Reply