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
AMFP's Ladder Hatch
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#1
AMFP's Ladder Hatch

Why hello there again.

Another time, another question.

I want to get the ladder hatch (\entities\door\attic_floor_ladderhatch) working properly ingame. I made my research and found the used code for that section of the main game.

Here's the code that i think is responsible for the whole action of opening the hatch:

PHP Code: (Select All)
void onStart() {
SetEntityPlayerInteractCallback("attic_floor_ladderhatch_1""DeactivateAtticHatchBlocker"true);
AddEntityCollideCallback("attic_floor_ladderhatch_2""PhysicsSimulationTrigger""AtticHatchPhysicsSimulation"true1);
}

void DeactivateAtticHatchBlocker (string &in asEntity)
{
    
SetEntityActive("AtticHatchBlock"false);
    
PlaySoundAtEntity ("""attic_hatch_latch""attic_floor_ladderhatch_1"0false);
    
RemoveEntityCollideCallback("Player""Attic_Hatch_ChildRun_Trigger");
    
RemoveEntityCollideCallback("Player""ServantBedroom_Trigger");
    
StopSound("Child_Run_2D"1.0f);
    
StopSound("Child_Run_3D"1.0f);

void AtticHatchPhysicsSimulation (string &in asParentstring &in asChildint alState)
{
    
AddDebugMessage("Attic Hatch Physics Set To STATIC"false);
    
SetEntityInteractionDisabled("attic_floor_ladderhatch_1"true);
    
SetPropStaticPhysics("attic_floor_ladderhatch_2"true); 

The "AtticHatchBlock" is an invisible object that blocks the whole hatch from opening. Once interacted with the opening rope, the entity disappears and lets the hatch open. (For the people that did NOT play Amnesia: A Machine for pigs, there first opens some sort of smaller hatch to a 135 degree and then an external ladder slides down from within the 135 degree thingy.)
The second collide function is when the 2nd part of the hatch that slides down hits the floor, it sets the entity to a static mode so that it can not be interacted with (as i've understood it).

This whole thing is just set up that, when not opened, it lies inside of eachother (with the same xyz coordinates). I've build it up excectly like that but with one exception that is the trigger. I've replaced the interaction callback with a collide callback so that it opens when colliding with an area. But now to the main part, my thing just does not want to open with the 2nd ladder lying inside of it. I know this is probably because of some collision errors because it seems to work just fine without the second thing.

But i'd really like to the this one working as intended instead of doing a cheap ripoff, hope you guys can understand/help me and i hope that this textwall does not bother you too much c:

Best regards, RaideX

If you don't draw first, you don't get to draw at all... -The False Shepherd
(This post was last modified: 11-25-2013, 05:21 PM by RaideX.)
11-25-2013, 05:19 PM
Find




Users browsing this thread: 1 Guest(s)