Help with WML for a particular scenario
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: Help with WML for a particular scenario
Have you confirmed that those leaders do show up if you remove that [if] tag?chak_abhi wrote:But I face a problem if I load the scenario for the very first time. The side leaders for sides 2 & 3 do not show up at all. I am clueless about working a solution.
Re: Help with WML for a particular scenario
Yes, the situation normalises on removing the [if] tag.
Last edited by chak_abhi on February 17th, 2013, 5:09 pm, edited 2 times in total.
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Re: Help with WML for a particular scenario
Can you post the whole code?
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
Re: Help with WML for a particular scenario
Sorry, I had committed a bad mistake, I had used the variable no_side2 & no_side3 in a previous scenario but forgot to clear them. When I corrected it everything became normal. Anyway thanks for the help.
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Re: Help with WML for a particular scenario
I need help yet again.
Imagine a situation where the leader of an ai controlled side is moving from one location to another (they have been set previously) with a group of escorts (programmed such that they move with the leader and guard it). I want the leader to move along a road (Rr) which has no branching, and not to step on hexes other than the road. However the escorts are free to step on the other hexes. Can it be done? What will be the appropriate code?
Thanks in advance.
Imagine a situation where the leader of an ai controlled side is moving from one location to another (they have been set previously) with a group of escorts (programmed such that they move with the leader and guard it). I want the leader to move along a road (Rr) which has no branching, and not to step on hexes other than the road. However the escorts are free to step on the other hexes. Can it be done? What will be the appropriate code?
Thanks in advance.
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Re: Help with WML for a particular scenario
Yes, absolutely. There are a number of different ways of accomplishing this, but here's what I would do: Take the Messenger Escort Micro AI for the general behavior, and change the movement of the leader so that he can only move on road terrain.chak_abhi wrote:Imagine a situation where the leader of an ai controlled side is moving from one location to another (they have been set previously) with a group of escorts (programmed such that they move with the leader and guard it). I want the leader to move along a road (Rr) which has no branching, and not to step on hexes other than the road. However the escorts are free to step on the other hexes. Can it be done?
Now, the "problem" with this is that Micro AIs only become available in Wesnoth 1.11.2. However, the code is also contained in the AI-Demos add-on, so you could lift it from there until 1.11.2 comes out (there's also a demo scenario that you can test first). And if you're using 1.10, I think this particular AI should also work there (not all of the MAIs do). If you have problems with that, let me know, but in either case, take the 1.11 version as your template, the code in the 1.10 add-on is way out of date. In fact, I should probably remove that add-on.
EDIT: Actually, I just had a quick look at the code and the Messenger Escort AI will not work in 1.10 as it is. However, the change is simple (the weapon number needs to be decreased by 1 in the ai.attack() function - but not in the rest of the code). Again, if you need this for 1.10, I'd be happy to help you with the needed changes.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with WML for a particular scenario
This is appearing too complex! Isn't there any simpler alternative?
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
- pyrophorus
- Posts: 533
- Joined: December 1st, 2010, 12:54 pm
Re: Help with WML for a particular scenario
It seems to me it's very close to the 'carriage moving along a road' feature we discussed earlier.
I would:
1- disable the canrecruit key of the leader (and set the leader overlay icon), to avoid AI trying to mess into.
2- make it travel to its new keep with the escort.
3- restore its canrecruit ability.
4- setup a die event for this leader if needed.
Friendly,
I would:
1- disable the canrecruit key of the leader (and set the leader overlay icon), to avoid AI trying to mess into.
2- make it travel to its new keep with the escort.
3- restore its canrecruit ability.
4- setup a die event for this leader if needed.
Friendly,
HowTos: WML filtering, WML variables
Re: Help with WML for a particular scenario
Yeah, it is, but the road is more than a hex wide at some points.pyrophorus wrote:It seems to me it's very close to the 'carriage moving along a road' feature we discussed earlier.
There is no definite keep here. So this problem can be avoided.I would:
1- disable the canrecruit key of the leader (and set the leader overlay icon), to avoid AI trying to mess into.
2- make it travel to its new keep with the escort.
This will be done. Thanks for now, but I feel some more modifications are needed to make it work properly.4- setup a die event for this leader if needed.
Friendly,
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Re: Help with WML for a particular scenario
I am stuck once again with a problem.
There is a situation where a particular unit of the player's side must drop a bomb on any one of a group of pre-designated hexes. To place the bomb I use the following code in the prestart event.
The bomb must burst 2 turns after it has been placed, and kill any unit within 2 hexes, and also harm units within 3 or 4 hexes. For this I use the following code:
But this code doesn't work. The blast animation never takes place and in the end every unit on the map gets killed. I cannot locate the source of the error. Can anyone please help? Thanks in advance.
There is a situation where a particular unit of the player's side must drop a bomb on any one of a group of pre-designated hexes. To place the bomb I use the following code in the prestart event.
Code: Select all
#define MENU_DROP_BOMB
[set_menu_item]
id=drop_bomb_option
description= _ "Drop bomb here"
[show_if]
[have_unit]
[/have_unit]
[/show_if]
[filter_location]
[filter_adjacent_location]
[filter]
id=Hirdukmob
[/filter]
[/filter_adjacent_location]
terrain=Rrc
[/filter_location]
[command]
[set_menu_item]
id=drop_bomb_option
[show_if]
[not]
[/not]
[/show_if]
[/set_menu_item]
[item]
image=items/bomb.png
x,y=$x1,$y1
[/item]
[store_locations]
[filter]
x,y=$x1,$y1
[/filter]
variable=bomb_location
[/store_locations]
[message]
speaker=Flarklup
message= _ "We must now get away from here quickly, otherwise we also will be blasted off!"
[/message]
[message]
speaker=Hirdukmob
message= _ "Yes, lets get away from this place!"
[/message]
{VARIABLE bomb_placed 1}
{VARIABLE right_time 0}
[/command]
[/set_menu_item]
#enddef
Code: Select all
[event]
name=new turn
first_time_only=no
[if]
[variable]
name=bomb_placed
equals=1
[/variable]
[then]
[set_variable]
name=right_time
add=1
[/set_variable]
[/then]
[/if]
[if]
[variable]
name=right_time
equals=2
[/variable]
[then]
[scroll_to]
x=$bomb_location.x
y=$bomb_location.y
[/scroll_to]
[remove_item]
x=$bomb_location.x
y=$bomb_location.y
[/remove_item]
[sound]
name=explosion.ogg
[/sound]
[item]
x,y=$bomb_location.x,$bomb_location.y
halo=projectiles/fire-burst-small-1.png:50,projectiles/fire-burst-small-2.png:50,projectiles/fire-burst-small-3.png:50,projectiles/fire-burst-small-4.png:50,projectiles/fire-burst-small-5.png:50,projectiles/fire-burst-small-6.png:50,projectiles/fire-burst-small-7.png:50,projectiles/fire-burst-small-8.png:50,misc/blank-hex.png:1000000
[/item]
[delay]
time=800
[/delay]
[remove_item]
x=$bomb_location.x
y=$bomb_location.y
[/remove_item]
[terrain]
x=$bomb_location.x
y=$bomb_location.y
terrain="Dd^Dc" # this is a sandhole at the center of the explosion
[/terrain]
[kill]
[filter_location]
x=$bomb_location.x
y=$bomb_location.y # kills anyone two hexes around
radius=2
[/filter_location]
animate=yes
fire_event=yes
[/kill]
[terrain]
x=$bomb_location.x
y=$bomb_location.y
radius=2
terrain="Dd"
[/terrain]
[redraw]
[/redraw]
[harm_unit]
[filter]
[filter_location]
x=$bomb_location.x
y=$bomb_location.y
radius=3
[/filter_location]
[/filter]
amount=20
animate=yes
[/harm_unit]
[harm_unit]
[filter]
[filter_location]
x=$bomb_location.x
y=$bomb_location.y
radius=4
[/filter_location]
[/filter]
amount=10
animate=yes
[/harm_unit]
[if]
[have_unit]
id=Dorsfkign
[/have_unit]
[then]
[message]
speaker=Hirdukmob
message= _ "The bomb has blasted and yet Dorfskign is alive! We hadn't placed it properly!"
[/message]
[message]
speaker=Flarklup
message= _ "What have we done!"
[/message]
{DEFEAT}
[/then]
[/if]
{CLEAR_VARIABLE bomb_location}
[/then]
[/if]
[/event]
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
- pyrophorus
- Posts: 533
- Joined: December 1st, 2010, 12:54 pm
Re: Help with WML for a particular scenario
Hi,
Obviously, you 'bomb_location' variable is empty. This is why animation don't start and the code kills everyone. IMO this code is wrong:
And should be:
Friendly,
Obviously, you 'bomb_location' variable is empty. This is why animation don't start and the code kills everyone. IMO this code is wrong:
Code: Select all
[store_locations]
[filter]
x,y=$x1,$y1
[/filter]
variable=bomb_location
[/store_locations]
Code: Select all
[store_locations]
x,y=$x1,$y1
variable=bomb_location
[/store_locations]
HowTos: WML filtering, WML variables
Re: Help with WML for a particular scenario
I need help for a strange problem that creeps up again and again at the same time.
In a scenario of a campaign written by me an error comes at a particular time of gameplay. It says something like: Microsoft visual library error, wml trigger, to know more go to Microsoft visual library C++, to debug press retry--JIT must be enabled. (I do not remember the exact words but the main points are these)
The code for the part where the error comes is:
(The *** denotes the portion where the error is triggered)
If this same portion is implemented in any other place (e.g say in an event named turn 2) this error does not appear and the recall takes place normally.
What is the cause of this error? What is the remedy? Can anyone please help? Thanks in advance.
N.B. I use BfW 1.11.1.
In a scenario of a campaign written by me an error comes at a particular time of gameplay. It says something like: Microsoft visual library error, wml trigger, to know more go to Microsoft visual library C++, to debug press retry--JIT must be enabled. (I do not remember the exact words but the main points are these)
The code for the part where the error comes is:
Code: Select all
[event]
name=last breath
[filter]
id=Ajtimon
[/filter]
[message]
speaker=Ajtimon
message= _ "I may have fallen, but I die a free man! More will come after me, and how
many of them can you kill? Mother Doreldos will be free very soon!"
[/message]
[kill]
x,y=$x1,$y1
[/kill]
[message]
speaker=narrator
image=wesnoth-icon.png
message= _ "As soon as Ajtimon had fallen some help arrived unexpectedly taking the
Gloenish by surprise."
[/message]
*******************
[recall]
id=Milux
x,y=33,2
[/recall]
[recall]
id=Homorro
x,y=34,1
[/recall]
[recall]
id=Ajisx
x,y=33,1
[/recall]
[recall]
id=Ronglus
x,y=34,3
[/recall]
[recall]
id=Kavaras
x,y=34,2
[/recall]
[recall]
id=Kiltab
x,y=33,3
[/recall]
[recall]
id=Bojensur
x,y=32,2
[/recall]
[/event]
If this same portion is implemented in any other place (e.g say in an event named turn 2) this error does not appear and the recall takes place normally.
What is the cause of this error? What is the remedy? Can anyone please help? Thanks in advance.
N.B. I use BfW 1.11.1.
Last edited by chak_abhi on March 20th, 2013, 5:19 pm, edited 1 time in total.
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Re: Help with WML for a particular scenario
it would help if you could tell us the file and line part of the error message.
Re: Help with WML for a particular scenario
I have uploaded the information contained in the window. Unlike standard wesnoth errors this one appears in the middle of gameplay (not during loading a campaign or scenario). The last line contains the options given by the window (abort, retry & ignore). While pressing abort or ignore the program just closes, pressing retry causes the same thing but gives an error: wesnoth.exe has encountered a problem and needs to close.
- Attachments
-
- error.txt
- (402 Bytes) Downloaded 211 times
Current projects:
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Rebellion in the North,Legend of Far North,Birth of a Lich,
Doreldos: Fight to Liberty
Re: Help with WML for a particular scenario
related bug report: http://gna.org/bugs/?16148. the test case supplied by jamit isn't an exact match though.