Problem Again...

hey, I'm working on an air strike sw, and it involves a custom camera, The camera spawn and runs fine, but whenever I press the jet key (call in Airstrike), the Server UEs

here is my code:
datablock CameraData(TWM2ControlCamera) {
   mode = "AirstrikeCall";
   firstPersonOnly = true;
};

function CameraMessageLoop(%cl, %obj, %mode) {
   if(!isObject(%obj)) {
      return;
   }
   if(!isObject(%cl.player) || %cl.player.getState() $= "dead") {
      %obj.delete();
      return;
   }
   switch$ (%mode) {
      case "AirstrikeCall":
         BottomPrint(%cl, "AIRSTRIKE, MOVE TO POSITION, AND PRESS JET TO LAUNCH", 1, 2);
   }
   schedule(1000, 0, "CameraMessageLoop", %cl, %obj, %mode);
}

function TWM2ControlCamera::onTrigger(%data,%obj,%trigger,%state) {
   if (%state == 0)
      return;
      
   //first, give the game the opportunity to prevent the observer action
   if (!Game.ObserverOnTrigger(%data, %obj, %trigger, %state))
      return;

   //now observer functions if you press the "throw"
   if (%trigger >= 4)
      return;
      
   %client = %obj.getControllingClient();
   if (%client == 0)
      return;
      
   switch$ (%obj.mode) {
      case "AirstrikeCall":
         //press JET
         if (%trigger == 3) {
               //Can we Call in this airstrike?
               if(!%client.HasAirstrike) {
                  if(isObject(%client.player)) {
                     %obj.delete();
                     %client.setControlObject(%client.player);
                     bottomPrint(%client, "You cannot call in an airstrike", 5, 2);
                     return;
                  }
               }
               else {
                  //
                  %position = %obj.getPosition();
                  if(isObject(%client.player)) {
                     %obj.delete();
                     %client.setControlObject(%client.player);
                     %client.HasAirstrike = 0;
                     %client.xp += 35;
                     UpdateClientRank(%client);
                     MessageClient(%client, 'MsgZKill', "\c5TWM2: Airstrike Called In, +35XP.");
                     bottomPrint(%client, "Coordinates Confirmed, Calling In Airstrike", 5, 2);
                     messageTeam(%client.team, 'MsgAirstrike', "\c5TWM2: Airstrike Called In From "@%client.namebase@"");
                     Airstrike(%client, %position);
                  }
                  else {
                     bottomPrint(%client, "Player Object Required", 5, 2);
                  }
               }
         }
   }
}

just to help out a bit, the messages don't appear when I press the key, so the UE is not caused by the airstrike function, So, what could cause any of these, to ue

%obj.delete();
%client.setControlObject(%client.player);

Comments

  • Tribes 2 sometimes refuses to take direct .delete() calls. Try putting it in a schedule:
    %obj.schedule(500, "delete");
    
  • thanks, that did it
Sign In or Register to comment.