Page 1 of 8
Couple of questions...
Posted: Sat Aug 26, 2006 1:40 am
by Roberto
Hopefully someone can tell me the answers to these.
1. What AI instruction do I use to get a ship to launch a Q-mine?
2. How come I can't get a ship to generate escorts, when I've specified route1traderAI.plist (temporarily) as well as:
<key>escort-ship</key>
<string>gecko</string>
<key>escorts</key>
<integer>8</integer>
?
When I come to generate a new AI for it, I guess I'll use setUpEscorts - but I don't see why it's not working with route1traderAI, given that that's what, for example, the Anaconda uses. I am placing the ship way out of the normal space lane, but I don't see why that would be an issue. Also, I don't have "trader" as a role, but I doubt that's it.
Posted: Sat Aug 26, 2006 8:48 am
by Arexack_Heretic
1: several possibilities.
Code: Select all
<key>missile_role</key>
<string>QC_MINE</string>
<key>max_missiles</key>
<real>1</real>
<key>missiles</key>
<real>1</real>
have it attack only at a certain time...somehow.
Or:
Code: Select all
<key>death_actions</key>
<array>
<string>ejectItem: Qbomb</string>
</array>
Check the roles in the main shipdata.plist, I did this from memory.
Or:
You could even use scripted_actions and insert conditions somehow.
Posted: Sat Aug 26, 2006 8:53 am
by Arexack_Heretic
2:
You have to use
Code: Select all
<key>setup_actions</key>
<array>
<string>setUpEscorts</string>
</array>
ps: I think not having trader as role is EXACTLY it, some roles have hidden properties, such as traders having one of several AIs depending on location of generation and escorts. When making ships with custom roles, you have to code such stuff by hand. (Its not documented what thngs are hardcoded by role though) missile-type used to be too for thargoids (eg thargon), now they have to be defined as missile-role or -type.
Posted: Sat Aug 26, 2006 9:43 am
by Roberto
Yep, I already tried the setup_actions thing (in shipdata), so I guess it must be something to do with the trader role. Which I don't want to give it, as it'll be a mission ship. Hopefully using setUpEscorts in the AI will compensate.
Also, do you know if ejectItem will work in the AI? I had intended for the ship to eject a mine when it's low on energy, not as it explodes.
Posted: Sat Aug 26, 2006 3:40 pm
by Roberto
Well, setUpEscorts does the trick. Can't get it to launch the bomb from the AI, though. Have tried "ejectItem: qbomb" and "ejectItem: energy-bomb". Maybe our master and commander can advise me
*EDIT* One more thing - does anyone know how I can add heat shielding to a ship in shipdata?
Posted: Sat Aug 26, 2006 5:33 pm
by LittleBear
The missile role works as Ramon gave the Demon Class Cruiser 12 ECM hardened missiles with this wheeze in shipdata (a mission ship for our Assassins.oxp WIP). If you do a search of the Wiki there is a methods page which tells you the codes for all the equipment. (would post it but not at home, where I have it as a favourit!). Pretty sure it stars with EQ_ (both for the mine and the heat shield). Or (if the ship you fly has these items, check you save file to get the codes, there'll be under the Has Equipment bit).
Posted: Sat Aug 26, 2006 6:30 pm
by Roberto
Sadly, I do kind of want it to launch the Q-bomb at a specific moment - would spoil things if you attacked it and it randomly Q-bombed you off the bat. I'm assuming (since I remember Giles mentioning that NPCs occasionally drop the bomb) there must be a way of doing it in the AI.
Also, can you assign kit in shipdata using EQ_? I thought it had to be "has–something"...
Posted: Sat Aug 26, 2006 8:58 pm
by LittleBear
For kit, you do have to do it by:
<has_ECM> etc, but the wiki will page has a list of what the codes for all the has_stuff is. Looks like the shipdata wouldn't work to make it launch a Q-mine at a paticular moment, it would just make it launch a Q-mine instead of a missile. Think there is a way to do what you want in AI. Could you perhaps have somthing like ENGERGYLOW="setstate to LAUNCHMINE", then have LAUNCHMINE defined as ejectitem?
Posted: Sat Aug 26, 2006 9:09 pm
by LittleBear
PS: On the escorts, I found the code you've used did work but not all the time. Sometimes the ship had escorts and somthimes it didn't. Drove me up the wall! In the end I scripted to add the escorts by using in the script:-
check for ships : teamdef.
ships found less than 5 (I wanted 4 escorts)
addshipswithinRadius teamdef 4 [the co-ordinaters of the mothership] 150
That way, either the escorts turn up when called for by the motherships shipdata entry or if they didn't, the script adds 4 escortships within 150 meters of the mothership.
If you give the escorts escortAI they seem to escort the mothership, however they appeared, as long as you named them as the mother's escorts in the mother's shipdata entry. Try also using escort-role and then the role of your escort ship. If you want a gecko. Copy the gecko's shipdata into the oxp's shipdata. But give in the role "oxpescort" or whatever and give the special gecko escortAI in shipdata.
Posted: Sat Aug 26, 2006 10:04 pm
by Roberto
Cheers LB. The escorts are actually appearing (and escorting) fine with setUpEscorts in the AI - haven't got them attacking properly yet, but I'll come to that.
I've already tried "ejectItem: qbomb" in the AI as a response to ENERGY_LOW - can't get it to work (the ship sends a communication when it's low on energy, so I know it's reaching that point). I think perhaps only Giles knows the answer to this one.
Also, I'm looking at this page...
http://wiki.alioth.net/index.php/Shipdata.plist
...and I don't see a "has_" listing for the heat shield.
Posted: Sat Aug 26, 2006 10:42 pm
by LittleBear
Should have read your post better! What did you put in the AI as the set_up escorts bit (as could copy for mine!). Heat-shield might not be on the wiki as it is quite new. If you buy one and then check your save file, should be able to get it that way.
Escorts being tardy in the duties is somthing I've encounted too. They all seem to attack if you fire on one of them, but often ignore an attack on the mothership. It maybe somthing in the standard AI? In the end I made my escorts cops, but as the escorts were escorting an important witness, I could get away with them having ScanClass Police.
Think the list of equipment was under methods (or might have been script actions) rather than the shipdata page.
Posted: Sun Aug 27, 2006 10:49 am
by Arexack_Heretic
It's on the shipdata.plist page.
but whether Giles implemented a key for hasHeatShield is something only Giles can answer. probably not, but you never know.
Currently you can define ECM, escapepod, fuelinjectors, shieldboosters, cloakingdevice and scoop.
Posted: Sun Aug 27, 2006 2:10 pm
by Roberto
Actually, I think I can manage without the heat-shield thing - it's a "nice to have", but not an essential for what I'm doing. I am really keen to know how to trigger the Q-bomb from the AI, though. It's the difference between the NPC looking as if they maybe accidentally hit the wrong button and a calculated, ruthless act of aggression.
I've also got a slight problem with my escorts - the opposite to what LB describes! They *are* attacking when I attack the mothership, but if I attack one of them first, the mothership goes red but they all remain oblivious - even if I then subsequently fire on the mothership.
Here's part of the main AI for the mothership (each of the waypoint states is done in the same way), followed by the two escort AIs (main and fighting):
Code: Select all
"HEAD_FOR_WAYPOINT4" = {
ENTER = ("setCoordinates: pwm 1406207 46599 -677143", setDestinationFromCoordinates, "setDesiredRangeTo: 300.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.6", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: HEAD_FOR_WAYPOINT1");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, groupAttackTarget, "sendTargetCommsMessage: [shark-threat]", "setAITo: taranisSharkFightAI.plist");
ATTACKED = (setTargetToPrimaryAggressor, groupAttackTarget, "sendTargetCommsMessage: [shark-threat]", "setAITo: taranisSharkFightAI.plist");
"TARGET_FOUND" = (setTargetToFoundTarget, groupAttackTarget);
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "sendTargetCommsMessage: [shark-threat]", "setAITo: taranisSharkFightAI.plist");
UPDATE = (setDestinationFromCoordinates, checkCourseToDestination, "scanForNearestShipWithRole: thargoid", "pauseAI: 6.0");
EXIT = ();
};
GLOBAL = {
ENTER = (setUpEscorts, "setStateTo: HEAD_FOR_WAYPOINT1");
EXIT = ();
UPDATE = ();
};
Note: "thargoid" is a temporary measure, so I can see how it behaves when it doesn't spot me first. Am allowing for the possibility of the player having a cloaking device or (real future-proofing, this!) a long-range scanner - in those circumstances, want you to be able to observe the ships flying around.
Code: Select all
{
"FLYING_ESCORT" = {
ENTER = (performEscort);
ESCORTING = ("setDesiredRangeTo: 0.0", performEscort);
"NOT_ESCORTING" = ("setStateTo: LOOK_FOR_MOTHER");
ATTACKED = ("messageMother: ATTACKED");
EXIT = ();
"INCOMING_MISSILE" = (fightOrFleeMissile, "messageMother: INCOMING_MISSILE");
"TARGET_DESTROYED" = ("setStateTo: LOOK_FOR_MOTHER");
"TARGET_LOST" = ("setStateTo: LOOK_FOR_MOTHER");
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setAITo: taranisGeckoFightAI.plist");
UPDATE = (escortCheckMother, "pauseAI: 7.5");
};
"LOOK_FOR_MOTHER" = {
ATTACKED = (setTargetToPrimaryAggressor, "setAITo: taranisGeckoFightAI.plist");
ENTER = (scanForFormationLeader);
EXIT = ();
ESCORTING = ("setDesiredRangeTo: 0.0", "setStateTo: FLYING_ESCORT");
"TARGET_FOUND" = (setTargetToFoundTarget, suggestEscort);
"NOTHING_FOUND" = ("setStateTo: HEAD_FOR_WAYPOINT");
UPDATE = ("pauseAI: 7.5", scanForFormationLeader);
};
"HEAD_FOR_WAYPOINT1" = {
ENTER = ("setCoordinates: pwm 1398448 54128 -649486", setDestinationFromCoordinates, "setDesiredRangeTo: 300.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.9", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = ("setStateTo: LOOK_FOR_MOTHER");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, "setAITo: taranisGeckoFightAI.plist");
ATTACKED = (setTargetToPrimaryAggressor, "setAITo: taranisGeckoFightAI.plist");
UPDATE = (setDestinationFromCoordinates, checkCourseToDestination, "pauseAI: 6.0");
EXIT = ();
};
GLOBAL = {
ENTER = ("setStateTo: "FLYING_ESCORT");
EXIT = ();
UPDATE = ();
};
}
Now, I would have thought that an escort sending the message "ATTACKED" or "INCOMING_MISSILE" would cause the mother to send the message "GROUP_ATTACK_TARGET"...
I wonder whether, despite the fact that the mother is able to give orders to the escorts, the escorts don't know how to send a message back, because they haven't "selected" a mother - they just go straight into escorting... That's my best guess, so I'm gonna try altering that.
Code: Select all
{
"ATTACK_SHIP" = {
ATTACKED = (setTargetToPrimaryAggressor, "messageMother: ATTACKED");
"ENERGY_LOW" = ("setStateTo: FLEE");
ENTER = (performAttack);
EXIT = ();
"INCOMING_MISSILE" = (fightOrFleeMissile, "messageMother: INCOMING_MISSILE");
"TARGET_DESTROYED" = ("setStateTo: NEXT_TARGET");
"TARGET_LOST" = ("setStateTo: NEXT_TARGET");
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
UPDATE = ();
};
FLEE = {
"ENERGY_FULL" = ("setStateTo: ATTACK_SHIP");
"TARGET_LOST" = ("setStateTo: NEXT_TARGET");
"TARGET_DESTROYED" = ("setStateTo: NEXT_TARGET");
ENTER = ("setDesiredRangeTo: 25600", performFlee);
EXIT = ();
"INCOMING_MISSILE" = (fightOrFleeMissile, "messageMother: INCOMING_MISSILE");
UPDATE = ();
};
"NEXT_TARGET" = {
"MOTHER_LOST" = ("pauseAI: 25.0", "setAITo: taranisGeckoAI.plist");
"NOTHING_FOUND" = ("setAITo: taranisGeckoAI.plist");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
ENTER = (requestNewTarget);
EXIT = ();
"INCOMING_MISSILE" = (fightOrFleeMissile, "messageMother: INCOMING_MISSILE");
UPDATE = ();
};
GLOBAL = {
ENTER = ("setSpeedFactorTo: 1.0", "pauseAI: 2.0", "setStateTo: ATTACK_SHIP");
EXIT = ();
UPDATE = ();
};
}
Posted: Sun Aug 27, 2006 6:10 pm
by Roberto
Picked up two errors in the main escort AI, and changed the first line in FLYING_ESCORT to...
Code: Select all
ENTER = (escortCheckMother, performEscort);
...but it's made no difference. However, I've noticed the group do respond properly when I fire a missile at an escort (as opposed to lasering). Therefore the escorts can communicate with the mother - it's the message "ATTACKED" that doesn't seem to work. Anyone else experienced this?
Posted: Sun Aug 27, 2006 6:47 pm
by Roberto
Nope, I was wrong - I tested again and they responded to the *second* missile launch.
I officially don't get this!
Why doesn't sending the mother the message "ATTACKED" or "INCOMING_MISSILE" make it react as if it itself has received that message? That would seem to contradict what's in the AI how-to, unless I'm missing something.
Both ATTACKED and INCOMING_MISSILE in the mother's AI have groupAttackTarget in the list of responses. So, presumably this sends the message GROUP_ATTACK_TARGET back to the escorts, which should direct them to setTargetToFoundTarget and go to their fighting AI.
What gives?