Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Activating a script area
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.
(This post was last modified: 06-21-2012, 06:14 PM by Cruzore.)
|
|
06-21-2012, 06:05 PM |
|
ApeCake
Member
Posts: 116
Threads: 20
Joined: Jun 2012
Reputation:
4
|
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 |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Activating a script area
No problem, I just ment that it's strange to hear terrified noises from a door, you can just use "Player" if you want it to happen to yourself.
|
|
06-21-2012, 06:21 PM |
|
|