Cionara 10 Posted September 9, 2009 Could someone please post a little script how to damage a vehicle ? I want to destroy a humvee when it reaches a waypoint, what do I have to type into init ? greets Cionara Share this post Link to post Share on other sites
PuFu 4600 Posted September 9, 2009 humvee setdamage 1 * humvee needs to be the name of the object you want to destroy in this case 0 - none 1 - full/destroy http://community.bistudio.com/wiki/setDamage Share this post Link to post Share on other sites
Cionara 10 Posted September 11, 2009 Thank you very much. Is there also a command to do like 50% damage ? Just interested :) Share this post Link to post Share on other sites
LardThief 10 Posted September 11, 2009 Thank you very much.Is there also a command to do like 50% damage ? Just interested :) vehicle setdamage 0.5; .....you can do more than 1 dp so eg 0.58 I think anywhere above 0.8 and it starts smoking and needs fixing or it will explode. Share this post Link to post Share on other sites
Cionara 10 Posted September 11, 2009 (edited) Ah I see :D Another thing: I also want a humvee to be damaged when driving faster then I want. Now I know the command to damage a vehicle. Is there a command to get the current speed values of a humvee ? Kind of: if ((speed this) >= 80) then {this setdamage 0.5} but I don' know how to make it correct => greetz Cionara Edited September 11, 2009 by Cionara Share this post Link to post Share on other sites
dmarkwick 261 Posted September 11, 2009 (edited) Speed. Then, you'll need to loop it. So, using your code (and untested BTW, just giving you the idea): while {(speed this) < 80} do {sleep 3;}; this setdamage 0.5; Basically you'll be looping waiting for the speed to get over 80. If not then you'll wait 3 seconds then test it again. You can make the wait as long or as short as you feel is appropriate. Edited September 11, 2009 by DMarkwick Share this post Link to post Share on other sites
Cionara 10 Posted September 12, 2009 (edited) Oh yea you're right, I didn't think of that :) But now (with your script) it gets damaged immedtiately from the start. Could I write an "if" in that while loop ? while {alive this} do {if ((speed this) >= 80) then {this setdamage 0.5}} Damn it doesn't work. Nothing happens when reaching 80km/h. Edited September 12, 2009 by Cionara Share this post Link to post Share on other sites
dmarkwick 261 Posted September 12, 2009 Are you able to hint up the current speed in game? Just to make sure it's working properly. You can hint using: hint format ["Speed = %1", speed this]; Another thing to consider is to use a script instead of using the ArmA2 editor. So you place your code in a script and then you can call this script from the editor (unit's init field). In your MyDocs\ArmA2 Other Profiles\Username folder make a folder called Scripts, so it looks like this: MyDocs\ArmA2 Other Profiles\Username\Scripts then you can put your scripts in here and your editor previewed missions can access them. In your vehicle's init field type: nul = [this] execVM "Overspeed.sqf"; and in your fancy new Scripts folder make a file called Overspeed.sqf and place your code in there. The [this] will be passed to the script and within the script it will be called _this. So your fist line in your script will probably look like this: _thisVehicle = _this; allowing you to treat _thisVehicle as your speeding vehicle. Total script might look like this: _thisVehicle = _this; while {alive _thisVehicle} do { if ((speed _thisVehicle) >= 80) then { _thisVehicle setDamage 0.5; }; sleep 1; }; Or something like that. You might like to change that setDamage to: _thisVehicle setDamage ((getDamage _thisVehicle) + 0.5); just in case it's already damaged :) Share this post Link to post Share on other sites
Cionara 10 Posted September 12, 2009 (edited) Ok I will try that out. Thanks very much. while {this alive} do {hint format ["Speed = %1", speed this]; sleep 1} I think sleep-command is not working. It goes crazy and doesn't stop for 1 second. Are you able to hint up the current speed in game? Yes that works. Does somebody know where the problem is ? :( Edited September 12, 2009 by Cionara Share this post Link to post Share on other sites