Hostiles at the main station in v1.74.2?

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

Switeck wrote:

Code: Select all

[ai.takeAction]: Sidewinder Woma Escort 382 to take action pauseAI: 15.0
[ai.message.receive]: AI escortAI.plist for Sidewinder Woma Escort 382 in state 'CLEAR_STATION' receives message 'NOTHING_FOUND'
...
  [ai.message.receive]: AI escortAI.plist for Sidewinder Woma Escort 382 in state 'CHOOSE_NEW_CAREER' receives message 'ENTER'
  [ai.takeAction]: Sidewinder Woma Escort 382 to take action checkOwnLegalStatus
[ai.message.receive]: AI escortAI.plist for Sidewinder Woma Escort 382 in state 'CHOOSE_NEW_CAREER' receives message 'SELF_MINOR_OFFENDER'
[ai.takeAction]: Sidewinder Woma Escort 382 to take action checkForFullHold
[ai.message.receive]: AI escortAI.plist for Sidewinder Woma Escort 382 in state 'CHOOSE_NEW_CAREER' receives message 'NO_CARGO_BAY'
[ai.takeAction]: Sidewinder Woma Escort 382 to take action switchAITo: route1patrolAI.plist
In your case, the Sidewinder went from failed escort to route1patrolAI.plist script. How high was its bounty value?
And why do/did FTZ v0.13 escorts react differently and choosing a (short-lived) pirate career?
The bounty value is irrelevant. The choice-relevant bit is the message 'NO_CARGO_BAY'. The sidewinder has no cargo capacity, therefore it cannot become a pirate, because in Oolite piracy is all about looting. If an NPC has no more free cargo space, it can't be a pirate. The next choice for the escort is therefore to become a hunter, which gets route1patrolAI.
Switeck wrote:
My main "beef" with hostiles at the station was these weren't high-bounty kill-anything-that-moves fugitive pirates...they were low bounty barely-offenders.
'SELF_MINOR_OFFENDER' should probably have them go dock or better yet hyperspace out if capable to clear their offender status.
Attacking anything and everything around the main station is basically suicide.
...Er, well it should be unless you're ridiculously good and/or have a very powerful ship. :twisted:
As I explained in my previous post, it is a bug. The ships in question are failed escorts, which only exist because their creator made a mistake in formulating their shipdata.plist. They were never meant to be independent pirates. Escorts usually don't get high bounties. And Oolite's code cannot foresee every bug introduced by OXP creators and deal with it cleverly.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Commander McLane wrote:
Escorts usually don't get high bounties.
About hight bounties:
Yesterday I somehow came in conflict with a spacebar. There was a fight going on with pirates and I helped the bar by killing some of them. I don't know what went wrong, but suddenly I was chased by the guards. I fled but one I could not shake off. I killed that one.

But than, after a few jumps I still was a fugitive, so I looked at my bounty. It was still over 1,000,000. I have no Idea how it could become that high. The ships in random hits add a random bounty from 0 to 25 for every hit on them. (I now think that is a bug) But 1,000,000/25 is still 4000 hits and I am sure I never fired that many shots to kill the ship. :x
User avatar
Dave McRoss
Dangerous
Dangerous
Posts: 104
Joined: Wed Jul 07, 2010 9:28 am
Location: Italy, Tuscany
Contact:

Post by Dave McRoss »

Eric Walch wrote:
Commander McLane wrote:
Escorts usually don't get high bounties.
About hight bounties:
Yesterday I somehow came in conflict with a spacebar. There was a fight going on with pirates and I helped the bar by killing some of them. I don't know what went wrong, but suddenly I was chased by the guards. I fled but one I could not shake off. I killed that one.
I also came in conflict with a spacebar, some time ago. Like you, I chased pirates and, out of nowhere, I became a Offender. So the guards start to assault me.

I solved the problem using Energy Bomb and flying away from 7-8 jumps, until my legal status returned Clean.
My ship list:

Cobra MK 3 - Lepka
Dragon M - Smaug
Python - Boa Pitonato
Cobra MK 3 - Lepka II
Now in a Python ET Special - Shark Panzer

[G5] -= Deadly =- (3720 Kills)
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

Eric Walch wrote:
But than, after a few jumps I still was a fugitive, so I looked at my bounty. It was still over 1,000,000. I have no Idea how it could become that high. The ships in random hits add a random bounty from 0 to 25 for every hit on them. (I now think that is a bug) But 1,000,000/25 is still 4000 hits and I am sure I never fired that many shots to kill the ship. :x
That surely sounds like some calculation bug.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Commander McLane wrote:
That surely sounds like some calculation bug.
Yes, but were. But I think I have it. I just did a new attack and queried some bounties of my commander during attack:

Code: Select all

> PS.bounty
3
> PS.bounty
37
> PS.bounty
59450
> PS.bounty
5954250
Exception: Error: can't convert "5954612100" to an integer
    Active script: oolite-random-hits-hunter 2.1
    oolite-random-hits-hunter.js, line 74:
            missionVariables.random_hits_criminal_hate_score -= this.ship.scriptInfo.hateScore;
The high bounty is not accumulated during the hits, but on death of my target. It was the exception that brought the attention to the problem: scriptInfo. As value of hateScore only 1, 2 or 3 are used and never "5954612100".
To be more precise is the problem the line:

Code: Select all

player.bounty += this.ship.scriptInfo.bounty;
In the past I used an XML plist for shipdata, but in the current version I use an ascii plist. The bounty is typically "75". But using this as text makes it undefined for JS. I must explicitly convert it to an integer before doing calculations with it by using:

Code: Select all

player.bounty += parseInt(this.ship.scriptInfo.bounty);
This is a problem that will hit others also when using numeric scriptInfo. I just added a warning in the wiki about this.

Apparently I knew about the problem as everywhere else in the script I did use parseInt() when accessing scriptInfo, just not with these two values. :oops:
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

Commander McLane wrote:
Indeed it is far more likely that they were added as escorts (happens also a lot with Tigers, if you have the OXP installed).

It goes like this: Some trader (Anaconda or Boa) launches and gets some escorts added, randomly chosen from all ships with role "escort". These escorts launch as well, but they only connect to their mother right after launching. Now, some of the ships with role "escort" have a bounty defined without setting autoAI to true. This is buggy OXPing, because on spawning (or launching) they always get this bounty, even if spawned as the escort of a clean trader.
I have to correct myself in one point: the bug is not in omitting the autoAI-key (autoAI defaults to TRUE, so omitting the key is the same as setting it), but in giving the ship a bounty in the first place.

Oolite takes care of bounties for ships with generic roles all by its own. If a ship with bounty 0 is spawned as a pirate, it gets a random bounty between 1 and 50. Even if its bounty is set to a value higher than 0 in shipdata, it is ignored, so it is useless to set a bounty for ships which shall be spawned with role "pirate". The same goes for escorts. If a ship with bounty 0 is spawned as an escort to a pirate, it will get a small bounty automatically.

Unfortunately this doesn't work the other way round. If a ship that has an explicit bounty defined is spawned with role "hunter", it gets the bounty defined in shipdata, which to me doesn't make a lot of sense, because fugitive hunters are a bit weird in the game mechanics (perhaps the populator could be adjusted to change the bounty to 0 in these cases?). Also, if it gets spawned as an escort to a clean ship, the pre-defined bounty isn't nullified.

The solution for ship designers therefore is: if you want your ship to be able to appear as both a hunter and a pirate, and possibly as an escort to other ships, don't set its bounty to something different from 0.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Eric Walch wrote:
I must explicitly convert it to an integer before doing calculations with it by using:

Code: Select all

player.bounty += parseInt(this.ship.scriptInfo.bounty);
Hmm, if you want to be sneaky - and save yourself a bit of typing - the same result can be achieved with a unary plus:

Code: Select all

player.bounty += +this.ship.scriptInfo.bounty;
should give you the same, correct, result... :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply