objectives
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.
objectives
In a multiplayer scenario i'm working on, I need to change the objectives. I want to give the players two ways to win:
1. survive until turn 54.
2. defeat enemy leaders and survive until turn 42.
Here is my code:
My objectives do appear in the "scenario Objectives" whenever I check them, but the game doesn't recognize them. It still just ends the game when you "Defeat all enemy leaders", the default objective. Is there some extra code I need to use to get the game to recognize my objectives?
sorry if this is a newbie question, but it wasn't on the wiki page I was using:
http://www.wesnoth.org/wiki/InterfaceActionsWML
1. survive until turn 54.
2. defeat enemy leaders and survive until turn 42.
Here is my code:
Code: Select all
[event]
name=prestart
[objectives]
[objective]
description=Survive until turn 54 or defeat all enemy leaders and survive until turn 42.
condition=win
[/objective]
[objective]
description=Death of your leader
condition=lose
[/objective]
[/objectives]
[/event]
My objectives do appear in the "scenario Objectives" whenever I check them, but the game doesn't recognize them. It still just ends the game when you "Defeat all enemy leaders", the default objective. Is there some extra code I need to use to get the game to recognize my objectives?
sorry if this is a newbie question, but it wasn't on the wiki page I was using:
http://www.wesnoth.org/wiki/InterfaceActionsWML
Re: objectives
You need to put victory_when_enemies_defeated=no inside the [multiplayer] tag.
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.
Re: objectives
thanks, I think that works now
Re: objectives
for each [objective]
you need an [event] with an [endlevel] telling the game specifically what you want to do when each event occurs..
for a game ending with a death you need a die event.
for a game ending with a survive till 42 turns are up you need a turn event.
i think those are in the wiki go back and check...
you need an [event] with an [endlevel] telling the game specifically what you want to do when each event occurs..
for a game ending with a death you need a die event.
for a game ending with a survive till 42 turns are up you need a turn event.
i think those are in the wiki go back and check...
Re: objectives
hmmm, I checked endlevel and objectives in the WML Reference, but I can't find anywhere where the details are spelled out for me.
Is this kind of like what you're talking about?
sorry if this is obvious, i'm a noob when it comes to WML.
Also, how would I make an objective that has two requirements for victory, like "defeat enemy leaders and survive until turn 42"?
Is this kind of like what you're talking about?
Code: Select all
[objective]
description=Survive until turn 54
condition=win
[event]
name=turn 54
[endlevel]
result=victory
[/endlevel]
[/event]
[/objective]
Also, how would I make an objective that has two requirements for victory, like "defeat enemy leaders and survive until turn 42"?
Re: objectives
You could do something like this.
God help me if there's an error in there.
Code: Select all
[objectives]
<insert crap here>
[/objectives]
[event]
name=start
[set_variable]
name=turn_limit
value=54
[/set_variable]
[/event]
[event]
name=turn refresh
first_time_only=no
[if]
[not]
[have_unit]
canrecruit=yes
side=<insert sides here>
[/have_unit]
[/not]
[then]
[set_variable]
name=turn_limit
value=42
[/set_variable]
[/then]
[/if]
[/event]
[event]
name=turn $turn_limit
[message]
speaker=narrator
message= _ "Congratulations, you've survived, yadda yadda yadda..."
[/message]
[endlevel]
result=victory
[/endlevel]
[/event]
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.
Re: objectives
Why not just:
[objectives]
[objective]
description="put the message to the player about what you need to win the scenario here"
condition=win
[/objective]
[/objectives]
[event]
turn=54
[endlevel]
result=victory
[/endlevel]
[/event]
[objectives]
[objective]
description="put the message to the player about what you need to win the scenario here"
condition=win
[/objective]
[/objectives]
[event]
turn=54
[endlevel]
result=victory
[/endlevel]
[/event]
-
- Posts: 547
- Joined: August 11th, 2008, 3:19 pm
Re: objectives
This code won't work because [event]s cannot be placed inside of [objective] tags. I think it's important to note here that the [objectives][/objectives] tags are used simply to convey the scenario goals to the user, not to actually code those win/lose conditions into the scenario. So, as Jequ and A Guy pointed out, the [event] tags that check for the win/lose conditions are a completely separate entity.[objective]
description=Survive until turn 54
condition=win
[event]
name=turn 54
[endlevel]
result=victory
[/endlevel]
[/event]
[/objective]
what if the Bible's claims about Christ depicted accurate, verifiable history? given some research, you might be surprised at the evidence...
Re: objectives
There isA Guy wrote:God help me if there's an error in there.
You can't use $variables inside event names, so do this instead:
Code: Select all
[objectives]
<insert crap here>
[/objectives]
[event]
name=prestart
[modify_turns]
value=54
[/modify_turns]
[/event]
[event]
name=die
first_time_only=no
[filter]
canrecruit=yes
[/filter]
[if]
[not]
[have_unit]
canrecruit=yes
side=<insert sides here>
[/have_unit]
[/not]
[then]
[modify_turns]
value=42
[/modify_turns]
[/then]
[/if]
[/event]
[event]
name=time over
[message]
speaker=narrator
message= _ "Congratulations, you've survived, yadda yadda yadda..."
[/message]
[endlevel]
result=victory
[/endlevel]
[/event]
Re: objectives
the event goes outside the [objective] tagsLimabean wrote:hmmm, I checked endlevel and objectives in the WML Reference, but I can't find anywhere where the details are spelled out for me.
Is this kind of like what you're talking about?sorry if this is obvious, i'm a noob when it comes to WML.Code: Select all
[objective] description=Survive until turn 54 condition=win [event] name=turn 54 [endlevel] result=victory [/endlevel] [/event] [/objective]
Also, how would I make an objective that has two requirements for victory, like "defeat enemy leaders and survive until turn 42"?
as far as i know..objectives are single issue only
i've not seen a double [event] that can include both as the condition of victory
unless of course thats now allowed in version 1.5.x
Re: objectives
Thanks everyone, that seems to work, but I admit I have no idea what most of that code actually does.AI wrote:There isA Guy wrote:God help me if there's an error in there.
You can't use $variables inside event names, so do this instead:
Code: Select all
[objectives] <insert crap here> [/objectives] [event] name=prestart [modify_turns] value=54 [/modify_turns] [/event] [event] name=die first_time_only=no [filter] canrecruit=yes [/filter] [if] [not] [have_unit] canrecruit=yes side=<insert sides here> [/have_unit] [/not] [then] [modify_turns] value=42 [/modify_turns] [/then] [/if] [/event] [event] name=time over [message] speaker=narrator message= _ "Congratulations, you've survived, yadda yadda yadda..." [/message] [endlevel] result=victory [/endlevel] [/event]
Re: objectives
Okay, allow me to explain.
We want to set a turn at which you will win. We want this to be able to change. Since we can change variables mid-game, we will use a variable. We need to set the variable, so we will do that in the start.
We want the variable to change when both leaders die, so we will set a condition. We want the game to keep checking for whether both leaders are dead, so we will use the turn refresh event. We want the game to repeatedly check, so we need to set first_time_only=no in order to make the event repeat. Now, if the game does not find any leader belonging to the sides specified in the filter, then the variable (turn_limit) will be changed.
We need to specify that we want the value of a variable to be used, so we use the $ sign (meaning that the game should use the value of the variable, instead of using the name). So the game will make the event happen on the turn that is in the variable.
Only one flaw I noticed... If both leaders die after turn 42, then the game cannot be won. To counter this, you can do something like...
So you'll still win even if both leaders die after turn 42.
We want to set a turn at which you will win. We want this to be able to change. Since we can change variables mid-game, we will use a variable. We need to set the variable, so we will do that in the start.
We want the variable to change when both leaders die, so we will set a condition. We want the game to keep checking for whether both leaders are dead, so we will use the turn refresh event. We want the game to repeatedly check, so we need to set first_time_only=no in order to make the event repeat. Now, if the game does not find any leader belonging to the sides specified in the filter, then the variable (turn_limit) will be changed.
We need to specify that we want the value of a variable to be used, so we use the $ sign (meaning that the game should use the value of the variable, instead of using the name). So the game will make the event happen on the turn that is in the variable.
Only one flaw I noticed... If both leaders die after turn 42, then the game cannot be won. To counter this, you can do something like...
Code: Select all
[event]
name=time over
[endlevel]
result=victory
[/endlevel]
[/event]
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.