Quick Coding Question - Subordinates

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

spartanheyho
Posts: 162
Joined: Sun, 24. Nov 13, 16:06

Quick Coding Question - Subordinates

Post by spartanheyho »

When you use the subordinates function on ship A, such as:

Code: Select all

$shipA.subordinates
and you have squads of ships under the command of $shipA, does it count only squad leaders under the command of $shipA or does it count squad leaders under the command of $shipA and squad members under the command of squad leaders?
Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13126
Joined: Sat, 9. Nov 02, 11:45
x4

Post by Xenon_Slayer »

It should only include the direct subordinates of the commander. To include the ones lower down, you'd have to loop over the subordinates.
spartanheyho
Posts: 162
Joined: Sun, 24. Nov 13, 16:06

Post by spartanheyho »

So in a situation where squad A is under the command of ship A, the following:

Code: Select all

$shipA.subordinates
would only include the squad leader of squad A, correct?
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

erm.. if i understood you right - nope...

given this Hierarchy:

Code: Select all

+A
++B
|++C
| +D
++E
 ++F
  +G
subordinates of A would be B and E, subordinates of B would be C and D and subordinates of E would be F and G.
you just stated that the subordinate of A would be itself - which is plain wrong. (or i misunderstood you)

Also the Ship you ask for their subordinates (the leader) is not included in this List - if you also need him you have to include him.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
spartanheyho
Posts: 162
Joined: Sun, 24. Nov 13, 16:06

Post by spartanheyho »

Got it. Thanks for the help guys and gals. I was able to get my little project working.

Return to “X Rebirth - Scripts and Modding”