The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Problem with script
swamphag Offline
Junior Member

Posts: 2
Threads: 1
Joined: Aug 2012
Reputation: 0
#1
Problem with script

Hello everyone.

I am new to the amnesia level editor and today i was scripting, but when I tested out the script in game, it didn't work.. basically, I made a script so when I used a crowbar on a locked cabinet, it unlocked. When I try using the crowbar on it, it does become the crowbar joint, although when I try to move the joint to unlock it, it doesn't work. It just moves around, doing nothing.

Here is the code:




void OnStart()
{
AddUseItemCallback("", "crowbar_1", "cabinet_simple_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}


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("cabinet_simple_1", false, true);
AddPropImpulse("cabinet_simple_1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("cabinet_simple_1", true);
SetSwingDoorClosed("cabinet_simple_1", false, false);
SetMoveObjectState("cabinet_simple_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}


void OnEnter()
{
}


void OnLeave()
{
}


Also, whilst I'm here I want to ask, how do you put items (e.g lantern) inside a cabinet?
08-21-2012, 07:27 PM
Find


Messages In This Thread
Problem with script - by swamphag - 08-21-2012, 07:27 PM
RE: Problem with script - by Robby - 08-21-2012, 07:37 PM
RE: Problem with script - by swamphag - 08-21-2012, 07:40 PM
RE: Problem with script - by Robby - 08-21-2012, 07:44 PM
RE: Problem with script - by Adny - 08-21-2012, 07:55 PM
RE: Problem with script - by Robby - 08-21-2012, 08:12 PM



Users browsing this thread: 1 Guest(s)