Thanks - very helpful!
Another question, then: Is there a way to point to an object and have the pointer still work if the object's properties change - for example, if it becomes linked-fire or gets ionized? I'd like to somehow save which item I've made linked-fire so I can keep track of it in case I want to reverse the process later. That would be a lot cleaner than wiping linkedFireOptions from every installed weapon every time I want to change things, which is what I'm doing now. What I'm doing now could mess up other mods, including possibly PSD7 when PM finishes it.
It seems weird to be working with objects but have no way to refer to specific objects even if their attributes change.
EDIT: I'm still having trouble setting the position of the linked-fire weapon. I'm sending a message to myself through the code to verify that objEnumItems works properly, so I think the problem is the way I'm using objSetItemProperty. That's almost certainly the problem, because, as you said earlier, if objSetItemProperty were actually working, the new weapon would no longer be theItem, and objSendMessage wouldn't work!
Code: Select all
; Set all linked-fire weapons to fire from the other side of the ship
(objEnumItems gSource "wI~l" theItem
(if (objGetItemProperty gSource theItem 'linkedFireOptions)
(objSetItemProperty gSource theItem 'posAngle '315)
; For debugging purposes
(objSendMessage gSource gPlayerShip (itmGetName theItem 32))
Is there a better way to do this?