Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: steptoe on Sat 29/10/2011 17:30:48

Title: Walkto cursor on hotspot only for events to happen
Post by: steptoe on Sat 29/10/2011 17:30:48
Hi

I'm not sure if below is appropriate script but i need to have the user to use WALK mode only on hotspot for walkable area restored and the player to move to destination.

So far the player will not walk to destination.


function hHotspot2_Mode8()
{
if (mouse.Mode == eModeWalkto)
{
  RestoreWalkableArea(3);
    csinbad1.Walk(106, 109, eBlock, eWalkableAreas);
}
}


There may be other ways I can use but I would like to sort this out first.

all help appreciated

steptoe

Title: Re: Walkto cursor on hotspot only for events to happen
Post by: Shane 'ProgZmax' Stevens on Sat 29/10/2011 20:05:19
Have you tried GetHotspotAtXY (with mouse.x/mouse.y as the coordinates to check and hHotspot2 as the hotspot you are looking for)?  This way it will trigger whenever the mouse is over the proper hotspot, and then you can add some qualifying logic like (mouse.IsButtonDown(eMouseLeft)) to check for a click and then execute the blocked walk to that location.

You may consider making a non-block instead in case someone accidentally clicks there and changes their mind.  
Title: Re: Walkto cursor on hotspot only for events to happen
Post by: steptoe on Sat 29/10/2011 21:11:38
Good idea ProgZmax, I'll try it..

cheers


Title: Re: Walkto cursor on hotspot only for events to happen
Post by: Khris on Sun 30/10/2011 11:12:10
I can't make heads or tails of the first post...

One thing I see though is that the code says hHotspot2_Mode8(), so unless you renamed the function, mouse.Mode will never be eModeWalkto when that function is called (because it is Mode8).

Also, Walkto-Clicks on hotspots only trigger the AnyClick event, afaik.