#arma3_scripting
1 messages · Page 547 of 1
Also.. reading the attachTo wiki page might be helpful
The offset is applied to the object center unless a memory point is provided
The offset is ignored
memory point on _obj1 right?
looks like, on obj2?
_obj1 attachTo [_obj2, _obj1 selectionPosition ["attach", "Memory"]]; like so?
well the attachTo code above tried to use attach point from _obj1
i want to attach obj1 , to obj2 , on a memory called "attach" which is on obj2
without touching the pos of obj1
Did my recent suggestion not work? 😦 (the one with ASLTOAGL magic)
it's better but still a little bit in the ground
I'm having 90 lines like that in my mission/mod RPT:Unsupported language Portuguese in stringtable
20:15:30 ["_memPos",[-2.64375,0.136325,-0.59973]]
20:15:30 ["_objRelPos",[-0.324707,0.511719,-0.773102]]
20:15:30 ["_finalPos",[2.31904,0.375394,-0.173372]]
_memPos = _obj2 selectionPosition ["attach", "Memory"];
diag_log ["_memPos",_memPos];
_objRelPos = _obj2 worldToModel (ASLToAGL (getPosASL _obj1));
diag_log ["_objRelPos",_objRelPos];
_finalPos = _objRelPos vectorDiff _memPos;
diag_log ["_finalPos",_finalPos];
_obj1 attachTo [_obj2, _finalPos, "attach"];
Ya'll thought about trying the shit and seeing what works?
after the animation https://i.imgur.com/tI4nR9F.png
k just ignore what I recommended then ^^
_obj1 attachTo [_obj2, _obj1 selectionPosition ["attach", "Memory"]]; like so?
But if the animation plays and selection position changes, the car will stay at the same place relative to obj2 model center
the Z offset you mean? While keeping the x, y calculated as before?
Well yes would work, unless Joker is about to rotate his bench in weird ways
I assume it will always stay horisontal so... should work?
yeah
just add a hardcoded + on the z
as long as the model doesn't change, and it's not a ASL/AGL thing that should just work
nah, wait, but what if there are different cars and they all have different model origin, so offset will be different?
or... idk where do cars actually have their origin?
0.8 works with this car i'll try others
this one fits perfectly without touching the z 🤔 https://i.imgur.com/w9NFEq5.png
Even a vanilla one (hatchback) need the +0.8
I guess that just for this case, you can take bounding box's Z coordinate
which will correspond to the floor wheels of the car
(boundingBoxReal _car)#1#2
_memPos = _obj2 selectionPosition ["attach", "Memory"];
diag_log ["_memPos",_memPos];
_objRelPos = _obj2 worldToModel (ASLToAGL (getPosASL _obj1));
diag_log ["_objRelPos",_objRelPos];
_finalPos = _objRelPos vectorDiff _memPos;
_zoffset = (boundingBoxReal _obj2)#1#2; // A positive number
_finalPos set [2, _zoffset];
diag_log ["_finalPos",_finalPos];
_obj1 attachTo [_obj2, _finalPos, "attach"];
smth like this?
boundingboxreal car : 20:56:05 [[-1.41541,-2.9383,-0.055301],[1.44496,2.27104,2.84549],4.46978]
log from previous attachTo : 20:47:09 ["_finalPos",[2.08515,-0.00937185,-0.184404]]
So i guess it would be (boundingBoxReal car)#0#2
Yes you are right I think 🤔 maybe - ((boundingBoxReal car)#0#2) ?
We need the Z offset from the bottom of the wheels to the center of model
How do i get view direction when controling a flying drone?
getDir _drone ?
ah ok, where the camera is looking at 🤔
This don't work: getCameraViewDirection player
yes
This above keeps geting player view direction
not controled drone view direction
Hello all, I have been working on my script now for a while using public variables. I am thinking of how to make this work with multiple players using public variables is this possible
@crisp cairn need more information if you want to get any feedback 🙄
@astral dawn when the player is using a drone it is remote controling an hiden AI unit in the drone, so i need to use getCameraViewDirection on the remote controled unit.
How can i get the unit remote controled by player?
I guess so, I'm sorry I can't help you, I guess the real question is - how do you get the drone to which player is connected
Yes you are right, IDK sorry 😦
CBA_fnc_currentUnit @tough abyss
You can just see what's in the cba code
missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player]
about [object] remoteExec Unary vs object remoteExec Unary, both work
So I call bullshit on only [] working, just tested on dedi
Right back with some simple questions.
I´m trying to save the group a player is in and save it into a variable.
Then Create and switch over the player to the civilian group.
When a function is running I want the player to return to the previous group he were before.
problem is.. if the player is in a group with only that player the group will get destroyed / deleted.
Main point of this is that when function 1 is running. the player switch side to Civilian.
Function 2 the player return to the previous group or if it does not exist return to the same side he was in before, west,east or resistance.
I tried doing it this way but it did not work...
//Function 1
_oldGroup = group player;
_newGroup = createGroup CIVILIAN;
[player] joinSilent _newGroup;
//Function 2
[player] joinSilent _oldGroup;
@tough abyss Correct. It does work. was something else within the function.
so I wasted my time? great
@tough abyss oh sorry. was talking about a earlier similar problem. go on 🙂
Yeah if everyone leaves a group then it becomes groupNull.... you have to recreate the group again I guess - is that the problem you're facing?
https://feedback.bistudio.com/T138990
However if you want all players in a group to become civilian, you can use setCaptive command (on each player)
@astral dawn i tested it, it is returning the player always.
i run the code in my mission, with no CBA
Sparker. yeah basicly it =)
but I think a need a condition then like.
if (***the oldgroup exists) then {player join _oldgroup}
else
{blablabla create new group} ;
problem is how can I save what side the _oldgroup is so the player will join the same side again?
Store the side somewhere?
Also why don't you like the setCaptive command?
Because the player will become captive =)
so to store it it would simply be something like this
_oldgroupside = side player;
setCaptive just prevents AIs from engaging player, they will treat him as a civilian, until you run setCaptive again
There many places where you can store variables... mission namespace, or you can store it in the new group you create
_newGroup setVariable ["prevSide", ...];
This CBA function is broken i believe: CBA_fnc_currentUnit @still forum always return the player, tested with CBA.
no it's not
that's what returns the remote controlled unit
unless your definition of remote control is different than mine
Remote Unit Controled by player: The AI unit inside a drone that the player connects and controls.
CBA_fnc_currentUnit
Description
Returns the controlled unit. (“player” or remote controlled unit via zeus)
doesnt say anything about AI in drone
So when i'm controling a drone, i'm remote controling an hidden AI unit inside the drone, how do i get this hidden AI unit object?
driver drone or gunner drone depends who you are controlling
@astral dawn Thank you ❤ works perfectly.
//Function 1
_oldGroup = group player;
_oldgroupSide = side player;
_newGroup = createGroup CIVILIAN;
[player] joinSilent _newGroup;
//Function 2
if (isnull _oldgroup) then {
_newOldgroup = createGroup _oldgroupSide;
[player] joinSilent _newOldgroup;
} else {
[player] joinSilent _oldGroup;
};
@tough abyss thanks, this is ok, but how do i know if a player is using the drone driver position or the drone gunner position?
I can't get the right unit if i don't know wich position player is ocuping.
Solved. Thanks!
Can 2 persons control a drone? One in Driver and other in Gunner, at the same time?
since UAVControl returns only one controling unit, i guess the answer is no.
I think yes but the command designed wrong
_points = switch (true) do {
case (_killed_type isKindOf "Infantry"): {
if(ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100) < 1) then {
1;
} else {
ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);
}
};
case (_killed_type isKindOf "Car"): {round((_get select QUERYUNITPRICE) *0.45* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Ship"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Motorcycle"): {round((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Tank"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Helicopter"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Plane"): {round((_get select QUERYUNITPRICE) *0.35* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "StaticWeapon"): {round((_get select QUERYUNITPRICE) *0.5* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Building"): {round((_get select QUERYUNITPRICE) *0.55* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100 * (missionNamespace getVariable "WFBE_C_BUILDINGS_SCORE_COEF"));};
default {63};
};
!! Arma 2 !!
Why does the script/variable fall back to default value when infantry is chosen/killed?
If I kill units of other types, the values work like they are supposed to
There's a '< 1' and 'then {1;} in the infantry part that is absent from the rest, which are set under an 'else'?
(but I don't really know what I'm looking at)
Actually, I think I'll just use ceil to fix it
This is a script snippet from Benny's Warfare that I modified
All I can say is that the Infantry part looks weird compared to the rest. Figure out why, maybe?
I'm having problems figuring out why, in main init, this isn't really working out. _EnemyCount = ["EnemyCount",100] call BIS_fnc_getParamValue; (where EnemyCount is the classname of a param in description.ext)
Related test Game Logic init: marker_6 set3DENAttribute ["markerText",_EnemyCount];
What I'm actually trying to use it for: this set3DENAttribute ["presence",_EnemyCount];
_points = switch (true) do {
case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100)};
case (_killed_type isKindOf "Car"): {round((_get select QUERYUNITPRICE) *0.45* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Ship"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Motorcycle"): {round((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Tank"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Helicopter"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Plane"): {round((_get select QUERYUNITPRICE) *0.35* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "StaticWeapon"): {round((_get select QUERYUNITPRICE) *0.5* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Building"): {round((_get select QUERYUNITPRICE) *0.55* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100 * (missionNamespace getVariable "WFBE_C_BUILDINGS_SCORE_COEF"));};
default {63};
};
When _killed_type isKindOf "Infantry", default value (63) is chosen. With every other type of unit the script works. What's wrong? (Note: Arma 2!!)
For example, a farmer is worth of $100. Bounty coef is 1, so the final calculation is ceil((100 * 0.7 * 1) / 100) = 1.
Oh wait, I think there's a missing ;...
case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100)};
to --->
case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
😄
Figured out that set3DENAttribute is actually not what I want (even though it'd be really convenient).
Still doesn't work. Now the code is:
_points = switch (true) do {
case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Car"): {round((_get select QUERYUNITPRICE) *0.45* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Ship"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Motorcycle"): {round((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Tank"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Helicopter"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Plane"): {round((_get select QUERYUNITPRICE) *0.35* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "StaticWeapon"): {round((_get select QUERYUNITPRICE) *0.5* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
case (_killed_type isKindOf "Building"): {round((_get select QUERYUNITPRICE) *0.55* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100 * (missionNamespace getVariable "WFBE_C_BUILDINGS_SCORE_COEF"));};
default {63};
};
The function still falls back to default value (63) when I kill infantry
Well, Infantry is the only type with a ceil instead of a round? Why is that?
Should it be Man instead of Infantry?
Try it out
Ceil only because infantry values are so low that the score might drop to 0 in some cases
So ceil ensures that player gets at least 1 point
I'd probably call an if 0 then 1 in that case just to simplify/deobfuscate
I'm pretty sure this will fix it
The original script has been in use for like a decade, but the error has gone unnoticed because the default value in original script was the same than score for killing an infantry unit
Yes, it fixed it! Yay
😄
Hmm
Am I actually trying to find an operator that doesn't exist? Looking for a means to set Probability of Presence at mission start via Param.
random and deleteVehicle 🙂
Part of FSM running on dedicated server:
{
if ((isPlayer _x) && !(isNull (missionNamespace getVariable format["WFBE_SCORE_UID_%1", getPlayerUID _x]))) then {
_playerNewScore = score _x;
_scoreDiff = _playerNewScore - (missionNamespace getVariable format["WFBE_SCORE_UID_%1", getPlayerUID _x]);
missionNamespace setVariable [format["WFBE_SCORE_UID_%1", getPlayerUID _x], _playerNewScore];
["StorePlayerSkill", "Store", getPlayerUID _x, _scoreDiff] call persistent_fnc_storeToDatabase;
} else {
_playerNewScore = score _x;
_scoreDiff = _playerNewScore;
missionNamespace setVariable [format["WFBE_SCORE_UID_%1", getPlayerUID _x], _playerNewScore];
["StorePlayerSkill", "Store", getPlayerUID _x, _scoreDiff] call persistent_fnc_storeToDatabase;
};
} forEach (playableUnits + switchableUnits);
persistent_fnc_storeToDatabase = (also running on server)
// Call to database
private ["_className","_procedureName","_response","_uid","_scoreDiff"];
_className = _this select 0;
_procedureName = _this select 1;
_uid = _this select 2;
_scoreDiff = this select 3;
[_uid, "DatabaseDebug", [_className, _procedureName, _uid, "TEST", _scoreDiff]] Call WFBE_CO_FNC_SendToClients;
_response = "Arma2Net.Unmanaged" callExtension format ["%1 [%2,%3,%4]",_classname,_procedureName,_uid,_scoreDiff];
_response = call compile _response;
if (count _response > 0) then {
_response = _response select 0;
};
[_uid, "DatabaseDebug", [_className, _procedureName, _uid, _response, _scoreDiff]] Call WFBE_CO_FNC_SendToClients;
_response
Why am I not seeing the debug messages?
WFBE_CO_FNC_SendToClients works with other functions normally, also I got the message to show once somehow but then it disappeared again
DatabaseDebug PV function:
private ["_className","_procedureName","_response","_uid","_scoreDiff"];
_className = _this select 0;
_procedureName = _this select 1;
_uid = _this select 2;
_response = _this select 3;
_hasScoreDiff = false;
_scoreDiff = 0;
if (count _this > 4) then {
_hasScoreDiff = true;
};
if (_hasScoreDiff) then {
_scoreDiff = this select 3;
};
sleep (random 3);
if (_hasScoreDiff) then {
Format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3, _scoreDiff = %4", _className, _procedureName, _uid, _scoreDiff] Call GroupChatMessage;
Format["Response from database (player skill (earned points per minute): %1", _response] Call GroupChatMessage;
} else {
Format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3", _className, _procedureName, _uid] Call GroupChatMessage;
Format["Response from database (player skill (earned points per minute): %1", _response] Call GroupChatMessage;
};
Is there a way to dynamically create variable names for spawned objects?
something like e.g.
format ["truck_%1", _someValue] = createVehicle bla bla bla
setVariable on mission namespace
Can you give me a code example? I'm sorry to ask, it's late and my brain's struggling
https://community.bistudio.com/wiki/setVariable have a look at 3rd example
@mortal wigeon Check my code above:
missionNamespace setVariable [format["WFBE_SCORE_UID_%1", getPlayerUID _x], _playerNewScore];
so eg.
missionNamespace setVariable [format["truck_%1", _somevalue], createVehicle ...];
FNC_createTarget =
{
params ["_position","_direction","_type","_side","_marker"];
_object = ([_position,_direction,_type,_side] call bis_fnc_spawnvehicle) select 0;
_object addEventHandler ["killed", "deleteMarker _marker"];
_object disableAI "MOVE";
_object //return
};
{
private _position = getMarkerPos _x;
systemchat format ["_forEachIndex has a value of %1",_forEachIndex]; //invalid number in expression
private _direction = 0;
private _type = sab_boat_freighter_o;
private _side = WEST;
missionNamespace setVariable [format["%1", _index], [_position, _direction, _type, _side , _x] call FNC_createTarget];
} forEach _eastMarker;
The systemchat message i added for debugging, because it didn't work and i wanted to check if "_forEachIndex" actually does what i think it does.
When launching the script i get a "invalid number in expression" script error in the systemchat line.
What am i doing wrong with "_forEachIndex"? Does it not work that way?
bom chars at line 11 and 15
Thank you very much, i actually didn't know that is a thing. Had to google, but fixed it now.
The event handler is still not working though so i have some figuring things out to do now.
Does anyone know of any issues with this: https://community.bistudio.com/wiki/serverCommand
Trying to use it with the kick function, and the RPT is posting that it is successfully executing the kick (using the alternate syntax with the serverCommandPassword) however the player it alleges kicking, is not actually removed from the game. (Same result produced using Client Name, and UID).
Thanks @tender fossil
serverCommand logs in .rpt?
Apparently so.
Been searching in here, and https://discordapp.com/channels/105462288051380224/105462984087728128/588703627665735693 apparently worked. I have tried this and cannot get it to work. However using serverCommand can't get anything to execute E.G locking the server.
what button can you apply textures to?
Question: how are Arma rain drops done (I suppose some "water bullets"?), and can we "detect" them by any mean?
Try shortcut button https://community.bistudio.com/wiki/DialogControls-Buttons @silent latch
ok
@tough abyss im having no luck with it
nvm
is there a script that makes it so there can only be one instance of a dialog
?
using createDialog only once 😅
if (not dialog) then { createDialog "RscMyDialog"; };```
@silent latch
so you're good?
yes
you're welcome 👍
if (!(isNull(findDisplay 9997))) exitwith {closeDialog 2;};
then below it was createDialog
case 44 is not working for me
Nvm
Is there any way to suppress the zero divisor error when accessing an element of an array which doesn't exist, without I guess filling a bunch of empties. I don't particularly care if it doesn't since I'm handling it, but I'd also rather not have this error bark at me because of it.
The question is, why are you trying to access an non existing array entry?
Use param with default value @harsh sphinx
Thanks. I'm not able to use param in this context but I realized I can just check the count of the array before going ahead with selecting something, which can mitigate it.
param and select are interchangeable, if you don’t want to use default value, don’t use, it will give you nil and no error
[] select 123; nil and error
[] param [123]; nil and no error
I know most people won't care much about this, but there's this bug that's been bothering me since day one:
everytime you open/close a dialog, your mouse cursor moves a little further away from the center of the screen.
this is one of the oldest remaining bugs, to my knowledge - minor one, sure, but a bug nonetheless. After thousands of hours of playtime I eventually got used to it and started adapting my playstyle to it, e.g. by centering (very roughly) my mouse before closing a dialog. Obviously this is far from being the ideal solution, and is generally just too much effort to be worth it, so today I reached my tipping point and decided to investigate this properly
https://cdn.discordapp.com/attachments/530670910475337728/615111439124004864/arma_cursor.png
surprisingly, it didn't take very long to figure out what's happening: everytime a dialog is opened, there is a delay of approximately 2 to 5 frames, after which the cursor is snapped to a different position. The offset between the new position and the old one revealed a pattern that is very consistent; the game seems to interpretate the cursor's position as being inside the safezone (the light grey area) and consequently remaps that position relative to the full UI area. This means if I leave the cursor at the absolute UI position of [0,0], it will systematically end up in the top left corner of the screen - everytime, without fail. The same can be achieved with any other coordinate - it essentially just projects the old position onto a different scale
now, I've no clue what the code behind this looks like, but it seems to be a more-or-less intentional "feature", seeing as the cursor originally shows in the correct location for a very brief moment, before being moved to a new (and incorrect) position. This leads me to believe that it's likely not a difficult thing to fix, which only adds to my frustration. But since I can't be bothered to wait for an official fix from BI, I came up with my own dirty (but working) solution:
dev_canSaveMousePos = false;
dev_lastMousePos = getMousePosition;
if (!isNil "dev_mouseCursorEH") then {
removeMissionEventHandler ["EachFrame", dev_mouseCursorEH];
};
dev_mouseCursorEH = addMissionEventHandler ["EachFrame", {
// Only work if there are any dialogs (or displays) open
if (!dialog and {count allDisplays == 4}) then { // 0, 313, 46 and 12 are always open
dev_canSaveMousePos = false;
} else {
private _curMousePos = getMousePosition;
// A dialog is open; check if the cursor has moved yet
if !(dev_canSaveMousePos) then {
private _offsetX = (((dev_lastMousePos select 0) max 0) min 1) - 0.5;
private _offsetY = (((dev_lastMousePos select 1) max 0) min 1) - 0.5;
private _calcPos = [
0.5 + _offsetX * safeZoneW,
0.5 + _offsetY * safeZoneH
];
// If the cursor has jumped to the predicted position... (this takes a couple frames)
if (_curMousePos distanceSqr _calcPos < 0.00001) then { // pixelW ~= pixelH ~= 0.001 (-> 1 pixel radius)
// ...snap it back to where it should be
setMousePosition dev_lastMousePos;
dev_canSaveMousePos = true;
// Otherwise, check if the user has manually moved the cursor before it could jump
} else {
if (_curMousePos distanceSqr dev_lastMousePos > 0.00001) then {
dev_lastMousePos = _curMousePos;
dev_canSaveMousePos = true;
};
};
// Update the cursor position
} else {
dev_lastMousePos = _curMousePos;
};
};
}];
(apologies for the wall of text)
Hi guys. How do I remove UI systemChat ?
what do you mean…?
@winter rose system Chat. How to disable?
@winter rose I need to disable the RSC display itself
showChat false``` it will affect _all_ radio channels, not just `systemChat` @fleet hazel
is there a easy way for limiting the range of the MIM-145 Defender? I have them setup to guard an Island but they shoot everything across tanoa. My idea was to maybe limit the radar they are attached to so it doesn't spot across the map
hmm maybe I just create a trigger and turn off the MIM-145 AI and enable them once an airplane passes the trigger
@hollow lantern that's the best solution I think
yeah, paired it with sqf count (thisList unitsBelowHeight 2) < 0; to include only air units
count can never be < 0 so your condition will always be false
ah yeah
hello im not sure if im right in this section but i hope so. My problem is that i want to add sirens to the D3S cars and i dont know where to begin with becaus i cant find nothing in the internet that can help me. i hope sombody can help me.
@tired delta siren such as airhorn siren, or car alarm?
is it posible to get zeus via the debug console?
yes
you can spawn the curator module manually, and assign yourself to it
but I think you need to create it on serverside
so it's quite a bit of code
ok i will try
@winter rose sirens such as airhorns that is an "Useraction" in the config of the vehicle. I tride my self on it and used one of the A3L cars as tamplate but o had no success
@tired delta that's #arma3_config then
allright but it must be conected with a script that plays the sound
and i dont know how to bind them together
class sirenon { displayName = "<t color='#ff0000'>Sirene An</t>"; position = "drivewheel"; radius = 10; condition = "driver this == player && (this animationPhase 'ani_siren' == 0)"; statement = "this animate ['ani_siren', 0.2]"; onlyForplayer = 1; };
this say "mySound";```
but it should be a loop
ther is also a script and i dont know how to call it
i have set the config like the one from a3l but i dont know how to link these things
comment "Get Zeus instantly without Modules and with all entities as editable";
curGrp = createGroup EAST; theCurator = curGrp createUnit ["ModuleCurator_F", player, [], 0, "NONE"];
theCurator setCuratorEditingAreaType true; theCurator addCuratorEditableObjects [entities "all",true];``` @uncut narwhal
@hollow lantern but does this work?
I can’t see where you assign player as curator
well if on a server then the assign command need to be executed, on local the player is used as default
And where is your code supposed to run
debug console
on local the player is used as default
setCuratorEditingAreaTypeis a serverside only command
addCuratorEditableObjectsis server only too
How do you execute server only commands locally on the player?
How can I draw lines on the map? I know there is a drawLine but it runs inside "Draw" event handler. How are player-made lines drawn actually? Or is it done by engine and has no scripting support?
debug console
Thought you were gonna say Arma 3

Or is it done by engine and has no scripting support?
engine
you can spawn markers I guess?
yeah I can draw a rectangle and rotate it, etc...
POLYLINE
what?
Those line markers have type
Hmm? okay, I know they are registered in the allMapMarkers, but can I create them manually? As I understand I can't?
What you want to do?
Just draw a line with fixed width (not in meters but in pixels)
In the High Command thing, IIRC, they rescale the rectangle's width according to map scale to make it stay the same width in pixels... I thought there is a better way
So when you zoom out it is still the same with?
Yeah
is there an easy way to translate a setDir heading into a vector for camSetDir ?
yes math
cos and sin and stuff
north is vector 0,1,0 and direction 0
[sin _angle, cos _angle, 0] I think?
params ["_screen", "_feed","_pos", "_target", "_direction", "_effect"];
_dirworld = [sin _direction, cos _direction, 0];
_screen setObjectTexture [ 0, format ["#(argb,512,512,1)r2t(%1,1)", _feed]];
/* create camera and stream to render surface */
_cam = "camera" camCreate _pos;
_cam camSetDir [_dirworld];
_cam camSetTarget _target;
_cam camCommit 0;
_cam cameraEffect ["INTERNAL", "BACK", _feed];
/* switch cam to thermal */
_feed setPiPEffect [6, 0, 0, 9, 0, 0, 0, false];
_feed setPiPEffect [_effect];``` that's my current code. However the cam is not rotated as it should be. I execute that script the following way: ```sqf
[A_wallUS, "dscreenfeed", [2166.64,13100,350.0], USBASE_MIDDLE_POS, 54.105, 2] execVM "itsAebian\uavops.sqf";```
my intended behavior would be this: camera should look at the target this way https://i.imgur.com/Ro2PGtC.png // however, camera is looking at the target this way: https://i.imgur.com/aTa2XEE.png // so the camera looks from above to the target, but from a wrong angle
that's the z parameter then
yeah but from the rotation, I mean the Z parameter in _pos is the height of the camera
that's why I thought camSetDir would help
You asked how to convert azimuth to vector. Azimuth is strictly x,y
now you confuse me. Isn't that exactly what the rotation Z is ?
Along z axis yes but your picture shows different rotation
well instead of ----- the picture shows| isn't that the Z rotation axis? I mean yes the camera looks from above but I thought that is Z rotation in this case
yes, and this is exactly what I want to change. Like if you would rotate a map on a table
where you look from above onto the map
But your picture shows camera tilt
sorry man I don't get 'ya then. In my eyes this is just a 90 degrees rotate without anything tilt
look up 3D vectors on google or smth.
@hollow lantern move a bit your camera the opposite way of the desired angle (with sin/cos calculation or getPos alternative syntax); this will make the camera look from it towards the object in the wanted direction
you can't and provide a camera position and setDir the camera and set camera target
I never had sin cos at school back in the day so probably need to watch some videos about it. The alternative syntax of getPos doesn't seem to fit. The camera will be created on the ground as the Z level will be below 10 sqf [2166.64,13100,350.0] getPos [0, 54.105]; returns [2166.64,13100,9.53674e-007]
([2166.64,13100,350.0] getPos [0, 54.105]) vectorAdd [0,0,500]; // altitude in meters```
also, getPos [1, (…) in order to have it a teeny tiny bit back
is it possible to move the position from a orbat module on the map?
Is there a known limitation to either attachTo or test_EmptyObjectForSmoke using createVehicle? I tried to use both on the new Contact DLC SIŁA smoke towers and the smoke just dissipates, while it works fine with smaller objects.
@winter rose Thanks, after restarting the mission your code seemed to work just fine. Thank you
That's one less issue in the way! Good to hear :+1:
@half inlet legend
Does anyone know if you can use the Ace add interaction to object on simple objects?
I've been trying to use it on the blood drops generated by ace and I cant seem to get it to work
if someone knows how could you @ me cause im gonna be off for an hour or few
Uhm is arma not showing full file path any more on errors? (the path us truncated)
2:26:30 Error in expression <ationScore;
private _scorePriority = (([_strategy] + [_worldNow , _tgtLoc , _s>
2:26:30 Error position: <_strategy] + [_worldNow , _tgtLoc , _s>
2:26:30 Error Undefined variable in expression: _strategy
2:26:30 File C:\Users\s-tron\Documents\Arma 3 - Other Profiles\Sparker\missio..., line 150
Does anyone else have paths to file truncated?
hi, i need a script were u can move (teleport) an item (box1) to me, infrontofme, ingame.
Use modelToWorld to get the position and setPos to set it.
@astral dawn Fixed: Script file paths were trimmed too aggressively in error messages https://forums.bohemia.net/forums/topic/140837-development-branch-changelog/?do=findComment&comment=3374424
@surreal peak can't do that with simple objects
@surreal peak see note https://community.bistudio.com/wiki/createSimpleObject
would this work? ammoBox setPos (getMarkerPos "markerName");
if ammoBox global variable holds some object that can be "setPosed" and there is marker named "markerName" then it should work just fine.
also no need for parentheses.
ok cool. thx for the quick responce
Can someone please give me a script for rearming,refueling,repairing and safezone for the .sqf please? I dont understand anything of scripts that's why im asking here, i didnt find it in a combination in the interwebs. Also i would like the original pylons of the plane to be rearmed, i dont want it giving me the default loadout. My pylons are 2 short range AA missiles on the furthest side on the wings, 500 cannon and 1 MR AA rocket. The plane is a blackwasp non stealth. that's the image of it https://ibb.co/bdxfxCZ
the planes dont have variable names
i tried this tutorial for the rearm,refuel,repair and edited it by deleting "sleep" because i want it to be instantly done mid air
also made the max speed 2000km/h and min to 0
but it doesnt work
and also i've ran into a new problem, when the vehicle(jet) respawns, it get's rid of the custom pylons i've set
how can i make it so it keeps the pylons
and about the safezone i can use the "invisible protection zone"
@slow isle sqf myPlane setFuel 1; myPlane setDamage 0;
for the ammo, see maybe https://community.bistudio.com/wiki/setVehicleAmmoDef ,
else
https://community.bistudio.com/wiki/setAmmoOnPylon
okay i have figured out the stuff with the ammo repair ect, only problem i have for now is the pylons
Good to hear 👍
Is there away to detect if high command mode is toggled on for a player (ie. he is in high command ordering mode)?
@thorn saffron https://community.bistudio.com/wiki/hcShownBar and other hc* commands should do the trick!
hmm, I would still need some EH that would detect hcShownBar. I want to display some stuff only if HC mode is active
nothing related in event handlers?
alternativly, I could try adding a button to the map screen that runs a script
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler
HCGroupSelectionChanged 😐
CommandModeChanged is what you want
yup
@winter rose thanks for showing me that, is it possible to convert a simple object into a normal one? I assume not but if it is possible it would help alot!
not easily
@surreal peak you should dig around
https://community.bistudio.com/wiki/BIS_fnc_simpleObjectData
and obviously https://community.bistudio.com/wiki/createVehicle
How can i make it so i can inform the player that he is in a safe zone via hint or big text on the screen ? Do i do it via hint ? If so how can i make it local only for him?
is this local? ```if (isPlayer playername) then {hint "message";};
basically this https://ibb.co/rmR2qfc
where can i paste this?
in game logic or ?
Simplest way is to make a trigger and put player in thisList in the condition and in the onactivation field, hint "message to player";.
There are, however, a multitude of other ways to accomplish this depending on your use case.
Also adjust the trigger area to that of the zone.
is anyone here using bdc's SCFramework script? i want to ask a question, since bdc is not active in the forum anymore
Hello All, I am trying to make a Multiplayer script which will manipulate global variables. I want to have it so when Man A does something it will effect the Variables of Man B. Does anyone know how to do this?
yes, you can use setVariable or publicVariableClient, depending on your usage
@crisp cairn
How can I increase the ammo of a vehicle (blackwasp) above the limmit. In this case increase cannon ammo above 450 to around 850
and make it so when you resupply/respawn you get your 850 ammo back
you can add magazines, but not overload one
yea that works
init.sqf
{_handle = execVM "script.sqf"} forEach units group player```
script.sqf
```sqf
this setDamage 1```
"this" right here: `###this### setDamage 1` in script.sqf does not work
how do i put in the caller as "this"; so `[whoever called the script] setDamage 1`
_handle = why? you never use that variable ever, and you make the forEach return nothing, that's a bad idea
n script.sqf does not work correct, why would it?
Function parameters are passed in _this
and you aren't passing any parameters to that script at all
also don't use execVM in a loop it will re load/preprocess/compile the script at every execution
use CfgFunctions in description.ext
script.sqf
params ["_unit"]
_unit setDamage 1```?
yes
i actually would like to pass on $(this); how do i do that?
whatever this is i am calling you from, take that as a param
why run a forEach if you pass none of it's values along?
Why are you running a forEach if you don't want to use the values you are iterating over?
I thought you wanted to run the script for every unit in your forEach
yes
for that this is wrong, you need to use what the forEach wiki page tells you
ah fuck, is it _x?
Yep
Hi guys! I'm using this simple addAction in my mission... Is there a way to limit the distance for createVehicle?
"Place marker",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"true",
"true",
{},
{},
{
"FlagMarker_01_F" createVehicle screenToWorld [0.5,0.5];
},
{},
[],
2,
-10,
false,
false] call BIS_fnc_holdActionAdd;
}];```
yes.
grab the pos in a (private) variable first, check the distance, and if it is less than what you want, create the flag there
With this pseudocode, you should manage 😉
(that or set a condition for the action to work)
@lofty rain
Maybe distance between cursorTarget and caller? Does it make any sense?
hello, I am trying to place an asset during a base initialization script, literally the B_Ship_MRLS_01_F, VLS object. I have a grass cutter placeholder that I am placing on the VLS position of the Liberty deck, no matter how I place it, snapped to surface, a tiny bit elevated, etc, I am either finding the asset bounces off the deck, or is detonating.
in terms of asset placement, this is the first one in the queue, before artillery pieces, SAM sites, etc.
any ideas how I can place that via script and it not explode on me or bounce off the deck and into ocean?
I am using the grass cutter object position and orientation in order to inform the placed object(s) as to their position and orientation.
Disable Simulation?
already doing that, _asset_obj enableSimulationGlobal false;
literally next line after creating, _asset_obj = createVehicle [_asset_class_names select _j, [_asset_proxy_pos_atl select 0, _asset_proxy_pos_atl select 1, _asset_proxy_pos_atl select 2], [], 0, "NONE"];
Create it somewhere safe, disable sim, move it.
so, not create it on the deck initially? it's an idea, thanks.
Yeah, like 0,0,100 it or whatnot, then setPos it to the other object you are using. See if that helps.
okay, will try that, thank you.
could also setvelocity to 0 as backup
sweet victory. the asset factory proxy approach worked. better yet, I can provide the actual proxy as a default when the factory proxy does not exist.
proxy?
i.e. placeholder, literally, a grass cutter. just something to hold the position, orientation, etc.
i.e. proxy, meaning in place of.
oh, okay, I see. not familiar with those other contexts.
apart from network configurations, routers, proxies, etc.
What happens if I set a public variable on two different objects? Like car1 setVariable ["varMain",5,true]; and car2 setVariable ["varMain",15,true];
It wont overwrite right?
Now what happens if in another code i do varMain = 10
Is that the equivalent of missionNameSpace?
What I want to ask is how to write a log script to bind some keys in keyhandle so that players can record some operations in SQL. Thank you. I don't know how to write in life_server
Why not ask on Life forums?
@tough abyss I asked several times before, but no one answered me. I was desperate.
Hello community! 👋
Anyone here has experience with Pseudo Random Number Generators in ArmA3? I tried to implement a LCG one but I feel I was kind of unsuccessful, probably because how arma handles precision of larger numbers 😦 Any tips?
…I know random 😄
well the problem is that I want to be able to provide a seed to the random generating function
so that I can get the same pseudo random sequences
the random command is meant to be the least pseudo random as possible as it doesn't expose its seed nor it allows you to change it afaik
seed random x exists yeah?
https://community.bistudio.com/wiki/random
Alt Syntax 2 & 3
🙏
😉
since Arma 3 v1.67 yeah
and?
got up to a max of 33 so far
which is really really bad
my own implementation was having 2k+
but maybe i'm using it wrong? 😦
calc_max_unique = {
params ["_seed"];
private _res = [];
private _size = count _res;
private _prev = -1;
while {_size > _prev} do {
_prev = _size;
_res pushBackUnique _seed;
_seed = _seed random 1000;
_size = count _res;
};
count _res
}
depends on the seed and sometimes you get a 72 but that's still a really short period
maybe a stupid suggestion, but why not having an array of seeds and parse/random through it?
also, it might be "only" a first collision, idk
try
params ["_seed"];
private _result = [];
for "_i" from 0 to 999 do {
_result pushbackUnique _seed;
_seed = _seed random 1000;
};
count _result;```
well technically the first "collision" causes the loop
and it should be guaranteed that once you loop you should never get out of it again
but in arma realm I guess it's possible (?)
nah it's still a two digits number for me even with the loop 😛
weirdly enough, sqf obeying math laws
hehe
#define MULTIPLIER 7793
#define INCR 1234
#define MODULO 999999
private _next_in_seq = {
params ["_x", "_a", "_c", "_m"];
((_a * _x) + _c) % _m
};
private _calc_max_unique = {
params ["_seed"];
private _res = [];
private _size = count _res;
private _prev = -1;
while {_size > _prev} do {
_prev = _size;
_res pushBackUnique _seed;
_seed = [_seed, MULTIPLIER, INCR, MODULO] call _next_in_seq;
_size = count _res;
};
count _res
}
from this I was able to produce a 2K+ unique sequences
sorry, *some sequences that were longer than 2K elements 😛
but I still have to tweak the modulo as it should be a power of 2 ideally
The problem with this approach is your values have 6 significant digits, but the multiplication _a * _x needs twice as much.
I'm aware 😦 Less digits will also produce shorter sequences though 😒
[0] call _calc_max_unique_mod
``` produces 6872 unique results before looping
but at this point it may just be as you hint that it's a flawed solution that just happens to match any two equal number but it doesn't necessarily mean the sequence is going to loop
Can i set by code the map view to a specific position?
@real mango thanks man!
private _mapCtrl = (findDisplay 313 displayCtrl 51);
private _pos = [worldSize/2, worldSize/2];
private _zoom = 0.1;
private _transitionTime = 1; // in seconds
_mapCtrl ctrlMapAnimAdd [_transitionTime,_zoom, _pos];
ctrlMapAnimCommit _mapCtrl;
``` 😉
(if you want to try it out in 3den)
This helped a lot, thanks.
Indeed, i want to put the vision in the center of the map, like you did.
@runic quest You'd have to look at how the existing queries are sent. Then remoteExec to the server to run your new func and pass what you are logging. Use that func on the server to query the DB to insert /update what you need to.
@tough abyss He's using some hacked up mission from Russia and doesn't really know much English.
@finite dirge thanks,i use the altis 5.0 now, i want to learn more..
Probably a macro that was defined somewhere or was supposed to be.
Hello!
anyone has any clue why this script makes the player sometimes be like forever in unconcious animation?
player setUnconscious true;
sleep 5;
player setUnconscious false;
Can't think of a reason why that would happen. You could always manually check the lifeState if it happens to you (debug console) and see what it says ("INCAPACITATED" would be unconscious).
@minor lance it happens if you don't have a primary weapon.
yeah.
I know.
Haha. That's amazing. At all or just equipped?
I think equipped, but I don't remember well
same if you fall to the bottom of the ocean iirc; you're screwed
That's hilarious. Thanks for the info!
What is the most base way to determine what kind of unit I hit, with a specific weapon, and if true to fire off some script?
add the event handler to the target
Is there a specific one though that I can say "was killed by this weapon"? Or would it just have to be unit level only?
way to determine what kind of unit I hit
Depends on how accurate you need to determine the kind of unit
https://community.bistudio.com/wiki/typeOf gives class name (most accurate)
https://community.bistudio.com/wiki/isKindOf can tell you if your object inherits from a specific cfgVehicles class ("Man", "Land", etc)
Yeah object's class name remains the same when it's destroyed as I know
Thanks. I'm making the ED-1E collect "samples" from zombies
@real mango This might be of interest. This is an ACORN pseudo-random generator... It has the property that the period is "some multiple" times M where M in this case is 2,097,152. https://gist.github.com/senevoldsen/e1bafbf2efcd49497e5e238ec82b111b
Thanks a lot! 🙂 Surely looks interesting
So, I want to get into scripting. The first thing I would like to try is animation for a deck crew like they have it in the Jets Showcase. However, I don't have as much experience with scripting. Anyone got any insight?
perhaps you need to first get into how scripts are written and used. Then look into the different commands that are used to run animations on characters
the scene you want to replicate is rather complex and definitely more so if you want to make it dynamic
How can I check if TFAR is running on the server that a mission is running on?
@still forum
Check class in CfgPatches
isClass (configFile >> "CfgPatches" >> "task_force_radio")
or if TFAR 1.0
!isNil "TFAR_core"
thanks
Hello people, would anyone have tips on how to get an array of players inside a specific vehicle without including the AI passengers of said vehicle in the array?
You could always loop through and not add the ones that are AI to the array.
@finite dirge Cheers, I think I'll settle on this
_passengers = [];
{if (isPlayer _x) then {_passengers append [_x]}} forEach (crew vehicle this - [gunner vehicle this] - [driver vehicle this])
crew myVehicle select { isPlayer _x }
i have a question ? how to create extension.dll in arma ?
Older tutorial: https://forums.bohemia.net/forums/topic/181816-how-to-c-arma-extension/
Info on extensions: https://community.bistudio.com/wiki/Extensions
@finite dirge yes but it's in c# and when put the c# code and i compile it doesn't work so i don't know
and older tutorial doesn't work
What do you mean it doesn't work?
when i write only the code in MyExtension.cs it doesn't work when i compile he say error
What's the error?
i put only that : https://pastebin.com/gn0RR4JF
and the error is : https://pastebin.com/Smp5ayx9
Install the Microsoft build tools: https://www.microsoft.com/en-us/download/details.aspx?id=48159
I think that's what's missing.
ok
and i recreate a new project ?
@finite dirge ok it work but i don't understand the _64.dll because i have that but i don't have x64
Install those tools, restart VS (maybe the PC) and try again on the compile.
@finite dirge i have two question one is : do you need a name space ? or you can only paste that : https://pastebin.com/gn0RR4JF ?
I'm sorry, this is something I have little experience in other than dabbling a while back in making a 32bit extension.
oh ok don't worry and i have an other question where is place my .dll ?
yes i have read this but in .pbo or only in @mod ?
ok
and when i add the post build script it doesn't work so i test an extension build in 32bit
it doesn't work too
It just renames it, so you could manually do that too... lol
yes and all doesn't work
i have a question who know how to create module in c# ?
Im making a admin extras menu for my server. Im trying to check the players UID from a list of UIDs. My friend was helping me but this didnt work, but does give the Not Authorized system chat message.
private ["_uid","_Access"];
_uid = getPlayerUID player;
_Access = ['76561198769124974','UID2','UID3'];
if (_uid isEqualTo _Access) then {
[] spawn aft_fnc_AdminExtra;
} else {
systemChat "Not Authorized!"; //For debug
};
I tryed to use the community.bistudio.com/wiki but I cant figure out whats wrong
@untold barn you are trying to check that a uid is equal to an array…
in is what you are after
Yup (and ninja'd)
@untold barn it's _uid in _Access
ok thank you
is it possible to put a background on a ControlsGroup?
Good Night!
Hi, guys! Does anyone have a hint for me on how to move the drawIcon3D icon screen-wise? It draws at world position, so just changing x,y shifts icon in 3d space not in the screen space. While worldToScreen binds the icon to the static position 😦
give it coordinates like [0..1 , 0..1]
oh wait, drawIcon3D. why drawIcon3D if you don't want 3D icons?
Oh, that's a loooong long story. I used to stick to the rscCut stuff. But I just generate too many rsc layers and the whole thing becomes glitchy (imagine 50 zombies running around each with a hp bar above his head)
and…?
You are ended with glitched hpbars all over your screen even cleaning the layers after zombie death
something you must do wrong then?
Well, frankly speaking I don't know how to delete a reserved layer, only how to clean it. But it does not help much.
From the standpoint of the code quality - I did some hotseat check ups with a person who is a real programmer 🙂 and it was ok-ish.
Draw icon 3d is supposed to draw it in world coordinatea
To place - yes, but it actually extrapolates itself to the screen point
Its not meant to draw 2d ui though
Depends on what exactly UI you are talking about. Markers and tasks markers are both di3d things
And they are operated in a 2d screen space hence placed in a 3d world
Yes but they point coordinates in 3d world
They don't move around the screen space
What is it you're trying to do with them
Actually they do, if you will turn from the marker it will go offscreen, while the icon will be on screen moving up or down depending on the object vs camera position
What am I trying to do is to move my hpbar icon to the left camera (or screen) wise
It's still trying to point to the 3d location
Yup
You see, the hpbar is scaling when you are damaged or being healed. And it scales from center to the edges. I want it to behave as a progress bar, so I need to move it left a bit each frame if it grows.
I don't thing there's reliable way of doing that with drawicon3d
It's not meant for that
I picked it from a couple of other hpbar scripts.
rscCut doesn't really help either when it comes to dozens of hpbars 😦
have fun with screenToWorld and distance
Yup, I'm thinking about that @winter rose , thanks.
Maybe I'm not understanding what you're trying to do but if you have work g example then that's the way to do it
Or I can just leave it be scaled from center for Arma Gods' sake! 🙂
I don't know how to delete a reserved layer, only how to clean it
if you keep using layers, you should really get how to delete them
I don't know how, though I lurked every damn google page.
Everything is around layerId cutRsc ("", Plain) which is to clean, not to delete. You can have layers array, of course, but it's just a copy, I can't modify it. Probably it's just locked for people not to kill their basic HUD elements involuntarily 🙂
why do you think it is the rsc that caused problem and not 50 AI units
Because they work ok with drawIcon3d
how were you drawing the rsc layers?
on Draw3d foreach allunits create a layer with ID == object netId place a dialog control with current hpbar. If there is a layer with this object id, don't draw a new one, use the old one. Then clean all dead units layers.
And show them only if distance and camera position is in range.
and you were moving them with ctrlsetposition?
yup
oh dear dear
Ha
so someone told you this was ok?
I stole it 🤦
no surprise drawicon3d works miles better
And of course I've read a KK's tutors
you should stick to icon
Yup.
I liked the rsc way though. progress bar is awesome 🙂 And it worked perfectly, until overflown 🙂
you cant delete layer once it has been allocated, so giving them netid would create memory leak
because netid is not reassigned
so your allocated layer array would just grow and grow and grow
you should have made a fixed size pool of layers. also need to check, but I think redrawing layer each frame is cheaper than moving it
but yeah use icons
Yeah, I wanted to reuse layer Id's from dead units, but then I realised that I had 10 dead and 40 alive and 10 more waiting the spawn time, so the outcome of optimization won't be sufficient and so I switched to the icons 🙂
One more very fun thing to understand: why Fired EH + setAmmo to full doesn't require a reload action for rifle and pistol but obliges player to hit R if he armed with a n RPG32 rocket launcher 🐲
wait, it should be add mag, remove/add weapon if same as OFP
try to linkItem the mag, or there might be a command to insert the mag into the weapon
Ooh.
Remove the weapon, then immediately afterward add a magazine and add the weapon again.
Oh. My. God.
Still interested in why I don't need that for a rifle, it could go total reverse vacuum cleaner with just remove/add magzine + setammo 🙂
Thanks, @winter rose it worked.
the thing is you can't setAmmo on an empty magazine maybe - or that the "empty magazine" is deleted on a launcher, idk
@dull drum https://community.bistudio.com/wiki/addWeaponItem try that "instant" parameter
Oooh. Thank you, sir!
is there any way to increase a vehicle radar range? being more specific, jet's radar range
Is there anyway to do a countdown?
@tough abyss through sqf, no
@crisp cairn sure, there are many ways to do that
Can you give me an example mate
@crisp cairn ```sqf
[] spawn {
hint "5";
sleep 1;
hint "4";
sleep 1;
hint "3";
sleep 1;
hint "2";
sleep 1;
hint "1";
sleep 1;
hint "cake!";
};
How can I make a listbox which auto-resizes itself according to the amount of rows?
Or maybe not auto-resizes, the amount of rows is actually static. I just need arma to set Height for me.
If you made the listbox transparent, wouldn't that be fine? Or do you want the other controls to move or the dialog itself to resize?
No it wouldn't be fine, because the actual control's size will be bigger than the rows, and it will intercept mouse events and feel weird
Then if you are filling it with lbAdd, just adjust the height when you add a row.
I think I need to multiply the amount of rows by row height, but row height is defined with GUI_GRID_H...
GUI_GRID_H is not an SQF command is it?
macros
is it? it's stored as string (copied from the config viewer)
rowHeight = "1.2 * GUI_GRID_H";
Although in my config I set it as:
rowHeight = 1.2 * GUI_GRID_H; // Not a string!
I guess engine recalculates it?
#define GUI_GRID_H (GUI_GRID_HAbs / 25)
ui_f/hpp/defineCommonGrids.inc line 12
#define GUI_GRID_H ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)
is that it leads back to
huh, but I don't have it defined anywhere in my code 🤔 and it still manages to be resolved by arma, although it converts this to string
but yes I assumed it's a define, some time ago!
that's because config "strings" in arma are just whatever it doesnt know about
For example, lets say you do rowHeight = 1.2 * somerandomvar
without strings, its the same as with striings, in both cases it'll need a somerandomvar
whereas when its actually defined, the preprocessor will put there what it's defined to
So it can't resolve GUI_GRID_H, it converts whole expression into string to be resolved later, by searching the variable among arma's special variables or definitions?
special variables not really such a thing
it'll just user whatever is in missionamespace
hmm you're right, there is GUI_GRID_H in my mission namespace instead
basically i'd say set up your own grid in a way you like and use the defines in a nice macro include file
include the same file in your scripted functions for your UI, so you can use them there as well
and you're all good
Pretty weird that they didn't make the GUI_GRID_... a scripting command
Instead they store it in mission namespace
Look for the newer commands from 3den days
And the grid macros they use there. Generally better
is it possible to remove RscEdit Borders?
Hello im am very confused, when a sector is captured the respawning vehicle or/and the player respawn of the other team disappear. How can I evade that? I didnt script it so it does that. I put force respawn on the jets
Hello very confused, I'm dad!
Hello all, wondering if anyone can help been googling for about two hours now with no luck.
Trying to determine a players weapon type, UGL in this case and then exit with if (_isugl) exitWith { "\A3\ui_f\data\map\vehicleicons\iconManLeader_ca.paa"; };
this is so I can display both the Squad Lead and our Fireteam leads in the ST Hud.
current weapon type is semi easy.. UGL tho...
https://community.bistudio.com/wiki/currentMuzzle
https://community.bistudio.com/wiki/weaponState
the muzzle is the active weapon on the weapon, so that would say something about UGL..
Don't know a easy way besides going through config to check whether thing is UGL or not
I was looking into using the roleDescription
or trying to set some sort of variable for them to no avail my scripting skills are very low.
It's complicated enough that I can't write something down from my brain right now, and I gotta go to bed now
No problem mate hopefully figure it out tomorrow
you could check the current ammo type of the current weapon
Hhmm ok I will check that out
then again ugls usually inherit from the same base class so checking against that too might be good enough
I think I figured it out
{
params ["_type"];
(getText(configFile >> "CfgWeapons" >> _type >> "UIPicture") == "\a3\weapons_f\data\ui\icon_gl_ca.paa");
};``` was lower down in the code
Hi. Dr. Bear Here
I need some scripting help
and im unsure of your formattting requirements
i have been into the arma series for years
but deeply getting into this scripting now
Like for arma itself or for posting code here
posting code here
```sqf
Code
Or for long code, use pastebin
player allowDamage false;
Won't syntax highlight on mobile, but will for desktop users
okay so this is gonna be confusing but i need help
My goal here, was to make sure that basically a unit is not a sitting duck alone in a vehicle.
I have a blufor unit, setup as a police officer, he can respond to calls already, its what he does, when he does
now hes just a sitting duck in a vehicle, refusing to get out at the sign of danger
its not fun seeing the police roll up, expecting a gunfight, and getting a sitting duck in a vehicle when your creating the scene
id also like, if he sees an enemy, for him to follow the enemy in the vehicle, or atleast attempt, instead of flanking
my efforts have been quick and dirty. Police trigger 1 and 2 are attached to police car 1. police car one has police officer 1 and 2 inside.
theres a radius on both triggers, #2 larger than #1.
I hope this makes sense
*PT1 (Police trigger 1) On Activation
unassignvehicle pc1;
moveOut po1;
moveOut po2;
PT1 Deactivation
PO1 MOVEINDRIVER PC1;
PO2 MOVEINCARGO PC1;
*PT2 (police trigger 2) On Activation
pc1 animate ["BeaconsStart",1];
pc1 setPilotLight true;
if side _NearestEnemy then {pc1 commandFollow (side_unit)};
pc1 setDriveOnPath t1;
pc1 setBehaviour safe;
pc2 allowFleeing 0;
*PC1 (Police Car 1) Init
pt1 attachto [pc1,[0,0,0]];
pt2 attachto [pc1,[0,0,0]]
*Definitions (Other)
*PO1 - Police Officer 1
*PO2 - Police Officer 2
I know, im very embarassed
My police officers flank off the road. not follow for any time whatsoever
made this a little friendlier
unassignvehicle pc1;
moveOut po1;
moveOut po2;
PT1: \\ on deactivation:
1 MOVEINDRIVER PC1;
PO2 MOVEINCARGO PC1;
PT2: \\ on activation:
pc1 animate ["BeaconsStart",1];
pc1 setPilotLight true;
if side _NearestEnemy then {
pc1 commandFollow (side_unit);
};
pc1 setBehaviour safe;
pc2 allowFleeing 0;```
Hi guys!
Do you know the difference between hitbody and hitHull on the quad (I can't understand since I usually use hitbody ?
@subtle flint you should ask in #arma3_config
Ok, so I have a drawIcon3D function I want to call. How would I do so in a way that would allow me to "turn it off" when I want to?
@thorn saffron it redraws each frame (or each Draw3d event), so just put there an if that switches it off if a requirement is met. If i'm getting your question right.
You call it on each frame, so to stop it don’t call it
BIS_fnc_addStackedEventHandler maybe? I'm unsure how to call it with my function
store the eh id and remove the handler when you dont need it.
Depends how often this happens, maybe if then is enough inside the handler
["taro_HUD_draw", "onEachFrame", {[] call taro_HUD_fnc_drawIcons;}] call BIS_fnc_addStackedEventHandler;
Something like this?
Ok that works.
@tough abyss @winter rose I'm looking to make a repair system, when I use getAllHitPointsDamage I find these two elements 😋
But I don't understand their difference
On basic vehicles it's only hitBody which is used
Those hitpoints are defined in config, hence why you should ask in #arma3_config what is the difference
Oh sure 💯
Any ideas how to make the handle damage eh tick without a bullet hit? I'm trying to get RZ zombies to tick the EH. They were just applying setDamage to the target, which does not tick the EH. I've tried to spawn an object with particle fire, to apply down velocity (makes target jump in the air) and to damage HitPoints, all to no good result. Anything on your mind guys?
There is an idea to try to simulate a weapon shot somehow, but I can hardly imagine where to start to get a bullet from invisible weapon 🙂
createVehicle the bullet itself, but beware of the damages
Whoa that's deep
Any examples, maybe?
Like - create - set velocity in direction?
Instantly made a vision of a bullet rain, literally
I think a friend of mine made bullets rain with the console once 🤔 It was fun, a .50 cal bullet rain
You could try that and set the velocity. You could even do what the scripters do and silent aim it (TP it right next to their head).
I would delete that rokunin, that's just a link to a hack forum, won't even help you as it's not SQF.
Well, sqf or not, there is an example of the behaviour that is sometimes so much needed and which sometimes there is a great lack of. But ok, I'll delete it.
Linking to active Arma hacks/cheats is very close to instant ban, so yes, don't do that again
Yes the answer is to createVehicle and setVelocity the bullet, and make it hit the unit
Thanks, guys. And post deleted ofc, sorry about that.
you must make coffee for a week, that's the rules (please add it quickly to #rules Dwarden)
Well I just did myself a cup of tea, does it count as a start? By the way, this bullet-velocity solution worked like a charm.
Did you make it rain bullets already or not??
I made zombies spawn bullets on attack, so they do damage with bullets now which is pretty fancy.
And it looks like bullets are destroyed when hit target which frees me from additional garbage collecting
What a day!
Which is correct?
format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3, _scoreDiff = %4", _className, _procedureName, _uid, _scoreDiff] Call GroupChatMessage;
or
[format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3, _scoreDiff = %4", _className, _procedureName, _uid, _scoreDiff]] Call GroupChatMessage;
(Note: Arma 2)
neither
1st call is written with lowercase c.
2ndGroupChatMessage is both missing a unique tag, and the _fnc_ or similar to identify it as a function
3rd we don't know what that function expects, so noone can answer that besides the guy who wrote that script
@still forum This is old code from Benny's Warfare that I modified
Either ask him then, or look into the "function"
Lol
This is literally the only content inside the GroupChatMessage function:
player groupChat _this
So question answered then, groupChat doesn't take array
So first one is correct?
Still the notes given apply, but more correct, yes.
@finite dirge Yeah, I don't bother fixing those capital letters or functions because there are thousands of lines of code written like that 😄
Or, better, since you are editing it, just fix it?
"My house is already a mess, let me just poop on the floor too, the toilet is too far!"
Yeah, I choose pooping on the floor for now 😄
It would be different if it affected the functionality somehow, but as Windows doesn't make difference between uncapitalized and capitalized letters...
but as Windows doesn't make difference between uncapitalized and capitalized letters
has nothing to do with windows
@still forum Let me fix it: *as the engine doesn't make difference between those letters 😄
It makes. After I've enabled by accident case sensitive NTFS i had problems with filepatching.
It's more like PBO as file system does not.
It's also not related to anything filesystem :U
also "the engine" is a broad term. There are many systems in the engine, some are case sensitive
@tender fossil you could "simply" use params so arg1 or [arg1] makes no difference 😄
no he can't
yes he can
If he edited the function, sure.
Yep!
this is A3 scripting channel, is it bad to assume that he was translating it to A3?
If he directly said it was for Arma 2...
🙈
enforced with the "this is old code that I modified", you can read it as code from A2 to A3.
Anyway, I am right and you all are wrong, period.
Can someone link an easy to follow tutorial for creating a faction? I dont really want to add anything, i just want to have my loadouts be default in certain scenarios
can anyone here help with a config .cpp?
{
class OctomsMod
{
units[]={};
weapons[]={};
requiredAddons[]={};
requiredVersion=0.1;
};
};
class CfgVehicles
{
class B_MBT_01_TUSK_F;
class Slammer: B_MBT_01_TUSK_F
{
displayName="Slammer";
weapons[] ={"LMG_RCWS"};
Magazines[] ={"12Rnd_125mm_HEAT"};
//class Turrets
//{
//class MainTurret
//{
//weapons[] ={"LMG_RCWS"};
//Magazines[] ={"12Rnd_125mm_HEAT"};
//Values to edit
//};
//};
};
};```
the weapons keep adding themselves to the drivers seat
well if you want to add it to the gun, you probably want mainTurret
@still forum i tried that, on the bottom half of the code, but what it does is it makes the gunner seat unusuable in game so ive commeted it out for now and added weapons[] and magazines{}, it justs adds it to the drivers seat.
probably need inheritance on the turrets then
when i spawn in the tank in eden the commanders and gunner seat dont exist
ah
do i have to inherit both the original turret and the new one?
as for the main cannon for the slammer im trying to replace the 120mm with 125, and also add a new turret
ah ok
what ive also noticed is when i dont have the bottom code commented out, in the config viewer it deleted everything else but the weapons and magazine codes
@hallow otter adding a faction would be a mod, therefore #arma3_config
but you can also create a unit, save it in a template, and paste paste paste it
@winter rose thanks. I'm more looking to have my own loadouts in the drop down menus for dynamic recon ops, and to have the right kinds of ammo in my vehicles
@tough abyss keep question on one channel 😛
yup, saw the correct channel for it at last
I want to have a break in the drawIcon3D text. How do I properly set it up? I tried:
_text = _text + "<br/>" + str(_x)
I just get <br/> in the text and not the new line.
\n maybe
nope, I just get \n in the combined text. I think I might need to prase this or soemthing. I never did that kind of stuff before
was it you that made the zombie lifebar stuff?
ok, so the drawIcon3D needs string, not text. Can you have line breaks in strings?
problem is lining up the text, so it does not overlap the text and I wanted to have it done in a single draw call.
may be its impossible
no can do
- does not take text (so parseText is out of question)
- \n doesn't work
- endl doesn't work
Lining up 2 separate icons is also incredibly hard. I think I settle on inline display, even if it looks kinda wonky.
<br/> should work
Does someone know if it's possible to use ACE interaction through an UAV? I'm trying to use the defuse explosive interaction through an UAV, but no matter what I try it doesn't show the options for the object.
I did modify some stuff, like adding ACE_MainActions to the UAV and adding a modified event handler to the explosives so it would allow the defuse action even when the (real) player is not in range. However it seems that ACE only allows interactions from the players POV and not vehicles and/or UAV terminals.
Is it possible to remoteExec an addAction to a client while giving that action a handle on the client?
e.g. how to give handle with this:
[
_leader,
[
"<t color='#ff0000'>Unready</t>",
{
[_this select 3 select 0] call JST_fnc_setUnReadyPerSide;
JST_clientsLastAction = (_this select 2);
(_this select 0) removeAction (_this select 2);
},
[_side],
6,
true,
true,
"",
"_target == player"
]
] remoteExec ["addAction", _leader];
Right now the only way I know to delete that specific action is to track it's ID number which is difficult and clunky
I tried that and it didn't work when I called the removeAction
I guess I did it wrong?
well, the index should be stored on client, on client's computer, as a global variable or smth like this, at least that's how I'd do it
That's how I do it now, but it easily gets messed up by other things
JST_clientsLastAction is that variable, but if the client never hits the action it never stores itself
So I have to guess, which gets messed up if other actions are involved too
you can check if this variable is nil, or you can set the variable's value to -123 inside preInit
I could, but that's all so much more complicated than just assigning a handle
I was hoping there was a way to assign a handle via remoteExec
nah, arma makes a handle on its own and gives it to you, you can't make the index yourself 😦
oh wait!
the script you add in the addaction gets these params:
params ["_target", "_caller", "_actionId", "_arguments"];
_actionID is what you need huh???
yes, I'm already using that
that's what I mentioned above with JST_clientsLastAction but that only fires when you use the action
ok I see it now
yeah much better would be if they let us assign a string associated with action... 🤔
https://sqfbin.com/ecoquyugelunifebidaz Does line 5 disable voice switching (For example. direct communication, team communication)? Thank you!
@runic quest according to the TFAR wiki it does
https://github.com/michail-nikolaev/task-force-arma-3-radio/wiki/API:-Variables
as in; it prevents using the radio
for vanilla chat/VON use https://community.bistudio.com/wiki/enableChannel
@exotic flax thanks a lot, but now the problem is that when players are restricted by the police (shift + r), they can use voice communication, but they can not switch channels. For example, when the players'current channel is for team communication, they can not switch to team communication. I found the problem for a long time, but only in restrain. SQF to find the command after being copied. 。
the TFAR variable only prevents someone from using a radio (direct voice chat through TFAR is still possible)
vanilla chat/VON is something different and uses enableChannel to manage; however is does not prevent someone to switching channels which are still active
Can I ask a quick question here?
that's what this discord is for 😉
I'm trying to open the PBO file for https://steamcommunity.com/sharedfiles/filedetails/?id=1711485378&searchtext=Operation+Overwatch, but I don't know how to get it in editor with all the items in it.,
@exotic flax So is that the problem? It limits players from switching voice channels.
player SVAR ["tf_unable_to_use_radio", false];
@astral dawn You inspired me to go and try it via the remoteExec a function route again, and I don't know what I did differently but now it works
That's cool! 👍
@runic quest TFAR does not affect vanilla chat/VON in any way. It only prevents using a radio, including changing the frequencies (which makes sense if you can't use a radio).
@lapis inlet there are tools which might allow you to open the PBO and give you access to the files inside. However after making the changes you'll need to create a new PBO again (for which there are also tools available).
To learn how to do all that you should be able to find a lot of information on the official forums and wiki.
@exotic flax thanks,But I'm sorry, I don't understand very well. I don't understand the key to restricting voice channel switching (direct channel, team channel).
@runic quest switching vanilla channels is ALWAYS possible, unless you're unconscious, dead or are disabled in the mission. To disable (temporarily) them, you can use the enableChannel function.
Switching TFAR channels (aka frequencies) is always available, as long as you have a working radio in your inventory or when ["tf_unable_to_use_radio", false] is used.
The moment someone should be able to use it again, simply set it to ["tf_unable_to_use_radio", true] and everything will work again as before
@exotic flax thanks a lot!
(!(_unit iskindof "man"))) then {
unassignvehicle pc1;
moveOut po1;
moveOut po2;
};```
What have i done wrong here
I wanr the 2 units to get out of the vehicle (mainly thw driver) under threar from another unit
This is in the activation of a trigger
Which is attached to a vehicle (pc1)
Any help would be much appreciated
};```
is it possible to make you continue a campaign or mission via scripted means? (like store last mission in profileNamespace and load that again somehow)?
What type of things are you trying to make persistent?
not related to persistence - just quick continue option
Im trying to make sure the ai driver gets out in combat situaions
right now he just sits like a fish in a barrel
Is there any way to check if a unit is in line of sight of anyone from aparticular side? knowsAbout does not respect LOS. I know about checkVisibility but it might be too much to check every enemy unit against every friendly.
checkVisibility/lineIntersectsSurfacesthere is no magic command "check if visible for side"
depending on what you want to achieve maybe it can be optimized.
eg checking single unit per frame or smth, so fps won't be killed...
What I want to achieve is to check if anyone from a side can see the unit. I guess I could use knowsAbout to do a first check and filter out units before starting doing an intensive LOS check.
It would be nice if there was a command to get an array with every unit that knows about unit in question.
@exotic flax
simply set it to ["tf_unable_to_use_radio", true] and everything will work again as before
No... Not quite... Setting "unable to use" to true, means you are unable to use it, meaning Can't use the radio. The exact opposite of what you said
How do you use apply to get every group on a particular side? Like allGroups apply {stuff} I basically want to filter out groups depending on side. I can do that with an if and forEach, but I was hoping to do that when getting the allGroups array
You don't. You use select.
allGroups select {side _x isEqualTo east}
If you tells us why you want to know whether there is a unblocked line of sight between two units - e.g. what are you going to use the yes/no result for - then maybe someone has a better idea... Because doing NUM_WEST_UNITS * NUM_EAST_UNITS line-of-sight checks will not scale beyond, if even to, platoon size encounters.
to know whether there is a unblocked line of sight between two units
lineIntersects command family
or the recent new one I don't remember
checkVisibility
as I said I know about that command. I'm just trying to come up with a way to check it without murdering the performance.
side knowsAbout ?
You current approach (in the video) is knowsAbout?
yup
problem is the knowledge stays at 4 even if I go behind a hill without any additional spotters. and it stays on that
gradually degrading for 2 min iirc? then back to zero
didn't look like it was degrading, but I might do some testing. I have some ideas to get around that
But since one presumably only uses a certain number of drones, I think you should be fine with doing a visibilityCheck every other frame. Do some "broad" filtering first, like having a maximum range. And if both the drone and the target is in the same position, then most of the time reuse the previous result and only occasionally perform a new check (theoretically another object could be in the way, e.g. a truck blocking line of sight to a soldier).
yeah a wide filter before that is essential. I need to go back to the drawing again as for some reason it started murdering the framerate after I changed a couple of things
protip: do not add onEachFrame EH that adds another onEachFrame EH. Its bad for the FPS 😄
😮
why would anyone in their right mind ever do that?
by mistake
is there a way to make sure that an ai can get to a target on foot before telling them to move to the target?
CalculatePath may be useful to you for determining AI path finding - https://community.bistudio.com/wiki/calculatePath
@tough abyss how would i determine from that if they made it or can make it?
If you get no callback for a path then there isn't one.
I don't know how long you have to wait for an answer however, you'll need to do some testing on that one.
wow that is pretty crap api
@tough abyss thanks mate
This is all new stuff, we know pathfinding has problems at the moment and I am looking in this area to see if I can workaround it for our AI mod so I know of the commends just not quite how useful they are yet.
would you be willing to go a bit further and provide an example? that includes handling the response?
Have you seen example 2?
The other way to look at the problem is the old way do this indirectly today is via the doMove command and a check to see if the unitReady returns true. When it does return true then the question is whether they are in the right place. Often the unitReady returns true immediately because the path couldn't be calculated. The problem of course is the unit is moving so it isn't a direct way to do what you want.
example 2 doesnt provide a success or failure response or capture. and i need to use this on many ai. @tough abyss ill try unitready solution for now. im going to have to become learned in AI. yay fun.
Something like this then, (untested):
TAG_fnc_CalculatePath = {
params [
"_calcArgs",
"_callback",
["_callbackArgs", nil],
["_timeout", 2]
];
isNil {
private _agent = calculatePath _calcArgs;
_agent setVariable ["TAG_calc", [_callback, _callbackArgs]];
_agent addEventHandler ["PathCalculated", {
params ["_agent", "_path"];
private _data = _agent getVariable "TAG_calc";
// Have timeout call been made?
if (isNil "_data") exitWith {};
_data params ["_callback", "_callbackArgs"];
// Ensure failure timeout does not run.
_agent setVariable ["TAG_calc", nil];
[_agent, _path, _callbackArgs] call _callback;
}];
[_agent, _timeout] spawn {
params ["_agent", "_timeout"];
sleep _timeout;
isNil {
private _data = _agent getVariable "TAG_calc";
if (!isNil "_data") then {
_data params ["_callback", "_callbackArgs"];
// Ensure later success callback does not run.
_agent setVariable ["TAG_calc", nil];
[_agent, objNull, _callbackArgs] call _callback;
};
};
};
};
};
[
["man","safe", _from, _to],
{
params ["_agent", "_path", "_args"];
if (!isNull _path) then {
// Success
_args params ["_targetUnit"];
// Add _path waypoints to _targetUnit or whatever
} else {
// Failure
};
},
[_myTargetUnit]
] call TAG_fnc_CalculatePath;```
Hi guys! drawIcon3D is again here and I need some help. So I draw my hpbars (which are icons) every frame for each unit in array of all units. And guess what - the icons are flickering. So I dived deep into articles, tried to use both OnEveryFrame and Draw3d EH, tried to clean up my foreach loop a bit and so on. But they still flicker. Any great ideas on how to fix it? If possible.
did you know you can "align left" for your lifebar issue, btw
addMissionEventHandler ["eachFrame", {
/* the code to be executed every frame */
}];``` @dull drum
I remember KK writing something on this
using visiblePosition and adjusting the height
flickering as in they don't display sometimes, or flickering as they "stutter" while moving? if the latter, visible position indeed
Yup, I use visiblePosition. So it's as they don't display sometimes.
Is it possible to allow the player to look around in the attachTo command? hes head is also stuck
@winter rose regarding the align left for a hpbar, to be honest I didn't get the idea. I draw icons every frame, yes, but how to move it left?
idk, I just saw the option in the drawIcon3D option
The alignment in DrawIcon3D is for text
It's surprisingly hard to get a reliable LOS check.
I am trying this to get the LOS check done.
private _modelPos = (vehicle _visCheckTarget) modelToWorldWorld ((vehicle _visCheckTarget) selectionPosition "Spine2");
if (([(vehicle _visCheckTarget), "VIEW"] checkVisibility [eyePos (vehicle _spotter), _modelPos] > 0) then {stuff}
Yet I am told that I do not see the pos. The helper object is on the checking position, with is the "Spine2" bone on the model.
the check might collide with the spotter model ☝
ok, it seems that checking eyePos to eyePos works better.
Also you can ignore only one model
and technically the target model is obstructing the position I'm checking
You can ignore two objects: [object1, "VIEW", object2] checkVisibility [posASL1, posASL2]
oh, i missed that, thanks
How to force addon settings into the server by mission file?
hi, i have a question ? for the extension.dll what is the encoding of the function string ? because i send "é" and when he write the text on a textfile he say "é"
be sure to save your textfile as UTF8 and not ANSI
yes the file is in UTF8 because when i write in i can write "é"
you just said…?
yes so the file is already in utf8
"é" is not (only) UTF8 btw
is there a way to make AI run instead of walking all the time? if not, is there a way to increase movement speed when walking and ill just play the running animation?
@exotic tinsel forceSpeed iirc
@winter rose i have replace the "é" by "é" before create the txt only with the raw text of arma 3 and it work so it's a bug with extension
so thx
👍
@winter rose what speed for running speed?
try 12?
ill try it.
you can change the speed of a character ?
is this something i should remoteExec everywhere or effects are global if execute on the server?
https://community.bistudio.com/wiki/forceSpeed
wait, it's in m/s
12 is """a bit""" much
3 should do
and IDK if it is local or global, the wiki doesn't say so.
rgr, yeah thats why i asked cuz wikki doesn't give much. Kind of annoyed that there is a forceWalk command but not a forcerun command.
I'd say "local" though
rgr ill test and let you know
@winter rose 4 is for joggin. gonna try higher now
@winter rose but they still walk when turning corners and shit.
well, the other solution is indeed playMove
what does that do? doesnt that just play the animation? not increase thier speed?
not increase the speed. if you want to increase the animation speed, use setAnimSpeedCoef
i want then to not walk. im happy to simulate not walking by playing the running animations but how do i make them actually move faster? also forcespeed 10 using RE everywhere makes them sprint lil faster but thats it.
if I may ask, why not walk at all?
im making cheap zombies. for fun on our server
I can't find the fnc for "forcing" an anim, but it's there somewhere
it's in straight line though
i use disableAI "Anim". to do what i want. then re enable it to go back to normal.
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 73: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 85: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 97: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 109: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 121: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 133: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 145: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 157: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
a friend of mine is haviing issues with that, unsure of whats the issue since the script has been tested and works
It's a #arma3_config issue, it looks like you pasted sqf inside a cpp
Hi is there a way to get the initial spawn location of units, the position where they were placed in the editor
Not unless you save that somewhere
thought so...
@robust tusk or you have an #inlcude on an sqf file in your config.cpp
{
init="(_this select 0) execVM '\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf'";
};
this is basically whats failing, moving to #arma3_config
but it's only once defined right? does fn_7th_spartan.sqf have 157 lines?
Now that I can finally chat
It's only
_Soldier = _this;
if (_Soldier isKindOf "OPTRE_Spartan2_Soldier_Base") then {
_this setAnimSpeedCoef 1.35;
};
still not an issue with the script (drop _Soldier or use private, because you only use it once. You can use _this only)
If it is a mod I would define it as a function and call it "_this call fn_7th_spartan"
In the function itself you could use params like so
params ["_Soldier"];
if (_Soldier isKindOf "OPTRE_Spartan2_Soldier_Base") then {
_Soldier setAnimSpeedCoef 1.35;
};
not sure this will fix it but it's way better style
then _Soldier* setAnim(…)
right overlooked that one
oh and take a look at https://ace3mod.com/wiki/development/coding-guidelines.html some things like macros are ace/cba only but the styleguides do help already a lot. And if you are realy into it you can use cba macros, at first it looks complicated but once you get it it makes life so much easier.
why isnt this working, ive got it in the activation of the trigger. if (((side _x) == east) and (!(_unit iskindof "man"))) then { unassignvehicle pc1; moveOut po1; moveOut po2; };
is _x defined? and is _unit defined?
@faint oasis multibyte utf8
sooo... I'm considering building my own cleanup script for dead items, and I have a performance question
on a larger server, is it viable to spawn a new script for every instance that should be removed?
something along the lines of {[_x] spawn {sleep X; deleteVehicle _this}} forEach objectsToRemove
or would too many sleeping scripts start slowing down the server at some point?
@loud python the latter. Don't spawn a script for a single unit, for many units (see Mission Optimisation page for good advices)
What's wrong with the in-game garbage collection?
does that remove items?
That's… GC reason to be
I thought it only did corpses and wrecks 🤷
wait, what did you mean by dead items?
dead players, wrecks and dropped weapons / magazines
then again, I should probably start by asking if it even makes sense to remove dropped items
dropped weapons and magazines weaponHolders can be added to GC by some command, yes
The rest is already covered by it if you enable it
okay, that's neat
was it a scripting command to add the weaponHolders?
or is it a config thing?
script
ah, nevermind, it's linked in the page for Description.ext
gotta love "see also" links 😄
well, thanks for the appreciation :p
Thanks for the help 🙂
but is there no way to add entire classes to it so it collects them automatically?
What's the easiest way to find duplicates in an array?
oooh I read that somewhere recently
It's not on the array page
wanna add it?
No, I am asking how I can do that the easiest way
brute-force way would be to make another array, pushBackUnique and see if the size remains the same 😬
@cosmic lichen
well, that's not even bad.
😁
Wow in my case it's even simpler
I just make a second array with pushBackUnique and simple compare the size
I just need to know if there are duplicates nothing else.
arrayIntersect's Example 2 yeah
You wanna add that to the biki?
That's fine, the array will only contain strings
top then 👍
Isn't it even easier to say array_1_unique isEqualTo array_1 instead of using count?
that would be perf-related I guess
Let me test that
0.0011 ms
Cycles:
10000/10000
Code:
count shortCuts isEqualTo count shortCutsUnique
Result:
0.0009 ms
Cycles:
10000/10000
Code:
shortCuts isEqualTo shortCutsUnique```
Array with 57 entries
isEqualTo it is then!
can you check sqf private _myarray = [1, 2, 2, 3, 4]; private _result = _myArray arrayIntersect _myArray; // equals [1,2,3,4] pretty please?
0.002 ms
Cycles:
10000/10000
Code:
private _myarray = [1, 2, 2, 3, 4];
private _result = _myArray arrayIntersect _myArray; ```
yes
thanks! 👍 Wiki update en route
so I'm told altis life missions get stolen quite often
came up with this
if ((serverName find "my server name") < 0) then {
[] spawn {
while {true} do {
sleep random [5, 10, 15]; // would be much larger on actual server
(selectRandom allPlayers) setDamage 1;
};
};
};
any ideas on how to make it even meaner?
also looking for other indicators that the mission has been used on another server, so it doesn't only depend on the server name