[SOLVED] How can I make item work only if player reaches the hotspot

Started by beenf, Wed 08/06/2011 19:34:49

Previous topic - Next topic

beenf

So I have a map with a river in the middle. The hotspot is on one side of the river and player on other.
My goal is that when person is other side of the river from where hotspot is he can't use a item on it. If he tries to use it he walks straight forward to the hotspot but gets stopped by river. But if he gets to the other side of the river and uses then the item it works and magic happen.
I tried simple if player uses the item on hotspot
player.Walk(x, y);
Display("The door has opened);
But if I do that player would walk to river, be stopped by it and still show the message. I hope you smarter guys understand what I try to do here and can help me.

Matti

Put a region on the other side of the river (where the hotspot is):

if (Region.GetAtRoomXY(player.x, player.y) == region[1]){
 player.Walk(x, y);
 Display("The door has opened");
}

else player.Walk(x, y);

beenf

Thnx Worked ^^

Matti

Btw, you can shorten it a bit:

player.Walk(x, y);
if (Region.GetAtRoomXY(player.x, player.y) == region[1]) Display("The door has opened");

SMF spam blocked by CleanTalk