Hello, a general question:
I have a character or an area where the player cannot yet access. If I click on it, the player cannot move to the area, but he still does his action, from where he is. How to avoid this?
You can draw a region in the area where the player character should be to trigger the event.
Then you add a condition when the player click on the hotspot/object/character:
if (Region.GetAtRoomXY(player.x, player.y) == region[1]) {
//perform the action
}
else {
//do something else
}
Or you can simply make the hotspot/object/character non clickable at first and activate it when the new area is accessible.
Thank you for the answer. I try the first solution (you must not put "player.", Only the positions) but it does not work.
Quote from: Peegee on Sat 20/11/2021 11:09:20
(you must not put "player.", Only the positions) but it does not work.
You should put 'player.x' & 'player.y', as these two are the player character's positions.
Yes I put this: if (Region.GetAtRoomXY(player.228, player.173) == region[7])
But the program doesn't take it.
He takes that well: if (Region.GetAtRoomXY(228, 173) == region[7])
But that doesn't change my problem.
Quote from: Peegee on Sat 20/11/2021 15:56:38
Yes I put this: if (Region.GetAtRoomXY(player.228, player.173) == region[7])
But the program doesn't take it.
You seem to misunderstand, the proper way was to do literally
if (Region.GetAtRoomXY(player.x, player.y) == region[7])
The point is that you ask engine to check which coordinates player character is at. You don't have to know these coordinates yourself.
Ok, it works! Thank you.