Saving unit coordinates/location to a variable

The place to post your WML questions and answers.

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.
Post Reply
User avatar
Gwledig
Posts: 539
Joined: March 30th, 2009, 5:10 pm
Location: UK

Saving unit coordinates/location to a variable

Post by Gwledig »

Hi Im having some issues trying to save a unit's current coords in a single variable so this can be filtered later allowing me to do an event when another unit is adjacent to that former coord, any ideas of the besy way to populate this in a variable macro please?
Maintainer of Conquest (Original Gameplay), Conquest+, Conquest+ Space/Ranged, Chaoz Battle of the Wizards, Lazersquad (squad game), WesCraft (building MP game)
User avatar
Ravana
Forum Moderator
Posts: 2482
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Saving unit coordinates/location to a variable

Post by Ravana »

Store the locations that have your unit on.

If it is code challenge to solve it with variable macro, you need something like lua_function or formula to unpack the value again.
User avatar
beetlenaut
Developer
Posts: 2535
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Saving unit coordinates/location to a variable

Post by beetlenaut »

The way I would do it would be to store_locations with radius=1 to save the six hexes adjacent to the unit's current coords. That way, I could just use find_in when I filtered the location later.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply