Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scripting: check if treasure chest is open
Samuelblitz Offline
Junior Member

Posts: 16
Threads: 4
Joined: Feb 2011
Reputation: 0
#4
RE: scripting: check if treasure chest is open

I am sorry for asking in this thread, but i figured since this thread is exactly what i'm trying to do, i shouldn't make a new topic.
I am trying to make it so when the player walks into a room, they walk into an area (door_close_trigger) that will close the door behind them IF they left it open.

under OnStart i have these two:

"AddEntityCollideCallback("storage_door1", "monster_scare3", "DoorState", true, 0);
AddEntityCollideCallback("Player", "door_close_trigger", "CloseDoor", true, 1);"

later in the script i have:

"void DoorState(string &in asParent, string &in asChild, int alState)
{
if (alState == 1)
{
SetLocalVarInt("DoorOpen", 1);
}
if (alState == -1)
{
SetLocalVarInt("DoorOpen", 0);
}
}"

and then:

"void CloseDoor(string &in asParent , string &in asChild , int alState)
{
if(GetLocalVarInt("DoorOpen") == 1)
{
SetSwingDoorLocked("storage_door1", true, true);
GiveSanityDamage(15.0f, true);
PlaySoundAtEntity("", "lock_door.snt", "monster_scare3", 0.0f, false);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0.0f, false);
}
if(GetLocalVarInt("DoorOpen") == 0)
{
AddDebugMessage("Door is closed! Smile", false);
}
}
"

When i test this in-game i always get the debug message "Door is closed! Smile" even if it is obviously open, help would be very much appreciated.
03-25-2011, 05:10 PM
Find


Messages In This Thread
RE: scripting: check if treasure chest is open - by Samuelblitz - 03-25-2011, 05:10 PM



Users browsing this thread: 1 Guest(s)