ID:160292
 
Okay, I make it so whenever you equip a new weapon, you receive it's overlays. Then I can switch in-between items fine, the old overlay vanishing for the new one. However, this only works if I'm facing south and I switch weapons. If I'm facing any other direction, it won't remove the other overlay. What's up?
Other than needing to remove the same object reference you've added to overlays to get rid of the overlay, the object's built in (visual?) vars also need to be identical to the time the overlay was added. This means if you've added an overlay with an atom with SOUTH dir, it needs to still have SOUTH dir (and other vars) to remove it, or it won't work. Working around this is probably a simple matter of (temporarily, if needed) restoring the dir var to a previous value for the purpose of removing the overlay.
In response to Kaioken
An easy fix, thanks Kaioken. :)


EDIT: It worked, thanks. I don't see a purpose behind having to change it to it's original direction, maybe it's a small inconvenience that needs to be fixed? Or perhaps it does have a purpose. Oh-well! As long as that annoying bug is out of the way!
In response to Speedro
No problem. Also bear in mind, if your game isn't designed to use atoms modified on-the-fly for actual overlays (such as modifying an atom's icon and when using that atom to add an overlay, having the new icon appear), you can switch to simply adding and removing strictly type paths instead. It will always use the path's object definition vars for the overlay, so it won't reflect on runtime changes as said above, but if you don't need such functionality it is easier and probably more robust to use, as removing the overlay by removing its path will consistently work (if it's added by a path).
In response to Kaioken
Unfortunately not for the game I have in mind, though it would be easy to change it all to type paths, the game doesn't need it. I only needed one line of code changing the direction of the object (because all the references just go to one place) and THEN removing it to fix the entire problem. Thanks!