More Scripting Help Please!

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

Yup. I have more issues. :|

I'm setting up missions for Hell's Trinity and recently made a breakthrough using old Commonwealth Habitat Mission coding from Eridani.xml. After some hair-pulling I managed to get it working - the game chooses a random Ares station and tells the player to go kill out and destroy it -- only trouble is, it oftetimes chooses an already destroyed station.

I'm using:

Code: Select all

(setq enemyStations (sysFindObject gSource "tAN +HellAresOutpost;"))
I have gone through the Wiki and there are no Object paramteres for "not destroyed". So what are my options? How do I filter out stations that aren't destroyed?
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

I'm not entirely sure but isn't there a criteria that is "active"? If so, that would mean that it only finds active things, like ships or live stations. It might ignore stations.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

active "A" should be doing it

maybe try

Code: Select all

(setq enemyStations (sysFindObject gSource "tA +HellAresOutpost;"))
no "N"
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

Drako Slyith wrote:I'm not entirely sure but isn't there a criteria that is "active"? If so, that would mean that it only finds active things, like ships or live stations. It might ignore stations.
sdw195 wrote:active "A" should be doing it

maybe try

Code:
(setq enemyStations (sysFindObject gSource "tA +HellAresOutpost;"))


no "N"
I'm using "A"...I don't think that's working. "N" is just for nearest, but I'll remove that and try again. Do you want to see all the coding for the mission?
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

yes please that might help
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

Code: Select all

<HelpLevel1>
				<OnPaneInit>
				(block Nil
					; Construct a list of all enemy stations within a certain radius
					(setq enemyStations (sysFindObject gSource "tAN +HellAresOutpost;"))

									(switch
										; If there are no valid missions available, then nothing
										(not enemyStations)
											(scrShowPane gScreen "AllGood")

										; Give out a mission
										(block (target)
											(setq target (seededRandom (objGetDestiny gSource) enemyStations))
											(objSetObjRefData gSource "target" target)

											; Remember the nature of the target
											(switch
												(objHasAttribute target "HellAresOutpost")
													(objSetData gSource "missionID" 'aresOutpost)
				
											)
										)
									)
								
								
								(setq missionID (objGetData gSource "missionID"))
								(setq gTarget (objGetObjRefData gSource "target"))

								; Compute reward
								(setq gReward (add 500 (multiply (objGetLevel gTarget) 100)))

								; Compose message
								(scrSetDesc gScreen(cat
									"\"One, ey?. Well, better than nothing. I want you to go and do the same again - go take down this Outpost for me."
									"If you succeed I'll pay you " gReward " credits. Can you do that?\""
									))
								
						
								)
				</OnPaneInit>
					
				<Actions>
					<Action name="Accept" key="A" default="1">
								(block (targetCount totalMissionCount)
									; Target 
									(objRegisterForEvents gSource gTarget)

									; Order the player
									(shpCancelOrders gPlayerShip)
									(shpOrder gPlayerShip 'attack gTarget)

									; Set mission status
									(objSetData gSource "missionStatus" 'inProgress)
									(objSetGlobalData gSource "missionInProgress" True)
									(objSetData gSource "missionFee" gReward)

									; Keep track of total mission count
									(setq totalMissionCount (objGetGlobalData gSource "totalMissionCount"))
									(if (not totalMissionCount) (setq totalMissionCount 0))
									(objSetGlobalData gSource "totalMissionCount" (add totalMissionCount 1))

									(scrShowPane gScreen "MissionAccept")
									)
							</Action>

							<Action name="Decline" key="D" cancel="1">
								(scrShowPane gScreen "Refuse")
							</Action>
				</Actions>
			</HelpLevel1>
			<MissionAccept>
						<OnPaneInit>
							(scrSetDesc gScreen
								"\"Good, soldier! I'lll program the target into your ship's computer. Just follow the arrow on your screen and go give those Ares Hell! Good luck!\""
								)
						</OnPaneInit>

						<Actions>
							<Action name="Continue" key="C" default="1" cancel="1">
								<Exit/>
							</Action>
						</Actions>
					</MissionAccept>

					<MissionSuccess>
						<OnPaneInit>
							(block (desc fee missionID)
								(setq missionID (objGetData gSource "missionID"))

								(objSetData gSource "missionStatus" Nil)
								(objSetGlobalData gSource "missionInProgress" Nil)
								(shpCancelOrders gPlayerShip)
								
								(setq fee (objGetData gSource "missionFee"))
								(intMissionRewardPayment fee)

								(switch
									(eq missionID 'aresOutpost)
										(setq desc (cat 
											"\"Great work! Every blow against the Ares helps!"
											))

									)

								(scrSetDesc gScreen (cat
									desc
									" Here, I've deposited " fee " credits to your account.\""
									))
								)
						</OnPaneInit>
						
						<Actions>
							<Action name="Continue" key="C" default="1" cancel="1">
								(scrShowPane gScreen "Default")
							</Action>
						</Actions>
					</MissionSuccess>
					
					<!-- Mission is going on-->
					<MissionInProgress>
						<OnPaneInit>
							(block (missionID)
								(setq missionID (objGetData gSource "missionID"))

								(switch
									(eq missionID 'aresOutpost)
										(scrSetDesc gScreen
											"\"What's wrong? Are you going to kick those Ares's ass, or are they too tough for you? Get back out there and finish the job!\""
											)
									(scrSetDesc gScreen
										"\"What's wrong? You said you could handle this mission! Get back out there and finish the job!\""
										)
									)
								)
						</OnPaneInit>

						<Actions>
							<Action name="Continue" key="C" default="1" cancel="1">
								(block Nil
									(shpCancelOrders gPlayerShip)
									(shpOrder gPlayerShip 'dock (objGetObjRefData gSource "target"))
									(scrExitDock gScreen)
									)
							</Action>
						</Actions>
					</MissionInProgress>
Here ya go. No doubt it's riddled with bugs... >.>
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

Code: Select all

 <Actions>
                     <Action name="Continue" key="C" default="1" cancel="1">
                        (block Nil
                           (shpCancelOrders gPlayerShip)
                           (shpOrder gPlayerShip 'dock (objGetObjRefData gSource "target"))
                           (scrExitDock gScreen)
                           )
                     </Action>
                  </Actions>
are we being nice to the ares now O.o
why not use 'attack ?
-----------
apart from that it looks good :D
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

sdw195 wrote:

Code: Select all

 <Actions>
                     <Action name="Continue" key="C" default="1" cancel="1">
                        (block Nil
                           (shpCancelOrders gPlayerShip)
                           (shpOrder gPlayerShip 'dock (objGetObjRefData gSource "target"))
                           (scrExitDock gScreen)
                           )
                     </Action>
                  </Actions>
are we being nice to the ares now O.o
why not use 'attack ?
-----------
apart from that it looks good :D
Hm. I copied that over from George's stuff. I'll change it...
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

Another problem -- even when I do get sent to a real Ares Outpost, the game doesn't realise when it has been destroyed...it just keeps pointing to the outpost...

Can anyone see in the coding there why that wouldn't happen?
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Because you're telling the player to dock with it? You can dock with a dead station. You can't kill a dead station. That may be it. Also, I once built a mission, and it didn't recognize I had done it until I copied some effect data from a CSC telling itself when the mission was over. That could be your problem.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

Solved!

I'm an idiot. :roll: :roll:

I forgot to have:

Code: Select all

 <OnObjDestroyed>
				(switch
					(and (eq aObjDestroyed (objGetObjRefData gSource "target"))
							(eq (objGetData gSource "missionStatus") 'inprogress))
						(block Nil
							(objSetData gSource "missionStatus" 'success)
							(typIncGlobalData &stLincolnShipyards; "missionsCompleted")
							(objUnregisterForEvents gSource aObjDestroyed)
							(shpCancelOrders gPlayerShip)
							(shpOrder gPlayerShip 'dock gSource)
							(plyMessage gPlayer "Mission complete!")
							)
					)
			</OnObjDestroyed>
In the Events for the station that is giving out the mission...it's all fixed now! :D :D :D

Which puts Hell's Trinity another step forward! :mrgreen:
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

ThePrivateer wrote:Solved!

I'm an idiot. :roll: :roll:
your not an idiot..
your just mildly misinformed
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

sdw195 wrote:
ThePrivateer wrote:Solved!

I'm an idiot. :roll: :roll:
your not an idiot..
your just mildly misinformed
thanks. :oops:

I just need to remember to look at all of George's code when trawling through the XML's... -_-
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

yeah, that normally helps
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
Post Reply