Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: mode7 on Mon 08/11/2010 14:20:43

Title: Is there a hotspot_WalkOff event?
Post by: mode7 on Mon 08/11/2010 14:20:43
I noticed there's a WalkOn event for hotspots but there isn't a WalkOff one.
I want to give an object a certain tint while the player stands on hotspot and if the player walks off, I wont to remove the tint.

Of course I could use Regions for that, but there are only 15 Regions and that won't be enough, in fact even 30 Hotspots could also be problematic, as I'm using pretty big bgs. Maybe there's a possibiblity to increase the count?
Title: Re: Is there a hotspot_WalkOff event?
Post by: Mouth for war on Mon 08/11/2010 14:48:48
maybe you could use something like...I don't know...if the character is on a specific x,y coordinate, tint the character and then remove the tint when he's standing on a different coordinate. Just a thought and have no idea if it would work. I'm not a great scripter :D
Title: Re: Is there a hotspot_WalkOff event?
Post by: mode7 on Mon 08/11/2010 14:54:35
yeah, that would work - but the whole code would get really confusing - well at least thats a possibility. Maybe there's another way
Title: Re: Is there a hotspot_WalkOff event?
Post by: Matti on Mon 08/11/2010 15:00:38
What version are you using? In 3.2 there's a limit of 50 hotspots. Also, there's no "WalkOn" but only a "StandingOn" for hotspots.

But I'd do it like Mouth suggested, the script shouldn't get confusing doing this.

Edit: It should look somehow like this:

Pseudo-

if      (Hotspot.GetAtScreenXY(player.x, player.y) == hHotspot1) oObject.tint();
else if (Hotspot.GetAtScreenXY(player.x, player.y) == hHotspot2) oObject.tint();
else if (Hotspot.GetAtScreenXY(player.x, player.y) == hHotspot3) oObject.tint();
...
else oObject.RemoveTint;
Title: Re: Is there a hotspot_WalkOff event?
Post by: mode7 on Mon 08/11/2010 15:59:10
Hm thanks Matti - this way it looks really straightforward - I'll try this
Title: Re: Is there a hotspot_WalkOff event?
Post by: Wyz on Mon 08/11/2010 19:50:19
You can use Matti's code in a function that is called by the WalkOn events. I believe hotspot 0 (hotspot less parts) also triggers the event. If not you can use the repeatedly execute event.