Unit Presence Check
Moderator: Forum Moderators
-
- Posts: 21
- Joined: November 20th, 2005, 4:14 am
Unit Presence Check
Does anyone know what WML is needed to check to see if any unit is on a given hex? Also, does anyone know how to check the hex a unit is on for it's terrain type?
I need the first to check if a unit is sitting on a destination hex for an intended teleport. The second is so I can set up some units that have terrain specific regeneration: meaning that the unit regenerates but only if it is sitting on the specified terrain.
I need the first to check if a unit is sitting on a destination hex for an intended teleport. The second is so I can set up some units that have terrain specific regeneration: meaning that the unit regenerates but only if it is sitting on the specified terrain.
Re: Unit Presence Check
See http://www.wesnoth.org/wiki/EventWML for the moveto event.Wevilspore wrote:Does anyone know what WML is needed to check to see if any unit is on a given hex?
This is not implemented, it is the subject of feature request https://gna.org/bugs/?func=detailitem&item_id=3588 at the bug tracker.Also, does anyone know how to check the hex a unit is on for it's terrain type?
You should probably just use a [teleport] tag.I need the first to check if a unit is sitting on a destination hex for an intended teleport.
See the Oasis terrain in terrain.cfg: you need "heals=true" as an attribute of your terrain.The second is so I can set up some units that have terrain specific regeneration: meaning that the unit regenerates but only if it is sitting on the specified terrain.
This quote is not attributable to Antoine de Saint-Exupéry.
-
- Posts: 21
- Joined: November 20th, 2005, 4:14 am
You misunderstand. I am trying to set up some units that regenerate only when they occupy a given terrain type, not a healing terrain.My Quote:
The second is so I can set up some units that have terrain specific regeneration: meaning that the unit regenerates but only if it is sitting on the specified terrain.
ott's Quote:
See the Oasis terrain in terrain.cfg: you need "heals=true" as an attribute of your terrain.
You could use [store_locations] to store the locations of units of type x that are standing on terrain y. Then you could iterate through the stored array of coordinates and use each coordinate as the unit filter and give them some hp that way. This would of course happen inside a side turn event, so the healing occurs at the beginning of the side's turn.
-
- Posts: 21
- Joined: November 20th, 2005, 4:14 am
Wouldn't it be easier to filter for the terrain type rather than the terrain's location?
What I was thinking was to set up, in either the unit or the movement-type, a way to check if the current location's terrain was a given terrain type and then allow the unit its regeneration. I just need to know how to access the unit's current location and use that to look at that location and return the terrain-type at that location.
Any thoughts would be appreciated.
What I was thinking was to set up, in either the unit or the movement-type, a way to check if the current location's terrain was a given terrain type and then allow the unit its regeneration. I just need to know how to access the unit's current location and use that to look at that location and return the terrain-type at that location.
Any thoughts would be appreciated.
-
- Posts: 21
- Joined: November 20th, 2005, 4:14 am
What about Ambush?
Doesn't Ambush check for the terrain the current unit is on? What is the WML it uses to do this?
Re: What about Ambush?
I think ambush is hardcoded, c++ code checks this, not WML.Wevilspore wrote:Doesn't Ambush check for the terrain the current unit is on? What is the WML it uses to do this?
-
- Posts: 21
- Joined: November 20th, 2005, 4:14 am
:(
Darn. And all I know is c#, otherwise I could fix this myself.Tomsik wrote:I think ambush is hardcoded, c++ code checks this, not WML.