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)
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#1
How to use crowbar to unlock door? (Solved)

Okay why my Crowbar is not working with the door?

What i am doing wrong? Simple Script using crowbar on "Prison door"
i use that crowbar but then it disappears and its gone.. And door is locked..

Full Script just in case:


void OnStart()
{
SetPlayerLampOil(0);
//if(ScriptDebugOn())
//{
// GiveItemFromFile("lantern", "lantern.ent");
// for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
// SetPlayerLampOil(100);
//}
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}

void OnEnter()
{
}

/// Actual Functions

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}

void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("prison_section_1", false, true);
SetMoveObjectState("prison_section_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}

“Life is a game, play it”
(This post was last modified: 01-10-2011, 12:00 AM by HumiliatioN.)
01-09-2011, 09:24 PM
Find
triadtimes Offline
Senior Member

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

(01-09-2011, 09:24 PM)HumiliatioN Wrote: Okay why my Crowbar is not working with the door?

What i am doing wrong? Simple Script using crowbar on "Prison door"
i use that crowbar but then it disappears and its gone.. And door is locked..

Full Script just in case:

Spoiler below!

void OnStart()
{
SetPlayerLampOil(0);
//if(ScriptDebugOn())
//{
// GiveItemFromFile("lantern", "lantern.ent");
// for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
// SetPlayerLampOil(100);
//}
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}

void OnEnter()
{
}

/// Actual Functions

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}

void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("prison_section_1", false, true);
SetMoveObjectState("prison_section_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}


Here is what I have
(Must have gotten it from the same place.)

Spoiler below!

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
CompleteQuest("BrokenLock", "BrokenLock");
CompleteQuest("BrokenLock", "BrokenLock2");
}

void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("mansion_3", false, true);
SetMoveObjectState("mansion_3", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}


What is the problem? Can you not interact with the crowbar once it is in the door? Is the crowbar showing up at all?

01-09-2011, 10:36 PM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#3
RE: How to use crowbar to unlock door?

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. :/

“Life is a game, play it”
(This post was last modified: 01-09-2011, 10:58 PM by HumiliatioN.)
01-09-2011, 10:53 PM
Find
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
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#5
RE: How to use crowbar to unlock door?

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.

Oh, I Forgot that thanks... But now its only opens and there is that Area effect but not that when you must turn that crowbar to open.. Only Soundeffect and particle then its open not that Crowbar animation i mean Smile

“Life is a game, play it”
01-09-2011, 11:38 PM
Find
triadtimes Offline
Senior Member

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

(01-09-2011, 11:38 PM)HumiliatioN Wrote: 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.

Oh, I Forgot that thanks... But now its only opens and there is that Area effect but not that when you must turn that crowbar to open.. Only Soundeffect and particle then its open not that Crowbar animation i mean Smile

I think your problem is that you have your area directly on the crowbar

It should look (somewhat) like this:
Spoiler below!
[Image: Crowbar01.jpg]
Notice that the crowbar_joint_1 is not in the ScriptArea but can be moved into it

I think yours looks like this:
Spoiler below!
[Image: Crowbar02.jpg]
See that the crowbar is in the ScriptArea and will automatically fire AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);

01-09-2011, 11:53 PM
Find
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#7
RE: How to use crowbar to unlock door?

Oh many thanks now it works Tongue

You are good with scripting Smile

“Life is a game, play it”
01-09-2011, 11:59 PM
Find
Tony32 Offline
Junior Member

Posts: 26
Threads: 2
Joined: Jan 2011
Reputation: 0
#8
RE: How to use crowbar to unlock door? (Solved)

Surely an intresting script. I think I'll use it aswell. Thank you! Smile
01-11-2011, 02:46 PM
Find
Vradcly Offline
Member

Posts: 100
Threads: 6
Joined: Jan 2011
Reputation: 0
#9
RE: How to use crowbar to unlock door? (Solved)

Now I am trying this aswell, but there is one thing that is a bit unclear.

Where do I create the joint?, Is the joint also a script area or what is it and how do I create it?
Cant find joint creation on the level editor, so it must be something else that i just move into position and call a joint?
01-28-2011, 11:39 AM
Find
Vradcly Offline
Member

Posts: 100
Threads: 6
Joined: Jan 2011
Reputation: 0
#10
RE: How to use crowbar to unlock door? (Solved)

Nwm, now i understand, its an entity of the crowbar Smile
01-28-2011, 02:12 PM
Find




Users browsing this thread: 2 Guest(s)