The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Activating a script area
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#1
Activating a script area

Hello again. So I thought about something very simple, a script area that activates upon a key pickup. When I walk into the script area nothing happens, but after I picked up the key and walk in it it does something (in this case push the player back) (I had in mind delete the script area after one use). However, after I picked up the key and walked in the area nothing happened. Here's my script. The script area is called "pusharea" and the key "tocarnellroomkey". The area is not active in the beginning obviously.



void OnStart()

{
AddEntityCollideCallback("Player", "pusharea", "Push", false, 1);
SetEntityCallbackFunc("tocarnellroomkey", "OnPickupKey");
}


//The push script
void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "push", 0, false);
AddPlayerBodyForce(0, 0, -2000, false);
}

//The setting-the-area-active script
void OnPickupKey(string &in asEntity, string &in type)
{
SetEntityActive("pusharea", true);
PlaySoundAtEntity("", "scare_male_terrified5.snt", "randomatticdoor", 2, false);
}

So my guess is that SetEntityActive doesn't work on script areas? Can anyone improve this or knows what I did wrong? Thanks in advance.

EDIT: If I do the code in a code window, it gets messed up.
(This post was last modified: 06-22-2012, 08:31 PM by ApeCake.)
06-21-2012, 04:58 PM
Find


Messages In This Thread
Activating a script area - by ApeCake - 06-21-2012, 04:58 PM
RE: Activating a script area - by MaZiCUT - 06-21-2012, 05:04 PM
RE: Activating a script area - by ApeCake - 06-21-2012, 05:05 PM
RE: Activating a script area - by Cruzore - 06-21-2012, 05:04 PM
RE: Activating a script area - by Adny - 06-21-2012, 05:09 PM
RE: Activating a script area - by ApeCake - 06-21-2012, 05:17 PM
RE: Activating a script area - by Cruzore - 06-21-2012, 05:17 PM
RE: Activating a script area - by Cruzore - 06-21-2012, 05:20 PM
RE: Activating a script area - by Adny - 06-21-2012, 05:23 PM
RE: Activating a script area - by ApeCake - 06-21-2012, 05:33 PM
RE: Activating a script area - by Cruzore - 06-21-2012, 06:05 PM
RE: Activating a script area - by ApeCake - 06-21-2012, 06:19 PM
RE: Activating a script area - by Cruzore - 06-21-2012, 06:21 PM



Users browsing this thread: 1 Guest(s)