+SquallLeonhart Posted November 10, 2016 Share Posted November 10, 2016 Hi, I'm currently developing my second Wherigo. I would like to know if/how it is possible to move a Character from a zone to another zone or to the 'none' zone by using a lua script. Thanks in advance. Quote Link to comment
+charlenni Posted November 10, 2016 Share Posted November 10, 2016 Use zitem:MoveTo(zone) to move the item "zitem" to the zone "zone". If you want to remove the item, use zitem:MoveTo(nil) Quote Link to comment
+SquallLeonhart Posted November 10, 2016 Author Share Posted November 10, 2016 (edited) Use zitem:MoveTo(zone) to move the item "zitem" to the zone "zone". If you want to remove the item, use zitem:MoveTo(nil) Thanks for your answer. I guess the "zitem" is the Identifier of the character or item to move ? Edited November 10, 2016 by SquallLeonhart Quote Link to comment
+charlenni Posted November 10, 2016 Share Posted November 10, 2016 Yes, this is correct. Quote Link to comment
+SquallLeonhart Posted November 10, 2016 Author Share Posted November 10, 2016 It works ! Thanks a lot. I have another quick newbie question . Still in LUA, is it possible to find the identifier of the current character ? Thanks in advance Quote Link to comment
+charlenni Posted November 10, 2016 Share Posted November 10, 2016 You mean the character the user is looking on in the detail page? No, that isn't possible. Or do you have anything else in mind. Perhaps get the identifier for a character, which Name you know? Quote Link to comment
+SquallLeonhart Posted November 10, 2016 Author Share Posted November 10, 2016 You mean the character the user is looking on in the detail page? No, that isn't possible. Or do you have anything else in mind. Perhaps get the identifier for a character, which Name you know? Yes, the identifier of the character the user is looking on in the detail page. My purpose exactly : 1. In the detailed page of a character, I created a command "Fight" 2. When the user clicked on the "Fight" command, save the character id somewhere 3. A Battle function is used to do the fighting 4. When the character is killed, retrieved the character id and use the <char id>:MoveTo(nil) to remove the character from the zone (as it is dead) See what I mean ? Quote Link to comment
Ranger Fox Posted November 11, 2016 Share Posted November 11, 2016 If you associate the "Fight" command with a character, you know which character the user selected because of that. If I was writing the code and I had a "Fight" command with every character, I'd send the character object as a parameter to a generic Fight method when "Fight" was chosen. Quote Link to comment
+SquallLeonhart Posted November 11, 2016 Author Share Posted November 11, 2016 If you associate the "Fight" command with a character, you know which character the user selected because of that. If I was writing the code and I had a "Fight" command with every character, I'd send the character object as a parameter to a generic Fight method when "Fight" was chosen. It worked. Thanks. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.