Forum Jump :

Author Message


Posts: 22
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2014-03-28 19:55        
     
hello there. first time posting here and was hoping you guys could help me.
i am trying to get in the init of a vehicle that a certain part cant be damaged.
what i am after is that only the wheels can be damaged of the vehicles for a trainings mission.
i already found the car1 setHit ["wheel_1_1_steering",false]; but this only allows to damage it or repair it. i want in this case the wheel to be invincible. any way of doing that?


Author Message


Posts: 250
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name: austinXmedic

 
#2 Posted at 2014-03-28 20:42        
     
You need to loop it through a script. Or I suppose you could just use the spawn command, but I would use a script instead.

while{alive car1} do
{
       waitUntil{car1 getHitPointDamage "wheel_1_1_steering" > 0.001};
       car1 setHit ["wheel_1_1_steering",0]; 
       sleep 0.0001;
};

paste that code into a file called init.sqf (make a .txt file in notepad first, then rename it) -- make sure you delete the .txt extension and if your computer asks you about the extension just click yes do it anyways. Then when you go to play your mission, since init.sqf is always loaded in if it exists in the mission file before anything else.

Some of my work:
http://steamcommunity.com/sharedfiles/filedetails/?id=287343671 -- Unit Play/ Unit Capture Functions Guide
http://steamcommunity.com/sharedfiles/filedetails/?id=265454265 -- Zeus Guide
add me on steam: austin_medic

Advertisement


Author Message


Posts: 22
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2014-03-28 20:53        
     
# austin(medic) : You need to loop it through a script. Or I suppose you could just use the spawn command, but I would use a script instead.

while{alive car1} do
{
       waitUntil{car1 getHitPointDamage "wheel_1_1_steering" > 0.001};
       car1 setHit ["wheel_1_1_steering",0]; 
       sleep 0.0001;
};

paste that code into a file called init.sqf (make a .txt file in notepad first, then rename it) -- make sure you delete the .txt extension and if your computer asks you about the extension just click yes do it anyways. Then when you go to play your mission, since init.sqf is always loaded in if it exists in the mission file before anything else.

hello and thanks for the fast reply. i tried this in the editor but it doesnt seem to work?


Author Message


Posts: 1484
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2014-03-28 20:55        
     
The way the damage system makes it a little difficult unless you want to change config values and the all users would need that file/addon.

You could also use an event handler placed in the vehicles init.
When it gets hit it just repairs the parts listed.

this addEventHandler ["hit",{player sidechat str (_this select 0) ;{(_this select 0) setHit [_x,0] } foreach ["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering"] }  ]

It isn't perfect as damage taken by one part also effects other parts of the vehicle, continually shooting the tire will destroy the vehicle even though the tire is still being repaired.

Austins should work but it needs to be in script or spawned

null = car1 spawn {
while{alive car1} do
{
       waitUntil{car1 getHitPointDamage "wheel_1_1_steering" > 0.001};
       car1 setHit ["wheel_1_1_steering",0]; 
       sleep 0.0001;
};
};


Author Message


Posts: 22
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2014-03-28 21:05        
     
The way the damage system makes it a little difficult unless you want to change config values and the all users would need that file/addon.

You could also use an event handler placed in the vehicles init.
When it gets hit it just repairs the parts listed.

this addEventHandler ["hit",{player sidechat str (_this select 0) ;{(_this select 0) setHit [_x,0] } foreach ["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering"] } ]



this one works like a charm. only thing is that it says the objects name in side chat constantly? sorry im a absolute noob in all this. also in scripts. but i am desperatly trying to learn :)


Author Message


Posts: 1484
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2014-03-28 21:28        
     
Try that, I was using it for debug

this addEventHandler ["hit",{{(_this select 0) setHit [_x,0] } foreach ["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering"] } ]


Author Message


Posts: 22
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#7 Posted at 2014-03-28 22:08        
     
# F2kSel : Try that, I was using it for debug

this addEventHandler ["hit",{{(_this select 0) setHit [_x,0] } foreach ["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering"] } ]

works perfectly <3 thanks allot!

whilst im being a whiney arse anyhow :P
cuz basically. everything has to stay in condition except the wheels. its cop training so shoot the wheels :P
do you got a way to keep ai in vehicles even after their entire wheels are shot down?


Author Message


Posts: 1484
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#8 Posted at 2014-03-28 22:28        
     
I think this should do it

place in vehicles init
this allowCrewInImmobile true;


Author Message


Posts: 22
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#9 Posted at 2014-03-28 23:31        
     
# F2kSel : I think this should do it

place in vehicles init
this allowCrewInImmobile true;

you guys are wonderfull






Tags: Help, Init, Vehicles, Wheel