-
Content Count
4333 -
Joined
-
Last visited
-
Medals
Everything posted by Grumpy Old Man
-
I can't get pictures to work on signs.
Grumpy Old Man replied to Anthony0'Rourke's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well did you read the related link that leads to an explanation and multiple use cases? .paa is a file extension and can be converted by the arma 3 tools available through steam. Cheers -
Sure, might as well port it for mobile too. Cheers
-
doMove isn't a weak command. doMove only works in conjunction with the doStop command. It makes a unit move towards a given position, but the unit will fall back into formation after reaching that position. A doStop after the position has been reached prevents the unit from falling back into formation. I believe the wiki mentions this. No other way than spawning a waitUntil loop checking for distance to move position to make the AI stay there, like so: TAG_fnc_doMove = { params ["_unit","_position"]; _unit doMove _position; waitUntil {_unit distance2D _position < 5}; doStop _unit; true }; _move = [test,getPosATL player] spawn TAG_fnc_doMove; Bit baffling how there's no other way of doing this... Cheers
-
Sort an array of array only by number
Grumpy Old Man replied to Crazy_Man's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Simple sorting without having to manually do anything: _array = [["Player_1",1],["Player_2",5],["Player_3",2]]; _toSort = _array apply {[_x#1,_x#0]};//number is now first element _toSort sort false;//false for descending order _array = _toSort apply {[_x#1,_x#0]};//switch it again back to original order ["string",number] systemchat str _array; //prints: //[["Player_2",5],["Player_3",2],["Player_1",1]] Cheers -
Change movement speed for AI problem
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well you're still being pretty vague about further details, no idea if the group is editor placed, spawned etc. Cheers -
Change movement speed for AI problem
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That needs a move waypoint or doMove command. Have a read. Cheers -
Change movement speed for AI problem
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What do you expect this command should do? setSpeedMode only affects units breaking formation and running will be preferred. Cheers -
AI shoot only if attaced.
Grumpy Old Man replied to Pba (DayZ)'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
Barebones solution: //initPlayerLocal.sqf TAG_fnc_captiveCheck = { params ["_unit"]; _unit setCaptive true; waitUntil {currentWeapon _unit != ""}; _unit setCaptive false; {_x reveal [_unit,4]} forEach (_unit nearEntities 25); }; player spawn TAG_fnc_captiveCheck; If the player starts out unarmed, enemy AI will not engage. As soon as the player equips a weapon this will be seen as a hostile action and enemies will immediately engage if present. Cheers -
Return true if the word it's inside the array
Grumpy Old Man replied to MechSlayer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
findIf might be even faster than forEach or count. Edit: Did some quick worst/best case tests: //worst case scenario TEST_array = []; for "_i" from 0 to 9998 do { TEST_array pushBack "man"; }; TEST_array pushBack "car"; //tests: TEST_array find "car" > -1;// 0.163265 ms {_x isEqualTo "car"} count TEST_array > -1;// 5.31746 ms TEST_array findIf {_x isEqualTo "car"} > -1;// 5.53591 ms ///////////////////////////////////////////////////////// //best case scenario TEST_array = ["car"]; for "_i" from 0 to 9998 do { TEST_array pushBack "man"; }; //tests: TEST_array find "car" > -1;//0.0009 ms TEST_array findIf {_x isEqualTo "car"} > -1;// 0.0016 ms {_x isEqualTo "car"} count TEST_array > -1;// 5.25654 ms ///////////////////////////////////////////////////////// //"car" is element 5000/10000, rest all "man" TEST_array find "car" > -1;// 0.0841 ms TEST_array findIf {_x isEqualTo "car"} > -1;// 2.67914 ms {_x isEqualTo "car"} count TEST_array > -1;// 5.26316 ms Well didn't expect that, so in any case find seems to be fastest, unless I'm missing something. Cheers -
SetObjectTexture help
Grumpy Old Man replied to Skull_Army's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Van setObjectTexture [0, "a3\soft_f_orange\Van_02\Data\van_body_black_CO.paa"]; should do the trick. Cheers -
How do I improve mission performance?
Grumpy Old Man replied to The Black Fox's topic in ARMA 3 - MISSION EDITING & SCRIPTING
As far as I know enableSimulation only affects moveable objects such as vehicles etc, static objects should be fine without disabling their simulation, maybe I'll find a source for that. The simpleObject tip is well worth to investigate further (check out KKs first comment). Cheers -
Once upon a time there was a rather well visited MP server with debug console enabled for everyone, for some reason nobody was doing anything with it. remoteExecs and fun happened. Cheers
-
Add all objects from arrays into a crate
Grumpy Old Man replied to MechSlayer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Don't add items and weapons this way, you use addItemCargo, addWeaponCargo, addMagazineCargo and addBackpackCargo for all items inside the arrays, this is bound to cause issues. Make arrays only containing backpack classnames, use this array with addBackpackCargo, same for items, weapons, magazines, etc. Won't work otherwise. Cheers -
Artillery Radar Script Release 0.3
Grumpy Old Man replied to ofp_f3d3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well since most artillery requires a player to command the fire it should be no problem to retrieve the target area via mapClick or other means and add wanted imprecision to those coordinates to display a marker. Cheers -
Artillery Radar Script Release 0.3
Grumpy Old Man replied to ofp_f3d3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You could track arty guns via fired eventhandler, check if projectiles enter your radar range and display them and/or add precision errors to your flavor. No need to use expensive calculations when you can track what's already there, even more so when the player won't be able to tell the difference. Cheers -
Check the wiki: means the command needs to be executed on the server, like so: [_selectedPlayer,false] remoteExec ["enableSimulationGlobal",2]; Alternatively you can use disableUserInput. Cheers
-
How do I improve mission performance?
Grumpy Old Man replied to The Black Fox's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Until further elaboration this could have a few causes... View distance and object view distance have the biggest performance impact, next to supersampling. With 180 AI and 600+ triggers you're bound to run into performance issues which also can vary greatly depending on the condition checks done by the triggers. To improve performance you can reduce all AI groups to the leader units, so they still patrol around, when any player gets within viewDistance * 1.1 simply spawn in the rest of the group. getUnitLoadout/setUnitLoadout will do a good job here. Bigger group sizes benefit more from this kind of solution. This will most likely be the biggest performance improvement, again, depending on what these 600+ triggers are doing. Edit: On a sidenote having to render 180 units (if they're within objectViewDistance) will most likely bog down the most powerful GPUs out there, since infantry units in A3 are pretty detailed. Cheers -
Soundtrack unavailable unless I re-buy all the APEX edition content?
Grumpy Old Man replied to Deathstruck's topic in ARMA 3 - GENERAL
Would be good to know, purchased A3 in march 2013 during alpha, own all DLCs, no bonus folder with soundtrack, was there something I'm missing (except the bonus folder, hee hee)? Cheers -
Unit X moving to Unit Y position, even when Y is moving?
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This way the AI will move to a position with (in worst case) a 5 seconds delay. Might be enough for the target to be long gone. If a player knows how this script works it's easy to completely break the bomber by just moving all the time. For a successful AI bomber there's quite some stuff needed, knowing at what distance the explosion will be lethal helps quite a bit, also I'd rather use a function to calculate the targets anticipated position and have the bomber intercept the target, something like this: Can be easily modified. Cheers -
Unit X moving to Unit Y position, even when Y is moving?
Grumpy Old Man replied to jonipetteri's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Only works on units of the same group, used to make AI fall back into formation etc, doesn't do what you think it does, heh. Also worth to consider using this: _bomber setAnimSpeedCoef ((getAnimSpeedCoef _target) * 1.25) for a guaranteed bombing. Cheers -
Command "vehicle" only return the unit's name
Grumpy Old Man replied to Eroge's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Then the first post by @pierremgi is your solution. Cheers -
Command "vehicle" only return the unit's name
Grumpy Old Man replied to Eroge's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The thread title is: Which suggests you only want to get the units name, which is already used in your snippet. The issue you mention in the first post is: Then when being asked what you want you respond with: Not really sure what you want, can you rephrase it? Do you mean the class name of the killers vehicle? Or the displayName? Cheers -
Add actions for all houses of a specific kind
Grumpy Old Man replied to Taylor1984's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Sure, this will only move you around after using the addAction, which will show up if you're at an access point and standing still: _roofAccess = [["Land_MultistoryBuilding_03_F",[[11.5654,-0.246582,-25.9038],[2.13477,17.0049,-26.0029],[-7.50781,13.2588,-25.9038],[-1.31836,4.89502,-25.9038],[-7.0752,-1.81104,-24.2182],[0.0898438,-13.0679,-25.9038],[11.585,12.7637,-25.9038]],[[-1.01367,11.0376,25.919]]]]; GOM_fnc_buildingTypes = _roofAccess apply {_x#0}; GOM_fnc_entryPositions = _roofAccess apply {_x#1}; GOM_fnc_roofPositions = _roofAccess apply {_x#2}; player setVariable ["GOM_fnc_accessingAllowed",true]; _ID = player addAction [ "Access Roof", { params ["_target", "_caller", "_actionId", "_arguments"]; _pos = _target getVariable ["GOM_fnc_position",[]]; _target setPosASL _pos; _target setVariable ["GOM_fnc_position",[]]; _reset = 10 spawn { sleep _this; player setVariable ["GOM_fnc_accessingAllowed",true]; } }, [], 1.5, true, true, "", "_this isEqualTo _target AND !((_target getVariable ['GOM_fnc_position',[]]) isEqualTo [])", 50, false, "", "" ]; player setVariable ["GOM_fnc_roofAccessActionID",_ID]; addMissionEventHandler ["Draw3D", { if (player distance2d cursorObject < 25 AND {typeOf cursorObject in GOM_fnc_buildingTypes}) then { _index = GOM_fnc_buildingTypes find typeOf cursorObject; _entryPositions = GOM_fnc_entryPositions # _index; _roofPositions = GOM_fnc_roofPositions # _index; _checkDistance = 20; _color = [[1,0,0,1],[0,1,0,1]] select (player getVariable ["GOM_fnc_accessingAllowed",false]); { _pos = cursorObject modelToWorldVisual _x vectorAdd [0,0,1.5]; drawIcon3D ["", _color, _pos, 0, 0, 0, "Roof Access", 1, 0.05, "PuristaMedium"]; if (player distance2d _pos < 1 AND vectorMagnitude velocity player < 0.1 AND (player getVariable ["GOM_fnc_accessingAllowed",false]) AND (player getVariable ["GOM_fnc_position",[]]) isEqualTo []) then { player setVariable ["GOM_fnc_position",cursorObject modelToWorldVisualWorld selectRandom _roofPositions]; player setVariable ["GOM_fnc_accessingAllowed",false]; player setUserActionText [player getVariable ["GOM_fnc_roofAccessActionID",-1],"Move to roof"]; }; } forEach (_entryPositions select {!(lineIntersects [eyePos player,(cursorObject modelToWorldVisualWorld _x vectorAdd [0,0,1.5]),player])}); { _pos = cursorObject modelToWorldVisual _x vectorAdd [0,0,1.5]; drawIcon3D ["", _color, (cursorObject modelToWorldVisual _x vectorAdd [0,0,1.5]), 0, 0, 0, "Ground Access", 1, 0.05, "PuristaMedium"]; if (player distance2d _pos < 1 AND vectorMagnitude velocity player < 0.1 AND (player getVariable ["GOM_fnc_accessingAllowed",false]) AND (player getVariable ["GOM_fnc_position",[]]) isEqualTo []) then { player setVariable ["GOM_fnc_accessingAllowed",false]; player setUserActionText [player getVariable ["GOM_fnc_roofAccessActionID",-1],"Move to ground level"]; player setVariable ["GOM_fnc_position",cursorObject modelToWorldVisualWorld selectRandom _entryPositions]; }; } forEach (_roofPositions select {!(lineIntersects [eyePos player,(cursorObject modelToWorldVisualWorld _x) vectorAdd [0,0,1.5],player])}); }; }]; Cheers -
Add actions for all houses of a specific kind
Grumpy Old Man replied to Taylor1984's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Goofed around a bit and came up with this: //roof access //initPlayerLocal.sqf //array structure: [["BuildingClassName",[entryPosition1,entryPosition2,entryPosition3],[roofPosition1,roofPosition2,roofPosition3]]]; //positions need to be in modelspace format //retrieve positions using: //cursorObject worldToModelVisual getposatl player _roofAccess = [["Land_MultistoryBuilding_03_F",[[11.5654,-0.246582,-25.9038],[2.13477,17.0049,-26.0029],[-7.50781,13.2588,-25.9038],[-1.31836,4.89502,-25.9038],[-7.0752,-1.81104,-24.2182],[0.0898438,-13.0679,-25.9038],[11.585,12.7637,-25.9038]],[[-1.01367,11.0376,25.919]]]]; GOM_fnc_buildingTypes = _roofAccess apply {_x#0}; GOM_fnc_entryPositions = _roofAccess apply {_x#1}; GOM_fnc_roofPositions = _roofAccess apply {_x#2}; player setVariable ["GOM_fnc_accessingAllowed",true]; addMissionEventHandler ["Draw3D", { if (player distance2d cursorObject < 20 AND {typeOf cursorObject in GOM_fnc_buildingTypes}) then { _index = GOM_fnc_buildingTypes find typeOf cursorObject; _entryPositions = GOM_fnc_entryPositions # _index; _roofPositions = GOM_fnc_roofPositions # _index; _checkDistance = 20; _lockout = 10;//time needed to pass until roof access can be used again for this player _color = [[1,0,0,1],[0,1,0,1]] select (player getVariable ["GOM_fnc_accessingAllowed",false]); { _pos = cursorObject modelToWorldVisual _x vectorAdd [0,0,1.5]; drawIcon3D ["", _color, _pos, 0, 0, 0, "Roof Access", 1, 0.05, "PuristaMedium"]; if (player distance2d _pos < 1 AND vectorMagnitude velocity player < 0.1 AND (player getVariable ["GOM_fnc_accessingAllowed",false])) then { player setVariable ["GOM_fnc_accessingAllowed",false]; player setposASL (cursorObject modelToWorldVisualWorld selectRandom _roofPositions); _reset = _lockout spawn { sleep _this; player setVariable ["GOM_fnc_accessingAllowed",true]; } }; } forEach (_entryPositions select {!(lineIntersects [eyePos player,(cursorObject modelToWorldVisualWorld _x vectorAdd [0,0,1.5]),player])}); { _pos = cursorObject modelToWorldVisual _x vectorAdd [0,0,1.5]; drawIcon3D ["", _color, (cursorObject modelToWorldVisual _x vectorAdd [0,0,1.5]), 0, 0, 0, "Ground Access", 1, 0.05, "PuristaMedium"]; if (player distance2d _pos < 1 AND vectorMagnitude velocity player < 0.1 AND (player getVariable ["GOM_fnc_accessingAllowed",false])) then { player setVariable ["GOM_fnc_accessingAllowed",false]; player setposASL (cursorObject modelToWorldVisualWorld selectRandom _entryPositions); _reset = _lockout spawn { sleep _this; player setVariable ["GOM_fnc_accessingAllowed",true]; } }; } forEach (_roofPositions select {!(lineIntersects [eyePos player,(cursorObject modelToWorldVisualWorld _x) vectorAdd [0,0,1.5],player])}); }; }]; This will put you on a random position on the roof when going up, and on a random position on the ground when going down, if multiple positions are available. Plenty of space to customize it, simply add further building types by using the respective class names and retrieve positions as mentioned in the comments. Cheers -
Can't make AI airstrike on trigger
Grumpy Old Man replied to GreenXp's topic in ARMA 3 - MISSION EDITING & SCRIPTING
It might be logical to use a getPos command and retrieve a position, if it weren't for various data types/coordinate spaces to chime in and ruin your day. There's many commands that do similar jobs like getPos, getPosASL, getPosVisual, getPosWorld, etc. Then there are commands that don't do what their names might suggest (not going into this, out of bananas). Reading the wiki usually clears things up. Also I strongly suggest using a text editor that supports .sqf syntax, such as the glorious Poseidon, maintained by a dev. Using such a tool makes syntax problems obvious and if in doubt simply click on a script command, hit F1 and you're on the wiki. It also helps to be as specific as possible in the first post. Cheers