Dynamic Systems

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

In the OnDestroy event you can use gSource to access the object and aWreckObject to access the wreck. Again, this info is on the wiki:

http://wiki.neurohack.com/transcendence/wiki/events

Are you trying to prevent the station from being destroyed? If so, then perhaps you should use OnDamage instead?
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?

Does anyone know how to use constructionrate on a CSC station?--- i don't think it works because it is a ship in a stationtag.
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.
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:

You could try making the construction on the marker. If the ship moves, it could cause problems but if you remove the code for the ship moving then it will look like the ships are coming from the CSC.
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
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Just use a timer event on the CSC.
Literally is the new Figuratively
User avatar
stealthx
Militia Lieutenant
Militia Lieutenant
Posts: 127
Joined: Thu Jan 21, 2010 3:45 am
Location: At the edge of chaos (sovereign)

RPC wrote:Aparrently Bobby didn't write the mining auton, it's Apemant. So can I just use the code and give him credit? (I pm'ed him anyway- he last visited the forums on Mon Jun 07, 2010, so he should still be around. )
That's when he gave me permission to use the scripts from his mining auton, iirc. I believe he would be happy to let you use; he even said he won't mind if credit is not given!
Be the hope of humanity. Be a Gundam Meister.
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?

Just wondering, but can I do this?

Code: Select all

(block level
				(setq level (objGetData gSource "RPCCWRetaliate"))
				(switch
					;CW
					(not (ls (subtract level 2) 1))
						(block Nil
							(objSetData gSource "RPCCWRetaliate" (subtract level 2))
							(setq something (objGetData gSource "RPCCWRetaliate"))
							(plyMessage gPlayer "The Commonwealth retaliation level decreased to "something"!")
							)
					)
				)
to:

Code: Select all

(block level
				(setq level (objGetData gSource "RPCCWRetaliate"))
				(switch
					;CW
					(not (ls (subtract level 2) 1))
						(block Nil							
							(setq something (objSetData gSource "RPCCWRetaliate" (subtract level 2)))
							(plyMessage gPlayer "The Commonwealth retaliation level decreased to "something"!")
							)
					)
				)
The main change is from

Code: Select all

            (objSetData gSource "RPCCWRetaliate" (subtract level 2))
				(setq something (objGetData gSource "RPCCWRetaliate"))
to

Code: Select all

(setq something (objSetData gSource "RPCCWRetaliate" (subtract level 2)))
I was wondering if I can use that way so I can both set something as well as set RPCCWRetaliate.
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.
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 think so yes. Script is all about returns, so as long as it returns what you want to be set in setq, it should work.
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
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

RPC wrote:

Code: Select all

(setq something (objSetData gSource "RPCCWRetaliate" (subtract level 2)))
Yes, tscript is all about nesting expressions. What you need to be sure of when doing this, is what each expression returns.
So, `subtract` returns the value of the subtraction (of course), but what does `objSetData` return? It could return the value it is setting, or it could return `true/nil`. If it does not return the value, then the above expression would not work as intended. To find out what a function returns, you can either check it on the functionlist, xelerus, or even better, test it with a `dbgLog`.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

RPC wrote:1.If I can't build stations, how am I going to increase a sov's presence in the system?
I wanted to build stations, but as you noted earlier, station-building is too long an enterprise for the timescale of the game (I know gameplay trumps all, but I wanted to stick to George's ideal of realism, just like when inertia really shook me the first time I played Trans.)
I don't quite understand why station-building is too long of an enterprise for the timescale of the game. In the present day, we build a space station by constructing "modules" on the ground and then sending them up. The actual sending them up bit takes hours, not weeks.

If you noticed, the korolov station is more than half complete when you do the quest in Charon, and they were building pieces onto a wreak, not simply piecing large station bits together.
I just realized that if I let sovereigns create new stations, the whole system might be dotted with abandoned stations (and consequently, more places to hide).
Is there some way to make the abandoned station destroyable?
My guess is it would not be destructible by normal means. I suggest that if a sovereign wanted to blow up an enemy station (don't want to leave a wreak to rebuild from), they would just send a transport with some explosives, fill the station with with them, and let it rip. It wouldn't be that hard to script a transport going to a station wreak, docking with it, and then 10 seconds later set an event to remove the station and place a large explosion where it used to be.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

alterecco wrote:
RPC wrote:

Code: Select all

(setq something (objSetData gSource "RPCCWRetaliate" (subtract level 2)))
I don't remember what objSetData returns (it might return True/Nil).

But this will definitely work:

Code: Select all

(objSetData gSource "RPCCWRetaliate" (setq something (subtract level 2)))
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 need help. I have the retaliation event and the retaliation event handler, but I can't seem to store the ship order nor the target of the attacker.
The respective codes are here:
Retaliation event:

Code: Select all

<CWRetaliate>
			(block Nil
				;make destroyable before switch
				(staSetStructuralHP aWreckObj 100)
				; if it is CW, then don't invoke:
				(switch
					(and
					; TODO:
					; how do you stop it from attacking against a dead ship's explosion?
					;no CW vs Nil [dead ship's explosion]
					(not (eq (objGetSovereign aDestroyer) Nil))
					;no CW vs CW
						(not (eq (objGetSovereign aDestroyer) &svcommonwealth;))
					;no CW vs CWfleet					
						(not (eq (objGetSovereign aDestroyer) &svCommonwealthFleet;))
					;no CW vs CWfleet assasins
						(not (eq (objGetSovereign aDestroyer) &svFleetAssassins;))					
					;no CW vs Corp- although it would be cool!
						(not (eq (objGetSovereign aDestroyer) &svCorporate;))
					;It would be weird if the CW attack your auton but not you
						(not (eq (objGetSovereign aDestroyer) &svFriendlyAuton;))
					;no CW vs Ringers
						(not (eq (objGetSovereign aDestroyer) &svRingers;))
					;no CW vs Ferians either- I'm not letting the player off that easily!--- make a special retaliation for angry ferians that also targets player!
						(not (eq (objGetSovereign aDestroyer) &svFerianMiners;))
						(not (eq (objGetSovereign aDestroyer) &svFerianMinersAngry;))
						)
					(block (Retaliationshiptype pos sov theLeader cnt name CSC level)
						(objIncData gSource "RPCCWRetaliate" 5)
							(setq level (objGetData gSource "RPCCWRetaliate"))
							(switch
								;syslevel first
								(leq (sysGetLevel) 4)
									;retaliationlevel
									(switch
										(leq level 9)
											(block Nil
											(setq Retaliationshiptype &scRoninC;)
											(setq cnt 5)
												)
										(and (geq level 10) (leq level 13))
											(block Nil
											(setq Retaliationshiptype &scIAVMedium;)
											(setq cnt 5)
												)
										(and (geq level 14) (leq level 20))
											(block Nil
											(setq Retaliationshiptype &scIAVHeavy;)
											(setq cnt 5)
												)
										(and (geq level 21) (leq level 25))
											(block Nil
											(setq Retaliationshiptype &scManticore;)
											(setq cnt 5)
												)
										;If none of the above apply,
											(block Nil
											(setq Retaliationshiptype &scBritannia;)
											(setq cnt 5)
												)
										)
								(geq (sysGetLevel) 5)
									(switch
										(leq level 5)
											(block Nil
											(setq Retaliationshiptype &scCenturion;)
											(setq cnt 5)
												)
										(and (geq level 6) (leq level 9))
											(block Nil
											(setq Retaliationshiptype &scCenturionX;)
											(setq cnt 5)
												)
										(and (geq level 10) (leq level 17))
											(block Nil
											(setq Retaliationshiptype &scBritannia;)
											(setq cnt 5)
												)
										(and (geq level 18) (leq level 24))
											(block Nil
											(setq Retaliationshiptype &scDSAquilaCruiser;)											
											(setq cnt 2)
												)
										;NOTE: IMPLEMENT BELOW!!
										;if CSC was sent, don't send another one--
										
										;If none of the above apply,											
										(block Nil
											(setq Retaliationshiptype &scCSCHQ;)
											(setq cnt 1)
												)
										)
								)
							
							<!-- I'll put this away for now- I'll let it escalate as necessary- b/c I can't compare 2 ships w/o creating them
							;; determine what the combat power of the destroyer is
							(setq power (objGetCombatPower aDestroyer))
							;; pick a shiptype [renamed as to not conflict w/ Trans] thats determined by the destroyers strength
							(switch
								(leq power 10)
									(setq RetaliationB &scRoninC;)
								(leq power 25)
									(setq RetaliationB &scCenturion;)
								(leq power 50)
									(setq RetaliationB &scManticore;)
								(setq RetaliationB &scBritannia;)
								)
							(switch
								(ls)
								)
							-->
							;; decide where the reinforcements are coming from- here we use the nearest gate
							(setq pos (sysFindObject nil "GN"))
							
							;; determine what soverign the ships will have, (here we use the sov of the destroyed station)
							(setq sov (objGetSovereign aObjDestroyed))
							
							(setq theLeader (sysCreateShip Retaliationshiptype pos sov))
				;here is the inserted code to get fleets
							;give retaliation ship this event
							(objSetEventHandler theLeader &evRetaliationEventHandler;)
								;set the teamLeader status
								(objSetData theLeader "teamLeader" true)
								;get ShipOrders from previous leader
									;ObjSetData- what?
										;order
										(objsetdata theLeader "shipOrder" 'attack)
										;target
										(setq test (objsetdata theLeader "orderTarget" (objgetid adestroyer)))
										(plyMessage gplayer "what is "test"?")
							;order the leader to wait so the squad forms up-- taken from evStdConvoyEncounterBehavior
							(shpOrder theLeader 'wait 10)
				
							
							;; order the leader to attack the destroyer then gate out
							(shpOrder theLeader 'attack aDestroyer)
					
							(shpOrder theLeader 'gate)
							
							;; in case the single ship is not enough, spawn more ships
							(if cnt
								(for i 1 cnt
									(block (ship)
										(setq ship (sysCreateShip Retaliationshiptype pos sov))
										
					;here is the inserted code to get fleets
											(objSetEventHandler ship &evRetaliationEventHandler;)
											
											(shpOrder ship 'escort theLeader)
											(shpOrder ship 'gate)
										)
									)
								)
							(setq name (typGetDataField (objGetSovereign aDestroyer) 'name))
							(plyMessage gPlayer "The CW Retaliate against the "name"!")							
						)
					)
				)
		</CWRetaliate>
Retaliation event handler:

Code: Select all

<!--Retaliation Event Handler-->

	<ShipClass UNID="&evRetaliationEventHandler;"
			class=				"(Retaliation Event Handler)"
			virtual=			"true"
			
			attributes=			"behaviorClass"
			>
			
		<Events>
			;give retaliation ship this event
			;set the teamLeader status
			;get ShipOrders from previous leader
				;ObjSetData- what?
					;order
					;target
			<OnDestroy>
				;; check if this ship is the leader
				(if (objGetData gSource "teamLeader") 
					(block (escorts prevOrder prevTarget)
						;; get the ships currently escorting destroyed ship
						(setq escorts (sysFindObject gSource "sO:escort"))
						
						;prev orders + target
						(setq prevOrder (objGetData gSource "shipOrder"))
						(setq prevTarget (objGetData gSource "orderTarget"))
						
						;; only proceed if we have any escorts left
						(if escorts 
							(block (newleader)
								;; the first becomes the new leader
								(setq newleader (item escorts 0))
								;; designate the ship as teamLeader
								(objSetData newleader "teamLeader" true)
								;; give the new leader some useful order
								;; (cancel any previous ones first)
								(shpCancelOrders newleader)
								<!--until I figure out how to get the target and order from the event, I'll stick to this-->
								(shpOrder newleader 'attackNearestEnemy)

								;; if there are any more ships, tell them to escort newleader
								(enum (subset escorts 1) s 
									(block nil
										(shpCancelOrders s)
										(shpOrder s 'escort newleader)
										)
									)
								)
							)
						)
					)
			</OnDestroy>
		</Events>
	</ShipClass>
I'll clean it up if people find too much junk in the code.
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.
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?

To further simplify, I need to transfer data from the <whateverEvent> such as shpOrder and Target so that the event handler can use it. Here is my current strategy:
<event> stores data using objSetData onto theLeader ship and the event handler uses objGetData to get the shpOrder and Target.
The problem is that objSetData sets the shpOrder and the Target as "true" and not what I want them to be. I'm thinking about switching to setq instead.
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.
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:

You can use (objSetObjRefData whereIt'sStored shipYouWantToStore).
It works the same as (objSetData) but (objSetData) can only store strings and variables, not objects.
I'm not sure if that's what you mean, but it might help transferring one object to another.
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?
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 used

Code: Select all

(setq test (objSetObjRefData theLeader "orderTarget" (objgetid adestroyer)))
										(plyMessage gplayer "what is "test"?")
and still got "true".
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.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

if you read my previous response, you'll see that objsetdata returns True/Nil. That explains your result. Try what Isuggested and see if it helps.
Post Reply