+Chaman Calle Posted March 28, 2016 Share Posted March 28, 2016 I am doing a Wherigo with the urwigo but have a problem with the active zones. I have a random selection of zone. Then, you use an object that calls a funtion to dig. If you are in the correct area, you find a treasure. If not, you don't find anything. However, the problem comes when I use the "compare" function to see if the player is inside the active zone. The active zone is not the one "chosen" to have the treasure, and don't know why. Any help will be great. Thanks in advise. Quote Link to comment
+charlenni Posted March 29, 2016 Share Posted March 29, 2016 I don't know, what "CurrentZone" is. To see, what Urwigo use for this, you have to look into the source code of your cartridge. "CurrentZone" isn't part of the Wherigo definition. So it is perhaps better to save the treasure zone to a variable (when creating it) and check, if the player is in this treasure zone. Btw. you set only one zone active. With this, the player sees always only one zone. The other zone isn't used. Quote Link to comment
+Chaman Calle Posted March 29, 2016 Author Share Posted March 29, 2016 There's a list of items to select, such as zones, player, function, tasks... And there's a menu for "current objects". Inside this menu, there are options for current zone, current item, current task, and so on. The Wherigo will have 10 zones where you can dig, and one is selected randomly. You play a hot/cold game in order to find the zone where you have to dig. A simple hot/cold with just 1 area is simple to program (distance to area, and select the area in play), but the problem begins when the area is not defined by the user and it is selected randomly. I don't know how to say to the cartridge "I want to use this zone". I thought that with that option of "current zone" the problem should be solved because the randomly select area is the only active, but it doesn't work properly. Quote Link to comment
+charlenni Posted March 29, 2016 Share Posted March 29, 2016 The problem is, that a player could be inside of moire than one zone. That's the case, if the zone are overlap. I made a small cartridge with 4 zones to show you, how it could be done. I assume, that there are more than this solution for the problem, but this was the first I get. You have 4 zones (Zone A - D) and a shovel to dig inside of the zones. If you have any questions or problems, don' hesitate to ask. Best regards, Dirk (Charlenni) Treasure.zip Quote Link to comment
+Chaman Calle Posted March 30, 2016 Author Share Posted March 30, 2016 Ok now a zone has became a variable. However, in order to check "distance to a zone" you need to pick a zone. Is there any LUA expression that works with that? Once again, the "current zone" should be the best way to solve this problem, but as always, it doesn't work. Quote Link to comment
+charlenni Posted March 31, 2016 Share Posted March 31, 2016 I looked into it. CurrentZone is only a string, which holds the name of a zone. I didn't see, how it is set to another zone than the first one. I have to investigate this further. Regarding the distance: this is only a check for the State of the zone. In the example it would be 'treasureZone.State == "Proximity"'. "Proximity" could be although "Inside", "Distant" or "NotInRange". So you could use a "Lua user expresion" to reproduce this. Quote Link to comment
+charlenni Posted March 31, 2016 Share Posted March 31, 2016 It seems, that "CurrentZone" is set, if you enter/exit/activate (or all other zone events) a zone. So you could use it, if you work with "Global zone events". The others current objects aren't set to any valid value. Quote Link to comment
+Forest-Ghost Posted April 2, 2016 Share Posted April 2, 2016 Here is the definition of how current objects work according to yourself: "CurrentObject represents a zone/item/... for which is the code executing. It is not useful in classic OnEnter, OnExit, ... handlers for objects. It is intended to be used in user functions, that are reused between different objects. Lets assume you have zoneA and zoneB and in OnEnter handler both call function myFunction. CurrentObject will represent zoneA or zoneB, depending from where the function has been called." Quote Link to comment
+Chaman Calle Posted April 23, 2016 Author Share Posted April 23, 2016 Final step: I have to set some messages for the "random area", like a reverse Wherigo, forthe distant and proximity areas. However, the target of the "distance to a zone" expression doesn't work with variables. Is there any other way than setting 10 "if" condition for every area? I set the "contains" LUA expression, but don't know if there is any other for that conditions. Thanks in advise Quote Link to comment
+Forest-Ghost Posted April 23, 2016 Share Posted April 23, 2016 If your trying to simplify the code for each zone you could create a function and do a function call for each zone of the same code. I am not sure I am understanding the problem 100% though. In terms of the "distance to zone" function. This actually does work with variables. Create a "set function." Within the set function have a compare statement with one side be the variable and the other side be a numeric operation. You will need to pull the distance to target to within the numeric operation and then set the multiplier to 1. Johnny65 posted about this a couple years ago and if you search his forum posts there is one relating to how to set up the distance to target function in urwigo. Another option, is you could use the proximitiy setting for each zone and create a series of nested zones that would work as proximity rings. I did this once to create a hot and cold Wherigo. One ring was at 300 ft, another at 200, 100 ect. If a player leaves a ring then they get a message they are getting colder. If the player enters the ring then they get a message that they are getting warmer. Quote Link to comment
+Chaman Calle Posted April 24, 2016 Author Share Posted April 24, 2016 The way you play this Wherigo is: > The cartridge selecs a random area over 10 possibilities. > You have an item tha allows you to dig. > If you are in the area and you use the item, you find a treasure. If not in the area, there's a message telling you how far are you from the area (distant, in proximity, out). As you can see at the picture, there's a LUA expresion for the "inzone", but don't know if there is similar for the other functions (in proximity and distant). I don't want to set a function with a variable and compare 10 possible solutions, doing 10 copy-paste (one for each area) as the image shown. Quote Link to comment
De GC-lopers Posted April 25, 2016 Share Posted April 25, 2016 If have made an example of how I would do it, don't know if it is exactly want you want. Treasure.zip Treasure.zip Quote Link to comment
+charlenni Posted April 25, 2016 Share Posted April 25, 2016 The function in Wherigo you search is Wherigo.VectorToPoint(). If you want the correct distance to the treasure zone, you should use math.floor((Wherigo.VectorToPoint(Player.ObjectLocation, treasureZone.OriginalPoint):GetValue "m") + 0.5) Details: Wherigo.VectorToPoint(Player.ObjectLocation, treasureZone.OriginalPoint) returns a distance object between player location and the variable treasureZone, which contains the treasure zone Wherigo.VectorToPoint(Player.ObjectLocation, treasureZone.OriginalPoint):GetValue "m" returns the value of a Distance object in meters. The rest (math.floor(x+0.5)) formats the distance, so that you have a integer value without decimals. I added this in the example (see Shovel.Dig). Treasure.zip Quote Link to comment
+Chaman Calle Posted April 26, 2016 Author Share Posted April 26, 2016 (edited) Thanks for your help guys! I have other problems now, but they don't fit here... If you want to check the final result, I linked the cartridge downthere. Chocobo prueba 2.zip Edited April 27, 2016 by Chaman Calle 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.