SysCreateWeaponFire and Data

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?

Is it possible to store the unid of some item, say, a starcannon, and then use that data in conjunction with sysCreateWeaponFire?
I'm currently having trouble with (typGetDataField (itmCreate (ObjGetData gPlayership "someData") 1) 'speed) as Trans keeps saying "integer expected".
Here's all of the code:

Code: Select all

<!-- OmniSlot-->
	<ItemType UNID="&itOmniSlot;"
			name=				"OmniSlot"
			level=				"3"
			value=				"1500"
			mass=				"4000"
			frequency=			"notrandom"
			modifiers=			"MajorItem; Mayfly Industries; NotForSale;"			

			description=		"This item can be installed to take up one weapon slot. [U]se and pick a weapon from your cargo hold, and it will be mounted on the OmniSlot, making the weapon omnidirectional."
			
			useScreen=			"&dsOmniSlot;"
			useKey=				"O"
			useInstalledOnly=	"true"
			>		
		<Image imageID="&rsItems1;" imageX="288" imageY="0" imageWidth="96" imageHeight="96"/>
		<Weapon
				type=			"particles"
				count=			"1d4+4"

				configuration=	"wall"
				damage=			"plasma:50; WMD5"
				fireRate=		"20"
				missileSpeed=	"20-40"
				lifetime=		"0"
				powerUse=		"6000"
				LinkedFire=		"always"

				particleCount=	"5d6"
				particleEmitTime="5-12"
				particleSpreadWidth="25" 
				particleSpreadAngle="0"

				sound=			"&snMissileLauncher;"
				>

			<Effect>
				<Shape
						directional=		"true"
						scaleLength=		"16" 
						scaleWidth=			"6"

						scaleLengthInc=		"3" 

						color=				"0xff, 0xfd, 0xad"
						opacity=			"64"
						>
					<Point x="0"	y="0"/>
					<Point x="-5"	y="29"/>
					<Point x="-10"	y="44"/>
					<Point x="-20"	y="50"/>
					<Point x="-30"	y="47"/>
					<Point x="-40"	y="44"/>
					<Point x="-100"	y="0"/>
					<Point x="-40"	y="-44"/>
					<Point x="-30"	y="-47"/>
					<Point x="-20"	y="-50"/>
					<Point x="-10"	y="-44"/>
					<Point x="-5"	y="-29"/>
				</Shape>
			</Effect>
		</Weapon>
		<Events>
			<OnFireWeapon>
				;issues: drawing reactor power			
					(sysCreateWeaponFire (itmCreate (ObjGetData gPlayership "OmniWep") 1) gSource (ObjGetPos gSource) 0 (typGetDataField (itmCreate (ObjGetData gPlayership "OmniWep") 1) 'speed) nil)
					)
			</OnFireWeapon>
		</Events>
	</Itemtype>
<DockScreen UNID="&dsOmniSlot;"
			name=				"Ship's Interior"
			type=				"customPicker"
			backgroundID=		"&rsItemListScreen;"
			>
		<List>			
			(block Nil
				;(objEnumItems obj criteria itemVar exp)
				(setq listEntries (list))
					;
					(enum (objGetItems gPlayership "*cw ~l") w (lnkAppend listEntries (list
						(itmGetName w 1)
						;nil
						(itmGetImageDesc  w)
						"" ; or something else
						;(dbglog(objGetID w))
						(itmGetUNID w)
						)))
						listentries
				)
		</List>

		<Panes>
			<Default>
				<OnPaneInit>
					(scrSetDesc gScreen(cat "Choose the weapon to make omnidirectional."))
				</OnPaneInit>

				<Actions>
					
					<Action name="1. Mount" key="1">
						(block Nil
							(ObjSetData gPlayership "OmniWep" (item (scrGetListEntry gScreen) 3))
							(dbglog (ObjGetData gPlayership "OmniWep"))
							(scrExitScreen gScreen)
							)
					</Action>					
					
					<Action name="Cancel" cancel="1" key="C">
						<Exit/>
					</Action>
					
				</Actions>
			</Default>
		</Panes>
			
		
	</DockScreen>
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
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

RPC wrote:Is it possible to store the unid of some item, say, a starcannon, and then use that data in conjunction with sysCreateWeaponFire?
I'm currently having trouble with (typGetDataField (itmCreate (ObjGetData gPlayership "someData") 1) 'speed) as Trans keeps saying "integer expected".
That's easy. TypGetDataField is a type function, not an item function. You want (typGetDataField (ObjGetData gPlayership "someData") 'speed). Converting the UNID to an itemstruct is like trying to make an omelet out of a chicken.
Literally is the new Figuratively
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?

Sweet. I'll test it out when I get back home.
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