-
Content Count
4333 -
Joined
-
Last visited
-
Medals
Everything posted by Grumpy Old Man
-
Anyway to disable the fast forward feature for Sp missions?
Grumpy Old Man replied to Plantroot's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You could bruteforce it like this: addMissionEventHandler ["EachFrame",{ if (accTime != 1) then {setAcctime 1}; }]; I guess his concern was mainly other players playing his mission, using time acceleration can very well take out tension of a mission that's building on it, heh. Cheers -
2d compass 2D Compass calculations
Grumpy Old Man replied to Flash-Ranger's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Why not share how you solved your issue? Deleting topics won't help others that might run into similar issues. Cheers -
2d compass 2D Compass calculations
Grumpy Old Man replied to Flash-Ranger's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Use linear conversion then? You're not really specific about what you want. When the bearing is 0 the slider should be full left, at 360 full right? Could be something like this: _dir = getDirVisual player; _newMin = minPositionX;//some x coordinate the image should have when the player bearing is 0 _newMax = maxPositionX;//some x coordinate the image should have when the player bearing is 360 _positionX = linearConversion [0,360,_dir,_newMin,_newMax,true]; Cheers -
2d compass 2D Compass calculations
Grumpy Old Man replied to Flash-Ranger's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Why use math? disableSerialization; MyCompass = findDisplay 46 ctrlCreate ["RscPictureKeepAspect", -1]; MyCompass ctrlSetPosition [0.5,0.5,.1,.1]; MyCompass ctrlSetText "\A3\ui_f\data\map\markers\handdrawn\arrow_CA.paa"; MyCompass ctrlCommit 0; addMissionEventHandler ["EachFrame",{ MyCompass ctrlSetAngle [getDirVisual player, 0.5, 0.5]; }]; You can get around the serialization error message by using "with UInamespace do", depends on how you set it up. Cheers -
Random Flagpole Teleport
Grumpy Old Man replied to Jordan Booth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What kind of problems? Besides a missing closing bracket? Always check the wiki for syntax and enable -showScriptErrors as startup parameter. Also good to use a text editor that supports .sqf syntax highlighting. Alternatively you could get rid of the .sqf file and put this into the objects init field: this addaction ["OG Castle","_this#1 setpos getmarkerPos selectRandom ['Rock', 'Stone','Corner','Main']"]; Cheers -
Random Flagpole Teleport
Grumpy Old Man replied to Jordan Booth's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Make sure there are no typos and upper/lower case errors in your marker array or editor placed markers. Also post the snippet that didn't work. Cheers -
Race Circuit Script (aka learning to count)
Grumpy Old Man replied to wogz187's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So if I got it right you got 6 markers (per course?) and need to move an object to the next marker when a player is close to it? Could look like this: //init.sqf or initPlayerLocal.sqf _course1 = ["ringMARK1_1","ringMARK1_2","ringMARK1_3","ringMARK1_GOAL"]; _course2 = ["ringMARK2_1","ringMARK2_2","ringMARK2_3","ringMARK2_GOAL"]; _course3 = ["ringMARK3_1","ringMARK3_2","ringMARK3_3","ringMARK3_GOAL"]; TAG_courses = [_course1,_course2,_course3]; TAG_currentCourse = 0;//because arrays start at 0 TAG_ringID = 0; TAG_ringObject = test;//your object that will be moved to the current ring addMissionEventHandler ["EachFrame",{ _currentRing = (TAG_courses#(TAG_currentCourse)#TAG_ringID); if (vehicle player distance TAG_ringObject < 5) then { TAG_ringID = TAG_ringID + 1; TAG_ringObject setPos getMarkerPos (TAG_courses#(TAG_currentCourse)#TAG_ringID); if (_currentRing find "GOAL" >= 0) then { TAG_ringID = 0; TAG_currentCourse = TAG_currentCourse + 1; } }; hintSilent format ["Active Course: %1\nCurrent Ring: %2",TAG_currentCourse+1,TAG_ringID+1]; }]; As a quickly thrown together example, this will go through all rings and courses upon completion, control object will be moved to the next marker and will be used for a distance check of the player, using an EachFrame EH for precision. Still needs a check for final course, can be done similar to find "GOAL", should get you started. Cheers -
Race Circuit Script (aka learning to count)
Grumpy Old Man replied to wogz187's topic in ARMA 3 - MISSION EDITING & SCRIPTING
So you need to move the task marker every 0.2 seconds between each ring? Could switch the forEach loop to this: while {player inArea YourTriggerName} do { { ["task1",[_x,true]] call BIS_fnc_taskSetDestination; _ringGoal setpos (getpos _x); sleep 0.2; } forEach _rings; }; Many ways to set this up though, depends on what you're actually trying to do. Cheers -
Race Circuit Script (aka learning to count)
Grumpy Old Man replied to wogz187's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well this doesn't make sense: currentRING= [ringMARK2_1,ringMARK2_2,ringMARK2_3,ringMARK2_4, ringMARK2_5, ringMark2_6] select 5; currentRING= [ringMARK2_1,ringMARK2_2,ringMARK2_3,ringMARK2_4, ringMARK2_5, ringMark2_6] select 5; Why not simply use currentRing = ringMark2_6? Will never change. ringChall is also nowhere defined, maybe another script outside? You could use deleteAt, which I always forget, returns the deleted element could be set up like this: YourRings = [ringMARK2_1,ringMARK2_2,ringMARK2_3,ringMARK2_4, ringMARK2_5, ringMark2_6]; currentRing = YourRings deleteAt (count YourRings -1);//first execution returns ringMark2_6 currentRing = YourRings deleteAt (count YourRings -1);//second execution returns ringMARK2_5 currentRing = YourRings deleteAt (count YourRings -1);//third execution returns ringMARK2_4 //etc. If that's what you're after. Also not sure about your usage of terminate, since it's always preferred to end scripts the proper way instead of terminating them. You can use exitWith to exit while true loops, or even better use variables to control loop execution like this: //not ideal _stuff = [] spawn { while {true} do { sleep 1; //stuff }; }; terminate _stuff; //exit spawned loop on condition _stuff = [] spawn { while {true} do { sleep 1; if (something) exitWith {false}; //stuff }; }; //stop looping on condition _stuff = [] spawn { while {something} do { sleep 1; //stuff }; }; Might work fine for more basic stuff but terminating more complex scripts might lead to issues depending on what that script does etc. If you want to run multiple ring courses with individual rings you can also use an abstract function, define the rings and courses as nested arrays and simply call the same function for every course: TAG_fnc_ringCourse = { params ["_courseID","_rings","_ringGoal"]; hint format ["Starting Ring %1!\nGo!",_courseID]; playergroup = group Player; deleteWaypoint [playergroup, 0]; { sleep 0.2; ["task1",[_x,true]] call BIS_fnc_taskSetDestination; _ringGoal setpos (getpos _x); _ringGoal hideobject FALSE; } forEach _rings; _courseID = _courseID +1; _courseID//_courseID will increment by one so you can automate the next courseID if needed }; _handleRing = [1,[ringMARK2_1,ringMARK2_2,ringMARK2_3,ringMARK2_4, ringMARK2_5, ringMark2_6],ringGOAL_1] spawn TAG_fnc_ringCourse; Cheers -
if...then...else trobuleshooting
Grumpy Old Man replied to obrien979's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well I'd go for a draw3d eventhandler and play a bit around using color and text select usage depending on distance, and also cleanly remove the EH once the player has boarded the vehicle, to give a full example. Nothing wrong with giving a quick heads up, but as you already acknowledged it's dirty. @Spatsiba wrote how to do it. //initPlayerLocal.sqf addMissionEventHandler ["Draw3D", { _veh = YourVehicleName;//adjust to your vehicle _pos = ((getposatl _veh) vectoradd [0,0,4]);//text will appear 4m above the vehicle _check = player distance2D _veh < (2 + sizeOf typeOf _veh); _text = ["Get Closer","Get In"] select _check; _color = [[1,0,0,1],[0,1,0,1]] select _check;//red if too far away, otherwise green drawIcon3D ["", _color, _pos, 0.8, 0.8, 0, _text, 1, 0.0315, "EtelkaMonospacePro"]; if (player in crew _veh) then {removeMissionEventhandler ["Draw3D",_thisEventhandler]};//remove the EH when the player is inside }]; Should be self explanatory, check up select on the wiki, makes most if statements obsolete, should get you started. This also keeps the hint free for debugging or other purposes, since there can only be a single hint for every frame. Cheers -
Scripted guard waypoint
Grumpy Old Man replied to gc8's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That's not how guard waypoints work though. AI with guard waypoints will move towards them only if "guarded by" triggers are under attack. Cheers -
Multiple AddAction's from Script
Grumpy Old Man replied to voidbyte's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Made something similar a while ago, feel free to adapt: Should be straightforward and at least give some pointers on what you want to do (routing, excluding certain destinations etc). Cheers- 1 reply
-
- 3
-
Making the AI wait to open their chute
Grumpy Old Man replied to Ex3B's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Depends on how you execute the function, from an objects init field using your example above could look like this: _spl = [this] spawn { params ["_unit"];//declares the first passed parameter as _unit waitUntil { (getPos _unit) select 2 < 120 }; _unit addBackpack "B_Parachute"; }; This way you could copypaste the snippet to other units and it will still work. Cheers -
Making the AI wait to open their chute
Grumpy Old Man replied to Ex3B's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well if it helps to put your mind at ease Cheers -
Making the AI wait to open their chute
Grumpy Old Man replied to Ex3B's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_unit is not defined inside the scope of the spawned script, hence the error. "this" also doesn't exist inside the scope of the spawned script, it's a magic variable that only works in a few places. Pretty basic stuff, I suggest reading one of the various guides/tutorials for sqf scripting or go through Mr. Murrays guide. Easily doable without prior knowledge in a weekend or two (4-5 hours total). The waitUntil will complete everytime the checked unit is below 150m AGLS, if the chopper takes off from ground level the unit receives a backpack as soon as the mission starts. You might want to check this using a getOut eventHandler, depending if you spawn those units mid mission, upon mission start inside chopper etc. Cheers -
[Release] GOM - Ambient AA V1.2.1
Grumpy Old Man replied to Grumpy Old Man's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Something like this will do: test addEventhandler ["Fired",{ params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; _reloadTime = _unit getVariable ["TAG_fnc_fireRate",1]; _unit setWeaponReloadingTime [_gunner, _muzzle, _reloadTime]; }]; test setVariable ["TAG_fnc_fireRate",0.75]; Where the value (0.75 as example) stands for seconds between rounds. Cheers -
Contact Expansion Asset Feedback
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
Explosive shells no, but I guess AP/slugs/general deforming rounds are against the hague (I guess?) convention. All other rounds including flechettes and HE are legal. Might have changed though, been a while, heh. Cheers -
Face Targets towards firing platform
Grumpy Old Man replied to obrien979's topic in ARMA 3 - MISSION EDITING & SCRIPTING
As @sarogahtyp explained, it sets a variable that can later be used to retrieve units marked with it using select and the array that's holding the unit. Think of it as a color you're marking specific needles in a haystack with, then you filter through the entire haystack only picking needles of your specified color. Cheers -
Face Targets towards firing platform
Grumpy Old Man replied to obrien979's topic in ARMA 3 - MISSION EDITING & SCRIPTING
For ease of use you could select all targets, hit right click on one, then select attributes, make sure the title then shows: "Edit n objects". This way you can mark all of them at once, using this snippet: this setVariable ["TAG_rotate",true]; Now you can select all of them and rotate them from initServer.sqf or wherever you seem fit: { _x setDir (_x getDir YourFiringPlatform); } forEach (allUnits select {_x getVariable ["TAG_rotate",false]}); Either use allUnits or vehicles, depending on what your targets are. Note that not all models seem to be configured with the actual front facing forward, no idea why, some chairs for example will face backward etc. Cheers -
from from to looping help
Grumpy Old Man replied to Ninjaisfast's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Depends on what you want, as @sarogahtyp stated explain what exactly you're trying to do. A loop is a loop is a loop. Which kind of loop you're using depends on what you want the loop to do. forEach loops through an array and gives you _forEachIndex, could be an alternative to the from to loop. If you don't need an index you can use while or count. Cheers -
Spawning two civilians with name
Grumpy Old Man replied to Coladebote's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Note that this will only return a unit when using the default syntax, as the alternative syntax returns nothing. Cheers -
How to calculate VTOL hovering thrust? +some questions about VTOLs
Grumpy Old Man replied to POLPOX's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You could write a PID controller (various examples on how to make one can be found using google) using vertical velocity as a process variable and 0 as setpoint (since you want the vtol to hover) and use the output to control the setAirplaneThrust value. Cheers- 1 reply
-
- 3
-
Try using allowFleeing and forgetTarget together. Cheers
-
Contact Expansion Asset Feedback
Grumpy Old Man replied to DnA's topic in ARMA 3 - DEVELOPMENT BRANCH
Tractor windows will be properly damaged, all fine here. Really enjoying that thing more than I'd like to admit. Pretty neat being able to see the suspension at work. Cheers -
script to record metadata of the units
Grumpy Old Man replied to darkbob12's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Depends on what exactly you want, if you simply want to track movement and direction something like this might do the trick: Made primarily for vehicles but works for individual units just fine. Can easily be modified to store the information to arrays etc. Cheers- 1 reply
-
- 1