objSetDeviceActivationDelay Issues

Freeform discussion about anything related to modding Transcendence.
Post Reply
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

I keep getting this error:

Code: Select all

OnFireWeapon [Mayfly-class Capitalist-ForTrans]: Item is not an installed device on object [(-517431296 -16777215 74 60 0 "\0\0\0\0\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff" "\0\0\0\0\0\0\0\0" 0)] ### (objSetDeviceActivationDelay gSource (itmCreate (ObjGetData gPlayership "OmniWep") 1) 0) ###
But it still works, (reactor is drained). Is there something wrong with my code or can I ask for objSetDeviceActivationDelay to draw power as if any item was installed?

Code: Select all

(block (Target Mount shot)
					(if (ObjGetTarget gPlayership)
						(setq Target (ObjGetTarget gPlayership))
						(setq Target (SysFindObject gSource "*NAEs"))
						)
					(if 
						(and
							(ObjGetData gPlayership "OmniWep")
							(ls (ObjGetDistance gPlayership Target) 80)
							)
						(block Nil
							(setq Mount (ObjGetData gPlayership "OmniWep"))
							(setq shot (sysCreateWeaponFire 
								Mount
								gSource 
								(ObjGetPos gSource) 
								(sysCalcFireSolution (sysVectorSubtract (objGetpos Target) aFirePos) (objGetVel Target) (typGetDataField Mount 'speed)) 
								(typGetDataField (ObjGetData gPlayership "OmniWep") 'speed) 
								Target
								))
							(objIncVel shot (objGetVel gSource))
							(sysPlaySound (typGetDataField (ObjGetData gPlayership "OmniWep") "sound") gSource)
							(objSetDeviceActivationDelay gSource (itmCreate (ObjGetData gPlayership "OmniWep") 1) 0)
							)
						(block Nil
							(if
								(not (ObjGetData gPlayership "OmniWep"))
									(Plymessage gPlayer "No weapon is currently mounted.")
								)
							)
						)
					
					)
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

It seems like objSetDeviceActivationDelay requires a pointer to an installed item rather than simply an itmStruct.

Try replacing the (itmCreate....) with something like

Code: Select all

(item (filter (objGetItems gplayership "wI") itm (eq (itmGetType itm) mount))) 0)
That should find an installed weapon that matches the unid that is saved on the playership as the var "mount". If that returns an error then you probably dont have the "mount" weapon installed.

This is all just theory, I haven't used this func before but I hope it helps
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Prohet wrote:objSetDeviceActivationDelay requires a pointer to an installed item
I was afraid of that D:
I was trying to make an omnidirectional weapon slot that could take any weapon in the cargo hold and use objSetDeviceActivationDelay to simulate the weapon draining fuel.
I guess I should put this off until I can come up with a better idea.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Post Reply