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
Help with scripting and notes.
NadTheBat Offline
Junior Member

Posts: 38
Threads: 4
Joined: Aug 2011
Reputation: 0
#1
Help with scripting and notes.

I'm having trouble with scripting in my custom story, as well as the notes not working. Basically, with the scipt, the first section where the grunt appears, but when I add in the part where the door is banged on, the level won't load. Here's the .hps file:
Quote:////////////////////////////
// Run when entering map
void OnEnter()
{

}
void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_1" , true);
}

{
AddEntityCollideCallback("Player", "ScriptArea_2", "Func01", true, 1);
}
void Func01(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("ScaryDoor", 0, 0, 5, "World");
PlaySoundAtEntity("", "21_bang_door.snt", "ScaryDoor", 0, false);
StartPlayerLookAt("ScaryDoor", 2, 2, "");
AddTimer("", 2, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
StopPlayerLookAt();
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

With the notes, they open and close instantly when picked up, and when I check in the notes section, I see the paper and click on it and the notes open up, but there's no text at all. Here's the extra_english.lang file:
Quote:<LANGUAGE>
<CATEGORY Name="Journal">
<Entry Name="Note_Suicide_Name">Suicide Note</Entry>
<Entry Name="Note_Suicide_Text">[voice Suicide.ogg][br]I've been stuck here for God knows how long, all I want to do is get out of here and see daylight, breathe fresh air, hug my children one more time. Every exit is locked, there are... strange... creatures lurking around every corner. I can't go on any longer, and I've decided to commit suicide. If you are reading this, listen to what I have to say; you must find a way out no matter the cost, do what I could not, find a way to escape this Hell.</Entry>
<Entry Name="Note_Lantern_Name">Hidden Lantern</Entry>
<Entry Name="Note_Lantern_Text">[voice Lantern.ogg][br]I have stashed my lantern in the wine cellar for safe keeping.</Entry>
<Entry Name="Note_KeyLocA_Name">Hidden Key</Entry>
<Entry Name="Note_KeyLocA_Text">[voice KeyLocationA.ogg][br]I have hidden my key to the Main Floor here in the Wine Cellar.
<Entry Name="Note_PrisonerA_Name">Prisoner Number: 110907</Entry>
<Entry Name="Note_PrisonerA_Text">[voice PrisonerA.ogg][br]Age: Thirty three; Height: Five foot seven; Hair: Blonde; Sentenced to death for the rape and murder of three-year-old James Nelson.</Entry>
<Entry Name="Note_PrisonerB_Name">Prisoner Number: 84302</Entry>
<Entry Name="Note_PrisonerB_Text">[voice PrisonerB.ogg][br]Age: Nineteen; Height: Six foot Nine; Hair: Brown; Sentenced to Solitary Confinement for 113 years for the murder of his parents and two sisters.</Entry>
<Entry Name="Note_PrisonerC_Name">Prisoner Number: 578103</Entry
<Entry Name="Note_PrisonerC_Text">[voice PrisonerC.ogg][br]Age: Sixty-three; Height: Five foot two; Hair: Brown; Sentenced to death for burning down an orphanage containing fifty-four children and six caretakers.</Entry>
<Entry Name="Note_PrisonerD_Name">Prisoner Number: 928734</Entry>
<Entry Name="Note_PrisonerD_Text">[voice PrisonerD.ogg][br]Age: Twenty-seven; Height: Five foot five; Hair: Red; Our only female prisoner, sentenced to 97 years in prison for the murder of her husband Tom Eliott. Tom was found strangled, his penis was cut off and shoved down his throat, and his chest was stabbed seventy-two times.</Entry>
<Entry Name="Note_DidntDoIt_Name">I didn't do it!</Entry>
<Entry Name="Note_DidntDoIt_Text">[voice DidntDoIt.ogg][br]I swear, I didn't do it! I couldn't kill my husband! How could they think that? I loved him too much to ever hurt him!</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_MainFloorKeyA">Main Floor Key 1</Entry>
<Entry Name="ItemDesc_MainFloorKeyA">Key that unlocks one of the two doors leading to the Main Floor</Entry>
<Entry Name="ItemName_MainFloorKeyB">Main Floor Key 2</Entry>
<Entry Name="ItemDesc_MainFloorKeyB">Key that unlocks one of the two doors leading to the Main Floor</Entry>
</CATEGORY>
</LANGUAGE>

Any help would be greatly appreciated, as I've put countless hours into this custom story, and I do NOT want to lose all of my progress.
(This post was last modified: 08-12-2011, 10:24 AM by NadTheBat.)
08-12-2011, 10:22 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Help with scripting and notes.

AddEntityCollideCallback("Player", "ScriptArea_2", "Func01", true, 1);

This should be in the braces of OnStart, not a standalone {}.

Keep in mind that { is used to open a function block, and } is used to close it. Every function block should have a name or an indicator. So it would be like this:

////////////////////////////
// Run when entering map
void OnEnter()
{

}

void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Func01", true, 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_1" , true);
}

void Func01(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("ScaryDoor", 0, 0, 5, "World");
PlaySoundAtEntity("", "21_bang_door.snt", "ScaryDoor", 0, false);
StartPlayerLookAt("ScaryDoor", 2, 2, "");
AddTimer("", 2, "TimerFunc");
}

void TimerFunc(string &in asTimer)
{
StopPlayerLookAt();
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
}

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

}


If you don't have the sound files notes will skip instantly.

08-12-2011, 10:31 AM
Website Find
NadTheBat Offline
Junior Member

Posts: 38
Threads: 4
Joined: Aug 2011
Reputation: 0
#3
RE: Help with scripting and notes.

(08-12-2011, 10:31 AM)Tanshaydar Wrote: AddEntityCollideCallback("Player", "ScriptArea_2", "Func01", true, 1);

This should be in the braces of OnStart, not a standalone {}.

Keep in mind that { is used to open a function block, and } is used to close it. Every function block should have a name or an indicator. So it would be like this:

////////////////////////////
// Run when entering map
void OnEnter()
{

}

void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Func01", true, 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_1" , true);
}

void Func01(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("ScaryDoor", 0, 0, 5, "World");
PlaySoundAtEntity("", "21_bang_door.snt", "ScaryDoor", 0, false);
StartPlayerLookAt("ScaryDoor", 2, 2, "");
AddTimer("", 2, "TimerFunc");
}

void TimerFunc(string &in asTimer)
{
StopPlayerLookAt();
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
}

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

}


If you don't have the sound files notes will skip instantly.

Thank you! The script worked! And yes I do have the sound files for the notes, but it still skips instantly. I can view the notes in my journal, but there is no text at all. Could it be because I have too many notes?

EDIT: I tested my custom story again, and when I pick up one of the keys, it simply says "Picked up", and when I look in my inventory there isn't an item name or a description.

EDIT 2: I used the Langtool editor thing, and it told me exactly where the errors were. Again, thank you so much for the scripting help! I would've NEVER fixed that myself!
(This post was last modified: 08-12-2011, 12:06 PM by NadTheBat.)
08-12-2011, 10:43 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Help with scripting and notes.

No problem at all, feel free to ask help, everyone here is willing to help.

08-12-2011, 12:22 PM
Website Find




Users browsing this thread: 1 Guest(s)