Right now I have a part in my game that I want the player to walk over a certain area and when he walks on it the floor boards creak and he backs up saying something about the floor being squeaky then the player can use an inventory item say like grease to turn off the effect of the squeeky floor is there an easy way to do this without using very much code or none at all?
Well, there is a event for standing on a hotspot. Why can't you just use that?
~Trent
That works somewhat but if you walk to another point bu just say using something on the other side of the room it does not stop the player it allows them to go right over it.
Perhaps something like
//room_rep_exec
Hotspot *hotty=Hotspot.GetAtScreenXY(player.x, player.y);
bool greasedfloor;
if (hotty==hCreakyFloor && !greasedfloor) {
//Can't step there!
}
But, Khris or someone else will probably soon come by and give you something better. := Cause they're cool like that.
~Trent
Unfortunately, blocking walks won't trigger region events until after the player has stopped moving, correct.
It's possible to do a rep_ex check, but it's even better to send the player off non-blocking.
I've written a module called GotThere to achieve this.
Here's the link & short explanation:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36383.msg477380#msg477380
(The downside: if you want the game to work consistent, you'll have to adjust all your existing interaction funtions)
Quotewithout using very much code
As a workaround, using lots of code, could you add in a condition to the Interact function for each object on the other side of the room that requires a walk-up-and-interact animation??
if (bOiledFloorboards)
{
// walk across, you're fine
// interact with the whatnot on the other side as intended
}
else
{
if (bTestedFloorboard)
{
cChar.Say("If I walk over there, that damned floorboard'll start squeaking again.");
}
else
{
// engineer a walk just as far as the floorboard
// play squeak effect
// back off
bTestedFloorboard = true;
}
}
??
Depends on how many objects you've got on the other side of the room, I suppose.
I did the very thing thezombiecow is suggesting in the game I'm making.
I had a section of the floor that could not be walked over until certain conditions were met. I put the proper code into the playerWalksOntoRegion function ("Oh no I can't walk here!" etc), and then for each hotspot on the other side of that region, I checked if the conditions had been met, and if not, had the player only walk just as far as the edge of the region and stop. That would trigger the playerWalksOntoRegion function.
Since I had only four interactable items beyond that region of the floor, this was a simple and effective solution.
QuoteI did the very thing thezombiecow is suggesting in the game I'm making.
Awesome. Hope it works out for you ;)
Well, I did it several months ago, so it is working out for me just fine. Thanks. ;)
Aaaaaaah.
Then again, I am a time traveler...
He came from the past to save the future...
Seriously though, you could just not have any walk-to interactions beyond the board (ie, the player must manually walk to within a certain distance for take/interact stuff to occur). This easily resolves the issue of blocked walk because you won't have any (except for walking away from the board, obviously).