Jump to content
mmods

Damage vehicle

Recommended Posts

hello i'm making a callout of a vehicle that has been damaged by an unknow suspects but i don't know how to spawn the vehicle with damage. i hope you can help me.

Share this post


Link to post
Share on other sites

use this method to deform a vehicle:

https://docs.ragepluginhook.net/html/M_Rage_Vehicle_Deform.htm

 

here's a method to randomly deform it :

 

public static void Damage(this Vehicle vehicle, float radius, float amount)
{
    var model = vehicle.Model;
    model.GetDimensions(out var vector3_1, out var vector3_2);
    var num = new Random().Next(10, 45);
    for (var index = 0; index < num; ++index)
    {
        var randomInt1 = MathHelper.GetRandomSingle(vector3_1.X, vector3_2.X);
        var randomInt2 = MathHelper.GetRandomSingle(vector3_1.Y, vector3_2.Y);
        var randomInt3 = MathHelper.GetRandomSingle(vector3_1.Z, vector3_2.Z);
        vehicle.Deform(new Vector3(randomInt1, randomInt2, randomInt3), radius, amount);
    }
}

 

Share this post


Link to post
Share on other sites
9 minutes ago, NoNameSet said:

use this method to deform a vehicle:

https://docs.ragepluginhook.net/html/M_Rage_Vehicle_Deform.htm

 

here's a method to randomly deform it :

 


public static void Damage(this Vehicle vehicle, float radius, float amount)
{
    var model = vehicle.Model;
    model.GetDimensions(out var vector3_1, out var vector3_2);
    var num = new Random().Next(10, 45);
    for (var index = 0; index < num; ++index)
    {
        var randomInt1 = MathHelper.GetRandomSingle(vector3_1.X, vector3_2.X);
        var randomInt2 = MathHelper.GetRandomSingle(vector3_1.Y, vector3_2.Y);
        var randomInt3 = MathHelper.GetRandomSingle(vector3_1.Z, vector3_2.Z);
        vehicle.Deform(new Vector3(randomInt1, randomInt2, randomInt3), radius, amount);
    }
}

 

 public static void Damage(this.victim, 30f, 100)
        {
            var model = victim.Model;
            model.GetDimensions(out var vector3_1, out var vector3_2);
            var num = new Random().Next(10, 45);
            for (var index = 0; index < num; ++index)
            {
                var randomInt1 = MathHelper.GetRandomSingle(vector3_1.X, vector3_2.X);
                var randomInt2 = MathHelper.GetRandomSingle(vector3_1.Y, vector3_2.Y);
                var randomInt3 = MathHelper.GetRandomSingle(vector3_1.Z, vector3_2.Z);
                victim.Deform(new Vector3(randomInt1, randomInt2, randomInt3), 30f, 100);
            }
        }

i have this but makes error (victim is the vehicle)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×