Jump to content
Dmitri Medeleiv

disable damaged on CAR

Recommended Posts

Hi everyone,

I would like to know if there is a way to disable damage on car in order to make them indestructible. Car are still very buggy, I think people on my server could appreciate to use car without destroying it 5 min later.

So if anyone know how to do that, with a script or in the dayz server file, please let me know.

Thanks

Share this post


Link to post
Share on other sites

In your server folder, go into dta. There is a file called scripts.pbo. You need to unpack it with the Pbo Manager. After unpacking it, go to 4_World\Entities\Vehicles, in there is a file called CarScript.c, open it and go to the function OnContact, just delete the complet function body and thats it. Repack the folder again as scripts.pbo and replace the old scripts.pbo with it. You should of course make a backup first.

 

Edit: Here is the modified version of the scripts.pbo if you have problems https://drive.google.com/file/d/15_uUE99yJrt_gO95L-jaTsXC6bmzg47K/view?usp=sharing

By "delete the complet function body" i meant 

    void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
    {

    }

Now your car don't react at all if you drive agains something

Edited by julip

Share this post


Link to post
Share on other sites

All right ! I just delete the body of the function, it's working very well ! thanks a lot !

 

Edited by Dmitri Medeleiv

Share this post


Link to post
Share on other sites
12 hours ago, G0ndalf said:

Does not work for me :(

Did you get some error message ?

Share this post


Link to post
Share on other sites
21 hours ago, julip said:

In your server folder, go into dta. There is a file called scripts.pbo. You need to unpack it with the Pbo Manager. After unpacking it, go to 4_World\Entities\Vehicles, in there is a file called CarScript.c, open it and go to the function OnContact, just delete the complet function body and thats it. Repack the folder again as scripts.pbo and replace the old scripts.pbo with it. You should of course make a backup first.

?

 

 

Edited by mrwolv

Share this post


Link to post
Share on other sites
5 hours ago, Dmitri Medeleiv said:

All right ! I just delete the body of the function, it's working very well ! thanks a lot !

 

could you explain more on what to remove as i dont want to mess it up lol

Share this post


Link to post
Share on other sites
8 minutes ago, mrwolv said:

could you explain more on what to remove as i dont want to mess it up lol

It should be the complete OnContact so 

Spoiler

 void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
 {

  //Print(zoneName);

  if ( zoneName == "" )
  {
   Print("CarScript >> ERROR >> OnContact dmg zone not defined!");
   return;
  }
  
  switch( zoneName )
  {
   
  
   
   
   
/*
   case "dmgZone_lightsLF":
    //Print("dmgZone_lightsLF");
   break;
   
   case "dmgZone_lightsRF":
    //Print("dmgZone_lightsRF");
   break;
*/

   default:
    if ( GetGame().IsServer() && zoneName != "")
    {
     float dmgMin = 150.0; 
     float dmgThreshold = 750.0;
     float dmgKillCrew = 3000.0;
     float dmg = data.Impulse * m_dmgContactCoef;

     if ( dmg < dmgThreshold )
     {     
      if ( dmg > dmgMin )
      {
       //Print( GetType() + " >>> " + " SmallHit " + zoneName + " >>> " + dmg.ToString() + " >>> " + localPos);
       AddHealth( zoneName, "Health", -dmg);
      }
     }
     else
     {
      
      //Print( GetType() + " >>> " + " BIGHit " + zoneName + " >>> " + dmg.ToString() + " >>> " + localPos );
      //Print( dmg );

      for( int i =0; i < CrewSize(); i++ )
      {
       Human crew = CrewMember( i );
       if ( !crew )
        continue;

       PlayerBase player;
       if ( Class.CastTo(player, crew ) )
       {
        if ( dmg > dmgKillCrew )
        {  
         player.SetHealth(0.0);
        }
        else
        {
         //deal shock to player
         float shockTemp = Math.InverseLerp(dmgThreshold, dmgKillCrew, dmg);
         float shock = Math.Lerp( 50, 100, shockTemp );

         player.AddHealth("", "Shock", -shock );
         //Print( "SHOCK..........." + shock );
        }
       }
      }

      ProcessDirectDamage( 3, null, zoneName, "EnviroDmg", "0 0 0", dmg );

     }
    }
   break;
  }
 }

 

Share this post


Link to post
Share on other sites
2 minutes ago, G0ndalf said:

It should be the complete OnContact so 

  Hide contents

 void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
 {

  //Print(zoneName);

  if ( zoneName == "" )
  {
   Print("CarScript >> ERROR >> OnContact dmg zone not defined!");
   return;
  }
  
  switch( zoneName )
  {
   
  
   
   
   
/*
   case "dmgZone_lightsLF":
    //Print("dmgZone_lightsLF");
   break;
   
   case "dmgZone_lightsRF":
    //Print("dmgZone_lightsRF");
   break;
*/

   default:
    if ( GetGame().IsServer() && zoneName != "")
    {
     float dmgMin = 150.0; 
     float dmgThreshold = 750.0;
     float dmgKillCrew = 3000.0;
     float dmg = data.Impulse * m_dmgContactCoef;

     if ( dmg < dmgThreshold )
     {     
      if ( dmg > dmgMin )
      {
       //Print( GetType() + " >>> " + " SmallHit " + zoneName + " >>> " + dmg.ToString() + " >>> " + localPos);
       AddHealth( zoneName, "Health", -dmg);
      }
     }
     else
     {
      
      //Print( GetType() + " >>> " + " BIGHit " + zoneName + " >>> " + dmg.ToString() + " >>> " + localPos );
      //Print( dmg );

      for( int i =0; i < CrewSize(); i++ )
      {
       Human crew = CrewMember( i );
       if ( !crew )
        continue;

       PlayerBase player;
       if ( Class.CastTo(player, crew ) )
       {
        if ( dmg > dmgKillCrew )
        {  
         player.SetHealth(0.0);
        }
        else
        {
         //deal shock to player
         float shockTemp = Math.InverseLerp(dmgThreshold, dmgKillCrew, dmg);
         float shock = Math.Lerp( 50, 100, shockTemp );

         player.AddHealth("", "Shock", -shock );
         //Print( "SHOCK..........." + shock );
        }
       }
      }

      ProcessDirectDamage( 3, null, zoneName, "EnviroDmg", "0 0 0", dmg );

     }
    }
   break;
  }
 }

 

so my on contact looks like this have i done it correct

 

void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
    {

        //Print(zoneName);
        //Print(other);
        
        //Print( data.Impulse);
        //float        RelativeNormalVelocityBefore;
        //float        RelativeNormalVelocityAfter;
        //Print( data.Normal);
        //Print( data.Position);
        //vector        RelativeVelocityBefore;
        //vector        RelativeVelocityAfter;

    }

Share this post


Link to post
Share on other sites

It should be the whole void OnContact   i mean i cant test it    so all what i wrote above    if you have try it on a test server   my Servers dont want to override it   like in the Stamina thread 

 

Greetz

Share this post


Link to post
Share on other sites

thanks its all working now woudl you know how to set fresh spawned vehicles to a full fuel tank or to have some in it

Share this post


Link to post
Share on other sites
4 minutes ago, mrwolv said:

thanks its all working now woudl you know how to set fresh spawned vehicles to a full fuel tank or to have some in it

dayzOffline.chernarusplus->"cfgspawnabletypes.xml"   search for your Vehicle     i think you can spawn them a Gasoline Cannister  but not sure    like          

<attachments chance="1.00">
            <item name="CanisterGasoline" chance="1.00" />
        </attachments>      

 

but dont know if ist gonna spawn in the trunk   Needs some test

Edited by G0ndalf

Share this post


Link to post
Share on other sites
Just now, G0ndalf said:

dayzOffline.chernarusplus->"cfgspawnabletypes.xml"   search for your Vehicle     i think you can spawn them a Gasoline Cannister  but not sure    like           <attachments chance="1.00">
            <item name="CanisterGasoline" chance="1.00" />
        </attachments>       but dont know if ist gonna spawn in the trunk   Needs some test

yeah i have it set like that but would  be nice to have like a bit of fuel in the tank already :D

Share this post


Link to post
Share on other sites

Gonna look at this        then you have to put it in when the Server spawns it         should be in the Script.pbo or something (i believe)

Share this post


Link to post
Share on other sites
6 minutes ago, G0ndalf said:

Gonna look at this        then you have to put it in when the Server spawns it         should be in the Script.pbo or something (i believe)

do we know where the play spawn time is so i can change it i have totaly forgot where i saw it hahaha i want to change it from 15 to 5

Share this post


Link to post
Share on other sites

Must delet all this ?

void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
	{

		//Print(zoneName);

		if ( zoneName == "" )
		{
			Print("CarScript >> ERROR >> OnContact dmg zone not defined!");
			return;
		}
		
		switch( zoneName )
		{
/*
			case "dmgZone_lightsLF":
				//Print("dmgZone_lightsLF");
			break;
			
			case "dmgZone_lightsRF":
				//Print("dmgZone_lightsRF");
			break;
*/
			default:
				if ( GetGame().IsServer() && zoneName != "")
				{
					float dmgMin = 150.0;	
					float dmgThreshold = 750.0;
					float dmgKillCrew = 3000.0;
					float dmg = data.Impulse * m_dmgContactCoef;

					if ( dmg < dmgThreshold )
					{					
						if ( dmg > dmgMin )
						{
							//Print( GetType() + " >>> " + " SmallHit " + zoneName + " >>> " + dmg.ToString() + " >>> " + localPos);
							AddHealth( zoneName, "Health", -dmg);
						}
					}
					else
					{
						
						//Print( GetType() + " >>> " + " BIGHit " + zoneName + " >>> " + dmg.ToString() + " >>> " + localPos );
						//Print( dmg );

						for( int i =0; i < CrewSize(); i++ )
						{
							Human crew = CrewMember( i );
							if ( !crew )
								continue;

							PlayerBase player;
							if ( Class.CastTo(player, crew ) )
							{
								if ( dmg > dmgKillCrew )
								{		
									player.SetHealth(0.0);
								}
								else
								{
									//deal shock to player
									float shockTemp = Math.InverseLerp(dmgThreshold, dmgKillCrew, dmg);
									float shock = Math.Lerp( 50, 100, shockTemp );

									player.AddHealth("", "Shock", -shock );
									//Print( "SHOCK..........." + shock );
								}
							}
						}

						ProcessDirectDamage( 3, null, zoneName, "EnviroDmg", "0 0 0", dmg );

					}
				}
			break;
		}
	}

 

Share this post


Link to post
Share on other sites
2 hours ago, mrwolv said:

?

 

 

Here is the modified version of the scripts.pbo if you have problems https://drive.google.com/file/d/15_uUE99yJrt_gO95L-jaTsXC6bmzg47K/view?usp=sharing

By "delete the complet function body" i meant 

    void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
    {

    }

Now your car don't react at all if you drive agains something

Share this post


Link to post
Share on other sites
42 minutes ago, Mostabdel said:

so i delete all in { } ?!!!

 

Yes,   just let the 

void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
    {

//DELELTE EVERYTHING IN ME

    } 

 

otherwise you can also Change the Damage that the car can hold

Quote

default:
    if ( GetGame().IsServer() && zoneName != "")
    {
    // float dmgMin = 150.0; 
     float dmgMin = 1625.0; 
    // float dmgThreshold = 750.0;
     float dmgThreshold = 2700.0;
    // float dmgKillCrew = 3000.0;
     float dmgKillCrew = 3500.0;

i wanna make it "stable" so the engine dont "explode" after a Little crash   so i have to try  my next step is to set the "m_EngineHealth = 1;"    Maybe i can do something    like i know 1 = 100%    but if i do it to 5 (500%) the engine itself should hould 5 times damge or not ? ^^      Maybe someone try it today    ill do it tomorrow anyways    just a info for ya

 

greetz

Gondalf

  • Thanks 1

Share this post


Link to post
Share on other sites

Hello,

 

I`m trying to remove the damage of cars on my server.

Deleted all inside { } but I got an error from another mod trying to load the server.

Something like CREDITS...

 

Can someone help, please?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×