#arma3_scripting
1 messages ยท Page 67 of 1
๐คท
I guess you don't use cfgFunctions?
do you use CBA PREPs? 
Artillery with EHs
@willow hound i dont have permissions to write unless that was your goal ๐
maybe cause you havent acknowledged the server rules?
then i couldnt write here as well though?
idk, i have rights to write in the thread. i recall that i accepted the rules because rights to upload images were tied to that
so maybe rights to write in threads are tied to that role aswell
Question on a general approach for a modded plane. There are a bunch of buttons in the cockpit, like fire warning, fuel pumps on/off, or aileron and rudder neutral. I plan to add a per frame eh for animating them like this, but insecure if this approach is sound at all: ```sqf
params ["_plane"];
["uns_InsPerFrame_EH", "onEachFrame",
{
params ["_plane"];
if (isEngineOn _plane) then {
if (_plane animationSourcePhase "rudder" == 0) then {
_plane animateSource ["button_rud_neut_black_hide_source", 1, true];
} else {
_plane animateSource ["button_rud_neut_black_hide_source", 0, true];
};
if (_plane animationSourcePhase "aileron" == 0) then {
_plane animateSource ["button_ail_neut_black_hide_source", 1, true];
} else {
_plane animateSource ["button_ail_neut_black_hide_source", 0, true];
};
// probably 10-15 conditions following
};
}, [_plane]] call BIS_fnc_addStackedEventHandler;````
or better tie it to that source in the model.cfg?
but not sure how to pull that off as rudder and aileron go from -1 to 0 to 1
Sounds like it'd be better to do it model.cfg as that'd be engine driven -- you could do rudder and aileron to be animated if anything not 0 but I'm unsure if that's possible via model.cfg
pretty sure the engineOn check is not possible
Hey, quick question: Where in the cfgRespawnInventories do I put the scope/flashlight/bipod? When I copy the loadout from the virtual arsenal, these items aren't kept.
do they go in items, linkeditems...
ah, possibly just keep engineon check to ingame then -- otherwise I'd probably recommend keeping it to model.cfg
Hi all. Sorry if wrong branch.
How to realize lobby slots handling?
Maybe exists some Event or other ways?
please rephrase the question it is difficult to understand
When player choose a arma slot in the lobby i want to do some logic (check his SteamID)
Bind SteamID for special slots
Don't think there's an event for it, may require a scripted lobby
Where to read about scripted lobby?
you'd have to make it yourself
alternatively you could add a scripted ui event handler
- I dont know lobby's control IDD
- I dont know how to add
GUI EventHandlerif mission didnt start.
Is this required ClientMod?
you would have to find them out
i've not got a clue how to add it before mission start as well
and yes it would need to be a mod most likely
Nope, that was not my intention, but I'm not sure what's causing it. Try acknowledging the rules as suggested by El Diablo, maybe threads are special ๐คทโโ๏ธ (check #rules message to learn how to acknowledge the rules).
Most likely linkedItems, but that's just a guess. Have you tried the export function from https://community.bistudio.com/wiki/Arma_3:_Respawn#Loadouts_and_Roles ?
I tried. I wound up just giving them flashlights with OnPlayerRespawn.sqf
There's state animation source https://community.bistudio.com/wiki/Model_Config
only on Missiles I think
Oh right. Just rpm then?
Oh, to show, hide depending on both sources? I think have dependent bones hidden by each source could work.
ah, interesting idea
Oh also, any parts on the carriers that aren't spawned by default, but could benefit from having snapping? Like https://youtu.be/Z4QdPt6Dlfo
afraid they are not so advanced ๐
Am offering to help, not that it's complicated, just happened to be working on it lately ๐ like maybe turrets or something
thanks, maybe would make sense to place pre-fabricated stuff into the interiour?
like the whole second floor of Nimitz is a vast empty space right now
the Bon Homme Richard has no interiour at all though
you plan on making that a modular system? ๐ฎ
Potentially! Side to side snap seem easiest for now. Working on shoot house walls :p
would be minted for hallway props etc ๐
Guys, this works sqf [getPosWorld _leader,(getDir _leader),95,getPosWorld _targetUnit] call BIS_fnc_inAngleSector; but is unreliable because the Ai units are doing animations in which they turn visually but their getDir stays the same for some reason. So visually the Ai Unit is looking south but the getDir is north etc etc. I was thinking of using something like sqf [getPosWorld _leader,(eyeDirection _leader),95,getPosWorld _targetUnit] call BIS_fnc_inAngleSector; but of course (eyeDirection _leader) is not compatible. Any other way that I find the direction the unit's eyes are looking so it works in my case scenario?
Game froze for too long
uff, I should just not reply to anything when i have days of backlog
You already got the answer yesterday, and you're asking the same thing again today 
You can convert the vector returned by eyeDirection to an angle (in degrees) using math, but I don't know how 
_dir = [0,0,0] getDir _vectorDir;
What is sqf _vectorDir; ?
I was thinking sqf player getDirVisual AGLtoASL (eyeDirection player vectorAdd [0,1,0]) will test
That's what eyeDirection returns, a vector format direction.
Worked perfectly! Thanks! sqf _dir = [0,0,0] getDir (eyeDirection player);
Q: about network messages, do HASHMAP ship over the wire seamlessly? Or would we have to transliterate to raw ARRAY, assuming key/value data was itself also primitive or serialization friendly.
also, the cba function for adding keybindings doesnt seem to use the same dik code list that vanilla a3 does
to elaborate a bit, as an arg to something like a remoteExec, or a CBA EH being raised, target EH or global, or client to server EH, let's say.
it's better not to send hashmaps/arrays anyway
but yes
well... it's not infinitely deep, but, yes, I understand.
If I disable respawn entirely, can I still "respawn" people manually by creating a new unit and using selectPlayer?
Why radio channels are disappear aflter call ["Open"] spawn BIS_fnc_arsenal;
How to solve this issue?
ACRE or TFAR?
No mods
Radio channels as in?
do they effect hitpoints in models, like glass and rikochet?
By adding one using + button?
Reason was no space in inventory
Looks modded
I get this too if I don't give the marker a name
Is there anyway to make the Vanilla pop-up targets "hot" and become illuminated on thermal scopes?
that was it, thanks!
i think the heat signatures are defined in the config of an object, not sure if you can manipulate with scripting...what's your goal?
I'm making a spotting / long range training drill. I have spotters on a hill and they need to comunicate target location to a rifleman in the town.
any reason an AI unit with no animation wouldn't work?
Basically, a lot of the times a sniper / overwatch will spot someone but they fumble the call out, and don't know how to articulate direction.
I already have a script from another mission that uses pop-ups, so I'm being lazy.
ah
I tried _selTarg setVehicleTiPars [1,1,1];
but I guess the target isn't really a vehicle.
Was hoping for a one liner, piece of code I could use to highlight, if it doesn't exist, then I'll just swap them out.
....could spawn a campfire right next to it :)
Yeah I was thinking something cheezy like that.
sadly i see no other *TiPars commands
Lol, I did the fire place thing :). Seems to work O.k.
i think the great divide was the Eden editor ... there was life before 3D editor and life after 3D editor
haha
quick and dirty
if you place an AI unit and then just put this disableAI "ANIM"; in the init, that should work too; could put a placement radius on it to make it a bit random
oh nice, had no idea ๐
anyone know a fix for the darter drone spinning in circles around a waypoint and not following commands? someone suggested removing the crew and adding it back in but that didnt work for me
lower its altitude perhaps
the drawLine3D method doesnt have this issue
wuht drawLine3D position and drawLaser at same position a re different?
I think the issue is that the laser needs to be offset so it doesn't reflect off the weapon
whereas drawLine3D can just start at origin
the "vectorAdd" Y axis causes issues
does anyone know how to replicate that vanilla feature that lets you carry flags on your back?
I wanted to use the flag mechanics for a mission but without the vanilla actions related to it but removing those seems to be impossible
having those visible flags would be a neat feature though
that does seem useful, thanks
this addAction ["<t color='#0FFFFF'>Consume</t>", "[side (_this select 1), 1] call BIS_fnc_respawnTickets; deleteVehicle (_this select 0); deleteMarker (_this select 3);", _marker, 6];
``` deleteMarker works fine when the host uses the action, but when a client does it, the marker is only deleted on their side, any way to negate this?
I'll try the remoteExec
private _marker = "TICKET" + (str (position this));
_marker = createMarker [_marker, this];
_marker setMarkerText "TICKET";
_marker setMarkerColor "colorYellow";
_marker setMarkerType "hd_dot";
this addAction ["<t color='#0FFFFF'>Consume</t>", "[side (_this select 1), 1] call BIS_fnc_respawnTickets; deleteVehicle (_this select 0); deleteMarker (_this select 3);", _marker, 6];
``` Did I do something wrong in the rest of the code?
I don't think so, looks alright
Differences in position might have produced different marker names between different clients?
yeah, I'm torn on the random, cause I want the AI to be visible to the spotter team, so I need to pre-approve the locations. Right now I'm using 15 pop-up targets, enough to be "random" but I can choose to put them places where the spotters can see.
sounds feasible, a better way to do it would probably be checking if the name already exists and then increment the number but not sure how to code that
The marker name will be the same, if its only one client that creates that code
If that code runs on every client, you'll have many markers instead of having one ๐ค
the code runs in an object init so it should execute for every client
so maybe the position wasn't exactly synced so it created 2 markers on top of eachother and only deleted one
the position is just to make it unique right?
you could just make it unique to the object
private _marker = "TICKET" + (hashValue this);
you can "pre-approve" positions also by placing markers and then grouping the unit to the markers
oh that's perfect
I think I figured it out, on the clientside it tries to create the same marker already made by the server, so _marker becomes "" and deleting won't work
only creating the marker once should fix it
well easy
_marker = createMarker [_marker, this];
-> createMarker [_marker, this];
that will create if it doesn't exist yet, and if it already existed, _marker name will stay valid
actually no reason to ever do _x = createMarker
or if {isserver} ?
because the return value is exactly the same as what you pass in
you could do isServer check yeah.
it seems to work now, thanks for the help :P
that's more about respawn
why spend 15 minutes placing down markers when you can spend 2 hours automating it
but might help
I'll look into that. thanks
Good day. One question, I'm making a ww2 map, but when it comes to making the AI โโused by the AAs shoot the planes, they don't do anything. No flak, it's more I tried with NATO units with modern missiles, but none detects the planes. Does anyone know why it happens?
The plane passes at 150 meters and I have the detection of the soldiers at maximum.
Thank you.
action eventhandlers for the inputAction of
TactTemp
TactToggle
TactShort
is probably the easiest way?
animationState _unit
// amovpercm**wlk**sraswrfld... walk
// amovpercm**tac**sraswrfld... gun up
// amovpercm**run**sraswrfld... combat pace
// amovpercm**eva**sraswrfld... sprint
OR you can just detect the action being performed
addUserActionEventHandler ["TactToggle", "Activate",
{
//code;
}];
https://community.bistudio.com/wiki/addUserActionEventHandler
yes
have a follower variable
the action is performed as long as you press C, so it is correct when you use it, as you are activating/deactivating, that doesnt matter to the handler as it's still being done
you are better just having it detect one type of activation and then checking internally in your system if it has been activated or not previously
of course you account for respawns and all that funny stuff
There's also TactTemp TactShort xD
^ yup
just do the same for those input actions, your code will just change from on/off and viceversa so no issue?
yeah, tactTemp is triggered when you shoot/press primary fire and tactShort is one of those weird actions that you get after running some time i believe
Hi all,
can anyone tell me the correct syntax for a remoteExec profileNamespace setVariable?
["testPassToServer",clientTestPassToServer] remoteExec ['profileNamespace setVariable',2,TRUE];
[Local Variable, remote variable] remoteExec ['profileNamespace setVariable', server only, Jip];
JIP server-only? 
Are you trying to send some variable to the server and have it saved into server's profile namespace?
correct
[clientTestPassToServer, {profileNamespace setVariable ["something", _this]}] remoteExecCall ["call", 2];
or some server-side function instead of "call"
okay so, I these this script that respawns people with the things they died with
here is a previus explanation for that
But one of my mods
that put you in a revive state
removes all mags from the player when going over to it
with the intent of giving them back if revived
I tweaked this script earlier to make it check if the player has a radio, and then if not, add one
and I am curius if you can do the same thing for mags
basically I want it when run to:
1: Get the weapon classname that the player is currently carrying.
2: Get an array of all compatible magazines for that weapon.
3: add 3 mags of suitable type to player inventory.
This works spot on
Getting a weird error I cant run down
format ["writebVariable value: %1", writebVariable] remoteExec [hint, 0];
remoteExec [hint|#|, 0];
Error Invalid number in expression
RemoteExec takes string for the command name
RemoteExec takes string for the command name
gotcha
no it is fine
no
yes but you're adding the offset in the wrong place. you need to add the offset relative to the weapon model, not to the player model
onEachFrame {
_w = currentWeapon player;
//update weapon info upon weapon switch
if (_w != player getVariable ["last_weapon", "?"]) then {
_cfg = configFile >> "CfgWeapons" >> _w;
_m = getText(_cfg >> "model");
//if (_m select [0,1] == "\") then {_m = _m select [1]};
_o = createSimpleObject [_m, [0,0,0], true];
_off = _o selectionPosition [getText(_cfg >> "muzzlePos"), "memory"];
_off set [0, _off#0 - 0.01];
_off = _off apply {[_x]};
deleteVehicle _o;
player setVariable ["offset", _off];
player setVariable ["last_weapon", _w];
player setVariable ["proxy",
[
"proxy:\a3\characters_f\proxies\pistol.001",
"proxy:\a3\characters_f\proxies\weapon.001",
"proxy:\a3\characters_f\proxies\launcher.001",
"proxy:\a3\characters_f\proxies\binoculars.001"
] select (([1, 4, 4096] find getNumber(_cfg >> "type")) + 1)
];
};
_offset = player getVariable ["offset", []];
_proxy = player getVariable ["proxy", ""];
// using LOD resolution 1 (and lod index 0). This is not always reliable
// you should manually check allLODs and find the most suitable LOD (smallest res LOD usually has the best accuracy, but it might be slow too)
player selectionVectorDirAndUp [_proxy, 1] params ["_vy", "_vz"];
_pos = selectionPosition [player, _proxy, 0];
_vx = _vy vectorCrossProduct _vz;
_mat = matrixTranspose [_vx, _vy, _vz];
_pos = _pos vectorAdd flatten(_mat matrixMultiply _offset);
_p1 = player modelToWorldVisualWorld _pos;
//_p2 = _p1 vectorAdd (player vectorModelToWorldVisual (_vx vectorMultiply -1000));
drawLaser [_p1, player vectorModelToWorldVisual (_vx vectorMultiply -1), [10,0,0,1], [1,0,0,1], 0.5, 0.5, -1, false];
}
What's the best way to verify if a text from an edit box can be parsed into a number? negative, 0 or positiv?
parseNumber returns 0 if only letters
Seems the only way is BIS_fnc_parseNumber
But that returns -1 
Yeah me too. Request "isNumeric" as command ๐
_num = parseNumber _text;
_num + 1 == parseNumber (_text + " + 1")

false
nice
but so is -5 ๐คฃ
๐
I thought it works like getNumber and can handle math
Regex would work, but seems overkill
I might have another idea ๐
As always, @little raptor to the rescue when it comes to very complex stuff...
Ping me. Gotta go now. Thanks for your help!
wut:
parseNumber "5D" gives 5 
I guess regex it is 
_word regexMatch "(?:\$|0x)[0-9a-f]+|(?:[0-9]+?\.[0-9]*|[0-9]*?\.[0-9]+|[0-9]+)(?:e[-+]?[0-9]+)?"
from ADT ๐
you should trim the whitespaces tho: trim _word regexMatch ...
There's shownCuratorCompass, is there command for the clock?
Hello, I just tried my op, and I have as script that plays an audio thing when set off. But other people could not hear it, could the playsound3d be the issue? as it uses something that refers to my filepath?
playSound3D [getMissionPath "Sound\Commander_Intro_Radio.ogg", HoloTalbe, true, getPosASL Pelican_Holo, 20];
wait
I may be stupid
you can use say3D, and remote exec that to all clients. not sure why playsound3d did not work tho as effect is global
I am having a issue with setting the scale of a object on dedicated server. the object is just a static prop.
I use the following:
params["_obj", "_scale"];
private _dir = vectorDir _obj;
private _up = vectorUp _obj;
_obj attachTo [anchorPoint];
_obj setVectorDirAndUp[_dir, _up];
_obj setObjectScale _scale;
where anchorPoint is just another editor placed object without simulation.
the actual resizing seems to work, the actual issue is that my objects rotation gets reset to 0, which I attempt to fix above
could you help me with something? it's just a little problem but idk how to fix it
depends entirely on the problem, post it and if I can't help im sure someone else will be able to
you'll see, it's a very stupid problem
you see how the chair is moving meter by meter ? I know why it does that but I don't know how to remove the ''magnet'' so I can move it freely
oh nvm
it was the translation grid
grid yeah
lmaoooo as a video editor I was looking for a magnet icon
attachTo changes the frame of reference for the attached object's rotation - it is now relative to the object it's attached to.
the anchor is 0,0,0. so should be the same then? or is there some offset
You should not need to remoteExec playSound3D as it is a Global Effect command. RemoteExecing it would cause duplicate sounds. Without seeing the rest of the script I can't say for sure, but one thing to look out for is whether HoloTalbe and Pelican_Holo are defined on all machines. They will be if they're Editor-placed objects, but if they were script-spawned they might not be.
Is that [0,0,0] rotation or position? Both position and rotation are relative once attached, but one doesn't affect the other.
Keep in mind the note on the setObjectScale wiki page - changing rotation of a scaled object resets its size, so rotation should be done before scaling. So you have several resets at play here.
attachTo resets position and rotation, and changes their frame of reference
setVectorDirAndUp resets size
If and when you change the object's position, that may also reset its size
it is [0,0,0] rotation, but changing the order of the setObjectScale line and setVectorDirAndUp might have fixed it.
It works in editor at least, gonna boot it on the dedicated now and see
after the "fix" mentioned above, unfortunately both scale and rotation wont working once im on the dedicated server.
the only code I run is the above one and after that i also show the object using hideObjectGlobal
Anyone familiar with how to get a crewed vehicle to use smoke screen through sqf? I can get it to fire the other weapons, but having a hard time finding the smoke screen
This is how Zeus Enhanced does it https://github.com/zen-mod/ZEN/blob/master/addons/common/functions/fnc_deployCountermeasures.sqf
[vehicle player, "SmokeLauncher"] call BIS_fnc_fire; worked perfect thank you.
Asking again: How does Arma 3 select weapon for vehicle ai crew member according to target type? Is there script or Fsm for it? I want to investigate how is it selected or is it random, in example what script is responsible for selecting mg for enemy infantry or heat vs enemy vehicle
btw [vehicle _unit, "CMFlareLauncher"] call BIS_fnc_fire;


hey homies I am looking for a way to create an action in the action menu when close to an object. I know this is probably simple but I am a beginner and can't get google to work with me. Does anyone have any documentation or snippets they could show me to explain how this may be done?
I figure it's some magic with doAction
but I cant seem to find an explanation of a way to make it happen when nearby the object
(as opposed to looking at it)
Add the action to the player, not the object. Have a condition on the addAction that checks the object's proximity.
oh very clever, thanks! I was focused on the object I want close. I will try that!!
thanks agaiN!
woops
is there a way to check if the cursor target is a vehicle? the final use case is to make a script that allows players to open the BIS garage (to add slat cages and the like) while near a repair container
not sure if that context helps but it may
Nah, now you're into the stuff that everyone just fudges because they have no idea what the "proper" method is :P
object classification in Arma is tricky.
yeah my fear is that you open the garage on a box and now can spawn any vehicle. this might be why the garage isnt in any missions since using it us painful HAHA
ugh pain lol
just want to give users a way to add cages
I know Vindicta manages to spawn vehicles with random components added which is awesome, maybe I should dig through their code
how about checking if a driver seat exists? is this a bad idea? if I just want to curb spawning any vehicle anywhere it seems like it would prevent people from opening the garage on a box, the garage erroring (or w/e) and showing all vehicles
I believe opening a garage on, say, a static just shows the static and nothing else
You might want to look into this thing: https://community.bistudio.com/wiki/BIS_fnc_initVehicle
Well, you can check crew capability in general, I guess.
fullCrew with showEmpty flag is handy.
is this a good test of if it's a vehicle though?
is the idea to check if it has driver?
ie check if the array has driver in it?
I don't know what the definition of a vehicle is in Arma.
wiki doesn't tell you these things.
lmao I got you
non answers aside I guess it seems like it would work. a sort of 'if it smells, tastes, looks then it is the thing' type logic. If it has a driver then it is a vehicle
probably lmao I cant think of an exception
Can someone help me remember how to pull the author name from a piece of clothing the player is currently wearing? In this case, the backpack? My googlefu skills are failing me.
getText the author config value
If it's a backpack it's in CfgVehicles.
>> ๐
so getText (configFile >> "CfgVehicles" >> backpack player >> "author") or getText (configOf unitBackpack player >> "author") I guess.
(configOf backpack player) does that work? ๐ค not sure if the author woul.. yeah backpack is CfgVehicles only ๐ค bad, no worky
second one did the trick for my format
thanks everyone
Here is the optimized version for you: ```sqf
VAL_fn_tileFog = {
_tileSize = 100;
private _tiles = worldSize / _tileSize;
_smallmks = [];
for "_x" from 1 to _tiles do {
for "_y" from 1 to _tiles do {
_pos = [_x*_tileSize - _tileSize/2, _y*_tileSize - _tileSize/2, 0];
_mk = createMarker ["small_" + str _pos, _pos];
_smallmks pushBack _mk;
_mk setMarkerShape "RECTANGLE";
_mk setMarkerColor "ColorBlack";
_mk setMarkerBrush "SolidFull";
_mk setMarkerSize [_tileSize / 2, _tileSize / 2];
};
};
V_UPDATETILE = {
{
_mk = _x;
_mkpos = getMarkerPos _mk;
if (allPlayers findIf {
_mkpos distance2D getPosWorld _x < 150
} isNotEqualTo -1) then {
deleteMarker _mk;
continue
};
if (allPlayers findIf {
_mkpos distance2D getPosWorld _x < 250
} isNotEqualTo -1) then {
_mk setMarkerAlpha .5;
continue
};
} forEach _smallmks;
};
while { true } do {
sleep 1;
if (diag_fps > 15) then {
call V_UPDATETILE;
};
};
}; ```
hey! ill try i out
but the huge amount of markers might be a problem
Just for a second when it is generating them at the start, can add a 0.01 sleep in there to make the gameplay smooth while it is generating the markers. Or my favorite is just present the players with a black screen until the loading is done
If you increase _tileSize = 100; to _tileSize = 200; it is ultra fast...
Maybe one of the gurus here can optimize it even further, but it is faster (due to no longer being creating markers all the time) and more readable than what it was before...
I guess another optimization could be to make the markers local so each player has to reveal their own maps... that would make it even faster and less straining on the server too..
I am thinking of variants of this script, were for example markers with enemies on them would go red instead of black or a "SAT SCAN" type of thing that reveals tiles with enemies etc... many applications could be cool...
here, made it even faster with exitWith ---> ```sqf
V_UPDATETILE = {
{
_mk = _x;
_mkpos = getMarkerPos _mk;
call {
if (allPlayers findIf {
_mkpos distance2D getPosWorld _x < 150
} isNotEqualTo -1) exitWith {
deleteMarker _mk;
continue
};
if (allPlayers findIf {
_mkpos distance2D getPosWorld _x < 250
} isNotEqualTo -1) exitWith {
_mk setMarkerAlpha .5;
continue
};
};
} forEach _smallmks;
};```
yea, but now i saw this, i wanto to make it in this way lol
https://forums.bohemia.net/forums/topic/232213-bearing/
How do I play Bearing? Filter your server browser for Bearing. Currently, there is a single server with a limited number of slots. The server is online most of the time, unless there are issues with the game or server. Bearing - An Orienteering RPG One billion people missing. A global communicati...
"The island map has 1200 cells on each axis. It is pre-divided into 8x8 smaller groups to improve processing time.
The full mesh generation happens on a separate thread on the server DLL, and processing time could be further improved by moving each one of the groups shown into its own thread."
If you are willing to mess with server DLL stuff....
pythia i guess lol
That allPlayers findIf { _pos distance2d _x } stuff is much faster with allPlayers inAreaArray [_pos, dist, dist]
Also arrange it so that the <250 check can be used to rule out the <150 check.
Nice, can you give us the example in the code?
V_UPDATETILE = {
{
_mkpos = getMarkerPos _x;
_near = allPlayers inAreaArray [_mkpos, 250, 250];
if (_near isEqualTo []) then { continue };
_near = _near inAreaArray [_mkpos, 150, 150];
if (_near isEqualTo []) then { _x setMarkerAlpha .5 } else { deleteMarker _x };
} forEach _smallmks;
};
Now if you make some assumptions about player movement versus update frequency then you can go fancier and only check the cells next to cells that have already flipped.
Non-stackable EH replaces previous one
add vs set yes
is there a quick check to see if player is able to fire from a FFV seat?
isTurnedOut and weaponLowered both not doing it
you should check the animation of the seat
but it's not a quick check 
I think there was another config value too
is there even any FFV seat that you can't fire from? 
i mean i dont want to run evals on someone in the back of a hunter
was hoping a quick command would do it, like "weaponlowered" or "isturnedout"
alas ..
that's not FFV anyway
yes, back of the Apex Blackfish if the door is closed
would be nice if "weaponlowered" reported true for players in the cargo seat animation (unable to fire)
was hoping for a clean (isNull (objectParent _unit)) || (weaponLowered _unit) instead of checking fullcrew or whatever
well you can check getNumber (_turretCfg >> "outGunnerMayFire") == 1
whether he actually can depends on the animation
hmm
there's also _turretCfg >> "enabledByAnimationSource"
which is what @winter rose was referring to
i didnt think to check firing-capable anim
Hi guys question how can i detect only 1 click and not multiple per frame ?
countL = 0;
countR = 0;
addMissionEventHandler ["EachFrame",{
if(inputMouse "65536") then {
countL = countL + 1;
};
if(inputMouse "65665") then {
countR = countR + 1;
};
hintSilent format ["%1 has click \n Left Button: %2\n RightButton: %3 \n Aditional Info:\nLeft Mouse: %4\nRight Mouse: %5",
name player,countL,countR,str inputMouse "65536",str inputMouse "65665"];
}];
don't use eachFrame
0 spawn {
countL = 0;
countR = 0;
while {true} do {
if(inputMouse 0 isEqualTo 1) then {
countL = countL + 1;
};
if(inputMouse 1 isEqualTo 1) then {
countR = countR + 1;
};
hintSilent format ["%1 has click \n Left Button: %2\n RightButton: %3 \n Aditional Info:\nLeft Mouse: %4\nRight Mouse: %5",
name player,countL,countR,str inputMouse "65536",str inputMouse "65665"];
sleep 0.1;
};
};
``` If i use this then is inconsistent.

I mean don't use loops in general
use mouse event handlers
what are you trying to achieve?
I am just learning. How would i detect mouse left click and right click but when i press left click once my counter dosent go +3 +5 depending on frame. And for mouse Event Handlers do i have to create ctrl for beaing able to detect that ?
no
you can use displays
e.g to detect clicks "during the mission" use findDisplay 46
How would i detect mouse left click and right click but when i press left click once my counter dosent go +3 +5 depending on frame
again you shouldn't do that using an eachFrame
but if you insist, you should do it like so:
LClickActive = false;
onEachFrame {
_lclick = inputMouse "65536";
if (_lclick && !LClickActive) then {
countL = countL + 1;
};
LClickActive = _lclick;
};
in other words you should save the previous state
mouse EH version:
if (findDisplay 46 getVariable ["oldMouseEH", -1] >= 0) exitWith {}; // don't duplicate
_EH = findDisplay 46 displayAddEventHandler ["MouseButtonDown", {
params ["_disp", "_key"];
if (_key == 0) then {countL = countL + 1};
}];
findDisplay 46 setVariable ["oldMouseEH", _EH ]
if you're trying to detect events, such as firing, again that's not the way to do it
you should use user action event handlers
https://community.bistudio.com/wiki/addUserActionEventHandler
Ty very much for this info. Also i am trying user action EH but for some reason right click is not updateing code myb the key is wrong.:
countL = 0;
countR = 0;
private _ehLMouse = addUserActionEventHandler ["defaultAction", "Activate", { countL = countL + 1;}];
private _ehRMouse = addUserActionEventHandler ["optics", "Activate", { countR = countR + 1;}];
onEachFrame {
hintSilent format ["%1 has click \n Left Button: %2\n RightButton: %3 \n Aditional Info:\nLeft Mouse: %4\nRight Mouse: %5",
name player,countL,countR,str inputMouse "65536",str inputMouse "65665"];
};
are you holding R click?
if not you should
No i wasnt i was clicking
.
Hey, I am wondering how I can make it so a script will stop what its doing if another one is activated?
in this case its for music scripts
usually they go something like:
5 fadeMusic 0;
sleep 5;
playMusic "";
sleep 1;
2 fadeMusic 0.6;
playMusic ["BeholdaPaleHorse", 190];
Sleep 36;
5 fadeMusic 0;
sleep 5;
playMusic "";
sleep 1;
5 fadeMusic 0.6;
if another similar music script activates before the 36 seconds have passed, this would most likely interfere with whatever that one is trying to do or clash in other ways
do you want to know that or do you want to know how to detect a music is playing?
in regards to using isNil to run something in an unscheduled environment, is it still beholden to the scheduler 'getting around to' running it?
to explain what I'm trying to do
I have an addAction, I need the code in it to run unscheduled as its time sensitive, but I don't want it being held up by script lag
no "script lag" in unscheduled? or I don't get what you mean
what I mean is like, because the addaction code is run scheduled, if I put my function in a isNil to run it unscheduled, wouldn't it still be affected by script lag as the scheduler might wait around to execute the isNil?
I just want to know if I can put something in my script that makes the later part stop if it detects a specific other script has been activated.
So script one will activate, play music, and stuff but the last part,
Sleep 36;
5 fadeMusic 0;
sleep 5;
playMusic "";
sleep 1;
5 fadeMusic 0.6;
Will be canceled if its told to (id assume form the other script. Tho it could also just stop if it detects the trigger for that script itself.)
how is your mission organisedโฆ how do scripts decide to trigger?
the addAction may be not instant on action itself, but the isNil will make the rest unscheduled
you cannot get the addAction instantly unscheduled I'm afraid
I have set triggers placed in spots where I want music to play when players are at. When they activate, it remoteexecs a script that plays music. Like the example I gave before.
If 2 of these script triggers are close enough together and i underestimate the speed the players move at, the next music trigger and script may activate while the first is still going. Causing issues.
This issue is the first saying stop after the first script has finished
mmmm that's what I figured, oh well, hopefully this is enough.
there are https://community.bistudio.com/wiki/addMusicEventHandler if you insist
or you could have a global variable HAMSCH_IsScriptRunning
if (!HAMSCH_IsScriptRunning) then
{
HAMSCH_IsScriptRunning = true;
// ...
sleep 42;
// ...
HAMSCH_IsScriptRunning = false;
};
Ah
or use a function that does that for you, if it's just about music
Hm
Hm.
I will tinker with it
If simple if (condition) {effect} things work fine in scripts then it could be solved relatively easily
Like the example you gave
Thats 100% not the right word to call it but im just learning programming
D: assuming that he is spawning the script/function, wouldn't it be better to use the handle of the script to be able to use the multiple tools for handles?
If you absolutely must run it on the same time client does the action, you can run it on inGameUISetEventHandler event, but that's pretty dirty way of doing it
Having some kind of key to run code in unscheduled could've been useful
is there an easier way to add positions?
oof yeah I hate that thing
Maybe something like:
player addAction ["Test", [{systemChat "Unscheduled!"}, true], ...];
is # a stand in for select?
Pretty much, but it also has higher priority
would be nice, especially considering the condition is already unscheduled
Speaking of addAction, with so many arguments and many of the usually not needed, having something like ENTITY addAction HASHMAP could've been very useful
So you can specify only parameters you need and the rest fills by itself without having to type out long array
Could have a key to make sure action is run in unscheduled too
player addAction createHashMapFromArray [
["title", "Test"]
,["action", {systemChat "Unscheduled!"}]
,["unscheduled", true]
,["priority", 123]
,["hideOnUse", true]
];
wait what does # do?
Same as select
[100,200,300] select 1 + 1 => 300
[100,200,300] # 1 + 1 => 201
Wow i didnt know that ๐
someone should comment about the increased speed with # on that wiki page
What would a vectorFromTo vector math scheme look like for plotting a liner path between two points? I'd like to use it for https://community.bistudio.com/wiki/setTerrainHeight
how should I add positions?
what positions and where?
like, position at sea level. [1,0,0] added to [20,332,502] for example
vectorAdd?
vector what now
[1,0,0] vectorAdd [20,332,502]
th- that'll work xD
what increased speed?
it's the same
I don't follow the question. what do you want to do?
they probably meant "precedence" 
as in "# operator description mentions that it functions like select but with higher precedence, so select wiki page should probably mention that if you need higher precedence you can use # "
sounds like a fitting use of https://community.bistudio.com/wiki/vectorLinearConversion, i suppose? for loop over, say, X coordinate 
I am trying to make a hostage rescue scenario like a hundred other people.
I have 2 hostages and a trigger setup that checks the ENH_isHostage function condition on the hostage AI. I set the AI to be hostages using Eden Enhanced so freeing them is a hold-button action and a little spinny circle. When the AI are freed the trigger executes a join to move the hostage to the player group so the player can exfil them.
COND:
NOT (Hostage1 getVariable "ENH_isHostage")
ACTIVATION:
[Hostage1] join (PlayerGroup);
I changed up the scenario a bit to account for more players and now have 3 player groups. So instead of just PlayerGroup we now have Group1, Group2, and Group3. I could do this by making the "free hostage" something individually selectable using addAction but I'd rather not. What I want to do is make it so that the scenario smartly detects the group of the user who executes the action to free the hostage. Alternately I'd like to make a way to push or pull the freed units between groups once they are freed.
I feel this is necessary because nothing ever happens the way it's intended. Ideally I should be fine with always having the hostages merged to the assault team who should've rescued them but it's not out of the realm of possibility that for some reason it makes more sense to put them into the medic or the logistic support elements.
I am not really familiar with Eden Enhanced. Does it give you an option to execute custom code when the hostage is freed?
It does not. Here's the description from their Github wiki...
Make Hostage
Description: Makes the unit a hostage and adds a 'Free Hostage' action. Whether the unit is still hostage can be checked with _unitName getVariable 'ENH_isHostage';
Property: ENH_makeHostage
DefaultValue: false
@copper flare My mission editing is currently a bit rusty, but I'd say you have reached the limit of what is possible (or at least feasible) with the Editor.
I guess you could try using a trigger area around the hostage to detect which player is near it when the hold action that frees the hostage is completed. But then you run into trouble if multiple players are near the hostage because there is no way to determine which player completed the hold action.
You'd (probably) be better off scripting the hostage stuff yourself, because then you can just define some code to be executed when the hold action is completed. In that case it is very easy to determine which player completed the hold action.
What do you prefer?
I've seen in several posts in the forum the hashtag # being used in scripts but have no clue what it is about. Searched for it in the biwiki and .. no joy. Can anyone point me to a doc or sth to read up on what that does?
Ok .. I searched for # ... cheers ๐
@cosmic lichen is there a way to do this
with Eden Enhanced tools?
Ok. I just really like that the action added by the Eden Enhanced mod takes some amount of time and is an easy pop-up. The simple solution is to add multiple addAction stuff and the player picks the correct one via scroll wheel menu.
no
that's not the "simple solution"
I mean it may be simple for you, but for your mission it just confuses people
Oh yes absolutely it's simple to code but awful to use.
Eden Enhanced (most likely) uses https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd, and you could too ๐
well yeah
can you post your unbinarized mission.sqm file?
I want to modify the code saved by 3den enhanced (iirc it just adds the code to object init?)
actually I don't need that now ๐
Ok good because if you tried to load it I'd need to just make a new mission on Stratis with less mods loaded.
I didn't want to load it
I wanted to edit it with a text editor
anyway:
if (isServer) then
{
ENH_fnc_makeHostage =
{
if (_this getVariable ['ENH_isHostage', true]) then
{
_this switchMove 'Acts_AidlPsitMstpSsurWnonDnon04';
[
_this,
localize 'STR_A3_OM_SYSTEM_QUEST_HOSTAGEHOLDACTION',
'A3Ui_fdataIGUICfgHoldActionsholdAction_unbind_ca.paa',
'A3Ui_fdataIGUICfgHoldActionsholdAction_unbind_ca.paa',
'_target getVariable [''ENH_IsHostage'', true] && {_this distance _target < 2 && {alive _target && {_target != _this}}}',
'true',
{},
{},
{
[_this # 0, 'AmovPercMstpSnonWnonDnon'] remoteExec ['playMoveNow', 0];
[_this # 0, _this # 2] remoteExec ['BIS_fnc_holdActionRemove', 0];
_this # 0 setVariable ['ENH_IsHostage', false, true];
[_this#0] join group (_this#1)
}
] call BIS_fnc_holdActionAdd;
};
};
[this, ENH_fnc_makeHostage] remoteExec ['call', 0, true];
};
put that in the hostage unit's init field
you can debinarize mission.sqm with CfgConvert from tools, btw ๐
you can just uncheck binarize in mission settings in 3den 
also you can add it to as many hostage units as you want
but be sure to uncheck the Eden Enhanced option
Tested and worked thanks
Knowing the way players act I an almost sure someone from the "wrong" group would free the hostages the first time out if I didn't add the contingency for it to work.
[] spawn {
_posA = getPosASL a;
_posB = getPosASL b;
_dist = round(_posA distance _posB);
_coords = [];
for "_i" from 0 to _dist do {
_newPos = vectorLinearConversion [0, _dist, _i, _posA, _posB];
_zOffset = (getTerrainHeight _newPos) - 1;
_newPos set [2, _zOffset];
_coords pushBack _newPos;
};
setTerrainHeight [_coords];
};
``` well, it makes a jagged trench between the objects so that's a start
Is this a terrain resolution issue or?
terrain resolution is in 2m range at best iirc
lol no
4m at best
usually worse
on vanilla maps at least
tanoa may have 3.75m
malden has 12.5
no. vietnam terrains are usually 2m
well any terrain that is too uneven uses a small cell size
terrain res (or better said, "pixel size") issue + your code issue too
setTerrainHeight sets the height of the closest cell vertex
https://community.bistudio.com/wiki/getTerrainInfo even has the code to visualize the grid
thank you for pointing that out, that's a new extreme to test my trenches in
i also wonder if manually rounding to the nearest cell would help with later JIP shenanigans 
well I'm not sure about the SOG's Cam Lao Nam or whatever it was
but RHS one (don't remember its name) was 2m
the bra has 2.5, the others are larger
thank you
well you should use the exact same coordinates every time (which means no more vector conversion and stuff, just store them)
so you only need to make sure of that
can I do anything with the number id return for playSound3D?
doh there goes that dev branch trickery again!!
no way to tell if the sound is complete in that dev branch though
there was
iirc getSoundInfo or something
soundParams
soundParams can net me the overall length and duration which will be enough
Just check in a loop if it's still hostage
Var name is in the description.
It didn't register to me that he wanted to use the hold action that is built into ENH's makeHostage function
I think its worth in his case, for him to write his own holdaddaction that can get him the effect he wants of the hostage joining the correct group of the free'er as well as knowing exactly when the hostage becomes freed so he can skip using a loop.
he meant getting the person that freed the hostage
I just copy pasted your function from GitHub and added what he wanted 
Hi, im trying to make some Screenshots and i run into some problem, i dont know how to make the AI Shoot their guns while they are in static, i tried to put the script that is in the POLPOX Guide, but when i put it in Init, the thing errors.
@lament fog We need more information. The thing errors is not exactly specific
so i put in "[this, 0, 0.3] call PLP_fnc_fireWeapon" in Init, and it supposed to make the weapons fires itself while the soldier is in static, but when i start the playing the editor, it simply saids taht he cannot fire its weapon, and i cnat find the solution for this, i change the RPM taht didnt do anything, i change the weapon still the same, i keep trying to make them fire their weapon, but they just wont.
Did you try on POLPOX's discord?
i havent joined POLPOX's discord
Not all animations allow the unit to fire its weapon
so what do i do then? that animation is the one im looking for, and the only 1 that matches what im looking for.
Well, in theory, you can make a mod that changes that animation to allow firing. That is probably beyond your level of competence though.
So, in practice, nothing.
welp, guess ill scrapt it and make a new one.
I mean you can always find muzzleflash.jpeg and add it in photoshop I guess
i cant afford photoshop.
Then use one of the many free alternatives
gimp then
i could try.
thanks for the help BTW
Is it possible to know the scaling of the player's map?
can I remove a specific engine action with inGameUISetEventHandler?
Is there a EH to handle players spawning after briefing, serverside?
must handle JIPs and trigger once per mission
mission event handler PlayerConnected, has a JIP flag.
It'll trigger multiple times per mission if players disconnect and rejoin but you can track that easily enough.
If you want to be very specific about when it triggers (like whether the player object exists) there are other options.
You can simply find an anim that allows
yeah, that's what I actually need
I'm only interested in players actually playing
I was thinking in creating a client side .pbo that uses CBA_loadingScreenDone, it will wait X seconds before sending a server event. On the server, I'll have a .pbo with the event, updating a hashmap with the player GUID as the key
Doesn't seem like you'd need it. There's a lot of server side functionality for this now. OnUserSelectedPlayer + didJIPowner, maybe.
OnUserClientStateChanged also an option.
When using 'CfgDisabledCommands', will this prevent all client execution of these commands? Or just the commands executed in the execution path/scope from the missions init.sqf?
All client execution
Is there anyway to make the Vanilla pop-up targets "hot" and become illuminated on thermal scopes?
Is there any way to get cfgRespawnInventories to handle weapon attachments?
you can create pre-defined weapons with attachments through cfgWeapons in config.cpp and then add them to respawninventories
No, because they have no color in the approriate channels of their TI texture for that.
...is that how you do it? Hell. Okay, thanks.
Do recommend where I could find any examples of this?
check official wiki
I did, it's a stub without like, a coherent example
weird
CfgWeapons {
class InheritedWeaponClassname;
class TAG_YourNewWeapon : InheritedWeaponClassname
{
class LinkedItems
{
class LinkedItemsOptic
{
slot = "CowsSlot";
item = "optic_Arco";
};
class LinkedItemsAcc
{
slot = "PointerSlot";
item = "acc_pointer_IR";
};
class LinkedItemsMuzzle
{
slot = "MuzzleSlot";
item = "muzzle_snds_M";
};
};
};
};```
make sure you're adding a compatible item with that weapon, some weapons have restrictions of what you can mount on them. and in case of future config stuff you can go to [#arma3_config](/guild/105462288051380224/channel/122121444703338496/)
addMissionEventHandler ["Map",{
params ["_mapIsOpened", "_mapIsForced"];
LEG_mapOpen = false;
if(_mapIsOpened) then {
LEG_mapOpen = true;
systemChat "Map Open";
[] spawn {
("RscMyHUD_layer" call BIS_fnc_rscLayer) cutRsc ["MapTimerDialog", "PLAIN",-1,true];
disableSerialization;
private _parent = uiNamespace getVariable "MapTimerDialog";
private _text = _parent displayCtrl 1000;
while {LEG_mapOpen} do {
_text ctrlSetText format ["%1",[CBA_MissionTime, "H:MM:SS"] call CBA_fnc_formatElapsedTime];
uiSleep 0.1;
};
waitUntil {not LEG_mapOpen;};
};
}else {
LEG_mapOpen = false;
systemChat "Map Closed";
("RscMyHUD_layer" call BIS_fnc_rscLayer) cutRsc ["", "PLAIN"];
};
}];
Hi guys i made this code. All i want it to do is the HUD to show when i open the map and show missionTime and remove it when i am not in map anymore. But when i close the map hud still says on and i got the Resource Title not Found Error. I dont know is the best way to aproach this or how to get display to close when you close the map.
Ok i got it the Problem was in
LEG_mapOpen = false;
systemChat "Map Closed";
("RscMyHUD_layer" call BIS_fnc_rscLayer) cutRsc ["", "PLAIN"];
//Change to this:
("RscMyHUD_layer" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
Even though i got this to work is this optimal solution for something like this ?
("RscMyHUD_layer" call BIS_fnc_rscLayer) is no longer needed, just use "RscMyHUD_layer"
Show:
"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6];
```Hide:
```sqf
"RscMyHUD_layer" cutFadeOut 0;
what is 1e-6 parameter ?
1e-6 == 0.000001
Will show the 1e-6 seconds of fade in
Also you can get rid of your flag variable, just do:
while {!isNull _text}
Which the fade in is simply impossible to see so it means instant show
Also ideally move your UI code into MapTimerDialog's onLoad
Also a question if i want to remove i can use eather or one of these right ?
"RscMyHUD_layer" cutFadeOut 0;
"RscMyHUD_layer" cutText ["", "PLAIN"];
Yeah, both will work, second one will replace your display layer with generic text layer
but cutFadeOut is more proper layer closure
Like this ?
onLoad = "
private _parent = _this select 0;
uiNamespace setVariable ['MapTimerDialog', _parent];
private _text = _parent displayCtrl 1000;
while {!isNull _text} do {
_text ctrlSetText format ['%1',[CBA_MissionTime, 'H:MM:SS'] call CBA_fnc_formatElapsedTime];
uiSleep 0.1;
};
";
This is too ugly, have it call a function
And onLoad is unscheduled, this won't work
onLoad = "_this select 0 call someFunctionName";
someFunctionName = {
uiNamespace setVariable ["MapTimerDialog", _this];
0 spawn {
disableSerialization;
private _text = uiNamespace getVariable ["MapTimerDialog", displayNull] displayCtrl 1000;
while{!isNull _text} do {
_text ctrlSetText ...;
uiSleep 0.1;
};
};
};
Now shows dispay for a few seconds and closes it.
You probably have duration wrong
addMissionEventHandler ["Map",{
params ["_mapIsOpened", "_mapIsForced"];
LEG_mapOpen = false;
if(_mapIsOpened) then {
LEG_mapOpen = true;
systemChat "Map Open";
[] spawn {
"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true];
waitUntil {not LEG_mapOpen;};
};
}else {
LEG_mapOpen = false;
systemChat "Map Closed";
"RscMyHUD_layer" cutFadeOut 0;
};
}];
class MapTimerDialog
{
idd = -1;
onLoad = "_this select 0 call LEG_fnc_timeToStringDialog";
duration = 1e+6;
Test run your "RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true]; and see if it stays
It dosent stay shows for few seconds and closes.
getNumber(missionConfigFile >> "RscTitles" >> "MapTimerDialog" >> "duration")
Result : 1e+006

Maybe you have some other code running closing your layer or display or something
Do "TotallyNewLayer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true];
Same
I found the problem In here when I do it like this:
"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true];
display shows for a few seconds and disapers
but when i do it like this:
"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", -1,true];
display stays
Why not just use 1e-6 then?
I dont know what is causing this but aperantly the speed of a fade in is causing my display to disapear after a few seconds. if i use 1e-6 it disapears but if i just a value like -1 1 or any other it stays.
Strange, I test with my RscTitles and -1 works as 1 second fade in
while 1e-6 does an instant appearance
both stay indefinitely
class KingOfHill_Hint {
idd = -1;
duration = 1e11;
onLoad = "_this select 0 call client_func_hints_onLoad";
class Controls {
class HintBackground:RscText {
```Nothing special in the display itself
Maybe duration of 1e+6 is not enough and my 1e11 makes it behave differently/
Ok i change this
class MapTimerDialog
{
idd = -1;
onLoad = "_this select 0 call LEG_fnc_timeToStringDialog";
duration = 1e+6;
``` to duration 1e11 and it works now.

Huh, so if I do ```sqf
"KingOfHill_Hint" cutRsc ["KingOfHill_Hint", "PLAIN", 1e-11];
I guess that fade in time is also a multiplier for the duration
"KingOfHill_Hint" cutRsc ["KingOfHill_Hint", "PLAIN", 3e-11];
```makes it last 3 seconds
So yeah, title stays visible for duration * speed
No mention of it anywhere on wiki it seems
Might be worth adding
Yea this would be great addition just in case somebody runs in the same problem.
ive got a heli flying with unit capture but how do i kick out all the AI in the cargo once its landed
@cedar cape Something like ...
{
doGetOut _x;
unassignVehicle _x;
} forEach _myUnits;
can i set it for a whole group
instead of each individual unit
that would kick out the gunners too
can "cargo" be used?
wdym
would that not kick out the gunner?
and drivers
im confused
how would that look in script
alr
BIS made a funny again?
alr
where would i put that?
im using unit capture for the vehicle
so i put a trigger where the heli lands?
addMissionEventHandler ["EachFrame", {
if((missionNamespace getVariable "isAcidRainActive")) then {
if([player] call LEG_fnc_isInHouse) then {
hintsilent "Safe";
} else {
hintSilent "Better run";
};
};
}];
What would be the best practice in here to dmg player every 5 to 10 seconds if player is not Safe ?
while { sleep (5 + random 5); true } do
{
if (missionNamespace getVariable ["LEG_isAcidRainActive", false])) then
{
if ([player] call LEG_fnc_isInHouse) then
{
hintSilent "Safe";
}
else
{
hintSilent "Find shelter!";
};
};
};
more betterer missionNamespace getVariable ["LEG_isAcidRainActive", false])
get rid of that, and start the loop when you start acid rain, and kill the loop again when you end it.
No need to constantly check every 5-10 seconds, while its not active
LEG_isAcidRainActive = true;
0 spawn {
while { sleep (5 + random 5); missionNamespace getVariable ["LEG_isAcidRainActive", false] } do
{
if ([player] call LEG_fnc_isInHouse) then
{
hintSilent "Safe";
}
else
{
hintSilent "Find shelter!";
};
};
};
sleep 60;
LEG_isAcidRainActive = false;
Currently i am just calling via fnc [] call LEG_fnc_createAcidRain;
but i have the fnc [player] call LEG_fnc_isInHouse; witch checks is player in house it returns true or false; And i would like to have so when player is in house or in cover to stop applying dmg.
Are you using any medical system mod?
No vanilla.
applying damage in vanilla is different than applying damage in ace medical
Oh i got it only apply dmg if player is not in cover so no need to do eachFrame for cheching is player in cover or not.
Based on Lou's example
LEG_isAcidRainActive = true;
private _damageScript = 0 spawn {
private _warningCounter = 0;
while { sleep (5 + random 5); true } do {
if ([player] call LEG_fnc_isInHouse) then {
hintSilent "Safe";
_warningCounter = 0;
} else {
hintSilent "Find shelter!";
_warningCounter = _warningCounter + 1;
if (_warningCounter > 5) then {
// Waited long enough, apply damage
player setDamage (damage player + 0.05);
}
};
};
};
sleep 60;
LEG_isAcidRainActive = false;
terminate _damageScript;
So you get like 25 seconds without cover, then it starts hurting you
Ty very much.
Just last Question should't in while codition be instead of True be this var : LEG_isAcidRainActive
i dont see how once it enters in while loop it exits ?
terminate _damageScript; at the end, kills the spawned script
Its probably more unclear than checking the variable every iteration.
But if you know only one thing turns the variable to false, you can kill the script there without need to check constantly
Just giving you extra choice, you can also use Lou's variant
When i try to run this code i have error saying undefine variable in expresson _house in LEG_fnc_isInHouse
here is the code of the fnc:
params ["_unit"];
private _line = lineIntersectsSurfaces [getPosWorld _unit, getPosWorld _unit vectorAdd [0, 0, 50],_unit, objNull, true, 1, "GEOM", "NONE" ];
_line select 0 params ["","","","_house"];
if (_house isKindOf "House") exitWith { true; };
false;
_line is empty
How would i get not empty line ? This is how i run this fnc :
[player] call LEG_fnc_isInHouse
if (isNil "_house") exitWith {true}; // Nothing found, is probably outside (or inside extremely tall house)
? before the isKindOf?
private _house = _line param [0, []] param [3, objNull];
so fnc should look like this:
params ["_unit"];
private _line = lineIntersectsSurfaces [getPosWorld _unit, getPosWorld _unit vectorAdd [0, 0, 50],_unit, objNull, true, 1, "GEOM", "NONE" ];
private _house = _line param [0, []] param [3, objNull];
if(isNil _house) exitWith {false;};
if (_house isKindOf "House") exitWith { true; };
false;
Or this combined with previous check
if (isNil "_house" || {_house isKindOf "house"})
No need for isNil with the param thing
And it's wrong anyway
ty very much it worked.
same, saves the array creation
0.0006 ms
Cycles:
10000/10000
Code:
[]```
```Result:
0.0004 ms
Cycles:
10000/10000
Code:
0```
Apparently an array is unnecessary slow. But very small difference
https://github.com/dedmen/Intercept_CBA/blob/master/src/SQFExtension/Utility.cpp#L558 I made one 5 years ago ๐
gib
push to main as alternate syntax ๐
Does anyone know how to randomize a vehicles texture through orbat or the text editor? ex: Spawn in BTR-70, it has a random camo/skin.
there is already a BIS function for that iirc?
Debug Console, the meter icon
It is the button/command to get the performance of the code
because array does a malloc, 0 is a constant, allocated at compile time and does not need an allocation at runtime (thus cheaper, as the benchmark shows)
Anyone know how to force a missile projectile to explode? deleteVehicle and setDamage 0 seem to just make it disappear. Having a hard time finding anthing in the wiki
Thank you so much
Can anyone please help me make a script that randomizes a vehicles texture/skin in either orbat or the text editor? Please, any help is greatly appreciated.
1/ please don't crosspost
2/ you can recruit someone in #creators_recruiting
3/ here is to ask for help/assistance
which you did here
vehicles should already randomize their texture in the base game
and here
oh you want BTR-70... then which mod?
give me a class name of the one you are using
b_afougf_btr70
textureList[]=
{
"ZSUCAMO1",
0.3,
"ZSUCAMO2",
0.3,
"ZSUCAMO3",
0.3,
"ZSUCAMO4",
0.3,
"ZSUCAMO5",
0.3,
"ZSUCAMO6",
0.3,
"ZSUCAMO7",
0.3,
"ZSUCAMO8",
0.3,
"ZSUCAMO10",
0.3,
"ZSUCAMO11",
0.3,
"ZSUCAMO15",
0.3,
"ZSUCAMO18",
0.3
};
using these predefined skins
is there a setting to include milliseconds in the timestamps in the rpt?
picked randomly on spawn
these are already defined and weighted at 30% chance... and they aren't randomizing when you start the mission and spawn one? (not place them in the editor)
Yes correct
if Vanilla, they should be configured properly to randomize, although there is a lot of mods that kinda only have a single skin defined which might be the case.
@sage bridge
read this:
https://community.bistudio.com/wiki/Arma_3:_Vehicle_Customization
its regarding vehicle classes configuration.
To modify CUSTOM textures via scripting you need to make the custom skin and use
setObjectTexture
https://community.bistudio.com/wiki/Retexturing_with_setObjectTexture
Maybe all the skins being used by that vehicle are the same?
Where do I put textureList[]=
{
"ZSUCAMO1",
0.3,
"ZSUCAMO2",
0.3,
"ZSUCAMO3",
0.3,
"ZSUCAMO4",
0.3,
"ZSUCAMO5",
0.3,
"ZSUCAMO6",
0.3,
"ZSUCAMO7",
0.3,
"ZSUCAMO8",
0.3,
"ZSUCAMO10",
0.3,
"ZSUCAMO11",
0.3,
"ZSUCAMO15",
0.3,
"ZSUCAMO18",
0.3
};
in this?
I dont mean to ask, but I do not know how to do that, can you please show me?
is the import_01 something that orbat created? I don't use that system
its from alive
if you just want to modify B_UAArmy_Test_01, then you add the textureList[] to that class under line 104
he is using the alive orbat thing
Okay, nevermind
you know with what you posted, you are making a mod right? if you want a simple solution, get all the file paths of the textures you want and use setObjectTexture/setObjectTextureGlobal
if you just want to do it for a mission
Im not understanding im sorry. do I put the pre defined textures in "init = "if (local (_this select 0)) then {_onSpawn = {sleep 0.3; _unit = _this select 0;};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";?
are you looking to make a mod that people will download and use? or are you just making a mission and want things randomized.
just making a mission and want things randomized.
then toss all of that
alive spawns in a BTR-70, it has a randomized texture
get a list of the texture file paths you want
which is the texturelist
no, those are class names, you need a full file path for setObjectTexture
How can I find that?
example of another mod. : init = "if (local (_this select 0)) then {_onSpawn = {sleep 0.3; _unit = _this select 0;_unit setObjectTextureGlobal [0,'\ua_factions_rhs\data\vehicles\btr70\afou_btr70_1_newcamo_zviruka.paa'];_unit setObjectTextureGlobal [1,'\ua_factions_rhs\data\vehicles\btr70\afou_btr70_2_newcamo_04.paa'];_unit setObjectTextureGlobal [2,''];_unit setObjectTextureGlobal [3,'\ua_factions_rhs\data\vehicles\btr\afou_btr_gear_02_co.paa'];_unit setObjectTextureGlobal [4,'\ua_factions_rhs\data\vehicles\btr\afou_btr_gear_02_co.paa'];};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
just standby...
would it be this?
eaaasy
you don't want to make a mod
// Put in description.ext
class CfgVehicleTemplates
{
class b_afougf_btr70_test
{
vehicles[] =
{
"b_afougf_btr70"
};
displayName = "My Test Variant";
author = "Your Mom";
factions[] = {
"BLU_F", "BLU_G_F",
"OPF_F", "OPF_G_F",
"IND_F", "IND_G_F",
"CIV_F"
};
textureList[]=
{
"ZSUCAMO1",0.3,
"ZSUCAMO2",0.3,
"ZSUCAMO3",0.3,
"ZSUCAMO4",0.3,
"ZSUCAMO5",0.3,
"ZSUCAMO6",0.3,
"ZSUCAMO7",0.3,
"ZSUCAMO8",0.3,
"ZSUCAMO10",0.3,
"ZSUCAMO11",0.3,
"ZSUCAMO15",0.3,
"ZSUCAMO18",0.3
};
};
};
then when you want to spawn the vehicle, do so and run
[_myVehicle, "b_afougf_btr70_test"] call BIS_fnc_initVehicle
you may need to add more of the created vehicle class names to vehicles[] = {}; depending on what vehicles you want used
I don't see that vehicle class name in my CUP config so I'm not even going to attempt to search for the texture filepath list. But that is how you would use the new vehicle customization system
all in all, this might be worth checking ALiVE configuration and documentation.
It seems like it would be a great tool if you knew what you were doing and could speed things up. But if you don't, it looks like it just throws you in there
@sage bridge
Yes?
did it work?
Unfortunately not, I am just about to give up on it
Unless you can try helping me through VC or in dms then I am pretty much done
Hi if anyone could help, I have a quick question.
I'm running a simple script that transitions players into a black screen with a splash of text and then transitions out after a few seconds. The issue is, with the "sleep" command, an error saying "suspending not allowed in this context" appears. Anyone know how to fix?
Here's the script for reference:
"_screenLayer" cutText ["2 Hours Later...", "BLACK FADED", 0, true, false];
sleep 5;
"_screenLayer" cutText ["", "BLACK IN", CRQ_SPAWN_FADEIN_TIME, true, false];
Run it through an sqf
[] spawn {
// mycode
};
personally, its gone passed the "time invested vs player appreciation" ratio
I have tried both methods and it doesn't work, im sorry, I really do appreciate your help a lot.
Thank you, that worked beautifully. ๐ ๐
I have a certain item tied to a while script. How do I detect if the item is dropped, picked up, and spawned with? Only locally
an inventory event handler?
which one? they dont say what im looking for bluntly so it leaves me unsure what to use.
I was thinking it could be ContainerClosed and Open? Cause stuff on the ground is a fake container afaik
But InventoryOpened and InventoryClosed are the best options I assume? Am I just overthinking it?
take or put for dropped or picked up (event handlers)
ah right, take, put, I am just overthinking
Hi, I have another question. If anyone is able, is there any script that forces a player to turn on the NVG in their inventory? I have a sequence that transitions from a daylight to night time setting and in the "cutscene" I would like for players to have their nod's equipped without any interaction. Any way to achieve this?
Thanks so much once again! I feel like such a novice with all of this ๐
is it possible to lay alpha over a texture using UI on texture?
like to make a texture that is an already existing texture but with parts cut off?
where do you want to show the texture?
the idea is to have one texture per red square, with the texture displaying the ground texture and being transparent inside the trench
nope you can't do that
but don't you already triangulate around the trench?
if so one idea might be making more triangles with different texture uvs and using them accordingly
it'll still be glitchy near the trench but far from it it should be ok 
tho I guess your triangle shapes are not so predictable from what I see 
thanks, i'll bake more uvs then
i thought if the ui was possible i would have less objects and less distortion
I might have another idea too
actually no I think that won't move the uv ๐
but anyway I was gonna suggest animations
I thought you triangulate it then place triangles there 
how does compositions and init field work? are the only executed locally for zeus or something?
they seem to run fine when testing, but not on actual dedicated server
When a composition is placed in the Editor, the init fields of its objects behave like any Editor init field - executed on all machines and JIP.
When placed with Zeus, the init fields are only executed on the machine that placed them.
just for confirmation sake, procedural textures can be set to deploy any color you config them to, right?
@fair drum
Yo, is it possible to edit cfg variable for all vehicles in a script or description ext? I have a config field from a mod that i want to change it for all vehicles globally, is it possible via script?>
thanks!
no
description.ext maybe
is it possible to override a value that is supposed to be in cfgVehicles inside description.ext?
read the wiki
can ui to texture be used to set the scale of the texture?
no.
init.sqf definitely shouldn't be removed
you can but even then ui to texture is extremely slow
i guess in that case i'll bake even more UVs
the event scripts are all handled by a scripted framework, they not anything magically handled by the engine :P
init.sqf however...that's some engine magic
guys, any idea why this is deleting only ~25% of the whole array on a while {true} loop on each pass? sqf if (time > V_INEXTDELCHECK) then { V_INEXTDELCHECK = time + 30; { private _inf_x = _x; private _near = allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS]; if (_near isEqualTo []) then {0 = V_POPULATION deleteAt (V_POPULATION findIf {_inf_x == _x}); deletevehicle _x;}; } forEach V_POPULATION; };
I need to to delete all the units "not near" to players, and it does but takes several passes...
I guess the issue is here: sqf 0 = V_POPULATION deleteAt (V_POPULATION findIf {_inf_x == _x}); but I thought this would be the fastest solution
Deleting stuff from a list while iterating it is generally not a good idea. Havent looked closely but maybe try iterating from the last object to the first instead
If this is not what you are doing, disregard me. Just a quick glance
is there a way to export all functions easily
Well, the stuff I am deleting are Agents that are listed in the V_POPULATION array. The loop is supposed to check every 30 seconds for agents that are too far from any players and delete them. But I believe that the "forEach" already iterates from the first to the last anyway. I could add a sleep in there and there is no performance degradation. The only issue is that if 100 Agents are far from the players, every 30 seconds this code only deletes ~25% of them on each loop... And I don't know why it doesn't delete all of them during that first iteration...
Of course, there should be a correct way of doing it... which I am not grasping yet...
i do something similar-ish and it works just fine for the specific stuff that I do and check. I do check closeness to players and remove them too, so maybe this can shed some light
//dynamic cleaner
if (count (_currentGrps) > (_maxgroups) then //Or any other condition to clean
{
private ["_newGroups", "_oldGroups"];
_newGroups = [];
_oldGroups = _currentGrps;
{
if !(isNull _x) then //Or other condition
{
private ["_currentGroup", "_iteratedGroup", "_canRemove"];
_currentGroup = _x;
_iteratedGroup = units _currentGroup;
_canRemove = true;
{
private _currentPlayer = _x;
{
if (_x distance _currentPlayer < _someDistance) exitWith
{
_canRemove = false;
};
}count _iteratedGroup;
if !(_canRemove) exitWith {};
}count allPlayers;
if (_canRemove) then
{
{
deleteVehicle _x;
}forEach _iteratedGroup;
}
else
{
_newGroups pushBack _currentGroup;
};
};
}forEach _oldGroups;
_currentGrps = _newGroups;
};
I'm on mobile so its hard to follow the code exactly.
But to me it looks like you are iterating (looping) the vpop array, and deleting elements from the same array inside the loop.
This will mess with the indexes, so instead of a foreach loop, try using a standard for loop and start at the last index and and move to the first.
he is
that the real issue
its not that it deletes arbitrarily 25% units
but that he losses an unit to check per each one he deletes
he just need to hold a control array and a reference array, and not delete from the reference one
Yea, that also works if he really wants the foreach loop instead of a for
delete findIf inside the forEach loop looks crazy enough to break the backwards iteration too 
its also inneficient to search within yourself if you already know your _forEachIndex
Logic looks like array should end up empty anyways
{deleteVehicle _x} forEach _array;
_array resize 0;``` should be good enough for that 
Ok, so I will do two different arrays, one the main array and the other the array of the units inside the main array that are outside the radius, and then, how do I delete all the units in the main array that are duplicated in the "to delete" array?
firt remove the units to delete and the deleteAt find in your reference
I wonder if scripting command to split an array into two based on predicate can be useful
Like sqf [1, 2, "a", objNull] selectSplit {_x isEqualType 0} // [["a", objNull], [1, 2]]
๐ง if the "to delete" array is entirely contained inside the main array and rhe main array only contains real units - delete all the units from delete array, then remove objNulls from the main array.
objects are deleted in the next frame
BIS made a funny again?
Nah. They are not meant to heat up.
- subtracts two arrays
instead of duplicating you can also do:
V_POPULATION set [_idx, objNull];
and do: V_POPULATION = V_POPULATION - [objNull] after the loop ends
using something like 0 instead of objnull is faster but be careful. if the array might still be iterated over again before the invalid stuff are removed you'll get a type error
Perfect! Exactly what I was looking for! Thanks!
when you delete something from an array you're iterating over, you skip the next element
e.g. you delete something at index 2, the array shifts one back, now in the next iteration when forEach wants to use index 3. it actually uses the old item at index 4 (it got shifted to index 3). the one at index 3 was also shifted to where 2 was so it's safe
Yeah, I guess we would need something like a "findAll" command instead of "findIf", so it does not stop on the first element
findall is just select
๐คฏ
_array deleteAt select {_nonMagicX == _x};``` ?
select returns elements not indices
and deleteAt doesn't take array
also now that I read your code it's way too redundant
So we either need a "deleteAtArray" or "selectIndices"?
{
private _inf_x = _x;
private _near = allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS];
if (_near isEqualTo []) then {0 = V_POPULATION deleteAt (V_POPULATION findIf {_inf_x == _x}); deletevehicle _x;};
} forEach V_POPULATION;
you're just removing the item at _forEachIndex
so you already have the index
and like I said just do that via select
V_POPULATION = V_POPULATION select {count (allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS]) != 0 || {deleteVehicle _x; false}};
๐ง someone add that to the wiki somewhere!
even if you didn't know select you could still do it like so:
{
private _near = allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS];
if (_near isEqualTo []) then {V_POPULATION set [_forEachIndex, objNull]; deletevehicle _x};
} forEach V_POPULATION;
V_POPULATION = V_POPULATION - [objNull]
Yeah but I was told this sqf V_POPULATION = V_POPULATION - [objNull] was slow...
Well, not that but V_POPULATION = V_POPULATION - [_x]
well yes you only need to remove stuff after the iteration
but anyway just use this
Ohhhh I will! For many many things!
fixed an error
if !(isDedicated) then {
[player,didJIP] execvm "initPlayerLocal.sqf";
[[[player,didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp;
"initPlayerLocal.sqf" call bis_fnc_logFormat;
"initPlayerServer.sqf" call bis_fnc_logFormat;
};
looks like initPlayerLocal and initPlayerServer run for headless cients
Question regarding ExtDB2. Is ExtDB2 creates sqllite DB file automatically when I trying to get access to it first time?
Or I should create it myself?
Regarding "SetIdentity" in MP. I've worked it out so that on player respawn a variable from the old character gets loaded and the respawned character gets a remotexec'd setidentity face, however I've noticed something curious - the OLD unit looses the face and it gets reverted to the player's profile face. What's up with that?
dead units lose identity/name/etc on group removal, hence why you cannot use name _deadUnit
it might be related
Interesting - it's not a big deal because the old corpse gets deleted - but it's one of t hose Arma things ... ^^ TM
does the sqf _targets = _unit targets [true, 300]; command returns the array of targets from closest to furthest? Or is it necessary to use the BIS_fnc_sortBy fnc to order by distance?
Order from furthest to closest after testing
I take that back
Its actually in order of the unit's placement in the editor or their creation. So effectively, treat it as unordered.
Hi guys. How to make a plane attack a point?
I trying to do
_pilot doWatch _position;
Then this:
_pilot doSuppressiveFire _position;
or this one:
_pilot fire (currentWeapon _plane);
But get no effect. Plane comes to position and do not firing at the point.
https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec
allowedTargets = 1; // 1 - can only target clients, execution on the server is denied
Does this work with server client, or it denies both listen and dedicated server?
i believe being the target is a bad thing
actually it looks like its the opposite
Can't target server client?
Question is, can I have non-server client fire a function with allowedTargets = 1; against server client?
oh I see what you are getting at. I'm interpreting that as it is denied on dedicated, and not denied on listen. I'd have to test.
What is a server client?
Server is server and client is client. If the server is player-hosted, then it has a player and an interface (but it is still the server, not a client); if it is dedicated, then it neither has a player nor an interface. Either way, it always remains the server: isServer always returns true and the machine network ID is always 2. The server is never a client.
It is of course possible that I made a mistake when I reworked the remote execution pages, but I would be very surprised if it was possible to remotely execute a function configured with allowedTargets = 1 on either type of server.
That's why foreachreversed was added, see it's wiki page for explanation what's happening
Hi together, as a non programmer I get in struggle by writing a simple script:
What do I want to do:
Get all traits of the actual players in current mission (Dedi Envoirement) and print later the result on a Billboard or something else: Actual Medics: Player 1, Player 2, Player 3,.... ; Actual explosive Specialists: Player 1, Player 2,... and so on.
I started with getting allplayers, iterate the getunittrait over and then I am stuggling: How do I get the result of the Iteration to an Array? Or is this the complete wrong path?
private _allplayers = allPlayers - entities "HeadlessClient_F"; private _medic_trait = "Medic"; _playerswithtraits = []; {_x getUnitTrait _medic_trait } forEach _allplayers; //pushback to use ?
Thank you so much for your feedback and help.
@pliant cradle Your idea is correct, you could indeed do it like so ...
private _medics = [];
{
if (_x getUnitTrait "medic") then {
_medics pushBack _x;
};
} forEach _allPlayers;
```... but there is an easier way:
```sqf
private _medics = _allPlayers select {_x getUnitTrait "medic"};
```Under the hood (i.e. in the game engine), the `select`-statement does the same thing as the `forEach`-loop above (like I said, your idea is correct). The `select`-statement is just shorter and also faster (because a larger portion of the code is executed directly in the game engine, which is faster than running similar SQF code).
Thanks a lot ansin11 for pushing to the right direction. And yes when I see now how you solved it makes "click" by my side. And that select-statment is faster was also new to me. Very smart idea. Thanks a lot for pushing me in the right direction.
Does anyone know the name of move which looks like the player is using a medikit?
You can find it either by looking at animation viewer or doing animationState player while you yourself play that move
Thank you. I'll have a look
On a different note, how can I check if an array is empty within an IF condition?
_myArray isEqualTo []
Thanks very much!
or count _arr == 0
^ slower but more human readable
Hello
I'm trying to use ChatGTP for scripting in Arma 3 (since I have very little knowledge on scripting) and I got this as a result.
this addAction ["Add to squad", {
// Add the AI unit to the player's squad
[_this, group player] joinSilent group player;
}];```
What I'm trying to do is to make AI join my squad using the action menu. Chat told me to put it in the unit's init field and I did, but even tho I can see the action pop up when I'm close to the unit, the unit doesn't actually join my squad when I select the action.
I'm trying to use ChatGTP
don't.
Yea I know :/ but I'm completely clueless
hi completely clueless, I'm dad! ๐
so!
Goal: make AI join my squad using the action menu
when?
When I get close to them and select the action from the action menu
so an action on them to join your group, OK. is that multiplayer or singleplayer?
singleplayer
kewl! so:
this addAction
[
"Recruit", // title
{
params ["_target", "_caller", "_actionId"];
units _target join group _caller;
_target removeAction _actionId;
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"alive _target", // condition
8 // radius โ you may want to set that
];
add this to the group leader's init field to join all of its unit to you
note that if the leader is killed, the action will disappear and won't transfer to other units
last , should be removed
fixeded
Nice
right after the 8, remove the ,
Thanks guys
If you're doing this in an init field you may need to remove the comments
I know that at least ๐
true that, too
@wispy topaz
Do not rely on stuff like chatGPT or similar AI chat models for anything code related. There are dedicated AI models for things like C and Java but they are **aids **designed to basically be context predictive auto-fill like when texting on the phone.
There are very good A3 tutorials on youtube to ease you into the concepts of arma scripting. If you plan to make stuff on the regular start with those.
using AI for scripting is okay-ish as long as you have the junior level scripting knowledge because it can spit out ideas but it generates something more of a pseudocode and you need to know where it makes mistakes and be able to fix them. Otherwise you're just making it harder for yourself to understand what you are doing, reading the actual wiki and mass-spamming queries in Google would be much more helpful.
Yeah thats a fair point. I would also consider using Bing and Yandex for deeper searches. Google screws with results so much now-a-days making it harder to find very obscure stuff deep in forum threads or something.
Hello,
Is attributes avaible, which are defined in config, on Zeus (if it's can I disable this option) and does attributes only affects objects which are placed via editor? Or does objects spawn with defaultValues ? If I have init eh where I do call function with values from attributes , let's say in attributes I have set decals under object boolean (default false).
Not sure does my question have any clue. But i ask anyway
theres nothing wrong with using chatgpt to help with script writing
How would i make value go between 0 and 9.99 based on distance ?
Code:
private _distance = ((player distance _object) - _minDistance) max 0;
private _threat = ((1 - (_distance/_maxDistance)) max 0) min 1;
``` So this gives me value between 0 and 1 how would i make this to go between 0 and 9.99
linearConversion is enough
like this ? private _threat = linearConversion [0,1,(player distance _object),0,9.99,true];
Well, it is not a wrong code but probably that's not what you want
I have no idea what _minDistance and _maxDistance in this context so can't say how wrong, but seems so
This was the fnc i had:
if (!hasInterface) exitWith {};
params ["_object", "_maxDistance", ["_minDistance", 0], ["_condition", {true}]];
"ChemicalDetector" cutRsc ["RscWeaponChemicalDetector", "PLAIN", 1, false];
private _ui = uiNamespace getVariable "RscWeaponChemicalDetector";
private _ctrl = _ui displayCtrl 101;
_maxDistance = _maxDistance - _minDistance;
while _condition do {
private _distance = ((player distance _object) - _minDistance) max 0;
private _threat = ((1 - (_distance/_maxDistance)) max 0) min 1;
_ctrl ctrlAnimateModel ["Threat_Level_Source", [_threat, 2] call BIS_fnc_cutDecimals, true];
sleep 1;
};
Still have no clue
_maxDistance and _minDistance were set to 5000 and 10.
private _threat = linearConversion [10,5000,(player distance _object),0,9.99,true];``` then I guess
ty it is its just inverted.
Ah well, but anyways
Need a biki page for "How to start scripting for Arma with ChatGPT" that says
Don't
. . . don't tempt me
good ol' Arma 4 "No." page ๐
https://community.bistudio.com/wiki?title=Arma_4&direction=prev&oldid=321538
can we get this added as a !quote?
Quote created with ID 6:
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
!quote 6
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
๐
nice, so 5 and 6 are my most used ones now
5 = setPos, right?
@tough abyss It's because a headless client is what it is, a client. It's meant to run those.
yup
what are the rest? 
!quote 0
hi new, I'm dad!
Lou Montana; Monday, 31 May 2021
NOOOO
audiocustoms; Thursday, 3 June 2021
!quote 2
_> whoever posts about "is ThIs tHe neXt arMa?" or "thEy aRE aBoUt to aNNoUnCe ArMa 4" will be rammed by @young current _
should do ๐
Lou Montana; Monday, 21 June 2021
!quote 3
If there ever is a con , i'll cosplay as a goat
Whiplash; Sunday, 12 September 2021
!quote 4
no
Dedmen; Wednesday, 6 October 2021
the 4 definitely has potential ๐
can probably clean some of those up lol
If it is running initServer then there is a problem.
params ["_unit","_height","_velocity","_direction","_speed","_delay"];
_unit setVelocity [(_velocity select 0) + (sin _direction * _speed), (_velocity select 1) + (cos _direction * _speed), ((_velocity select 2) * _speed) + _height];
private _pause = time + _delay;
LEG_JumpingEnabled = false;
waitUntil {time > _pause};
LEG_JumpingEnabled = true;
``` Hi so i have code here for jumping but how would i applay here code when i execute this again it tells me you have to wait x amount of time before jumping again ?
is there anything u can imput to stop all animations on an object?
Simulation is not the solution
private _nextJump = _unit getVariable ["next_jump", -1];
if (time < _nextJump) exitWith {systemChat format ["wait for %1 seconds", (_nextJump - time) toFixed 0];};
_unit setVariable ["next_jump", time + _delay];
speaking of which, why can he inline images yet I can't? lol
did you agree to the rules and verify yourself?
Don't tell me I've been here this long and never did that
nope 
oh... my... god...
those animations use the time source
so unless you stop time... 
but you can make a ticket for it
maybe it'll get fixed
I'll make one myself
_EH = findDisplay 46 displayAddEventHandler ["KeyDown", {
params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
if(_key == 57) then {
//systemChat format ["%1",_key];
if((player == vehicle player) && (isTouchingGround player) && (player getVariable ["next_jump", true]) && ((stance player == "STAND") || (stance player == "CROUCH"))) then {
_height = 10 - (load player);
_velocity = velocity player;
_direction = direction player;
_speed = 10;
[player,_height,_velocity,_direction,_speed,30] spawn LEG_fnc_Jump;
};
};
}];
``` just a Question how would i ge the Next jump here then where i call the script ?
I don't understand the question
why do you want to place it there at all?
place it in the function
and call it instead of spawn
Ty very much. I got it to work and the last Question how would i detect here if player press the _key 2 times instead of once ?
either use the modded keybindings or do it manually using a timer again

don't ask me where, I wish Valk would link to said message ๐คฃ
Should be named initClientLocal then instead of initPlayerLocal. Player implies a player.
well HC is a player
just not human
try in SP
Thats a weird definition. I'd say a player is a person playing a game.
answer: stop breaking things!
at least the old HC system (A2) there was no diffrence from a HC or a player from a tecnical standpoint
no a player is a client that is connectet to a server
a music player is not human ;)
Thats a different meaning of the word.
HC's don't play music
it plays the game without a renderer and runs scripts :)
player != human
http://www.oxforddictionaries.com/definition/english/player
1A person taking part in a sport or game
lets say it is a virtual person playing arma 3 on your server ^^
can draw3d be used to get complex models in MP? i've seen servers with custom objects ingame and am confused to how this is done
no
There is a word for that. It's client
createSimpleObject
if i'm not mistaken you can just load p3ds from the mission folder
yeah you can
Just fyi. "-5" will return false as well. So this method won't work
so you can load a p3d if it is a simple object?
any relevant documentation on p3d's
?
well my mod treats +- as operator yeah 
_word regexMatch "[-+]?(?:(?:\$|0x)[0-9a-f]+|(?:[0-9]+?\.[0-9]*|[0-9]*?\.[0-9]+|[0-9]+)(?:e[-+]?[0-9]+)?)"
this should do it
you can make p3ds with blender and the arma 3 toolbox. you can spawn them in as a super simple object, which means there is no config involved.
With your definition the sqf should also trigger for the server
time to horifically fail at modelling a 3d object because i code not modell
fixed a pair of brackets btw
you can load a p3d as a super simple object
it won't have any special functionalities (damage, gravity, etc.)
The actual game player (like music player)
do path lods work on super simple objects?
it can have animations and collisions tho
dunno
they should 
ofc not
they're not entities
you can use Fired event handler to get missiles
entities is what the game constantly needs to update I guess 
they're also stored in a "separate container" I think
so looking them up is faster than going over the whole quad tree (game stores objects in a quad tree)
this argument... :shootself:
Actually makes me wonder what Arma does with -5 is it unary - and 5? Or -5 constant ๐ค
Why?
there should really be an emoticon for that..
@little raptor
"-1d5" regexMatch "[-+]?(?:(?:\$|0x)[0-9a-f]+|(?:[0-9]+?\.[0-9]*|[0-9]*?\.[0-9]+|[0-9]+)(?:e[-+]?[0-9]+)?)" //false
๐
well it's not a valid number tho 
it is

parseNumber "-1d5" // -10000
wut ๐
yes ๐
not exactly the server is not a game client its a server client
but anyway
well this was for normal SQF numbers 
including hex
yeah
1d5 being the same as 1e5. I've never seen that before
just seems incredibly pointless that's all
Do player units record suppression?
you know.. arguing about semantics
According to getSuppression:
Suppression is not calculated for player entities and is always 0, unless it is set with setSuppression.
Damn, just read the article, mustve missed that part :x thanks
How is it pointless? Someone could write a initPlayer script that fails on the headless client and causes errors
There is no arguing about semantics. Words have meanings and this game is confusing enough already
How can i cancel or remove tasks trough script?
like for example i got this task,
when this trigger is activated, I want to finish that task. This is just for testing. will use this in a script later
hmmm
I will look into that
in the example given
["BIS_task_01","CANCELED"] call BIS_fnc_taskSetState;
Do I need to replace "BIS_task_01" with the variable name of the create task module, or Task ID?
Or is it that I have to write
"BIS_task_(TaskID)"
for example for this it would be
["Tk_1","CANCELED"] call BIS_fnc_taskSetState;
yes
initPlayer initializes a player object, initClient initializes the client itself
sure but a for the server all clients are players that are connectet to him self. it does not care if there is a human siting in front of a monitor or a programm simmulating a client like a HC does
@pliant stream Thats not true though initPlayerLocal triggers on the headless client
the HC is even there on the map as a goat or whatever you place them
or did that change in A3?
I think those can be virtual now.
But they still take up a slot
if in scheduled environment then yeah i guess
https://community.bistudio.com/wiki/Scheduler#Scheduled_Environment paragraph 4 and 5
I think