How to stone a unit ?
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.
How to stone a unit ?
I'm working on a scenario where ice appear randomly on a river.
When there is an unit on the hex to be iced, it would be stoned, and unstoned when the ice would melt...
My random terrain generation works, i figured how to unstone a unit, but didn't find how to stone a unit.
I tried something like this, but it doesn't work :
($xtarget,$ytarget) is the location of the hex being frozen
Does anybody knows how to do this ?
When there is an unit on the hex to be iced, it would be stoned, and unstoned when the ice would melt...
My random terrain generation works, i figured how to unstone a unit, but didn't find how to stone a unit.
I tried something like this, but it doesn't work :
Code: Select all
[if]
[have_unit]
x=$xtarget
y=$ytarget
[/have_unit]
[then]
[store_unit]
x=$xtarget
y=$ytarget
variable=frozen_unit
[/store_unit]
[set_variable]
name=frozen_unit.status.stone
value=yes
[/set_variable]
[unstore_unit]
variable=frozen_unit
[/unstore_unit]
[/then]
[/if]
Does anybody knows how to do this ?
This code worked just fine for me. I'm not sure where your problem occured, but it wasn't with the stone variable syntax. Try saving the game after you store the unit and seeing if it's actually getting a unit.
Code: Select all
[event]
name=turn 2
[store_unit]
variable=stone_store
[filter]
description=Scott
[/filter]
[/store_unit]
{VARIABLE stone_store.status.stone on}
[unstore_unit]
variable=stone_store
[/unstore_unit]
[/event]
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
Basically i use this code :
And then this macro is called several times on every side turn :
This works ok for me if i replace status.stone with status.poisoned, but it wouldn't work with stone ... Any idea ?
Code: Select all
#define FREEZE
[set_variable]
name=xtarget
random=9..15
[/set_variable]
[set_variable]
name=ytarget
random=1..22
[/set_variable]
[terrain]
x=$xtarget
y=$ytarget
letter=i
[/terrain]
[if]
[have_unit]
x=$xtarget
y=$ytarget
[/have_unit]
[then]
#debug
[message]
speaker=narrator
message="Unit frozen at ($xtarget,$ytarget)"
[/message]
[store_unit]
[filter]
x=$xtarget
y=$ytarget
[/filter]
variable=frozen_unit
kill=yes
[/store_unit]
[set_variable]
name=frozen_unit.status.stone
value=on
[/set_variable]
[unstore_unit]
variable=frozen_unit
[/unstore_unit]
[/then]
[/if]
#enddef
Code: Select all
[event]
name=side turn
first_time_only=no
{FREEZE}
{FREEZE}
{FREEZE}
{FREEZE}
{FREEZE}
{FREEZE}
{FREEZE}
{UNFREEZE k}
{UNFREEZE k}
{UNFREEZE k}
{UNFREEZE c}
{UNFREEZE c}
{UNFREEZE c}
{UNFREEZE c}
{UNFREEZE s}
{UNFREEZE s}
{UNFREEZE s}
{UNFREEZE s}
{UNFREEZE s}
[/event]
Your macro worked for me when I removed the UNFREEZE macros (since I don't have them). Perhaps they are messing up the freezing process.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
Thanks, it comes from there :
Variable name conflicts ?
Code: Select all
#define UNFREEZE TERRAIN
[set_variable]
name=xtarget
random=9..15
[/set_variable]
[set_variable]
name=ytarget
random=1..21
[/set_variable]
[terrain]
x=$xtarget
y=$ytarget
letter={TERRAIN}
[/terrain]
[unstone]
x=$xtarget
y=$ytarget
[/unstone]
#enddef
I don't think [unstone] takes a standard unit filter. You should consider filing a bug report.
In the only places I remember seeing the tag, it was used without any keys whatsoever (Valley of Statues and Fallen Lich Point).
You can work around this issue by storing the unit and setting "stone" to "off".
In the only places I remember seeing the tag, it was used without any keys whatsoever (Valley of Statues and Fallen Lich Point).
You can work around this issue by storing the unit and setting "stone" to "off".
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
I made all the things work ...
Here is how i use [unstone] :
(i took different variables for the unfreeze code too).
I also made a MP scenario from this, but bad things happen in MP.
Here is how i use [unstone] :
Code: Select all
[unstone]
[filter]
x=$xunfreeze
y=$yunfreeze
[/filter]
[/unstone]
I also made a MP scenario from this, but bad things happen in MP.