Nexus Modding > Mod Development / Released Mods

Freespace modding issues

(1/2) > >>

nips:
So yesterday I posted a thread where I had an issue, which only was the result of my own stupidity. Now I face another one which I can't really get around with, every time I play this mission at the very same moment the game crashes with no error message (when playing it via the mission editor or the normal game) there's no error logged whatsoever. The game crashes when the SendActium event is called from the AgrippaArrives event and the Actium arrives. If you use ctrl 3 the actium warps in and everything is fine

Another issue is that from time to time I get an error saying (I don't remember exactly) but something about wrong docking points. I kinda figured it was the artemis bombers pulling that thing but the game still gives me those errors with other ships (I can't really figure out which ships cause that error)

Another issue is that the AI seems to not send out any fighters, neither from the ships or the dispensers, I tried using the WeaponMode function but they only send out one squad and not all of the fighters/bombers

Here's the mission script, you have to comment out the playmusic functions as well as dialogues, and change the DefLocation


MISSION 1
Name "Sirius Blockade"
DefLocation "Deneb-Sirius Node"

OBJECTIVES
   1
   2
END


RULES
   RULE    event sceneInit
         :action
       SelectEx(s.ship,
         MakeFullyKnown(S.this);
         FreezeReconState(S.this,1);
      );
                  
            PreCacheNPC(#NPC_commando);
            PreCacheNPC(#NPC_Dispatcher);
            PreCacheNPC(#NPC_Francis);
            PreCacheNPC(#NPC_Amanda);

            SetRelation(#race_player, #race_ntf, 2);
            SetRelation(#race_ntf, #race_player, 2);
            M.Comm:=Disappear(GetSceneObj("Command"));

            M.Lys := GetSceneObj("GTCv Lysander");
            M.Act := Disappear(GetSceneObj("GTCv Actium"));
            M.Orf := GetSceneObj("GTC Orff");
            
            M.Nau := Disappear(GetSceneObj("GVC Naunet"));

            M.Cor := Disappear(GetSceneObj("NTCv Coriolanus"));
            M.For := Disappear(GetSceneObj("NTC Fortune"));
            M.Obe := Disappear(GetSceneObj("NTC Oberon"));
            M.Agr := Disappear(GetSceneObj("NTCv Agrippa"));
            M.Virgo :=Disappear(GetSceneObj("Virgo Wing"));
            M.Leo :=Disappear(GetSceneObj("Leo Wing"));
            PlayMusic(#music_ambient02);
            M.Sirius:=GetSceneObj("Sirius Jump Node");
            GetMachine("MissionScript"):ChangeState(default, 0);
            
         :end
   END

   MACHINE "MissionScript"

      STATE default

         RULE   event In
            :action
               StartTimer(PlayDialog, 1, E.dialog := "_02begin");
               Timer(CoriolanusArrives,10,0);
            :end   
         END
         
         RULE event CoriolanusArrives
            :action
               PlayEfx(#EFX_ALARM1, 1, M.Cor:position, 0, 0);
               StartTimer(PlayDialog,3,E.dialog:="_02CorInbound");
               M.Cor:damage:=25;
               M.Cor :=Appear(M.Cor);
                       MEvent(MakeShipWarpIn, E.Ship :=M.Cor);
               M.Cor:tMoveTo(M.Lys,2,0);
               M.Cor:tFireTo(M.Lys,2);
               PlayMusic(#music_battle06);
               M.Virgo:=Appear(M.Virgo);
               M.Leo:=Appear(M.Leo);                        :end
         END

         
         RULE event FortuneArrives
            :action
               M.For:damage:=30;
               PlayEfx(#EFX_ALARM1, 1,M.For:position,0,0);
               StartTimer(PlayDialog,3,E.dialog:="_02FortuneInbound");
               PlayMusic(#music_battle04);
               M.For :=Appear(M.For);
               MEvent(MakeShipWarpIn, E.Ship :=M.For);
               M.For:tMoveto(M.Sirius,2,0);
               M.For:tFireto(M.Orf,2);
            :end
         END
   
         
         RULE event AgrippaArrives
            :action
               PlayEfx(#EFX_ALARM1,1,M.Agr:position,0,0);
               
               PlayMusic(#music_battle01);
               M.Agr:damage:=15;
               M.Agr:=Appear(M.Agr);
               MEvent(MakeShipWarpIn,E.Ship:=M.Agr);
               M.Agr:tMoveto(M.Sirius,2,0);
               M.Agr:tFireto(M.Lys,2);
               StartTimer(PlayDialog,1,E.dialog:="_02Agrippa");
               StartTimer(PlayDialog,3,E.dialog:="_02NoWorry");
               Timer(SendActium,10,0);
            :end
         END      
         
         RULE event Oberon
            :action
               M.Obe:damage:=25;
               M.Obe:=Appear(M.Obe);
               MEvent(MakeShipWarpIn,E.Ship:=M.Obe);
               M.Obe:tMoveto(M.Sirius,2,0);
               M.Obe:tFireto(M.Lys,2);   
            :end
         END   

         RULE event SendActium
            :action   
               
               M.Act:damage:=13;
               M.Act:=Appear(M.Act);
               //PutShipRel(M.Act,M.Lys,150,0,0,0);
               MEvent(MakeShipWarpIn,E.Ship:=M.Act);
               StartTimer(PlayDialog,2,E.dialog:="_02ActiumArrives");
            :end
         END   

         //When the Corelsdl is down
         RULE event FatalDamaged
            condition E.Ship=M.Cor
            :action
               StartTimer(PlayDialog,2,E.dialog:="_02CorDead");
               Timer(FortuneArrives,10,0);
            :end
         END

         //When the Fortune is down
         RULE event FatalDamaged
            condition E.Ship=M.For
            :action
               PlayMusic(#music_ambient02);
               StartTimer(PlayDialog,1,E.dialog:="_02ForDead");
               StartTimer(PlayDialog,2,E.dialog:="_02NotSo");
               //Timer(VirgoWingDispatched,15,0);
               Timer(AgrippaArrives,45,0);
            :end
         END

         //Orff is down
         RULE event FatalDamaged
            condition E.Ship=M.Orf
            :action
               StartTimer(PlayDialog,1,E.dialog:="_02OrfDead");
               
            :end
         END

         RULE event Cheat2
         :action
            Terminate(M.For);
         :end
         END

         RULE event Cheat1
         :action
            Terminate(M.Cor);
         :end
         END

         RULE event Cheat3
         :action
            LocalEvent(SendActium);
         :end
         END
            
      END
   END
   

   #include "includes\_include_me.inc"
         
                        
END


ENTITIES

   SHIP
      Name "GTC Orff"
      Race #race_Player
      ShipType #styp_gtc_fenris
      Position -3241.98 1878.35 -9084.02
      Orientation -19.5716 4.98181 -23.6752
      Devices #weap_gtf_myrmidon ;

      NPC
         Name "Cmdr. Donemberg"

         ID 31
         Rank 4
         Medals ;
         CrewLevel 3
         Skill 1 2
         Skill 2 2
         Skill 3 3
         XP 0
      END
   END

   SHIP
      Name "GTCv Actium"
      Race #race_Player
      ShipType #styp_gtcv_deimos
      Position -1827.82 1701.6 -6500.52
      Orientation 147.555 3.69988 25.6712
      Devices #weap_gtf_myrmidon #weap_gtf_hercules_mk2 #weap_gtb_medusa ;

      NPC
         Name "Cmdr. Donaghy"

         ID 3
         Medals ;
         CrewLevel 3
         Skill 1 2
         Skill 2 2
         Skill 3 3
         XP 0
      END
   END

   SHIP
      Name "GTCv Lysander"
      Race #race_Player
      ShipType #styp_gtcv_deimos
      Position -2398.7 1596.61 -9527.93
      Orientation 12.7495 -9.86259 9.71468
      Devices #weap_gtf_myrmidon #weap_gtf_hercules_mk2 #weap_gtb_medusa ;

      NPC
         Name "Cmdr. Thombaugh"

         ID 13
         Medals ;
         CrewLevel 3
         Skill 1 2
         Skill 2 2
         Skill 3 3
         XP 0
      END
   END

   SHIP
      Name "GVC Naunet"
      Race #race_Player
      ShipType #styp_gvc_aten
      Position -900.465 2615.06 -3507.13
      Orientation 113.72 24.3554 82.9499
      Devices #weap_gvf_horus ;
   END

   SHIP
      Name "Command"
      Race #race_GTA
      ShipType #styp_gtc_leviathan
      Position -991.465 1451.01 2262.36
      Orientation 0 0 0

      NPC

         ID 26
         Medals ;
         CrewLevel 3
         Skill 1 2
         Skill 2 2
         Skill 3 3
         XP 0
      END
   END

   SHIP
      Name "NTC Oberon"
      Race #race_NTF
      ShipType #styp_gtc_fenris
      Position -7670.13 3169.83 -5797.34
      Orientation -143.76 -12.6765 17.3805
   END

   SHIP
      Name "NTC Fortune"
      Race #race_NTF
      ShipType #styp_gtc_aeolus
      Position -4139.44 1339.59 -3681.43
      Orientation 171.906 -34.4308 19.2274
   END

   SHIP
      Name "NTCv Agrippa"
      Race #race_NTF
      ShipType #styp_gtcv_deimos
      Position -8324.72 3219.81 -3515.17
      Orientation -143.76 -12.6765 17.3805
      Devices #weap_gtf_hercules #weap_gtf_myrmidon #weap_gtf_hercules_mk2 #weap_gtb_zeus #weap_gtb_zeus ;
   END

   SHIP
      Name "NTCv Coriolanus"
      Race #race_NTF
      ShipType #styp_gtcv_deimos
      Position -3035.56 -277.26 -2650.77
      Orientation 176.361 22.5792 3.99487
   END

   SHIP
      Name "Leo Wing"
      Race #race_NTF
      Class #cls_fighter_dispenser
      Position -3301.92 1939.09 -4577.66
      Orientation 0 0 0
      Devices #weap_gtf_hercules #weap_gtf_hercules #weap_gtf_hercules_mk2 ;
   END

   SHIP
      Name "Virgo Wing"
      Race #race_NTF
      Class #cls_fighter_dispenser
      Position -3301.92 1939.09 -4577.66
      Orientation 0 0 0
      Devices #weap_gtb_zeus #weap_gtb_medusa ;
   END

   SHIP
      Name "Sirius Jump Node"
      Class #cls_subspacenode
      Behaviour 5
      Position -2932.5 1745.32 -10553.8
      Orientation 0 0 0
   END

END

Arparso:

--- Quote from: nips on February 14, 2011, 00:17:23 ---The game crashes when the SendActium event is called from the AgrippaArrives event and the Actium arrives.
--- End quote ---
To be honest: I have no idea. The error seems to be triggered somewhere in the "WarpIn" machine in "_include_me.inc", but I wasn't able to find anything problematic there. I added Debug() commands everywhere to get to pinpoint the exact moment of the crash, but the WarpIn-related events all seem to work as expected and finish properly... the crash doesn't seem to happen directly in any of these events, but yet it only crashes, if you trigger the warpin sequence. Don't using the WarpIn for the Actium works just fine without any crash.

I'll need to investigate this further, but right now I don't have a clue why the game crashes.


--- Quote from: nips on February 14, 2011, 00:17:23 ---Another issue is that from time to time I get an error saying (I don't remember exactly) but something about wrong docking points.
--- End quote ---
Yeah, that's normal. This error only happens in the editor, because the GetDockPoint() function fails for some odd reason, if you're playing the mission in the editor. This function is being called to get the correct location for the subspace warp effect when a fighter is "docking" (=> warping out).

Just ignore the error - it'll only happen once in a running mission (because the script recognizes the failed function call and uses a different method next time). Alternatively you can set in_editor := 1; in your mission's SceneInit event to avoid the crash. Just remember to remove that line again before releasing the mission to the public.


--- Quote from: nips on February 14, 2011, 00:17:23 ---Another issue is that the AI seems to not send out any fighters, neither from the ships or the dispensers, I tried using the WeaponMode function but they only send out one squad and not all of the fighters/bombers
--- End quote ---
WeaponMode() only DOES send out a single squad. You'll need to call WeaponMode() for each squad. I did that in the Patrol Duty mission, for example:


--- Code: ---SelectEx(s.device & InSet(s.this, 22) & s.owner:race = #race_shivan,
WeaponMode(s.this, #SQUAD_PATROL, 0);
);
--- End code ---

To break it down:
SelectEx - selects a number of objects based on the given criteria and executes the given code on each one
s.device - limits the selected objects to devices (squads ARE technically devices, e.g. #weap_gtf_hercules)
InSet(s.this, 22) - limits the selected objects to fighters (bombers are in set 21)
s.owner:race = #race_shivan - limites the selected objects to those being stationed on a Shivan ship

This'll select all Shivan fighter squads currently in the scene and order each one to fly a patrol by using WeaponMode(s.this, #SQUAD_PATROL, 0)

And that's it.

nips:

--- Quote from: Arparso on February 14, 2011, 01:44:02 ---
--- Quote from: nips on February 14, 2011, 00:17:23 ---The game crashes when the SendActium event is called from the AgrippaArrives event and the Actium arrives.
--- End quote ---
To be honest: I have no idea. The error seems to be triggered somewhere in the "WarpIn" machine in "_include_me.inc", but I wasn't able to find anything problematic there. I added Debug() commands everywhere to get to pinpoint the exact moment of the crash, but the WarpIn-related events all seem to work as expected and finish properly... the crash doesn't seem to happen directly in any of these events, but yet it only crashes, if you trigger the warpin sequence. Don't using the WarpIn for the Actium works just fine without any crash.
I'll need to investigate this further, but right now I don't have a clue why the game crashes.

--- End quote ---
Isn't there a way around this? Like timing or some other thing? Cause it's really specific :P


--- Quote from: Arparso on February 14, 2011, 01:44:02 ---
--- Quote from: nips on February 14, 2011, 00:17:23 ---Another issue is that from time to time I get an error saying (I don't remember exactly) but something about wrong docking points.
--- End quote ---
Yeah, that's normal. This error only happens in the editor, because the GetDockPoint() function fails for some odd reason, if you're playing the mission in the editor. This function is being called to get the correct location for the subspace warp effect when a fighter is "docking" (=> warping out).

Just ignore the error - it'll only happen once in a running mission (because the script recognizes the failed function call and uses a different method next time). Alternatively you can set in_editor := 1; in your mission's SceneInit event to avoid the crash. Just remember to remove that line again before releasing the mission to the public.

--- End quote ---
So let me get this straight, if I play the game normally I wont get that error, right? if so then all is good

--- Quote from: Arparso on February 14, 2011, 01:44:02 ---
--- Quote from: nips on February 14, 2011, 00:17:23 ---Another issue is that the AI seems to not send out any fighters, neither from the ships or the dispensers, I tried using the WeaponMode function but they only send out one squad and not all of the fighters/bombers
--- End quote ---
WeaponMode() only DOES send out a single squad. You'll need to call WeaponMode() for each squad. I did that in the Patrol Duty mission, for example:


--- Code: ---SelectEx(s.device & InSet(s.this, 22) & s.owner:race = #race_shivan,
WeaponMode(s.this, #SQUAD_PATROL, 0);
);
--- End code ---

To break it down:
SelectEx - selects a number of objects based on the given criteria and executes the given code on each one
s.device - limits the selected objects to devices (squads ARE technically devices, e.g. #weap_gtf_hercules)
InSet(s.this, 22) - limits the selected objects to fighters (bombers are in set 21)
s.owner:race = #race_shivan - limites the selected objects to those being stationed on a Shivan ship

This'll select all Shivan fighter squads currently in the scene and order each one to fly a patrol by using WeaponMode(s.this, #SQUAD_PATROL, 0)

And that's it.

--- End quote ---
Well the thing is that the AI used to warp the fighters but stopped doing so... Weird :/

Anyways, thanks for the help! To be honest, this is my first scripted mission ever :P

Arparso:

--- Quote from: nips on February 14, 2011, 04:16:31 ---Isn't there a way around this? Like timing or some other thing? Cause it's really specific :P
--- End quote ---
I don't know - I didn't yet find a solution other than not using the WarpIn effect for the ship and it didn't seem related to the timing as well... there was no difference between starting the WarpIn almost immediately or two minutes after the Agrippa arrived.


--- Quote from: Arparso on February 14, 2011, 01:44:02 ---So let me get this straight, if I play the game normally I wont get that error, right? if so then all is good
--- End quote ---
Yes, it won't happen when playing the game normally outside the editor.

nips:
I've found another error

***** SCRIPT ERROR
Bad function parameter passed.

File: universe\mod_missions\includes\_include_me.inc
Line: 50

Rule: event Tick

Expression: E.squad:target
Parameter 0: Not an object
   E.squad  ==>  0
*****


***** SCRIPT ERROR
Bad function parameter passed.

File: universe\mod_missions\includes\_include_me.inc
Line: 46

Rule: event Tick

Expression: S.owner:launcherWeapon:mode
Parameter 0: Not an object
   S.owner:launcherWeapon  ==>  0
*****

This happens when fighters/bombers get orphaned (like their carriers die, in this case the coriolanus) and after a while, when the Fortune arrives the game crashes with that error. I was wondering if I should use the fighter dispensers instead of carriers.


Also is there a way to make the AI kind of override its survival instinct? Like if a damaged cruiser warps in, I want it to get to the node no matter what, instead of running away like a wuss.

Navigation

[0] Message Index

[#] Next page

Go to full version