Rasiermesser manufacturing plant

Freeform discussion about anything related to modding Transcendence.
Post Reply
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

In older versions the fact that this station has had a BFG has rescued my dying ship many times against hostiles.

However, there was a time it failed to open fire ..

Recently I noticed it again and set myself to give it back it's BFG ..only to learn that it HAS ONE !

the problem is that the station's weapon is depending on the Random generation of items to supply it with Ammo......add a player thirsty for ammo and you have a supply/demand problem.

Originally I did this :

Code: Select all


		<Devices>
			<Device deviceID="&itAkan30Cannon;"	omnidirectional="true">
						<Items>
							<Item count="5000" item="&itAkan30CannonShell;"/>
						</Items>
					</Device>
		</Devices>


however, thinking harder on it : I decided that THIS might be a better option because the station will not be in competition with the player for Ammo nor dependent on random generations: ((**** don't know if it actually works ))

Code: Select all


		<Devices>
			<Device deviceID="&itAkan30Cannon;"	omnidirectional="true"/>
		</Devices>

<Events>
			<Reload>
				(block (theBFG)
					(setq theBFG (item (objGetItems gSource "wI") 0))
					(if theBFG
						; Tell the Akan to reload itself
						(and (not (objGetItems gSource "m +Akan;")))
							
		(objAddItem gSource (itmCreate &itAkan30CannonShell;(random 20 60))
						)
						)
(if (not (objGetData gSource "Destroyed"))
(sysAddObjRecurringTimerEvent 90 gSource "Reload"))
					)
			</Reload>
</Events>

Code: Select all


	<!-- Akan 30 Cannon Shell -->

	<ItemType UNID="&itAkan30CannonShell;"
			name=				"Akan 30 cannon shell cartridge"
			attributes=			"commonwealth, Akan, consumable, missile, rasiermesser"
			  
			level=				"4"
			frequency=			"common"
			numberAppearing=	"10d40"

			value=				"20"
			mass=				"10"
			  
			description=		"This shell cartridge is used by the Akan 30 cannon."
			>

		<Image imageID="&rsItemsRasiermesser3;" imageX="192" imageY="96" imageWidth="96" imageHeight="96"/>
	</ItemType>
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 am

(if (not (objGetData gSource "Destroyed"))
I'm not sure this works. I think you want (objIsAbandoned spaceObject). And you should cancel the timer if it's abandoned (unless you think it might stop being abandoned).
(sysAddObjRecurringTimerEvent 90 gSource "Reload")
This needs to be inside something like <OnCreate>, rather than the event triggered by the timer, otherwise the timer will never get created, and if it did it would create more and more timers.

Code: Select all

               (if theBFG
                  ; Tell the Akan to reload itself
                  (and (not (objGetItems gSource "m +Akan;")))
All the conditions need to be inside (and).

Try this:

Code: Select all

<Events>
	<OnCreate>
		(sysAddObjRecurringTimerEvent 90 gSource "Reload")
	</OnCreate>

	<Reload>
		(if (objIsAbandoned gSource)
			(sysCancelTimerEvent gSource "Reload") ; If abandoned, stop reloading
			; otherwise tell the Akan to reload itself
			(block (theBFG)
				(setq theBFG (item (objGetItems gSource "wI") 0))
				(if (and theBFG
					(not (objGetItems gSource "m +Akan;"))
					)
						(objAddItem gSource (itmCreate &itAkan30CannonShell;(random 20 60)))
				)
			)
		)
         </Reload>
</Events>
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

YES!!!!!!!!
I often forget about little things like death....

However,

Code: Select all

 (objGetData gSource "Destroyed"))
is Broken

Instead we must use

Code: Select all

(objIsAbandoned gSource) 
( which I learned from testing out a dock screen that kept showing up after the station died ( I forgot to give the station an Abandoned screen ) ..
very annoying - I trashed the entire idea of that particular station I was working on... I wouldn't really use it with my play style anyway)
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
Post Reply