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
#12
RE: Activating a script area

(06-21-2012, 06:05 PM)FastHunteR Wrote: Okay, I used this script, modified it a bit and tested it, and it works this way:
void OnStart()
{
SetEntityCallbackFunc("tocarnellroomkey", "OnPickup");
}
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "tocarnellroomkey")
{
AddEntityCollideCallback("Player", "pusharea", "Push", true, 1);
}
}

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
AddPlayerBodyForce(0, 0, -100000, false);
}

You need a really big amount at addplayerbodyforce, or it's barely visible. Also, playsoundatentity should be player, not some door, as a door can't make such terrified noises. Also, I changed the area to be collided with only once, since you would be pushed all the time if you went through it.

Edit: I tried this several times with a other function name than OnPickup, and since it didn't work, i assume that the function must be named OnPickup. If someone can falsify this, I would be happy to know a different way.
My god sir, thank you so much. It finally worked. I kind of hesitated to use this because I already had a function called OnPickup, and it gave me an error saying you can't use the same twice, so I change the other one. It works! Thank you so much!

And about the sound, I wasn't sure where to get the source coming from (If you know what I mean) so I put the source on a door that was nearby and called it "randomatticdoor". It worked flawless. I don't think the devs filtered ''humanoid''-sounds to be not from doors or other entities.
06-21-2012, 06:19 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)