+Ogislookin Posted September 14, 2014 Share Posted September 14, 2014 How do I go about taking something out of the player's inventory and giving it to a character? I am trying a scene where the player has to bribe a character to get information. Is this possible? Quote Link to comment
Ranger Fox Posted September 14, 2014 Share Posted September 14, 2014 You can accomplish this a few ways. One of my favorite ways is to define a command that works with the character and item. The Wherigo engine is supposed to take care of making sure you're in the same zone as the character. When you have both the item and character in the same zone, the command will work. Make sure you disable the command on the command's event so the character cannot be bribed again (or move the item to nil). If you want something cleaner, you could always enable the command when the player reaches the zone with the character (and, if you'd like, disable it when the player leaves the zone). If you won't be dealing with people playing using a Garmin device, you could use the click event to determine if the item is in the player's inventory and display a message that looks like it's coming from the character. Some click events don't work with Garmin devices, so you might not want to go this route. Another way is when the user enters or is in proximity to a zone. Test to see if the player has an item in his or her inventory. If so, show a dialog that asks if the player wishes to give the item to a character. Define the input, store the value in a variable, define an event on the OnGetInput event, test for the variable's value, and determine if the player decided to bribe the character. If you have money in the game, store the quantity in a variable, do some math every time a bribe is given, and update the money object's description or name with the amount remaining (the variable's value). I have attached a basic cartridge (unzip the file). It demos three ways to set up what you want: when the player enters a zone, a command defined on the item, and a command defined on the character. In the end, it's up to you which approach fits your style. Ogislookin.zip Quote Link to comment
+charlenni Posted September 14, 2014 Share Posted September 14, 2014 It depends on, what you want to do with the item after you have removed it from the inventory. 1. You want, that the item vanishs. Than you should move it to nil. 2. You want, that the item still exists. Than you should move it to a zone. 3. You want, that the item change the character. Than you should make two characters, lets say "wizzard without hat" and "wizzard with hat", and, if you give the item to the character, set the first character to invisible, the second character to visible and the item is moved to nil. In all cases, the function Move is what you are looking for. Quote Link to comment
+Ogislookin Posted September 14, 2014 Author Share Posted September 14, 2014 Thanks guys! I just finished up my first Wherigo! It gets easier as you go along! 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.