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
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: scripting: check if treasure chest is open

I am not going to give you explicit code now, rather a layout.
Note that I didn't test this and it might not work.

1. Create a script area above the chest, let's call it ChestScriptArea.
2. Add an entity collide callback using the ChestScriptArea and the chest itself in your OnStart and use 0 as last value, let's call the callback ChestState.
3. In the ChestState function, make an if-clause with if (alState == 1) and set your LocalVarInt (which I call ChestOpen now) to 1. Create another if-clause with if (alState == -1) and set ChestOpen to something different than 1.
4. Now add another entity collide callback using your original script area and set the boolean to false (so it doesn't get removed when you enter the area).
5. In that new callback function, check if (GetLocalVarInt("ChestOpen") == 1), then your amazing stuff happens and don't forget to the orginial script area to inactive, so it won't trigger again.

(This post was last modified: 03-23-2011, 01:10 AM by Pandemoneus.)
03-23-2011, 01:08 AM
Find


Messages In This Thread
RE: scripting: check if treasure chest is open - by Pandemoneus - 03-23-2011, 01:08 AM



Users browsing this thread: 1 Guest(s)