Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help How to unluck a door from another map?
z3akx Offline
Junior Member

Posts: 15
Threads: 4
Joined: Dec 2011
Reputation: 0
#11
RE: How to unluck a door from another map?

So i'll put it like this? Big Grin

In the Global.hps

////////////////////////////// Run at the start gamevoid 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);}


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

////////////////////////////// Run at the start gamevoid 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);}


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
(This post was last modified: 04-30-2012, 06:22 PM by z3akx.)
04-30-2012, 06:21 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#12
RE: How to unluck a door from another map?

Could you please make it more readable? xD

you can do that by editing the post ^^

(This post was last modified: 04-30-2012, 06:47 PM by SilentStriker.)
04-30-2012, 06:35 PM
Find
z3akx Offline
Junior Member

Posts: 15
Threads: 4
Joined: Dec 2011
Reputation: 0
#13
RE: How to unluck a door from another map?

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
04-30-2012, 06:51 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#14
RE: How to unluck a door from another map?

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

}

SetLevelDoorLocked("Level_AbandonedHouse", false);

{ else return;

it should be inside OnEnter Smile

04-30-2012, 06:52 PM
Find
z3akx Offline
Junior Member

Posts: 15
Threads: 4
Joined: Dec 2011
Reputation: 0
#15
RE: How to unluck a door from another map?

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 :-)
04-30-2012, 07:40 PM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#16
RE: How to unluck a door from another map?

(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 "}".


Dark Seclusion Here
(This post was last modified: 04-30-2012, 08:07 PM by FragdaddyXXL.)
04-30-2012, 08:06 PM
Find
z3akx Offline
Junior Member

Posts: 15
Threads: 4
Joined: Dec 2011
Reputation: 0
#17
RE: How to unluck a door from another map?

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!
04-30-2012, 08:11 PM
Find




Users browsing this thread: 1 Guest(s)