Frictional Games Forum (read-only)
[SCRIPT] How to unluck a door from another map? - 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: [SCRIPT] How to unluck a door from another map? (/thread-15192.html)

Pages: 1 2


RE: How to unluck a door from another map? - z3akx - 04-30-2012

So i'll put it like this? Big Grin

In the Global.hps

Code:
////////////////////////////// Run at the start gamevoid OnGameStart(){SetGlobalVarInt("AbandonedHouseDoorUnluck", 0);}


In the Forest.hps

Code:
void OnStart(){    PlayMusic("ambience_wind_eerie.ogg", true, 0.4f, 0, 0, false);AddEntityCollideCallback("Player", "ScriptArea_1", "scream", true, 1); SetEntityPlayerLookAtCallback("corpse_male_leg_1", "LookAtScare_1", true);AddEntityCollideCallback("Player", "ScriptArea_2", "Bugs", true, 1);AddEntityCollideCallback("Player", "BreakFence", "OldFence", true, 1);AddEntityCollideCallback("Player", "AreaCaveMonster", "CollideActivateBreath", true, 1); SetEntityPlayerInteractCallback("Cave", "Level_Cave", false);SetEntityPlayerLookAtCallback("Cave", "CaveText", false); SetEntityPlayerInteractCallback("WindowAbandonedHouse", "Level_AbandonedHouse", false); SetEntityPlayerLookAtCallback("WindowAbandonedHouse", "WindowText", false); if(GetGlobalVarInt("UnluckAbandonedHouseDoor") == 1)}
SetLevelDoorLocked("Level_AbandonedHouse", false);
{    else return;}


And in AbandonedHouse.hps

Code:
void BreakBlockade(string &in asParent, string &in asChild, int alState) {SetEntityActive("Blockade", false);    SetEntityActive("BlockadeBroken", true); CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);SetEntityActive("Crowbar_2", false);    SetEntityActive("CrowbarBroken", true); PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false); SetLevelDoorLocked("Level_Forest", false);    GiveSanityBoostSmall(); AddGlobalVarInt("AbandonedHouseDoorUnluck", 1);}


If not then i dont get it :/
(04-30-2012, 06:21 PM)z3akx Wrote: So i'll put it like this? Big Grin

In the Global.hps

Code:
////////////////////////////// Run at the start gamevoid OnGameStart(){SetGlobalVarInt("AbandonedHouseDoorUnluck", 0);}


In the Forest.hps

Code:
void OnStart(){    PlayMusic("ambience_wind_eerie.ogg", true, 0.4f, 0, 0, false);AddEntityCollideCallback("Player", "ScriptArea_1", "scream", true, 1); SetEntityPlayerLookAtCallback("corpse_male_leg_1", "LookAtScare_1", true);AddEntityCollideCallback("Player", "ScriptArea_2", "Bugs", true, 1);AddEntityCollideCallback("Player", "BreakFence", "OldFence", true, 1);AddEntityCollideCallback("Player", "AreaCaveMonster", "CollideActivateBreath", true, 1); SetEntityPlayerInteractCallback("Cave", "Level_Cave", false);SetEntityPlayerLookAtCallback("Cave", "CaveText", false); SetEntityPlayerInteractCallback("WindowAbandonedHouse", "Level_AbandonedHouse", false); SetEntityPlayerLookAtCallback("WindowAbandonedHouse", "WindowText", false); if(GetGlobalVarInt("UnluckAbandonedHouseDoor") == 1)}
SetLevelDoorLocked("Level_AbandonedHouse", false);
{    else return;}


And in AbandonedHouse.hps

Code:
void BreakBlockade(string &in asParent, string &in asChild, int alState) {SetEntityActive("Blockade", false);    SetEntityActive("BlockadeBroken", true); CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);SetEntityActive("Crowbar_2", false);    SetEntityActive("CrowbarBroken", true); PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false); SetLevelDoorLocked("Level_Forest", false);    GiveSanityBoostSmall(); AddGlobalVarInt("AbandonedHouseDoorUnluck", 1);}


If not then i dont get it :/
Wow thats hard as hell to read dont know why it's set it up like that sorry Smile


RE: How to unluck a door from another map? - SilentStriker - 04-30-2012

Could you please make it more readable? xD

you can do that by editing the post ^^


RE: How to unluck a door from another map? - z3akx - 04-30-2012

Im so sorry man that failed xD

In the Global.hps

////////////////////////////// Run at the start game
void OnGameStart()
{
SetGlobalVarInt("AbandonedHouseDoorUnluck", 0);
}


In the Forest.hps

void OnStart(){ PlayMusic("ambience_wind_eerie.ogg", true, 0.4f, 0, 0, false);
AddEntityCollideCallback("Player", "ScriptArea_1", "scream", true, 1); SetEntityPlayerLookAtCallback("corpse_male_leg_1", "LookAtScare_1", true);
AddEntityCollideCallback("Player", "ScriptArea_2", "Bugs", true, 1);
AddEntityCollideCallback("Player", "BreakFence", "OldFence", true, 1);
AddEntityCollideCallback("Player", "AreaCaveMonster", "CollideActivateBreath", true, 1); SetEntityPlayerInteractCallback("Cave", "Level_Cave", false);
SetEntityPlayerLookAtCallback("Cave", "CaveText", false); SetEntityPlayerInteractCallback("WindowAbandonedHouse", "Level_AbandonedHouse", false); SetEntityPlayerLookAtCallback("WindowAbandonedHouse", "WindowText", false); if(GetGlobalVarInt("UnluckAbandonedHouseDoor") == 1)
}
SetLevelDoorLocked("Level_AbandonedHouse", false);
{ else return;
}


And in AbandonedHouse.hps

void BreakBlockade(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Blockade", false);
SetEntityActive("BlockadeBroken", true);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("Crowbar_2", false);
SetEntityActive("CrowbarBroken", true);
PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false); SetLevelDoorLocked("Level_Forest", false);
GiveSanityBoostSmall();
AddGlobalVarInt("AbandonedHouseDoorUnluck", 1);
}


That should be better Big Grin

Though i have no idea why the text keeps changing place from how i write it to how it's shown soz Smile


RE: How to unluck a door from another map? - SilentStriker - 04-30-2012

Yes everything is correct except:
if(GetGlobalVarInt("UnluckAbandonedHouseDoor") == 1)

}

SetLevelDoorLocked("Level_AbandonedHouse", false);

{ else return;

it should be inside OnEnter Smile



RE: How to unluck a door from another map? - z3akx - 04-30-2012

Okay now im getting this error

FATAL ERROR: Could not load script file 'custom_stories/blabla/bla/blabla/Maps/Forest.hps'! ExecuteString(1, 1) : ERR : No matching signatures to 'OnLeave()'
main (21,20) : ERR : Expected identifier
main (22,2) : ERR : Unexpected token '}'
main (24,2) : ERR : Unexpected token '}'

the "main" part is this


void OnStart()
{
if(GetGlobalVarInt("UnluckAbandonedHouseDoor") == 1)
}
SetLevelDoorLocked("Level_AbandonedHouse", false);
}
else return;
}
}


I dont get it -.-
it's probably because i dont understand how the scripting are connected to one another :-)


RE: How to unluck a door from another map? - FragdaddyXXL - 04-30-2012

(04-30-2012, 07:40 PM)z3akx Wrote: Okay now im getting this error

FATAL ERROR: Could not load script file 'custom_stories/blabla/bla/blabla/Maps/Forest.hps'! ExecuteString(1, 1) : ERR : No matching signatures to 'OnLeave()'
main (21,20) : ERR : Expected identifier
main (22,2) : ERR : Unexpected token '}'
main (24,2) : ERR : Unexpected token '}'

the "main" part is this


void OnStart()
{
if(GetGlobalVarInt("UnluckAbandonedHouseDoor") == 1)
}
SetLevelDoorLocked("Level_AbandonedHouse", false);
}
else return;
}
}


I dont get it -.-
it's probably because i dont understand how the scripting are connected to one another :-)
Check your curly brackets. You have 1 opening curly bracket "{" and 4 closing curly brackets "}".




RE: How to unluck a door from another map? - z3akx - 04-30-2012

Oh lawl Big Grin yeah it's working now and i got my cousin to tell me how it all worked together so i understand it now Big Grin thanks for the help dude Big Grin!