Jump to content
Sign in to follow this  
KrisSerbia

Artillery fire at area

Recommended Posts

Hi Orcinus

I accidentally place one russian unit desert camo pack in the mission.And I using Russian modern mechanized infantry.That unit has hiding somewhere in the sea.I agree with you and Rydygier,but that isn't addons just for one mission,that's for five missions in Lingor(missions in Lingor are first part of camping).

Share this post


Link to post
Share on other sites

Tested last version, but as for triggers - same triggers issue for me.

Anyway - found source of yours problem - you are using in this mission one of older version of ArtySim. Use code from last package (D2 link above).

ArtySim.sqf file must contain this line:

ArtySim_Stop = false;

(you can check this with notepad, but best just paste and overwrite into mission folder newest files)

Share this post


Link to post
Share on other sites
Hi Orcinus

I accidentally place one russian unit desert camo pack in the mission.

Perfect example of why not to attempt to develop scripts except in vanilla (or as vanilla as possible) :D
And I using Russian modern mechanized infantry.That unit has hiding somewhere in the sea.I agree with you and Rydygier,but that isn't addons just for one mission,that's for five missions in Lingor(missions in Lingor are first part of camping).
Again, get script development done in a vanilla environment. When it is working OK, add it to one mission after the other with testing. Really, it will save you a lot of time and hassles in the long run.

Cheers

Orcinus

Share this post


Link to post
Share on other sites

So, as i'm also a noob and currently using one of the scripts you provided i thought i'd hijack this thread just to ask if there's anyway to apply this to an AI so that he acts as a FO, and if killed, the script stops?

Share this post


Link to post
Share on other sites

Here's how BIS did it basically. You have three physical mortars and a forward observer. If the observer is killed the mortars get inaccurate and slower to fire. Once the mortars are found and destroyed they stop firing.

init.sqf:

mortarFalling = FALSE;
waitUntil {!(isNil "BIS_fnc_init")};
_mortars = [m1,m2,m3];
{[getPos player, _x, observer, true] execVM "mortars.sqf"} forEach _mortars;  // using optional player tracking

mortars.sqf:

_targetPos = _this select 0;
_mortar = _this select 1;
_observer = _this select 2;
_tracking = if (count _this > 3) then {_this select 3} else {false}; // Optional tracking, added by kylania

_observerCoef = 1;

while {mortarsActive} do {	
if (_tracking) then {_targetPos = getPos (vehicle player)}; // Optional tracking, added by kylania
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)
};

Then in mission you'd have a trigger that checks for all the mortars to be dead to set mortarsActive to false. Or if you wanted just have it check for the observer instead and use that to stop it. Also "impactArea" is a trigger with the falling mortars sound effect.

Share this post


Link to post
Share on other sites

Holy shit. That's a quick answer! Thanks a bunch, ill try that!

Edit: I forgot to ask, how do i tell the script who's the FO?

---------- Post added at 16:06 ---------- Previous post was at 15:40 ----------

Okey, now i feel stupid. The error messages have stopped now, i had a few AI names wrong. But they still won't fire. Do i sync the trigger to anything? Should the trigger cover no area or does it represent the area of impact?

Edited by rikardgladt

Share this post


Link to post
Share on other sites

They don't actually "fire". They just sit there and shells are created around the player. The FO is the unit named "observer" in the init.sqf call for mortars.sqf.

Here's a demo mission of all that happening.

Share this post


Link to post
Share on other sites

Okey, so it seems like it doesn't work in I44, maybe i should have asked you that before wasting you're time. I apolagize for that! But thank you anyways for the quick responses!:)

Edit: Scratch that, got it working:) thanks!

Edited by rikardgladt

Share this post


Link to post
Share on other sites

Ahh, that code I had up there was from a different version! I'll fix that. :) The demo mission has the right code though. It should work in i44, but you might need to change the shell name it creates, the "Sh_85_AP" part.

Share this post


Link to post
Share on other sites

Hi guys, so I am working with his code brought up earlier in the thread. I need this script to deactivate after a minute and this is it.

_pos = position Center;

_pX = _pos select 0;

_pY = _pos Select 1;

while {not (isNull Center)} do

{

sleep 1;

_dX = (random 50) - 25;

_dY = (random 50) - 25;

_pX = _pX + _dX;

_py = _pY + _dY;

_bum = "ARTY_Sh_81_HE" createVehicle [_pX,_pY,100];

_bum say3D "whistle";

_bum setVelocity [0,0,-300];

}

Also if I take this out of the init and put execvm arty.sqf in a trigger would that cause the trigger to execute the script on say a radio call instead of just starting out randomly bombing stuff? I would assume it would

Share this post


Link to post
Share on other sites

The main concern with putting it in a trigger is that every client + server will run it, so if you got 4 guys connected you'll get 5 bombs! So make sure you wrap the code with an isServer check.

Also get rid of the while not isNull center, that's what's causing it to happen all the time.

Share this post


Link to post
Share on other sites

keep the do? And I do sp missions. MP are too crazy for me atleast until I get a better grasp of doing them.

Share this post


Link to post
Share on other sites

Actually, i read that wrong. For some reason that code is using "center" as an object name which is a Bad Thing Indeedâ„¢ since that's a command. So instead of "center" as the name for a unit call it something like C1 or something.

In that case just replace it with this:

_target = _this select 0;
_pos = position _target;
_pX = _pos select 0;
_pY = _pos Select 1;

while {not (isNull _target)} do
{

sleep 1;
_dX = (random 50) - 25;
_dY = (random 50) - 25;

_pX = _pX + _dX;
_py = _pY + _dY;
_bum = "ARTY_Sh_81_HE" createVehicle [_pX,_pY,100];
_bum say3D "whistle";
_bum setVelocity [0,0,-300];
};

Then just run it from the trigger as:

nul = [player] execVM "bombme.sqf";

Assuming you wanted mortars landing a few dozen meters from you till you die. :)

Share this post


Link to post
Share on other sites

No I dont think that's an issue. I tested it with an object named center and the shells landed around it instead of me. Everything in my script works fine except I need it to stop after 60 seconds instead of continuing to bomb.

Edited by TexKaz

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×