Frictional Games Forum (read-only)
[SCRIPT] Entity collide that uses every entity in the level? - 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: [SCRIPT] Entity collide that uses every entity in the level? (/thread-54766.html)



Entity collide that uses every entity in the level? - HappyMatt12345 - 10-21-2018

You see, I'm working on a custom story called "Order of the Skull" and I am trying to make a script that will do something if one of any movable entity in the level that will fit in the location of the area is placed in that area, and the player presses a button, I know I could do 30 different AddEntityCollideCallback's but that just seems impractical, and I feel there must be a more efficient way. Any ideas and/or suggestions are much appreciated Smile


RE: Entity collide that uses every entity in the level? - Mudbill - 10-22-2018

Unfortunately, wildcards (*) are not allowed in the entity name. There are a couple of ways to achieve this, but they mostly rely on a certain pattern with your allowed entities. Perhaps something you can do is add a "PlayerInteractCallback" in the Entity tab of each object, which all call the same function which will add the collide callback between it and your area. That would minimize a lot of your code, but requires you to add that interact callback to each one via the Level Editor.


RE: Entity collide that uses every entity in the level? - HappyMatt12345 - 10-23-2018

(10-22-2018, 04:56 PM)Mudbill Wrote: Unfortunately, wildcards (*) are not allowed in the entity name. There are a couple of ways to achieve this, but they mostly rely on a certain pattern with your allowed entities. Perhaps something you can do is add a "PlayerInteractCallback" in the Entity tab of each object, which all call the same function which will add the collide callback between it and your area. That would minimize a lot of your code, but requires you to add that interact callback to each one via the Level Editor.

Well if thats the way it works, not much anyone can do about that. I guess it will work, but its gonna take a while...


RE: Entity collide that uses every entity in the level? - Mudbill - 10-23-2018

If they're named similarly, you can use a for-loop in script to achieve it. If not, the same is possible if you're able to produce a list of all the entity names.