Frictional Games Forum (read-only)
Activating a script area - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Activating a script area (/thread-16374.html)

Pages: 1 2


RE: Activating a script area - Cruzore - 06-21-2012

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.


RE: Activating a script area - ApeCake - 06-21-2012

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


RE: Activating a script area - Cruzore - 06-21-2012

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.