Hey everyone, so I’m trying to make a dropping system (as in from an inventory) in which an item spawner is spawned at the player’s ‘feet’. The way that my item spawners work is they are a simple box with a property ‘itemName’. Using this property I can access the properties of the actualy items, found in layer #2. So, if the player selects an item from his inventory and drops it, it adds an object ‘itemSpawner’ from layer #2 with the property ‘itemName’ and sets it equal to the selected item, so that the player can pick up the item again. It wasn’t working; I was getting the error of something along the lines of ‘key “” does not exist’ when the player tried to pick the item up again (Worth mentioning; it worked until I dropped like four items at once so they all spawned in one spot, then it stopped working after I re-ran the game, even with only one added spawner.) I made ‘itemName’ a debug property, and turns out it never changed from not having a value. I’m guessing if you add an object you can’t change its properties. This is a huge issue for me since the entire item system was supposed to rely on being able to do this. Are there any alternatives, or am I just missing something possibly?
Here’s the code that adds the spawner:
droppedSpawner = scene.addObject(scene.objectsInactive['itemSpawner'], box, 0) droppedSpawner['itemName'] = inv['selectedItem']
But wouldn’t this create something sort of like a “new instance of the object” ‘itemSpawner’?