C
Cable_Guy
Guest
Hello everyone,
I've been searching for some info regarding variable scope for DS Lists. I'm sort of under the impression they are global.
My scenario is that I have a number of instances in a room that are from the same object. I am setting them up so that they monitor a circle around themselves for enemy instances. To accomplish this, I have a script that can be called by any instance that will populate a list of enemy instances within its radius. My plan was to have the script update the calling-instance with a DS List of all enemy objects.
Since my script is using collision_circle_list, it will populate a DS List created in the script of all instances in a radius of itself. Then it will filter the list down to objects that are 'enemies', sorted by nearest to furthest, and then pass that back to the calling instance. If an object creates a DS List, is it local to that object only , or is it global?
I can make the script do all of its stuff, and then pass an array back out instead, then destroy the DS List before the script ends. If Lists are global then I would image it will get messy when multiple instances are accessing the same list.
Any direction on this is very much appreciated. Thanks!
I've been searching for some info regarding variable scope for DS Lists. I'm sort of under the impression they are global.
My scenario is that I have a number of instances in a room that are from the same object. I am setting them up so that they monitor a circle around themselves for enemy instances. To accomplish this, I have a script that can be called by any instance that will populate a list of enemy instances within its radius. My plan was to have the script update the calling-instance with a DS List of all enemy objects.
Since my script is using collision_circle_list, it will populate a DS List created in the script of all instances in a radius of itself. Then it will filter the list down to objects that are 'enemies', sorted by nearest to furthest, and then pass that back to the calling instance. If an object creates a DS List, is it local to that object only , or is it global?
I can make the script do all of its stuff, and then pass an array back out instead, then destroy the DS List before the script ends. If Lists are global then I would image it will get messy when multiple instances are accessing the same list.
Any direction on this is very much appreciated. Thanks!