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 Message on door and StopPlayerLookAt
CreatAr Offline
Junior Member

Posts: 8
Threads: 2
Joined: Jul 2012
Reputation: 0
#1
Message on door and StopPlayerLookAt

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>
(This post was last modified: 07-13-2012, 12:48 PM by CreatAr.)
07-13-2012, 10:27 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Message on door and StopPlayerLookAt

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.

Tutorials: From Noob to Pro
07-13-2012, 09:22 PM
Website Find
Ermu Offline
Member

Posts: 86
Threads: 13
Joined: Jan 2012
Reputation: 2
#3
RE: Message on door and StopPlayerLookAt

(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.
07-13-2012, 10:46 PM
Find
CreatAr Offline
Junior Member

Posts: 8
Threads: 2
Joined: Jul 2012
Reputation: 0
#4
RE: Message on door and StopPlayerLookAt

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.
(This post was last modified: 07-13-2012, 11:18 PM by CreatAr.)
07-13-2012, 11:13 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: Message on door and StopPlayerLookAt

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)

(This post was last modified: 07-14-2012, 12:46 AM by SilentStriker.)
07-14-2012, 12:39 AM
Find
CreatAr Offline
Junior Member

Posts: 8
Threads: 2
Joined: Jul 2012
Reputation: 0
#6
RE: Message on door and StopPlayerLookAt

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?
(This post was last modified: 07-14-2012, 01:00 AM by CreatAr.)
07-14-2012, 12:54 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#7
RE: Message on door and StopPlayerLookAt

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

07-14-2012, 12:31 PM
Find
CreatAr Offline
Junior Member

Posts: 8
Threads: 2
Joined: Jul 2012
Reputation: 0
#8
RE: Message on door and StopPlayerLookAt

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.
07-14-2012, 12:56 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#9
RE: Message on door and StopPlayerLookAt

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

07-14-2012, 01:23 PM
Find
CreatAr Offline
Junior Member

Posts: 8
Threads: 2
Joined: Jul 2012
Reputation: 0
#10
RE: Message on door and StopPlayerLookAt

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!
07-14-2012, 01:29 PM
Find




Users browsing this thread: 2 Guest(s)