07-13-2012, 10:27 AM
Hi there, I'm currently working on my first custom story. I'm new to scripting and in need of some help. The 2 things that I need help with is, making a message appear when you try to open a locked door, and making the player to be able to look around freely again after using a PlayerLookAt script. Those 2 scripts are the ones not working. Here's my lang and hps files.
///////////////////////////
//Run first time starting map
void OnStart()
{
AddUseItemCallback("", "bigroomdoorkey_1", "bigroomdoor", "UsedKeyOnDoor", true);
}
void KeyFunc (string &in asEntity, string &in type)
{
SetEntityActive("servant_brute_1", true);
StartPlayerLookAt("servant_brute_1", 15, 15, "");
AddTimer("monstertimer", 2, "monstertimer");
ShowEnemyPlayerPosition("servant_brute_1");
}
void mostertimer(string &in asTimer)
{
StopPlayerLookAt();
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("bigroomdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "bigroomdoor", 0, false);
RemoveItem("bigroomdoorkey_1");
}
void DoorIsLocked(string &in asEntity)
{
if(GetSwingDoorLocked("bigroomdoor") == true)
{
SetMessage("Messages", "thedoorislocked", 0);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
///////////////////////////
// Run when leaving map
void OnLeave()
{
}
___________________________________________________________________________
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You are Michael, you are nineteen years old and your parents have gone away for a vacation over the weekend.[br][br] When you wake up the first morning that you are alone you notice that there is something strange going on with your house.</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_bigroomdoorkey">Big Room Door Key</Entry>
<Entry Name="ItemDesc_bigroomdoorkey">Key to the door in the big room</Entry>
</CATEGORY>
<CATEGORY Name=“Messages”>
<Entry Name =“thedoorislocked”>The door is locked, I think the key should be around here somewhere</Entry>
</CATEGORY>
</LANGUAGE>
///////////////////////////
//Run first time starting map
void OnStart()
{
AddUseItemCallback("", "bigroomdoorkey_1", "bigroomdoor", "UsedKeyOnDoor", true);
}
void KeyFunc (string &in asEntity, string &in type)
{
SetEntityActive("servant_brute_1", true);
StartPlayerLookAt("servant_brute_1", 15, 15, "");
AddTimer("monstertimer", 2, "monstertimer");
ShowEnemyPlayerPosition("servant_brute_1");
}
void mostertimer(string &in asTimer)
{
StopPlayerLookAt();
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("bigroomdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "bigroomdoor", 0, false);
RemoveItem("bigroomdoorkey_1");
}
void DoorIsLocked(string &in asEntity)
{
if(GetSwingDoorLocked("bigroomdoor") == true)
{
SetMessage("Messages", "thedoorislocked", 0);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
///////////////////////////
// Run when leaving map
void OnLeave()
{
}
___________________________________________________________________________
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You are Michael, you are nineteen years old and your parents have gone away for a vacation over the weekend.[br][br] When you wake up the first morning that you are alone you notice that there is something strange going on with your house.</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_bigroomdoorkey">Big Room Door Key</Entry>
<Entry Name="ItemDesc_bigroomdoorkey">Key to the door in the big room</Entry>
</CATEGORY>
<CATEGORY Name=“Messages”>
<Entry Name =“thedoorislocked”>The door is locked, I think the key should be around here somewhere</Entry>
</CATEGORY>
</LANGUAGE>