Frictional Games Forum (read-only)
[SCRIPT] Message on door and StopPlayerLookAt - 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] Message on door and StopPlayerLookAt (/thread-16935.html)

Pages: 1 2


Message on door and StopPlayerLookAt - CreatAr - 07-13-2012

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>


RE: Message on door and StopPlayerLookAt - Your Computer - 07-13-2012

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.


RE: Message on door and StopPlayerLookAt - Ermu - 07-13-2012

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


RE: Message on door and StopPlayerLookAt - CreatAr - 07-13-2012

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.


RE: Message on door and StopPlayerLookAt - SilentStriker - 07-14-2012

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)


RE: Message on door and StopPlayerLookAt - CreatAr - 07-14-2012

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?


RE: Message on door and StopPlayerLookAt - SilentStriker - 07-14-2012

(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?


RE: Message on door and StopPlayerLookAt - CreatAr - 07-14-2012

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.


RE: Message on door and StopPlayerLookAt - SilentStriker - 07-14-2012

Yepp that's what I thought Smile Here's your problem with the timer void mostertimer it should be monstertimer


RE: Message on door and StopPlayerLookAt - CreatAr - 07-14-2012

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!