Hi guys, 1st post on this site. I’ve been looking around here and google searching for a week or 2 now, and tho I’ve found a lot of useful information I still haven’t been able to put together a solution. needless to say I’m a noob at game design.
I have an empty, spawning copies of an object I made that is in an inactive layer. I have an enemy wandering around that is suppose to be able to detect these spawned objects using a near sensor and a property of the origin object each copy should also have. I’ve found code for making lists of objects with a given property, and checking an objects distance, angle, and line of sight on each object in the list for picking one to target, and then giving that target to a steering actuator. then of course activating that actuator.
the problem I’m having is that the enemy does not seem to target any of the spawned object that enter its detection range. I intended to have the spawner spawn each object with an assigned name, but based on what I’ve learned from this site and others I found, objects created in the game engine can’t be referenced by name, right? so weather they have the same name or not should make no difference.
I’ve started wondering if it’s because they are copies of another objects that they were considered the same, so the enemy would be targeting the original in an inactive layer. I’ve read on here however that created objects are created with their own reference that can be saved to a variable and added to a list. but attempting to reference an object that no longer exists can cause errors. is there a way to add each object that’s created to a list AND be able tell that list to remove specific object references when those objects are being removed from the game?
also, it’s been a while since I’ve programmed, and never for a game or in blender before. so I’m not familiar with how to reference a script from another or a specific module in a script from another. checking the list in a script from a script running on enemies that will be spawning in throughout the game.
text walls ik, sorry. any and all help is greatly appreciated.