Page 2 of 8

Posted: Sun Aug 27, 2006 6:48 pm
by LittleBear
Away for weekend at the moment so don't have Oolite available, but Won't it be easier to use escortAI? (see Giles's AIs)? A ship with escort AI will defend itself if attacked and will fly escorting the mothership, defending her if she is attacked, provided you define in the mother's shipdata that the escortships are your oxp escort ship.s EG: key <escort-role> <string>myescortship<\string>. Unless of course you want the escorts to do somthing other than flying in formation with the mother!

Posted: Sun Aug 27, 2006 7:12 pm
by Roberto
I tried escortAI - same problem. Also, regardless of the fighting, these ships aren't intended to behave as "standard escorts" anyway.

Also, I've been looking at escortAI to see if there's something I'm missing... and I don't see it.

Posted: Sun Aug 27, 2006 7:20 pm
by LittleBear
Odd!

Using escortAI my ecorts defend themselves well and will group attack if one of them is attacked. 9 times out of ten, they defend the mother, but occasionally sit there whilst you blast her!

Posted: Sun Aug 27, 2006 7:51 pm
by Roberto
I just tried replacing groupAttackTarget with fightOrFleeHostiles (as used in the route1traderAI) in the mother's main AI - still no dice! In fact, it made it worse - when I attacked the mother directly, only two of the escorts responded. Which is just weird.

Think Giles may be the only one who can help me on this. I'm pretty much out of ideas.

Posted: Sun Aug 27, 2006 8:06 pm
by Roberto
Yep, *now* I'm out of ideas!

I replaced the TARGET_DESTROYED and TARGET_LOST lines (under "FLYING_ESCORT" in the main escort AI) with a MOTHER_LOST line, just in case the escorts were reading TARGET_LOST and getting stuck in "LOOK_FOR_MOTHER" - not very likely, but hey. And of course, it didn't work.

Wish I had a big searchlight with the Oolite logo on it I could shine up into the sky :)

Posted: Sun Aug 27, 2006 8:18 pm
by Arexack_Heretic
try to do an object dumb debug when this is happening

to check whether the mother is getting stuck somewhere.

Also usefull to check for misspelt methods. :wink:

Posted: Sun Aug 27, 2006 8:44 pm
by Roberto
Hey there :) So how would I do that?

Actually, I'm pretty sure the mother isn't getting stuck - I've followed it as it flies between its various waypoints, and it responds as it should when it's attacked, triggering the escorts as well (the only problem is the Q-bomb issue). It even seems to respond properly when an escort is attacked. It's the escorts that are the problem: when I start by attacking one of them, they seem to refuse to go red - despite the fact that the mother goes red (indicating successful communication).

Posted: Sun Aug 27, 2006 8:53 pm
by LittleBear
under attacked you have setTargetToPrimaryAggressor,

try : "setTargetToPrimaryAggressor",

I wrote a AI that was meant to scan for Nearest ship with role and then atatck it. I tore my hair out cursing it as it refused to function at all until I put the the scanforNearestshipwithrole: erebel in quotes. I still have no idea why this made it work, but it worked perfectly as soon as put the command in ""s. Perhaps this is why the mother goes red but the escort doesn't attack. The commincation is quotes works, but the unquoted setTarget to PrimaryAgressor does not. Just an idea!

EDIT: Perhaps you also need a performattack here as well!

Posted: Sun Aug 27, 2006 8:59 pm
by Roberto
It's my understanding that you only need quotes if the instruction has a space or an underscore in it. So I think it's something elsewhere... elusive...

Posted: Sun Aug 27, 2006 9:02 pm
by LittleBear
I know. But when I wrote a "killplayer" AI, I just took ThargoidAI changed the ScanforNonThargoid (not in quotes) with ScanforNearestShipwithRole : player (not in quotes) and the ships just tumbled. Added the quotes and the ships attacked me without pity! I cannot think of any reason why this worked, but it did! :?

Posted: Sun Aug 27, 2006 9:04 pm
by Roberto
Because in that instance you had an instruction with a space in it :)

Posted: Sun Aug 27, 2006 9:07 pm
by LittleBear
Oh. Sorry stumped then! Perhaps add performattack.

Under the attacked bit, you don't seem to either have a "setAITo: taranisGeckoFightAI.plist"); or a SetStateto : ATTACK SHIP. Could this be why they message mummy (and she goes red), but don't attack themselves? The code only tells them to message mum?

EDIT:-
(I mean in this bit of the code)

Code: Select all

{ 
    "FLYING_ESCORT" = { 
        ENTER = (performEscort); 
   ESCORTING = ("setDesiredRangeTo: 0.0", performEscort); 
        "NOT_ESCORTING" = ("setStateTo: LOOK_FOR_MOTHER"); 
   ATTACKED = ("messageMother: ATTACKED"); 
        EXIT = (); 
I'm not brilliant at AI's but could this mean that when attacked whilst "Flying_Escort" the ships only messege mum, but don't attack themselves as they are not being told to?

Posted: Sun Aug 27, 2006 9:43 pm
by Roberto
If I added an attack command there, then that individual would probably attack - but the thing is, I need to get all of the escorts to attack. Which the mother should be telling them to do (via a groupAttackTarget command, sent back in response).

What's really confusing me is that after I start on the second or third escort, it *does* kick in. So it's *almost* working! Or working at least some of the time.

Posted: Sun Aug 27, 2006 9:45 pm
by LittleBear
Would MessageEscorts: ATTACKED be vaild? Or perhaps have a performGroupAttack at this point (I mean in the escort's AI). That should get them all attacking if one of their number is attacked.

Posted: Sun Aug 27, 2006 9:47 pm
by Roberto
I'm not sure the former is a valid command, and I've tried the latter.

I've just had a thought, though - maybe it's the pause...