MPB Script/Vehical Limit

I want to be able to place a MPB at mission start already deployed. This i know how to do, But how do i make this MPB count as the MPB Vehical Limit.

Right now i can place it, but am still able to buy a second one.

Comments

  • I want the team to be able to buy the MPB.

    Right now they start with one, and can buy an additional one.(for a total of 2) I don't want to remove the buying capability but i want the one they start with to count as the 1 per team.
  • From ServerVehicleHud.cs:

    $VehicleTotalCount[%team, %blockName]
  • In vehicle.cs replace the following function:
    function VehicleData::onAdd(%data, %obj)
    {
       Parent::onAdd(%data, %obj);
       if((%data.sensorData !$= "") && (%obj.getTarget() != -1))
          setTargetSensorData(%obj.getTarget(), %data.sensorData);
       %obj.setRechargeRate(%data.rechargeRate);
       // set full energy
       %obj.setEnergyLevel(%data.MaxEnergy);
    
       if(%obj.disableMove)
          %obj.immobilized = true;
       if(%obj.deployed)
       {
          if($countDownStarted)
             %data.schedule(($Host::WarmupTime * 1000) / 2, "vehicleDeploy", %obj, 0, 1);
          else
          {
             $VehiclesDeploy[$NumVehiclesDeploy] = %obj;
             $NumVehiclesDeploy++;
          }
          vehicleListAdd(%obj.getDataBlock(), %obj);
       }
       if(%obj.mountable || %obj.mountable $= "")
          %data.isMountable(%obj, true);
       else
          %data.isMountable(%obj, false);
       
       %obj.setSelfPowered();
    //   %data.canObserve = true;
    }
    

    The only difference is the addition of vehicleListAdd() when the vehicle is set to deploy, i.e. an MPB already in the mission. It does not make any changes to other vehicles. This will, however, affect missions that only allow one MPB to be purchased and there is already one deployed by the mission.
  • which is why using this:

    $VehicleTotalCount[%team, %blockName]

    is more stable, and easier, you just call that to the MPB block on match startup for your specific game mode, and that will do it without modifying and scripts.
  • That also affects the purchasable vehicles, so it is just as flawed.
  • Wrong,

    Calling $VehicleTotalCount[1, MobileBaseVehicle]++; would increase Only the MPB's Count. Try it sometime.
  • By doing so the vehicleCheck() function will disallow purchases since $VehicleTotalCount may be at the maximum or over. Unless you increase the number of MPBs in the $VehicleMax variable.
  • I want the team to be able to buy the MPB.

    Right now they start with one, and can buy an additional one.(for a total of 2) I don't want to remove the buying capability but i want the one they start with to count as the 1 per team.

    I believe he made that clear enough too.
Sign In or Register to comment.