modding problem with dockscreens

Freeform discussion about anything related to modding Transcendence.
Post Reply
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Code: Select all


<!-- Charon Pirate Cache -->

	<StationType UNID="&stCharonPirateOutpost;"
			name=				"Charon Pirate Cache"
			sovereign=			"&svPirates;"
			abandonedScreen=	"&dsAbandonedStation;"
			dockScreen=			"Main"
			dockingPorts=		"8"
			canAttack=			"true"

			armorID=			"&itLightTitaniumPlate;"
			maxHitPoints=		"50"
			hitPoints=			"50"
			fireRateAdj=		"80"
			ejectaType=			"&vtWreckEjecta;"

			attributes=			"pirates,enemy,envAir,envEarth,envFire,envWater,populated"
			levelFrequency=		"cuv-- ----- ------ ----- -----"
			locationCriteria=	"-planet,-void"
			>

		<Image			imageID="&rsStations1;" imageX="0" imageY="512" imageWidth="156" imageHeight="156"/>

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

		<Ships>
			<Table>
				<Ship chance="85"	count="1d4"	class="&scCorsair;"		orders="guard"/>
				<Group chance="10">
					<Ship			count="1"	class="&scCorsair;"		orders="guard"/>
					<Ship			count="1"	class="&scViking;"		orders="guard"/>
				</Group>
				<Ship chance="5"	count="1d2"	class="&scViking;"		orders="guard"/>
			</Table>
		</Ships>

		<Items>
			<Table>
				<Lookup chance="40" count="1" table="&trConsumables2;"/>
				<Lookup chance="40" count="1" table="&trMinorItem2;"/>
				<Lookup chance="20" count="1" table="&trMajorItem2;"/>
			</Table>
		</Items>

		<Encounters frequency="common">
			<Table>
				<Ship chance="75" count="1d3"	class="&scCorsair;" orders="attack"	/>
				<Ship chance="25" count="1"		class="&scViking;" orders="attack"	/>
			</Table>
		</Encounters>

		<DockScreens>
			<Main
				name=			"=(objGetName gSource)"
				>

				<Panes>
					<Default
						desc=	"You are in the docking bay of a pirate outpost.">
						<Actions>
							<Action name="Ask for the location of the nearest freighter" imageID="&rsItemListScreen;" imageIndex="1" default="1" key="A">
								<ShowPane pane="AskForFreighter"/>
							</Action>

							<Action name="Refuel" imageID="&rsItemListScreen;" imageIndex="1" key="R">
								(block Nil
									(setq gPrevScreen "Main")
									(setq gPrevPane "DockServices")
									(intSetCompatibleFuel '((&itHeliumAssembly; 70) (&itHelium3FuelRod; 22)))
									(scrShowScreen gScreen "&dsRefuel;")
									)
							</Action>

							<Action name="Undock" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="U">
								<Exit/>
							</Action>

						</Actions>
					</Default>

					<AskForFreighter
						desc=	"No one seems to recognize your request. (not implemented)">
						<Actions>
																	<Action name="Done" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="D">
							<ShowPane pane="Default"/>
							</Action>
						</Actions>		
					</AskForFreighter>
				</Panes>
			</Main>

		</DockScreens>
	</StationType>

</TranscendenceExtension>
It compiles, but fails when I try to refuel. I buy the fuel and then it takes me to a screen with no options, then crashes.

The rest of the code is reproduced below so you can test it. Just put this code immediately before the code above which has the problem in it.

Code: Select all

<?xml version="1.0" ?>

<!DOCTYPE TranscendenceExtension
[<!ENTITY itPiratesROM				"0xDF506001">
<!ENTITY scWolfenPiratePlayer			"0xDF505011">
]>

<TranscendenceExtension UNID="0xDF506000" version="0.98d">

	
<!-- Pirates ROM (Thank you e___e)-->

<ItemType UNID="&itPiratesROM;"
		name=				"pirate imitation ROM"
		level=				"7"
		value=				"10000"
		mass=				"1"
		frequency=			"notrandom"
		unknownType=		"&itUnknownROM;"
		modifiers=			"Consumable; Info; Illegal"

		description=		"This program causes your ship to broadcast on pirate channels, identifying you as a Charon Pirate."
		>

	<Image imageID="&rsItems1;" imageX="192" imageY="96" imageWidth="96" imageHeight="96"/>

	<Invoke>
		(block Nil
			(objSetSovereign gSource &svPirates;)
			(objSendMessage gSource gSource "Program completed.")
			)
	</Invoke>

</ItemType>

	<!-- Player Ship: Wolfen-class Gunship -->

	<ShipClass UNID="&scWolfenPiratePlayer;"
			manufacturer=		""
			class=				"Wolfen"
			type=				"Pirate Gunship"
			score=				"225"
			techOrder=			"biomech"
			
			mass=				"30"
			reactorPower=		"100"
			fuelCapacity=		"25000"
			cargoSpace=			"35"
			thrust=				"300"
			rotationCount=		"40"
			maneuver=			"2"
			maxSpeed=			"25"
			
			maxArmor=			"10000"
			maxCargoSpace=		"100"
			maxDevices=			"8"
			maxNonWeapons=		"4"

			leavesWreck=		"20"
			>

		<Armor>
			<ArmorSection start="315" span="90" armorID="&itLightPlasteelPlate;" areaSet="0,2" />
			<ArmorSection start="225" span="90" armorID="&itLightPlasteelPlate;" areaSet="3,4" />
			<ArmorSection start="45"  span="90" armorID="&itLightPlasteelPlate;" areaSet="7,13" />
			<ArmorSection start="135" span="90" armorID="&itLightPlasteelPlate;" areaSet="1,6" />
		</Armor>

		<Devices>
			<Device deviceID="&itDualLaserCannon;"/>
			<Device deviceID="&itNAMIMissileLauncher;"/>
			<Device deviceID="&itHullPlateIonizer;"/>
		</Devices>

		<Items>
			<Item count="4d6" item="&itHelium3FuelRod;"/>
			<Item count="4d6" item="&itKM100Missile;"/>
			<Item count="1" item="&itPiratesROM;"/>	
		</Items>

		<AISettings
			fireRateAdj=		"30"
			fireAccuracy=		"90"
			perception=			"4"
			/>

		<Image imageID="&rsWolfenGunship;" imageX="0" imageY="0" imageWidth="48" imageHeight="48" imageFrameCount="0" imageTicksPerFrame="0"/>

		<DriveImages>
			<NozzleImage imageID="&rsDriveExhaust2;" imageX="0" imageY="0" imageWidth="48" imageHeight="48" imageFrameCount="0" imageTicksPerFrame="0"/>
			<NozzlePos x="-41" y="-8"/>
			<NozzlePos x="-41" y="0"/>
			<NozzlePos x="-41" y="8"/>
		</DriveImages>

		<PlayerSettings
			desc=				"Fast and deadly, the Wolfen is designed for combat. Though limited in cargo capacity, it has lots of room for more weapons."
			largeImage=			"&rsWolfenLarge;"
			initialClass=		"true"

			startingSystem=		"SE"
			startingPos=		"Start"
			>
			
			<ArmorDisplay>
				<ArmorSection name="forward"
						imageID="&rsWolfenArmor;" 
						imageX="0" imageY="0" imageWidth="52" imageHeight="15"
						destX="42" destY="19" hpX="55" hpY="18"
						nameY="8" nameBreakWidth="200" nameDestX="0" nameDestY="10" />

				<ArmorSection name="starboard"
						imageID="&rsWolfenArmor;" 
						imageX="75" imageY="0" imageWidth="23" imageHeight="69"
						destX="94" destY="34" hpX="97" hpY="60"
						nameY="30" nameBreakWidth="360" nameDestX="12" nameDestY="0" />

				<ArmorSection name="port"
						imageID="&rsWolfenArmor;" 
						imageX="52" imageY="0" imageWidth="23" imageHeight="69"
						destX="19" destY="34" hpX="13" hpY="60"
						nameY="52" nameBreakWidth="200" nameDestX="0" nameDestY="8" />

				<ArmorSection name="aft"
						imageID="&rsWolfenArmor;" 
						imageX="0" imageY="75" imageWidth="52" imageHeight="16"
						destX="42" destY="103" hpX="55" hpY="107"
						nameY="74" nameBreakWidth="360" nameDestX="12" nameDestY="0" />
			</ArmorDisplay>

			<ShieldDisplay>
				<Image imageID="&rsWolfenShields;" imageX="0" imageY="0" imageWidth="136" imageHeight="136"/>
			</ShieldDisplay>
				
			<ReactorDisplay>
				<Image imageID="&rsZubrinReactor;" 
						imageX="0" imageY="0" imageWidth="256" imageHeight="60"/>
				
				<PowerLevelImage imageID="&rsZubrinReactor;"
						imageX="0" imageY="60" imageWidth="202" imageHeight="14"
						destX="54" destY="9"/>
						
				<FuelLevelImage imageID="&rsZubrinReactor;"
						imageX="0" imageY="74" imageWidth="194" imageHeight="14"
						destX="54" destY="37"/>
						
				<FuelLowLevelImage imageID="&rsZubrinReactor;"
						imageX="0" imageY="88" imageWidth="194" imageHeight="14"/>
						
				<ReactorText x="62" y="22" width="154" height="14"/>
				<PowerLevelText x="62" y="0" width="154" height="9"/>
				<FuelLevelText x="62" y="51" width="154" height="9"/>
			</ReactorDisplay>
			
		</PlayerSettings>

	</ShipClass>
sorry for the length.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

F50 wrote:

Code: Select all

					<Action name="Refuel" imageID="&rsItemListScreen;" imageIndex="1" key="R">
								(block Nil
									(setq gPrevScreen "Main")
									(setq gPrevPane "DockServices")
									(intSetCompatibleFuel '((&itHeliumAssembly; 70) (&itHelium3FuelRod; 22)))
									(scrShowScreen gScreen "&dsRefuel;")
									)
							</Action>
my first thought is the gPrevPane should be Default not DockServices
Crying is not a proper retort!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Thanks, I was just trying to copy/paste my way through dockscreens.

One other problem though, unlrelated to dockscreens.

In the station code it makes encounters with an order "attack". This will result in having seemingly friendly ships attack you if your soverign is scPirates by using the rom.

is there a way to remove those encounters if you are aligned with their faction?
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

F50 wrote:is there a way to remove those encounters if you are aligned with their faction?
yes, sort of. add a recurring timer event to your playership and have the rom start it, the event looks for ships with your soverign set to attack you and change their orders to something else.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

unfortunately, I found more problems with merely copying e___e's script into my mod. Your autons will attack you. I suppose what I actually need to do is set svPirates to be friendly to svPlayer (if there is such a thing) and svCommonwealth or whatever it is to be enemy to svPlayer (if there is such a thing).

However, that and the recurring timer trick I will try to do after I get the basic pirate dockscreen services worked out.

I am a newbie at modding. I know nothing about scripting in Transcendence. At the moment I have mastered copy/pasting xml and modifying values for variables as in Fleets and the HardMod, but nothing more.


Right now I need two scripts for two basic pirate services:

1. Map all Charon pirate stations. Easy enough, but I don't know enough about modding. I have copied the code from the Charon Pirate Mapping ROM but it doesn't seem to work, apparently because gSource refers to the station, not the player. I then tried gPlayer, but that didn't work either.

Code: Select all

					<AskForCharonLocations
						desc=	"One of the Pirates says "Here's the list."">
									(block (found)
				; We map all Charon stations
				(enum (sysFindObject gPlayer "AT:pirates;") obj
					(block Nil
						(objSetKnown obj)
						(setq found True)
						)
					)

				(if found
					(objSendMessage gPlayer Nil "Mapped all Charon pirate stations in system")
					(objSendMessage gPlayer Nil "No Charon pirate stations in system")
					)
				)					
						<Actions>
																	<Action name="Leave" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="L">
							<ShowPane pane="Default"/>
							</Action>
						</Actions>		
					</AskForCharonLocations>
2. Have the player choose an option in the dockscreen that causes a ship to be created ~120 ls away that acts as a merchant. I hope to copy/paste this one quite easily. The trick is to get it to disappear once the player is greater than 120 ls away.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

gPlayerShip is what you need to use, not gPlayer.

also: you can change the sovereign of your autons when you change yours so they won't attack you.(see below)

as for #2, you can use events, oncreate and recurring on the merchant, that checks it's distance from the player and gates out if it's too far. example below, i'm pretty sure it will work though i have not tested it. it should be on the ship you want to gate out if it gets too far

Code: Select all

<Events>
	<OnCreate>
		(sysAddObjRecurringTimerEvent 40 gSource "checkdist")
	</OnCreate>
	<checkdist>
		;if the player and source are farther apart than 120 light seconds then order the source to gate out
		(if (gr (objGetDistance gSource gPlayerShip) 120)
		(block Nil
			(shpCancelOrders gSource)
			(shpOrderGate gSource)
		)
		)
	</checkdist>
</Events>
EDIT: this will change the soverign of all your autons to pirate(also untested but should work)

Code: Select all

(block Nil
	(setq gList (sysFindObject gPlayerShip "s B:auton; O:escort;"))
		(enum gList auton
			(objSetSovereign auton &svPirates;)
		)
)

EDIT: perhaps you could repeatedly check the entire system for ships ordered to attack you and have the same sovereign then make them attack something else
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Code: Select all

									(block (found)
				; We map all Charon stations
				(enum (sysFindObject gPlayerShip "AT:pirates;") obj
					(block Nil
						(objSetKnown obj)
						(setq found True)
						)
					)

				(if found
					(objSendMessage gPlayerShip Nil "Mapped all Charon pirate stations in system")
					(objSendMessage gPlayerShip Nil "No Charon pirate stations in system")
					)
				)
still doesn't work. But thanks for the advice bobby! I'll be abusing it regularly I think. :twisted:


The only problem I see with your script for #2 is that I don't want the ship to gate out, I want it to disapear. Otherwise stations in the way would destroy it and the loot would be left for the player or someone else. (unless I make it immutable, which I don't want to do)
<OnCreate>
(sysAddObjRecurringTimerEvent 40 gSource "checkdist")
</OnCreate>
I will make sure to remember that line for the future. Once I get comfortable with how to use these functions in the xml, I will be able to refer to the function list.

After this mod (or during), I will write a guide to collate all this information for future users.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

dissapear? as in just go away? then you can replace:

Code: Select all

         (shpCancelOrders gSource)
         (shpOrderGate gSource) 
with:

Code: Select all

(objDestroy gSource)
that will make it just dissapear, it will be destroyed but not explode or leave a wreck, btw this works with stations as well as ships.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Figured out why #1 code wasn't working. All code must be inside [action] [/action] tags.

EDIT: The drake won't sell or buy anything.

EDIT2: The drake will now sell and buy stuff. It took a while to figure out

Code: Select all


	<ShipClass UNID="&scDrakeMerchant1;"
			manufacturer=		"Charon Pirates"
			class=				"Drake"
			type=				"missileship"
			score=				"350"
			techOrder=			"mech"
			
			mass=				"1000"
			cargoSpace=			"5"
			thrust=				"250"
			maneuver=			"10"
			maxSpeed=			"12"
			dockingPorts=			"1"
			dockScreen=			"Main"
			

			leavesWreck=		"100"
			>

		<Armor>
			<ArmorSection start="345" span="30" armorID="&itLightBlastPlate;" areaSet="0,2" />
			<ArmorSection start="315" span="30" armorID="&itLightBlastPlate;" areaSet="3,4" />
			<ArmorSection start="285" span="30" armorID="&itLightBlastPlate;" areaSet="1,6" />
			<ArmorSection start="255" span="30" armorID="&itLightBlastPlate;" areaSet="7,13" />
			<ArmorSection start="225" span="30" armorID="&itLightBlastPlate;" areaSet="0,2" />
			<ArmorSection start="195" span="30" armorID="&itLightBlastPlate;" areaSet="3,4" />
			<ArmorSection start="165" span="30" armorID="&itLightBlastPlate;" areaSet="1,6" />
			<ArmorSection start="135" span="30" armorID="&itLightBlastPlate;" areaSet="7,13" />
			<ArmorSection start="105" span="30" armorID="&itLightBlastPlate;" areaSet="0,2" />
			<ArmorSection start="75"  span="30" armorID="&itLightBlastPlate;" areaSet="3,4" />
			<ArmorSection start="45"  span="30" armorID="&itLightBlastPlate;" areaSet="1,6" />
			<ArmorSection start="15"  span="30" armorID="&itLightBlastPlate;" areaSet="7,13" />
		</Armor>

		<Devices>
			<Device deviceID="&itNAMIMissileLauncher;" omnidirectional="true"/>
			<Device deviceID="&itLaserCannon;" secondaryWeapon="true" minFireArc="20" maxFireArc="160" posAngle="60" posRadius="30"/>
			<Device deviceID="&itLaserCannon;" secondaryWeapon="true" minFireArc="200" maxFireArc="340" posAngle="300" posRadius="30"/>
		</Devices>

		<Items>
			<Item count="2d6" item="&itHelium3FuelRod;"/>
			<RandomItem 
					criteria=		"* +Ore; -NotForSale;"
					level=			"1"
					levelCurve=		"2"
					/>
			<Table>
				<Item chance="85" count="10d20" item="&itKM100Missile;"/>
				<Item chance="15" count="10d20" item="&itFragmentationMissile;"/>
			</Table>
		</Items>

		<Image imageID="&rsMediumShips3;" imageX="96" imageY="0" imageWidth="96" imageHeight="96" imageFrameCount="0" imageTicksPerFrame="0"/>

		<Events>
			<OnCreate>
				(sysAddObjRecurringTimerEvent 40 gSource "checkdist")
   			</OnCreate>
   			<checkdist>
    				;if the player and source are farther apart than 240 light seconds then make the Merchant dissapear. 
      				(if (gr (objGetDistance gSource gPlayerShip) 240)
      					(block Nil
						(objDestroy gSource) 
      					)
      				)
			</checkdist>
		</Events>
		
		<DockScreens>
			<Main
				name=			"=(objGetName gSource)"
				>


				<Panes>
					<Default
						desc=	"You are in the docking bay of a Pirate Merchant. Several bouncers greet your approach.">
						<Actions>
							<Action name="Buy items" imageID="&rsItemListScreen;" imageIndex="1" default="1" key="B">
								(block Nil
									(setq gPrevScreen "Main")
									(setq gMargin i10)
									(setq gShowCriteria "*U;")
									(scrShowScreen gScreen "&dsExchangeBuy;")
									)
							</Action>

							<Action name="Sell items" imageID="&rsItemListScreen;" imageIndex="1" key="S">
								(block Nil
									(setq gPrevScreen "Main")
									(setq gMargin 0)
									(setq gBuyCriteria "*NU -Military; -ID;")
									(setq gMaxPrice 10000)
									(setq gTitle Nil)
									(scrShowScreen gScreen "&dsExchangeSell;")
									)
							</Action>

							<Action name="Undock" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="U">
								<Exit/>
							</Action>
						</Actions>
					</Default>
				</Panes>
			</Main>
		</DockScreens>
		
		<DockingPorts>
			<Port x="0"		y="0" />
		</DockingPorts>

		
		<AISettings
			fireRateAdj=		"30"
			fireAccuracy=		"90"
			perception=			"4"
			combatStyle=		"standOff"
			/>

	</ShipClass>

Here's another question:

Code: Select all

(block Nil
   (setq gList (sysFindObject gPlayerShip "s B:auton; O:escort;"))
      (enum gList auton
         (objSetSovereign auton &svPirates;)
      )
)
How do I make the first three lines find ships of sovereign svPirates? I need that in order to prevent pirate encounters from attacking me.
Last edited by F50 on Wed Mar 05, 2008 2:38 am, edited 1 time in total.
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

as to your last question(also untested but should work)



EDIT: now i debugged and tested, it seems to be working, it left the pirate catches unaffected, yet the attacking viking gated out. it did nothing to the zulu however, it must be an outlaw?

Code: Select all

(block Nil
; find all ships in 100 light seconds of the player  
  (setq listofships (sysFindObject gPlayerShip "s N:100;"))
;flip through the list of ships found, use the variable "ship" to refer to each one
	(enum listofships ship
 ;if this ship is the pirate soverign and is attacking then do the contents of the block Nil
		(if (and (eq (shpGetOrder ship) 'attack) (eq (objGetSovereign ship) &svPirates;))
			(block Nil    ;contents: make the ship gate out
			(shpCancelOrders ship)
			(shpOrderGate ship)			
			)
		 )
      )
)  
it will: find every ship close to the player, then see if it is the pirate sovereign and ordered to attack(usually only the b-line ships are ordered to attack), and if so, make it gate out.

also, seen xelerus yet?
Last edited by Bobby on Tue Mar 04, 2008 11:19 pm, edited 4 times in total.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Yes, but I don't know enough about lisp to formulate a more complex statement yet. I am learning though. I can understand the details of the code you are writing now though.

Thanks bobby!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

Unfortunately your script simply orders all pirate ships to gate out. Trying to debug...
Bobby
Militia Captain
Militia Captain
Posts: 675
Joined: Wed Jul 25, 2007 7:39 pm

F50 wrote:Unfortunately your script simply orders all pirate ships to gate out. Trying to debug...
ok, my above post is now edited to show a debugged version.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

The Drake now sells and buys stuff!

All I have to do now is Pirate missions and pirate crime. This should be the hardest part, but at least now I have an understanding of the basics!
Post Reply