Eric has pointed out the first one. Although I switch the escorts AI with the script to the custom AI (which checks for friendly fire). As it takes a few seconds to run, it is possible that the escorts are in bog-standard escort AI when they get hit by the mark, so I really need to add an auto-ai false. It shouldn't happen very often, but it is a known bug.
The strange thing is, that they were not fighting other ships and did not even have the time to do so. Thus, after spawning, they must have targeted their leader on purpose (because of fugitive rating?).
LittleBear wrote:
On the Second one. Is the variable for revenge : YES ? The counter still counts even if the variable is NO, but nothing will happen. I reduced the chance of revenge being taken to 1 in 3 everytime you make a hit, so it will be less frequent. The dice should be re-rolled when you are paid for making a hit. I might have forgotten though to reset the YES / NO roll. Could you pull into a bar and post your variables with a screenie? I pretty busy with RL ATM so may be a while before I can look into it though.
Hatred 14
Events Timer 116
Dockings 12
Events number 1
Special Mission Timer 116
Revenge Status YES
Time to Strike SOON
Revenge jumps made 175
Special Mission WAITING
Master Timer 116
Dice Roll 54
Is it normal that the same value appears multiple times? I cant remember to see it otherwise. The value changes, but those variables all report the same value...
There's somthing up as the code should force a revenge encounter if you go over a certain number without an enounter. Bother - I have broken something in the new release. It is intended though that the Events times and Revenge timer and Special Mission timers count separatley. When an Event happens the timer is reset. But at the moment the only event in the OXP is the Criminal Attack on the bar (idea is to have about 8 events some that happen in space and some around the bar - but to stop the player being bugged by constant Random Hits events, when an event happens the counter is set back to 0 and RH won't check again for a random chance of an event until the timer has passed a certain number). The Special Mission timer would also be reset when you are offered it, so if you don't feel like doing it when offered it'll be re-offered again later. But again, I haven't finsihed writing it yet, so the counters just er count ATM.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
Eric has pointed out the first one. Although I switch the escorts AI with the script to the custom AI (which checks for friendly fire). As it takes a few seconds to run, it is possible that the escorts are in bog-standard escort AI when they get hit by the mark, so I really need to add an auto-ai false. It shouldn't happen very often, but it is a known bug.
No it is because the escorts were first added with a plain escortAI. That AI looks for the leader. Immediately after that the escorts are put in the special randomHits role. That one starts by looking for the player as first. When it gets a FOUND_TARGET message it assumes it found the player but actually it was the result of the previous search for the leader.
I always get this behaviour. It could be that 1.73 has another timing here than 1.72 and this problem only started with 1.73. But as Little_bear writes. For his next release he will set auto_ai to false so it than no longer looks for an AI it thinks is suitable, but immediately starts with the defined one.
{
GLOBAL = {
ENTER = ("setStateTo: FLYING_ESCORT");
EXIT = ();
UPDATE = (); };
'fraid you'd need to do the same with randomhitsescort2AI and randomhitsescort3AI. And then fire up with the shift key.
I think that fixes the problem Eric spotted. Although it may be in standrard escort AI when spawned for a second and so locks onto its mother as a target, with this change to the custom AI, it escorts its target rather than attacking it. I'd made this change on the version on my hard disk and was then puzzeling why I couldn't reproduce it.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
[ai.error.recursion]: ***** ERROR: AI reactToMessage: recursion in AI randomhitsattackAI.plist, state FRIENDLY_FIRE_INCIDENT, aborting. It is not valid to call reactToMessage: FOO in state FOO.
[ai.error.recursion]: ***** ERROR: AI reactToMessage: recursion in AI randomhitsattackAI.plist, state POSITION_CHECK, aborting. It is not valid to call reactToMessage: FOO in state FOO.
There's somthing up as the code should force a revenge encounter if you go over a certain number without an enounter. Bother - I have broken something in the new release.
Do you have any idea how I could modify my save game so that the revenge thing works again?
I've done another 50 jumps or so...way over 200 now, but still nothing, although I did fulfill several other contracts since then and these, too, did not cause any revenge ships.
I still do have two problems with the tombstones:
1) They spin so that the text is almost unreadable (maybe change the spinning parameters)
2) The text is mirrored (texture flipped?)
Furthermore, I just got this after a space bar has been blown up by a q-bomb:
[script.javaScript.exception.noProperties]: ***** JavaScript exception ("oolite-random-hits-miningpod.js.anon-script"): TypeError: who has no properties
[script.javaScript.exception.noProperties]: ../AddOns/RandomHits1.3.6.oxp/Scripts/oolite-random-hits-miningpod.js, line 31.
If I understand things properly, the script should better be written as this:
Yes, with q-bombs the whom is always nil so you need to be check for whom first. It is often missed that whom might be undefined as with normal testing there is always a ship (or the planet when it crashes).
A little bit better is:
because, when whom exists, the boolean property isPlayer also exists. In your case, when the ship crashed on the planet you still get an error that a planet has no primaryRole.
A mix of spaces and tabs is not good for indenting. Either use 4 spaces, or a single tab. Due to widely varying environments, the standard we should use is 4 spaces.
Leave a space between the if keyword and the parenthesis, as this is not a function that is being called.
Always compare using the strict equality operators. The standard equality operators use a complicated set of rules to determine equality, which allows too many strange situations to occur.
I will not bicker about quotes. The standard is single quotes when scripting for web pages (to prevent confusion) but here I am okay with double quotes.
The outer parenthesis are not required, nor do they aid in understanding the code.
Leave a space either side of operators, the asterix. This aids the readability of the code when things get complex.
Lots of whitespace at the end of the statement is removed
Many scripts fail to complete their statements with semicolons. Without, the statement may not end depending on what follows after it, so use the semicolons. Like fullstops in writing, they serve a purpose.
Yes, with q-bombs the whom is always nil so you need to be check for whom first.
I wonder if this should be considered as a bug in Oolite, and fixed. I guess the problem is that the Q-Bomb no longer exists. Should it be whoever dropped the q-bomb then? What if they are dead by now as well?
What happens in other situations when 'whom' is dead by the time this event is fired? Eg, missiles?
Yes, with q-bombs the whom is always nil so you need to be check for whom first.
I wonder if this should be considered as a bug in Oolite, and fixed. I guess the problem is that the Q-Bomb no longer exists. Should it be whoever dropped the q-bomb then? What if they are dead by now as well?
What happens in other situations when 'whom' is dead by the time this event is fired? Eg, missiles?
On the q-bomb having no owner I agree that this is probably a bug. Maybe it was never added because of all those cascading, adding a owner was not just a small fix. (I just made a quick look into the code. Both on initialising the blast, the owner is set to the mine owner in particle entity as well as in ship entity itself. So it was really intended to have an owner. So it not working is a bug and not intentionally)
And on the missiles you are right. They transfer not their own identity but that of whom has fired the missile and that ship could have died in the meantime, also resulting in whom not existing anymore.
But still the kills through secondary blasts are awarded to the player, if he launched the first q-bomb, aren't they?
So how does the code determine the connection between the secondary kills and the player? There must be something in the code already. (Unless, of course, my assumption is wrong, and secondary kills are not awarded. However, a certain experience with the Tionisla Orbital Graveyard seems to tell me otherwise, ahem...)
But still the kills through secondary blasts are awarded to the player, if he launched the first q-bomb, aren't they?
So how does the code determine the connection between the secondary kills and the player? There must be something in the code already. (Unless, of course, my assumption is wrong, and secondary kills are not awarded. However, a certain experience with the Tionisla Orbital Graveyard seems to tell me otherwise, ahem...)
It was always correct and all blasts have the launcher as whom. Then nil only happens when the launcher got himself killed. (as with the missile that Micha mentioned) I only remembered there was a scripting problem with the q-bomb. I now looked it up in Asteroid storm.oxp what was my original problem with the q-bomb : A script can not determine it was killed by a q-bomb. Back in 1.71 the why was nil and even the current removed gives no 100% guarantee it was a q-bomb. Probably energyBlast instead of removed whould be better as reason.
I just arrived at enle when a large group of offenders was shown on my scanners. Heading towards them I noticed that they were attacking the space bar. It's been around 6 Asp Mark IV flying in formation to attack the space bar - and the only way to make them break the attack was to shoot them to sparks. There were also a fer-de-lance which seemingly was the commanding craft for the asps and a constitution - all attacking that poor space bar!
Sadly, I shot down their master too early to know which AI he had to begin that attack. It was a pretty impressive sight and strangely the bar did have defenders in the air...there were a few yellow blips, but they did not fight these ships!