Hey guys, I am working on an RPG and I had an idea to spawn objects on the board from an array. The reason I am doing so is so that I can create a dynamic environment where the PC can pick items up, move objects around, drop items, destroy objects, etc., and I wanted to track those changes in an array so that when the PC returned to a previous layout, those changes were still present. But I'm also going a step further and having the program move or remove some items around (so a PC might return to find that some objects have been removed or returned to their original positions, but some impact might still be noticeable).
Anyway, I wrote a function to spawn objects from an array when the layout is loaded. It stores the name of the layout the objects should appear on, the coordinates of the object, the ID (a variable I've added to the family "Items" which is used to select the item to spawn), and other information that isn't being used yet but I plan to include once I can get this running. I've run tests to ensure that the array was loaded correctly (data is being imported from a csv file) and that the variables are pulling the right data from the array. So far that all checks out. However, the objects that are spawned appear to be completely random. They do appear at the right locations, but I can't seem to get the function to select the right object to spawn.
Am I missing something obvious here? Or is there an easier way to go about this?
[attachment=0:2f08gvh7][/attachment:2f08gvh7]