#arma3_scripting
1 messages · Page 745 of 1
at least you get the tools in this game
once you get the hang of sqf the ai becomes the annoying part to deal with
rip
OH I LEARNED SOMETHING AWESOME
You can highlight an entire chunk of code and hit TAB and it indents all of it
Amazing
Do I need a Semi Colon at the end of this?
private _uniform = selectRandom [
"CUP_O_TKI_Khet_Partug_08",
"CUP_O_TKI_Khet_Partug_07",
"CUP_O_TKI_Khet_Partug_06",
"CUP_O_TKI_Khet_Partug_05",
"CUP_O_TKI_Khet_Partug_04",
"CUP_O_TKI_Khet_Partug_03",
"CUP_O_TKI_Khet_Partug_02",
"CUP_O_TKI_Khet_Partug_01"
]
depends
no, no
only the file's final semicolon is not needed, but it is always a good thing to have - you don't want to look for it when you add lines to your script
is there any problem with adding a Semicolon on the Last one in the FIle?
never
k
add it, good practice, saves headache
yeah good to know
the compiler doesn't see the line breaks and indents, so you need to separate things out with the semicolon
Oh thats, thats a very simple way to make a disgusting image that makes alot of Sense
Thanks
private
_a=
5
;
```is the same as```sqf
private _a = 5;
so if you do
private _array = [
1
]
hint "hello"
```it's the same as doing```sqf
private _array = [1] hint "hello"
```and the engine says "wait a minute"…
Yeah, I understand that on a Whole other level now
Cheers
Ive also now got a Cursed image of all this code compiled in my head. So. Thanks.
would you like to see the other way around
private _array = [1];hint "hello"
P L E A S E
i put it in the debug console, ghost, what did it say on the top right of my screen?
goodbye
i am unstoppable
noooo
I like how the Ingame Arsenal calls it "Facewear" But SQF, says no. "Goggles"
Gl man
Please tell me Lou you're still here
setDamage is to set damage, how do you get damage?
NOOO
no
we have damage as well 😅
shhh
I see
Oookay
Got all the "goggles" Cough Facewear. and Headgear done. Time for script time
I assume
_unit forceAddUniform _uniform;
Removes overrides the Previous Uniform since it says "Force"
I’d put money on it
it's a bit different than that
addUniform replaces the uniform as well
forceAddUniform is to add the uniform to an enemy side
OH
you can see its wiki page, it allows to assume the minimum possible amount 😉
GH_fnc_civLoadouts
oh
So
this GH_fnc_civLoadouts
No
👀
[this] call GH_fnc_civLoadouts
arguments call function 😉
be you define _unit in the function
you can either write
params [“_unit”];
or
private _unit = _this select 0;
both of these functionally do the same thing
the former the better 👀
params is way better, as it could work with [this] or this
so..
params [“_unit”]; does what
it takes the argument you provide and slaps it into _unit
so
params [“_unit”];
removeVest _unit;
_unit addUniform _uniform;
_unit addVest _vest;
_unit addBackpack _backpack;
[_unit, _weapon, 5] call BIS_fnc_addWeapon;
_unit addHeadgear _headGear;
_unit addGoggles _goggles;
if there’s two arguments it would be
params [“_unit”,”_otherOne”]
so to make sure we are on the same pag
yeah assuming everything is defined above
This thing spawns units (agents) and by typing
params [“_unit”];
it magically knows that I want _unit to target that Agent?
_unit isnt defined anywhere else
so with params you’re telling it that whatever argument you call the function with gets turned into _unit
_unit can be anything
so params [“_unit”]; make whatever its called to the _unit?
SO whatever runs the function become the _unit?

params is anything you put in that arguments field
Yeah so
this call fn_myFunction
the "This" Is calling the fucntion so it becomes the _Unit no?
If you write [12345] call myFunction then _unit becomes 12345
“this” isn’t calling the function
It’s an argument
It’s the input for the function
it’s what you’re feeding it
Okay then what does "This" do then
if you put it in the units init field “this” represents the unit
so you’re inputting that unit to the function
Gotcha
it’s the same as writing the unit’s variable
Okay problem it didnt work
what are those quotes? 
write some systemchat lines in the function so you can see if it’s being called
oh I was missing a }; on the Description one sec
don’t ask me ask params
wat?
wat?
does that look like a string to you??
params [“_unit”];
vs
params ["_unit"];
“
fun fact Im getting an error with that Exact thing
which is?
well _uniform is not defined
it is
private _uniform = selectRandom [
"CUP_O_TKI_Khet_Partug_08",
"CUP_O_TKI_Khet_Partug_07",
"CUP_O_TKI_Khet_Partug_06",
"CUP_O_TKI_Khet_Partug_05",
"CUP_O_TKI_Khet_Partug_04",
"CUP_O_TKI_Khet_Partug_03",
"CUP_O_TKI_Khet_Partug_02",
"CUP_O_TKI_Khet_Partug_01"
];
ew
you might want to show the full code then
I don't see it defined in the previous code
says
params ["_unit"];
Invalid number expression
huh is there some way I can link the whole thing?
I was told by Lou not to drop alot lol
how are you calling this?
Function
one sec
using Civilian Presence Module
"Code on Unit created"
this call GH_fnc_civLoadouts
class CfgFunctions
{
class GH
{
class Loadouts
{
class civLoadouts {};
};
};
};
are you sure “this” works with the module
any docs on this module?
This 100% works
I don't think they have a this
one sec
it does one sec
I made it work with this but with setloadout (getloadout) etc
Lemme see if I still got it
OH
its _this
so
does that Params work with _this?
yeah
hmm got an error still
what error
Idk if this goes here or not.
But does anyone have any tips for ai inserting under fire?
...
...
...
_unit a...'
Error Invalid number in expression
Line 193
Like, AI usually flees or lands somewhere else away from the firefight, but I don't want that obviously.
if you know scripting, you could use BIS_fnc_unitPlay, or e.g setCombatBehaviour
is it bad to replace _unit with just _this
what you can do is you can type
systemChat str _unit;
after params and it’ll chat to you in-game what it thinks _unit is
Agents
All agents
Which is correct
wait
im confused
it works now
?????????????????????
some wrong save/load before testing perhaps ^^
Maybe, but like
that's what she said 😭
did you change the function file?
to add "systemChat str _unit;"
and the test before that, no?
Unless I thought I saved before but didnt?
ah well
yay 60 Agents roaming a city
welcome to Armagic
😄
Aren’t you glad you weren’t writing out all those arrays in the little module box
Honestly
I would've done WAY less in that
But because I had an array, I went WAy overboard on the Options lol
SO yes
Okay so now Ive got 2 new things to tackle
OOOOH IVE LEARNED SO MUHC,
I was just thinking, I want to make vehicles drive through and despawn once they leave the area.
I Know how to make an Array of Vehicles and pick a Random one now pog
Cheers everyone. Its time for sleep
'night! 👋
trying to make random waypoints, but I need a way to check that waypoints aren't put on top of each other. Is there a way to check if two arrays are or are not the same?
yes, isEqualTo
or you could remove the used array from the pool of arrays
ah thanks saved me from lot of for loop shenanigans
i didn't see multidimensional arrays in the wiki examples nor do they mention it(position coordinates are arrays themselves). Is multidimensional arrays possible in arma scripting?
yes of course 🙂
private _arrayLv2 = ["array"];
private _arrayLv1 = [["arrayLv2 v1", "v2", "v3"], _arrayLv2, _arrayLv2, ["lol"]];
```etc
i see thanks
anyway to change colorBackgroundActive of a button
via scripting
or does anyone know a workaround
or a way in config or scripting to remove the hovering (colorBackgroundActive) color altogether would work
Just set it to the same color as the normal background color?
I need to change the normal background color dynamically however
but you can't change the focus color dynamically
Use a non button UI class and use a mouseDown eventhandler to make it a button?
Just an RscText and shape it like a button?
I don't do dialog very often sorry
But what are you doing that requires a dynamic hover color?
its not dynamic hover color per say
I wanted to remove hover color altogether
one solution to that would be have it dynamic so I can set it to whatevers underneath
which would give the impression it is removed
So you just what a clickable that doesn't do any thing that a button does? Yeah, just use a CT_TEXT with an eventhandler.
Yea exactly
It basically just needs to change color as soon as its clicked
it was just a square
CT_Static = RscText but just don't give it any text.
And give it an onMouseDown UI eventhandler. That will react to buttons clicks.
cheers man
Np
How would I go about making a script where it'd set the hitpoint damage for all of a players' body parts using a saved getAllHitPointsDamage array. I found similar cases but they all seemed to have a little bit of a difference and I'm not confident in my ability to fit them to the needed purpose.
You can use a forEach loop on the saved array (the 3rd array, i.e. select 2) and use setHitIndex with _forEachIndex
Hang on, it couldn't have been as simple as:
{
player setHitIndex [_forEachIndex, _x]
} forEach _hitDamage select 2;
Huh, it seemed to work for a second there.
Oh right, there we go, of course it needed to be (_hitDamage select 2), I must've accidentally put in the wrong one after already having it right.
Create an invisible man instead
Good evening!
Could you help me, please?
I trying to check if player stay on the top of the vehicle.
Tryed to do it with boundingBoxReal and worldToModelVisual, but it looks not so good
Is exists any another way to check this condition?
Edited
Find solution - done it with:
https://community.bistudio.com/wiki/lineIntersectsWith
so nope, not through script
There is a vanilla soldier that is invisible
Theres technically 2 ways to do with with script
VirtualMan_F
Use lineIntersectsSurfaces
The other way is really hacky and relies on an existing bug with setPos and bipods
but why not lineIntersectsWith? I mean - looks like this one works good
surfaces one is more flexible
not sure which LOD the with one uses, but using the GEOM LOD in surfaces variant can easily double the performance (the GEOM lod is typically the simplest lod in all models)
understood, thank you!
Hiya, im trying to set the animation of a simple object in the form of a player model. Its giving a generic error
_d = typeOf _x;
_p = getPosASL _x;
_p = _p vectorAdd [0,0,1];
_t = getObjectTextures _x;
_as = animationState _x;
_s = createSimpleObject [_d,_p];
_s setObjectTextureGlobal [0, _t select 0];
_s setObjectTextureGlobal [1, _t select 1];
[_s,["","",0,0,[_as, 0.5]]] call BIS_fnc_adjustSimpleObject;
_x is part of a foreach for an enemy ai
All the variables that are used are set in that code chunk I sent, I dont know what you mean by they arent helpful
is it maybe because im using "createSimpleObject" and not "BIS_fnc_createSimpleObject"?
Dunno, your code generally looks okay.
add some debug_log after each line to see where it fails
Its failing with the last line, everything else completes successfully and outputs cleanly
Simple objects don't support rtm anims (tho this has nothing to do with your error)
do they support any kind? The simple object spawns t-posed which makes sense, I was hoping to switch it to a standard standing with rifle pose instead
No. Only model animations
something like this?
_tank animate ["Wheel_podkoloL6", 0.5, true];```
Yes. But characters don't have such animations
is there a way to check if a magazine is compatible with a given weapon?
Use BIS_fnc_compatibleMagazines
does this work with all modded mags aswell or just basegame?
All
nice, thanks a lot
Question... if I put the GM6 Lynx sniper on a autonomous turret is there a way I can enable zeroing on it? (Using ACE on the server)
Has setAnimSpeedCoef gotten changed in a recent update? It no longer seems to have a lasting effect anymore causing me to have to use a while loop that keeps executing it which I don't remember being the case previously
do you mean setAnimSpeedCoef
how long does it last
for me it has lasted at least a minute now
perhaps you are using a mod that uses setAnimSpeedCoef
?
Yes
Less than a second
Loading up an almost clean arma gives the same result
vaaanilla? 👀
my unit has kept its animSpeedCoef for 25 minutes now
Just loaded up vanilla and tested and it works fine
pain
Loaded up cba and ace only and now it no longer works
So there is a line of code somewhere in this composition that is faulty and I need to delete it, is there a way that I can search for this line of code with out having to check every object for it?
Yup, ACE uses it: https://github.com/acemod/ACE3/search?q=setAnimSpeedCoef
ACE uses it for its stamina system
save as not binarized and open mission.sqm in text editor
I wanna say I know how to do that but Im very technology stupid
Nvm I just accidentally clicked on an object and found the line of code 😂😂😂
It’s my lucky day
How does Arma clean up weapon holders when deleting corpses?
It seems to tied to the corpse somehow - I'd like to know if I can access that information and manipulate it?
can someone explain to me how i can find the projectile of say a turret etc
maybe with the fired eh: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
yeah but dont you need the projectile name for "_projectile" for it to work?
No. If you use params as shown on the linked page, the local variable _projectile contains the projectile object.
I'm trying to use the location of a trigger that's being used to run a script in the script to spawn AI at - how do I do this? I swear I've seen it somewhere and can't remember how to set it up, it was something like
Trigger OnAct:
[_thistrigger] execVM "randomEncounter.sqf";
In randomEncounter.sqf:
params ["_thisTrigger"];
_pos = [_thisTrigger, 0, 25, 50, 0, 0.4, 0] call BIS_fnc_findSafePos;
_grp01 = [_pos, west, (configfile >> "CfgGroups" >> "West" >> "rhs_faction_usarmy_wd" >> "rhs_group_nato_usarmy_wd_infantry" >> "rhs_group_nato_usarmy_wd_infantry_team")] call BIS_fnc_spawnGroup;
Try with [thisTrigger] execVM "randomEncounter.sqf"; 🙂
ahhh it works, thank you!
Didn't the game complain about the undefined variable (_thistrigger)?
Does worldToScreen work in multiplayer?
it did, I'm just a newb when it comes specifically to setting up params - i've read the documentation like fifty times but don't really get it lmao
if your user has an interface, so everyone except dedi server and HC
The player are on a dedicated server, but are actual clients connected. Would that work? A note with that too, if that player were to control a drone, would the worldToScreen then correctly change to the view they have with the drone?
it will work for the players but not for the dedicated server itself. about the second one: I am not too sure but I don't think so. test it
hmm, I dont think I know this enough to follow why the dedicated server would even be able to see it. Does that mean the actions performed by worldToScreen can only happen clientside and nothing can affect the server?
no i mean that the dedicated server has no "screen"
so ofc worldToScreen will not work
the dedicated server is its own instance, just like a client/player is
ah ok, thankyou!
how can I make a trigger wait for a condition to be set by the script that the trigger runs? I have this in the triggers onAct:
[thisTrigger] execVM "randomEncounter.sqf";
How can I make the trigger wait until the script is done to repeat?
if I have this in the trigger Condition:
this && rndEncVar
and this in onAct:
handle = [thisTrigger] execVM "randomEncounter.sqf";
rndEncVar = false;
null = [] spawn { waitUntil { scriptDone handle }; rndEncVar = true};
How/where can I declare the rndEncVar variable so that it starts true and the trigger can be triggered when the player enters it, and then it waits until the script to be done to set rndEncVar back to true?
You could declare rndEncVar = false in the init.sqf so it may be accessible by the trigger
hrm, it would need to be true for the condition instead of false but that might work
I have two respawnPoints, Respawn Point A and Respawn Point B.
I have a bunch of code in onPlayerRespawn.sqf that runs when a player respawns in either Respawn Point A or Respawn Point B.
However, I want to run new code when a player respawns at Respawn Point A but not when they're at Respawn Point B. Any ideas how to this?
if (_playerPos inArea) { yourcode } is cheap way, but perhaps you can also get the "control" (gui widget) that selects the respawn point and add a callback to the respawn button with your code
Does onPlayerRespawn.sqf run before or after a player respawns?
I would say after because event listeners get the event message after the event.
Then I'll try the cheap method. Thanks
i have a question about BIS_fnc_holdactionadd
i have this command set up in a script that is run on every client
_Medic_action = [player,
"Use Medikit",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"alive _target && 'Medikit' in itemcargo _this && damage _target >= 0.05 && (typeOf _this) == 'B_medic_F'",
"alive _target && alive _caller && 'Medikit' in itemcargo _this ",
{if ((typeOf _caller) == "B_medic_F") then [{
_caller switchMove 'AinvPknlMstpSlayWrflDnon_medic'
},
{_caller switchMove 'AinvPknlMstpSlayWrflDnon_medicOther'}];
},
nil,
{_target setdamage 0;},
{_caller switchMove 'AinvPknlMstpSlayWrflDnon_AmovPknlMstpSrasWrflDnon'},
[],
6,
999,
false,
false,
true
] call BIS_fnc_holdActionAdd;
it was working but after changing some irrelevant data it doesn't.
it only works for the unit with the classname of "B_medic_F"
i have tried getting this to run seperatly in onplayerrespawn.sqf WITH respawnOnStart = 0; in description.ext.
it used to show up for every player but now it only shows up if the B_medic_F is injured
right after this i have a switch that applies certain commands to units, but i moved this out of there because i needed the action on every unit
is there something im missing? does the command need to be executed on the server for each unit in the playable units?
is there a way to attach a trigger to a unit
to what end?
Attaching a trigger to a AI to move past the players so they all have a script go off when in a stationary position. Or i may save the trigger as a custom composition and see if placing it on the units will set it off
so you are trying to check if players are moving in proximity to the ai?
worldToScreen is proving to be incredibly inaccurate to what is on screen and doesnt relate to fov/zoom in any way. Despite my best efforts I cant find a way to adjust the bound of wordToScreen, or impact the safezones. Im trying to efficiently determine whether or not something is in view depending on what the player can actually see, like based on getObjectFOV.
Maybe I can create a virtual square on the screen and change its size based on fov, and then do worldtoscreen or something
I guess a question to go with that, is can I create a hud element placed at the x and y that worldToScreen creates so that I can see if the output is accurate or not??
Kind of, the starting size need to match the players fov though
only thing i can think of is an empty text box
I'm having trouble getting 'Agents' From Civilian Presence Module to run.
They all walk be default.
I tried using setSpeedMode But I believe that Requires a Group and if I recall correctly 'Agents' are empty and arent a Unit nor in a Group,
Any ideas on how to force them into Running/Jogging?
Noticed there was a forceWalk but no forceSprint
they run if you pull a gun...
lol I want them by Default to run
iirc they flee to cover position
I have a town of Agents making the town feel alive. I want some to jog some to run. Gives a bit of Randomness. This way enemy Players can Blend in more
hey, I want to execute a simple code when the player presses "ALT+LMB" combo. I read a bit on BIKI but couldn't manage to write the code
https://community.bistudio.com/wiki/inputMouse
This perhaps. Note that it's not available in 2.06
https://community.bistudio.com/wiki/addUserActionEventHandler
Maybe. I don't know if this suits
will take a look thanks
Question. I added the GM6 Lynx Sniper to a autonomous turret (nato) but I can't zero with it. Is there a script to add zeroing?
Or am I SOL?
okay so im having a slight issue and i dont know how i can do it and im completly lost on how to make it work.
what im trying to do is im trying to let players shoot stationary artillery with a addaction. only issue is the projectiles of the artillery hit waaaay to close and i intend it to shoot near the player but it wont reach so my solution was for it to drop a bomb in a 500m radius around a random player. but i just cant find a way to delete the artillery projectile
deleteVehicle
so deleteVehicle _projectile ? thats legit all i could figure out so far and im not even sure if thats how it works
yup
so thats it? no eventhandler nothing just deleteVehicle _projectile in the init?
ah, no
not in the init 😄
what I don't get is why do you want to fire but not fire but create but delete
in human words, outside scripting; what effect do you want?
okay so basicly im trying to make it fire. but delete the projectile
so i can then use a whole seperate script to just "simulate" artillery fire around the player
im trying to make it fire. but delete the projectile
no, that's not what you want 😄
is there a better way?
what you want is a shot to happen that would not hurt players 😉 I mean, in the goal you are trying to accomplish 🙂
but most likely, yes, that's how we are going to proceed 😄
add a fired Event Handler, delete projectile, and spawn a script that will create an artillery shell near player(s) 🙂
do you maybe have a quick example? because i tried my best and the params confused the hell out of me on the community page 🙃
Hmm, wat? Isn't that an infantry weapon?
Yeah but using the addWeapon script I added it to the Nato autonomous turret (trying to make a remote sniper rifle for a mission like they used in COD Ghost)
I've never seen an infantry weapon added to a vehicle 
Well I mean.... I did it
if (isServer) then
{
this addEventHandler ["Fired", {
params ["", "", "", "", "", "", "_projectile"];
deleteVehicle _projectile;
}];
};
thank you very much i appreciate it more than you know
un1 addWeapon "srifle_GM6_F";
un1 being the name if the remote sniper
Wouldn't it be easier (and perhaps cooler) to just make the artillery shoot somewhere next to instead of at the target?
yeah thats the plan, so it doesnt directly hit the player just around them. i dont intend to kill them off, would be kinda unfair in a pvp scenario :P
I don't see what you're asking
You've clearly told the script to only show the action for B_medic_f
Also, _this is not defined for the progress condition (according to the wiki)
Also you're using _target and other variables in the codes without having defined them
or maybe i just had a big brain moment i dont know what exactly you meant lmao
I meant doing something like this ...
private _pos = getPosASL TargetPlayer;
//Find a random position, between 100 and 200 meters away from _pos:
_pos = _pos getPos [100 + random 100, random 360];
Artillery doArtilleryFire [_pos, AmmoType, 1];
```... instead of deleting the projectile and simulating the impact.
vectorAdd
is there a way to make an uniform randomizer spawn in uniforms with ammo in them?
Like on the ground?
Well there's an issue. You're right about _this not being defined in the condition for progress, that should definitely be _caller.
_Target is a special variable that is assigned inside of bis_fnc_holdactionadd to refer specifically to the object the action is attached to.
_this and _caller are also special variables assigned from the function.
I think the issue I have been having is related to locality.
I kinda got it working. It seems stable but the start condition is starting to grow to the point it might have to be defined as a function, but that's for another time.
My current solution is to keep the medic_action local to the medic instead of assigned to each player, using cursorObject instead of _target, and a terrible idea I had was for the cursor object to be captured in a variable during the start code and using that variable with {command, variables} remoteExec ["command" , 0, false];
Seems to be stable. I will paste the code later. I'm at work.
_this and _caller are also special variables assigned from the function.
I'm not talking about the conditions. I'm talking about the codes
they are not defined in the codes
well except for _this ofc
nah on ai
aka when you place down a group it randomizes their uniforms but still keep the ammo for their guns
What's really got me wierded out is the code worked for what it was supposed to do
I see I should have defined the variables passed to the script with Params, right?
yes
at least according to the wiki (and my personal experience) it doesn't define those variables. that's why the wiki shows params. otherwise it would just mention them as "special variables"
Isn't that for passing the arguments though? I thought the arguments could be used to redefine what each of the variables are
it is
they're not predefined
it just passes you an array and it's up to you to handle it
Then I'm really curious why it did work. What is happening inside of bis_fnc_holdactionadd;
¯_(ツ)_/¯
_caller, _this, and _target never had to be defined with Params for the conditions. Is the variable left open for the script too?
either the wiki's wrong and those are special variables (predefined), or you're wrong and it didn't work
conditionProgress:...
Special arguments passed to the code: _target, _caller, _id, _argumentscodeStart: Code - Code executed when action starts. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"];
🤷♂️ I have this working now and I never defined the variables
Hang on I just got home, let me get the baby set, and I'll log in and get that code
the code for the holdaction contains a call to the function so any variables defined in the outer scope are also available in the call
that's probably why it worked without params?
if that's how it's written then that's definitely it
yeah:
params
[
["_target",objNull,[objNull]],
["_caller",objNull,[objNull]],
["_actionID",10,[123]],
["_arguments",[],[[]]]
];
...
[_target,_caller,_actionID,_arguments] call _codeStart;

So _caller & _target really is available as a var in the code sections?
yes
So in other words I got lucky with my noob mistake of not defining Params
yes
confused about what modelPos param is in "obj modelToWorldWorld modelPos". I assumed modelToWorldWorld would be equal to selectionPos vectorDiff _vehiclePosASL.
vectorAdd rather. e.g., if vehicle is at 100,100,0 and selection is 1 meter up, selection asl would be 100,100,1.
not necessarily. depends on object's orientation
in what you said you just assumed the vehicle was upright
if it was upside down it would be 1 meter lower
so is modelPos just an offset? selectionPosition modelToWorldWorld [0,0,0] would be the plain ASL of selection?
that's wrong
the command format is OBJECT modelToWorldWorld ARRAY(pos)
what you meant was _obj modelToWorldWorld (_obj selectionPosition "selection")
so if selection is part of a tank, object would be the tank
yes
selection is the name of the bone in the model
and modelPos is its relative position (in model coordinates)
Is there a command to check what scope a player has on their gun like the currentWeapon command returns the gun that the player has?
I have had a look in the weapons group but can't find anything
it doesn't provide magazine though
is there any way of extracting the ASL pos of a marker ?
the extra param for getMarkerPos returns Z, but in the form of AGL/ASLW, but those pesky waves are messing things up ....
did you try aglToAsl?
so? an AGL pos is dynamic too
according to the Biki, PositionAGL is the same as PositionASLW
it's not
only on water they're the same
plus that has nothing to do with AGLtoASL
yes sorry, over water, Z is the same as ASLW
in what way is it messing up?
AGLtoASL should always give the same Z
the problem is, my marker is over water, and with getMarkerPos we get AGL, which is ASLW
I told you. there's no problem. just try AGLtoASL instead of guessing stuff
an AGL pos is dynamic
so when you convert it to ASL the wave effect will go away
also this means you have to get the marker pos every time
not just get it once and save it into a variable
yes
Does anyone know a good way to ensure that an AI unit in a custom faction always spawns with a certain goggle slot item? Instead of randomized.
The units are created in ALiVE orbat and then spawned in zeus.
anyone here got sog pf that can test something for me?
When I'm doing getLightingAt player anywhere on the Khe Sanh map, I get VERY high brightness values, when previously it's been between 0-1
it's returning [[0.947977,0.944228,1],1500.93,[0,0,0],0] when I expect it to be like, 0.5 or something.
"Very high brightness" is not unusual. Arma uses HDR, so it doesn't care about the absolute brightness value
interesting. how would I get just an idea of how bright it is at a player then?
What is the end goal? That might help to assess if your method is correct.
@young current basically how bright it is taking into account overcast/time of day/rain/etc. worst case I can just use time of day + overcast + rain and merge them together myself though
Ye but I mean you use it for something I'd assume
@young current set camo value dynamically
so dont ask why
but i decided i wanted an array of every helmet
and i'd like to ask
why does every helmet class have a Headgear_H_ prefix rather than just H_?
let me find an example
so if I want to give the player a combat helmet it would be player addHeadgear "H_HelmetB" but in the config viewer it's listed as Headgear_H_HelmetB
Wrong, CfgVehicles is not CfgWeapons
oh damn
that would be the issue
I'm looking in the wrong place
thanks 👍
why is it listed in both?
One as placeable object, one as the equipment
i see
is there a config entry to indicate that it's headgear?
or would I go off of the prefix?
Name of a config never means anything but a value indicates
_helmets = "getText (_x >> 'vehicleClass') == 'ItemsHeadgear'"
I don't recall which value of CfgWeapons entry does
but i decided i wanted an array of every helmet
Means something you can use withaddHeadgearright?
yes
Secs plez
_helmets = "getText (_x >> 'vehicleClass') == 'ItemsHeadgear'"
configClasses (configFile >> "CfgVehicles");
{
_helmets set [_forEachIndex, configName _x select [9]]
} forEach _helmets;
player addHeadgear (selectRandom _helmets);
This works but I should probably get CfgWeapons figured out if I'm going this route
also mods are a thing
"getNumber (_x >> 'ItemInfo' >> 'type') == 605 and getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgWeapons") apply {configName _x}```
Yeah that's a godsend
thanks for the help, config stuff is daunting
if ((uniform _unit == "U_I_CombatUniform") || (uniform _unit == "U_I_CombatUniform_shortsleeve"))
any way to shorten this?
say I wanted it to be 5 different uniforms, would each of those conditions need to be written out?
or since it's the same uniform check can it be abbreviated?
if ((_a == _b)||(_a == _c)||(_a == _d)||(_a == _e)||(_a ==...
what I mean is could this be condensed?
oh i see
i got confused because i already did ```sqf
if ( "U_I_CombatUniform" in (uniform _unit))
i was so close yet so far
thanks sharp
and polpox
again
Anytime
Getting an Error with the _unit forceSpeed _civSpeed; Line
Doesnt like me using a Var instead of a Straight Number. What did I do wrong?
params ["_unit"];
private _civSpeed = selectRandom ["1","3","5"];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
_civSpeed is a string than a number
How do I change that?
private _civSpeed = selectRandom [1,3,5];```
Not sure if forceSpeed even works for units tho
Using it for Agents
Ive tested it, it works just failed at getting that Var to work. Awesome so Quotes mean "this text" while no quotes mean the value of it. Thanks
https://community.bistudio.com/wiki/Category:Data_Types
For more info about string and others
Thanks
Huh, quite confused now. No errors.
But the Agents still spawn with forcewalk true Using a Civilian Presence Module spawners etc.
I currently have the Agents getting random kits and those are working perfectly. So I know "_unit" Is targeting them.
Strangely still this code isnt turning "forceWalk" Off
params ["_unit"];
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
Cut the rest out
If I run this on the Agent Directly in the Execute box. It works. but through my Function through the "Civilian Presence" "Code On Unit Created" It wont work.
Again, the rest of the code regarding What clothing what Guns they spawn with are in the Exact same Config. So That all works. But for some reason, these few lines dont run?
Maybe the effect of those lines is undone by something that is executed after the On Unit Created code (for example the code that orchestrates the civilian presence behaviour).
Ah, I did notice by default Agents are "forceWalk true" How would I counter that then?
Only thing I can think of is Label each new Agent with some Variable and if they have it Then run the script above.
Once Script is done then Remove Variable.
But I assume there is a easier way?
Going to be heading to sleep so if anyone figures it out please at me
in your server init you can write ```sqf
GH_allAgents = [];
and in your "Code on unit created"
```sqf
GH_allAgents pushBack _this;
This should give you an array of all agents spawned with the module.
{_unit = _x;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;} forEach GH_allAgents;
try running this after you spawn the agents
Is it possible to have a player select an option through addAction command when they are in a camera POV? (not their player's camera, another camera object)
for example when I do
cam1 switchCamera "INTERNAL";
I want them to be able to select options through the mouse wheel menu, but when I switch them the player basically loses all elements of control over the mouse wheel selection menu (they still can move their player obviously), is it possible to have a work around?
Control over the unit is not given to the player. Use selectPlayer or a combination of switchCamera and remoteControl to achieve this.
that if its an AI unit right?
you’ll have to try it
what I meant was if you are switched to camera, not an AI unit
If it doesn’t work with the camera you can disable simulation on an ai
thanks
it worked
Hello, I'm struggling with the say3D execution in MP it's not heard by other players...
Is there a trick to make it audible in MP ?
// File: rcc_zeus_soundbox.sqf
// Parameters _unit, _prefixSoundName, _maxCount
//
// spawn Say3D sound russian dialog version
//
params ["_this"];
private _pos = _this select 0;
private _unit = _this select 1;
//if unit is empty/null/player, exit
if (isNull _unit || !(_unit isKindOf "CAManBase") || isPlayer _unit) exitWith {
systemChat "Selection not valid";
};
RCC_fnc_sayDialog = {
params ["_unit"];
private _count = missionNamespace getVariable "CountSound";
private _soundName = "";
private _prefixSoundName = "RussianDialog";
private _maxCount = 11; // value to define according to number of soundVariations
if (_count >= _maxCount) then {
_count = 0;
systemChat str "Restart soundbox";
} else {
_count = _count + 1;
};
missionNamespace setVariable ["CountSound", _count, true];
_soundName = [_prefixSoundName, _count] joinString "";
_unit say3D _soundName;
};
["zen_common_execute", [RCC_fnc_sayDialog, [_unit]], _unit] call CBA_fnc_targetEvent;
Thanks...
You must use remoteExec for that command
See:
https://community.bistudio.com/wiki/Multiplayer_Scripting
But CBA_fnc_targetEvent is supposed to do the same
idk what it does
¯\_(ツ)_/¯
But if you don't hear the say3D then the problem is obviously the locality
You're only targeting the _unit's computer
That's why
alright, thanks
I think I have a logic error: I want to enable a trigger for friendly people to a side:
Condition:
{[west, side (group _x)] call BIS_fnc_sideIsEnemy} count thisList == 0```
Activiation:
```sqf
{[_x] call ace_medical_treatment_fnc_fullHealLocal} forEach thisList;```
however the trigger is not firing. I guess my condition is the issue here
init.sqf
if (isServer) then {
setTimeMultiplier 120;
};
Not sure why it's not working in multiplayer
works for me, did you try to execute after server is properly started ?
initServer.sqf```sqf
sleep 0.1; // perhaps needed
setTimeMultiplier 120;
ty, with added sleep all working great!
First of all, not enemy doesn't mean friendly
Second of all, that trigger will be active even if no one is present, and if that's the case, it will never fire again
And third of all, you can't do what you want with a trigger alone
What is needed then? What's the trigger limitiation?
Quick question; if you do player action...
Will it always work even if the player cant perform the action themselves in normal circumstances?
i.e is it forced
What player actions are you taking about? 
When a trigger activates, it won't reactivate until it deactivates...
Which means if one unit activates the trigger and stays there, the trigger won't activate for the rest of units
that is true
Some do, some don't
sleep 20;
setTimeMultiplier 120;
while {true} do {
sleep 140;
0 setOvercast 1;
0 setRain 1;
forceWeatherChange;
};
this code correct (maintain good weather)?
initServer.sqf
you are setting it to rain
🤦🏼♂️
I'd say
sleep 1;
setTimeMultiplier 120;
[] spawn {
while { true } do
{
0 setOvercast 0;
0 setRain 0;
forceWeatherChange;
3600 setOvercast 0;
3600 setRain 0;
sleep 3600;
};
although, rain cannot happen if overcast is not > 0.7 so you should be safe
just setOvercast should be enough
0.5* according to the wiki https://community.bistudio.com/wiki/setRain
well wdym with "rest of units". The activation clearly affects everyone on thisList does it not? Therefore if the condition is met, it will fire and executes that ace command on the thisList array
Do all units walk into the trigger at once?
ofc not
yes, I might also need to add that the trigger has a delay of 20 seconds before activating.
but I got your point now
probably an often asked question, but how do you add an action to a vehicle so that only someone in the drivers seat can use said action?
this addAction["an action",
{
hint "1";
},
nil,
1.5,
true,
true,
"",
"{(driver _target) isEqualTo _this}"];```
does not seem to work
looks like a typo in condition {
mustve deleted that bracket copying into discord.
I would try without the brackets
that did it, thx
Is there a way to store files on a dedicated server and call them during the mission?
Hi, is it possible to make BIS_fnc_EXP_camp_playSubtitles work in tandem with an audio source for dialogue at the same time? I'm trying to see if there's a way to use subtitles with audio in a clean way like "player say"/"playsound" where titles[] is played and called at the same time the audio is, but instead I want to use the BIS_fnc subtitles.
only with an extension
hi, sorry for late reply, this is not possible. If player once gets marked as teamkiller, he stays like that until he reconnects, because regaining positive rating won't put him back into blufor side
You know what extension that would be?
Ty
Hello! Can someone assist please? Players on my server are getting (as part of the mission) marked as teamkillers. But this causes problems. Disabling negative points or adding to players big score doesn't work. So i would like to make a script, that will pop a message and/or play a sound in loop to those, who become teamkillers
so far i know, that a teamkiller is probably in this group: https://community.bistudio.com/wiki/sideEnemy
So is there a way to detect players who get into this group?
remove the rating, and move the player to a fresh blufor group
i'm not really sure what do you mean by that, this pretty much equalls to relog, i just want some script, that will let the player know "hey, you're a teamkiller now, go reconnect"
I'm not sure I entirely understand. I have a file that has functions within it and I normally just preprocess the file at the start of every mission but I'm looking for the server to save the functions. It seems like I need to use write and/or set but I don't really know how
Also I'm looking for the server to save audio files as well
Could I possibly get a short example of what it would look like if you were to save a file with a function and then call the function during the mission?
out of intrest how am i ment to use endLoadingScreen if i cant access the debug?
addMissionEventHandler ["EachFrame", {
if (rating player < 0 && side player isEqualTo sideEnemy) then {
_prevRating = rating player;
player addRating abs _prevRating;
private _group = createGroup [blufor, true];
[player] joinSilent _group;
};
}];
this is not really what i need but it gives me a lot of valuable information, i think i might be able to push myself forward from this point, thank you very much 🙂
it fixes your marked as teamkilling issue completely without causing a break in the gameplay loop
and this is supposed to go into init.sqf? or initPlayerLocal.sqf?
as it is currently written, initPlayerLocal
great, thank you i appreciate it
Why do some scripts check isServer?
Because it’s best performance wise unless you need to use something local
how is it different than sticking the code into initServer.sqf? Performance wise, that is
InitServer is a scheduled environment but sometimes you have code in an unscheduled environment that should only run on the server
that is misguided imo. performance doesn't matter as much when the mission hasn't even started yet
the real reason things check isServer is because sometimes the script is run on a local machine. for instance, lets say i want to create 50 units at the start of the game using init.sqf. If i don't do a isServer check, 50 units will spawn every single time a client loads the mission plus the server
@cold mica
or if you use a init box, those boxes are run every single time the mission is loaded on each machine, included on clients that are JIP so you can accidentally run your script much more than you want
oh cool. In that sense, it fulfills the same role as initServer.sqf
i wouldn't say same role. it fulfills its own role, especially for things that are not an init script
like mid mission scripts/functions
There's a handleRating event handler
Use handleRating EH
It feels like checkVisibility using the players eyes pos fails if they have any equipment on their head, like goggles or bino's in front of their face.. Is this really the case? I suppose I could just move the point a couple inches in front of the players face to fix this?
Also would this mean the model of the enemy im checking if I can see would also interfere with the calculation?
Edit: I guess I can add the enemy model to the ingore2 slot
^edit to this, it seems like its just when equipping binoculars that it breaks
After looking it seems the binocular command gives the string of the binocular I have equipped but not the object name. Is there a way to convert this string to an object name or to get the object name of the binoculars? Im thinking if I can get this then I can exclude it in the checkvisibility
no, as it is not an "object" per se
So checkVisibility is inherently broken when having binos equipped?
and theres nothing I can do to fix it?
you can offset the starting position yes
alright, thank!
I still have a problem with my code which uses the ACE Rearm Framework. Can somebody help me there? I took a look into the CBA Settings but didn´t found anything about rearm (as earlier suggested)
trg_1_1 setTriggerStatements["this", "[Munitionsauffueller_1, 666] call ace_rearm_fnc_setSupplyCount;",
"ammo_left = [Munitionsauffueller_1] call ace_rearm_fnc_getSupplyCount; hint str ammo_left;"];
the problem is that i always get -1 as "ammo_left" and i am now pretty sure that the getSupplyCount doesn´t work properly.. Does somebody know a solution or a workaround?
I will repeat what I said last time, if your rearm is set to unlimited then it will always return -1 as supplies are infinite.
ACE Logistics > Rearm > Ammunition supply
thank you very much. Last time i missread something. I looked at CBA But now it works. I would have never found that out. thank you 🙂
can anybody help me?
2:27:20 Error in expression <is_inFriendlySector",false];
}
forEach (bis_fnc_moduleSpawnAI_groupsWest + bis_f>
2:27:20 Error position: <bis_fnc_moduleSpawnAI_groupsWest + bis_f>
2:27:20 Error Undefined variable in expression: bis_fnc_modulespawnai_groupswest
2:27:20 File A3\Modules_F_Heli\Misc\Functions\ModuleSpawnAISectorTactic\main.sqf..., line 167```
for some reason i cant use ai sector tactic module, its broken
seems so
@vad1m4#9679
what?
if it is broken, you cannot use it
how do I fix it? I really need to use it
perhaps it needs other modules to work properly, idk
have you tried to google it?
what can I use instead to spawn ai and make them capture a sector?
yes, nobody seems to have the same issue
try without mods
see their documentation, I don't think such big mishapp' would happen
lets see a screenshot of how you set up your module
one second, I've reinstalled the mod
bis_fnc_moduleSpawnAI_groupsWest does not look like anything CBA
Where did I mess up here
Init ```sqf
GH_allAgents = [];
agentSpeed.sqf
```sqf
[] spawn {
while {true} do {
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
sleep random[1,5];
};
};
No errors just doesnt do anything
[player,
"Treat Unit",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"vehicle _this == _this && alive _this && alive cursorObject && lifeState cursorObject != 'INCAPACITATED' && group _this == group cursorObject && 'Medikit' in itemcargo _this && damage cursorObject >= 0.05 && (typeOf _this) == 'B_medic_F' && _this distance2D cursorObject <= 2.5",
"alive patient && _caller distance2D patient <= 2.5",
{[_caller,'AinvPknlMstpSlayWrflDnon_medicOther'] remoteExec ["switchmove", 0, false];
patient = cursorobject;
},
nil,
{patient setdamage 0;},
{[_caller,'AinvPknlMstpSlayWrflDnon_AmovPknlMstpSrasWrflDnon'] remoteExec ["switchmove", 0, false];},
[],
6,
999,
false,
false,
true
] call BIS_fnc_holdActionAdd;
heres that code from the other day
Make sure GH_allAgents actually has units in it and random is wrong, you need 1 random 5 if you want it inbetween two values
also you could just do [] spawn agentSpeed.sqf; instead of using spawn in the sqf
but that's only if everything in the file should be using spawn, but it doesn't really matter I think
question: does anyone know how i can check if western sahara dlc is currently enabled?
I've checked it does have units in it, if I run the Command in game via Debug Console (without While loop obviously and Sleep command) it works.
This works in the Debug
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
yeah bc the sleep was wrong
[] spawn agentSpeed.sqf;
{
while {true} do {
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
sleep 1;
};
};
I mean that doesnt work either
Should be:
Some Place | Example: initServer.sqf
[] spawn "agentSpeed.sqf";
agentSpeed.sqf
while {true} do {
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
sleep (1 random 5);
};
ah lemme try that
or
[] spawn {/*code here*/}
tried that didnt work either
yeah like I said it doesn't really matter which way you use spawn
[] spawn
{
while {true} do {
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [1,3,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
sleep 1;
};
};
``` No errors just doesnt work
on the phone, help u in a bit
cheers
Works for me
you're spawning them via Civilian presence module and it works?
nah just changed
_unit = selectRandom GH_allAgents;
to
_unit = man1; //Named Unit
how are you adding the agents to the GH_allAgents array
init.sqf
GH_allAgents = [];
and do you ever add any units to the array after that?
bc if not you are selecting nothing bc it's an empty array
an init is a one time thing
[Agent 0x1b5c0100,Agent 0x4fb3c0c0,Agent 0x4dc10100,Agent 0xdf668140,Agent 0x61490080,Agent 0x67e88100,Agent 0x41ee8180,Agent 0x674580c0,Agent 0x6f234140,Agent 0xb9c88080,Agent 0x61048100,Agent 0xa9f0a180,Agent 0x49dec0c0,Agent 0xd30fc140,Agent 0x6f2100c0,Agent 0x1c798140,Agent 0x41c1a140,Agent 0x702c6180,Agent 0x41d64180,Agent 0x1bf88180,Agent 0x619a0140,Agent 0x6794e0c0,Agent 0xfd38e1c0]
Okay so, how do I get it to keep updating? Add it to the loop then?
how are you creating the agents
why do you need to keep updating it? Does the number of units change?
Yes
Civilian prescene module
It spawns Agents in and deleted them over time depending on time/waypoints they get to
It basically recycles them
So what you need to do is run a while loop getting all civs in the radius of the module and add them to the list / reset the list
no, there is an expression box
^
that you can apply to each unit as they are spawned
oh there is?
Yes
never used it before, sorry about that
so you need to pushbackunique into the array
no. give me a few min, still on phone
k
GH_allAgents pushbackUnique _this;
well you need to remove them from the list when they are deleted right?
yes
GH_allAgents deleteAt (GH_allAgents find _this);
where would I put that
or
GH_allAgents=GH_allAgents-[_this];
not sure which one is more performant tho
code on unit deleted box
Shouldn't have to worry about performance tho
Alright so I must be doing a good somewhere Ill post it all one sec.
No errors still
Cone On Unit Created
_this call GH_fnc_civLoadouts;
GH_allAgents pushbackUnique _this;
Code On Unit Deleted
GH_allAgents=GH_allAgents-[_this];
agentSpeed.sqf
[] spawn
{
while {true} do {
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [5,5,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
sleep 1;
};
};
init.sqf
GH_allAgents = [];
It not work?
I dont see any Agents running
I even changed the speed to only run so if the code every hits them it should make them run
[5,5,5]
On a side note if the mission is multiplayer don't use init.sqf instead use initServer.sqf
ah good to know, currently in editor but it Will be Multiplayer so Ill move that over
Use hint str _unit in the code and see if a hint with a unit pops up
nothing
I checked the array
Plenty there
small cut of it [Agent 0xba6c8080,Agent 0xba84c0c0,Agent
oh interesting
So this hints nothing?
_unit = selectRandom GH_allAgents;
hint str _unit;
I slapped in into the agentSpeed
Turns out its not even running it looks like had it hint "1" each time it runs nothingf
Ill run that 1 sec
that works
in debug atleast
so
[] spawn
{
while {true} do {
_unit = selectRandom GH_allAgents;
private _civSpeed = selectRandom [5,5,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
hint str 1;
sleep 1;
};
};
Isnt even running it seems
I put that hint str 1 Doesnt come up at all
oh I just realized you never called the sqf
?
in initServer.sqf run [] call agentSpeed.sqf;
In the agentSpeed.sqf?
No from that line you sent
Initserver.sqf
GH_allAgents = [];
[] call agentSpeed.sqf;
error missing ; line 2
Sorry I'm very tired apparently and confusing your code with mine
XD all good
change call to execVM
There we go. Sorry it took longer
all good, so whats execVM do?
https://community.bistudio.com/wiki/execVM Check for yourself :)
Cheers!
Make sure to use the wiki a lot. It may solve many of your problems
Yeah, very new but I usually use it for a couple hours until Im at a lost before I come here
Thanks again
why ```sqf
while {true}
why not forEach
{
private _unit = _x
private _civSpeed = selectRandom [5,5,5];
_unit forceWalk false;
_unit forceSpeed _civSpeed;
} forEach GH_allAgents;
Because I want their speed to be able to be changed
changed how?
Like I want it to Randomly pick an Agent and change their speed even the same one over and over
The whole goal is for Taliban players to be able to blend in with Agents.
If I was only able to get the Agent to only Permanently Run then well, if the Players saw a Taliban Stop running and jog, Well thats a player
Unless im misunderstanding how forEach works?
forEach just executes the code for every element in the array
so i see how this example doesnt apply
Ah, that is good to know though
Currently im now on the Next plan. Making Vehicle Traffic. Which is becoming more difficult than the Agent stuff XD
Currently placed a few Map markers for Positions on map.
Basically going to get AI Vehicles to Drive to "parkSpots" and then sleep for X time and go pick another spot.
Though struggling on how to find out once they arrive to the end of "move"
wow, that exists huh
Thanks
Was about to go down the rabbit hole of "setDestination"
Check if any of its addons exist, using isClass
there are already a few civilian vehicle scripts you can plug into your mission. save you some time.
Currently trying to get Civilians to run Errands from their Homes, leave randomly, go to one of a few options and then stay there for a bit. come back and repeat.
This is my current Idea. Anyone have any better ideas?
if x random y time and no player nearby (short) then
_homeStand = getPos _this; //save current Standing Position and facing?
go to vehicle assigned //parked (Civ's Vehicle) (struggling with assigning)
once inside car save parkSpot
_homePark = getPos _this
_this move selectRandom["shop","friends house","work"];
on destination exit vehicle Loiter for x random y time and no player nearby (short) then
getPos of Vehicle
Move to vehicle
Once inside
_this move _homePark;
When unit ready, Exit
_this move _homeStand;
Repeat.
The reason is, This gamemode is Nato vs Taliban. both teams are Players.
Taliban are blending in as Civs. Ive got Civ Agents everywhere also with Civ Units that I as Zues can mess with.
I want a way for Taliban to be able to blend in with Vehicles.
So if I can set Certain homes up with cars. The cars leave come back. Then it'll make it harder for Nato to find the Talibans bases
Is it possible to add a sensor to a vehicle?
For example , I want a Littlebird with an active radar
When/where would be a good place to call createDiaryRecord in script to also show it on the map briefing? Basically the same way the module does it?
I tried initPlayerLocal.sqf and init.sqf but no luck
initPlayerLocal.sqf works fine for me.
I did a big facepalm
I was adding it to a non-existing subject
🤦♂️
player createDiarySubject ["radio_net", "Radio Net"]; // <-- was missing this
player createDiaryRecord ["radio_net", ["Radio Net", "This is my cool radio net"]];
they exist, they were introduced with Old Man
Hello everyone, I need help. I'm trying to add pylons to a helicopter from special categories ||(Like CAS, Ground Suppression, etc)||.
I get categories like this:
private _pylons = "true" configClasses (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Presets") apply { configName _x }; // getting the category names
private _pylonsData = _pylons apply { getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Presets" >> _x >> "attachment") }; // getting an array of pylons from these categories
And then in the script I add them to the helicopter like this:
_pylonsData = _pylonsData select _selectedIndex;
{
_vehicle setPylonLoadout [_forEachIndex, _x];
} forEach _pylonsData;
But the problem is that with such an addition, the pylons may become completely out of place, for example, they should be under the wing, but they become above it.
Does anyone have any ideas on how to adequately add pylons so that they are normally attached to their places?
I am not on PC, but try the wiki
Hey folks, I need to make a script for an m1 carbine so if I attach a weapon attachment which has a fore-grip (an M3 Infra red night scope) I swap out the weapon for one with the right hand animation so the unit is grabbing the foregrip rather than the furniture.
What would be the best way to go about this in terms of which event handlers to use? Off the top of my head I see it being relevant to check on init & InventoryClosed, but curious if there's anywhere else that could catch me out where the attachment could change
Not via scripting
aw that's quite sad
They're in cfgMagazines iirc. Use config viewer to find them
Their names are pretty obvious too. E.g item_money iirc was for money
try
Land_MoneyBills_01_bunch_F
Land_MoneyBills_01_roll_F
Land_MoneyBills_01_stack_F
?
found in https://community.bistudio.com/wiki/Arma_3:_CfgVehicles_EMPTY
(weirdly)
These are not the items tho... 
I tried 
Items are never in cfgAmmo 
This can't be done via scripts to begin with (custom animations)
I don't think I explained myself well - I will be switching out the weapon class for one that has a different handanim
I have that side of it in hand, I'm more curious about best approach to triggering when to do it
There's really no best approach when it comes to inventory related scripts
E.g if you use inventoryClosed, etc. that won't cover the case where the unit attaches the item via Arsenal
or scripts
Don't attachments have some sort of EH themselves?
for mounting/unmouting? 
oh that's interesting
On the other hand if you use a constant check, e.g. eachFrame EH you can cover all cases, but that has more performance impact
yeah that's not preferable
I wonder if I just put it on the init for the weapon attachment if that will do it
I'm more interested in catching when it's been attached to change it out, I doubt players will very often remove it
Oh how I wish we had events for basically everything in dayz
is it possible to hide foilage ingame just like in eden with "CTRL+G"? I read that it cant be done due to technical limitations yet curious
setTerrainGrid iirc does that
I recall setTerrainGrid just gets rid of grass
CTRL+G removes leaves from trees and bushes as well
this may be the single dumbest question i've ever suggested, but can i have a recursively defined variable?
like for example
if i had a value i wanted to change when an object was hit with a bullet, relative to itself, decreasing by the damage amount?
wait, nevermind. i had an idea that should achieve the same result
no
Like val = val - damageAmount?
basically, yeah
Hello!
I would like to make a script for locking and unlocking vehicles but i found several scripts for that on wiki so i would like to ask, which one is the best for use. I found these three as the most suitable:
https://community.bistudio.com/wiki/lock
https://community.bistudio.com/wiki/setVehicleLock
https://community.bistudio.com/wiki/lockCargo
So far what i see, lock and setVehicleLock are identical scripts (do the same thing) - the only difference is in possible states where lock can be just locked/unlocked and setVehicleLock can be "UNLOCKED" "DEFAULT" "LOCKED" "LOCKEDPLAYER". Basically i need to lock a vehicle so that the player won't be able to get in. On the other hand i use ACE mod and ace allows interactions with vehicles and therefore i think, that ace can allow players to get into locked vehicles (judging by lock description that says "...but will not stop player getting into or out of vehicle via script commands... ") So here comes the lockCargo do i understand it correctly, that lockCargo does exactly the same thing as lock and setVehicleLock but in addition to it, it also prevents players from getting in via script (ace) ? So is lockCargo the best to use or am i wrong and i should use some other script? Thanks for help.
Afaik ACE does check if vehicle is locked
well so how do i solve this?
Solve what?
Like I said, ACE does check lock status
lock/setVehicleLock is the first thing you should try
fair enough, it seems like i'll have to go for old fashioned trial and error, but thanks for the information
anyone know how to add a cooldown to an action added with addAction?
idea I've been running with so far is the following function
Mission_fnc_canUse = {
params ["_target"];
private _cooldown = 180;
private _canSpawn = false;
private _current = time;
private _last = _target getVariable ["Mission_lastActionTime", -1e9];
if (_last + _cooldown < _current) then {
_target setVariable ["Mission_lastActionTime", _current];
_canSpawn = true;
};
_canSpawn
};
and then doing
"[_target] call canUse"
as the addAction Condition, but it doesn't show up.
hello @little raptor sorry for bothering, i just wanted to tell you what i found out about those scripts:
lockCargo locks all seats in vehicle except driver seat
lock and setVehicleLock work identically and lock all seats including driver seat
all three of them disable ace interactions with the vehicle, if set to locked
Thank you for your help and patience, i hope this helped you at least a little 🙂
@low remnant I would just set variable when the action is used.
// Init this somewhere:
lastActUsedTime = -1e9;
// Set when action is used:
lastActUsedTime = time;
// Then check for cooldown:
if((time - lastActUsedTime) >= 180) then
{
// Action can be used again
};
anyone have any suggestions on how to make it so I can load the sog pf bicycles into a cargo vehicle?
so set the variable within the actions code itself and init it on the object its placed on?
my example uses global variable...
edited my post a bit
where do i init global variables? can i do it on the object?
init.sqf for example
and there is no other way? cause if i wanted to have multiple instances i'd have to add a seperate global var for each object
you can add multiple addactions that use the same cooldown variable but if you want each object have it's own cooldown then use your code instead of mine. Hope I was able to show you some new stuff here
well the trouble is my code doesnt work
that's because you use setVariable in the condition. you should only set that once the action is triggered
...cause it continually evaluates of course 🤦
yes
Hello sir. I found this message while searching for "car radio". Figured I shouldn't reinvent the wheel and bother people here for help. Did you ever get it working properlY?
lockCargo only locks cargo seats
for driver use lockDriver
for gunner/ffv use lockTurret
does anyone know if there is a script name for enabeling and disabeling the "show model" on objects?
i guess this is what you're looking for
https://community.bistudio.com/wiki/hideObjectGlobal
I'll test it out, thanks
so im trying to make a script for teleporting all players to a position after the trigger is activated. Trying to fade to black, teleport, change to night, then fade back in. Thought i had it figured out but i guess not
what do you have rn?
right now I have a old script im trying to repurpose for the fading into/out of black
one sec
if (isServer) then {
[] spawn {
[0, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
sleep 6;
private _pos = getPosATL c2;
deleteVehicle c2;
{_x hideObjectGlobal false} forEach [t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, t28, t29, t30, t31, t32, t33, t34, t35, t36, t37, t38, t39, t40, t41, t42, t43, t44, t45, t46, t47, t48, t49, t50, t51, t52, t53, t54, t55, t56, t57, t58, t59, t60, t61, t62, t63, t64, t65, t66, t67, t68, t69, t70, t71, t72, t73, t74, t75, t76, t77, t78, t79, t80, hemtt_1];
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
};
};
That is the script im taking the fade to black from
and thats all I have
if (isServer) then {
[] spawn {
[0, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
sleep 6;
[[[[[insert time and teleport script here im guessing]]]]]
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
};
};
there's no need to put allPlayers in remoteExec targets
just put 0. or [0,-2] select isDedicated for every client except dedicated server
yeah that would work.
also why do you create objects for position? don't do that
use something less performance heavy, like markers for example
bro i dont fucking know, someone else in here wrote up the code, i just did what i was told
all im trying to do is figure out how to teleport all the players on the activation of a trigger, i already figured out the time part of it, now i need to figure out how to teleport them all
{
_x setPosASL _pos
} forEach allPlayers;
_pos must be ASL
so, UH addAction ["retract ladder",{hideObjectGlobal LD},nil,1.5,true,true,"","_this in _target"]; works fine, but UH addAction ["deploy ladder",{hideObjectGlobal LD false},nil,1.5,true,true,"","_this in _target"]; gives me an error, any thoughts?
for some context, UH is a helicopter, LD is a ladder that is attached to it, and i'm trying to toggle the ladder appearing and dissapearing
whoever wrote this is goofy
and i say this as someone who writes goofy code
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
an error
UH addAction ["retract ladder", { hideObjectGlobal LD }, nil, 1.5, true, true, "", "_this in _target"];
UH addAction ["deploy ladder", { hideObjectGlobal LD false }, nil, 1.5, true, true, "", "_this in _target"];
```if you lok closely, the error is in `hideObjectGlobal LD false`
see the doc for the proper syntax 😉
https://community.bistudio.com/wiki/hideObjectGlobal
well i've been looking at that
what does Syntax 2 say?
😆 thanks lou
I also added an example as hideObjectGlobal only works if executed on the server, so here your action only works if player-hosted and done by the server-player
so, this won't work in multiplayer?
no, but it can, see example 3 🙂
oh, had to refresh the page
💥 ☁️ 😁
the myobject is just the object, right?
yes yes, only a var name
When using checkVisibility to determine if I can see any part of an enemies bounding box, is it just as simple as using boundingBoxReal and plugging that info into checkVisibility?
Edit: no it is not...
anyone have any idea how i can detect if a missilepod on a helicopter is hit? getallhitpoinsdamage isnt showing any damage
Hello! I've got a problem and it's really weird. I've done this many times and always worked, this time it doesn't. Anyone got any idea what's wrong?
Simple: when vehicle gets locked or unlocked, it should play a sound (say3D). Everything works fine but no sound can be heard. The sound just doesn't work. Sound file is in proper folder and should be properly defined in description.ext just like any other sound. And this is the script, that should play it: ```sqf
this addAction ["2013 Chevy Silverado FDNY Ambulance", {
private _vehicle = createVehicle ["Fox_Silverado", [12565,12686]];
_vehicle addAction ["Last 112 call", {
[caller_position] spawn gps_fnc_main;
}];
_vehicle addAction ["Last 911 call", {
[caller_position2] spawn gps_fnc_main;
}];
[_vehicle, true] remoteExec ["enableDynamicSimulation", 0];
_vehicle setVariable ["ace_medical_isMedicalVehicle", true, true];
_vehicle addBackpackCargoGlobal ["TFAR_rt1523g", 1];
_vehicle addItemCargoGlobal ["ACE_SpraypaintBlack", 1];
... ... ...
_vehicle addItemCargoGlobal ["kat_bloodIV_AB_250", 20];
_vehicle setvariable["fw_owner",player,true];
_vehicle lock true;
_vehicle lockInventory true;
_vehicle addAction ["UNLOCK", {
params ["_target", "_caller", "_actionId"];
private _owner = _target getVariable["fw_owner",""];
if (_owner==player) then {
_target lock false;
_target lockInventory false;
[_target, [ "lock", 500, 1]] remoteExec [say3D, 0];
};
}];
_vehicle addAction ["LOCK", {
params ["_target2", "_caller2", "_actionId2"];
private _owner = _target2 getVariable["fw_owner",""];
if (_owner==player) then {
_target2 lock true;
_target2 lockInventory true;
[_target2, [ "lock", 500, 1]] remoteExec [say3D, 0];
};
}];
}];
are you calling the lock sound from a subdirectory?
the file is among other sound files in "sound" folder that is located inside the mission file
is the sound defined in cfgsounds?
yes, in the description.ext
is the sound issue the same with playSound3D?
didn't try that, i use say3D for many sounds and they all work... except this one
im looking at the command on the wiki, and it looks like only one say3d command will play sound at a time.
is it possible that another sound is playing?
looking at wiki playsound looks as a better option rather thn remote exec for say3d
no, not at all
only 1 sound at a time
I prefer it yea, also there maybe be some funky locality things going on in your script...
also i've tested it in the past and i was able to play like 10 sounds using say3d at the same time
after doing the UNLOCK actiion, the vehicle gets unlocked?
yes, everything else works fine, locking/unlocking mechanism works without any problem even when repeatedly used
playsound3d doesn't require you to write a cfgsound entry it only needs a path to the sound file, also it doesn't need remoteExec because it's global effect
just putting that out there...
i wonder what kind of crazy thing happens if you do remoteexec 0 the command
that sounds really handy
🤷♂️ that's why i came here, i've done this many times and it always worked
(yes the sound file is in .ogg format)
im just wondering if you execute playsound 3d, a global effect command, on every client, if the result is 20 copies of the same sound being played all at once resulting in some messed up Wendigo sound
yes
really?
that's why you don't remoteExec 0 global effect commands
that sounds like something really fun to do on a server where i have admin. just sneak in a predator sound and ruin everyones night in a forest in the middle of tanoa during a contact themed mission
Is there a way to return all operatable vehicles with isKindOf? Without going through every type, like "tank" "car", etc
get the parents with BIS_fnc_returnParents
What would I be getting the parent of?
mmm nvm, I misunderstood your question
like a list of all CfgVehicles?
I might have found it here https://community.bistudio.com/wiki/Arma_3:_Assets, but ya, like "Man", "tank","car","landVehicle"
there is a config viewer in the game
how do I access it?
in the editor, tools menu
hmm didnt have what I was looking for though, aw well
hey
[_target, "lock", 500, 1] remoteExec ["say3D", 0];
try this
you don't want extra brackets for remoteExec
you have extra parameters
[_target, "lock", 500] remoteExec ["say3D"];
unit1 setFace "Miller";
// becomes
[unit1, "Miller"] remoteExec ["setFace"];
``` https://community.bistudio.com/wiki/remoteExec
command name should be a string as well
keep using Say3D, you're just using remoteExec wrong
does anyone know where i can find the aircraft arsenal? i know it somewhere in the game


