OFFENCE_COMMITTED
Moderators: winston, another_commander, Getafix
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
OFFENCE_COMMITTED
Question about this AI message: When is it sent to AIs? Only as a response to scanForOffenders? Or whenever an offence is committed in scanner range? And what counts as an offence? Attacks on clean ships?
Probably it is only the positive response to scanForOffenders, but in that case the name of the message may lead to false expectations (as it would be in my case).
I was following the tail of a ship with an OFFENCE_COMMITTED message in its current state. Another ship attacked and destroyed me. The ship I was following never received an OFFENCE_COMMITTED. But the Wiki says it should. Or does a ship need a "hunter" role in order to listen to OFFENCE_COMMITTED?
Probably it is only the positive response to scanForOffenders, but in that case the name of the message may lead to false expectations (as it would be in my case).
I was following the tail of a ship with an OFFENCE_COMMITTED message in its current state. Another ship attacked and destroyed me. The ship I was following never received an OFFENCE_COMMITTED. But the Wiki says it should. Or does a ship need a "hunter" role in order to listen to OFFENCE_COMMITTED?
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
The description with that list is wrong. It are not the classes that receive the message but the classes that automatic send a message when hit. The message OFFENCE_COMMITTED is only send to POLICE ships and the main-station when they are in range. I just corrected the wiki text to:Commander McLane wrote:And the list in the Wiki certainly looks odd: CLASS_NEUTRAL, CLASS_STATION, CLASS_BUOY, CLASS_POLICE, CLASS_MILITARY, CLASS_PLAYER. Why should buoys and the player get the message?
Code: Select all
Hitting a clean ship with scanClass equal to CLASS_NEUTRAL, CLASS_STATION, CLASS_BUOY, CLASS_POLICE, CLASS_MILITARY or CLASS_PLAYER, automatically sends a OFFENCE_COMMITTED to all nearby police ships and the system station.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
To be very precise, to all authorities and those are defined by:Commander McLane wrote:How are police ships defined in this case? CLASS_POLICE or role police?
And which kinds of ships are receiving distress calls? role police and hunter? Or is it dependent on class?
Code: Select all
static BOOL AuthorityPredicate(Entity *entity, void *parameter)
{
ShipEntity *victim = parameter;
// Select main station, if victim is in aegis
if (entity == [UNIVERSE station] && [victim withinStationAegis])
{
return YES;
}
// Select police units in scanner range
if ([entity scanClass] == CLASS_POLICE &&
distance2([victim position], [entity position]) < SCANNER_MAX_RANGE2)
{
return YES;
}
// Reject others
return NO;
}
And on the distress message you probably figure it out yourself with the code below:
Code: Select all
- (void) broadcastDistressMessage
{
/*-- Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack --*/
//...[deleted code]
unsigned i;
for (i = 0; i < n_scanned_ships; i++)
{
ShipEntity* ship = scanned_ships[i];
d2 = distance2_scanned_ships[i];
if (d2 < found_d2)
{
// tell it! //
if (ship->isPlayer)
{
if ((primaryAggressor == [ship universalID])&&(energy < 0.375 * maxEnergy)&&(!is_buoy))
{
[self sendExpandedMessage:ExpandDescriptionForCurrentSystem(@"[beg-for-mercy]") toShip:ship];
[self ejectCargo];
[self performFlee];
}
else
[self sendExpandedMessage:ExpandDescriptionForCurrentSystem(distress_message) toShip:ship];
// reset the thanked_ship_id
//
thanked_ship_id = NO_TARGET;
}
if ([self bounty] == 0) // Only clean ships can have their distress calls accepted
{
if (ship->isStation)
[ship acceptDistressMessageFrom:self];
if ([ship hasPrimaryRole:@"police"]) // Not isPolice because we don't want wingmen shooting off...
[ship acceptDistressMessageFrom:self];
if ([ship hasPrimaryRole:@"hunter"])
[ship acceptDistressMessageFrom:self];
}
}
}
}
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
So this basically means that I cannot make personalities ships (which all have "personalities" as primary role and CLASS_NEUTRAL) react to offences committed in their vicinity, unless I find a very clever way to have them check for close-by fights in their ship script.
Or of course I have to assign a primary role of "hunter" to those of them which I want to react on distress calls. Have to think about which possible side-effects that could have.
Not exactly the same, but they should all react to ecm pulses, and to player status changes (so they'd be able to tell when the player is being attacked)
Alternatively, but it could be quite time consuming, you could scan for all ships in the system every 2 minutes or so, and if you get a cluster of pirate & some other ships within the same scanner range volume, that should mean a fight...
Hmmm, actually this second option could be the basis of a 'police band intercept' radio oxp: 'disturbance in progress, follow beacon 2' and then create a class_no_draw beacon (using the letter '2', of course) in the right spot. The possibilities are endless!
Alternatively, but it could be quite time consuming, you could scan for all ships in the system every 2 minutes or so, and if you get a cluster of pirate & some other ships within the same scanner range volume, that should mean a fight...
Hmmm, actually this second option could be the basis of a 'police band intercept' radio oxp: 'disturbance in progress, follow beacon 2' and then create a class_no_draw beacon (using the letter '2', of course) in the right spot. The possibilities are endless!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact: