[Help/Advice] Creating Ships and Sending them to War

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

So, I'm back at work on Hell's Trinity and want to have a very simple little event, which would be:
A station creates several other ships and sends them off to fight a random enemy Station in the system.

I don't think this should be to hard, but as my experience with Trans LISP is almost, but not quite, entirely zero, I need some advice. I noticed RPC wants to do a similar thing, but I'm not doing this on a sovereign level and all I want is the ships to just fly straight to the enemy and attack. I want to make it clear that I will be custom making these ships so that they are designed to die. I dont' expect any ships to survive the suicide mission, but if they do, I want them to return home to the station that made them.

Is this hard? I assume it's achievable, but was hoping someone around here could give me some basic coding and/or advice. This would help lots!
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Code: Select all

(block Nil
     (setq theShip (sysCreateShip &scMyShip; (objGetPosition gSource) &svMySov;))
     (setq theTarget (sysFindObject gSource "[[criteria]]"))
     (shpOrder theShip 'attack theTarget)
     (shpOrder theShip 'barrelRoll)
     (shpOrder theShip 'gaurd gSource)
)
That's a simple script + command queue that spawns a ship at the position of the station, finds another space obj according to criteria you can set, and then queues the orders to Attack the target, Do a Barrel Roll, and then Guard the station (which involves returning to the station).

Thats just a little sample of what you can do with it, obviously you can get more complex by spawning more ships, or even assigning them to a wing leader, etc. Though you'd have to take into account more things with those situations..


(the barrelRoll part was a joke btw, that's not actually a valid order)
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
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 also have this code in the station:

Code: Select all

<Construction maxConstruction="however many of the following choices you want" constructionRate="Typically around 400-500, depends" >
<Table>
  <Ship chance="number" count="number" class="&scShipClass" orders="attacknearestenemy"/>
</Table>
</Construction>
That makes a ship of that type every so often then tells them to attack the nearest enemy. I find it useful for that kind of thing. The code is in an Ares Shipyard if you want to look for yourself.
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
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

That would cause them to go after ships though :/

The fact you can define target parameters in here makes it a good deal more powerful.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
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:

That's true I guess. Perhaps in some future release George could include in the ship field

Code: Select all

orders="attack" targetCriteria="criteria"
Then you wouldn't have to do the scripting.
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

Wolfy wrote:

Code: Select all

(block Nil
     (setq theShip (sysCreateShip &scMyShip; (objGetPosition gSource) &svMySov;))
     (setq theTarget (sysFindObject gSource "[[criteria]]"))
     (shpOrder theShip 'attack theTarget)
     (shpOrder theShip 'barrelRoll)
     (shpOrder theShip 'gaurd gSource)
)
That's a simple script + command queue that spawns a ship at the position of the station, finds another space obj according to criteria you can set, and then queues the orders to Attack the target, Do a Barrel Roll, and then Guard the station (which involves returning to the station).

Thats just a little sample of what you can do with it, obviously you can get more complex by spawning more ships, or even assigning them to a wing leader, etc. Though you'd have to take into account more things with those situations..


(the barrelRoll part was a joke btw, that's not actually a valid order)
Thanks Wolfy...this could be a silly question but where does this go? <Events>, right?

And what 'Criteria' would an Ares Outpost be?

Thanks in advance! :D
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

You would want.... I think "aNTE +ares" - that /should/ select the closest living alive ares station, if T=station. I'm pretty sure it does.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

In your station you'll need two events:

Code: Select all

<Events>
  <OnCreate>
    ;; start a timer that runs every 100 secs to send out ships
    (sysAddObjRecurringTimerEvent 1500 gSource 'Attack)
  </OnCreate>
  <Attack>
    ;; spawn code goes here
  </Attack>
</Events>
As for finding an appropriate target:

Code: Select all

(setq target (random (sysFindObject nil "tA+AresMajor")))
Will find a random station with the attribute AresMajor
NOTE: if no valid target exists the ships will either pile up (frozen with no orders) or simply gate out, so I would reccomend you check for a target BEFORE spawning the ship
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Oh, the attribute for ares stations is AresMajor? >.> I mus'tve changed it in TSB.
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
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:

"Ares" is for all ares stations, "AresMajor" is for shipyards and Communes.
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

OKay, thanks for all the help so far guys, but I have a problem.

Code: Select all

<Events>
		<OnCreate>
   		(sysAddObjRecurringTimerEvent 1500 gSource 'Attack)
		</OnCreate>
		<Attack>
		(block Nil
     (setq theShip (sysCreateShip &scCenturionX; (objGetPosition gSource) &svCommonwealth;))
     (setq theTarget (sysFindObject gSource "tA+HellAresOutpost"))
     (shpOrder theShip 'attack theTarget)
     (shpOrder theShip 'guard gSource)
)
		</Attack>
</Events>
That's what I have. The Centurion is being created at a completely unrelated station from where the <Event> is in. It is being created at the center of the sun and then flying straight to the Commonwealth Station where the coding is. Without attacking or doing anything.

I'm guessing something (setq theShip (sysCreateShip &scCenturionX; (objGetPosition gSource) &svCommonwealth;)) here is going wrong? :?

BTW "HellAresOutpost" is one of the Attributes my Ares stations have -- they are modded Ares Stations from the Vanilla game.
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 might have found it.

Code: Select all

<Events>
      <OnCreate>
         (sysAddObjRecurringTimerEvent 1500 gSource 'Attack)
		 (sysAddObjRecurringTimerEvent 100 gplayership "Success")<-- example from Xelerus
      </OnCreate>
      <Attack>
      (block Nil
		 (setq theShip (sysCreateShip &scCenturionX; (objGetPosition gSource) &svCommonwealth;))
		 (setq theTarget (sysFindObject gSource "tA+HellAresOutpost"))
		 (shpOrder theShip 'attack theTarget)
		 (shpOrder theShip 'guard gSource)
			)
      </Attack>
</Events>
Basically 'Attack needs to be "Attack" based off of the Xelerus example.
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
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

:(

still not working RPC...I can't make heads or tails of it. Now with your coding, the ships aren't even being created! :|

edit:

Code: Select all

<Events>
      <OnCreate>
	  (block Nil
       (sysAddObjRecurringTimerEvent 100 gSource 'Attack)
       (sysAddObjRecurringTimerEvent 100 gplayership "Success")
	   )
      </OnCreate>
      <Attack>
      (block Nil
       (setq theShip (sysCreateShip &scCenturionX; (objGetPosition gSource) &svCommonwealth;))
       (setq theTarget (sysFindObject gSource "tA+HellAresOutpost"))
       (shpOrder theShip 'attack theTarget)
       (shpOrder theShip 'guard gSource)
         )
      </Attack>
</Events>
Ships spawning now, but at the sun still.
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?

Privateer: Don't add

Code: Select all

(sysAddObjRecurringTimerEvent 100 gplayership "Success")
. It was just the example I got off of Xelerus. The only change I made was to add the "" around the event. The reason why it didn't work the 1st time was because the <-- should have been <!--whatever I said --> so that Trans would ignore it.
Last edited by RPC on Sat Mar 12, 2011 7:19 am, edited 1 time in total.
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
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

RPC wrote:Privateer: Don't add

Code: Select all

(sysAddObjRecurringTimerEvent 100 gplayership "Success")
. It was just the example I got off of Xelerus. The only change I made was to add the "" around the event.
Doesn't change a thing - the Ships still spawn at the center of the sun and fly straight to this station. Without doing anything else. Just to check, I have these attributes for my Ares Station:

Code: Select all

attributes=			"enemy,envAir,envEarth,envFire,envWater,populated,HellAresOutpost,ares"
I have to go for the night anyway -- if anyone solves it please post and I'll check it out in the morning. Thanks to everyone for helping out! :D
Post Reply