But there's a problem; the patrol order makes them attack anything that gets near the star. 350 lightseconds away is not "near the star", so they just let me past this barrier they're supposed to be forming.
So I set up a script that detects any ships not of their faction within 350 ls, and orders their nearby ships to attack the intruders using shpOrder. This does not work- neither of the shpOrder functions in my script are having any effect whatsoever.
I made a test mod that does this in Eridani, creating several hundred Centauri raiders. Here's the file.
Here is the script (on the star object):
Code: Select all
<Events>
<OnCreate>
(block (i ship)
(sysAddObjRecurringTimerEvent 6 gSource "ShpOrderTimer")
)
</OnCreate>
<ShpOrderTimer>
(block (allWarlords allEnemies)
(setq allWarlords (sysFindObject Nil "s B:centauriWarlords;"))
(setq allEnemies (sysFindObject gSource "s -centauriWarlords; N:350"))
; display how many enemies are detected
;(plyMessage gPlayer (cat "enemies: " (count allEnemies) " centauriWarlords: " (count allWarlords)))
; set all centauri ships to patrol
(enum allWarlords theShip
(shpOrder theShip 'patrol gSource 300)
)
; for all detected enemies,
(enum allEnemies theEnemy
(block (nearbyWarlords)
; get nearby centauri ships that can attack
(setq nearbyWarlords (sysFindObject theEnemy "s B:centauriWarlords; N:40"))
;(plyMessage gPlayer (cat "nearbyWarlords: " (count nearbyWarlords)))
; and order them to attack
(enum nearbyWarlords theShip2
(shpOrder theShip2 'attack theEnemy)
)
)
)
)
</ShpOrderTimer>
</Events>
[EDIT] Yeah, I just noticed I have junk in my OnCreate event. It's irrelevant.