[SOLVED] Display message when you click to walk

Started by rickious, Sat 21/09/2013 14:13:03

Previous topic - Next topic

rickious

How do I display message when you click to walk in an area that in inaccessible?
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

selmiak

I wouldn't display a message saying you can't walk there anytime the player clicks outside a walkable area or a hotspot/object/character. This gets annoying for the player really fast. If you have a scene with a blocked off way just add a hotspot for the blocked path and treat it like a hotspot with all needed interactions. If you don't give the hotspot a name its name won't be shown on any GUI and behave like a normal part of the background except when clicked on.

Slasher

#2
One way

You could RemoveWalkableArea until you can go there and use a Hotspot.

select in Hotspot  events Any Click in it's events panel.

When the player can access that area set Hotspot enabled to false and RestoreWalkableArea.

It's best not to give this Hotspot a name.


Ex:
Code: ags
hHotspot1.Enabled=false;
RestoreWalkableArea(3);


EDIT:
QuoteI wouldn't display a message saying you can't walk there anytime the player clicks outside a walkable area or a hotspot/object/character. This gets annoying for the player really fast.

I agree and you may / should give a better reason why player can't go there if it looks like he should be able to.





rickious

Thanks you two.

To extrapolate, I have a corridor which I will use twice, 1 version of the room will be when you are at the back end, the other version you will be at the front (perspective with the corridor coming towards you).  In the middle is something the player doesnt want to go near.

So, I have a hotspot ready to cover the area that you want to move to and cant.  When you click to walk there he just stops at the walkable areas limit.

So, I want the walk icon to interact with the hotspot triggering a 'Display'  The 'Any Click' isnt giving me a message when in walk mode, only with talk, interact and look.

This isnt a biggie, Ill just have messages saying you cant reach etc for the area instead otherwise.  I just thought there would be code for 'Walk' like there is for interact, look etc.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Slasher

One way (I believe there is a more suggestive way) would be to add a region around the area you can't go and have the player walk until he walks on to the region, displays something and then walks back or vice versa. You should use a boolean / condition to control this.

Make a boolean and give it a name then add this to the Walks on to region event:
Code: ags


{
if (boolean==false) // boolean name
{
 Do this // IE Can't go there if condition not met
{
else if (boolean==true) // boolean name 
{
 Do this // Can go there if condition met
}
}


This is a short way that you could use. It depends.




Khris

Edit:
slasher, PLEASE use proper indentation when posting code examples. If you can't, stop posting code examples.

Yeah, eModeWalkto doesn't trigger any click on, afaik.

What I would do is create a region near the blockage, then show the text when the player steps on it.
Thus, whenever you click at a spot that makes the player try and go down the corridor, they will hit the region.

If you do want to show the text after clicking the blockage area (which IMO is kinda outside of how the walk cursor should work), add this to the room script:
Code: ags
function on_mouse_click(MouseButton button) {
  // only handle left walk clicks on room
  if (button != eMouseLeft || mouse.Mode != eModeWalkto) return;
  // handle only the blockage
  if (Hotspot.GetAtScreen(mouse.x, mouse.y) != hBlockage) return;
  Display("...!");
}

rickious

Cheers.
I might go for the 'Stands on Hotspot" solution.  Im finding it hard not to want all the little details like this in place from the beginning so I appreciate you help.
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Khris

Don't use the "stands on hotspot" event, it is only still included for backwards compatibility and will trigger the event 40 times per second.
Use a region and its "walks onto" event instead.

rickious

--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

SMF spam blocked by CleanTalk