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
How to use crowbar to unlock door? (Solved)
triadtimes Offline
Senior Member

Posts: 508
Threads: 16
Joined: Jan 2011
Reputation: 21
#4
RE: How to use crowbar to unlock door?

(01-09-2011, 10:53 PM)HumiliatioN Wrote: What is the problem? Can you not interact with the crowbar once it is in the door? Is the crowbar showing up at all?

I cant interact and its not showing at all. :/

Do you have a "crowbar_joint" which is not active on your door in the Level Editor? Because the code does the following:

Spoiler below!

void OnStart()
{
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UsedCrowbarOnDoor", true); <-- This makes UsedCrowbarOnDoor run if crowbar_1 is used on prison_section_1
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1); <-- Once crowbar_joint_1 hits ScriptArea_1 it runs CollideAreaBreakDoor
}

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel"); <-- runs timer
RemoveItem("crowbar_1"); <-- Removes crowbar_1
}

void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false); <-- Plays a sound
SetEntityActive("crowbar_joint_1", true); <-- Makes crowbar_joint_1 active. There must be a non-active crowbar_joint_1 in the map for this to work
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);<-- Sanity Boost
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);<-- Plays Music
SetSwingDoorLocked("prison_section_1", false, true);<-- Unlocks the door
SetMoveObjectState("prison_section_1", 1);<-- Moves the door into state 1 (Open I think (This didn't work in mine but it is more aesthetic and won't interfere with gameplay))
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);<-- Plays a sound
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);<-- Creates a particle effect at entity AreaBreakEffect
SetEntityActive("crowbar_joint_1", false);<-- makes the crowbar_joint_1 not active
SetLocalVarInt("Door", 1);<-- Sets the Variable Door to 1
}


The problems might be that you don't have a crowbar_joint_1 (which should be not active) at prison_section_1, and you might not have all of the necessary scripting areas.

01-09-2011, 11:26 PM
Find


Messages In This Thread
RE: How to use crowbar to unlock door? - by triadtimes - 01-09-2011, 11:26 PM



Users browsing this thread: 2 Guest(s)