Blueknights Questions
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: Blueknights Questions
Should be pretty straightforward:
Untested, though.
Code: Select all
[event]
name=prestart
{VARIABLE_OP village rand "a,b,c"}
[switch]
variable=village
[case]
value=a
{VARIABLE village_x 5}
{VARIABLE village_y 7}
[/case]
[case]
value=b
{VARIABLE village_x 9}
{VARIABLE village_y 6}
[/case]
[case]
value=c
{VARIABLE village_x 10}
{VARIABLE village_y 4}
[/case]
[/switch]
[/event]
[event]
name=moveto
[filter]
side=1
x,y=$village_x,$village_y
[/filter]
# ...
{CLEAR_VARIABLE village,village_x,village_y}
[/event]
-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
Thank you zookeeper I'll test this very soon.
Also I've noticed that more complicated WML has $ signs in it and as in aspiring to get better at WML I wondered what the $ sign actually means, does anyone know?
Also I've noticed that more complicated WML has $ signs in it and as in aspiring to get better at WML I wondered what the $ sign actually means, does anyone know?
Re: Blueknights Questions
The $ sign before a variable name means substitute-the-variable's-value-here.
So while
will display 'hello_message'
will display 'Welcome!'.
I wonder how could you get by without this for so long
So while
Code: Select all
[set_variable]
name=hello_message
value=_ "Welcome!"
[/set_variable]
[message]
speaker=narrator
message="hello_message"
[/message]
Code: Select all
[set_variable]
name=hello_message
value=_ "Welcome!"
[/set_variable]
[message]
speaker=narrator
message="$hello_message"
[/message]
I wonder how could you get by without this for so long

-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
Thanks again zookeeper that does work and very well.
Lipk thanks for that information it was very helpful and I wrote some code alongside Zookeeper's using $ and it works great.
Regarding the Catapult WML it does not work in the [scenario] tag with a unit that's attack id and name is catapult.
Do you have any ideas what might be causing it?
Lipk thanks for that information it was very helpful and I wrote some code alongside Zookeeper's using $ and it works great.
Regarding the Catapult WML it does not work in the [scenario] tag with a unit that's attack id and name is catapult.
Do you have any ideas what might be causing it?
Re: Blueknights Questions
I'm not sure what do you mean by the unit's 'attack id and name', but this code works for a unit of the type Catapult (there's no such unit of course). You can replace that with Great Troll, Spearman, or anything you wish.
-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
Ohhh sorry I read the code as the attack name needing to be Catapult not the unit type sorry.
Also another dilema I would like to make it so that when youuncover the mage hiding in the derilict village some dialog occurs then Side 2 targets the mage with value 100 and the scenario is won 10 turns after that. So far I have got the attached file below (the concerned code is 97-216) and when the event fires it's all good until the [side] tag where I get the in-game error invalid <WML> [side] or something, could anyone:
a. Point out how to correctly do what I have done.
b. Tell me the code for the game ending 10 turns after the event.
Thanks in advance.
EDIT: removed file
Also another dilema I would like to make it so that when youuncover the mage hiding in the derilict village some dialog occurs then Side 2 targets the mage with value 100 and the scenario is won 10 turns after that. So far I have got the attached file below (the concerned code is 97-216) and when the event fires it's all good until the [side] tag where I get the in-game error invalid <WML> [side] or something, could anyone:
a. Point out how to correctly do what I have done.
b. Tell me the code for the game ending 10 turns after the event.
Thanks in advance.
EDIT: removed file
Last edited by blueknight1758 on September 9th, 2011, 2:54 pm, edited 2 times in total.
Re: Blueknights Questions
It's [modify_side], not [side]. Or, if you just want to change ai behaviour, use [modify_ai].
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
-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
Lipk yes that Catapult works a treatnow thanks!
Yes Ceres that has definitely got rid of the error so I can assume the ai is targeting the Monk now.
So does anyone know how to make the scenarioend with a victory 10 turns after this event?
Yes Ceres that has definitely got rid of the error so I can assume the ai is targeting the Monk now.
So does anyone know how to make the scenarioend with a victory 10 turns after this event?
Re: Blueknights Questions
Code: Select all
[set_variable]
name=guy_found
value=$turn_number # when finding the monk
[set_variable]
...
[event]
name=side 1 turn
first_time_only=no
[if]
[variable]
name=turn_number
equals="$($guy_found+10)"
[/variable]
[then]
<do stuff>
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
-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
So that code how does it work because I can't fathom where to put it exactly.
(also it looks like i'd need to have an exact turn the monk is 'found' but in the scenario that depends on how the player plays and is random: I might be wrong with this statement though.)
(also it looks like i'd need to have an exact turn the monk is 'found' but in the scenario that depends on how the player plays and is random: I might be wrong with this statement though.)
Re: Blueknights Questions
turn_number is automatically storing the current turn number.
Put the [set_variable] part into the mage finding village moveto event.
Put the [event] somewhere in your [scenario] tag.
How this code works? You're storing the current turn in a variable (you need to save it in another variable because otherwise it'd be overwritten next turn). Every time it's your turn, Wesnoth checks if the current turn number equals the turn number when finding the mage plus ten. If yes, the code in the [event] is executed (an [endlevel] tag for example).
Put the [set_variable] part into the mage finding village moveto event.
Put the [event] somewhere in your [scenario] tag.
How this code works? You're storing the current turn in a variable (you need to save it in another variable because otherwise it'd be overwritten next turn). Every time it's your turn, Wesnoth checks if the current turn number equals the turn number when finding the mage plus ten. If yes, the code in the [event] is executed (an [endlevel] tag for example).
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
-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
i've tried that but I get an error when thegame has loaded saying invalid <WML> [then] not supported. Also I hadto put a [/if] at the end of [/set_variable] is that the right place?
Do you know why this is?
I'm on 1.9.7 if that helps.
Do you know why this is?
I'm on 1.9.7 if that helps.
Re: Blueknights Questions
I can't exactly figure out how your code looks, so you'll have to post it.
(you know that the code I posted wasn't fully complete, namely missing the closing tags, as I only wanted to show which tags to use, right?)
(you know that the code I posted wasn't fully complete, namely missing the closing tags, as I only wanted to show which tags to use, right?)
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
-
- Posts: 252
- Joined: March 30th, 2011, 8:38 pm
- Location: The UK
Re: Blueknights Questions
Yes I know and I closed them before launching the game, the game loads up and is all fine until the scenario the code is in loads and I get the error.Ceres wrote: (you know that the code I posted wasn't fully complete, namely missing the closing tags, as I only wanted to show which tags to use, right?)
I'll post the scenario.cfg ASAP
EDIT: Uploaded scenario file, the code regarded is lines 132-233
- Attachments
-
01_Template.cfg
- (7.76 KiB) Downloaded 104 times
-
- Posts: 427
- Joined: May 10th, 2011, 7:20 pm
Re: Blueknights Questions
I think you want this:
I'm not super good with wml, but I think this is it.
Code: Select all
[event]
name=new turn
first_time_only=no
[filter]
side=1
[/filter]
[if]
[variable]
name=turn_number
equals="$($guy_found+10)"
[/variable]
[/if]
[then]
[endlevel]
result=victory
[/endlevel]
[/then]
[/event]
Timshel