Jump to content

Stank4K

Member
  • Content Count

    11
  • Joined

  • Last visited

  • Medals

Community Reputation

2 Neutral

About Stank4K

  • Rank
    Private First Class

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That's the winner! @Larrow Works in MP perfectly. Made a few adjustments to fit my needs, but out of box that works perfectly! For those who want the completed project, (just in case the dropbox ever goes down.) Here it is: init.sqf: //Function to call remotely to make artillery fire TAG_fnc_doArtilleryFire = { params[ "_laserTarget" ]; //passed laser designator object //AL( argument must be local( mortar11G )) mortar11G setVehicleAmmo 1; //AL( argument must be local( mortar11 )) mortar11 doArtilleryFire[ getPosATL _laserTarget, "8Rnd_82mm_Mo_shells", 3 ]; }; initPlayerLocal.sqf player addAction ["Bring the Rain", "scripts\sendArtToLazerDes.sqf"]; scripts\sendArtToLazerDes.sqf: //sendArtToLaserDes.sqf _laserTarget = laserTarget player; if !( isNull _laserTarget ) then { _etaRaw = mortar11 getArtilleryETA[ getPosATL _laserTarget, currentMagazine mortar11 ]; //Tell actions user about ETA mortar11G sideChat format[ "Rounds Inbound to Designated Location. ETA: %1 s", round _etaRaw ]; //remote call the function TAG_fnc_doArtilleryFire where mortar11 is local [ _laserTarget ] remoteExec[ "TAG_fnc_doArtilleryFire", mortar11 ]; }else{ //Tell actions user that no laser target is available mortar11G sideChat "No Target Acquired!"; }; Mortars Variable name is Mortar11. Mortar11G is the unit on the mortars name natively when the mortar is set to Mortar11. Thanks once again to @Larrow. He wrote this and figured everything out. I take no credit.
  2. The script I have in the original post is the one I am using. The mortars are not local. They are AI placed in editor. So server side only. (Dedicated Server). I tried with a few clients, one being myself, but the AI don't seem to want to fire. I added the setAmmo command to the script to ensure they have it. An ETA does get returned in side chat, but it's only visible to the client that called it in. Which is odd, since the AI didn't actually fire, I'm not sure how the server returned and ETA. waitUntil {Alive sLead}; sLead addAction ["Bring the Rain", "scripts\sendArtToLazerDes.sqf"]; I have this in a trigger temporarily that covers the spawn area. I plan on moving to the bottom of my init once it works. It successfully waits for the Var Name to be logged in and ready and then assigns the sLead (Squad Leader) the ability to call the script. So anyone can activate it, but only the sLead will, once alive, get it. And to prevent mass scrolling, here is the code as it stands: //sendArtToLaserDes.sqf _desPos = laserTarget player; if !( isNull _desPos ) then { mortar11G setVehicleAmmo 1; mortar12G setVehicleAmmo 1; mortar13G setVehicleAmmo 1; mortar14G setVehicleAmmo 1; mortar11 doArtilleryFire[ getPosATL _desPos, "8Rnd_82mm_Mo_shells", 3 ]; etaRaw = mortar11 getArtilleryETA [position _desPos, currentMagazine mortar11]; eta = round etaRaw; mortar11G sideChat (format ["Rounds Inbound to Designated Location. ETA: %1 s", str(eta)]); sleep .5; mortar12 doArtilleryFire[ getPosATL _desPos, "8Rnd_82mm_Mo_shells", 3 ]; sleep .5; mortar13 doArtilleryFire[ getPosATL _desPos, "8Rnd_82mm_Mo_shells", 3 ]; sleep .5; mortar14 doArtilleryFire[ getPosATL _desPos, "8Rnd_82mm_Mo_shells", 3 ]; sleep 10; mortar11G addEventHandler ["fired", "mortar11G setVehicleAmmo 1"]; mortar12G addEventHandler ["fired", "mortar12G setVehicleAmmo 1"]; mortar13G addEventHandler ["fired", "mortar13G setVehicleAmmo 1"]; mortar14G addEventHandler ["fired", "mortar14G setVehicleAmmo 1"]; }else{ mortar11G sideChat "No Target Acquired!"; }; TL;DR - sideChat only (somehow) shows up for the client that calls the code. And the Mortars, which are editor placed with AI on it, do nothing. @Larrow I believe that since the AI/Mortars are server side only, and the player command returns as isNull for the server, this script doesn't return laserTarget to _desPos since _desPos = laserTarget player; is trying to pull an array from Null. So the only way to get this to work would be to somehow get _desPos client side, then send that data to the server for it to process it with the script. I was considering setVariable and/or remoteExecutedOwner with remoteExec. But I am no expert. I'm gonna mess with things when I get home, but I'm almost certain @Larrow, being the legend he is, will probably figure this out way faster than I can. Side note: Would getting _desPos from player in the addAction then sending that var to the script work best? And how would I send that var to the server with it's data intact. I assume setVariable? Haven't put too much research into setVar just yet.
  3. Via addAction ["words", thisscript] Turn on laser, scroll and use the action to run the arty script.
  4. I don't know if it notify's you of edits @Larrow, so here is a reply to maybe catch the eye of the almighty himself. The script in it's updated form, (edited original post), does not work in MP. And I'm lost on how to replace player with something that works in MP. Looking into setVariable and publicVariableServer. And maybe groupOwner. Since only the squad lead can call this in anyways. All units are synched to him in editor.
  5. Finished script with rounded ETA in seconds: //sendArtToLaserDes.sqf _desPos = laserTarget player; if !( isNull _desPos ) then { mortar11 doArtilleryFire[ getPosATL _desPos, "8Rnd_82mm_Mo_shells", 3 ]; _etaRaw = mortar11 getArtilleryETA [position _desPos, currentMagazine mortar11]; _eta = round _etaRaw; mortar11G sideChat (format ["Rounds Inbound to Designated Location. ETA: %1 s", str(_eta)]); }else{ mortar11G sideChat "No Target Acquired!"; }; Thanks @Larrow you legend! Bailed me out a 3rd time as of now! I tried to do _mortar = mortar11 and replace all the mortar11's with _mortar but it didn't work for me. But, this will do for sure. Not too big of a script to change them manually when needed!
  6. I'm gonna explode if that works. Testing tonight around 730 cst. I never saw that on the lazerTarget page. I think I messed with isNull a couple times. Once desPos has been set, does it return to isNull after the script completes, or do I need to set it back to isNull? Otherwise the player could accidentally recall a mortar strike on the last position they lased. @Larrow
  7. @Larrow Upon uploading this to my server in the mission. It does not work in multiplayer. Something to do with the "player" command doesn't work for MP. Which is odd, since it works in the MP in the editor. I also tried this where the character's variable name is sLead. But I guess Variable Name for a player controlled unit doesn't matter. _desPos = laserTarget sLead; I also tried setting all the variables to public ones. Thinking the server would pickup desPos after the client sets it. But no luck. I plan on changing those back to private vars if I can once it works. //sendArtToLaserDes.sqf desPos = laserTarget sLead; if !( isNull desPos ) then { mortar11G setVehicleAmmo 1; mortar12G setVehicleAmmo 1; mortar13G setVehicleAmmo 1; mortar14G setVehicleAmmo 1; mortar11 doArtilleryFire[ getPosATL desPos, "8Rnd_82mm_Mo_shells", 3 ]; etaRaw = mortar11 getArtilleryETA [position desPos, currentMagazine mortar11]; eta = round etaRaw; mortar11G sideChat (format ["Rounds Inbound to Designated Location. ETA: %1 s", str(eta)]); sleep .5; mortar12 doArtilleryFire[ getPosATL desPos, "8Rnd_82mm_Mo_shells", 3 ]; sleep .5; mortar13 doArtilleryFire[ getPosATL desPos, "8Rnd_82mm_Mo_shells", 3 ]; sleep .5; mortar14 doArtilleryFire[ getPosATL desPos, "8Rnd_82mm_Mo_shells", 3 ]; }else{ mortar11G sideChat "No Target Acquired!"; }; This is the full script I have. Doesn't work in MP as it stands. I also tried using Param[1] in place of "Player", but same effect. Nothing.
  8. Thanks a ton! @beno_83au Been raging over this for ages now. You are a god amidst men.
  9. @Larrow That made things a tad better. I don't error. However. AI seems to think it's not in range. So I assume the values that returns is not what the AI is looking for. Here's what you suggested and how I've implemented it. [] Spawn { for "_time" from 0 to 2 do { _arty = mortar1; _target = ["target1","target2","target3"] call BIS_fnc_selectRandom; _artyAmmo = getArtilleryAmmo [_arty] select 0; _artyETA = _arty getArtilleryETA [getMarkerPos _target, _artyAmmo]; _inRange = (getMarkerPos _target) inRangeOfArtillery [[_arty], _artyAmmo]; systemchat format ["In range: %1",_inRange]; if (_artyETA > 0 AND _inRange) then { systemchat "Cleared to fire!"; systemchat format ["Impact ETA: %1s",_artyETA]; _arty commandArtilleryFire [getMarkerPos _target, _artyAmmo, 5]; sleep 15; } }}; I should note, the "target1" 2 and 3, are all 3D objects. Not map markers.
  10. Looking for a script to remove all AI smokes from OPFOR at the Init level. I've been digging for ages and have only found failed scripts and not much else to go off of. I'd like to remove all smokes from all OPFOR AI at mission start. They are very smoke happy and it causes FPS issues, Lag, and it's just annoying to stop a firefight for 2 or 3 minutes for enemy smoke to clear. I was happy removing them all by hand via the edit load-out option in the right click menu when we were working with a smaller squad with smaller missions. But we have grown enough for there to be 60-100 enemy's at a time and doing it by hand just isn't an option anymore. I've given it a whack, but I'm not sure what the smokes ID is for each one. Or how to find them. There must be a better way to remove all than to name each smoke ID and remove it. If there isn't, if one of you wonderful people over here would like to set me up with a basic script with 2 or 3 vanilla names, and the knowledge on how to find all the other IDs, I'll gladly add the rest of them myself. Thanks in advance!
  11. Looking to make AI fire on random preset markers. I have ripped and tinkered with some bits and pieces of code. Most come from GOM's posts and replies. Here is what I've come up with: [] Spawn { while {true} do { _arty = mortar1; _target = ["target1","target2","target3"] call BIS_fnc_selectRandom; _artyAmmo = getArtilleryAmmo [_arty] select 0; _artyETA = _arty getArtilleryETA [getPosATL _target, _artyAmmo]; _inRange = (getPosATL _target) inRangeOfArtillery [[_arty], _artyAmmo]; systemchat format ["In range: %1",_inRange]; if (_artyETA > 0 AND _inRange) then { systemchat "Cleared to fire!"; systemchat format ["Impact ETA: %1s",_artyETA]; _arty commandArtilleryFire [getPosATL _target, _artyAmmo, 5]; sleep 45; } }}; But as far as I can tell, the target cannot be randomly selected. This bit here seems to break it: _target = ["target1","target2","target3"] call BIS_fnc_selectRandom; It works to fire on one position with it as this: _target = target1; The artillery fires nicely with the Do While loop and the sleep x; bit. But one other issue is that arty doesn't start firing until the sleep x time has passed. Which is a small issue in itself. Even with sleep being at the end of the code, it waits the full amount of time before firing. I thought these scripts ran top to bottom. TL;DR: Code works only for single target. I want to fire 5 shots, then pick another random preset target (target1,target2,target3,etc.) then fire 5 more with a sleep delay between barrages. Huge bonus: If someone can post a separate bit of code to fire on players current position. Once it fires, I just want it to hit where it was supposed to. As if players are running from the arty fire and if they stay still, RIP. I looked into getRelPos for players, but had no luck. Just errors.
×