0.3 Style vehicle damage

Gulk2

  • Newbie
  • Posts: 39
0.3 Style vehicle damage
«  »Last edited
Bulletproof unoccupied vehicles for the Java server but it's really simple if you want to use it in non-java server I think.

MainController

Code: [Select]
    @Override
    public void onPlayerEnterVehicle(Player player, Vehicle vehicle, int slot) {
        Vehicle v = vehicle;
        VehicleImmunity none = new VehicleImmunity();
        v.setImmunities(none);
    }

Code: [Select]
    @Override
    public void onPlayerExitVehicle(Player player, Vehicle vehicle) {
        Vehicle v = vehicle;
        //System.out.println(vehicle.getSyncReasonOrdinal());
        //server.sendClientMessage((null), new Colour(255, 0, 255), player.getName() + "VEHSYNC: " +v.getSyncReasonOrdinal() );
        if (v.getSyncReasonOrdinal() == 4) { //4 seems to mean empty
            // so we set bulletproof only when vehcile is empty.
            VehicleImmunity bp = new VehicleImmunity(VehicleImmunity.Flag.BulletProof, VehicleImmunity.Flag.Tyres);
            v.setImmunities(bp);
        }
    }

Code: [Select]
    @Override
    public void onVehicleRespawn(Vehicle vehicle) {
        Vehicle v = vehicle;
        VehicleImmunity bp = new VehicleImmunity(VehicleImmunity.Flag.BulletProof, VehicleImmunity.Flag.Tyres);
        v.setImmunities(bp);
    }

Then make sure to spawn your vehicles with the immunities, this includes an idle vehicle timeout for respawning.

So, create a new class

Code: [Select]

public class ServerConfig {

    public static class Setup {
       
    public static void mainVeh(int modelId, int worldId, Vector position, float angle, VehicleColours colours) {
            Vehicle v = server.createVehicle(modelId, worldId, position, angle, colours);
            v.setIdleRespawnTimeout(210000);
            VehicleImmunity bp = new VehicleImmunity(VehicleImmunity.Flag.BulletProof, VehicleImmunity.Flag.Tyres);
        }

 public static void loadVehicles() {
            mainVeh(163, 1, new Vector(-1743.0f, -211.8f, 15.0f), (4.71239f), new VehicleColours(43, 0)); //[email protected]
        }
    }

}

spawn it in MainController

Code: [Select]
    @Override
    public boolean onServerInitialise() {
        System.out.println("[" + LocalTime.now() + "][SERVER]INITIALIZED");
        Setup.loadVehicles();
       
        return true;

    }

Edit: forgot to add respawn too. added.

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,043
Re: 0.3 Style vehicle damage
« Reply #1,  »
This is fun to play around with, sometimes, when players dm alot around vehicles.
"but..but... the car didn't explode T_T"

@Murdock was telling me about Sky-City server where DriverOnWater was enabled, and he was just playing around sometimes by turning it off, and players were wrecked xD

Gulk2

  • Newbie
  • Posts: 39
Re: 0.3 Style vehicle damage
« Reply #2,  »Last edited
Quote from Sebastian on March 31st, 04:32 PM
This is fun to play around with, sometimes, when players dm alot around vehicles.
"but..but... the car didn't explode T_T"

@Murdock was telling me about Sky-City server where DriverOnWater was enabled, and he was just playing around sometimes by turning it off, and players were wrecked xD
As much as i enjoy the new gameplay with vehicles as a danger of instant explosion, i also enjoyed being able to use them as cover in 0.3 and now with this new sync players cant abuse desynced vehicles (fuck you NubKillerUK) for cover so it's nice!

Oh and this stuff works well for the Rhino tank(make it invincible), which has low hp in vcmp for whatever reason. You can also do stuff like give police vehicles more hp than regular vehicles.

I use this for creating unique groups of vehicles, with unique traits or powers, some with respawn timers, some that dont respawn at idle and just sit wherever players leave them.