[SCRIPT] Group Management System

The place to discuss scripting and game modifications for X³: Reunion.

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

This script is...

pointless
1
1%
interesting, but I wont use it
5
7%
usefull
66
92%
 
Total votes: 72

wanderer
Posts: 278
Joined: Wed, 6. Nov 02, 20:31
x3tc

Grouping ships / combining differens ships

Post by wanderer » Thu, 19. Oct 06, 10:38

Hey moggy2,


had a problem, with combining groups of different ship types.
(Seems same as the feature request 'Creating groups of non-combat ships' on your Xai side).


Well what I want:
- Create a Battle group with M1, 2xM2, 3M6 + Moded M7,M8 (from XtendedMod)
- Create Trader Groups *xTS, TL,...
- Mixed Groups

As a solution I checked your code in 'plugin.Xai.grp.gms.setupGrp.cmd.xml'. There you had a code snipped 'setup ships currently in formation with us'. This I copied and changed (see here). Now, I can setup groups as I described above.

Here my additions:

Code: Select all

046   * setup ships currently in formation with us without filter
047   * -1 as count of ships to only use followers
048   if $amount == -1
049    $ships.list = [THIS] -> get formation follower ships
050    if  is datatyp[ $ships.list ] == DATATYP_ARRAY
051     append [THIS] to array $ships.list
052     $ships.list.num =  size of array $ships.list
053     $filter = Ship
054     while $ships.list.num
055      dec $ships.list.num = 
056      $ship = $ships.list[$ships.list.num]
057 @    = wait randomly from 100 to 150 ms
058   * DEBUG: Log the ship when it is assigned
059      $Ship.name = $ship -> get name
060      write to player logbook: printf: fmt='XAI Group Commands: Adding ship %s; to group %s, number %s', $Ship.name, $f.num, $ships.list.num, null, null
061      gosub setDetails
062     end
063    end
064    return null
065   end
066   
This changes has to be done BEFORE the code part '* setup ships currently in formation with us'. Also, you have to change the following parts a little bit:

Code: Select all

....
068   * setup ships currently in formation with us
069   if $amount > 0   <-- New!

and

135   *= wait null ms
136    return null
137   end  <-- New!
....
Here you need an IF because, your script goes down and tries to add even ships in the sector which are not following (eg. Nav.Sats :D ). As you see, normally you don't need the 4th input anymore, I set it fix to the type 'ship'. This I need because of your gosub routine, which checks the ship type.

How it works:
You define a ship taking some actions. Then you define followers. Use the command to setup group; Input: 'Name', 'Group number', now as 3rd '-1', 'ship' (will not be used, you can select every type).

With this only the followers now are in the group no other ships. So, now you have a defined Group eg. of traders, Battle ships, or mixed...
Be aware, all group members still get the command protect leader after the group is set - Here nothing is changed.

so long,
wanderer

PS: Some notes - I had some strange results while testing, so sometimes I got in the command 2 times the command slot :wink:
Also, using the missle plugIn - Only when I set the Missile Fire Probability from the leader it works. Setting it from a group member brings up some curious effects. No Missile Fire Probability will be set to the group, and the command for the group management disapears.
As with the naming, it would be cool, if you save the old name, and when deselecting the command for the group, rename the ship back to its original name.

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Thu, 19. Oct 06, 16:52

If I do that, you wont be able to create a group from 5 of your 10 newly bought Novas, without first launching one and telling 4 to follow it, the running the setup group command.

wanderer
Posts: 278
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by wanderer » Fri, 20. Oct 06, 14:08

Hi moggy2,


moggy2 wrote:If I do that, you wont be able to create a group from 5 of your 10 newly bought Novas, without first launching one and telling 4 to follow it, the running the setup group command.
Nop, because as in the code example above i use '-1' as 'How many ships?' (Variable: $amount) to go around the original ship selection code. When you are using 0,1,2 or more in the 3rd input parameter, the script is working as before. So you will get the Noves without the following order as well.

Well may be the if in the second example above should be 'if $amount => 0'. Will test it.

regards
wanderer

Hm, thinking...
I should point out more clearly, that above example is a dupplicate of your codesnipped 'setup ships currently in formation with us'. I dupplicated your code snipped BEFORE yours a second time, and changed it as described. So in case the $amount is -1, it goes only here. In case its 0,1 or greater it goes down to your code and processes as you want it.

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Fri, 27. Oct 06, 20:02

updated to allow groups to automatically resupply from carriers.

Puruco
Posts: 527
Joined: Tue, 6. Dec 05, 00:09
x3

Post by Puruco » Mon, 6. Nov 06, 17:04

I want to make a group of 1 Centaur 3 M3's and 3 M4's. I can only get in the group the Centaur (lider) and the M3's, not the M4's. How I can include them?

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Mon, 6. Nov 06, 17:21

if the M3's and M4's are following the Centaur. run the setup command on the centaur, and use ship as the class selector

Puruco
Posts: 527
Joined: Tue, 6. Dec 05, 00:09
x3

Post by Puruco » Tue, 7. Nov 06, 05:14

moggy2 wrote:if the M3's and M4's are following the Centaur. run the setup command on the centaur, and use ship as the class selector
Thanks moggy2...

Nosferato
Posts: 11
Joined: Sat, 29. Oct 05, 01:47
x4

Post by Nosferato » Thu, 14. Dec 06, 08:11

i installed the script and under the group managment system entry (8.)
the ones following are all buttons labelled 'text****-****'
i installed using cycrows script installer .. am i missing something?

Nosferato
Posts: 11
Joined: Sat, 29. Oct 05, 01:47
x4

Post by Nosferato » Thu, 14. Dec 06, 19:09


fud
Posts: 9837
Joined: Wed, 25. Jan 06, 14:26
x3

Post by fud » Thu, 14. Dec 06, 19:20

Looks like the text file is missing/corrupted to me.

Nosferato
Posts: 11
Joined: Sat, 29. Oct 05, 01:47
x4

Post by Nosferato » Thu, 14. Dec 06, 21:31

after doing some checks .. seems my scripts folder is all messed up
anyone know how to get back to vanilla without re-installing it?

User avatar
Sesk
Posts: 441
Joined: Fri, 17. Nov 06, 21:09
x4

Post by Sesk » Thu, 14. Dec 06, 23:03

How can i remove the name formatting for the groups ? I know you replied to this somewhere else but i lost it, and i tried it by memory but it didn't work so maybe you could refresh my mem ?

bunk
Posts: 136
Joined: Mon, 12. Jul 04, 11:30
x3

Group Mgmt

Post by bunk » Mon, 18. Dec 06, 04:20

Looks good. Does it work together with Terracorp Task Force?
Player of computer space games since 1975!

bunk
Posts: 136
Joined: Mon, 12. Jul 04, 11:30
x3

Xai Corp Ship commands

Post by bunk » Mon, 18. Dec 06, 07:21

Thank you for super ship and utility script commands. Well done.
Player of computer space games since 1975!

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Mon, 18. Dec 06, 15:02

Sesk wrote:How can i remove the name formatting for the groups ? I know you replied to this somewhere else but i lost it, and i tried it by memory but it didn't work so maybe you could refresh my mem ?
line 165 in plugin.Xai.grp.gms.setupGrp.cmd actually sets the name on the ships. Deleting or comenting out that line will prevent the ships being renamed.

Code: Select all

163   * Set displayed name
164    $ship.name = sprintf: pageid=$textpage textid=1001, $f.name, $f.num, $ship.shortname, $ship.number, null
165    $ship -> set name to $ship.name
166   end
167   endsub
168   return null

Jase555
Posts: 145
Joined: Fri, 13. May 05, 17:17
x4

Post by Jase555 » Sun, 14. Jan 07, 13:45

Thank you. Truly useful

jlehtone
Posts: 21809
Joined: Sat, 23. Apr 05, 21:42
x4

Re: [SCRIPT] Group Management System

Post by jlehtone » Thu, 25. Jan 07, 10:38

moggy2 wrote:3. Group Management System
- it handles the automatic resupply of energy for jumpdrives, missile and ammo, when docked at stations that sell the supplies.
You do have "Define Missile Loadout" command as separate package. But does that, or some other code, determine the desired loadout of fuel and ammo too? Ie, what are the defaults? 0?
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Re: [SCRIPT] Group Management System

Post by moggy2 » Thu, 25. Jan 07, 15:33

jlehtone wrote: You do have "Define Missile Loadout" command as separate package. But does that, or some other code, determine the desired loadout of fuel and ammo too? Ie, what are the defaults? 0?
no, there's nothing that can define those at the moment. Ammo is set to 5 units and energy is a case of "fill her up" once everything else has been loaded (but only if she has the require equipment, ie Mass driver or Jumpdrive).

If you've got suggestions on how this should change, fire away.

jlehtone
Posts: 21809
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Mon, 29. Jan 07, 09:00

It did look to me like there is a 1000 ECell fuel limit.


5 for MD ammo is fine as long as the ship has only one (turret) MD. But unless the ship can use only MD (Mamba R and Chimera turrets), it seems likely that one either has none or full deck. It may not make much sense to load a Centaur with 11 MD. Nova or Mamba with 8 frontal MD might be feasible. And if one does that, then 5 cases of ammo is not what one wants.

Maybe the script should count the installed MD's and have some ammo for each?

"Define Missile Loadout" stores data about a sample ship. It could store the ammo bit as well. Then the refuel code would use the stored value, if existent, or the default, if not. I know, it would not be intuitive to set MD ammo limit with missile-oriented script.

I guess one cannot have a "group" with only the leader? (Or maybe I can.) Because that would allow "default command" (ie Attack all) on single ships.
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.

jlehtone
Posts: 21809
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Thu, 8. Feb 07, 11:31

(Sorry for double, slow thinker)

The homebase setting (even if NULL) is copied from Lead to escorts. That is good. Could other properties be copied as well? I know there is GMM for setting Missile firing probability, but doing that as part of setup could be semi-intuitive. Wingman flag. Report when ready. Hue and saturation. Turret command(s). Yes, it could easily bloat into huge routine.

GMS runs in background. It does not check for script updates. So one has to stop/restart it everywhere if there is an update. Easy, if you have only one group. Less so with massive armadas. Another "overhead" routine.

The ship names are mostly static, set at Setup Group. Say, one could show homebase on the name, and then one manually changes homebase on individual ship. The name would become misleading. Yes, I'm in "useless overhead" mode. It may make sense on CAG/CLS like script to say things via shipname, but the thought of couple hundred fighters in the epic furball pondering what they are called this second is somewhat lagging.
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.

Post Reply

Return to “X³: Reunion - Scripts and Modding”