Frictional Games Forum (read-only)
Check if something is touching an entity or 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: Check if something is touching an entity or area. (/thread-15557.html)



Check if something is touching an entity or area. - Stepper321 - 05-22-2012

Hello, i do not know if it is possible. But i need a window to break with EVERY entity. But for as far as i know, is that not possible, besides typing EVERY entity.


RE: Check if something is touching an entity or area. - Obliviator27 - 05-22-2012

void OnStart()
{
for(int i; i<7; i++)
AddEntityCollideCallback("entity_" + i, "Windowname", "BreakWindow", true, 1);
// Note that i<7 should be changed to accommodate however many entities you have, and make sure you name every entity entity_1, entity_2, and so on, or however you want to name them
}

void BreakWindow(string &in asParent, string &in asChild, int alState)
{
// Insert breaking script here.
}

Also note that that's just something I tossed together off of the top of my head.

//EDIT - Fix'd.


RE: Check if something is touching an entity or area. - Datguy5 - 05-22-2012

(05-22-2012, 04:28 PM)Obliviator27 Wrote: void OnStart()
{
for(int i; i<7; i++){
AddEntityCollideCallback("entity_" + i, "Windowname", "BreakWindow", true, 1);
// Note that i<7 should be changed to accommodate however many entities you have, and make sure you name every entity entity_1, entity_2, and so on, or however you want to name them
}

void BreakWindow(string &in asParent, string &in asChild, int alState)
{
// Insert breaking script here.
}

Also note that that's just something I tossed together off of the top of my head.


Thats something ive been wondering for a while too steppers.Im gonna go test ^ that now.
EDIT:Yup that worked perfectly.I just removed the { from for(int i; i<7; i++){ and now it works well.


RE: Check if something is touching an entity or area. - Obliviator27 - 05-22-2012

Whoop. I forgot to enclose it properly. Thanks for catching that.