More curiosity! Two more questions...
Looking on the
AI page of the Wiki, I noticed this description of the 'Scan for Offenders' AI method
Locates all the ships in range, multiplies the legal status with a government factor, subtracts a random value between 0 and 255 from this result and compares the remaining value. It chooses the worst remaining offender. Because of the random value not all ships are found in every scan and the lower the bounty and lower the government, the longer it takes to detect a ship as offender. Returns: "TARGET_FOUND" or "NOTHING_FOUND".
Government factor = 0 in an anarchy and increases with 0.4 for every government till it reaches 2.8 for a corporate state. Result is that it never finds a ship in an anarchy, that is needs 637 points to always find an offender in a feudal state and only needs 91 points to always find a offender in a corporate state.
If I understand this correctly it means that a scan for offenders will never find an offender in an Anarchy, and is unlikely to in a feudal state as well. Now as this is where you'd most expect to find offenders this struck me as odd. Is this right? Perhaps it's to stop any Police/Hunters cleaning up the System before you (the player) arrive.
Also on the AI page I found the role scanning methods at the bottom of the page, which I would like to use. Specifically
scanForNearestShipWithPrimaryRole:(NSString*) role
I'm not an expert with this language, so could some kind soul tell me how to incorporate this into an AI?
I tried
Code: Select all
scanForNearestShipWithPrimaryRole:pirate,
with upper and lower case Ps on the pirate, a space and no space after the colon and pretty much every other permutation, and it gets rejected. Each time the log shows
[ai.unpermittedMethod]: Handler "UPDATE" for state "HEAD_FOR_WITCHPOINT" in AI "cbhAI.plist" uses "scanForNearestShipWithPrimaryRole:pirate", which is not a permitted AI method.
I've also tried the old 'scanForNearestShipWithRole' with the same result. I am using this in the 'Update's which currently have a scanForOffenders method. I am adding a scanForHostiles which it seems happy with, and the scanForNearestShipWithPrimaryRole, which it's not happy with.
I expect my syntax is wrong. Can anyone point me in the right direction?
To put all this in context I'm trying to adapt the Route1Patrol AI to make the detection of offenders and pirates more efficient for a Hunter role ship.
In fact no harm being truthful, the original AI for my NPC Contractor isn't working as well as I'd like and I'm trying to improve it ready for the next update/release.