Page 26 of 70
Posted: Sat Oct 03, 2009 1:22 pm
by Screet
LittleBear wrote: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...
Screet
Posted: Sat Oct 03, 2009 1:44 pm
by LittleBear
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.
Posted: Sat Oct 03, 2009 1:52 pm
by Eric Walch
Screet wrote:LittleBear wrote: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.
Posted: Sat Oct 03, 2009 7:37 pm
by LittleBear
Could you just try this. Change the global state in the randomhitsescortAI to this :-
Code: Select all
{
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.
Posted: Sun Oct 04, 2009 12:40 pm
by Screet
Not sure if this is news to you:
Code: Select all
[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.
Screet
Posted: Sun Oct 11, 2009 5:50 pm
by Screet
LittleBear wrote: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.
Screet
Posted: Wed Oct 14, 2009 9:00 am
by Screet
Hi,
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:
Code: Select all
[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:
Code: Select all
this.shipDied = function(whom)
{
if(whom && whom.primaryRole == "player") {
player.bounty += (Math.ceil(Math.random()*25));
}
}
Screet
Posted: Wed Oct 14, 2009 11:18 am
by Eric Walch
Screet wrote:Furthermore, I just got this after a space bar has been blown up by a q-bomb:
If I understand things properly, the script should better be written as this:
Code: Select all
this.shipDied = function(whom)
{
if(whom && whom.primaryRole == "player") {
player.bounty += (Math.ceil(Math.random()*25));
}
}
Screet
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:
Code: Select all
this.shipDied = function(whom)
{
if(whom && whom.isPlayer) {
player.bounty += (Math.ceil(Math.random()*25));
}
}
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.
Posted: Wed Oct 14, 2009 11:31 am
by pmw57
Screet wrote:If I understand things properly, the script should better be written as this:
Code: Select all
this.shipDied = function(whom)
{
if(whom && whom.primaryRole == "player") {
player.bounty += (Math.ceil(Math.random()*25));
}
}
Screet
Let's take this one line at a time.
Line 1:
- Only one space each side of the equals sign.
- A space between function and parenthesis, because here we are not calling a function, just defining one.
- Follow the parenthesis with a space and the opening brace.
Line 2:
- 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.
Code: Select all
if (whom && whom.primaryRole === "player") {
Line 3:
- 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.
Code: Select all
player.bounty += Math.ceil(Math.random() * 25);
Line 4:
- This line is okay as it is, leave it lined up underneath the if statement
Line 5:
- This brace closes the definition for the this.shipDied function, so it should be properly finished with a semicolon.
The improved code in full:
Code: Select all
this.shipDied = function (whom) {
if (whom && whom.primaryRole === "player") {
player.bounty += Math.ceil(Math.random() * 25);
}
};
Posted: Wed Oct 14, 2009 12:07 pm
by Micha
Eric Walch wrote:
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?
Posted: Wed Oct 14, 2009 12:16 pm
by Eric Walch
Micha wrote:Eric Walch wrote:
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.
I now tested it with trunk and both parameters:
Code: Select all
this.shipDied = function (whom, why)
{
log(this.name, "Whom = " + whom + " Why = "+why);
}
Genarates in the log:
Code: Select all
Whom = [PlayerShip "Boa Class Cruiser" ID: 100 position: (-51138.8, -98190.2, 531325) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT] Why = removed
So it is already corrected. For 1.72 (1.71?) I am sure a q-bomb generated nil. But it can also be that it are the secondary blasts that generate nil
Posted: Wed Oct 14, 2009 12:57 pm
by Commander McLane
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...)
Posted: Wed Oct 14, 2009 1:35 pm
by Eric Walch
Commander McLane wrote: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.
Posted: Fri Oct 16, 2009 5:31 pm
by Screet
Is UPS now attacking space bars?
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!
shift-h did reveal this:
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!
Screet
..
Posted: Fri Oct 16, 2009 5:55 pm
by Lestradae
This is a weird mix.
The fer-de-lance was the Constitution's mother? As the latter can only come from OSE on your system, that's impossible. They are never ever escorts?
UPS attacking Random Hits with an OSE ship in tow. Bizarre.
A friendly fire chain reaction perhaps?
Very
L