05-18-2012, 01:38 PM
Hey Forum people!
Earlier today, I was trying out my elevator. It's only supposed to start going upwards before the screen fades out, so as far as controlling the elevator it should be easy.
I have used the default elevator room from Amnesia, and put a piston underneath it. The piston should be triggered when I push down my elevator lever (which works!).
Here is a sample of my code:
void OnStart()
{
SetEntityInteractionDisabled("Entity_Elevator", true);
SetPropStaticPhysics("Entity_Elevator", false);
SetEntityConnectionStateChangeCallback("elevator_lever_1", "func_drop");
}
void func_drop(string &in asEntity, int alState)
{
SetEntityInteractionDisabled("elevator_lever_1", true);
SetPropStaticPhysics("elevator_lever_1", true);
AddDebugMessage("func_drop is running for relz.", true);
GiveSanityBoost();
AddTimer("", 2.0f, "Play_Sound");
PlaySoundAtEntity("", "quest_completed.snt", "elevator_lever_1", 0, false);
}
void Play_Sound(string &in asTimer)
{
PlaySoundAtEntity("", "crank_old_move.snt", "elevator_lever_1", 0, false);
SetMoveObjectStateExt("control_room_piston_piston_1", 0.6, 0.6, 8, 0, false);
}
Anyone have any suggestions? I already tried to understand Elvens elevator tutorial, but my piston is going right through my elevator room!
All the best,
//Twitchez
Earlier today, I was trying out my elevator. It's only supposed to start going upwards before the screen fades out, so as far as controlling the elevator it should be easy.
I have used the default elevator room from Amnesia, and put a piston underneath it. The piston should be triggered when I push down my elevator lever (which works!).
Here is a sample of my code:
void OnStart()
{
SetEntityInteractionDisabled("Entity_Elevator", true);
SetPropStaticPhysics("Entity_Elevator", false);
SetEntityConnectionStateChangeCallback("elevator_lever_1", "func_drop");
}
void func_drop(string &in asEntity, int alState)
{
SetEntityInteractionDisabled("elevator_lever_1", true);
SetPropStaticPhysics("elevator_lever_1", true);
AddDebugMessage("func_drop is running for relz.", true);
GiveSanityBoost();
AddTimer("", 2.0f, "Play_Sound");
PlaySoundAtEntity("", "quest_completed.snt", "elevator_lever_1", 0, false);
}
void Play_Sound(string &in asTimer)
{
PlaySoundAtEntity("", "crank_old_move.snt", "elevator_lever_1", 0, false);
SetMoveObjectStateExt("control_room_piston_piston_1", 0.6, 0.6, 8, 0, false);
}
Anyone have any suggestions? I already tried to understand Elvens elevator tutorial, but my piston is going right through my elevator room!
All the best,
//Twitchez