Frictional Games Forum (read-only)
how make music stop and make player freeze - 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: how make music stop and make player freeze (/thread-17344.html)



how make music stop and make player freeze - Hartmann - 07-30-2012

well title says pretty much it self. when i spawn i add a song. it keeps playing and when i leave the maps to a newone IT keeps PLAYING. i cant fix this because im dumb. and secondly i want daniel to freeze at the lightsout_1 script. Here is the whole 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_1");
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);
}

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

}

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();
}


void StartMusic(float afFadeTime, int alPrio)
{
StopMusic(1,0);
}


RE: how make music stop and make player freeze - ksnider - 07-30-2012

First of all, change:

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

}

To:

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

"PlayMusic" only has five parameters.

To stop the music when you leave the map, move "StopMusic" into "void OnLeave()". It should look like this.

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



RE: how make music stop and make player freeze - Hartmann - 07-30-2012

(07-30-2012, 02:23 AM)ksnider Wrote: First of all, change:

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

}

To:

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

"PlayMusic" only has five parameters.

To stop the music when you leave the map, move "StopMusic" into "void OnLeave()". It should look like this.

Code:
////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(1,0);
}
thanks you very much sir. now how to i make a player freeze? i would it to be in here. it should be 6 seconds
void LightsOut_2(string &in asTimer)
{
StartPlayerLookAt("wall_door_frame_6", 10, 10, "");
AddTimer("StopLook_1", 6, " KillTheLights_1");
SetPlayerActive(false);
}


RE: how make music stop and make player freeze - ksnider - 07-31-2012

(07-30-2012, 10:30 AM)Hartmann Wrote: thanks you very much sir. now how to i make a player freeze? i would it to be in here. it should be 6 seconds
void LightsOut_2(string &in asTimer)
{
StartPlayerLookAt("wall_door_frame_6", 10, 10, "");
AddTimer("StopLook_1", 6, " KillTheLights_1");
SetPlayerActive(false);
}
Are you having trouble with starting the 'freeze', or making the player 'unfreeze'?