Attack enemies in radius - UPDATE
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Attack enemies in radius - UPDATE
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.
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
-
- Posts: 1093
- Joined: Sun, 7. Dec 03, 05:32
- fuzzywuzzy
- Posts: 1272
- Joined: Sat, 23. Oct 04, 15:47
[ 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 |
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 |
just some suggestions as I take a quick look through this:
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
do that for each class priority list,
and then in the scan script:
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.
$enemy could be an array of up to five ships, I'm not certain line 112 will work correctly.
in attack:
you haven't defined $random yet
I'll keep looking through as I get a chance.
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.
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'
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'
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
in attack:
Code: Select all
003 [THIS] -> set command: COMMAND_ATTACK target=$target target2=$random par1=null par2=null
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.
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?
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.
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
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
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".What does it improve?
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
-
- Posts: 3698
- Joined: Fri, 9. Apr 04, 17:49
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
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.
----------------------
Since 2004 (X2), capping ships (without the whole boarding with trained marines complexity) is still my favorite thing to do.
----------------------
-
- Posts: 1940
- Joined: Sun, 8. Feb 04, 19:04