#arma3_scripting
1 messages ยท Page 759 of 1
how do you do a findIf statement inside a forEach loop? I'm having an issue with _x.
I'm having an issue with _x.
Explain
{
private _currentX = _x;
_currentX findIf {_x == 2}; //1
} forEach [[1,2,3]];```
This you mean?
Is there a way to allow a units addaction be accessed in a vehicle? Trying to allow crew to scroll wheel on one another.
gotcha, thanks
they already are
did you add it on both clients?
This is singleplayer, so heres an example.
Infantry unit has an addaction assigned to him before entering aircraft.
Infantry unit enters aircraft.
Crewman, while in aircraft, can scroll on infantry and access the addaction
oh that. I don't think that works
game issue
there are some other tricks you can use tho
Hmm darn. Other solution would be to maybe pass the addaction to the aircraft when entering? Im always down for more tricks, do you have any you recommend?
well what I was gonna recommend was what you said.
another way might be adding the action to yourself, and checking an intersection to get the other guy
might be a bit slow I think ๐ค
not even sure if intersection works on units in the vehicle ๐ค
it should tho
Do you know how to "copy paste" a addaction? I know you can access its params via https://community.bistudio.com/wiki/actionParams and https://community.bistudio.com/wiki/actionIDs but haven't had much luck
something like this:
this addAction
[
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
toString {player == _target && {
_inters = lineIntersectsSurfaces [eyePos _target, eyePos _target vectorAdd (getCameraViewDirection _target vectorMultiply 3), _target, vehicle _target, true, 1, "FIRE", "NONE", -1];
_otherGuy = objNull;
{
if (_x#2 isKindOf "CAManBase") exitWith {
_otherGuy = _x#2;
};
} forEach _inters;
!isNull _otherGuy
}}, // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
what do you mean copy paste?
Bascially transferring the data from the units existing addaction, and recreating it on the vehicle, or maybe its crew members to use it while in the vehicle
you have to save the action id first:
empty_params = ["", "", nil, 1.5, true, true, "", "", 50, false, "", "", "", ""];
_id = _unit addAction [...];
_unit setVariable ["my_actionID", _id];
_unit addEventHandler ["GetInMan", {
params ["_unit", "_veh"];
_params = _unit actionParams (_unit getVariable ["my_actionID", -1]);
if (_params isNotEqualTo empty_params) then {
_veh addAction _params
};
}];
Hmm let me play with that a bit and see what I can break ๐ Thank you!
also you might want to remove the action after the units disembark
Good point, ill do that as well
@warm hedgejust found your animation thing on steam,exactly what im looking for
your artwork
no no
its easier to explain
ina VC but long story short its for MP,for ues
zues*
Then that's a no
Artwork Supporter is a Mod for purely artwork creation nothing else, nothing to do with a mission
so am i usuing the correct mod or
like its hard to explain
im in gen if you want me to explain more
im usuing the animation scrips in the artwork to make my FOB more legit,then ill salve it in a comp,place it in zues and see if it works,if so the animations should stay and make the fob look like the AI are doing stuff such as repairing cars,listening to radio chatter and wht not
Then you're just doing it wrong. as I said Artwork Supporter is just an artwork supporter, not a mission supporter
so it won't work in MP then?
Never. Neither for a SP mission
it's only for taking screenshots and stuff
not mission making
yeah i get that part,if thats the case is there a mod like that out there or am i going to have to deal with like Zam and stuff
Although Artwork Supporter gives you an easy interface for it, it is possible to apply animations to AI without it, using commands such as switchMove
would that be my best bet for static animation?
More like AS just does switchMove for you w/o complex scripting
just put this into the unit init:
if (isServer) then { [this, "SIT2"] remoteExecCall ["BIS_fnc_ambientAnim"]; };
and change SIT2 to your desired ambient anim
I don't know why this note says do it like that tho
makes no sense 
[this, "SIT2"] call BIS_fnc_ambientAnim; // wrong! the first JIP will throw the unit to position [0,0,0]
https://community.bistudio.com/wiki/BIS_fnc_ambientAnim
but meh
thank you
Which note you mean Leo?
2nd note
this part
It should work with any animation (but bear in mind that certain static poses are added by the Artwork Supporter mod itself and won't be available without it).
BIS_fnc_ambientAnim as Leopard20 mentioned is easier to figure out, but keep in mind it only supports the specific animations listed on the wiki page. switchMove is a little more complex to work with, but can use any animation in the game.
It's probably because of this parameter:
snapTo: Object - (Optional, default objNull) the object where the unit will be snapped to
I expect there's something that gets lost in translation on JIP, so it actually uses objNull as the position instead of not snapping at all
but what's the difference with removeExecing it?
apparently using remoteExec is fine, but object init is not 
both should be the same 
ยฏ_(ใ)_/ยฏ
It might not even be true, I don't know.
Maybe it's actually this one:
attachToLogic: Boolean - (Optional, default true) true to attach the unit to the created logic object, forcing it in one position
and something something logic position not synced
I haven't tried it or looked at the function code and I'm not going to
//remove NV goggles from units without helmets
if (_gear != "ASIS") then
{
{ _unit unassignItem _x } forEach
[
"NVGogglesB_grn_F",
"NVGoggles_tna_F",
"NVGogglesB_gry_F",
"NVGoggles_ghex_F",
"NVGoggles_hex_F",
"NVGoggles_urb_F",
"nvgoggles",
"nvgoggles_opfor",
"nvgoggles_indep"
];
};```You can guess how horrible it is ๐
In fairness the function was added before the hmd command
There is actually a ticket about this so it's probably true https://feedback.bistudio.com/T124429
Are there any cases where the player's locality is not his own machine?
I'm trying to figure out why in some rare cases in my MP game mode, eventHandler "killed' stops firing when player is killed.
under what circumstances is the player killed?
being shot by another player
There's a few things going on but this EH is pretty straightforward. It frequently stops firing for some players. I'm pretty mystified. It gets added in initPlayerLocal.sqf.
I have spent many hours on this ๐ฆ
One thought I had was maybe it stops firing for players who've gotten into another player's vehicle and their locality temporarily changed, breaking the eventHandler. But my testing showed that your locality does not change when you're a passenger.
no
do you add it after respawn?
I don't re-add it after respawn but that isn't supposed to be necessary. My next step may be adding a post-respawn check to see if it exists and adding it if it doesn't. Maybe there is an unusual respawn situation that breaks it.
do you just use player in initPlayerLocal.sqf?
yes
as-in, player addEventHandler [etc.]
Ok. What is the thinking behind that?
player object is not assigned 
oh, like someone has shit FPS when they spawn in or whatever, so initPlayerLocal runs before player object exists?
not related to FPS. but maybe the game doesn't assign the player at init. dunno. I've always used that and not player
it should be very rare
to the point of being a non-issue
my guess is script conflict or bug in script
hey, I came here to ask how i can make an sort of heal animation script , like
I have a unit who have a injured animation , what I wanted to do is that I use my Medkit on to make Unit regain heath , so alfter i treat , he change animation , but my Init didn't work . if someone knows plz tell me
(the injured unit have like 30% of heath)
arma 3 has an injured walking animation built in when legs are damaged, would that be what you are looking for?
no just the static animation
for an init who react when unit have 100% of health and switch animation
i guess it would happen just a tiny bit later and that is enough
hello, I have a problem. i put up sandbags and stuff in a building but when building is destroyed, all the stuff I put up just floats in the air and annoys me, any way to remove the objects when building is destroyed?
you could replace the destroyable building with one that isn't destroyable, and have it as part of the composition
or replace it with a destroyable one and delete the sandbags when it gets destroyed
instead of replacing, you can disable building's damage
or delete sandbags on building's destroying
or attach them to the building
attach them to the building? how would that work?
attachTo
you can
when i was working on that sort of thing, clients stream terrain buildings and a server-set "allowdamage false" flag would not remain on the client machine if he moved far away and returned
causing a situation where clients have destroyed buildings while server has intact buildings
did something change?
if I'm making a long trigger statement, can I use \ to denote new line?
"\
['loyalist', 'SUCCEEDED'] call BIS_fnc_taskSetState;\
deleteVehicle thisTrigger;\
etc commands;\
"
I've used it before when it comes to configs with
expression = "\
if (blah) then {\
blahblahblah;\
};\
if (blah) then {blah};\
"
with no problems
just wondering if it would work for sqf too
it could be just arma's preprocessor being arma's preprocessor
I don't think you can in sqf. my linter is having a fit
well the easiest way to tell is just, loadFile "test.sqf", preprocessFile "test.sqf"
I don't believe trigger statements get preProcessed, just Compiled no?
they don't
it is the preproc
just tested
so for this to work you need to preprocess it
seems weird that it even works in double quoted strings
I have a zeus module script that modifies the X,Y,Z positions of an object randomly and create some effects while doing so. When I place this script over an object, it has to activate the script for that object. How will I achieve this? (Something like cursorObject or cursorTarget but from a module perspective)
As sharp said, there's no need to put anything
That's only necessary in configs and inside macros
Check out vanilla modules that have the same functionality
E.g. zeus arsenal
Alright thanks!
and AFAIK therefore cannot be properly controlled with "allowdamage" , unless something has changed ...
how can i disable the stupid smoothing of camCommit? I want it to linearly interpolate between 2 targets and 2 positions, but instead it does some weird spinning around inbetween
also, the transition between the 2 positions is really stuttery if i set a long time for camCommit
too stuttery to be attributed to floating point inaccuracy
You can use https://community.bistudio.com/wiki/getUserMFDValue to read the values, but it does return all user MFD values for the vehicle, so you'll need to filter it a bit to check the specific value you want. I don't know much about MFD values so I can't tell you exactly how to interpret that array.
You don't necessarily need 2 actions unless you want the title to be different; if there are only two possible states, you can have one action that just checks what the current state is and sets it to the other one. But if you do use 2, you can definitely make it so only one is visible at any time.
how can i linear interpolate a camera between 2 targets?
camsettarget and camcommit do some arc interpolation
and theyre very stuttery
what's the difference between camCommitPrepared and camCommit
camCommitPrepared is for commands like camPrepareTarget
you can have two sets of data
what is the practical difference?
wish I knew
and why does the camera stutter so much?
and why does it not interpolate between 2 targets linearly?
i am at 60 fps
but the camera stutters with its movement
I don't really see stuttering when I use it, haven't tried it on a dedicated server in a while though
shouldn't make a difference i don't think as long as you have it properly running locally
as for the interpolation you can ask the spaghetti chef
im using it locally in singleplayer
have you tried setting the position and vector manually on each frame?

that should be linear right if you have a linear function?
framerate is not linear
you would have to compute an accurate time
sqf doesnt offer an accurate time
i don't have much to offer then besides suggesting something horrendous like switching to and from the camera in the middle of the transformation so it appears linear
or forcibly halting its movement
getting an error mising ( at
if (//error here_selectedindex))==0) then (
_barbedwire2 = "Land_Razorwire_F" createVehicleLocal position player;
barbedwire2 attachTo [player, [0,5,2]];)
any ideas on what im missing?
_Rsclistbox_1500 ctrlAddEventHandler["LBSelChanged", {
params["_control", "_selectedinterface"];
if (_selectedindex))==0) then (
_barbedwire2 = "Land_Razorwire_F" createVehicleLocal position player;
barbedwire2 attachTo [player, [0,5,2]];)
if (_selectedindex))==1) then (
_tower2 = "Land_LifeguardTower_01_F" createVehicleLocal position player;
tower2 attachTo [player, [0,5,2]];)
if (_selectedindex))==2) then (
_circular2 = "Land_BagFence_Round_F" createVehicleLocal position player;
circular2 attachTo [player, [0,5,1]];)
if (_selectedindex))==3) then (
_czech1 = "Land_CzechHedgehog_01_new_F" createVehicleLocal position player;
czech1 attachTo [player, [0,5,1]];)
if (_selectedindex))==4) then (
_long2 = "Land_BagFence_Long_F" createVehicleLocal position player;
long2 attachTo [player, [0,5,2]];)
if (_selectedindex))==5) then (
_teeth2 = "Land_DragonsTeeth_01_4x2_new_redwhite_F" createVehicleLocal position player;
teeth2 attachTo [player, [0,5,2]];)
if (_selectedindex))==6) then (
_bunker2 = "Land_HBarrierTower_F" createVehicleLocal position player;
bunker2 attachTo [player, [0,5,2]];
}];
well first of all
if (_selectedindex))==0) then (
you have 1 ( and 3 ) so that's a problem
Also you need { } after then not ( )
im selecting from a rcslistbox i can include the things ive added in the box if you want
Are you saying there more code than what is posted?
You also have _selectedindex in the if conditions but _selectedinterface in params
github link would be much better
give me a second please just need to login to github
wait dont worry
just remove the \, strings in Arma can be multiline
i think he just wanted to use them for readability
wuht

how does adding useless backslashes that break the code help with readability ๐ค
dunno
i'm suprised it actually works like that (in preprocessor)
the fact that it strips backslashes within ""
in preprocessor macro definitions you can disable the line ending by blocking it with \ at end
yes, macro definitions
yes, and tha should be it
BIS_fnc_unitCapture doesnt copy anything to my clipboard when it ends
im using a whitelisted arsenal script, I was wondering if there was anyway to make it so people can't take damage while there in the arsenal?
BIS_fnc_unitCaptureSimple works as intended
you have to pause, unpause, and press F1
unitplaysimple doesnt work
You can just use BIS_fnc_addScriptedEventHandler with the "arsenalOpened" and "arsenalClosed" to then toggle allowDamage on the player.
https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
hey so i was reading what you said can would something like this in my init.sqf work? ```sqf
[true, "arsenalOpened", { player allowdamage false; }] call BIS_fnc_addScriptedEventHandler;
But that's not a macro. It's inside a normal string.
Juat read the value
To toggle 0 and 1, just do 1 - value
also noob question how do i add another trigger to this sqf if ( (not canMove _x) || (not alive _x) || (({ alive _x } count (crew _x)) isEqualTo 0) && !(_x inArea kavala_hangar) ) then { solution: add another ```sqf
&& !(_x inArea kavala_hangar)
It should yes
Wdym another trigger?
so that is for a script to remove empty vehicles and the kavala_hangar is the trigger so it doesn't delete vehicles in that area in the ```sqf
(_x inArea kavala_hangar)
oops
but i have multiple areas(triggers) i want to add i tried doing ```sqf
(_x inArea kavala_hangar,skip_hangar)
Well add another one with && or ||
Also you might want to use lazy evaluation
Ahhh ok thanks
awesome the && worked thank you @little raptor
Well what you wrote is not right because && has higher precedence than ||
No. That's not what I mean
You shouldn't just use them randomly
&& means and
|| means or
What I mean is you should use parentheses around your groups of ||
No need for github. Use sqfbin
See the pinned messages
๐
Your parentheses are unbalanced
after then you need {} and not ()
and your variable names are all wrong so... your script is totally kaputt
Neither
Find the MFD index then do
getUserMFDValue _veh select _index
See this if you don't know what MFD index is:
https://community.bistudio.com/wiki/setUserMFDValue
why did you write true?
disregard found it in the docs
that should work, just be sure to add another one for closing the arsenal
consider initPlayerLocal.sqf as it does not need to fire serverside if it's dedicated
Okay i will switch it thanks for the heads up
also i was wondering if anyone could give me a solution for this
im using ```sqf
0 = [] spawn {
while{true} do {
{
if(_x distance (getMarkerPos "i_safezone") < 75) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
sleep 1;
};
};
i do player enabledamage false; and i still take damage
that's what you have it set up to do.
it's checking every second if the unit is outside the safe zone and enabling damage if it is
also this isn't scripted well for multiplayer
Is there any other way to make it so an unit/vehicle that is in that marker wont take damage but I can still use god mode? and i know im new to scripting and just been googling and found that for a safezone
a lot of the scripts you can find through google are simply goofy
but if you want to have a unit override that script a good way to do that is by setting a variable and having a check in the code for that variable
also 0 = [] spawn is unnecessary you can just write [] spawn
how can I do that can you teach me lol that would be cool
yeah
by the way this is where i got that code https://steamcommunity.com/app/107410/discussions/18/2592234299569715401/
and thanks i appreciate it, i been working on my mission all day its fun
[] spawn {
while{true} do {
if !(_x getVariable ["DJ_GodMode", false]) then {
{
if (_x distance (getMarkerPos "i_safezone") < 75) then {
_x allowDamage false
} else {
_x allowDamage true
};
} forEach allUnits + vehicles;
};
sleep 1;
};
};
then for the unit you can do
_unit setVariable ["DJ_GodMode", true];
what's happening is you're setting a godmode variable for that unit
and the script checks if that godmode variable is false, which it defaults to if it is not manually set
again, this script is weird and not good for multiplayer. allowDamage takes a local attribute, which means it has to be executed on the player's machine
what the individual on the steam forum is saying to do is to have this loop continuously run on every machine and iterate through every single unit and vehicle
so every unit is iterated through on every machine just to set allowDamage on the player
and the player's vehicle
there are likely more efficient ways to go about this, but let's use your loop as an example
instead of putting it in init.sqf and having it loop like this on every machine, you can go into initPlayerLocal.sqf and have every client only worry about its own player unit
okay, and i put the last code in the units init box correct? and I been trying to learn about init and initserver all of that
also thank you for writing that out for i really appreciate it
you want to avoid the init box unless you're just slapping in some quick code that references the unit itself
the init box executes code for every machine, including JIP
quick question @proven silo is this for AI or just players?
its for players i have a 5v5 cqc mission im working on
oh that makes things super easy
so if that code doesn't go into the unit I would slap it in initplayerlocal and it will make it so all units bypass allowdamage true correct?
its more than 5 players but its a tdm cqc mission.
be right back gonna get a drinkl
//initPlayerLocal.sqf
[] spawn {
while{true} do {
private _unit = player;
if !(_unit getVariable ["DJ_GodMode", false]) then {
if (_unit distance (getMarkerPos "i_safezone") < 75) then {
_unit allowDamage false
} else {
_unit allowDamage true
};
};
sleep 1;
};
};
again, looping like this should generally be avoided but this isn't too heavy and I should be going to bed soon
make a file called initPlayerLocal.sqf in the mission folder and slap this in there
this will have every player's client run the check itself instead of having every machine check every unit
the better way to do it is to use a function to only run when it's needed (i.e. during a certain stage of the round)
Hey so I just tried that and the safe zones still work, but its the same result god mode doesn't work when Im outside of the marker area. I just needed to add that code into initplayerlocal correct?
Nope how do I do that? Thats what I was asking about the units init in the editor do I need to put ```sqf
_unit setVariable ["DJ_GodMode", true];
_unit is an undefined local variable. I just wrote it as a placeholder. if you put it in the init it would be this
ahh
so should I do in my initplayerlocal.sqf ```sqf
player setVariable ["DJ_GodMode", true];
if you look at the code setting that variable to true just makes the unit bypass the script entirely
so yes, if that's what you want to happen
if !(_unit getVariable ["DJ_GodMode", false]) then { read this as "if DJ_GodMode is not true then do the thing"
so what you do with that depends on your goal right now. if you want a unit to selectively bypass the script then you write this setVariable ["DJ_GodMode", true] in the init box
Okay sorry im really slow at this can we from step one, my goal is to have a safe zone for no player or vehicle damage but admins need to be able to toggle god mode and currently whats happening is god mode doesn't work at all because of my script.
sorry if im making it confusing
or god mode does work but only in the safezone
//initPlayerLocal.sqf
player allowDamage false;
[] spawn {
while{true} do {
private _unit = player;
if !(_unit getVariable ["DJ_GodMode", false]) then {
if (_unit distance (getMarkerPos "i_safezone") < 75) then {
_unit allowDamage false
} else {
_unit allowDamage true
};
};
sleep 1;
};
};
//local exec in the debug console (don't include this comment line)
player setVariable ["DJ_GodMode",true];
if you want to set the variable on the fly you can do that in the debug console. If you click the local button you can use player to get the unit of whoever ran the command locally
if you click global it will execute on every machine thus setting the godMode variable for every player
player setVariable ["DJ_GodMode",false];
``` to disable it
going to try that right now
this does not affect whether damage is allowed, only whether the unit is affected by the script
the best way to do all of this is with functions. https://community.bistudio.com/wiki/Arma_3:_Functions_Library
if you define a godmode function you can combine setting the variable and setDamage to have a single line that does it all
which you can then add to the scroll wheel menu, etc.
Okay I understand now, that command is going to be the main god mode command instead of using player allowdamage false. I tested it and every is working fine so far thank you so much for putting up with a noob Im happy I can use god mode now ๐ I also have one more question if you don't mind it should be simple I hope. How would add a second marker would it go like this for this part of code ```sqf
if (_unit distance (getMarkerPos "i_safezone" && "second_safezone") < 75) then {
that command is going to be the main god mode command instead of using player allowdamage false
what are you talking about?
and no that code wouldnt work
I ran ```sqf
player setVariable ["DJ_GodMode",true];
no it doesn't, it just prevents the script from setting allowDamage
player setVariable ["DJ_GodMode",true];
player allowDamage false;
this is what you're looking for
okay but thats strange im on editor running and i only typed that in and i have god mode with the allowdamage
GodMode is just the name of the variable, it doesn't actually change anything, it's a variable checked by the script before it does anything
did you walk out of the safe zone first
yes
i think the script isn't working
im going to test it again
try it without setting the variable
okay going to restart my mission in editor and try allowdamage command first.
okay you were right I tried both commands separate local and nothing worked until I did ```sqf
player setVariable ["DJ_GodMode",true];
player allowDamage false;
must of been a bug idk how it was working the first time
if (["i_safezone","second_safezone"] findIf {_unit distance (getMarkerPos _x) < 75 } > -1) then {
this is how you check a condition for multiple entities
Leopard might come in and say findIf is slow in which case an alternative is
if ((_unit distance (getMarkerPos "i_safezone") < 75) || (_unit distance (getMarkerPos "second_safezone") < 75))
awesome thank you very much I appreciate it im just testing stuff right now making sure theres no other problems ๐
Okay man tested that second code and everything working flawless. You the real mvp
yw dude I recommend checking out that functions library link itโs fairly essential if you plan on adding more scripts
A2OA. I have an invisible target object I use for AI to suppress positions. If there's any way to do this, I'd like to have the target sway back and forth a little so the AI's suppressive fire is more spread out. Any way to do this?
that's not a condition
does anyone know what this means Tried to AccessTargetList for non-local AI group while non-local targeting was disabled! Engine will now enable non-local targeting which will hurt clientside performance.
it's a #perf_prof_branch message
it only does targeting locally which improves performance
if you use a command such as targetKnowledge, targets, etc. on a remote unit it disables the optimization to be able to fetch what you requested for the remote unit
to use those commands you must always check if the unit is local using local command
if not remoteExec the function
okay im a noob idk how to do that lmao, should i just use main branch also x86 or x64 for my dedi
do what?
what branch should i use when i host my dedicated server they have main profiling i was just testing them
@still forum btw was this merged into the main/dev branch?
you can use whatever branch you want
that's not an error, it's just a message
everything is still working
but that message simply means that the optimization was turned off, either because of a bad mod, or your own fault
np
is there really no EH for Activetext dragging?
hey , what is the init needed to set an heal script ?
"an heal script"?
some knowsAbout or other AI commands were used client-side while the AI was server-side (or at least non-local)
yes like a set health to an AI
I don't really know what it is. Elaborate please, do you have any resources?
no , that's why i ask
What exactly is the goal?
in fact , i need this for complete a **treat injured pilots ** task
so i know i can use
setDamage
W-what
tldr you need a setter or getter?
set
Then setDamage
to ?
What?
like 1 at 0
alr
and witch init to trigger the completed task ?
l was trying for if (_unitname) damage <20
if (_unitName damage < 0.2) then {
// execiton
};```?
yea
but in the then it would be like(taskid)set Completed task or something like that
with the BIS_fnc task status
Something like that yeah, I guess
instead of using ```sqf
(nearestBuilding this) allowDamage false;
Hey question- how does setVariable/getVariable work for player units that respawn? Is setVariable persistent across respawns?
use the building pos and ID with nearestObject
Aight, got inspiration from the general chat, and a long nagging feeling of something missing from singleplayer campaigns.
I put together a basic but functional AI-compatible revive system for a mission I released not too long ago, and I think with some tweaking it could be used in campaigns, ala the SSPCM functions.
However, since its a script I wrote and all, its a) probably awful in every computational sense, and b) obviously only available as a script injection if you have the admin console.
Where should I start looking if I wanted to package it as a standalone mod, activatable on a per-mission basis from an added Mapscreen menu?
maybe #arma3_config
Had a feeling, but wasnt sure if this project would qualify. Thanks!
Why switchCamera _anotherPlayer sometimes act strange (multiplayer):
- it show a scoped vision but player is not scoped.
- it show the camera from weird view point that are really not possible in game.
- it show bugged vision from inside a vehicle.
May be network problems (missing packs)?
could someone help me with something regarding a condition field?
it has to do with an ACE3 interaction condition but i think the syntax expectations for them are the same as for UserActions
Hi Everyone, I'm running a Server with some missions and I've wanted to do some extensions with a script, is there any way I can do this without having to make a pbo thing?
If there is no way, could somebody maybe point me on how to best start with this?
Since all I can find seems to focus on making scripts in missions, but I want to do something which "lives" outside the missions and is loaded always.
You should use x64. An x64 application is one using 64-bit processing, whereas x86 is using 32-bit. 64-bit is more bits than 32-bit and is therefore better. (There are more detailed reasons for this but it's complex to explain.) You would only use x86 if you had a very old machine that didn't support x64.
Extensions don't need a pbo
also I'm not sure if that's actually what you meant...
you can also use the profileNamespace for data that "lives outside the mission"
Sorry, for not using the right terms, still trying to grasp what is what.
So the ideal thing I want to do is make/use something which allows me to do custom admin commands. I don't want this to be added to the missions, since they can change on the server. And it seems to me I don't need to "compile"/pbo-ify some simple scripts, but things just won't really load so I'm very confused.
I have done some modding/scripting for various other games, but here I can't for the life of me even figure out how to get something started ๐
. Everything I look at has a different folder structure and I'm not really able to get anything from the "Arma 3 Samples" to run/load, so if you have any ideas or pointers on how I can get started with this I'd really appreciate it.
What do you mean custom admin commands?
My idea is to be able to write something like #something and in the background it runs some code I defined.
Afaik you can't add custom admin commands
You can get your scripts to run on the server using the debug console
To always have access to your scripts you have to make a pbo, sign it, and add the bikey to server keys. If you don't give that signature to anyone else only you can use that mod
This page explains the basics of sqf:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
This page explains the basics of making an addon:
https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon
Tho I don't think you can follow it as a complete beginner
As for Arma 3 samples, afaik there are no scripts in there, so they're irrelevant to your needs. Also to use them you need to set up P drive
Hello. I have two objects that appear at a random position, but I want them to appear in the briefing for only one side. How can I specify an object in a briefing?
Will try this, thanks for the help ๐
oh wow ๐ฎ
Do you by any chance know how I can make a script with a bunch of calls to CBA_fnc_registerChatCommand which loads on server start?
thanks for the CBA thing tho
Hello everyone, is it possible to get the Z height using screenToWorld?
Need to get the Z height of screenToWorld [0.5, 0.5] knowing the height of the object and its vectorUp.
https://community.bistudio.com/wiki/screenToWorld
Return Value:
Array - PositionAGL, world position on surface [x,y,0]
Z height relative to what?
to ASL
AGLtoASL after that then
It sounds like screenToWorld ignores objects entirely though, so you may have the wrong starting point.
Hey guys. I'm using the bis_fnc_holdActionAdd function to add an action with a nice progress icon. The problem is the hold action is supposed to last longer than 20 seconds, and after about 10 seconds in, the action menu automatically fades out, along with the progress icon which just vanishes from the screen. It makes it seem like the action has failed (even though it actually continues in the background as long as the key is held). It's pretty confusing for players. Is there a quick way to prevent the action menu from automatically fading out, or perhaps force it by script to show itself again (along with the progress icon)? I know there's a isActionMenuVisible command. Would be nice to have a showActionMenu command or something I guess ๐
not as far as I know (but using the scrollwheel I guess)
Surely there must be some hacky workaround nobody's discovered yet lol
if they haven't discovered it yet here's your chance ๐
Is there a Rsc config just for the action menu?
whats the script used to create the pictures of the AI in eden? ive completely lost what it was called
just in case you need it again, I went to the screenshot command page and it is linked there ๐
could not find it in there
https://community.bistudio.com/wiki/Arma_3:_IDD_List
Yeah I didn't see it in there either. But I think I actually managed to find a way to avoid the problem. I'll have to confirm on dedicated tomorrow but I think setting the priority of the action to be the higher than everything else makes the menu not fade away ๐
I'm having trouble finding a complete list of the default mission endTypes. Does anyone have a link to all of them?
Thank you, but that list is not comprehensive.
It's missing at least:
"EveryoneWon"
"EveryoneLost"
"SideScore"
"GroupScore"
"PlayerScore"
i see
I think I remember seeing things like WestWin and OpforWin in Arma 2 or something like that. I probably am not remembering, but I can't find whatever it was that I thought I saw.
@shadow sapphire check CfgDebriefing
(found under CfgDebriefing in the game's config file)
yw
Does anyone know if there is a reason to choose config.cpp for anything over description.ext when something can be done in either file?
isn't config.cpp for addons and description.ext for missions?
I have no clue, but the custom debriefings can be placed in either file and my mission utilizes both.
I'll likely just use the description.ext and change it later if there is a compelling reason.
I don't think config.cpp will do anything in a mission file
Description.ext is the mission config, config.cpp goes in addon root
Oh, thanks!
How can I get my vehicle spawned to spawn vehicles with init code after they are destroyed and Respawn
Also anyone know a simple way to add disable friendly fire for teams but enable fall damage too
//onPlayerRespawn.sqf
params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
_newUnit addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
private _friendlyFire = missionNamespace getVariable ["DJ_FriendlyFire",true];
if (!_friendlyFire) then {
if (side _source == side _unit) then {0}
}
}];
DJ_FriendlyFire = false will disable friendly fire. Make sure to broadcast the variable (either global exec or use publicVariable)
worth noting that ace medical may override this
fixing this now if any concerned parties stumble on this, found the tutorial someone linked on the wiki
one day I will fully comprehend this darned event handler
one day i will learn how to read*
disableUserInput true;
//do something, time delay effect
disableUserInput false;
I want to use this script in EH. and give some time delay effect between them, just like sleep. but EH is Unscheduled environment and suspending is not allowed, so Is there a way to give that sleep effect between them?
Use spawn
you mean?
// under EH
0 spawn {
disableUserInput true;
sleep 2;
disableUserInput false;
};
Yes
much appreciated.
Does anyone know how I can get vehicles to keep there init when they respawn using a vehicle respawner
so i did some searching and I found out this is the way you do it so I tried this in the vehicle respawn module init and my vehicle still doesn't have an arsenal option```sqf
params ["_newVehicle","_oldVehicle"]; _newVehicle addAction ["<t color='#006400'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}];
Speculatively, the respawn module has 2 code fields, one init for the module itself and one that it runs on respawning an object, and you've used the wrong one
Alternatively, also speculatively, this is in MP and the code is only being run on one machine
oh wow i feel dumb @hallow mortar thank you, I was putting in the init box and didn't read the expression box its working now
hey guys, I'm trying to use a script from a workshop for a bombing run. Basically just hides and unhides a crater and explodes a satchel charge on the ground when the plane passes overhead. But, for some reason, I'm getting an error thrown out
The code in the trigger is this:
call{rt enablesimulationGlobal false && rt hideObjectGlobal true && crater1 hideObjectGlobal true && crater2 hideObjectGlobal true && crater3 hideObjectGlobal true && crater4 hideObjectGlobal true && crater5 hideObjectGlobal true && crater6 hideObjectGlobal true && crater7 hideObjectGlobal true && crater8 hideObjectGlobal true;}
And the error I'm getting is this:
Error &&: Type nothing, expected Bool,code
Anyone know why? The first crater gets hidden, the second does not.
And, yes, I know, the code is horrendous and overcomplicated, but that was the way it was implemented in the composition I pulled from the workshop and didn't wanna mess with it.
Anyone know why?
because the script is wrong
replace&&by;and it should be good
@finite imp โ
To expand: && doesn't mean "do this & this", it means "check if this & this both return true". ; indicates an end of the current instruction and is used to separate a series of commands.
Also, hideObjectGlobal is a command that must run only on the server, so make sure your trigger's Server Only box is ticked (and all other commands in the trigger are okay with being run only on the server)
Finally, you can simplify this pretty easily:
{
_x hideObjectGlobal true;
} forEach [rt,crater1,crater2,crater3,crater4,crater5,crater6,crater7,crater8];
the trigger includes enableSimulationGlobal, is this fine with being run on the server only?
thank you for your input, both of you as of now
Yes
Remember you can look up commands on the wiki (https://community.bistudio.com/wiki/enableSimulationGlobal) and it'll tell you what kind of locality requirements they have
(+ rt enablesimulationGlobal false)
does this have to be in a call{} or is that unimportant?
could you put a unit insignia on a vest?
remove it
I don't know if vests can be configured to display unit insignias. If it's possible to configure a vest in that way, doing so would be part of the model config, not something you can do with scripting.
Hey guys i have this weird problem I got my vehicles to respawn with the init but it doesn't work on a dedicated server, this is what i have in my expression box. Am i doing anything wrong for these to not work on an dedicated server ```sqf
params ["_newVehicle","_oldVehicle"]; _newVehicle addAction [("<t color=""#0fff00"">" + ("Repair Vehicle") +"</t>"), "repair\repair.sqf",[],1,false,true];
do you mind indenting a bit please?
yo, how can you load a save in multyplayer, old man mission
Old Man is not multiplayer
For some reason the plane is now simulation disabled and the craters are now hidden (great), but the plane "rt" is not hidden (not so great) ๐
its not much of a deal to me personally because they spawn way out of visible range for any players but still
Try disabling simulation on the plane after hiding it
@winter rose sorry im new and i can't get it nice. The function works but it doesn't work on a dedicated server
the addAction isn't showing up?
The respawn module script is probably only running on one machine (likely the server). The addAction command only has local effect, so the action is only being added on the server (or rather, it's being ignored because DS don't care about addactions). You'll need to remoteExec it.
Thats in the trigger now. That what you meant?
{
_x hideObjectGlobal true;
} forEach [rt,crater1,crater2,crater3,crater4,crater5,crater6,crater7,crater8];
rt enableSimulationGlobal false;
yes
Error still persists though
Unfortunate. Well, I'm out of ideas
how do i write a remoteexec for an add action
Alright, thanks for trying though! Been much help
can i just put the remoteExec infront of it correct?
ya im looking right now i see the hint one
addAction [("<t color=""#0fff00"">" + ("Repair Vehicle") +"</t>"), "repair\repair.sqf",[],1,false,true];
``` hopefully this comes out formatted.
[_newVehicle, [("<t color=""#0fff00"">" + ("Repair Vehicle") +"</t>"), "repair\repair.sqf",[],1,false,true]] remoteExec ["addAction", 0];
dang that was quick i was googling and looking at this example reading the 0 makes it so everyone can see it
It means it runs it everywhere. Now if you want full multiplayer compatibility then you may also want to think about JIP :P
I recommend to do a different approach. Use initplayerlocal, check if vehicle is damaged etc etc
Why would you use initPlayerLocal for this? That would be fine for vehicles that already exist, but it's of no use at all for respawned vehicles, which is what this is about
Why remoteexec all the time? Just use addaction in combination with cursortarget
all the time once per vehicle spawn
In my view, an action that involves interacting with an object is best assigned to the object, not to the player; by checking cursorObject, distance, vehicle type etc. you're putting a lot of work (and per-frame performance) into duplicating functionality that already exists natively in addAction. That's not necessary just to avoid one small, infrequent remoteExec.
bump I tried using remoteexec but Im stil having the problem on
dont use vehicle init for respawning
use something like this
Official Example Mission: Note: ALiVE users need to select Virtualize synced units only in the ALiVE Virtual AI system module. Official fn_vehRespawn.sqf /* ---------------------------------------------------------------------------------------------------- File: fn_vehRespawn.sqf Author: Iceman7...
They're not using the vehicle's init as the method of respawn, they're using a BI Vehicle Respawn Module. They've successfully used the respawn module's expression field to add an action to the vehicle when it respawns; the problem now is that it works locally but not on DS.
how difficult would it be to make side WEST neutral to side GUER outside of specific markers?
like, if a unit of side GUER is in a marker it's considered hostile to WEST but only in those markers.
have you peeped the side relations wiki page
not recently but im aware of how they work generally
Thereโs a value you can assign to make specific units hostile, not sure if it works both ways
I don't think it's possible to do exactly what you want. Side hostility doesn't have that level of control.
So you'd have to use hacks like side-swapping or setCaptive.
I believe that's what I was thinking of. If you also have opfor thrown in you might have to mess with guer units joining/leaving opfor groups when they enter the area
as john jordan said
I'm spawning an object
but I want to make sure that this object is in contact with the ground or with any type of floor so that it doesn't spawn floating
what command should I use to make sure the object is either in contact with the ground or with any type of floors?
oh it seems isTouchingGround also accounts for floors even if the floor is floating
then I guess I have answered my self
such silliness
((typeOf (vehicle player)) in ['WarfareSupplyTruck_RU', 'WarfareSupplyTruck_USMC', 'WarfareSupplyTruck_INS', 'WarfareSupplyTruck_Gue', 'WarfareSupplyTruck_CDF'])
Is this correct syntax? I get no errors but the script is still not working and I suspect that the error is caused by this line (NOTE: Arma 2 OA)
Iโd use the setCaptive method as itโs a 1-liner, but the question is, is this just NPC units or could they be players also? Because youโd probably want to remove captive status if they shoot
Hmmโฆnow that I think about it, both sides would have to be captive, otherwise the captive side would shoot the non captive side with no consequences until they all died
yeah probably the best way to do it but im just not going to bother w/ it
hoping that arma 4 has per-faction hostility but im doubtful
Did you mean this? A3 does have that https://community.bistudio.com/wiki/setFriend
I feel like you meant to say per-unit hostility, not faction
probably means an in-between of arbitrarily-defined factions rather than fixed sides.
Ah I think he meant factions as the different groups belonging to the same side
Not entirely sure if this will work but you can use setFriend to change the standard side hostilities, then in your code add all the affected units to a group in that side
yes this
its not meant to be but it is possible to play with friends
i have played with one of mine
I'm trying to calculate the amount of the items "money_bunch" a player has in their inventory
but problem is
despite me having that item in my inventory in addition to other items
when I run items player it just returns ["FirstAidKit"]
try magazines
Ah too slow, was typing that lol
Is dat possible to set angular velocity?
Whats the code to switch to a different player via a trigger?
@elfin flax Not directly but you can use addTorque
Anyone know what I need in the file path to use a sound from a mod?
// What I've got rn
playSound3D ["\addons\Cytech_Sounds\Cytech_SFX_Sounds\Alarm_V1.ogg", _hive, false, getPosASL _hive, 5, 3, 30];
"\Cytech\Cytech_Core_Assets\Cytech_Sounds\Cytech_SFX_Sounds\Alarm_V1.ogg" @hushed tendon
It doesn't work with the \ at the start of that but thanks for the tip. It works now
ay , can someone help me , my Init dosen't work
Crewmen1 switchMove ""; if (Crewmen1 damage > 0.5) then {["task4","succeeded"] call bis_fnc_tasksetstate}; [Crewmen1] join Misfit1
that say a ( is missing .
Hey im making a coop MP mission and i have a team of 4. sitting in chairs for a brif. i have it set on a trigger to switch them to another set of units where the mission will take place.. they have the variable name of mark, mark2. ect
but me code no workie
selectPlayer mark && mark1 && mark2 && mark3;
i want the team to switch to the players in the mission area, to save having to transport em ect
so if you want mark 1 ,2 and 3 to switch team do
[mark1] join _groupname
[mark3] join _groupname
[mark2] join _groupname
they are in a diff area though
tried itemswithmagazines yeah works
[mark1] join _Alpha 1-5 && [mark3] join _Alpha 1-5 && [mark2] join _Alpha 1-5 && [mark] join _Alpha 1-5;

why u add && ?
because it wasnt working either way
hey guys, ive made a custom save data function for my mission, however when I try calling the fuction, it doesnt work and throws an error saying suspending not allowed in this contex.
The code works 100% as just a file, want it as a function to call it easier
redacted
This is the code. any insight will be helpful ๐
suspending not allowed in this contex
sleep 0.5;
sleep 1;
those are both "suspending"
spawn your code
im stupid, turns out i wasnt creating the database ๐คฆ because aparently a home hosted server doestn run initServer.
and yeah, i tried spawn before and it wasnt working due to ^
got it workin now, thankss ๐
private _zeus = (allMissionObjects "ModuleCurator_F") select 0;
_zeus addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
if (_entity isKindOf "Man" && {(side (group _entity)) isEqualTo EAST}) then {
[_entity, "balaclavaReplace"] call BIS_fnc_unitHeadgear;
};
}];
};
Hello all. I'd like to use this script that applies headgear/glasses to OPFOR units that are spawned in with Zeus. But instead of BIS_fnc_unitHeadgear i'd like to use linkItem (to equip NVGs instead). How would I do this?
damage x not x damage
why do it separately if it takes an array
[_unit1,_unit2] join _group
or โunits _group1 join _group2โ
well
?
damage _unit is correct, _unit damage is nonsense
so it would be (number) < damage_unit ?
because i need the game to understand that when my unit as been healed , the task ends
@open fractal
Crewmen1 switchMove ""; if ((damage Crewmen1 > 20) then {["task4,"SUCCEEDED"] call BIS_fnc_taskSetState}; I modified it , and the game still gave me an error code
you have an extra ( after if
also
20?
you mean 0.2?
did you read the docs
ye
i did , but i don't understand
damage scales from 0 to 1
so 50% damage would be 0.5
remember that damage != health
damage is generally the inverse of health
health 1 = 0 damage
damage 1 = 0 health
have a nice day
damage is how you get "health", just 0 means undamaged and 1 means dead, which is why it will never be greater than 20
that says me if: type number , Boolean expected
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
greater than 1
Hey guys, I got a question with pip.
Ok so, I got 2 screens, left and right. I want them to function like some kind of cctv. I set up 2 cameras, 1 for each door. Now the 1st camera, on screen it points where I want it to. The 2nd camera, points the opposite of where I want it to. What should I do?
I tried a bunch of stuff like making stuff on the sqf's vectordir up negative but it didnt really make the camera point outside but just towards the door
Anyone have a solution to checking if the player that triggered a trigger is a group leader?
leader group _unit == _unit
Did you set trigger activation to players?
Yes, I just need to know if that player is the group leader.
thisList findIf {leader group _x == _x} >= 0
That means at least one leader in the trigger
Would that exclude AI group leaders that are already in the trigger area?
That's why I asked you first if you set the trigger to players only
If you did yes
If not no
So thisList only has things that would make the trigger go off?
Yes
Noice
Crewmen1 switchMove ""; if (health Crewmen1) > 0.5) then {["task4,"SUCCEEDED"] call BIS_fnc_taskSetState};
Misses (
where
Also there's no health command
if (health Crewmen1) > 0.5)
so its damage
As people already told you
One open, two close
Also you're missing a quote in the next bit.
["task4,"SUCCEEDED"] call BIS_fnc_taskSetState <- no
but when my game lauch it say if: type number , Boolean expected
Did you fix all three errors?
only that one appear
It gives up on the first parsing error. It's a computer not a human.
ik thanks i know the difference -_-
i'll just don't see where to set the true or false
@granite sky
Just fix the three errors that we told you about (missing bracket, wrong command, missing quote) and then see what it does.
Crewmen1 switchMove ""; if ((damage Crewmen1) > 0.5 , true) then {["task4, "SUCCEEDED"] call BIS_fnc_taskSetState};
?
blinks
Crewmen1 switchMove ""; if ((damage Crewmen1) > 0.5) then {["task4", "SUCCEEDED"] call BIS_fnc_taskSetState};
I think you created that error by adding a bogus , true in the if statement.
alr
so now its good
no error code
but the then {["task4", "SUCCEEDED"] call BIS_fnc_taskSetState};
won't do something
so i copied the code you wirtted
like that won't set the task state to completed
It'll set "task4" to "SUCCEEDED", whatever the hell task4 is.
If you want it to throw a notification then ["task4", "SUCCEEDED", true]
and did the call BIS_fnc_taskSetState}; stay ?
sighs
Crewmen1 switchMove ""; if ((damage Crewmen1) > 0.5) then {["task4", "SUCCEEDED", true] call BIS_fnc_taskSetState};
you should probably attempt to learn the basics of programming :P
i know
i know how to set all infos for make an ORBAT group
but for that , that's my first attempt
:/
don't set the task4 as succeeded
still not
I guess your task isn't called "task4".
yes it is
or damage Crewmen never exceeds 0.5
Your condition is reversed
It's damage not "health"
Are you trying to heal the guy or kill him? :P
heal
oh yeah, backwards then
It's already > :P
_<
YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
TASK NOW COMPLETE
XD
DUDE
thanks
xd
@little raptor@granite sky big thanks
How can I rotate the live feed and make it face somewhere else
I have it setup as a stationary camera.
can someone explain to my smooth brain how velocity is calculated
like the geometry behind it
all i know is you can multiply the array to change the speed the object is moving
velocity is just the speed in metres per second, split into x/y/z components
so getPosASL _veh vectorAdd velocity _veh will give you the ASL position of the vehicle after one second.
Not unless your input values are bearings or something.
OH
position/time for xyz
thank you
so if I wanted to, say, toss an object upward, it would just be ```sqf
_object setVelocity [0,0,1];
oh wow that's really it, I don't know why I never made this connection but thanks john
Hello there! Um, I don't know if this is the right channel to be asking for help, but lately I've been having issues in dedicated servers when it comes to the Trigger module. So to keep things short, basically my Trigger module which is for a Bar gate to open whenever any player would come into contact, would not work in my dedicated server, although, the Trigger itself works in EDEN Editor when I play it in "Play in Multiplayer."
EDEN Editor when I play it in "Play in Multiplayer."
that's the same as single player
what code do you use in the trigger?
The Trigger settings were:
ACTIVATION: Any Player
TYPE: None
ACTIVATION TYPE: Present
REPEATABLE: True
SERVER ONLY: False
Condition:
this
On Activation
Gate01 animate ["Door_1_rot", 1]
On Deactivation
Gate01 animate ["Door_1_rot", 0]
server only should be true
animate has a global effect
idk if that's a fix
wiki says animateSource should be used for multiplayer as well
So I see that on the TWS nightvision scope that when you press T it displays the distance, I was wondering what base arma script that does that is? I know it also auto elevates guns on tanks too. I know I could just use inputAction to detect when lase range is pressed but I wanted to see how the base game does stuff
still having problem with this btw
The laser rangefinder and tank FCS systems are probably engine-level systems, not SQF scripts. The FCS system in particular definitely does things that can't be done with SQF commands, such as setting weapon lead and precise zeroing.
if (hasInterface) then {
private _zeus = (allMissionObjects "ModuleCurator_F") select 0;
_zeus addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
if (_entity isKindOf "Man" && {(side (group _entity)) isEqualTo EAST}) then {
[_entity, "balaclavaReplace"] call BIS_fnc_unitHeadgear;
};
}];
}; ```
Hello all. I'd like to use this script that applies headgear/glasses to OPFOR units that are spawned in with Zeus. But instead of BIS_fnc_unitHeadgear i'd like to use linkItem (to equip NVGs instead). How would I do this?
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Any way to get the mass / weight of a vehicle from ConfigFile?
Just replace the unitHeadGear line with _entity linkItem "nvg_class_here";
I have wanted to do this in the past but haven't found a way. I think it's part of the physics model rather than the config.
Any way to extract data from models? like size / shape etc?
boundingBox can give you a rough estimation of size
boundingBox/Real, sizeOf, bis_fnc_boundingBoxDimensions
ait, got it!
Thank you!
problem with the bounding boxes is that they are often quite a bit larger than the most extreme points in each axis
If you have an existing example of the object (required for all the size commands except sizeOf) you can use getMass
boundingBoxReal is much better for accurate dimensions
yeah bounding boxes are a headache when it comes to stuff like antennae and structures extending underground
lucky for me I only used them for a mock prop hunt
The additional parameters for bounding box commands from 1.92 have also made it easier to get accurate measurements
PhysX only
They were asking about vehicles and it's been a while since I saw a non-PhysX vehicle in Arma 3
Vehicle mass is not config parameter
it's model's?
Models' yes
What about the parts that set the the gui with the range , for RscInGameUI where for the control of idc=198 gets set to the range if possible. Would that be engine level? So I guess in worse case I would need to write my own thing to detect when inputaction "gunElevAuto" is pressed?
I don't know. Probably?
It's recently become fairly easy to detect when input actions are used, thanks to the addition of relevant event handlers. So you shouldn't have too much difficulty unless you want to modify the behaviour, in which case good luck
hi, im trying to display an icon via Draw3D
TAG_3DIcon1 = addMissionEventHandler ["Draw3D", {
alphaText = linearConversion[2, 8, player distance generator1, 1, 0, true];
drawIcon3D [getMissionPath "images\RepairIcon.paa", [1,1,1, alphaText], generator1 modelToWorld[0,0,0.1], 0, 0, 0, "POWER GENERATOR", 0, 0.04, "RobotoCondensedLight","center",true,0,-0.03];}];
but somehow it shows the text but not the image,any help?
your width and height are 0
no easy way, you can look into ace fcs, they get it pretty close to arma with approximate/close calculation to what the engine calculates by simulating the simulation step
perfect thank you very much!
Hello. Basically i have an addAction on an AI to open an arsenal. I'd like for the addAction to open the arsenal and then say a greeting using sideChat or similar function from an array of strings. BUT only for the player using the addAction and not for all clients. What would be a good way to do this?
this addAction["ACE Arsenal", {[arsenal_box, player] call ace_arsenal_fnc_openBox},"",1,true,false,"","_this distance _target < 5"];
params ["_target"];
private _text = selectRandom ["array","of","strings"];
_target sideChat _text;```
Since sideChat has local effect, this will only display the message for the player that uses the action.
Is there a way to get distance between player and house wall (distance from player to the wall), if player stands outside or inside the house?
https://imgur.com/a/hfsmiNt
https://imgur.com/a/UrV7Dg4
https://imgur.com/a/RleKiBn
Which wall? Nearest or a specific one? Specific house or any house?
In general you can use the lineIntersectsXXX functions for this sort of thing.
anyone any idea on how to this to work? its to select another team via a trigger so i dont have to transport em. and want it to work in COOP
selectPlayer mark, mark1, mark2, mark3,;
private _playerUnits = units playerGroup;
private _targetUnits = units targetGroup;
{
private _playerUnit = _x;
private _targetUnit = _targetUnits select _forEachIndex;
_targetUnit remoteExec ["selectPlayer",_playerUnit];
} forEach _playerUnits;
never used selectPlayer no idea what this does
but looking at the syntax i think this is what you want?
it would probably be better to just teleport your players...
yeah if you want to teleport, just teleport.
I have one entity being hidden by a terminal activation, but i need to add extras into the script and im not sure how i string them on, help?
Terminal addAction ["Hide laser wall", "hideObject wall 1"];
that is the current code i have
terminal addAction ["Hide laser wall", {hideObject wall1; hideObject wall2; hideObject wall3; hideObject wall4;}];```
should work, it's from the forum thread I've sent you
alright thank you
oh and if its a multiplayer mission use https://community.bistudio.com/wiki/hideObjectGlobal instead of hideObject
is there a way to detect when object is clipping through a wall?
with boundingboxes and lineIntersects* most likely
Does anybody use VS code with the sqf extensions?
https://community.bistudio.com/wiki/Arma_3:_Visual_Studio_Code
I just found this and set it up and opened one of my projects. It says all my inline functions are not defined, but they are...on that exact line where the warning is lol
are they defined locally or globally
globally

Is there a way to convert text/structured text back to a string?
I'm having trouble with line breaks and action icons
str?
That has weird behavior, it culls everything after line breaks it would seem
_image = image "\a3\ui_f_oldman\data\igui\cfg\holdactions\holdaction_market_ca.paa";
_image setAttributes["size","3"];
_text = "Check Credits";
_x = composeText[_image,linebreak,_text];
//How do I convert _x back to an XML style string?
setUserActionText Takes a string instead of structured text
@open fractal here's an example, couldn't post a picture so hopefully a link to an image is ok
https://imgur.com/a/DRbFWrl
@ivory locust try this:
_str = str parseText _structuredText;
per https://community.bistudio.com/wiki/parseText the first note by Dr_Eyeball
have you tried blackfisch's SQF library instead? https://marketplace.visualstudio.com/items?itemName=blackfisch.sqf-language
I disabled the Armitxes version and installed blackfisch's version and reloaded and still getting the warning
i get that with functions as well
i just ignore it
I don't love that, but this will probably be better than using notepad++ and git bash, if for no other reason than the git terminal inside vs code lol
the nearest one from player. and an inner wall or an outer wall of any house.
Good day
How may I run remote exec here?
[cam1, "piprendertg1", 1, 45, 45, -30, 0.25, 0] execVM "Scripts\setSurveillanceCam.sqf";
sleep 3;
[cam2, "piprendertg2", 1, 20, 30, -30, 0.5, 0] execVM "Scripts\setSurveillanceCam.sqf";
turn that script into a function then you can remote exec that function
Ah, thank you!
Hey guys I have this jump script I am using that I found online It works, but people able to teleport when they DPI and jump. I know dpi has been a thing on arma for a while but I was wondering if someone could help me make it less buggy. currently you can hold down the v key and it will keep jumping if there was a way to have a cooldown after jumping that would be awesome.
does anyone know how i can make a weapon on the ground inaccesible?
i have a "weaponHolder_single_Limited_weapon_F"
and i read somewhere that setting the damage to 1 would make it inaccesible to the player, but it also makes the weaponcargo command return and empty array
as well even then inventory still opens if the player lays down on the weapon in just the right spot.
testweapon1 enablesimulationglobal false; & [testweapon1,false] remoteExec ["enablesimulationglobal",0,false]; also does nothing.
i cant use createsimplevehicle because i need the vehicle to be accesible later on
Try lockInventory I think?
tried that. it does lock the inventory but the option to pick up the rifle still appears and works
I solved this by disabling simulation for a unit's weapon when the unit is killed
["WeaponDestroyed",[localize "STR_Weapon", localize "STR_Weapon_destroyed"]] remoteExecCall ["BIS_fnc_showNotification",0];
0 spawn {
sleep 5;
call{west addScoreSide (scoreSide west + 9999);
"SideScore" call BIS_fnc_endMissionServer;}};
Only one language is displayed on the server at all times, even though the stringtable.xml specifies two different ones.
https://community.bistudio.com/wiki/Stringtable.xml
I found a section about Multiplayer, but I do not quite understand how I should do it.
I need notifications.
If you run localize on server, it will localize to the servers language
Indeed, my trigger is set to execute on the server, but will this work with remoteExecCall? Could there be another issue with her?
you need to do the localize call on the client
not on the server
remoteExec some script that does localize on client
an "ugly" thing would be```sqf
[{
["WeaponDestroyed", [localize "STR_Weapon", localize "STR_Weapon_destroyed"]] call BIS_fnc_showNotification
}] remoteExec ["call"];
Tho you should convert that into a function and remoteExec the function
You can also remove access clientside using the UI event handlers to recognise when players access the weapon (or inventory of dead units). Eg:
inGameUISetEventHandler ["action", toString
{
private _cont = _this select 0;
_act = _this select 3;
if ( {cursorTarget isKindOf _x} count ['weaponHolderSimulated'] > 0
&& _act in ['TakeWeapon']
) then {
// case weapon on ground, do something;
}
else
{ if ( {cursorTarget isKindOf _x} count ['weaponHolderSimulated','CAManBase'] > 0
&& _act in ['Rearm','Gear','Inventory']
) then {
// case weapon dropped by man, do something else;
}
else
{ if ( {cursorTarget isKindOf _x} count ['CAManBase'] > 0
&& _act in ['TakeWeapon']
) then {
// case inventory man, do something;
}
}
}
}
];
ideally, yeah ๐
This works for my trigger, but doesn't work for the zone capture feature.
case "red":
{
if (_trigger getVariable ["owner","none"] == "none") then
{
_zone setMarkerColor "ColorEAST";
_marker setMarkerType RedFlag;
_flag setFlagTexture getTextRaw (configFile >> "CfgMarkers" >> RedFlag >> "texture");
[{ ["PointCaptured",[_pointName2,_pointName2 + localize "STR_Captured_red"]] call BIS_fnc_showNotification }] remoteExec ["call"];
RedSectors = RedSectors + [_pointName];
BlueDrain = BlueDrain + 1;
publicVariable "BlueDrain";
_trigger setVariable ["owner","red"]
};
};
My _pointName2
PointVillage setVariable ["linkedSectors",["Alpha","Charlie"]];
PointVillage setVariable ["name","Village"];
PointVillage setVariable ["name2", localize "@STR_Village"];
of course, you are using local variables ๐
The trigger that makes the function call runs on the server.
How can I make this work? I can already imagine how many missions need to be redone...
as Lou said you're using local variables in there
[{ ["PointCaptured",[_pointName2,_pointName2 + localize "STR_Captured_red"]] call BIS_fnc_showNotification }] remoteExec ["call"];
_pointName2is undefined
you can pass it as an argument to call:
[_pointName2, { ["PointCaptured",[_this, _this + localize "STR_Captured_red"]] call BIS_fnc_showNotification }] remoteExec ["call"];
Thanks
Why is radioChannelCreate always returning 0(for failed)?
radioChannelCreate [[0, 0.95, 1, 0.8], "Radio One", "Test", []]. I'm calling this via the debug console targeting the server
either you've created too many, or the label is not unique
I'm pretty sure this is the only custom channel created on the server
Is there a way to list all channels created?
_last = 0;
for "_i" from 1 to 10 do {
if !(radioChannelInfo _i#5) then {break};
_last = _i;
};
oh, so the channels are not resetting upon a changing the mission
idk. they should
hmm, strange. I just loaded a mission and it already had 10 channels lol
granted, it was the same mission
you're probably using a mod that does that
i just went back to the mission select secreen
I just tested and it does reset
should this be pinned here?
#arma3_tools message
((typeOf (vehicle player) in ['WarfareSupplyTruck_RU', 'WarfareSupplyTruck_USMC', 'WarfareSupplyTruck_INS', 'WarfareSupplyTruck_Gue', 'WarfareSupplyTruck_CDF'])
Ok, so we've traced the source of error in our script to this piece of SQF, that refuses to work. Classnames are correct (double or triple checked). I'm just curious; why doesn't this work? (Note: Arma 2 OA)
class WarfareSupplyTruck_Gue : WarfareSupplyTruck_CDF
{
side = 2;
faction = "GUE";
};
(Quote from v1.63 config files)
The casing should be correct too, but need to try with toLower
never trust the casing. also use toLowerANSI
Arma 2 OA
tl;dr
Okay cool will do, didnt know ace had something like that
Well, we ended up switching to cursorTarget based solution since it worked well on the first try
Is there a command to get pos AND rotation of the object?
like one array with both position and array available natively
private _posASLandDir = [getPosASL obj, getDir obj];
```other than that, no
ah got it
So i have added CfgUserActions to my mod. Any way to make them only activate or work when i'm in a vehicle?
Do UserActionsConflictGroups do this or do they only check if there are conflict with other keys?
Inside your action script, just check that player is in vehicle
if (isNull objectParent player) exitWith {};
Do UserActionsConflictGroups do this or do they only check if there are conflict with other keys?
only conflicts between keys
Arma keybindings have no way to define context, aka "in vehicle only", you gotta do that yourself
I just remembered that days ago someone asked for help with keybinding, I told them to ask questions they have, and then forgot about it and now I don't remember who it was or if they ever asked questions
Found it, it was in #game_design and no they didn't ask
Hello everyone, there is a unit in the vehicle that is controlled by Zeus, there is also a code that runs on each client.
Question - what condition can be written in order to run the code only on the client that control the unit?
I tried it like this:
if (gunner _vehicle != cameraOn) exitWith {};
but such a check returns false, I also can't use player instead of cameraOn because of zeus
remoteExec?
remoteExec ["GTX_fnc_yourFunction",_unit];
or ```sqf
if (owner gunner _vehicle != owner _zeus) exitWith {};
you didn't specify what the situation is or specifically what you mean by "control the unit" but the first example will make your code only run for the machine controlling _unit (does it have to be the machine physically remote controlling it?) and the second example will check if the unit is owned by the zeus, which is generally the case when the zeus either spawns or remote controls the unit.
ty
Is that also how it is done in the engine?
Is there any way to use setVectorUp together with setVelocity in a loop?
If you do something like this:
onEachFrame {
private _velocity = ...;
object setVectorUp (vectorUpVisual object_2);
object setVelocity _velocity;
};
Then object won't budge. If you remove line via setVectorUp, then everything will be fine.
wouldnt this override the medical actions too? like treat with FAK?
I wouldn't think so. The code checks the text of the user action, such as ['TakeWeapon'] for the first condition.
where can i find the code to gain a better understanding? ingame configveiwer?
I'm afraid this is cooked up. Although based on regular scripted commands. You can read up on it here: https://community.bistudio.com/wiki/inGameUISetEventHandler
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/inGameUISetEventHandler
Notice the example in the first link for "Deny any weapon disassembly". Very popular scenarios that run on public serviers such as Invade and Annex use these commands.
why does the if scope return true?
How do you mean? Which "if" ? I'll try to take a look at it when I'm behind a keyboard.
Because sqf if's can return a value
https://community.bistudio.com/wiki/if
If you want to do that then that code puts you quite a few steps ahead, but as it is now, no. Also the EH must return true before any overrides happen, and that code doesn't return true anywhere
tongue-in-cheek question for you guys good at MP scripting...is it worth learning the intricacies of locality and painstakingly use the correct commands all the time, or just remoteExec everything
remoteExec isn't immediate, so for a lot of stuff you kinda have to use the commands.
Generally if you have a chunk of code that's working on a particular unit then you run that chunk where that unit is local.
Yeah I'm starting to see that
anyone know how Hearts and Minds defines its vehicles for use? for instance where it decides to spawn certain types of boats or decides how to place vehicles on the flatbed of a hemtt?
Is there any way for me to be in a different locality than the server in MP editor?
like how do I test this lol
You generally have to run your own DS
which is a bit easier than it looks because you can re-use the client data.
I was afraid that'd be the answer, but I've had a DS before so I can probably figure it out again
anyone know how i can attach vehicle turrets to things or make hulls of vehicles invisible i want to attach a MGS turret to a hatchback sport
yeah but im a dumbass when it comes to scripting, how would one make it only make the wheels/hull invisible?
idk if you can make a specific part of a vehicle invisible...I never tried that
Generally you can't unless it's been built with pieces that can be disabled.
I would be surprised if the roof of a hatchback was removable.
Is your setVelocity before or after setVectorUp?
Also are you running it locally?
That's only possible via textures. Also afaik wheels don't support that, so your best bet is the hull only
You don't need DS. Just run Arma twice
I already got it working lol
Ask Vdauphin. You can ping in here or just DM
any suggestions for a HUD gui explanation?
what you mean? you want something to help players with the HUD you created? or you are looking for a guide on how to set up a HUD?
I figured it out but a guide is what I mean
no
hey, is it possible to playSound only once inside an MissionEventHandler without it being looped ?
TAG_3DIcon3 = addMissionEventHandler ["Draw3D", {
{
if (_x getVariable ["GeneratorActive",true] && player == monster1) then {
playSound "soundName"; //this part only once??
_pos = _x modelToWorldVisual [0,0,0];
drawIcon3D [getMissionPath "images\AudioWaves.paa",[1,1,1,1],[(_pos select 0),(_pos select 1), (_pos select 2)+0.2], 2.5, 2.5, 0,"", 0, 0.04, "RobotoCondensedLight","center",true,0,-0.03];
};
}forEach (allMissionObjects "Land_Cyt_FE_Dirty_ElectricalSupply_Switchboard01");
}];
simply do not put it in the event handler
I donโt see any reason for it to be in there
i want a sound to be played once any of the objects is activated ๐ค
so play the sound wherever you "activate it"
also:
_x modelToWorldVisual [0,0,0];
getPosWorldVisual _x
and:
[(_pos select 0),(_pos select 1), (_pos select 2)+0.2]
_pos vectorAdd [0,0,0.2]
and don't use allMissionObjects every frame 
it's slow
do you need to be checking every frame
yeah
what he said
ideally the only thing that should go in the event handler is drawIcon3D
it can be stacked
but you should still use it once
only stack for a new purpose
fair point
so define a variable for allMissionObjects outside the expression and pass that to the EH would you say
and keep the forEach
can you send me your crashdump? game shouldn't be crashing
im sorry, i just tried the code above again and oddly enough it did not crash the game it just looped the sound file a million times.
Anyone have a robust method or tips on how to stop spawned ai groups from getting stuck?
in the washing machine?
@drifting sky Stuck immediately on spawn?
What do I add to an object in order for it to have a 30% chance of something happening when it's hit by a bullet? Specifically trying to make "pressurized containers" for reference
random 100 < 30
it's not exactly 30% chance tho
I was also looking for the on hit by bullet syntax
what I wrote is the condition you should use
noob question, but I'm trying to modify this line to replace the chemlight with the orange one from ACE:
_chem1 = createVehicle ["Chemlight_yellow", chempos, [], 0, "CAN_COLLIDE"];```
how do I access the orange one given that it's from another mod and not the base game?
(line of code comes from the awesome TF21 Chemlight Drop mod)
Same way, you just have to find the classname.
the easiest solution is to use a FiredMan event handler then throw it and copy its class name
I think the ACE arsenal gives classname on mouseover, although not sure about the mags.
player addEventHandler ["FiredMan", {
_type = typeOf (_x#6);
copyToClipboard _type;
systemChat _type;
}]
ACE_Chemlight_Orange?
That would be the one.
you're probably right, as using that alone didn't work
use what I wrote above then
I'm assuming that the CfgAmmo.hpp from the ace chemlights pbo might just have it instead?
that's the easiest way for newbies to get ammo classnames
you can go config hunting but yeah, the EH is easier at that point :P
Yea, as others stated, EH is easier and less taxing
player addEventHandler ["Fired",{private ["_fired_throwable"]; _fired_throwable = _this select 6; _shooter = _this select 0; [_fired_throwable] execvm "change_throwable.sqf"}];```
ACE_G_Chemlight_Orange is the ammo apparently
thanks gents, I'll try that out. I'm super new to modding arma but not programming, so I can read stuff just fine but fail at writing shit myself
yeah, found that too and am trying it now. Will use EH if it fails
granted this is a bit lengthy since its an over generalization of what i was doing earlier
my
reaction was to using execVM in an event handler...
I play risky 
execVM is at least guaranteed to complete eventually, right :P
Someone added this epic keyDown handler in our project that occasionally jams completely. This is bad.
Oh yea it will complete 
the problem with execVM is not just the "scheduledness". it's also slow
it reads from the file everytime yeah
Hi guys, new to the arma scripting scene and was wondering if anyone knew of a way to increase the top speed of some of the vehicles?
can't be done via scripting
unless cruiseControl can do it 
ACE_G_Chemlight_Orange worked, thanks. Will keep the EH on hand for future use ๐๐ปโโ๏ธ
setVelocity can do it :D
well shit
from what little i know of scripting its a very dirty fix
kinda funny to have a key that gives you an instant 50km/h forward kick but not a fix, yes
hmm
you don't need to do it like that
you can just define a top velocity and a set acceleration
then use setVelocity every frame while the "W" key is pressed until you reach that top speed
could either of you send me over the script to do that
not in the mood
god no, it's horrible
You could try just setMass too, but I expect there's a hard limit on top speed for some vehicles.
paper cars 
Logically top speed isn't even related to mass unless you're going uphill
Although it should certainly affect your hill-climbing abilities...
irl it can be
I'm not familiar with PhysX tho
I guess the bearing friction increases a bit? Drifting off-topic though :P
yes
so tired set mass and my vehicle decided to float XD
think im juts gonna have to deal with it
attempting to do the same for an IR chemlight won't work, as it spawns in as a dummy and doesn't get the IR light effect
class ACE_G_Chemlight_IR: Chemlight_base
{
ACE_Chemlight_IR="ACE_Chemlight_IR_Dummy";
effectsSmoke="ACE_ChemlightEffect_IR";
timeToLive=28800;
model="\A3\Weapons_f\chemlight\chemlight_blue_lit";
};
from the config
any ideas on how to make it work?
hey really noob question how can I make this work for the tilde key ~ instead of user action 14 I was looking for the DIK key for it, but couldn't find it. ```sqf
addUserActionEventHandler ["User4", "Activate", TAWVD_fnc_openMenu];
that has nothing to do with keys. it's bound to the action
just create your own action
@serene rose If you spawn in the ACE_Chemlight_IR_Dummy instead then you get the IR effect.
going on my second week on arma scripting i don't know how lol
I would guess ACE just swaps the objects after throwing.
theres no DIK key for tilde
thank you
that worked, thank you!
Hey Friends - I'm placing some players in my mission as playable players but I only want them to become 'active' when someone connects to one of them, I'd then like it to kick off a series of events around bringing them into the game whereever I am, maybe by helli.. any pointers on what I need to be looking at?
you can write a function and slap it into onPlayerRespawn.sqf
Any template examples out there I can use as a starting point?
//onPlayerRespawn.sqf
params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
if (isNull _oldUnit) then {_newUnit call KIL_fnc_yourFunction};
//fn_yourFunction.sqf
private _player = _this;
//do whatever you want with _player
So the premis is, I've got my characters setup sat on an island in the corner of the map as the placeholders. Esentially using repawn (will trigger when someone connects to one of these toons) I can then basically script it to do whatever with it...
