It is currently February 9th, 2010, 4:08 pm

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: How to stone a unit ?
PostPosted: November 4th, 2005, 12:01 am 
Developer
User avatar
Offline

Joined: September 26th, 2005, 5:56 pm
Posts: 1791
Location: France
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 :
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]

($xtarget,$ytarget) is the location of the hex being frozen

Does anybody knows how to do this ?


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 12:29 am 
Forum Regular
Offline

Joined: May 12th, 2004, 12:35 am
Posts: 5283
Location: Dulles, VA
try 'on' instead of 'yes' in the set variable tag

_________________
Hope springs eternal.
Wesnoth acronym guide.


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 12:54 am 
Developer
User avatar
Offline

Joined: September 26th, 2005, 5:56 pm
Posts: 1791
Location: France
Hum ... I could make it work with 'frozen_unit.status.poisoned', but it wouldn't work with 'frozen_unit.status.stone'
I tried with 'frozen_unit.status.stoned' too, but it doesn't work too :(
It seems that the stoned status variable name is not as described in the Wiki :(


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 1:58 pm 
Forum Regular
User avatar
Offline

Joined: February 7th, 2005, 7:04 am
Posts: 1402
Location: Poland
Try [stone] tag, im not sure how it works, but i remember i seen this somewhere on the wiki.

_________________
"Think for yourself, schmuck!"


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 3:07 pm 
Developer
User avatar
Offline

Joined: September 26th, 2005, 5:56 pm
Posts: 1791
Location: France
I tried [stone] to with a standand unit filter (like [unstone]), but it doesn't work too :(
Well i think there is a bug in Wesnoth since it works well with status.poisoned and it wouldn't work with status.stone. :( :( :(


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 4:04 pm 
Forum Regular
Offline

Joined: May 12th, 2004, 12:35 am
Posts: 5283
Location: Dulles, VA
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.


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 6:43 pm 
Developer
User avatar
Offline

Joined: September 26th, 2005, 5:56 pm
Posts: 1791
Location: France
Basically i use this code :
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


And then this macro is called several times on every side turn :
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]


This works ok for me if i replace status.stone with status.poisoned, but it wouldn't work with stone ... Any idea ?


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 6:51 pm 
Forum Regular
User avatar
Offline

Joined: February 7th, 2005, 7:04 am
Posts: 1402
Location: Poland
maybe its "stoned" not "stone"?

_________________
"Think for yourself, schmuck!"


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 7:02 pm 
Forum Regular
Offline

Joined: May 12th, 2004, 12:35 am
Posts: 5283
Location: Dulles, VA
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.


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 7:30 pm 
Developer
User avatar
Offline

Joined: September 26th, 2005, 5:56 pm
Posts: 1791
Location: France
Thanks, it comes from there :
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

Variable name conflicts ? :oops:


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 7:49 pm 
Forum Regular
User avatar
Offline

Joined: February 7th, 2005, 7:04 am
Posts: 1402
Location: Poland
Uhh.. thats not functions like in c++ and such, every variable can be used in _every_ place of code.

_________________
"Think for yourself, schmuck!"


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 7:57 pm 
Forum Regular
Offline

Joined: May 12th, 2004, 12:35 am
Posts: 5283
Location: Dulles, VA
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".

_________________
Hope springs eternal.
Wesnoth acronym guide.


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 10:44 pm 
Developer
User avatar
Offline

Joined: September 26th, 2005, 5:56 pm
Posts: 1791
Location: France
I made all the things work ...
Here is how i use [unstone] :
Code: [ Select all ]
        [unstone]
                [filter]
                        x=$xunfreeze
                        y=$yunfreeze
                [/filter]
        [/unstone]

(i took different variables for the unfreeze code too).
I also made a MP scenario from this, but bad things happen in MP.


Top
 Profile  
 
 Post subject:
PostPosted: November 4th, 2005, 10:50 pm 
Forum Regular
Offline

Joined: May 12th, 2004, 12:35 am
Posts: 5283
Location: Dulles, VA
Hey great. I'll update the wiki.

_________________
Hope springs eternal.
Wesnoth acronym guide.


Top
 Profile  
 
 Post subject:
PostPosted: November 6th, 2005, 4:17 am 
Developer
Offline

Joined: June 26th, 2005, 8:39 pm
Posts: 294
Some commands have an implicit SUF and for others you need to use a filter tag. I think the common case is that you use a filter tag to do a location filter if there is an assumed unit filter or vice versa, but unstone doesn't seem to have an implied filter, so it is an exception.


Top
 Profile WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group