Jump to content

Hot and Cold Wherigo


Forest-Ghost

Recommended Posts

I am building a hot and cold Wherigo. I am trying to set it up so that every time the player moves 200 ft or more a message will be displayed stating if the player is getting hotter or colder (closer or farther from the geocache zone). So far I have setup a function to measure the distance from the geocache zone and tell if the player is getting hotter or colder.

 

Now I am trying to create a second variable that will measure the distance from the player's last known location. Can a player's location be stored as a variable and if so, can you use this variable to compare distance from the player's last known location? I would like to set it up so that every time the player moves 200 ft the cartridge will display the hot/cold message which I have already setup. How would you do this?

 

Any suggestions are welcome. Please let me know too if you think there is a better way to set up this cartridge.

Link to comment

The position of the player is of type Wherigo.ZonePoint and could surely used to calculate a distance to the actual position.

 

You could use the OnDistant and OnProximity events of zones. Set the position of the zone to the actual position of the player. Set the proximity range to 200 ft. If the player leaves the proximity range (here 200 ft) you get a OnDistant event, independent of the direction the player walks. See http://forums.Groundspeak.com/GC/index.php?showtopic=329458 too.

Link to comment

Funnily enough, I had a variation of this same concept in mind. The player has a button in their inventory, with a "press" command. Every time they press, it compares the distance from the player to the final cache location to the distance as at the last time they pressed the button. If it goes up, then the cartridge tells them they're getting colder, if it goes down they're getting warmer. You could put some kind of a timer that disables the button for a period of time after it is pressed to prevent abuse.

 

The problem I would foresee with a cartridge that detects them being exactly 200 feet away from last time it triggered is that, when the player gets within 200 feet of the cache, it gets hard to narrow down further which direction to go in. If it triggered when you're 100 feet away, you might potentially walk past the cache and be 100 feet the other side by the time it triggered.

 

An alternative I've just thought of as I was writing this is to have a timer event which checks the distance every X seconds or minutes.

Link to comment

Thank you, this sounds like it will work well. Sorry to ask questions again, but

 

How do you set the position of the zone to the actual position of the player?

 

I tried several commands on my own but they result in the cartridge crashing. Thank you for all of your help.

 

You could try something like this:

 

 function DistanceFromZone(zone, units)
local d2,b2 = Wherigo.VectorToPoint(Player.ObjectLocation, zone.Points[1])
local d = d2(units)
--print("Distance from zone " .. zone.Name .. " = " .. d)
return d
end

 

I've adapted this from something Ranger Fox created initially.

Link to comment

Could someone possibly upload an example of this in urwigo? I am looking for: a zone that is set to the player's current location as an on exit event

 

Sorry to ask again. I have read through all of the forum posts on this and tried the lua a number of ways but I still can't get it to work without crashing the cartridge. I even tried copying parts of several cartridges that are play anywhere but I still could not get it to work. I am not sure what I am missing. It would be a tremendous help. Thanks.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...