Tornado1001 4 Posted August 11, 2017 So I am making a mission on Malden where some NATO guys are pinned while rebels surround them. I want mortars to drop randomly but don't do damage (like in Hollywood where mortars go off right next to people and they just get dirt flinged on them that kinda thing). I googled and saw this script on Reddit here: https://www.reddit.com/r/armadev/comments/2qwzgq/fake_artillerymortar_fire_around_player/ I get the error " |#|[t1, numberOfShells] execVM "artySim.sqf"; Error Type Script, expected Bool" t1 being the trigger name. I made the SQF file and pasted the script below in it. I am still new around scripting but from what I can tell there's nothing wrong but I'm probably wrong. Any help would be appreciated on this. //Arty Incoming // 2014/04/26 //Trigger, Count, Distance, Type if (!isServer) exitWith {}; _theTrigger = [_this, 0, objNull, [objNull]] call BIS_fnc_param; _theTriggerPos = getPos _theTrigger; _theTriggerRadius = (triggerArea _theTrigger) select 0; _shellCount = [_this, 1, 1, [0]] call BIS_fnc_param; _safeDistance = [_this, 2, 62, [0]] call BIS_fnc_param; _shellType = [_this, 3, "Sh_82mm_AMOS", [""]] call BIS_fnc_param; for "_index" from 1 to _shellCount do { _posToFireAt = []; while {(count _posToFireAt) == 0} do { _posToFireAt = [_theTriggerPos, (random _theTriggerRadius), (random 360)] call BIS_fnc_relPos; { if ((_x distance _posToFireAt) < _safeDistance) exitWith {_posToFireAt = [];}; } forEach allUnits; }; systemChat format ["Shell Incomming [%1]", (player distance _posToFireAt)]; _posToFireAt set [2, 800]; _shell = _shellType createVehicle _posToFireAt; _shell setPos _posToFireAt; _shell setVelocity [0,0,-200]; if ((_index % 4) == 3) then { sleep (3 + (random 1) / 4); } else { sleep random 0.1; }; }; Mission Type: Nato forces are pinned down in the ruined military base on Malden and are being surrounded by rebel fighters (couple dozen with lowest skill and barely any optics are weapons) and the area around the ruined dome is heavily mined and the dome has many sandbag emplacements. I would like the effect of being shelled by the enemy but it kills everyone in the mission (Kinda like a Benghazi mission where few elite guys hold small area in close quarter combat from all directions). I'd like for the mortars to drop but cause no damage at all. I don't want to make anyone invincible since it ruins the immersion/purpose of the mission (to survive). Any help would be appreciated! Share this post Link to post Share on other sites
M1ke_SK 230 Posted August 11, 2017 I tried once that way, where I replaced mortar shell with "minigrenade" to avoid damage. I need to find that code tho :D Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted August 11, 2017 I would probably approach it differently, and instead modify (reduce) incoming damage to the players body, if the cause is a mortar shell/explosion. 1 Share this post Link to post Share on other sites
Tornado1001 4 Posted August 11, 2017 6 minutes ago, fn_Quiksilver said: I would probably approach it differently, and instead modify (reduce) incoming damage to the players body, if the cause is a mortar shell/explosion. How would I go around doing that? (New to scripting lol) Share this post Link to post Share on other sites
M1ke_SK 230 Posted August 11, 2017 5 hours ago, Tornado1001 said: How would I go around doing that? (New to scripting lol) Probably with https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted August 11, 2017 8 hours ago, Tornado1001 said: How would I go around doing that? (New to scripting lol) haha, was kind of hoping others would take over here with the actual lines of script for the damage handling :) Share this post Link to post Share on other sites
7erra 629 Posted August 11, 2017 _unit addEventHandler ["HandleDamage", { _damage = _this select 2; _projectile = _this select 4; _disabledAmmo = ["", "Sh_82mm_AMOS"]; if (_projectile in _disabledAmmo) then {_damage = 0;}; _damage }]; Not perfect but it does the job. If you need other projectile classnames you can use this modified variant: _unit addEventHandler ["HandleDamage", { _damage = _this select 2; _projectile = _this select 4; _disabledAmmo = ["", "Sh_82mm_AMOS"]; if (_projectile in _disabledAmmo) then {_damage = 0;} else {systemchat str _projectile;}; _damage }]; The problem is that it also disables the damage from projectiles with unknown classnames ("",eg explosions). Best practice would be to only add the EH to the unit when needed and remove it as soon as possible. 1 Share this post Link to post Share on other sites
madrussian 347 Posted August 12, 2017 I did something similar a while back. An objective where you have to destroy a fuel truck, but the default fuel truck explosion is pretty weak and just pretty much fizzles. I wanted the truck to really go BOOM! So I added a killed EH to fuel truck, and upon destroyed I spawned and detonated a large bomb (the huge one the Wipeout drops). Worked great, huge boom indeed!!! But... it was killing everyone in sight, including the player and his squad nearly that destroyed the truck. After some experimentation, I came up with the perfect solution. I attached the bomb inside the truck using attachTo (completely encased with no part of the bomb showing) and then detonated the bomb. Finally, everything was perfect. BIG BOOM visual effect! (that deals zero damage) Plus small boom that still killed people close by in limited way (due to the original truck explosion). In short, maybe you could encase your bomb in slightly larger object that will (completely) shield the blast. 1 Share this post Link to post Share on other sites
7erra 629 Posted August 12, 2017 Just made another attempt: myMortar addEventHandler ["Fired", { _this spawn { params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile","_gunner"]; waitUntil {(getPos _projectile) select 2 <= 1}; _impactPos = getPos _projectile; _impactPos set [2,0]; _cfgRange = getNumber (configfile >> "CfgAmmo" >> _ammo >> "indirectHitRange"); _objectsInRange = allUnits inAreaArray [_impactPos, _cfgRange*2, _cfgRange*2]; {_x allowDamage false} forEach _objectsInRange; waitUntil {isNull _projectile}; {_x allowDamage true} forEach _objectsInRange; }; }]; This way you wont take any damage even if you get hit directly. Everyone in range will be invincible for a split second. All mortar effects are still as if nothing's changed (sound, impact, desctruction). If you want to only protect player units and don't care about AI (those poor things) then you can change allUnits to allPlayers. Share this post Link to post Share on other sites
pierremgi 4833 Posted August 12, 2017 @7erra Nice, but don't forget the allowDamage command have to run locally, so you need to adapt your script for MP: if (local _x) then {{_x allowDamage false} forEach _objectsInRange }.... Not tested, just a hunch. Share this post Link to post Share on other sites
7erra 629 Posted August 12, 2017 {[_x,false] remoteExec ["allowDamage"]} forEach _objectsInRange; {[_x,true] remoteExec ["allowDamage"]} forEach _objectsInRange; Would be the safest guess. Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted August 13, 2017 20 hours ago, 7erra said: {[_x,false] remoteExec ["allowDamage"]} forEach _objectsInRange; {[_x,true] remoteExec ["allowDamage"]} forEach _objectsInRange; Would be the safest guess. that might be a lot of network messages ... I would probably send one network message with instructions, like this: [ [_objectsInRange,FALSE], { { _x allowDamage (_this select 1); } forEach (_this select 0); } ] remoteExec ['call',_objectsInRange]; Share this post Link to post Share on other sites