Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Problem .HPS key/crowbar
Author Message
wagiwombledog Offline
Junior Member

Posts: 8
Joined: Mar 2012
Reputation: 0
Post: #1
Script Problem .HPS key/crowbar
Hi, I'm having a scripting problem with my .HPS file. It involves opening two separate doors with 1. a crowbar, and 2. a key. Extra Info: my map is called Dugeion (I know), my key is called Prison Key my door is called Prison Door(Key). My crowbar is called crowbar_1 my door is called prison_1(crowbar). Here is the text(Crowbar).

////////////////////////////
// Run when the map starts
void OnStart()
{
    AddUseItemCallback("", "crowbar_1", "prison_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("prison_1", false, true);
AddPropImpulse("prison_1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("prison_1", true);
SetSwingDoorClosed("prison_1", false, false);
SetMoveObjectState("prison_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}



////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


and for key

////////////////////////////
// Run when the map starts
void OnStart()
{
    
    AddUseItemCallback("", "Prison Key", "Prison Door", "KeyOnDoor", true);
}

void KeyOnDoor(string &in item, string &in door)
{
    SetSwingDoorLocked(door, false, true);
    PlaySoundAtEntity("", "unlock_door", door, 0, false);
    RemoveItem(Prison Key);

}



////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Hopefully you can help,

-wagiwombledog
03-06-2012 04:15 AM
Find all posts by this user Quote this message in a reply
flamez3 Offline
Posting Freak

Posts: 1,319
Joined: Apr 2011
Reputation: 57
Post: #2
RE: Script Problem .HPS key/crowbar
It would be alot easier if you could actually tell us what the problem is. Rather than us trying to figure out what your problem is.

03-06-2012 06:50 AM
Find all posts by this user Quote this message in a reply
pandasFTW Offline
Member

Posts: 71
Joined: Feb 2012
Reputation: 2
Post: #3
RE: Script Problem .HPS key/crowbar
can you tell us what the problem is??? i have some descent experience with crowbar puzzles Wink i,d really like to help, but i just cant if you dont tell what the problem is...
03-06-2012 11:26 AM
Find all posts by this user Quote this message in a reply
wagiwombledog Offline
Junior Member

Posts: 8
Joined: Mar 2012
Reputation: 0
Post: #4
RE: Script Problem .HPS key/crowbar
Hello, my problem for crowbar is, it interacts (sticks out of the side of the door) but when I pull it sideways (either way)... nothing happens. My problem with the key is, when the key's script is added to the .HPS file the custom story gets an error message and Amnesia shuts down :(. But it starts fine without the script.
03-07-2012 03:52 AM
Find all posts by this user Quote this message in a reply
flamez3 Offline
Posting Freak

Posts: 1,319
Joined: Apr 2011
Reputation: 57
Post: #5
RE: Script Problem .HPS key/crowbar
For the crowbar, I think it would be easier if you either set another door active that is open and deactive the one you are trying to open. Or just use SetPropHealth instead.

For the key:

You forgot the "" around the Prison Key in the RemoveItem function.

03-07-2012 06:37 AM
Find all posts by this user Quote this message in a reply
wagiwombledog Offline
Junior Member

Posts: 8
Joined: Mar 2012
Reputation: 0
Post: #6
RE: Script Problem .HPS key/crowbar
Thanks every one! this has been a great help!
03-07-2012 07:27 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)