Frictional Games Forum (read-only)
[Solved] - Area Collide Script Activation - 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: [Solved] - Area Collide Script Activation (/thread-9271.html)



[Solved] - Area Collide Script Activation - Rokotain - 07-20-2011

Hello Forum People! Smile

I'm quite new to scripting and don't understand 100% of Frictional Games's Scripting Tutorial. Blush

Basically what I want is that whenever the player walks into "Area1" he activates "Area2" which then activates "servant_grunt_1".

"Area1" is enabled at start of map.
"Area2" is disabled at start of map until "Area1" activates the script.

I need help with what to write in the script, something like PlayerCollide(Callback?).


What I currently have, is PlayerLookAtCallback, which causes the grunt to spawn whenever I look at the 2 areas I have specified :/

And there is no CollideCallback in the Script-Area Entity Tabs, only LookAtCallback & InteractCallback.

In this case, would colliding with the area count as an InteractCallback?

Also, I'm Norwegian so please excuse if there are any typos. Angel

Thanks for reading xD!
-Rokotain

*EDIT - I found the soultion in another help thread c:
Thanks anyways!

Still feel free to post answers here as it will help other players find the solution C:!


RE: [Solved] - Area Collide Script Activation - Tanshaydar - 07-20-2011

You should write in scripting file because the entity that collides and being collided are two different entities and you cannot specify two of them at the same time in level editor.

List of available functions are here: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions
And this page has lots of user made tutorials: http://wiki.frictionalgames.com/hpl2/tutorials/start


RE: [Solved] - Area Collide Script Activation - Rokotain - 07-21-2011

Thank you for the helpful links Smile !

I'm becomming more adept to this with time.
Such as now, I have this:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "AreaActivateLookGrunt", "ActivateLookGrunt", true, 1);
}


void ActivateLookGrunt(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("AreaLookGrunt", true);
AddEntityCollideCallback("Player", "AreaLookGrunt", "LookAtGrunt", true, 1);
}

void LookAtGrunt(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("ghostgrunt", true);
}

It works very well and this is what I was looking for.
I posted it here in case someone else needing help for this^^

Thanks again Angel


RE: [Solved] - Area Collide Script Activation - Tanshaydar - 07-21-2011

Glad you got it working!
Good luck!