Search the Community
Showing results for tags 'bomb hole'.
Found 1 result
-
CRATERS Hi all, This topic gave me an idea for scripting craters after an explosion. I share this code you can add in an sqf or a trigger set to TRUE, server only should work. I'll add a similar code in my "terrain & map interactive" MGI module. Parameters: none MGI_hashAmmo = createHashMapFromarray (("true" configClasses (configFile / "cfgAmmo")) apply {[configName _x, getNumber (_x/"hit")]}); ["MGI_craters", "onEachFrame", { _flyingProj = (8 allObjects 2); { if (isNil {_x getVariable "EH"} ) then { _x setVariable ["EH", _x addEventHandler ["explode", { params ["_proj","_pos","_vel"]; _pos deleteAt 2; private _hit = MGI_hashAmmo get typeOf _proj; private _calc = log ((sqrt vectorMagnitude _vel*sqrt _hit) max 1.1); [_proj,_calc,_pos] spawn { params ["_proj","_calc","_pos"]; sleep 0.1; private _crater = _pos nearestObject "#crater"; if (!isNull _crater) then { _pos = getPosASL _crater; private _surface = (configFile /"cfgSurfaces"/ (surfaceType _pos splitString "#")#0); private _depress = getTerrainHeightASL _pos - ((_calc/(getNumber (_surface / "surfaceFriction") max 1)*(getNumber (_surface /"dust") max 0.01 min 1)) min 3); _pos set [2,_depress]; (setTerrainHeight [[_pos],TRUE]) remoteExec ["call",2]; }; }; }] ]; }; } forEach _flyingProj; }] call BIS_fnc_addStackedEventHandler; This code creates craters after explosion on ground (where Arma craters are). So, not on vehicles, not on buildings. Note1: Firing AP shell (armor piercing one) doesn't lead to explosion (Arma engine), so you need to fire HE shell for craters. Note2: at this time, craters after crash (planes) don't fire the code. this code is for EXPLODING PROJECTILES only. Feedback are welcome! Have fun.