Frictional Games Forum (read-only)
[SOLVED]ChangeMap script problem - 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)
+--- Thread: [SOLVED]ChangeMap script problem (/thread-27257.html)

Pages: 1 2


[SOLVED]ChangeMap script problem - Catalyst - 11-15-2014

Hello, i have a problem...when i change map through script:
ChangeMap("LR.map", "start", "", ""); , on the next map player is spawning in the floor and when it jumps cannot get in normal position, I watched if script is correct and checked if SetPlayerCrouching is enabled.

Please help, somebody know how to do this?

Thanks in advanced.


RE: ChangeMap script problem - FlawlessHappiness - 11-15-2014

is the StartArea called "start" in the next map?

Please show your script of LR.map.


RE: ChangeMap script problem - Daemian - 11-15-2014

Yes, and make sure the 'start' area is above the floor level and it's a PlayerStart type.


RE: ChangeMap script problem - Catalyst - 11-15-2014

(11-15-2014, 06:14 PM)Daemian Wrote: Yes, and make sure the 'start' area is above the floor level and it's a PlayerStart type.

yes, its called start and is higher floor, almost in the middle of the room

(11-15-2014, 05:46 PM)FlawlessHappiness Wrote: is the StartArea called "start" in the next map?

Please show your script of LR.map.

player start area is called "start"

void OnStart()
{
AddUseItemCallback("", "key_tower_1", "mansion_5", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_tomb_rusty_1", "mansion_4", "UsedKeyOnDoor3", true);
AddUseItemCallback("", "key_tomb_1", "level_wood_1", "UsedKeyOnDoor2", true);
SetPlayerSanity(60);
SetLightVisible("Insane_Light", false);
SetLightVisible("Insane_Light_1", false);
SetEntityCallbackFunc("lantern_1", "Lantern");
SetEntityCallbackFunc("key_tomb_1", "DamnedPicture");
AddEntityCollideCallback("Player", "Sanity", "Bloody", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "Scare", true, 1);
AddEntityCollideCallback("Player", "ZoneActivation", "Trigger", true, 1);
SetEntityConnectionStateChangeCallback("lever", "SecretRoom");
AddTimer("", 1, "AmountOfSanity");
AddTimer("", 10, "Plague");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("mansion_5", false);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_5", 0, false);
RemoveItem("key_tower_1");
CompleteQuest("cabinetdoor","CabinetDoor");
AddPlayerSanity(20);
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level_wood_1", false);
PlaySoundAtEntity("", "unlock_door.snt", "level_wood_1", 0, false);
RemoveItem("key_tomb_1");
CompleteQuest("kitchendoor","KitchenDoor");
AddPlayerSanity(10);
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_4", 0, false);
RemoveItem("key_tomb_rusty_1");
CompleteQuest("studiumdoor","StudiumDoor");
AddPlayerSanity(10);
}


void Lantern(string &in asEntity, string &in type)
{
SetEntityActive("insanity", true);
PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
StartPlayerLookAt("insanity", 1, 10, "StopPlayerLookAt");
GiveSanityDamage(11.0f, true);
CompleteQuest("firstnope", "Firstnope");
}

void DamnedPicture(string &in asEntity, string &in type)
{
SetEntityActive("insane_paint", true);
PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
StartPlayerLookAt("insane_paint", 1, 10, "StopPlayerLookAt");
GiveSanityDamage(11.0f, true);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "insane_paint", false);
}

void Bloody(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 6, "Horror");
GiveSanityDamage(10.0f, true);
FadeOut(2);
}

void Scare(string &in asParent, string &in asChild, int alState)
{
StopMusic( 2, 1);
AddTimer("", 2, "ChangeMusic");
GiveSanityDamage(3.0f, true);
SetPropHealth("pot_plant_small01_2", 0.0f);
SetPropHealth("pot_plant_small02_1", 0.0f);
StartPlayerLookAt("pot_plant_small02_1", 1, 10, "StopPlayerLookAt");
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}

void Horror(string &in asTimer)
{
FadeIn(2);
SetLightVisible("Insane_Light", true);
SetLightVisible("Insane_Light_1", true);
PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
SetEntityActive("insanepaint1", true);
SetEntityActive("insanepaint2", true);
SetEntityActive("insanepaint3", true);
PlayMusic("04_amb.ogg", true, 0.5, 6, 1, true);
AddTimer("",10, "StopRed");
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}

void StopRed(string &in asTimer)
{
SetLightVisible("Insane_Light", false);
SetLightVisible("Insane_Light_1", false);
AddPlayerSanity(20);
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}

void ChangeMusic(string &in asTimer)
{
PlayMusic("07_amb.ogg", true, 0.5, 6, 1, true);
CreateParticleSystemAtEntity("", "ps_dust_break_25", "ScriptArea_2", false);
PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_2", 1, 10, "StopPlayerLookAt");
AddTimer("", 2, "Cough");
}

void Cough(string &in asTimer)
{
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}

void OnLeave()
{
SetEntityActive("Sanity", true);
SetupLoadScreen("Loading", "message_1", 1, "game_loading_trunk.jpg");
}

void Trigger(string &in asParent, string &in asChild, int alState)
{
FadeOut(0);
PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
AddTimer("", 3, "Teleport");
SetPlayerMoveSpeedMul(0.35f);
SetPlayerRunSpeedMul(0);
SetPlayerLookSpeedMul(0.5);
}

void Teleport(string &in asTimer)
{
FadeIn(3);
TeleportPlayer("area_teleport_1");
AddTimer("", 3, "Teleport2");
}

void Teleport2(string &in asTimer)
{
FadeOut(0);
TeleportPlayer("area_teleport_2");
AddTimer("", 3, "Teleport3");
}

void Teleport3(string &in asTimer)
{
FadeIn(3);
TeleportPlayer("telearea");
AddTimer("", 3, "Teleport4");
}

void Teleport4(string &in asTimer)
{
FadeOut(0);
TeleportPlayer("telearea2");
SetPlayerCrouching(true);
AddTimer("", 3, "TeleEnd");
}

void TeleEnd(string &in asTimer)
{
FadeIn(3);
SetSanityDrainDisabled(true);
TeleportPlayer("teleport_target");
AddTimer("", 7, "Retake");
SetEntityActive("vision", true);
SetPlayerActive(false);
StartPlayerLookAt("vision", 1, 1, "StopPlayerLookAt");
ShowEnemyPlayerPosition("vision");
SetPlayerCrouching(false);
}

void Studium(string &in asEntity)
{
AddQuest("studiumdoor","StudiumDoor");
}

void Cabinet(string &in asEntity)
{
AddQuest("cabinetdoor","CabinetDoor");
}

void Kitchen(string &in asEntity)
{
AddQuest("kitchendoor","KitchenDoor");
}


void Retake(string &in asTimer)
{
SetPlayerActive(true);
TeleportPlayer("back");
SetPlayerSanity(42);
SetPlayerHealth(100);
SetEntityActive("vision", false);
PlaySoundAtEntity("", "player_stand.snt", "Player", 0, false);
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
AddTimer("", 4, "Again");
PlayMusic("09_amb_safe.ogg", true, 0.5, 6, 1, true);
}

void Again(string &in asTimer)
{
PlaySoundAtEntity("", "hurt_pant.snt", "Player", 0, false);
AddQuest("first", "First");
SetPlayerMoveSpeedMul(1.0f);
SetPlayerRunSpeedMul(1.3f);
SetPlayerLookSpeedMul(1.1f);
}

void SecretRoom(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret_shelf", 1);
PlaySoundAtEntity("", ".snt", "shelf_move_1", 0, false);
return;
}
AddPlayerSanity(20);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
}

void AmountOfSanity(string &in asTimer)
{
if(GetPlayerSanity() < 40.0f)
{
PlaySoundAtEntity("Player", "react_breath.snt", "Player", 0, false);
AddTimer("", 10, "AmountOfSanity");
}
}

void Plague(string &in asTimer)
{
PlaySoundAtEntity("", "player_cough.snt", "Player", 0, false);
}


RE: ChangeMap script problem - Catalyst - 11-15-2014

i have a screenshot for this issue
http://postimg.org/image/x04vozumr/


RE: ChangeMap script problem - FlawlessHappiness - 11-15-2014

Show a screenshot of the map in the level editor, could you?


RE: ChangeMap script problem - Daemian - 11-16-2014

Maybe you enabled "fast physics load". It ignores planes.


RE: ChangeMap script problem - Catalyst - 11-16-2014

(11-16-2014, 04:01 AM)Daemian Wrote: Maybe you enabled "fast physics load". It ignores planes.

I don't know, I never heard about this option,I just changed map through timer script, so how I can disable it?

there is map in editor :

http://postimg.org/image/osainlo2l/

looks stupid from the fourth map to change through script to first startup map, and her startup position, to test only the script, so this script for me doesn't work Sad


RE: ChangeMap script problem - Catalyst - 11-16-2014

Don't worry Smile I found the problem and solution Smile


RE: ChangeMap script problem - DnALANGE - 11-16-2014

you didnt seem to have a plane in your leveleditor....
Was that the problem?