JohnKalo 657 Posted June 23, 2018 How can I make the windows and tires of a vehicle to be bulletproof? They should be able to handle about 6 bullets or so and then be destroyed if more are fired against either the windows or the tires. 2 Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted June 23, 2018 You can use a handleDamage EH, check for the selection, if it's a window/tire, return 0. Keep in mind that you'd also need to delete the projectile after it hit the vehicle, otherwise it could cause more damage after passing the unharmed window. Cheers 2 Share this post Link to post Share on other sites
JohnKalo 657 Posted June 23, 2018 Okay that seems too complicated How will I make this method MP compatible and hitSelection section ... how do I say window or tires? Plus, type of projectile? Anything can damage both the windows and the tires. Ehm, hope there is an easier way or else I will need much more help. I have never again used an eventhandler let alone a much more complicated procedure Share this post Link to post Share on other sites
Mr H. 400 Posted June 23, 2018 Yet @Grumpy Old Man's solution is a good one, event handlers are not that complicated either! I doubt you'll find a simpler way anyway. 1 Share this post Link to post Share on other sites
pierremgi 4736 Posted June 23, 2018 in init field of your vehicle; if (isServer) then {this setVariable ["hitProof",0,true]}; this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage"]; if ((["wheel",_selection] call Bis_fnc_inString or ["glass",_selection] call Bis_fnc_inString) && _unit getVariable "hitProof" <7) then { _unit setVariable ["hitProof", (_unit getVariable "hitProof") + 1,true]; hint str (_unit getvariable "hitProof"); _damage = _unit getHit _selection}; _damage }]; 1 2 Share this post Link to post Share on other sites
JohnKalo 657 Posted June 24, 2018 @Mr H.Yep, his solutions are all good. @pierremgi Thaaaaaaanks!!!! Will check it out asap Share this post Link to post Share on other sites
JohnKalo 657 Posted June 24, 2018 @pierremgi It partly worked The damage inflicted on the windows is simply perfect. You have to shoot many bullets in order to break them. However the bullets go through in through and kill all passengers. Additionally the tires blow up as they normally do. Plus on the top right a hint appears counting up to 7 when I shoot the windows. How do you get rid of that too? Share this post Link to post Share on other sites
pierremgi 4736 Posted June 24, 2018 2 hours ago, JohnKalo said: @pierremgi It partly worked The damage inflicted on the windows is simply perfect. You have to shoot many bullets in order to break them. However the bullets go through in through and kill all passengers. Additionally the tires blow up as they normally do. Plus on the top right a hint appears counting up to 7 when I shoot the windows. How do you get rid of that too? Just remove the hint line. Corrected to make separated variables for each tires and glasses! For crew, you can add two lines, making them invulnerable while (the tires and especially) glasses are bullet proof. So: if (isServer) then { {this setVariable [_x,0,true]} forEach ((getAllHitPointsDamage this select 1) select {!(_x isEqualTo "")}) }; this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage"]; if ((["wheel",_selection] call Bis_fnc_inString or ["glass",_selection] call Bis_fnc_inString) && _unit getVariable _selection <7) then { _unit setVariable [_selection, (_unit getVariable _selection) + 1,true]; {_x allowDamage false} forEach crew _unit; _damage = _unit getHit _selection; } else { {_x allowDamage true} forEach crew _unit; }; _damage }]; 1 3 Share this post Link to post Share on other sites
JohnKalo 657 Posted June 25, 2018 So it seems to work but there is however a serious issue. I tried shooting a unit while he was in the car. The blood splatters and the bullet going through in through is shown but that is not the serious problem. The serious one is that sometimes the unit exits the vehicle and has his damage disabled. No matter how many times I shoot the guy he takes no damage!!! Any fix for that one? Share this post Link to post Share on other sites
pierremgi 4736 Posted June 25, 2018 1 hour ago, JohnKalo said: So it seems to work but there is however a serious issue. I tried shooting a unit while he was in the car. The blood splatters and the bullet going through in through is shown but that is not the serious problem. The serious one is that sometimes the unit exits the vehicle and has his damage disabled. No matter how many times I shoot the guy he takes no damage!!! Any fix for that one? if (isServer) then { {this setVariable [_x,0,true]} forEach ((getAllHitPointsDamage this select 1) select {!(_x isEqualTo "")}); this setVariable ["MGI_bulletProof",true,true]; }; this addEventHandler ["HandleDamage", { params ["_veh", "_selection", "_damage"]; if ((["wheel",_selection] call Bis_fnc_inString or ["glass",_selection] call Bis_fnc_inString) && _veh getVariable _selection <7) then { _veh setVariable [_selection, (_veh getVariable _selection) + 1,true]; _damage = _veh getHit _selection; } else { _veh setVariable ["MGI_bulletProof",false,true]; }; _damage }]; { _x addEventHandler ["HandleDamage", { params ["_unit", "", "_damage"]; if (objectParent _unit getvariable ["MGI_bulletProof",false]) then { _damage = 0 } else { _damage }; _damage }]; } forEach crew this; 2 Share this post Link to post Share on other sites
JohnKalo 657 Posted June 27, 2018 It works!!!! Thanks. Share this post Link to post Share on other sites
JCataclisma 36 Posted July 12, 2023 Excuse me, PierreMGI, may I ask whether have you been dealing with the related stuff lately? Because that last script from your in this topic works GREAT, especially in dedicated multiplayer server, BUT, when running inside the Quiksilver's Invade&Annex framework, its execution causes a funny glitch: every player that was inside the vehicle which calls that script ended up no longer getting incapacitated, but dead at once. In our scenario, the player applies it by using an addAction in a building, which will search and execute it upon a nearby helicopter. Share this post Link to post Share on other sites
pierremgi 4736 Posted July 13, 2023 3 hours ago, JCataclisma said: ... BUT, when running inside the Quiksilver's Invade&Annex framework, its execution causes a funny glitch: every player that was inside the vehicle which calls that script ended up no longer getting incapacitated, but dead at once. In our scenario, the player applies it by using an addAction in a building, which will search and execute it upon a nearby helicopter. Probably due to the way you're calling it. This is supposed to refer to a vehicle with wheels and glasses, and you need to place it in the init field of an edited one. The variable This has no sense outside an init field. I can't guess how and what you're scripting. By the way, an init field runs everywhere (server + clients), an addAction runs the code locally (on caller's PC). Also, no clue with possible interactions with scripts from Invade&Annex framework. You should make things simple, and consider the init field of the vehicle. If that doesn't work, forget. 1 Share this post Link to post Share on other sites
JCataclisma 36 Posted July 13, 2023 Nice! Some "small" but effective points to get me on the path. I'll bring the code here once I get the adapted/changed stuff properly working. Thank you!!! Share this post Link to post Share on other sites