First I apologize for coming across too harshly. It wasn't my intention.
(And I am by far not always right. I've made my fair share of embarrassing blunders.)
I'm trying to be precise in what I'm writing. AI-behaviour is well and strictly defined, after all. And it is well documented (at least in its general lines). I do think that it makes sense, if we talk about the trade, to know the tools of the trade first, especially as those tools are well documented (even though the documentation isn't perfect, and isn't 100% complete sometimes) and easily accessible for everybody here.
Switeck wrote:Code: Select all
"CARGO_DUMPED" = (checkForFullHold);
"HOLD_NOT_FULL" = ("rollD: 4");
"ROLL_1" = ("setStateTo: COLLECT_LOOT");
Right now I don't care if that happens only under extremely rare conditions (of the player or some trader dumping cargo) with a 1-in-4 chance.
I am not sure when the CARGO_DUMPED message is sent. I haven't used it before.
The documentation suggests that this only happens if another NPC uses the
dumpCargo
or
ejectCargo
method. (I don't know whether the player hitting 'D' also triggers it; and I don't know whether it is only sent to entities which at the time have the dumper as their primary target, or to all entities in the vicinity.) Generally I think it would be reasonable behaviour for a pirate to try to scoop this cargo. I seem to remember that there was a debate about this in some thread not too long ago, where people made the point that what pirates are ultimately after is
cargo, not destroying other ships for the sake of destruction. So, if the prey tries to get away by dumping cargo, the pirate has achieved his goal and would concentrate on the cargo, not the fleeing ship. I think that's the reasoning behind this specific behaviour.
(The COLLECT_LOOT state itself checks for new attacks. Therefore, if a pirate gets hit by laser fire while scooping, he will turn against his attacker with the known 25% probability. In other words: A single shot fired at him will probably not distract him from what he's doing, which is again how I would also react in the same situation. However, continuous fire will make him deal with the attacker first, which is again what I also would do in the same situation. (This is actually an assumption, because I don't know whether the 25%-rule also applies if the current target is not a hostile ship, but some cargo.))
And if the attacked ship doesn't dump cargo, the code is never executed in the first place. (Dumping or ejecting means what the player can do with hitting 'D' while in flight. It does not cover the cargo released after a ship is destroyed. The destruction of a target triggers TARGET_LOST and TARGET_DESTROYED, not CARGO_DUMPED.)
But I thought we were discussing the switching of targets, which is only dealt with in
Code: Select all
ATTACKED = (
setTargetToPrimaryAggressor,
"setStateTo: ATTACK_SHIP"
);
"ESCORT_ATTACKED" = (
setTargetToPrimaryAggressor,
groupAttackTarget
);
?