Okay, maybe I'm loosing it (some might argue I never had it) but-
Player A needs to cross region B to get to object C
If the player uses the "Interact" cursor on C, I need to get him to stop at B until (s)he does something. My code in the region
// script for region2: Player walks onto region
if( GetGlobalInt(0) == 0 )
{
StopMoving(MARTY);
DisplaySpeech(MARTY, "Not Yet!");
MoveCharacterBlocking(MARTY, 180, 160, 0); // Move player back
}
However, this only activates after the player has reached object C. How can I prevent this from happening?
I tried RemoveWalkableArea to prevent the player getting close, but the player can still interact with the object from the other side of the room.
Any ideas on how to solve this?
You could do away with region B, and work it into the "Interact with object C" command.
if (GetGlobalInt (0) == 0) { // thing hasn't been done
MoveCharacterBlocking (MARTY, x, y, 0); // move towards object, but don't get there
DisplaySpeech (MARTY, "Not Yet.");
MoveCharacterBlocking (MARTY, 180, 160, 0);
}
else { // thing has been done
//whatever
}
or
MoveCharacter(GetPlayerCharacter(),object x, object y);
while((character[GetPlayerCharacter].walking)&&(GetRegionAt (character[GetPlayerCharacter()].x,character[GetPlayerCharacter()].y)==region#)){
Wait(1);
}
if(character[GetPlayerCharacter()].x</> a value ){//check if player is //near object
runscript for interacting with object
}
else{
display ("You can't get there yet.");
}
Disable the region to let them go to the object
Cool. Thanks!
Ashen, code works a charm.
Goot, the code doesn't work. He walks right through. However, that was easy to fix, just needed an extra line added
if(character[GetPlayerCharacter()].x</> a value ){//check if player is //near object
runscript for interacting with object
}
else{
display ("You can't get there yet.");
StopMoving(GetPlayerCharacter()); // Prevent Moving
}