![]() |
Error with Mission.OnAircraftDamaged
Hi guys,
Time to break open the code. I am seeing an error on the server and I can not pinpoint what the issue is. Below is the code I am using (the voice sounds work and get no error with that) Any Idea? Code:
public override void OnAircraftDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, part.NamedDamageTypes damageType) [23:01:42] System.NullReferenceException: Object reference not set to an instance of an object. [23:01:42] [23:01:42] Server stack trace: [23:01:42] at Mission.OnAircraftDamaged(Int32 missionNumber, String shortName, AiAircraft aircraft, AiDamageInitiator initiator, NamedDamageTypes damageType) [23:01:42] at maddox.game.ABattle.OnAircraftDamaged(Int32 missionNumber, String shortName, AiAircraft aircraft, AiDamageInitiator initiator, NamedDamageTypes damageType) [23:01:42] at maddox.game.world.Strategy.OnAircraftDamaged(Int32 missionNumber, String shortName, AiAircraft aircraft, AiDamageInitiator initiator, NamedDamageTypes damageType) [23:01:42] at maddox.game.ABattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt) [23:01:42] at maddox.game.world.Strategy.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt) [23:01:42] at System.Runtime.Remoting.Messaging.StackBuilderSink ._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) [23:01:42] at System.Runtime.Remoting.Messaging.StackBuilderSink .SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext) [23:01:42] [23:01:42] Exception rethrown at [0]: [23:01:42] at System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage reqMsg, IMessage retMsg) [23:01:42] at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData& msgData, Int32 type) [23:01:42] at maddox.game.IBattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt) [23:01:42] at maddox.game.GameDef.eventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt) [23:01:42] at WoroaxENpmii8VryBS1.l72U2qEZkgauhd5ThjE.naGW165wRS kRFDpn8qAt(Object , GameEventId , Object , Object , Int32 ) [23:01:42] at WoroaxENpmii8VryBS1.l72U2qEZkgauhd5ThjE.eventGame( GameEventId , Object , Object , Int32 ) [23:01:42] at QTJWCZav3I4dK5Rv9Zd.soVedrakcuHYXN8uYhv.V15uBXPplU M(GameEventId , Object , Object , Int32 ) [23:01:42] ================================================= |
Test initiator_aircraft for null value
Code:
if (initiator_aircraft == null) return; |
Looks suspiciusly like some of my old code, ya bastard! :grin: What Kodiak said, also below I've tidied up all those 'case' statements. You can add/remove speech lines by altering the appropriate speech string array in each section without having to change the sayToGroup code.
Code:
public override void OnAircraftDamaged(int missionNumber, string shortName, AiAircraft aircraft, AiDamageInitiator initiator, part.NamedDamageTypes damageType) |
Thanks Salmo!
Also, "Looks suspiciusly like some of my old code, ya bastard! " That would explain why I have your name in my "Special Thanks" list next to Kodiak and others. Would you like your name further up the list? :-P Below is in the Briefing of Mission. "(Thanks also to SNAFU, KODIAK, Salmo & Bliss) " |
Quote:
|
Salmo,
Since you are reading here and not your email... Must take a while to travel from Melbourne to Tassie. You must be on the NBN...hahahaha FYI I sent you the mission to your email ;) |
All times are GMT. The time now is 12:32 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.