wasicun 11 Posted August 30, 2010 Hi all friends! I'm trying to make a mission in wich there are takistan militians that attack with mortars a british jackal (like you see in the new BAF campaign). How can i do it? I mean, if you put the takistans on the mortars, they will not shoot on the british jackal... How can i create a mission where the bad guys use the mortars? Thank you for help (and excuse my poor English) Share this post Link to post Share on other sites
Egosa-U 10 Posted August 30, 2010 use dotarget and dofire. But beware: Upon moving targets the dotarget command can make problems. Use an invisible, non-moving helipad in a certain height for targetting and adjust that one for a perfect hit Share this post Link to post Share on other sites
kylania 568 Posted August 30, 2010 Do it like they do it in that mission, fake it. The mortars aren't actually shooting, they just create explosions randomly. Called by: {[markerPos "base", _x, observer] execVM "mortars.sqf"} forEach _mortars; mortars.sqf: _targetPos = _this select 0; _mortar = _this select 1; _observer = _this select 2; _observerCoef = 1; while {alive gunner _mortar} do { if (!(alive _observer)) then {_observerCoef = 3}; _randomPos = [_targetPos, (random 150) * _observerCoef, random 360] call BIS_fnc_relPos; {if (_randomPos distance _x < 5) then {_randomPos = [position _x, 5, random 360] call BIS_fnc_relPos}} forEach units player; impactArea setPos _randomPos; mortarFalling = TRUE; publicVariable "mortarFalling"; sleep 1.75; _shell = "Sh_85_AP" createVehicle _randomPos; mortarFalling = FALSE; publicVariable "mortarFalling"; sleep ((15 + random 15) * _observerCoef) }; Share this post Link to post Share on other sites
wasicun 11 Posted August 30, 2010 thank you very much friends! Share this post Link to post Share on other sites
icebreakr 3156 Posted August 30, 2010 Is there a sound of fallin' mortar round in game? Share this post Link to post Share on other sites
kylania 568 Posted August 30, 2010 Is there a sound of fallin' mortar round in game? Yes, the mortarFalling publicVariable activates a trigger on the map which plays the mortar1 sound while active. Share this post Link to post Share on other sites
icebreakr 3156 Posted August 30, 2010 kylania: thank you, great stuff. Share this post Link to post Share on other sites
wasicun 11 Posted August 30, 2010 Do it like they do it in that mission, fake it. The mortars aren't actually shooting, they just create explosions randomly.Called by: {[markerPos "base", _x, observer] execVM "mortars.sqf"} forEach _mortars; mortars.sqf: _targetPos = _this select 0; _mortar = _this select 1; _observer = _this select 2; _observerCoef = 1; while {alive gunner _mortar} do { if (!(alive _observer)) then {_observerCoef = 3}; _randomPos = [_targetPos, (random 150) * _observerCoef, random 360] call BIS_fnc_relPos; {if (_randomPos distance _x < 5) then {_randomPos = [position _x, 5, random 360] call BIS_fnc_relPos}} forEach units player; impactArea setPos _randomPos; mortarFalling = TRUE; publicVariable "mortarFalling"; sleep 1.75; _shell = "Sh_85_AP" createVehicle _randomPos; mortarFalling = FALSE; publicVariable "mortarFalling"; sleep ((15 + random 15) * _observerCoef) }; Thank you very much mate! It's a good starting point. Of course _mortars should be somethink like [E1, E2, E3, E4, E5, E6], in which every E# is a mortar piece. Right? _mortars = [E1, E2, E3, E4, E5, E6]; How can I set the <markerPos "base"> parameter in order to keep the right coordinates of the spotted target? It will be great if you can create a little demo mission and send me to Wasicun@gmail.com :P thank you very much friend Share this post Link to post Share on other sites
kylania 568 Posted August 31, 2010 Here's a demo mission showing this script in effect. I added optional player tracking as well, since the script assumes a static target. Those lines are highlighted in red here: _targetPos = _this select 0; _mortar = _this select 1; _observer = _this select 2; [color="Red"]_tracking = if (count _this > 3) then {_this select 3} else {false}; // Optional tracking, added by kylania[/color] _observerCoef = 1; while {alive gunner _mortar} do { [color="Red"] if (_tracking) then {_targetPos = getPos (vehicle player)}; // Optional tracking, added by kylania[/color] if (!(alive _observer)) then {_observerCoef = 3}; _randomPos = [_targetPos, (random 150) * _observerCoef, random 360] call BIS_fnc_relPos; {if (_randomPos distance _x < 5) then {_randomPos = [position _x, 5, random 360] call BIS_fnc_relPos}} forEach units player; impactArea setPos _randomPos; mortarFalling = TRUE; publicVariable "mortarFalling"; sleep 1.75; _shell = "Sh_85_AP" createVehicle _randomPos; mortarFalling = FALSE; publicVariable "mortarFalling"; sleep ((15 + random 15) * _observerCoef) }; You'll notice that it's called with an "extra" argument, which can be left off, but to track the player just add the , true to the execVM arguments. _mortars = [m1,m2,m3]; {[getPos player, _x, observer, true] execVM "mortars.sqf"} forEach _mortars; // using optional player tracking Share this post Link to post Share on other sites
wasicun 11 Posted August 31, 2010 Thank you very much Kylania.You are the number one! ---------- Post added at 02:29 PM ---------- Previous post was at 01:56 PM ---------- Do you know if is possible to make a mission where mortars shoot to blu force (they don't aim to player only, but to every american that they spot)? Thank you so much! Share this post Link to post Share on other sites
kylania 568 Posted August 31, 2010 Well, I'm not sure this would be the script for it. This script basically never hits you and it's designed for single player. It's really just for scaring a player. :) You could replace the getPos vehicle player stuff with a search for nearest WEST unit or something though. Share this post Link to post Share on other sites