Frictional Games Forum (read-only)

Full Version: Message on door and StopPlayerLookAt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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>
For starters, you're going to need to set a SetEntityPlayerInteractCallback for DoorIsLocked. Secondly, you should use the parameter for DoorIsLocked instead of explicitly providing the name. Finally, you have special quotation marks in your LANG file; these are not considered proper quotation marks by the engine.
(07-13-2012, 10:27 AM)CreatAr Wrote: [ -> ]void mostertimer(string &in asTimer)
{
StopPlayerLookAt();
}
Dem typos. It should be "monstertime", which is called in the AddTimer.
Thanks both of you! However, "
For starters, you're going to need to set a SetEntityPlayerInteractCallback for DoorIsLocked. Secondly, you should use the parameter for DoorIsLocked instead of explicitly providing the name." I don't understand this, im really new to scripting. I changed the typos and the quotation marks, the message on the door showed up, however im still locked at looking on the brutes spawnlocation.
KeyFunc and DoorIsLocked how do you call them? Since in the script you have no callback/function that calls KeyFunc and DoorIsLocked.

What YourComputer means about parameters is that on GetSwingDoorLocked you should write asEntity instead of "bigroomdoor"

Parameters is these: (string &in asEntity)
The message on the door is working fine now, it was just the quotation marks. However the StopPlayerLookAt isn't. So that's the help I need now Smile
EDIT: I misread your post, what do you mean by how do I call them? Do you mean in the level editor?
(07-14-2012, 12:54 AM)CreatAr Wrote: [ -> ]The message on the door is working fine now, it was just the quotation marks. However the StopPlayerLookAt isn't. So that's the help I need now Smile
EDIT: I misread your post, what do you mean by how do I call them? Do you mean in the level editor?
Since you don't have any function calling KeyFunc and DoorIsLocked then I would guess they are called from the level editor?
Um, I think so I guess, I'm really new to scripting, I have written DoorIsLocked in the PlayerInteractCallback tab for the door. And KeyFunc in the CallbackFunc tab for the key that triggers the brute.
Yepp that's what I thought Smile Here's your problem with the timer void mostertimer it should be monstertimer
Another typo damn Tongue
It's good to have someone else look at it. Because you might have stared to much on it to see the problems ^^
Thanks alot!
Pages: 1 2