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:
void onStart() {
SetEntityPlayerInteractCallback("attic_floor_ladderhatch_1", "DeactivateAtticHatchBlocker", true);
AddEntityCollideCallback("attic_floor_ladderhatch_2", "PhysicsSimulationTrigger", "AtticHatchPhysicsSimulation", true, 1);
}
void DeactivateAtticHatchBlocker (string &in asEntity)
{
SetEntityActive("AtticHatchBlock", false);
PlaySoundAtEntity ("", "attic_hatch_latch", "attic_floor_ladderhatch_1", 0, false);
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 asParent, string &in asChild, int 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