Frictional Games Forum (read-only)

Full Version: Check if something is touching an entity or area.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
(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.
Whoop. I forgot to enclose it properly. Thanks for catching that.