Shield-Tails don't count as kills?

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Influence D
Above Average
Above Average
Posts: 23
Joined: Wed Jan 16, 2008 10:44 am
Location: Mooooooon

Shield-Tails don't count as kills?

Post by Influence D »

that's twice I've killed one, received a bounty, yet had no increase in kill count.

(this is with a lateish SVN build).

I'm assuming it's a minor problem with the OXP not the engine - and hence posting in this forum - as I'm pretty sure other add-on ships work correctly (though I haven't tested that recently).
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

There was a very recent change about subentities killcounts. Now destroying a subentity of a ship does not give you a kill (that is right from my point of view).
I don't remember if this ship has subentities.
If yes maybe it has something to do with this.
Unfortunately I have 1.70 vanilla so I cannot confirm that. But i will try to kill one with my version. If i get a kill that means that is that recent change that affected somehow this opx (maybe there was a dormant bug in that opx all those years)
Last edited by Ark on Sat Jan 26, 2008 2:11 pm, edited 1 time in total.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Yeah, I get the same thing on my machine (just tested it) no kill for a shield tail.

It only has one subentity, a flasher.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

This seems to be caused by the scanClass sometimes being set to CLASS_CARGO, which I think i happening when the pilot ejects.

In PlayerEntity line 3365 or so we have this

Code: Select all

		BOOL killIsCargo = ((killClass == CLASS_CARGO) && ([other commodityAmount] > 0));
		if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK))
		{
			if (![other hasRole:@"tharglet"])	// okay, we'll count tharglets as proper kills
			{
				score /= 10;	// reduce bounty awarded
				killAward = NO;	// don't award a kill
			}
		}
Which means that if the scan class is cargo (unless its a tharglet) we dont get a kill.

I think the solution is either to change the way kills are handled completely, as discussed elsewhere, maybe award a kill for an ejection? Or to ensure that ejection cannot change a ship to a cargo.
Last edited by Cmdr James on Sat Jan 26, 2008 5:34 pm, edited 1 time in total.
User avatar
Influence D
Above Average
Above Average
Posts: 23
Joined: Wed Jan 16, 2008 10:44 am
Location: Mooooooon

Post by Influence D »

I don't think that's it, because I just had a python pilot eject and I'm pretty sure I still got the kill for that... the recent subentity change seems far more likely to me. I'll try to keep better track of my kills next time, because if that's the case then I guess I should repost this as a bug report.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Well, it certainly happens with the shield tail when i run in the degugger.
It may not be caused by ejection, but it is certainly caused by the scanclass being Cargo at the time it is killed.

Right now, I am looking at the local variables at the point of killing a shield tail.

score 10
killClass CLASS_CARGO
killAward NO

I will experiment with some other ships to see what I get.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

And it looks like this is in ShipEntity 6467 or so

Code: Select all

		if ((energy < maxEnergy *0.125)&&(has_escape_pod)&&((ranrot_rand() & 3) == 0))  // 25% chance he gets to an escape pod
		{
			has_escape_pod = NO;
			
			[shipAI setStateMachine:@"nullAI.plist"];
			[shipAI setState:@"GLOBAL"];
			behaviour = BEHAVIOUR_IDLE;
			frustration = 0.0;
			[self launchEscapeCapsule];
------>		     [self setScanClass: CLASS_CARGO];			// we're unmanned now!
			thrust = thrust * 0.5;
			desired_speed = 0.0;
			maxFlightSpeed = 0.0;
			is_hulk = YES;
		}

This means that under some (maybe all) conditions when you hit a ship with an energy weapon he will eject, and his ship becomes cargo. An entity which has class cargo does not award kills.

There was only ever one subentity, a flasher for which you could previously get a kill.

I have also run a reasonable number (10) of test kills in the debugger and checked the values. The subentity code is not entered, but the scanClass is set to Cargo.

I am pretty sure that this is not related to the subentity change, and is in fact as I described.

Sorry if I come across as arrogant, I hope I dont, I just want to make clear that I know what the problem is.

I should add, well done finding this slightly exotic bug :)
User avatar
Influence D
Above Average
Above Average
Posts: 23
Joined: Wed Jan 16, 2008 10:44 am
Location: Mooooooon

Post by Influence D »

Hah - you didn't come across as arrogant; it was just that it was around 2-3AM for me when I posted that :)

I did some quick checking of my own, which involved blowing up a Viper ('coz it has flashers) and a bunch of other add-on ships (darn Commies), and they all seemed to work - odd. Also I can't see any special AI scripts in the OXP that would account for this, so maybe they did both eject (certainly they take longer to kill than most other pirates, so they'd have a lot more chance to).

[edit]At this point, I'm just going to assume that the Shield-Tail's maxEnergy is high enough that the above check will almost always trigger[/edit]
User avatar
Captain Hesperus
Grand High Clock-Tower Poobah
Grand High Clock-Tower Poobah
Posts: 2310
Joined: Tue Sep 19, 2006 1:10 pm
Location: Anywhere I can sell Trumbles.....

Post by Captain Hesperus »

<derail topic>
Good Giles! There's getting to be some very interesting and peculiar avatars around here (says he with the psycho-kitty avatar)
</derail topic>

It is strange that the Shield-back don't award a kill. Maybe Doc Nil (the author) could shed some light on it.

Captain Hesperus
The truth, revealed!!
Image
User avatar
Influence D
Above Average
Above Average
Posts: 23
Joined: Wed Jan 16, 2008 10:44 am
Location: Mooooooon

Post by Influence D »

Bugger. Thargoids don't ever eject, as far as I know - certainly there's no visible pod if they do - yet I only got one kill for bumping off two of them. :(

Now I'm just confused.

[edit](This was the main ships, not the robot fighters)[/edit]
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

I am wondering if there is really a good reason for setting scanClass to cargo. In the code that Cmdr James posted

Code: Select all

------>           [self setScanClass: CLASS_CARGO];         // we're unmanned now! 
the comment indicates that the purpose of this line is to declare the ship unmanned. But this has already happened in the [self lauchEscapeCapsule] method, executed directly above, when crew of the ship is set to nil.

Maybe setting scanClass to cargo is totally unnecessary. But further testing will be needed.
User avatar
Dr. Nil
---- E L I T E ----
---- E L I T E ----
Posts: 983
Joined: Thu Sep 28, 2006 5:11 pm
Location: Nearest Hoopy Casino
Contact:

Post by Dr. Nil »

Captain Hesperus wrote:
It is strange that the Shield-back don't award a kill. Maybe Doc Nil (the author) could shed some light on it.

Captain Hesperus
I have no idea why. It is not intentional. But it looks like some of our code wizards are unto it.
Image

300 billboards in Your Ad Here!
Astromines and more in Commies.
AVAILABLE HERE along with other Oolite eXpansion Packs.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Influence D wrote:
Bugger. Thargoids don't ever eject, as far as I know - certainly there's no visible pod if they do - yet I only got one kill for bumping off two of them. :(

Now I'm just confused.

[edit](This was the main ships, not the robot fighters)[/edit]
Correct, thargoids cannot eject.

This is interesting. In my testing I always get a kill for a thargoid, both warships and the tharglets. However, I did notice that the tharglets do not execute the custom tharglet code.

This line

Code: Select all

[other commodityAmount] > 0)
returns false, as thargets have no commodity amount (but, shield tails do!). This is especially intersting as tharglets can be scooped, and do award 1t of alien items. I need to find out what commodity amount is actually used for.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

It is the scoopUp method in ShipEntity.m that gives thargons their commodity. Inside the switch [other cargoType] statement, you will find

Code: Select all

case CARGO_THARGOID:
			co_amount = 1;
			co_type = [UNIVERSE commodityForName:@"Alien Items"];
			break;
As for the CARGO_THARGOID, this is specified for tharglets in shipdata.plist.

And you are right, the tharglet check inside the check for valid kills is always true (and therefore not needed), because tharglets have scan class CLASS_THARGOID, not CLASS_CARGO. Probably this code was used in the past, but subsequent changes in how thargoids are recognized by the system have made it redundant.
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 »

This means that under some (maybe all) conditions when you hit a ship with an energy weapon he will eject, and his ship becomes cargo. An entity which has class cargo does not award kills.
because tharglets have scan class CLASS_THARGOID, not CLASS_CARGO.
?? I don't get it all here. In the code giving at the beginning you see that a kill is awarded when scanclass is not cargo or with empty cargo. Maybe the ship with tail has wrongly cargo defined in his plist definitions.

Only in some occasions like the fueltanker of transports is is desired a ship has cargo defined this way.

The scanclass of tharglets is bad looking: They turn white to indicate that it is scanclass cargo. (The command: BecomeUncontrolledThargoid is doing that) The exception is needed because the have alien cargo but should count as a kill. This is probably the way Elite did it. Now with all kind of OXP's that add tharglets, I think is are easy gained killpoints.
Post Reply