Attack enemies in radius - UPDATE

The place to discuss scripting and game modifications for X²: The Threat.

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

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Attack enemies in radius - UPDATE

Post by stella » Wed, 22. Dec 04, 22:02

This script will order the ship running it to attack all enemy ships within a specified radius. The ship will return to its' starting point if there are no enemy ships within the specified range, or when they have all been destroyed.

If an enemy ship being attacked flies beyond the specified range, the ship will break off its' attack and return to its' start position.

It also contains rudimentary target prioritisation (see the readme [English only atm]).

Starting point can be in space, or a station (ship will dock/undock).

Good for station defence, sectors with HENs, blockading sectors.

Especially good for holding X472.

This script has already been submitted for signing, but feedback (for tweaks) would be nice.

Thanks to Matthew Farmery for hosting.
Last edited by stella on Wed, 29. Dec 04, 01:30, edited 1 time in total.
Attack enemies in radius -here

Dungeoncrawler
Posts: 1093
Joined: Sun, 7. Dec 03, 05:32
x3tc

Post by Dungeoncrawler » Wed, 22. Dec 04, 23:01

You script people are so kewl! I only currently use official scripts, but sounds like a great one! Keep up the wonderful work. Everyone appreciates it, allot!

Dc/Gary

p.s. Happy Holidays

User avatar
fuzzywuzzy
Posts: 1272
Joined: Sat, 23. Oct 04, 15:47
x3tc

Post by fuzzywuzzy » Wed, 22. Dec 04, 23:58

Sounds cool! Might be useful for those sectors with the hull-eating nebulas.

User avatar
Aro
Posts: 2766
Joined: Tue, 15. Jul 03, 00:35
x4

Post by Aro » Thu, 23. Dec 04, 00:26

Sounds good.

You can always put it up at www.xscripting.com :D
[ external image ]
The end of a trilogy does not mean an end to a series.
| Vanilla with strawberries? [List of Vanilla safe mods.] | Tired of the plots? [Plot Skipper Tool v0.5] |
| X3: R & TC Minimaps |

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek » Thu, 23. Dec 04, 00:44

just some suggestions as I take a quick look through this:

Code: Select all

004   if [THIS] -> is of class Destroyer M2
005    $target.priority =  array alloc: size=12
006    $target.priority[0] = Small Transport TS
007    $target.priority[1] = Passenger Transport TP
008    $target.priority[2] = Pirate Transport TS
etc.
rather than doing this, make a few permanent lists in the init.xml script (which you should rename to setup.xml by the way)
something like:
in setup.xml

Code: Select all

$AER_M2_priority = array alloc: size=12
set the values ...
$AER_M2_priority = set global variable, name='AER_M2_priority'
do that for each class priority list,
and then in the scan script:

Code: Select all

004   if [THIS] -> is of class Destroyer M2
005    $target.priority =  get global variable, name='AER_M2_priority'
that way you don't have to keep redefining the arrays, just define them once and load them in

You might mention in the readme that it only currently works for M1, M2, M3, M4, M5, M6.

Code: Select all

076   $flags = [Find.Enemy] | [Find.Nearest] | [Find.Random] | [Find.Multiple]
108      $enemy =  find ship: sector=[SECTOR] class or type=$target.type race=null flags=$flags refobj=[THIS] maxdist=$range maxnum=5 refpos=$arefpos
112       $distance = $enemy -> get distance to: position array=$arefpos
$enemy could be an array of up to five ships, I'm not certain line 112 will work correctly.

in attack:

Code: Select all

003   [THIS] -> set command: COMMAND_ATTACK  target=$target target2=$random par1=null par2=null
you haven't defined $random yet

I'll keep looking through as I get a chance. :)
Last edited by Burianek on Thu, 23. Dec 04, 00:58, edited 1 time in total.
"Nature's first green is gold" . . . stay golden.

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Thu, 23. Dec 04, 00:55

I'll get those changes done.

Rather than keep coming back to you, I'll wait till I get an exhaustive list, then send you the whole lot.

Cheers.
Attack enemies in radius -here

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek » Fri, 24. Dec 04, 00:54

no prob.
You can keep looking through / testing / debugging on your own as well :)
You know how to use the in game script debugger? (trace, log, etc.)
I haven't had a chance to look at the attack script at all, is it a version of the regular fight.attack.object script with timed breaks thrown in? or did you develop it yourself?
"Nature's first green is gold" . . . stay golden.

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Fri, 24. Dec 04, 07:13

hold fire for the moment. I had an idea, that if the "start " coordinates are a station (having to write a new lib procedure), the ship would dock, kill enemies, then dock again (if allowed and possible, and I'm testing that atm.

Don't want you to go through all that crap, then get presented with code that looks sod all like the copy you have.

I know I said I'l l wait for an exhaustive list, but thinking about it, send me anything as, and when. I'll incorporate as I go along

[EDIT]

I just realised, that I totally contradicted myself there.

Still, it's 6:15am, and I'm gattered :)
Attack enemies in radius -here

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Wed, 29. Dec 04, 01:32

New version uploaded
Attack enemies in radius -here

User avatar
fuzzywuzzy
Posts: 1272
Joined: Sat, 23. Oct 04, 15:47
x3tc

Post by fuzzywuzzy » Sun, 2. Jan 05, 03:18

What does it improve?

Galaxy613
Posts: 3285
Joined: Tue, 28. Dec 04, 02:19
x4

Post by Galaxy613 » Sun, 2. Jan 05, 22:40

Very awesome sounding and I just downloaded it mostly for tearing apart and learning new techeniqes.

And you should include a update log with the update posts.
10,000 Lightyears of awesomeness

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Mon, 3. Jan 05, 04:00

What does it improve?
If the coordinates you supply are within 100m of a station, the ship will try to dock there. When enemies come into range, it will undock, kill them, and dock again. If it can't land, or doesn't have permission, it will get as close as it can, and "hover about".

This way, you can stick a few M3's on a station, and have them protect it.

I know you can do this by setting the station as their homebase, but they'll still go right across the sector.
Attack enemies in radius -here

matthewfarmery
Posts: 3697
Joined: Fri, 9. Apr 04, 17:49
x3

Post by matthewfarmery » Mon, 3. Jan 05, 14:52

Which is why I am using it now, very good script Stella keep up the good work
=

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Mon, 3. Jan 05, 15:39

Thank you very much.
Attack enemies in radius -here

Xmaestro
Posts: 134
Joined: Fri, 30. Jul 04, 21:08
xr

Post by Xmaestro » Fri, 7. Jan 05, 06:23

Mmmh. Sounds like the game definitely needs this: I once found my OOS ships 9218KM away from the edge of the visible area.... They followed a single quick Khaak all the way around the planet in President's End....

How stupid can you get...

I guess your script will prevent this from ever happening again?
I wonder why your script isn't a signed one, considering it solves an exceptionaly obvious flaw in the game...

Xmaestro
----------------------
Since 2004 (X2), capping ships (without the whole boarding with trained marines complexity) is still my favorite thing to do. :)
----------------------

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Fri, 7. Jan 05, 13:11

Yes, it solves this problem.

I't's also good for sectors with HEN's, for station defence, and for keeping the shipyard in X472 out of the way.

It's been submitted for signing. I'm waiting for them to respond.
Attack enemies in radius -here

Xmaestro
Posts: 134
Joined: Fri, 30. Jul 04, 21:08
xr

Post by Xmaestro » Fri, 7. Jan 05, 15:17

I will give it a try and come back to you. Can you tell me what HEN stands for? Thanks.

Xmaestro
----------------------
Since 2004 (X2), capping ships (without the whole boarding with trained marines complexity) is still my favorite thing to do. :)
----------------------

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Fri, 7. Jan 05, 16:17

HEN - Hull Eating Nebula.

It does what it says on the tin. If a ship shops in one, its' hull will be damaged, and eventually, it'll be destroyed.

All feedback/suggestions/ideas for improvement gladly accepted.
Attack enemies in radius -here

KarlHemmings
Posts: 1940
Joined: Sun, 8. Feb 04, 19:04
x4

Post by KarlHemmings » Sat, 8. Jan 05, 12:59

Just wanted to say that I am keeping an eye on development of this script as well :thumb_up:

(I used to be a trader only - now I am into war)

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Sat, 8. Jan 05, 13:59

It's up for signing as is.

any feedback or suggestions re enhancements welcome
Attack enemies in radius -here

Post Reply

Return to “X²: The Threat - Scripts and Modding”