Campaign won't start
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.
Re: Campaign won't start
would it go back to the starting position?
Re: Campaign won't start
No, not really. But you can set an ai goal manually, so that the leader will try to move there: just look through all possible tags of AiWML.
(customizing ai was changed from 1.8 on, in this case see here, but for me the old syntax always worked as well, no idea about that)
(customizing ai was changed from 1.8 on, in this case see here, but for me the old syntax always worked as well, no idea about that)
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
Re: Campaign won't start
Code: Select all
[event]
name=attacker hits
first_time_only=no
[filter]
id=Sir_Miles
[/filter]
[filter_attack]
name=lance
[/filter_attack]
[set_variable]
name=lance
rand="0..2"
[/set_variable]
[if]
[variable]
name=lance
greater_than=0
[/variable]
[then]
[object]
silent=yes
[effect]
apply_to=remove_attacks
type=pierce
[/effect]
[/object]
[message]
id=Sir_Miles
message=_"Aw, my lance has snapped."
[/message]
[store_unit] #to stop the unit attack
[filter]
id=Sir_Miles
[/filter]
variable=stored_sir_miles
kill=yes
[/store_unit]
[unstore_unit]
variable=stored_sir_miles
[/unstore_unit]
[fire_event]
name=lance_snapped
[/fire_event]
[/then]
[else]
[/else]
[/if]
[/event]
[event]
name=lance_snapped
[filter]
side=2
[/filter]
[ai]
[leader_goal]
x,y=2,18
[/leader_goal]
[/ai]
[/event]
[event]
name=moveto
first_time_only=no
[filter]
id=Sir_Miles
x,y=2,18
[/filter]
[ai]
grouping=offensive
attack_depth=5
[target]
id=Sir_Miles
value=10.0
[/target]
[/ai]
[/event]
Re: Campaign won't start
To change [ai] you have to use [modify_side].
And I forgot, you need a [filter] in effect
Why are you trying to give a leader_goal when Sir_Miles' lance snaps?
(The following is based on my understanding of your intention, namely that you want your and your enemy's lance to randomly snap. If one unit's lance broke, it has to move to its keep to get a new one.)
Just make two different attacker_hits events (no custom ones), one for Sir Miles, one for side 2 leader, with accordingly slightly different filters (also remember the filters for message and effect). And then put the leader_goal modifying in the event for side 2.
Then make two moveto events, one for each side. In the side 2 one, remove the leader_goal (by setting it to nothing, x,y="").
And I forgot, you need a [filter] in effect

Why are you trying to give a leader_goal when Sir_Miles' lance snaps?
(The following is based on my understanding of your intention, namely that you want your and your enemy's lance to randomly snap. If one unit's lance broke, it has to move to its keep to get a new one.)
Just make two different attacker_hits events (no custom ones), one for Sir Miles, one for side 2 leader, with accordingly slightly different filters (also remember the filters for message and effect). And then put the leader_goal modifying in the event for side 2.
Then make two moveto events, one for each side. In the side 2 one, remove the leader_goal (by setting it to nothing, x,y="").
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
Re: Campaign won't start
Code: Select all
#textdomain wesnoth-j
#define INITIALIZE_SCENARIO_VARIABLES
{VARIABLE lancem 0}
{VARIABLE lanceb 0}
#enddef
#define CLEAR_SCENARIO_VARIABLES
{CLEAR_VARIABLE lancem}
{CLEAR_VARIABLE lanceb}
#enddef
[scenario]
name= "Sir Boris"
id="1_Sir_Boris"
map_data="{~add-ons/jousting/Maps/jousting.map}"
turns=10
next_scenario=null
{DEFAULT_SCHEDULE}
{INTRO_AND_SCENARIO_MUSIC "battle.ogg" "the_city_falls.ogg"}
{EXTRA_SCENARIO_MUSIC "loyalists.ogg"}
{EXTRA_SCENARIO_MUSIC "legends_of_the_north.ogg"}
{PLACE_IMAGE scenery/tent-fancy-red.png 3 1}
{PLACE_IMAGE scenery/tent-fancy-blue.png 2 18}
{J_BRAZIER 7 7}
{J_BRAZIER 7 12}
{OBJ_NEW_LANCE 3 1 Sir_Miles}
{OBJ_NEW_LANCE 2 18 Sir_Boris ([modify_side]
side=2
[ai]
grouping=offensive
attack_depth=5
[target]
id=Sir_Miles
value=10.0
[/target]
[/ai]
[/modify_side])}
[story]
[part]
background=story/jousting1.jpg
story=_"You are a knight going by the name of Sir Miles."
[/part]
[part]
background=story/jousting1.jpg
story=_"The king is watching you joust which is a great privilage."
[/part]
[/story]
[side]
type="Knight"
id="Sir_Miles"
canrecruit=yes
name=_"Sir Miles"
unrenamable=yes
side=1
controller=human
{GOLD 0 0 0}
income=0
team_name="Sir_Miles"
user_team_name=_"Sir_Miles"
fog=no
shroud=no
recruit=""
[modifications]
{TRAIT_STRONG}
{TRAIT_INTELLIGENT}
[object]
silent=yes
[effect]
apply_to=attack
type=pierce
increase_damage=-50%
[/effect]
[/object]
[object]
silent=yes
[effect]
apply_to=attack
type=blade
increase_damage=-50%
[/effect]
[/object]
[/modifications]
[/side]
[side]
type="Knight"
id="Sir_Boris"
name=_"Sir Boris"
canrecruit=no
unrenamable=yes
side=2
{GOLD 0 0 0}
team_name="Sir_Boris"
user_team_name=_"Sir_Boris"
controller=ai
fog=no
shroud=no
income=0
recruit=""
[modifications]
[object]
silent=yes
[effect]
apply_to=attack
type=pierce
increase_damage=-50%
[/effect]
[/object]
[object]
silent=yes
[effect]
apply_to=attack
type=blade
increase_damage=-50%
[/effect]
[/object]
[/modifications]
[ai]
grouping=offensive
attack_depth=5
[target]
id=Sir_Miles
value=10.0
[/target]
[/ai]
[/side]
[side]
type="Grand Marshal"
id="King"
name=_"The King"
canrecruit=yes
unrenamable=yes
side=3
{GOLD 0 0 0}
team_name="Spectators"
user_team_name=_"Spectators"
controller=ai
fog=no
shroud=no
income=0
recruit=""
[ai]
grouping=offensive
attack_depth=5
[/ai]
[/side]
[event]
name=prestart
{INITIALIZE_SCENARIO_VARIABLES}
[objectives]
[objective]
description=_"Make Sir Boris surrender by reducing his hitpoints to 0 or less"
condition=win
[/objective]
[objective]
description=_"Sir Miles is made to surender by reducing his hitpoints to 0 or less"
condition=lose
[/objective]
[objective]
description=_"Time runs out"
condition=lose
[/objective]
[/objectives]
[/event]
[event]
name=start
[unit]
type=Elvish Lady
side=3
id="Queen"
name=_"The Queen"
unrenamable=yes
x=7
y=9
[/unit]
[unit]
type=Elvish Lady
side=3
id="Matilda"
name=_"Princess Matilda"
unrenamable=yes
x=7
y=10
[/unit]
[unit]
type=Horseman
side=3
id="Chevalier"
name=_"Chevalier d'honneur"
unrenamable=yes
x=5
y=10
[/unit]
[unit]
type=Royal Guard
side=3
id="Guard1"
name=_"Royal Guard"
unrenamable=yes
x=7
y=8
[/unit]
[unit]
type=Royal Guard
side=3
id="Guard2"
name=_"Royal Guard"
unrenamable=yes
x=7
y=11
[/unit]
[message]
id=King
message=_"So, Sir Miles, you will joust for the hand of my daughter?"
[/message]
[message]
id=Sir_Miles
message=_"I will, sire"
[/message]
[message]
id=King
message=_"Well, here is the first challenger. This is Sir Boris."
[/message]
[message]
id=Sir_Boris
message=_"I am here at your command."
[/message]
[message]
id=King
message=_"Joust well, brave knights!"
[/message]
[message]
id=Queen
message=_"Good luck, Sir Miles"
[/message]
[message]
id=Chevalier
message=_"Ready, steady, joust!"
[/message]
[/event]
[event]
name=time over
[message]
id=Chevalier
message=_"Halt!"
[/message]
[message]
id=King
message=_"Sorry Sirs, but you have run out of time."
[/message]
[/event]
[event]
name=attacker hits
first_time_only=no
[filter]
id=Sir_Miles
[/filter]
[filter_attack]
name=lancem
[/filter_attack]
[set_variable]
name=lancem
rand="0..2"
[/set_variable]
[if]
[variable]
name=lancem
greater_than=0
[/variable]
[then]
[object]
silent=yes
[effect]
apply_to=remove_attacks
type=pierce
[/effect]
[/object]
[message]
id=Sir_Miles
message=_"Aw, my lance has snapped."
[/message]
[store_unit] #to stop the unit attack
[filter]
id=Sir_Miles
[/filter]
variable=stored_sir_miles
kill=yes
[/store_unit]
[unstore_unit]
variable=stored_sir_miles
[/unstore_unit]
[fire_event]
name=lance_snapped
[/fire_event]
[/then]
[else]
[/else]
[/if]
[/event]
[event]
name=lance_snapped # a separate event is needed so that you only get the below
# message the first time so it doesn't get on your nerves
[message]
speaker=narrator
image=wesnoth-icon.png
message=_"To get another lance, you will have to go to your starting position"
[/message]
[/event]
[event]
name=attacker hits
first_time_only=no
[filter]
id=Sir_Boris
[/filter]
[filter_attack]
name=lanceb
[/filter_attack]
[set_variable]
name=lanceb
rand="0..2"
[/set_variable]
[if]
[variable]
name=lanceb
greater_than=0
[/variable]
[then]
[object]
silent=yes
[effect]
apply_to=remove_attacks
type=pierce
[/effect]
[/object]
[message]
id=Sir_Boris
message=_"Aw, my lance has snapped."
[/message]
[store_unit] #to stop the unit attack
[filter]
id=Sir_Boris
[/filter]
variable=stored_sir_boris
kill=yes
[/store_unit]
[unstore_unit]
variable=stored_sir_boris
[/unstore_unit]
[modify_side]
side=2
[ai]
passive_leader=yes
[leader_goal]
x,y=2,18
[leader_goal]
[/ai]
[/modify_side]
[/then]
[else]
[/else]
[/if]
[/event]
[event]
name=last breath
[filter]
id=Sir_Miles
[/filter]
[message]
id=Sir_Miles
message=_"Ugh..."
[/message]
[message]
id=Sir_Boris
message=_"Do you yield!"
[/message]
[message]
id=Sir_Miles
message=_"I ... yield"
[/message]
[/event]
[event]
name=last breath
[filter]
id=Sir_Boris
[/filter]
[message]
speaker=Sir_Miles
message=_"Do you yield!"
[/message]
[message]
id=Sir_Boris
message=_"I yield!"
[/message]
[/event]
[event]
name=die
[filter]
id=Sir_Boris
[/filter]
[message]
id=Sir_Miles
message=_"I have beaten him!"
[/message]
[message]
id=Queen
message=_"Well done, Sir Miles"
[/message]
[message]
id=King
message=_"Now you may go on to the next challenger"
[/message]
{CLEAR_SCENARIO_VARIABLES}
[endlevel]
result=victory
bonus=yes
{NEW_GOLD_CARRYOVER 100}
[/endlevel]
[/event]
[/scenario]
#undef INITIALIZE_SCENARIO_VARIABLES
#undef CLEAR_SCENARIO_VARIABLES

Re: Campaign won't start
That means you've made a syntax error somewhere. It's probably a missing closing or opening tag somewhere, the wrong number of arguments given to a macro or a missing opening or closing quote. You need to find those and fix them.matsjoyce wrote:O.K. this is the scenario, but when I run it, it says "Missing closing tag for tag scenario"
Re: Campaign won't start
Just a guess (sorry if it's wrong):
These two macros seem the same, but the number of arguments is different.
Code: Select all
{OBJ_NEW_LANCE 3 1 Sir_Miles}
{OBJ_NEW_LANCE 2 18 Sir_Boris ([modify_side]
side=2
[ai]
grouping=offensive
attack_depth=5
[target]
id=Sir_Miles
value=10.0
[/target]
[/ai]
[/modify_side])}
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Re: Campaign won't start
Yes, its got that to work for the ai as well as the human player. If you want to see it, here is the macro:
Code: Select all
#define OBJ_NEW_LANCE X Y ID AI_MOD
[item]
x={X}
y={Y}
image=scenery/lance2.png
[/item]
[event]
name=moveto
first_time_only=no
[filter]
x={X}
y={Y}
id={ID}
[/filter]
[object]
silent=yes
[filter]
x={X}
y={Y}
[/filter]
[effect]
apply_to=new_attack
name=lance
description=_"lance"
type=pierce
[specials]
{WEAPON_SPECIAL_CHARGE}
[/specials]
range=melee
damage=7
number=2
[/effect]
[/object]
{AI_MOD}
[message]
id={ID}
message=_"I have a new lance, now lets knock this man off his horse"
[/message]
[/event]
#enddef
Re: Campaign won't start
If you have a macro with a certain amount of parameters, you always have to include exactly this amount of parameters in the macro call. You may just set AI_MOD to something irrelevant, but you must give a value for that parameter.
Crend
Crend
UMC Story Images — Story images for your campaign!
Re: Campaign won't start
Just put () as AI_MOD. That counts as argument value, but does nothing.
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
Re: Campaign won't start
O.K. done that. It starts but the lance doesn't snap. I attacked for nine turns with most of them hits and the lance didn't snap.
Re: Campaign won't start
He has no 'lancem' attack.Code: Select all
[filter_attack] name=lancem [/filter_attack]
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
Re: Campaign won't start
Opps, I must have done that when I was turning the lance var to lancem...
Re: Campaign won't start
Right, both lances snap now, but the ai doesn't go back for a new one.
Re: Campaign won't start
passive_leader=yes is not good when you want the enemy leader to move.
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons