Frictional Games Forum (read-only)
Freeze player? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Freeze player? (/thread-17359.html)

Pages: 1 2 3


RE: Freeze player? - Lizard - 07-30-2012

okay, try post your script


RE: Freeze player? - Hartmann - 07-30-2012

(07-30-2012, 02:12 PM)andyrockin123 Wrote: Alternatively, if you'd like the player to not move but still have control of the camera, you can use this:


SetPlayerMoveSpeedMul(0.0f);
SetPlayerRunSpeedMul(0.0f);void LightsOut_2(string &in asTimer)

AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1);
AddEntityCollideCallback("Player", "KillTheLights_2", "LightsOut_2", true, 1);

StartPlayerLookAt("wall_door_frame_6", 10, 10, "");

AddTimer("StopLook_1", 6, "KillTheLights_2");
SetPlayerActive(false);
}

void LightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_1", false, true);
AddTimer("", 0.5, "Out2");
}

void Out2(string &in asTimer)
{
SetLampLit("candle_floor_2", false, true);
AddTimer("", 0.5, "Out3");
}

void Out3(string &in asTimer)
{
SetLampLit("candle_floor_3", false, true);
AddTimer("", 0.5, "Out4");
}

void Out4(string &in asTimer)
{
SetLampLit("candle_floor_4", false, true);
AddTimer("", 0.5, "Out5");
}

void Out5(string &in asTimer)
{
SetLampLit("candle_floor_5", false, true);
AddTimer("", 0.5, "Out6");
}

void Out6(string &in asTimer)
{
SetLampLit("candle_floor_6", false, true);
AddTimer("", 0.5, "Out7");
}

void Out7(string &in asTimer)
{
SetLampLit("candle_floor_7", false, true);
AddTimer("", 0.5, "Out8");
}

void Out8(string &in asTimer)
{
SetLampLit("candle_floor_8", false, true);
AddTimer("", 0.5, "Out9");
}

void Out9(string &in asTimer)
{
SetLampLit("candle_floor_9", false, true);
AddTimer("", 0.5, "Out10");
}

void Out10(string &in asTimer)
{
SetLampLit("candle_floor_10", false, true);
AddTimer("", 0.5, "Out11");
}

void Out11(string &in asTimer)
{
SetLampLit("candle_floor_11", false, true);
AddTimer("", 0.5, "Out12");
}

void Out12(string &in asTimer)
{
SetLampLit("candle_floor_12", false, true);
SetPlayerActive(true);
}

(07-30-2012, 02:23 PM)ZereboO Wrote: okay, try post your script
void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor_2", true);
AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor_5", true);
SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true);
SetEntityCallbackFunc("key_3", "OnPickup");
AddTimer("StopLook", 2, "LookAtDoor");
AddEntityCollideCallback("Player","Music", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1);
AddEntityCollideCallback("Player", "KillTheLights_2", "LightsOut_2", true, 1);
AddTimer("StopLook_1", 6, "KillTheLights_2");
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, true);
RemoveItem("key_1");
}

void KeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0.0f, true);
RemoveItem("key_2");
}

void KeyOnDoor_5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_5", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
RemoveItem("key_3");
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("03_paper_daniel02.ogg", true, 0.8, 2, 0, true);

}

void OnPickup(string &in asEntity, string &in type)
{
SetSwingDoorClosed("mansion_3", true, true);
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 1, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion_3", 10, 10, "");
}
void LightsOut_2(string &in asTimer)
{
StartPlayerLookAt("wall_door_frame_6", 10, 10, "");
AddTimer("StopLook_1", 6, "KillTheLights_2");
SetPlayerActive(false);
}

void LightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_1", false, true);
AddTimer("", 0.5, "Out2");
}

void Out2(string &in asTimer)
{
SetLampLit("candle_floor_2", false, true);
AddTimer("", 0.5, "Out3");
}

void Out3(string &in asTimer)
{
SetLampLit("candle_floor_3", false, true);
AddTimer("", 0.5, "Out4");
}

void Out4(string &in asTimer)
{
SetLampLit("candle_floor_4", false, true);
AddTimer("", 0.5, "Out5");
}

void Out5(string &in asTimer)
{
SetLampLit("candle_floor_5", false, true);
AddTimer("", 0.5, "Out6");
}

void Out6(string &in asTimer)
{
SetLampLit("candle_floor_6", false, true);
AddTimer("", 0.5, "Out7");
}

void Out7(string &in asTimer)
{
SetLampLit("candle_floor_7", false, true);
AddTimer("", 0.5, "Out8");
}

void Out8(string &in asTimer)
{
SetLampLit("candle_floor_8", false, true);
AddTimer("", 0.5, "Out9");
}

void Out9(string &in asTimer)
{
SetLampLit("candle_floor_9", false, true);
AddTimer("", 0.5, "Out10");
}

void Out10(string &in asTimer)
{
SetLampLit("candle_floor_10", false, true);
AddTimer("", 0.5, "Out11");
}

void Out11(string &in asTimer)
{
SetLampLit("candle_floor_11", false, true);
AddTimer("", 0.5, "Out12");
}

void Out12(string &in asTimer)
{
SetLampLit("candle_floor_12", false, true);
SetPlayerActive(true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(1,0);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 3, "Idle");

}
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void Lightsout_2(string &in asTimer)
{
StopPlayerLookAt();
}


RE: Freeze player? - Lizard - 07-30-2012

which one is happening first. LightsOut or LightsOut2? And in which of them do you want the player to freeze in?


RE: Freeze player? - Hartmann - 07-30-2012

(07-30-2012, 02:39 PM)ZereboO Wrote: which one is happening first. LightsOut or LightsOut2? And in which of them do you want the player to freeze
(07-30-2012, 02:39 PM)ZereboO Wrote: same time i just couldent get it to work with only 1 collide callback



RE: Freeze player? - Lizard - 07-30-2012

Try this



void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor_2", true);
AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor_5", true);
SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true);
SetEntityCallbackFunc("key_3", "OnPickup");
AddTimer("StopLook", 2, "LookAtDoor");
AddEntityCollideCallback("Player","Music", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "KillTheLights_2", "LightsOut_2", true, 1);
AddTimer("StopLook_1", 6, "KillTheLights_2");
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, true);
RemoveItem("key_1");
}

void KeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0.0f, true);
RemoveItem("key_2");
}

void KeyOnDoor_5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_5", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
RemoveItem("key_3");
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("03_paper_daniel02.ogg", true, 0.8, 2, 0, true);

}

void OnPickup(string &in asEntity, string &in type)
{
SetSwingDoorClosed("mansion_3", true, true);
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 1, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion_3", 10, 10, "");
}


void LightsOut_2(string &in asTimer)
{
StartPlayerLookAt("wall_door_frame_6", 10, 10, "");
AddTimer("StopLook_1", 6, "KillTheLights2");
SetPlayerActive(false);
}


void KillTheLights2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_1", false, true);
AddTimer("", 0.5, "Out2");
}

void Out2(string &in asTimer)
{
SetLampLit("candle_floor_2", false, true);
AddTimer("", 0.5, "Out3");
}

void Out3(string &in asTimer)
{
SetLampLit("candle_floor_3", false, true);
AddTimer("", 0.5, "Out4");
}

void Out4(string &in asTimer)
{
SetLampLit("candle_floor_4", false, true);
AddTimer("", 0.5, "Out5");
}

void Out5(string &in asTimer)
{
SetLampLit("candle_floor_5", false, true);
AddTimer("", 0.5, "Out6");
}

void Out6(string &in asTimer)
{
SetLampLit("candle_floor_6", false, true);
AddTimer("", 0.5, "Out7");
}

void Out7(string &in asTimer)
{
SetLampLit("candle_floor_7", false, true);
AddTimer("", 0.5, "Out8");
}

void Out8(string &in asTimer)
{
SetLampLit("candle_floor_8", false, true);
AddTimer("", 0.5, "Out9");
}

void Out9(string &in asTimer)
{
SetLampLit("candle_floor_9", false, true);
AddTimer("", 0.5, "Out10");
}

void Out10(string &in asTimer)
{
SetLampLit("candle_floor_10", false, true);
AddTimer("", 0.5, "Out11");
}

void Out11(string &in asTimer)
{
SetLampLit("candle_floor_11", false, true);
AddTimer("", 0.5, "Out12");
}

void Out12(string &in asTimer)
{
SetLampLit("candle_floor_12", false, true);
SetPlayerActive(true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(1,0);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 3, "Idle");

}
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void Lightsout_2(string &in asTimer)
{
StopPlayerLookAt();
}


RE: Freeze player? - Hartmann - 07-30-2012

(07-30-2012, 02:51 PM)ZereboO Wrote: Try this



void OnStart()
{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_2", "KeyOnDoor_2", true);
AddUseItemCallback("", "key_3", "mansion_5", "KeyOnDoor_5", true);
SetEntityPlayerInteractCallback("key_3", "ActivateMonster", true);
SetEntityCallbackFunc("key_3", "OnPickup");
AddTimer("StopLook", 2, "LookAtDoor");
AddEntityCollideCallback("Player","Music", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "KillTheLights_2", "LightsOut_2", true, 1);
AddTimer("StopLook_1", 6, "KillTheLights_2");
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, true);
RemoveItem("key_1");
}

void KeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0.0f, true);
RemoveItem("key_2");
}

void KeyOnDoor_5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_5", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_5", 0.0f, true);
RemoveItem("key_3");
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("03_paper_daniel02.ogg", true, 0.8, 2, 0, true);

}

void OnPickup(string &in asEntity, string &in type)
{
SetSwingDoorClosed("mansion_3", true, true);
AddPropImpulse("mansion_3", 0, 0, 10, "World");
AddTimer("StopLook", 1, "LookAtDoor");
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0.0f, true);
StartPlayerLookAt("mansion_3", 10, 10, "");
}


void LightsOut_2(string &in asTimer)
{
StartPlayerLookAt("wall_door_frame_6", 10, 10, "");
AddTimer("StopLook_1", 6, "KillTheLights2");
SetPlayerActive(false);
}


void KillTheLights2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle_floor_1", false, true);
AddTimer("", 0.5, "Out2");
}

void Out2(string &in asTimer)
{
SetLampLit("candle_floor_2", false, true);
AddTimer("", 0.5, "Out3");
}

void Out3(string &in asTimer)
{
SetLampLit("candle_floor_3", false, true);
AddTimer("", 0.5, "Out4");
}

void Out4(string &in asTimer)
{
SetLampLit("candle_floor_4", false, true);
AddTimer("", 0.5, "Out5");
}

void Out5(string &in asTimer)
{
SetLampLit("candle_floor_5", false, true);
AddTimer("", 0.5, "Out6");
}

void Out6(string &in asTimer)
{
SetLampLit("candle_floor_6", false, true);
AddTimer("", 0.5, "Out7");
}

void Out7(string &in asTimer)
{
SetLampLit("candle_floor_7", false, true);
AddTimer("", 0.5, "Out8");
}

void Out8(string &in asTimer)
{
SetLampLit("candle_floor_8", false, true);
AddTimer("", 0.5, "Out9");
}

void Out9(string &in asTimer)
{
SetLampLit("candle_floor_9", false, true);
AddTimer("", 0.5, "Out10");
}

void Out10(string &in asTimer)
{
SetLampLit("candle_floor_10", false, true);
AddTimer("", 0.5, "Out11");
}

void Out11(string &in asTimer)
{
SetLampLit("candle_floor_11", false, true);
AddTimer("", 0.5, "Out12");
}

void Out12(string &in asTimer)
{
SetLampLit("candle_floor_12", false, true);
SetPlayerActive(true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(1,0);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 3, "Idle");

}
void LookAtDoor(string &in asTimer)
{
StopPlayerLookAt();
}

void Lightsout_2(string &in asTimer)
{
StopPlayerLookAt();
}
doesnt work Sad


RE: Freeze player? - Lizard - 07-30-2012

wont the player freeze or wont he get active?

Is all the area names in the Level Editor and ind .hps file names checked, for miss spelling?

I tryed this script myself and it is working, and you will only need one script area called KillTheLights.

You just need to ad your door frame in the KillTheLights function



void OnStart
{
AddEntityCollideCallback("Player", "KillTheLights", "KillTheLights", true, 1);

}


void KillTheLights(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
AddTimer("lights_out", 6, "lightkiller");
}

void lightkiller(string &in asTimer)
{
SetLampLit("candle_floor_1", false, true);
AddTimer("", 0.5, "Out2");
}

void Out2(string &in asTimer)
{
SetLampLit("candle_floor_2", false, true);
AddTimer("", 0.5, "Out3");
}

void Out3(string &in asTimer)
{
SetLampLit("candle_floor_3", false, true);
AddTimer("", 0.5, "Out4");
}

void Out4(string &in asTimer)
{
SetLampLit("candle_floor_4", false, true);
AddTimer("", 0.5, "Out5");
}

void Out5(string &in asTimer)
{
SetLampLit("candle_floor_5", false, true);
AddTimer("", 0.5, "Out6");
}

void Out6(string &in asTimer)
{
SetLampLit("candle_floor_6", false, true);
AddTimer("", 0.5, "Out7");
}

void Out7(string &in asTimer)
{
SetLampLit("candle_floor_7", false, true);
AddTimer("", 0.5, "Out8");
}

void Out8(string &in asTimer)
{
SetLampLit("candle_floor_8", false, true);
AddTimer("", 0.5, "Out9");
}

void Out9(string &in asTimer)
{
SetLampLit("candle_floor_9", false, true);
AddTimer("", 0.5, "Out10");
}

void Out10(string &in asTimer)
{
SetLampLit("candle_floor_10", false, true);
AddTimer("", 0.5, "Out11");
}

void Out11(string &in asTimer)
{
SetLampLit("candle_floor_11", false, true);
AddTimer("", 0.5, "Out12");
}

void Out12(string &in asTimer)
{
SetLampLit("candle_floor_12", false, true);
AddTimer("", 0.5, "ActivatePlayer");
}

void ActivatePlayer(string &in asTimer)
{
SetPlayerActive(true);
}


RE: Freeze player? - Hartmann - 07-30-2012

(07-30-2012, 03:18 PM)ZereboO Wrote: wont the player freeze or wont he get active?

Is all the area names in the Level Editor and ind .hps file names checked, for miss spelling?
yes and nothing happends. then i changed
void KillTheLights2(string &in asParent, string &in asChild, int alState)
to void LightsOut_2(string &in asTimer) and now the lights go out. but player doesnt freeze at all


RE: Freeze player? - Lizard - 07-30-2012

check my repley just above yours


RE: Freeze player? - Hartmann - 07-30-2012

(07-30-2012, 03:39 PM)ZereboO Wrote: check my repley just above yours
acutally im kinda confused.can you write the whole correct script and i promise to rep you. im very very confused