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 Make an script work when Pick up key?
SilentHideButFine Offline
Member

Posts: 156
Threads: 38
Joined: May 2012
Reputation: 6
#5
RE: Make an script work when Pick up key?

(06-13-2012, 08:32 AM)Mackiiboy Wrote: If you want something to happen when you pick up the key, you will need to use this:

void OnStart()
{
SetEntityCallbackFunc("name_of_your_key", "PickUpKeyFunc");
}

void PickUpKeyFunc(string &in entity, string &in type)
{
if(type == "OnPickup")
{
// Put everything you want to happen here after you have picked up your key.
}
}

So, if you have a script area that is inactive in the level editor and want to be active, you could put a SetEntityActive("Your_Script_Area", true); inside the PickUpKeyFunc.
When pick up key you are supposed to go out but when you come like 2 m away from the door the doors opens by it self Smile



void PickUpKeyFunc(string &in entity, string &in type)
{
if(type == "OnPickup")
{
AddBodyForce("mansion_2", -3.388, 0, 0, "world");
StartPlayerLookAt("mansion_2", 5, 5, "");
PlaySoundAtEntity("", "react_scare.snt", "mansion_2", 3, true);
AddTimer("StopLookAt", 3, "StopLookAtEvent");
}
}
void StopLookAtEvent(string &in asTimer)
{
StopPlayerLookAt();
}

There is the script with funcs
Sound and bodyforce dosnt work only the look at :S

[url= http://www.moddb.com/mods/jessehmusic [/url] ,HOSPITAL OF HORROR MOD
(This post was last modified: 06-13-2012, 04:11 PM by SilentHideButFine.)
06-13-2012, 10:07 AM
Find


Messages In This Thread
RE: Make an script work when Pick up key? - by SilentHideButFine - 06-13-2012, 10:07 AM



Users browsing this thread: 2 Guest(s)