#arma3_scripting
1 messages · Page 145 of 1
ah i understand. we just thought about including a eventhandler.
i will ask there. maybe thats a little better then working with eventhandlers
anyone? Up!1
no workaround for sides
so its not possible to create groups that are full hostile to eveyone?
even other groups of the same type?
the closest you can get is resistance hostile to everyone but civilians
if they are hostile to a separate resitance hostile that could be what i need. because i em not really using civ
wat
like, if i create a group like _grp1 = create group blabla "resistence hostile", _grp2 = create group blabla "resistence hostile"
fill them up with units
they will fight together
hmpf
not one against each other
as I said, don't think about it, it's a (known) limitation
independent is resistance is guer
what is this? i am not familiar with the term, and its like the 10th time that i saw this
but does that necessarely mean its the resitance hostile that you spoke about?
what? no
west is west, east is east, resistance is resistance
the editor allows you to set resistance's friendliness, it can be to everyone, west only, east only, or no one
did you know, that under certain circumstance if civilian side is set to be enemy to all sides, enemies WILL shoot at houses, inventory boxes and empty vehicles as if they were enemies? Hilarious to see, I guess its part of the engine limitation regarding civvies
so its the same as using GUER setFriendly [east,0]?
yes, but I thought it had been fixed in A3
As Far As I Know
yes
it doesnt seem to happen ALL the time but I have seen it give trying new things
you could imagine i was surprised when a 9 man squad began swiss cheesing a barn in chernarus
You can't actually use "GUER" for stuff because "GUER" is just the string representation of the Side data type returned by the independent and resistance commands. It's the human-readable representation of a non-human-readable data entity, and the engine doesn't use it itself.
Like "GUER" == resistance will return false, because one is a String and one is a Side
awesome. thanks!
good to know
I am trying to write a function that disables simulation for an entire layer. Initially I was gonna write a function for every single layer but I thought that the code should at least be a little clean, so I tried writing one single function that takes in parameters.
However, it seems like I don't get how function parameters work since I can't get this script to work.
The error I get is something like "Expected Number, got string".
Can I get some help with this?
maroPeople = (getMissionLayerEntities "MaroPeople") select 0;
artillery = (getMissionLayerEntities "Artillery Position") select 0;
MY_fnc_disableUnits = {
param ["_toDisable"];
_removeArray = _toDisable;
sleep 10;
{
_x enableSimulationGlobal false;
} forEach _removeArray;
};
[maroPeople] call MY_fnc_disableUnits;
[artillery] call MY_fnc_disableUnits;
(Everything has been Frankensteined out of the wiki pages.)
Oh, also, I removed this useless part that I tried to use as a solution. Line 10 is just forEach _toDisable; now.
_removeArray = _toDisable;
param and params are different. You've used params syntax with param.
Just change it to params and you should be fine
Make sure this script only runs on the server btw - getMissionLayerEntities and enableSimulationGlobal only work on the server.
This actually runs on init.sqf, does that run on clients too? If so, is there a way to not do that?
init.sqf runs on all machines during mission initialistion, or when they join if it's a JIP client
You could move it to initServer.sqf to run only on the server, or use an if isServer then { ... }; or if !isServer exitWith{}; check if you'd prefer to keep it here for organisation.
Thanks a lot
Is there a way to change an object direction without resetting velocity ?
i'm looking to use images in my structured text hints. are there any resources for icons/images I can use?
Not sure which to put this in exactly, trying to set up a HC on my VPS, IPs is defined correctly along with battlEye license in my server.cfg, but for some reason when I launch my .bat file and the HC tries to connect to my server it says it tries to load content that's been deleted and shtufff. But In my .bat file I feel like I made it load mods correctly:
@echo off
start /min "" "C:\arma\arma\arma3server_x64.exe"^
-profiles="C:\arma\arma\Arma 3 Server\Profiles"^
-client^
-connect=127.0.0.1^
-port=2302^
-password=****^
"-Mod=C:\AllMyMods\@ace;C:\AllMyMods\@Hatchet H-60 pack - Stable Version;C:\AllMyMods\@Hatchet Framework - Stable Version;C:\AllMyMods\@ACE3 Arsenal Extended - Core;C:\AllMyMods\@ALiVE;C:\AllMyMods\@CBA_A3;C:\AllMyMods\@CUP Terrains - Core;C:\AllMyMods\@DSqn - Effects;C:\AllMyMods\@DSqn - Functions;C:\AllMyMods\@"DSqn- Gear;C:\AllMyMods\@DSqn - Maps;C:\AllMyMods\@Dsqn - Objects;C:\AllMyMods\@DSqn - Units;C:\AllMyMods\@DSqn - Vehicles;C:\AllMyMods\@Dsqn - Weapons;C:\AllMyMods\@KAT - Advanced Medical; C:\AllMyMods\@RHSAFRF;C:\AllMyMods\@RHSGREF;C:\AllMyMods\@RHSSAF;C:\AllMyMods\@RHSUSAF;C:\AllMyMods\@Task Force Arrowhead Radio (BETA!!!);C:\AllMyMods\@USAF Mod - Main;C:\AllMyMods\@USAF Mod - Utility"
Exit
my server and HC are both run on the same VPS if what
Ok, fixed it, current .bat file looks like this for anyone in the fututre to reference:
start /min "" "C:\arma\arma\arma3server_x64.exe" -client -connect=127.0.0.1 -port=2302 -password=SFOD "-mod=C:\AllMyMods\@ALiVE;C:\AllMyMods\@DSqn - Maps;C:\AllMyMods\@USAF Mod - Utility;C:\AllMyMods\@USAF Mod - Main;C:\AllMyMods\@Task Force Arrowhead Radio (BETA!!!);C:\AllMyMods\@RHSUSAF;C:\AllMyMods\@RHSSAF;C:\AllMyMods\@RHSGREF;C:\AllMyMods\@RHSAFRF;C:\AllMyMods\@KAT - Advanced Medical;C:\AllMyMods\@Hatchet H-60 pack - Stable Version;C:\AllMyMods\@Hatchet Framework - Stable Version;C:\AllMyMods\@DSqn - Weapons;C:\AllMyMods\@DSqn - Vehicles;C:\AllMyMods\@DSqn - Units;C:\AllMyMods\@DSqn - Objects;C:\AllMyMods\@DSqn - Gear;C:\AllMyMods\@DSqn - Functions;C:\AllMyMods\@DSqn - Effects;C:\AllMyMods\@CUP Terrains - Core;C:\AllMyMods\@CBA_A3;C:\AllMyMods\@ACE3 Arsenal Extended - Core;C:\AllMyMods\@ace"
What would be the faster way to send data to the server, which should then be saved in an object's namespace?
_unit setVariable ["myVarName", _value, 2];[_unit, _value] remoteExecCall ["TAG_fnc_updateMyVar",2];- any other?
I want to use it to keep track of the current weapon and ammo type of a player. Other real-time mechanics executed on the server depend on this information, so the faster the better. Unfortunately, I did not find any effective, purely server-side solution. Therefore, I register the change on the client and then distribute it to the server.
The only options I have are to either do all the computation on the client and then send the result, or notify the server and do the computation there. I'm not sure which configuration will yield the best results. Either way, I will have to send a message, and I am not sure which of the the two commands is better.
Thank you.
I'd hope that setVariable was slightly better because it's not sending an array, but only BI would know.
when using nearObjects, is there a way to differentiate buildings from the world vs buildings created by the mission ?
does anyone have the documentation on Extended_PostInit_EventHandlers vs Extended_InitPost_EventHandlers I cant seem for the life of me find it
As far as setting them up? Or when the fire?
I when they fire, I am tryning to add a CBA EH on mission start so I have it added on Extended_PostInit_EventHandlers. But because I think the main menu has a mission file in the background when I get into an actual mission (lets say ace arsenal or virtual arsenal) the PFH isnt running anymore (it also isnt added twice since I check with get/setvariable if its already been added to prevent duplicate PFH from being added, so maybe thats not needed)
actually let me more simply state my goal, I want to add only 1 PFH on the start of a mission, whats the reccomended way of adding it?
thanks, i'll give it a try
Does anyone know if syntax 3 of selectionPosition is broken? It keeps returing a value of [0,0,0] for me when I try to do this command: selectionPosition [player,"Spine3",0,true,"AveragePoint"];
hey guys! quick question for me to check if a array is only filled with string types would this do the trick?
if (_lootValues isEqualType [""])
i know that this:
if (_lootValues isEqualType [])
validates if the variable is a array, but i need to check if it is a array with a bunch of random types or just strings
in this case, just class names
works perfectly
I just added ( getObjectType _x >= 8 ) everywhere and my scripts stop reacting to world stuff
thanks a bunch
nice nice, i noticed that command the other day, had been waiting for a chance to use it somewhere :)
:p
I have a FOB building module that uses buildings from the world, so I could interact with every cargo house on the map
I would try: if (_array findIf {typeName _x != "STRING"} == -1) then { //only strings inside};
_x isEqualType "" is modern approach
but the variable is always a array, but it could be something like:
[1,["classname1","classname2"]]
or just
["classname1","classname2", ...., "classnameN"]
I meant @ornate whale 's code, checking string value type using new command instead of typeName
OH
So your array can have subarray? How deep?
got it
You want your array to have strings and arrays containing strings but no other types?
i need to check how is the array constructed. because its a function that spawns loot in DMS. i need for this part that i am working with, i want it to spawn a static loot crate instead of the random that it already do
so, its a new format that i am trying
oh yeah, I forgot that its on entities and not like mission start, cool that makes sense
It wasn't broken last I checked
How do you know that the selection exists?
Try lodIndex 1 or others too
Also lods 0 and 1 (and other vis lods) are only loaded when the unit is visible afaik
Works for memory LOD (index=9)
Wish there was more options for ARRAY find ELEMENT, like starting search from index, reverse search, etc.
ARRAY find [ELEMENT, INDEX, INCREMENTING]
For findIf too
Sure there is for with any indexes you want, but its my muh microseconds moment again
Is there a reliable way to tell if vehicle is "out"?
Drones and statics can be checked with !isNull objectParent, what about other entities?
Gear containers too
ENTITY in vehicles sort of works, but what if entity is not that list
Wondering if there is a reliable way for everything
That selection is part of its base bone hierarchy. It exists in the sample asset and it returns a value when using the second syntax method of that function. Also the player is visible when using it
Hey, I had a horrible idea and I'd like to see if it's feasible at all before diving deeper.
I want to see if I can repurpose the Futura's railgun and make a Handheld railgun-like weapon.
I saw that the tank uses a normal cannon and a placeholder one for its script, since we can only hold one weapon at a time as characters, would I have to completely rewrite the script or is there some possibility of using the Futura's?
The second syntax is different tho
One takes LOD resolution, the other takes LOD index
So try a different index
if there's no player in hearing range of a falling tree, does it make a sound?
I tried 1 through 9 to no avail. I also checked the indexes with allLods and it populated with 1 through 9
Does "FirstPoint" work?
I will try, and get back to you
Also what about non-render version? (Render flag false)
So I checked the source code. Both syntaxes use the same code except the binary version is always render scope (and it converts the lod res to lod index like the unary syntax)
So there's no way that only the unary version is broken
If that's broken the binary version should be broken too
I just tested it for myself. It seems that only proxies work in res LODs which is weird (proxies use a different code tho)
I guess it's worth making a ticket. Something is probably broken (it's probably always been like this tho. it wasn't broken recently)
Thanks for testing it Leopard!
how do I know if a player's currentThrowable is actually a lethal grenade?
(with support for mods)
hey, how is everyone going?!
so i am using one of these cup bad boys for a custom mission that gets dynamically spawned in my server:
but i noted a problem where sometimes the terrain does not help a lot and it starts flickering and some times is sent flying in the air killing the nearby ai
i tried disabling simulation, but that also stop the AI from using its m135 (this heli is a static machine gun)
this problem sometimes happens with other static guns that spawn around it as well
is there a way to only disable physics of a static machine gun to lock it in place without disabling it for usage?
basically make the vehicle stuck and not been able to move, but preserve its attributes
M134*
You could attach it to something
@moses it doesn't the keydown keyup handlers are not 100% reliable.
Also, actionKeys can be tricked by rebinding vault to 2xv
i am just thinking on how i would do that since the objects are spawned dynamically and dont have variable names.... i would need to code a bit for that, but would definitely do it, maybe i could script the mg spawn script to also create a small object below it and attach it. Just to be sure... attach does not mean it needs to be touching right? i could spawn one prop like, 20m below it and attach right?
a prop without simulation
If it works for the average player then fine, but I would still be able to vault, just saying ; )
also, if i create a object and attach it to other object without passing offset, both keep their positions right?
Hi, I've got a "generic expression error (line 26 is flagged)" ` However, I've spent hours searching and still can't figure out why. Any help please? I've attached the script.
Can you tell the EXACT error message?
Here it is
Should be the unit which the function is attached to. In this case the vehicle (I think)
it has zero prams. This is how I call it within an eventHandler [] call Rider_LanceAttack; I assume _this would be the unit the handler is attached to
So _this is nil?
seems like it is not liking what are you trying to compare with _rider, try logging what _x is each time to see if is compatible, you might need to use isTypeOf before
hmm, I think I get you.
Thanks. I'll check that out.
@warm hedge Thanks. I'll make some tweaks with your input.
I don´t get why the init order seems to change randomly sometimes. I feel like the game tries to troll me.
I expect it to run like initServer, initPlayerLocal, initPlayerServer, onRespawnPlayer. But it changes wildly from time to time.
And it is not just when I switch from SP to MP (there is difference), but sometimes even when I just restart the mission.
Get the magazine class
Then from the magazine get the ammo class
And from the ammo class get the...I don't remember the property name but it could be indirectHit. Check in config viewer
I wanted a simpler way but looks like I'll need to go through all these hoops 😔
so be it
getNumber ( configFile >> "CfgAmmo" >> (getText (configFile >> "CfgMagazines" >> (currentThrowable player select 0) >> "ammo")) >> "indirectHit")```
now I need to remove a single grenade from the unit's inventory
removeMagazine seems to have the side effect of making the grenade unselectable until it is moved using the inventory
its even documented that the order is not guarenteed. this is why you have to wait for public variables to populate on the client before running the client scripts
for example, a section in initPlayerLocal.sqf:
waitUntil {
private _index = [
"variable_1",
"variable_2",
"variable_3"
] findIf {isNil _x};
diag_log format["Public Variable [%1] not populated...", _index];
_index == -1;
};
// Yay all the stuff is populated, lets continue!
yeah hm anyone have any ideas
or is this a BIS problem?

https://feedback.bistudio.com/T79813
Fix is on dev/prof for likely deployment with 2.18
@hallow mortar will "attachTo" remove the object collision? 🧐
what i am doing is, instead of just spawning the HMG in its position, i am spawning a brick in the same position but with Z -20
and i will attach the HMG to the brick
but i am worried that it can disable the HMG colision with the player
any info on that?
i mean... i prefere the no colision then a buggy HMG but... its not ideal :/
Maybe™
It's very easy to test
yeap, i just wanted to get a little ahead before coding
hehe
but i am already doing it
No, velocity is always reset.
However, you can get the relative velocity before the direction change using velocityModelSpace, and reapply it afterwards with setVelocityModelSpace.
wiki dont say anything about collision, i guess i will have to try
I have previously attached things and had them retain their collision; other times different objects have been less consistent. So I can't give you a solid answer, try it with your particular object.
You don't have to try it in your full mission if that's inconvenient because of mission mechanics - this is a simple test that can be done in an empty VR mission.
ok, cool, thanks for the tip!
this worked so well that i honestly i dont know why DMS was not done like this since day 1
Anyone here good with vector math? I'm trying to have an object, an arrow in this case, follow another objects up and dir vectors while maintaining its initial offset in said vectors.
My test case is two arrows, one vertical and the other perpendicular to it. I am trying to make the arrow that perpendicular stay perpendicular when the vertical arrow tilts.
This is the code I'm trying:
_c1VectorDir = vectorDir c1;
_c1VectorUp = vectorUp c1;
_c2VectorDir = vectorDir c2;
_c2VectorUp = vectorUp c2;
_newUpVector = _c1VectorUp vectorDiff _c2VectorUp;
c2 setVectorDirAndUp [_newUpVector, _c2VectorDir];
c1 is the vertical arrow and c2 is the perpendicular one.
The current result is that c2's up direction changes on every run of the code in a seemingly random direction..
I’m using Larrows Eden composition spawning script to spawn in compositions (fobs). I have it set up to create a trigger and set the terrain height inside the trigger to the height of the trigger. Seems ok, but is there a way to “smooth” the terrain in say a 100m radius so that the transition isn’t as obvious?
Just looking for some pointers on how I might go about this
For vector-y approach, this can probably work (or not) ```sqf
_localDir = c1 vectorWorldToModel (vectorDir c2);
_localUp = c1 vectorWorldToModel (vectorUp c2);
MEME_localDirAndUp = [_localDir, _localUp];
// following would need to run every frame or whatever
c2 setVectorDirAndUp
[
c1 vectorModelToWorld MEME_localDirAndUp#0,
c1 vectorModelToWorld MEME_localDirAndUp#1
];
Dumb and easy way would be to spawn a logic at c2's location, sync its rotation with c1, `attachTo` c2 to it sync logic rotation to c1's afterwards. And probably faster, as i suspect attachment would be processed engine-side 🤷♂️
you mean like modify the terrain mesh?
like "further modify the terrain mesh", probably. There's "set the terrain height inside the trigger to the height of the trigger" part already :3
Not quite there with the vernacular. Just basically using some maths to calculate setTerrainHeight for a radius outside the trigger.
Something like get terrain height in area triggernname. Then get the terrain height for each “grid” (I think there is get terrain info), for each outer “grid” and step level the terrain in between to slope and match.
Basically would make placing bases and other compositions a breeze.
Sorry if that doesn’t make sense.
Here’s a trigger that sets the terrain height. Not at home, but I’ve modified this to basically set the terrain height to the trigger height.
https://www.reddit.com/r/armadev/s/lCCYkxzAnY
What I want to do is slope the surrounding area terrain height up or down from around 50 or 100m out to the trigger, so that the height transitions look more natural.
So clarify, you want to flatten a place, and make the gap smooth so there won't be a noticeable "gap"?
_sounds = ["sellervoice1","sellervoice2"];
fr1 say3D [(selectrandom _sounds), 15, 5, 0, 0, true];
it gives an error 6 elements provided 1 expected
though i copied the example from the website and just changed some of it what am i missing?
What is fr1?
its the unit name
fr1 say3d (selectrandom ["sellervoice1","sellervoice2"]);
this works, but the previous one i sent doesnt work, im trying to get more options for the sound
Not so much a gap, but if you raise terrain or lower it in an area, I want to finesse the edges to have a smooth transition.
Imagine I place a trigger and try e area inside the trigger is raise 10m. It’s gonna look like a square block raise from earth. What I want to do is smooth from the edge of the area that was raised/lowered to the surrounding terrain
Which version you're on?
That's what I mean by quoting gap. It definitely is possible with some simple math, like linearConversion
linear conversion of distance between square inside and round outside doesn't sound exactly simple, though 🤣
Trigger will be square. I just threw something up as an example
Converting square into sphere is the most complicated thing if that's the case, yes
Don’t think I’d need to do that. It’s fine with a square trigger and square surrounding area.
strictly square, not rectangle?
i keep it always updated, its the latest version now
So 2.16?
yes should be, im trying to check to make sure also
That means you can't have the last argument you use there
so say3d was updated long ago im assuming
Read BIKI. The last argument is only added 2.18
(and 2.18 is in the future)
Square.
thanks, thats what im missing, im blind
_r = [] ;
triggerArea trig params ["_trigX","_trigY"] ;
_pos = getPosWorld trig ;
_grid = getTerrainInfo#2 ;
_diag = sqrt ((_trigX^2) + (_trigY^2)) ;
for "_xx" from -(_trigX*3) to _trigX*3 step _grid do {
for "_yy" from -(_trigY*3) to _trigY*3 step _grid do {
if ((abs _xx > _trigX) or (abs _yy > _trigY)) then {
private _posLocal = [_pos#0 + _xx,_pos#1 + _yy] ;
_r pushBack [
_pos#0 + _xx,_pos#1 + _yy,
linearConversion [
_diag,_diag*1.5,
trig distance2D _posLocal,
60,
getTerrainHeightASL _posLocal,
true
]
] ;
} else {
_r pushBack [_pos#0 + _xx,_pos#1 + _yy,60] ;
} ;
} ;
} ;
setTerrainHeight [_r]```Definitely not perfect but my idea is somewhat this
That’s perfect. I’ll check it out when I get home.
Thanks @warm hedge
It's very janky so it may not match to the actual dimension, but the math itself is not complicated so you can guess
that... looks like it's going for circles around the square trigger?
Yes
well, for square-ish square you can possibly go for linearConversion [_trigX, _trigX + 100, (abs _yy) max (abs _xx), ... (assuming _trigX and _trigY are equal) 🤔
inb4 smoothstep
@stuck palm oops, sorry, that should have max, not min
No worries. I’m about to leave work and will mess with it as soon as I get home
Both versions work great. Thanks @warm hedge and @south swan
my code literally works because of an unintended oversight
"this isn't supposed to work, but it does"
I love programming,.........................
"we call them happy little accidents" BobRoss.jpg
better late than never @still forum 🥴 https://feedback.bistudio.com/T79813
Actually, now i know i can pass arguments to mission event handlers the problem is solved. I can use EachFrame event, put setVelocityModdelSpace and SetVectorDirAndUp in it and it's ok
So it's close, but not quite sure how to adjust to get it precise?
wat
I assume there's come variances in positions. Seemed to work in VR, less so in Altis.
_logicPos = getPosWorld _logic;
diag_log format ["_logicPos %1", _logicPos];
//Create trigger to flatten terrain on the logic entity.
_flattenTrigger = createTrigger ["EmptyDetector", _logicPos];
_flattenTriggerSize = [100, 100, 0, true, 1];
_flattenTrigger setTriggerArea _flattenTriggerSize;
_r = [] ;
triggerArea _flattenTrigger params ["_trigX","_trigY"] ;
_pos = getPosWorld _flattenTrigger;
_grid = getTerrainInfo#2 ;
_diag = sqrt ((_trigX^2) + (_trigY^2)) ;
for "_xx" from -(_trigX*3) to _trigX*3 step _grid do {
for "_yy" from -(_trigY*3) to _trigY*3 step _grid do {
if ((abs _xx > _trigX) or (abs _yy > _trigY)) then {
private _posLocal = [_pos#0 + _xx,_pos#1 + _yy] ;
_r pushBack [
_pos#0 + _xx,_pos#1 + _yy,
linearConversion [
_diag,_diag*1.5,
_flattenTrigger distance2D _posLocal,
60,
getTerrainHeightASL _posLocal,
true
]
] ;
} else {
_r pushBack [_pos#0 + _xx,_pos#1 + _yy,60] ;
} ;
} ;
} ;
setTerrainHeight [_r, false];
Figured since I am creating a trigger at the logic worldpos, it'd be consistent. Instead the terrain either envelopes the base or is meters under it.
terrain goes to 60, because 60 is listed in the code 🤷♂️
_flattenTrigger distance2D _posLocal,
60,
and
_r pushBack [_pos#0 + _xx,_pos#1 + _yy,60] ;
?
yes
Ah, I was trying to flatten it to the height of the trigger as well.
download soon, however still debating if I should do the grenade workaround
if anyone has questions on how I made the mod feel free to ask
I think I got it.
_logicPos = getPosWorld _logic;
_zOffsetLogicPos = (_logicPos select 2) - 2.357;
//...
linearConversion [
_diag,_diag*1.5,
_flattenTrigger distance2D _posLocal,
_zOffsetLogicPos,
getTerrainHeightASL _posLocal,
true
]
//...
_r pushBack [_pos#0 + _xx,_pos#1 + _yy, _zOffsetLogicPos] ;
seems to work
Thankyou for your suggestion, unfortunately the result is c2's dir seems to rotate in the opposite direction with the object (even after trying to invert the vector) and the up vector stays locked to c2's original up vector
seems to work alright in my testing 🤷♂️ (full code at https://pastebin.com/teUbXaF7, flat arrow is c1)
Thanks artemoz!
@south swan Do you happen to know how to do the same thing but with a provided vectorDir and vectorUp instead of an object? For example instead of using c1 as an object, can we use it as a set of vectors? This would lose out on the currently used "vectorWorldToModel" function
I guess what Im asking, is how does Bi's vectorWorldToModel function actually works, since I want to provide my own position and vectors instead of using an object
The equivalent of VectorModelToWorld in SQF is essentially this:
_vx = _vy vectorCrossProduct _vz;
_mat = matrixTranspose [_vx, _vy, _vz];
flatten (_mat matrixMultiply (_modelVector apply {[_x]})
_vy and _vz are vectorDir and vectorUp, respectively
It uses matrices
And vectorWorldToModel is similar without the transpose applied
(assuming the vectors are normalized and perpendicular, otherwise you have to compute the inverse of _mat)
BTW we now have vectorSide iirc so you can use that for _vx
what are the _vx/y/z's? Are they vectors in just that direction?
They are world vectors
3 perpendicular world vectors
Like vectorSide,vectorDir,vectorUp
// c1 vectorModelToWorld vec1
(vectorDir c1 vectorMultiply vec1#0) vectorAdd
(vectorSide c1 vectorMultiply vec1#1) vectorAdd
(vectorUp c1 vectorMultiply vec1#2)
``` 
Yeah that works too
And for vectorWorldToModel it's:
// _obj vectorWorldToModel _worldVec
// assuming the object is not scaled/skewed
_vx = vectorSide _obj;
_vy = vectorDir _obj;
_vz = vectorUp _obj;
[
_vx vectorDotProduct _worldVec,
_vy vectorDotProduct _worldVec,
_vz vectorDotProduct _worldVec
]
Btw you should swap vectorSide and vectorDir (side is x, dir is y)
Oops
Anyways, i'd argue it's the worldToModel part that's the most interesting out there
With calculating the inverse transform matrix and stuff
You don't really need inverse if object is not scaled and skewed
It'll be similar to this, with:
_worldVec = _worldPos vectorDiff getPosWorld _obj
(for _obj worldToModel ASLtoAGL _worldPos)
What is the output of this? Normally I would provide a single vector like you did, say vectorUp or [0,0,1]. Is the array in your code the model version of that single vector?
Output is a vector in model space (converts _worldVec to model space)
ah, good old "just project onto basis vectors, lol". Sheesh, i was trained at that half my life ago (but even then i wasn't good)
You both have been INCREDIBLY helpful, I've been stuck on this for way too long. Thankyou thankyou thankyou
Anyone know if with ACRE2 it's possible to set 2 groups in the same faction to different channels by default
Do you happen to know what these functions are?
nice this works
onLoad = "_this select 0 ctrlSetURL 'http://arma3.com/';";
so this config parameter works but it only works on the second and subsequent clicks
the first click only adds the url
it only opens browser after the 2nd click
If you want to open it without any user input, there is a way to force click a button
I forgot but recently mentioned here
hey im new to the game anyone have a discord server i can join
yeah i've tried action = "_this select 0 ctrlSetURL 'http://arma3.com/'; ctrlactivate (_this select 0);";
but it doesnt open the link still
i think it doesnt work because the command doesnt activate the button action and UI event handling
the alternative syntax to simulate full button action is not implemented until 2.18 so will have to wait to test that one i guess
I can't force the ai to throw a grenade using any method that used to work. Anyone know any way that still works?
I only need him to actually fire, doesn't matter at what or in what direction
forceWeaponFire works.
bit of a pain digging up the right muzzle given a grenade magazine.
None of these work any longer:
[_unit, "HandGrenadeMuzzle"] call BIS_fnc_fire;
_unit forceWeaponFire ["HandGrenadeMuzzle","HandGrenadeMuzzle"];
_unit fire ["HandGrenadeMuzzle", "HandGrenadeMuzzle", _magazine];
_unit fire "HandGrenadeMuzzle";
The first one,
[_unit, "HandGrenadeMuzzle"] call BIS_fnc_fire;
Was working fine and was what I was using, until it stopped working some weeks ago.
Are you sure that's the right muzzle for your grenade?
Pretty sure. It was working before.
Are you on perf or dev branch? The last update to main branch was...more than some weeks ago.
Hmm.... seems to be something wrong specifically with CUP hand grenades
maybe it was a CUP update that broke them
uh, CUP hand grenades don't use HandGrenadeMuzzle.
Every grenade magazine has a different muzzle.
Look at CfgWeapons >> Throw
huh, that's weird, the generic HandGrenadeMuzzle used to work for cup grenades of all types
It's not even supposed to work with all vanilla grenades.
Like the RGN uses MiniGrenadeMuzzle.
smokes have a different muzzle for each colour.
I guess I was thrown off by a lucky glitch that must have been fixed at some point
I really hate Arma sometimes
ENTITY stopVariablesReplication ARRAY;
player stopVariablesReplication ["var1", "var2"];
player setVariable ["var1", 123];
forceRespawn player;
...
player getVariable "var1"; // nil
Can I somehow change the values of the new stamina system? Like for example how weight influences the stamina? I don't want to turn it off...I just want to change it to my needs!
I have 2 part question.. I have a script that makes a bunch of prisoners follow a player whoever steps into a trigger first. Works fine, but 1. I would want them to go into the helicopter naturally via waypoint and not instant with moveInCargo. I tried adding setWaypoint and setWaypointType but that didn't seem to do the trick :/ then 2. after the prisoners are extracted I would want them to get out of the helicopter via waypoint too, to just naturally get them out instead of instant.
Here's the script
params ["_prisoners"];
// Make the given group of prisoners follow the player and get into a nearby helicopter
while {true} do {
{
private _prisoner = _x;
private _nearbyHelicopters = nearestObjects [player, ["Air"], 6]; // Find helicopters within 5 meters of the player
if (count _nearbyHelicopters > 0) then {
private _helicopter = _nearbyHelicopters select 0; // Select the nearest helicopter
_prisoner doMove (position _helicopter); // Move the AI to the helicopter's position
// Wait until the prisoner is within 5 meters of the helicopter
waitUntil {sleep 1; _prisoner distance _helicopter < 6};
// Add a small delay before getting into the helicopter
sleep 2;
// Get into the helicopter
_prisoner assignAsCargo _helicopter;
_prisoner moveInCargo _helicopter;
} else {
_prisoner doMove (position player); // Move the AI to the player's position
};
} forEach _prisoners;
sleep 1; // Wait for 1 second before repeating the loop
};
I have my triggers and prison groups (in total there will be 4) set up in a BEAR_postInit.sqf
Ah, is the difference between moveInCargo and orderGetIn that the latter is acting like how AI would move with a waypoint?
moveIn* are instant commands
Being inside of a vehicle does not always mean the group leader wants to let him in, too
only sending the prisoner to the heli position once seems like it's prone to break if the heli moves a bit. Especially when the entire group's brain is halted in waitUntil until that one prisoner gets close to the heli
So these are values I can actually change: "staminaDuration" ... "maxSoldierLoad"?
Hi! Does anyone know how I can make RscText text bold or change the font size? At the moment I managed to center the text using style = ST_CENTER;?
font size is the sizeEx property
You can't make it bold tho
You have to change the font
or go RscStructuredText, probably
List of available fonts. Either use those or make your own font (which is too much hassle)
Okay, tysm
mod? yes. mission? no.
18:36:29 ["174360","playerRespawnTime","0"]
18:36:29 Respawn failed - body disappeared
18:36:29 ["174361","playerRespawnTime","1999998"]

After I did setPlayerRespawnTime 0;
You can write a stamina script to constantly deal with stamina. R34per's missions all have a stamina script which stretches your stamina pool.
You'd need something that'll check you're stamina delta and then reduce or enlarge it.
Yo bros is it possible to trigger an inputAction via script?
Not that I know of, but you can normally emulate the desired effect through script
Does remoteExec or remoteExecCall wait until the command is finished on the remote machines or it just moves on?
From the calling script? It just puts them in the network queue and moves on.
Damn thanks
Anyone know if its possible to attach something to the moving part of a door and have it move with it? My experimenting suggests not
Yes.
Use
object1 attachTo [object2, offset, memPoint, followBoneRotation]
//followBoneRotation: Boolean - (Optional) follows the memory point's rotation (if attached to one)
How do i place a camera thet films me playing like an other player or as similer as possibale in singelplayer
Like in example demo charge it doesn't follow.
But if you use
private _expl1 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl1 attachTo [player, [-0.15, 0.13, -0.18], "spine3",true];
_expl1 setVectorDirAndUp [[-0.707107,-0.707107,0],[0.707107,-0.707107,0]];
private _expl2 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl2 attachTo [player, [0.15, 0.13, -0.18], "spine3",true];
_expl2 setVectorDirAndUp [[-0.707107,0.707107,0],[-0.707107,-0.707107,0]];
private _expl3 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl3 attachTo [player , [0, 0.2, -0.18], "spine3",true];
_expl3 setVectorDirAndUp [[-1,0,0],[-0,-1,0]];
It will follow.
Like if you set unit unco
Okay yeah looks like what I was trying to attach to just didnt have the right memory points and thats why, thanks
Hello! How can I make a local variable accesible for all the scripts? Because if I have a _param = _this select 0; and I want to use that _param inside an if it says Undefined variable
_thisis empty array- Your
ifis in different scope (script)
I'm using a function ["menu"] spawn vls_fnc_shop; _this selects the parameter I'm using for the function, the if I use it to do some checking of the item you want to get, etc, it's all inside the same script.
Post the whole code in that function
Hey folks,
I am having trouble with using Variables in initPlayerLocal that are created in initServer
The idea is, that I create a publicVariable in initServer and use this in initPlayerLocal.
But sometimes when the initPlayerLocal script runs, the Variable is not yet initialised. I am solving this currently with a random sleep, but thought it would be nicer to just use a waitUntil and check if the Variable is initialised.
How would I do this? Would I check on "objNull" or is there another function like that checks if the Variable exists that I am not aware of?
isNil
waitUntil not isNil
Is there actually a way to destroy a flying missile ? Missiles doesn't have damage system
Yes, actually i'm looking for a way to shoot it down but i think i'm gonna have to do it scripted
inb4 deleteVehicle
Somehow deleting previous body causes respawn to fail 🤔
13:15:58 Respawn failed - body disappeared
Seeing really weird stuff, dead ex-player unit never goes into ragdoll, always has group no matter how long you wait
And if you delete it, next respawn fails like this
Armanormal activity
[isPlayer player, alive player, player, getPlayerUID player, name player]
=>
[false,false,1ce63c40400# 1780850: b_soldier_01.p3d,"","Sa-Matra"]
Thank you Arma, very cool
You can also delete your corpse just fine
player => <NULL-object>
Perfect, thank you so much guys
Result of pretty much
player setDamage 1;
selectPlayer anotherUnit;
Probably repro-able
Player unit remains without ragdoll, never loses group and if you delete it, it messes up new player's respawn
No more ragdolls finally 🎉
You can keep adding the corpse to your group
Group bar with just you there, never seen this before
Hi, I have a question, I have this code to add a list of weapons to a Listbox, how can I get the icon and put it in front of the weapon name? I know that to get the path of the icon is with getText(configFile >> "CfgWeapons" >> _weaponName >> "uipicture"), what I need is to add it in front of each object in the Listbox. The code is this:
{
private _weaponData = _x;
private _weaponName = _weaponData select 0;
private _weaponDisplayName = getText (configFile >> "CfgWeapons" >> _weaponName >> "displayName");
private _weaponIcon = getText (configFile >> "CfgWeapons" >> _weaponName >> "uipicture");
_listaArmas lbAdd _weaponDisplayName;
} forEach _primaryWeapons;
Right now it looks like this:
uipicture is a tiny icon for group bar at the bottom of the screen, picture is the image you see in inventory and such
Anyway, you need
private _index = _listaArmas lbAdd _weaponDisplayName;
_lastArmas lbSetPicture [_index, _weaponIcon];
Or even a one-liner if you don't need index for anything else
_lastArmas lbSetPicture [_listaArmas lbAdd _weaponDisplayName, _weaponIcon];
Ok, tysm!
Still having problems with making body die for good, any ideas how to accelerate body's "brain" dying faster? (group becoming null)
yo bros how do you get the script that runs when an inputaction is triggered
like inputaction showMap the script would probably be openMap
The idea that inputActions trigger a script and not enginestuff is a very big assumption
For modded keybindings that do definitely trigger a script, you can do a config lookup in CfgUserActions, but vanilla inputActions do a lot of things that aren't accessible by script at all. They have direct engine access.
I'm not sure I understand what the problem is, but it might help
https://community.bistudio.com/wiki/hideBody
if I define a variable like this
myVar= 123;
does that become a global variable that gets added to mission namespace?
https://community.bistudio.com/wiki/Variables#Scopes
That is a global scope variable, in the missionNamespace by default unless you used with previously. It is not a network global variable unless you then use publicVariable on it.
ahh ok so unless you use with its always in missionnamespace?
im trying to understand these namespace concepts
can you give examples on what purposes certain namespaces would be used
The missionNamespace is the default namespace. If you want to work with variables in a different namespace, you have to use with or setVariable.
An example could be that you want to track object-specific attributes of some kind. You'd want to store those in the object's namespace so they don't conflict with attributes belonging to other objects, and so they can easily be retrieved by referencing the object.
Alternatively, you'd use profileNamespace if you want to store information that needs to persist outside the current mission.
I see so its possible to create 2 variables with the same name but they exist on 2 different namespaces (namespace of object 1 and object 2)
Example: I want to add an action to some objects, and be able to remove them later. I can use the object's namespace to store the action ID on the object.
private _actionID = _object addAction [ ... ];
_object setVariable ["my_actionID",_actionID];
// ...
_object removeAction (_object getVariable ["my_actionID",0]);```
how many namespaces in arma? the namespace wiki page only listed several but it seems theres more such as object namespace as you mentioned above
https://community.bistudio.com/wiki/Namespace
so the terminology there is varspace, namespace is a part of varspace?
essentially the same thing
https://community.bistudio.com/wiki/currentNamespace only has 5 values
ok they function the same but they are different right? cuase i dont wanna confuse them
That command is for the global namespaces that aren't associated with any specific entity
I've been trying to run "ammoHit" Event handler within an ammo class. class EventHandlers { //init = "systemChat format ['init ammo EH output: %1 [time: %2]', _this, time]"; fired = "systemChat format ['fired ammo EH output: %1 [time: %2]', _this, time]"; ammoHit = "systemChat format ['ammoHit EH output: %1 [time: %2]', _this, time]"; }; only fired works. Please is this EH no longer supported?
The terms "variable space" and "namespace" mean pretty much the same thing.
There is one technical difference, which is that there is a Namespace data type which is only used for the global non-entity-specific namespaces. Entity-specific namespaces are referenced by using the entity itself, not a Namespace data type reference.
@ripe sapphire your default namespace can change when using with as well so be careful. Check out my note on the with wiki page.
I'm almost sure I mentioned that earlier 🤔
Oh yeah it looks like you did.
i see now thats a very good explanation
so is this correct
Yes, that's the point of namespaces
A namespace is a space in which names are searched for. Names (and the things attached to those names) outside of that space are ignored.
i see, but will it affect execution of normal scripts (e.g running hint "hello" within mission namespace and object namespace)
Namespace controls which set of variable names are referenced. hint "hello" is not referencing any variable names so it's completely unaffected.
Meh... thanks anyway
ahhh gotcha so as long as no variables are in use the namespace of the code have no significance
What do I need if I am trying to place something, and over land it's fine, but over sea, it's below where it should be? Is that ASLToAGL?
Usually I just create the object and then immediately setPosASL it to the correct position rather than fucking around trying to get the right position for createVehicle
Another mod is setting positions, and that's happening to the units it sets the positions of
#line 1 "A3\functions_f\Debug\fn_camera.sqf [BIS_fnc_camera]"
#line 0 "/temp/bin/A3/Functions_F/Debug/fn_camera.sqf"
what does this command do?
the #line
Whats a fake explosion? Like one that looks like one, but is really something else? Just make a real explosion by spawning a missile, bomb or set off a satchel charge
i need like the sound and the effect
because a realone would do dmg to the heli i dont want
Allowdammage false will stop heli taking damage.
then how would i spawn a missile targettting the heli and know exactly when it hits
Set all objects that are within the blast radius to no damage, after the explosion reenable damage.
yea i know
but i need like a missile coming so we get the rwr warning
you can script a missle to hit target, but I do not know if that gives an RWR warning.
the thing is i dont know how to
Just make an Armour AA unit shoot at it
Simple script that allows you fire a guided missile from the position of your choice to any type of target (object, unit, laser designated target...) I made this script for a mission Im working on and I thought that could be useful for others. Hope you enjoy it ! Link to the script guidedMissile....
firstly zsu ai do not care if i set there amoo to zero turn off there ability to shoot
thanks
zsu ai use magic to shoot even when they have 0 ammo
the missile rubber banded a few times before blowing the heli upand destroying everything
i need to know when the heli is hit
yo bros does displayAddEventHandler work before a display is created? and does the EH stay after display is closed and then re opened again? or do i have to add the EH everytime
everytime
and you have to have a display already created for displayAddEventHandler
i made a script to do it for me
how would i remove all counter measures from a vehcile
an also i need to stop ai from shooting the player after they scuttle the heli even tho theres no one inside
I love how A3 non-ragdoll bodies retain aiming pitch
Arma is indeed a paranormal game, yesterday I had the bug where dead body was not dying completely and breaking the respawn, today it doesn't happen in exact same setup anymore
All I did was restart Windows
I love spending 2 days figuring out the bug, isolating it, trying different approaches to bypass it only for it to never happen the next day
You love to break two decades old game
how the fuck do the ai figure out that i scuttled the helicopter when there on the other side of the map and not in the same group
It does it by itself, I swear
Once all clients crashed on my server after a restart, turned out it was the saved weather values for some reason (Worked for ages before) 
like why do ai ff you when you destroy a empty helicopter
player addRating 1e7 
i can now become the rank god
didnt work]
still got shot
Some scripting might be removing the rating
Or you didn't execute the script
Or at the wrong time (when there is no player yet)
wrong time it was in the init
You need to wait until player inits
0 spawn {
waitUntil {alive player};
player addRating 1e6;
};
thanks but i dont need it i have it in a trigger
I see so when the display exits all the EHs die aswell right
An EH is only alive as long as the parent thing is alive, in this case display
Ahhh gotcha
So whats the best way to detect when a display is created, do i have to use a condition check loop
I want to add a new EH to the splendid camera display
For BIS displays you can use that
Banger nice thanks
kinda curious why this code doesnt always work (test works but sometimes params messes up things ```sqf
private _testNum = 0;
_coords = [123,888];
_coords params ["_testNum","_notUsed"];
systemchat format ["test %1 %2",_testNum]; // Prints 123
What doesn't work exactly?
in some cases params doesn't set the new value to _testNum
You probably supply nil or empty array there
systemchat format ["test %1 %2",_testNum, _coords]; to see what's up
idk i had to switch to select to get it working _testNum = _coords # 0; and get rid of params
You'd just end up with nil instead of using previously defined value in such case
You're supplying either nil or empty array as _coords, log data to see where it goes wrong
like i said using select instead of params worked for me, in my project. and the test code provied always works
select and params behave differently in case of wrong data
If you expect to always have first element in the array, both will work the same
but you supply bad data and that's where your problem is
the data was good in the end
private _testNum = 0;
_coords = [123,888];
_coords params ["_testNum","_notUsed"];
// _testNum is 123
_testNum = _coords # 0;
// _testNum is 123
private _testNum = 0;
_coords = [];
_coords params ["_testNum","_notUsed"];
// _testNum is 0
_testNum = _coords # 0;
// _testNum is nil
private _testNum = 0;
_coords = nil;
_coords params ["_testNum","_notUsed"];
// _testNum is 0
_testNum = _coords # 0;
// _testNum is nil
interesting, could be something like that but then again the data was good
this is copy of the actualy code that i couldnt get working with params ```sqf
private _coords = [_fob,side _group] call getOutsidePlaceCoord;
//_coords params ["_startAngle","_spawnDist"]; // Must be commented out or _spawnDist will be zero
_spawnDist = _coords # 1;
it works only without params
_spawnDist is defined above that code
Looks like your function fails and returns nil
umm but _spawnDist is correct in the end
enemy siding with rating is kinda silly, a war crime counter would be much better
2001 gameplay mechanics
figured the problem out that I had. it was scope issue ```sqf
private _testNum = 0;
call
{
_coords = [123,888];
_coords params ["_testNum","_notUsed"];
};
systemchat format ["test %1",_testNum]; // Prints zero
You are defined in call your testNum, it's not changed outside of call.
_myvar = 123;
systemChat str [_myvar]; // [123]
call {
systemChat str [_myvar]; // [123]
private "_myvar";
systemChat str [_myvar]; // [any]
_myvar = 345;
systemChat str [_myvar]; // [345]
};
systemChat str [_myvar]; // [123]
https://community.bistudio.com/wiki/private
https://community.bistudio.com/wiki/call
yeah I get that params acts like the private command
I want to put unit's weapon in box and give him weapon from box. How can I save all the attachments that both weapons have, including magazines with the number of rounds? Something with weaponsItems command?
_unit removeweapon _unitrifle;
_container addweaponCargoGlobal [_unitrifle, 1];
_unit addweapon _ARifleinbox;
_container addweaponCargoGlobal [_ARifleinbox, -1];
What i need to add here?
Not sure if it supposed negative amount though
Doesn't seem so
@meager granite Can you explain in more detail for the incomprehensible? 🙂
Do test runs of the command and you'll see what it returns
@meager granite weaponsItems returns all weapons. How can I drop to the box only PrimaryWeapon?
Walk through array and find it in the array
I don't know if addWeaponWithAttachmentsCargoGlobal supports negative amount, if it doesn't then its futile and you'll need to do hacky stuff
Wow, you get variables copied from 2 bodies ago!
- Player unit #1 dies
- selectPlayer unit #2
- Player unit #2 dies
- Player respawns into unit #3
- Vars from unit #1 are copied to unit #3
These respawn events and variables are a fucking curse
And yeah you can't even nil variables on unit #1 because nils are also copied
This bug started happening again btw
Didn't happen yesterday, started again today
I didn't even touch the code there, I swear

GIB
open source Arma 3 when?
player in playableUnits => false
Wanted to do an arrange of bugged non-ragdoll units but one unit didn't die! Now he's the only unit in playableUnits
allPlayers - just me
playableUnits - just that bot unit
playableUnitsReal when?
O mighty bugged unit tell us your secret why you happen randomly
One of my favourite rare bugs in this field is when a player disconnects from a slot that has AI on (so their old body stays alive as an AI), then when they reconnect to the same slot, instead of taking over the old body again like normal, they create a second copy of themselves. It doesn't happen often but it's always funny
Seen it plenty of times over the years, OA included
Nowadays I just delete lobby unit and createUnit the player
You get these other bugs though
@meager granite
_WeapItUnit = weaponsitems _unit;
_PrimWeapUnit = _WeapItUnit select 0;
This way i found primaryweapon array in weaponitems. How can I use this with addWeaponWithAttachmentsCargoGlobal ?
Check what format it wants vs what format weaponsItems returns, build new array and feed it into command
They're probably similar
For you maybe 😄
Returned by weaponsItems: format [weapon, muzzle, flashlight, optics, [magazine, ammo], [magazine, ammo], bipod]:
Wanted by addWeaponWithAttachmentsCargoGlobal : weaponConfiguration: Array in format [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]
Same format even, no actions needed
But again addWeaponWithAttachmentsCargoGlobal might not support negative counts to remove the weapon, only to add
_container addWeaponWithAttachmentsCargoGlobal [_PrimWeapUnit, 1]
Yeah, try it
i don't need to delete with addWeaponWithAttachmentsCargoGlobal , i will do it with addweaponCargoGlobal, it supports negative amount for sure
What if you have two different weapons with different attachments?
You'll delete the wrong one
Check if longer command works first
It works
thanks
What about adding weapon with attachments to unit from box?
_unit addweapon _ARifleinbox;
How can I use weaponsItems there?
You'll need to add weapon and then edit it with addWeaponItem
also adding weapon auto loads the mag from gear so its another issue
I have a question for you: Is it possible to make the irlaser turn on for Ai even when it is not in COMBAT mode??? When I make such a script, the laser simply appears sometimes and then not. null=[] spawn { while {true} do { player action ["IRLaserOn", "name AI"]; sleep 0.01};};
Try each frame
I already checked. it's exactly the same problem. At normal game speed you can't see anything, and when I do this 4 times, the laser flashes. I don't know where the problem is 😦
["1", "onEachFrame", {player action ["IRLaserOn",aaa];}] call BIS_fnc_addStackedEventHandler;
Is there any way to make a unit enter combat mode and stay there permanently??? (script). to get around it 🙂
iI also tried, without success
This won't be what's causing your problem, but just FYI, the BIS_fnc_addStackedEventHandler system and those old EHs are pretty much obsolete. You can/should use the modern properly stackable EH system instead. https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EachFrame
Unfortunately, I'm not an expert in this :(. And that's why I wanted to ask you for help. If I don't manage to do it in the game, it won't be a tragedy. But it would be useful for my mission.
I wrote such a script a moment ago, and it's the same as before, at normal game speed you can't see anything and at 4x the laser blinks addMissionEventHandler ["eachFrame", {player action ["IRLaserOn",aaa];}]
very strange, but I put something like this _h = aaa spawn { while {true} do { player action ["IRLaserOn", aaa]; sleep 0.01};}; and at game speed 1x inc is not visible, at 2x it works almost fine, and at 4x it flickers
Try
onEachFrame {aaa action ["IRLaserOn",aaa];};
See if it makes any difference
Alternatively
addMissionEventHandler ["Draw3d", {aaa action ["IRLaserOn",aaa];}];
second one could be different because of different part of frame
exactly the same thing happens. hmmm. I don't think it's possible to get past this. Do you know how to make the AI enter combat mode and stay in it even when there is no enemy nearby??? Maybe that's how I would do it
I'll check it this way, for now it's flashing like a strobe at game speed 1x onEachFrame { if (diag_frameNo mod 60 isEqualTo 0) then { player action ["IRLaserOn", aaa] } };
yes, I've already read it :0. and when I do this, after 10-15 seconds the unit goes back to standby mode (even when I loop the script
hmmm, it's funny, but I just noticed that when the unit is very far from the player, the script works and the laser burns at normal game speed, but when the AI gets closer to the player, the laser is no longer visible.. strange. It's probably a display problem 😦 I won't bother you anymore. and thank you for trying to help
i'm really tempted to experiment with hashmapObjects
the big question is locality. anytime I make a change to the hashobject, I bet I have to send the whole hashobject over the network
oooo one potential flaw with them is that I don't think you can prevent their overwrite. a bad actor could come in and destroy the whole hashmapObject variable. that's really bad, especially if you have a lot of methods in it.
edit: nvm, compileFinal now takes a Hashmap to prevent this
edit2: that still bad because now you can't set new keys to the hashmapobject if you also protect the instance
Any ideas how to remoteExec this? Currently it just plays on the local machine that activates it.
[
[
["Recon Position", "<t align = 'center' shadow = '1' size = '1.5' font='tt2020style_e_vn_bold'>%1</t><br/>"],
["0557h", "<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]
]
] spawn vn_ms_fnc_sfx_typeText;};```
take this whole thing, throw it into a function in CfgFunctions, then remoteExec that entire function (also no need for the first spawn {})
Lemme look up on Biki what that is
So I need to assign a class for it? Sorry I'm just getting back into this
I'm pretty good at copy and pasting frankenstein code from the 2014 forums tho.🤣
// description.ext for a mission, config.cpp for addon
class CfgFunctions {
class Fox {
class fnc {
file = "pathtofunctions";
class MyLocalFunction {}; // looks for fn_MyLocalFunction.sqf
};
};
};
[] remoteExec ["Fox_fnc_MyLocalFunction", _targets];
So if Im understanding then "fn_MyLocalFunction.sqf" is where I place my code that I originally posted? I tested it as such and get an error for unverified _targets
_targets is just an example
Put in a number/obj/etc or array of numbers/obj/etc for the client computers. Look at the remoteExec wiki page.
I tried with "player" there but nothing happened. Thank you for the help btw! I'll try the wikipage too.
Ohhhh is there where I can write 0 and it goes out to all computers? I'll try that next. Edit: I tried 0 but nothing happened.
Hi Team, struggling to put a texture onto the Billboard Blank. For some reason this is not working, as far as I am aware the file path is correct and simulation is enabled. Any pointers or hints
Are you sure you defined it correctly, go to your config viewer in the editor to see if it did. Or check if Fox_fnc_MyLocalFunction is nil.
Must be .paa or .jpg. prefers .paa
Also make sure you are using the right slash.
I'm not sure how to use the config viewer. I will try that now though.
oh, wow. Arent I stupid. Cheers mate
Made it JPG and check fill path. Still not working, could this be casuing it?
Got it working with this! Thanks again for the help!
[
["Recon Position", "<t align='center' shadow='1' size='1.5' font='tt2020style_e_vn_bold'>%1</t><br/>"],
["0557h", "<t align='center' shadow='1' size='1.0'>%1</t><br/>"]
]
] remoteExec ["vn_ms_fnc_sfx_typeText"];```
probably
Nope, that did not help
Check RPT. Make sure it isn't throwing missing file error
this is just singleplayer
It doesn't matter
Its saying it isnt found
swap your / for \?
Have done that
um... how did you make that .paa file...
That too
changed the extension
That's not how it works
not how that works
Just use JPG if you don't know what is PAA
Still no luck
...You sure the mission folder you put the picture is correct?
You were editing the temp folder then
Then next up: make sure your JPG has correct resolution (power of 2)
what if I want it to be rectangler instead of square, cause its 2014x1024 as a power of 2
do you mean 2048?
Okay, then... just in case, didn't you changed extension to convert PNG to JPG?
Okay, yup. Got it to work now thank you. Sorry for my absolute mess
Thank you
Do you have a guide somewhere on use of your light placer module in your EAS mod? Just trying to figure it out
Linked in Workshop
I don't know what is unclear to you, that module is very straightforward
just some of the attenuation values
And how they intereact wth each other
https://community.bistudio.com/wiki/setLightAttenuation
Literally this
is there a way to check via script to see if an object is visible on a local player's screen
i.e. "is someone looking at this"
positionCameraToWorld maybe is an idea
hmm
wait duh
get direction of object from player's position, check if that direction is within 160 degrees or so of the player's getDirVisual
if it's not, spin the spooky object to face them.
worldToScreen is the direct method.
You can do a full frustum check yourself but it's not necessary.
Finally figured out what was causing it, it was my problem but it made respawn system go haywire, it started firing onUserSelectedPlayer on old units without me doing selectPlayer, that's how playableUnits ended up with a bot and allPlayers had actual player unit.
Basically, selectPlayer and setPlayerRespawnTime are dangerious and must be used carefully
Wrong order or timing and everything goes to hell
Still, its 2024 and we can't properly stop ragdolls on dead bodies and its a big shame
selectPlayer and setDamage lets you turn ex-player unit into non-ragdolled body
Not very useful unless you do that during player loading or something
Other mess like dead body never fully dying (always has group), respawn moving variables from older dead bodies and not last one, etc.
Seeing how ropes can be scaled by XYZ makes me wish we had a command for that so it can be tried against objects that support it, could be very useful
- Just had a need for invisible barrier objects of various shapes, so objects with bad geometry can be fixed and can't be hidden inside or easily peeked through.
Current list of ideas for objects to request to be added to base game:
- Invisible object to attach rope to. (Needs simulation chosen, maybe several simulations as they have different properties)
- Invisible object to attach to rope. (Same, needs simulation selected, maybe several simulations)
- UserTexture as ground decal (Several sizes)
- Standalone engine flag object with nothing but flag proxy to use with
forceFlagTexture - Even larger clutter cutter object.
- Invisible roadway object (Several sizes?)
- Invisible geometry object to block bad areas (Several sizes?)
Wont mind if somebody can take a lead on that, create sample configs or even models and file a ticket, maybe its not too late for 2.18
I suck as both models and configs
Finaly figured this one out, the code was perfect, however adding a holdAction to an object that is damaged doesnt work, it has to be an object that is "Alive"
Here's a loosely scripting related question, anyone know how to get the BI Wiki to stay in dark mode 😂 Changes back on every new page and its frustrating
#community_wiki
I personally just use the Dark Reader extension 
Now that is a great extension, cheers!
How do you go about changing the players respawn time mid mission once a trigger is activated?
i've tried that but it only changes it once, im looking for something that will change it for the rest of the mission
it works for me. are you running in MP mode?
yes
strange
is it doing it once, and on the second death resetting the respawn timer to the original? that's what its doing for me
not resetting for me. tried editor - MP
that is strange... so you have respawn setup in the editor for a different time and its changing it to the set time permanently?
yes
i just selected multiplayer -> Respawn at the position of death
didn't work, i've set it to 45 seconds respawn usual, but then once a trigger is set to start a big attack i have the on activation line saying "setPlayerRespawnTime 10", after one death it sets it to 10 seconds, but after a second it then sets it back to 45 seconds
i need it to be based off trigger though for the mission, is there any way to do it with the trigger?
id test first in console
maybe script line is setting it back
i haven't messed with it anywhere else
it's only in this one line that it's applied, is there a risk that the normal settings override it upon respawn?
worked in the new mission. which is strange
u sure you didnt forget the script that calls setPlayerRespawnTime somewhere? maybe another trigger?
i only just started trying to use it for the first time with this one
and theres no point either where it would be set back to the mission default by a trigger either
the only thing i changed about the other mission it worked in was the respawn settings, being respawn on position of death and also respawn doesn't allow for choosing position or loadout in the other one. it's plausible that choosing where to spawn somehow calls a function to set it to the mission default
yes. i went back to the one it worked in and changed the settings to let you choose position and loadout. and the script doesn't work anymore, so only on respawn on position of death does it work more than one time
good to hear you found the problem. I wonder whats the logic behind in resetting the respawn time
does anyone know a method by trigger to change the default respawn time?
playerResTime = 1; // Replace with default respawn time
addMissionEventHandler ["EntityRespawned",
{
_this spawn
{
params ["_newEntity", "_oldEntity"];
if(isPlayer _newEntity) then
{
sleep 0.1;
setPlayerRespawnTime playerResTime;
};
};
}];
``` this worked for me
that should be run in init.sqf or something
I'll look around the wiki to see how to get this to activate by a trigger, thanks
u shouldnt because it uses addMissionEventHandler
but a conversion, to get the trigger to change a variable that when changed adds the mission event handler or something
you could do something like ```sqf
playerResTime = 1;
setPlayerRespawnTime playerResTime;
i used to have the trigger just set the time to 10 directly, only worked once. but if i can get a system that re-applies the code every death then i can simply have that applied after calling a function, so im trying that now
then run the addMissionEventHandler code in initPlayerLocal.sqf
yeah my code re-applies the time after every respawn
so im going to try and put it into a function, so that when the trigger is activated it can call the function and add the event handler on to each playable unit or onto the mission, whichever works
trying to add a trigger that fires a notification when 2 conditions are met, Script triggers the conditions but how do I phrase it in the condition of the trigger?
Say the conitions are "Leave 1" and "Leave 2" do I just put Leave 1 & Leave 2; as the condition?
and or &&
(condition 1) && (condition2) in the condition, as (x) implies x is a boolean
Perfect, thanks guys
got it to work, thank you so much
Requiring admin rights to use diag_codePerformance is such a nuisance
Is there a way to make the briefing screens stay up until all players press "OK"? Currently I'm reading my missions briefing and the game dumps me into the start of the mission after about 60 seconds. I'd like to be able to read everything at my leisure then decide when to enter the game.
_eastGrp spawn { sleep 5;
_unitpresent = {typeof _x isEqualTo "B_Soldier_A_F"} count thisList > 0;
waituntil { {(_x distance _unitpresent) < 30} foreach units _this; };
hint "deleting units";
{deleteVehicle _x} foreach units _this;
};
trying to delete a group of units when a unit classname is nearby,
i get an error just before thisList > 0
What does the error actually say?
Given that you've just spawned a new scope, it's likely that thisList is not defined, since it's only available in specific scopes and if was available in the parent scope, you've just left it.
Also, your variable _unitpresent is going to contain a bool (true or false). You then use _unitpresent in a distance check, which is impossible.
isnt thisList global variable or something? 🤔
It looks like one, but it's not. How could it be? Its content is scope-specific.
It's like this in an init field.
maybe its nilled after its usage code
Undefined variable in expression : thisList
You need to pass thisList into the spawned scope as an argument, like you're already doing with _eastGrp.
e.g.
[_eastGrp, thisList] spawn {
params ["_group", "_list"];
[_eastGrp, thisList] spawn {
params ["_group", "_list"];
sleep 5;
_unitpresent = {typeof _x isEqualTo "B_W_Soldier_LAT2_F"} count _list > 0;
waituntil { {(_x distance _unitpresent) < 30} foreach units _group; };
hint "deleting units";
{deleteVehicle _x} foreach units _group;
};
great now it no longer gives error for thisList, for now the _unitpresent is the problem.
the error lies just behind distance how will i be able to swap _unitpresent to something that works
What are you trying to do here? Like what's the expected result of this code?
when the class name unit named "B_W_Soldier_LAT2_F" is near the group _eastGrp it deletes the group
Classnames refer to a type of unit, not a specific one. There could be multiple units of that type in the trigger. How sure are you that there will be only one (and it will be the right one)?
basically i have a script that spawns infantry garrisoned units randomly in buildings, as well as random zombies from another script, though sometimes they spawn on the same building which is annoying, so i want only one of them to be in a specific building
So, the waitUntil means the game will keep checking until the condition returns true (if the condition works but yours doesn't but we'll get to that in a minute). This means that even if there isn't initially a LAT2 near the group, if one walks in 5 minutes later the group will be deleted then. Is that the behaviour you want?
yes i also thought about that and im fine with it, because there are multiple classnames of zombies, so i can choose what classname spawns in buildings, and that classname if it happens to spawn near garrisoned infantry groups, it deletes the group so only zombies remain in it
maybe i can create a param named _unit and then use that param to define the type of classname? not sure if that makes sense
This checks every 5 seconds to see if any group member is near one of the specified classes (you can add more classes to the array to check them all in the same check). If any group member is within 30 metres of one of that class, the group is deleted.
_eastGrp spawn {
params ["_group"];
waitUntil {
sleep 5;
(units _group findIf {
private _nearZombies = _x nearEntities [["B_W_Soldier_LAT2_F"], 30];
count _nearZombies > 0;
}) > -1
};
hint "deleting units";
{deleteVehicle _x} forEach units _group;
};```
If i could say thanks a million times i would!
through my conversation with you i learned 2 things
1- passing a thisList to a spawned scope.
2- defining a classname unit to use for checking distances
✅
this setCaptive true; if (isServer) then {
[[this, "KNEEL","LIGHT",arrow1], BIS_fnc_ambientAnim] remoteExec ["call"]};
0 = this spawn {waitUntil {sleep 1; player distance _this <5};
_this call BIS_fnc_ambientAnim _terminate; [_this, true] call ACE_captives_fnc_setSurrendered;};
Can anyone see if im missing a ; On this?
"0 = this" doesnt make any sense to me, but the problem is likely in the remoteExec itself. You should be putting "BIS_fnc_ambientAnim" where the "call" is, since thats the function
Im not following?
Which call?
This is going off a video I was following for ace surrenders, but its rather old so may no longer work that way
[[this, "KNEEL","LIGHT",arrow1], BIS_fnc_ambientAnim] remoteExec ["call"]};```
->
```sqf
[this,"KNEEL","LIGHT",arrow1] remoteExec ["BIS_fnc_ambientAnim"];```
However, I think the issue is actually not that.
_this call BIS_fnc_ambientAnim _terminate;
should be;
_this call BIS_fnc_ambientAnim__terminate;```
So ```sqf
this setCaptive true; if (isServer) then {
[this,"KNEEL","LIGHT",arrow1] remoteExec ["BIS_fnc_ambientAnim"];
0 = this spawn {waitUntil {sleep 1; player distance _this <5};
_this call BIS_fnc_ambientAnim__terminate; [_this, true] call ACE_captives_fnc_setSurrendered;};
Well, you have a second instance of remoteExecing ambientAnim. You should change that as well.
Sorry that was in my scratch pad not actually part of the script
You also don't have a closing }; for the if isServer then {
The 0 = this spawn { is not technically wrong, but completely unnecessary. Just use this spawn {, there's no need to do anything with the return value.
this setCaptive true; if (isServer) then {
[this,"KNEEL","LIGHT",arrow1] remoteExec ["BIS_fnc_ambientAnim"];
this spawn {waitUntil {sleep 1; player distance _this <5}};
_this call BIS_fnc_ambientAnim__terminate; [_this, true] call ACE_captives_fnc_setSurrendered;};
Actually this won't work at all because you're trying to use player on the server
What would you suggest as a work around?
if (local this) then {
this setCaptive true;
[this,"KNEEL","LIGHT",arrow1] call BIS_fnc_ambientAnim;
this spawn {
waitUntil {
sleep 1;
((playableUnits + switchableUnits) findIf {_x distance _this < 5}) > -1
};
_this call BIS_fnc_ambientAnim__terminate;
[_this, true] call ACE_captives_fnc_setSurrendered;
};
};```
Works perfectly, Appreciate it!
Hey Folks,
weird question: Can I check if an item is a Backpack?
Following Background:
I want to write a Supply Drop function that gets an array of Items and Amount of them and fill them into a container.
The array has the following format:
[[itemClass_1,2],[itemClass_2,4],[itemClass_2,4]];
and so on.
I just want to make it super easy to fill this array.
with addItemCargoGlobal I can fill everything in the Container at the right amount, but addItemCargoGlobal is not working for Backpacks.
I was hoping there was a smart way to check if the itemClass in the array is a Backpack and if so, choose another option to move the Item into the Container.
something like:
if (_x select 0 isBackpack) then { _Box addBackpackCargo [_x select 0,_x select 1]; } else { _Box addItemCargoGlobal [_x select 0,_x select 1]; };
But I seem I cant find anything thats close. Does anyone know a better way to do this?
first, make your array easier to work with (more readable):
_x params ["_class", "_count"];
is the backpack on a player? is it just on the ground? is the backpack inside of the container and you want to fill that container in a container?
I'm pretty sure you can find something in the item's config that determines whether it's a backpack. Checking that would account for all cases
No, I just want to write a function that makes it possible for me to call a supply drop and fill the supply drop with Items I want.
So I can call the Function with [_cargo] fnc_SupplyDrop and use it for multiple missions.
and you want to be able to drop a backpack object as well? or should we just forget about the backpack thing for now?
oh i see now
idk why my brain wanted to focus on filling a backpack within a crate.
yes there is a config value for backpack, let me look it up
Oh, I think i found it: vehicleClass
no
getNumber (configFile >> "CfgVehicles" >> "backpackclassnamehere" >> "isbackpack")
for example
will return 0 or 1
OKay, great, thank you guys. Was so focused on finding a function that I forgot to check in CFG
Awesome, sometimes you just strike a wall and need a change of perspective. Thank you so much
can anybody help with how i'd write setting off a trigger once i free a hostage in a mission/have them join my group? hostage name is hostage1
i have the hold action from 3den enhanced set up already, just need to have a trigger for the success of the task
you already have the action itself, you don't need a trigger. just fire what you want when the action happens
so id code going into the next task into the action code?
yes, the task framework functions were created to be a global system, so it doesn't matter where it fires from (local to the computer that did the action in your case)
oh ok cool
thank you, i might need help setting the success task off but im gunna research on google/youtube first
ok will do
Any idea on this error popup? This script is in the config init eventhandler of an ammo class.
Wrong exitwith syntax
I've tried if () exitWith {} else {} but that will throw errors too
Because that is also wrong exitwith syntax
It's JUST if () exitwith {};
Else is implied - other code after that can't possibly run if the script exits, but will if it doesn't
How about this?
You don't need the
if (_isMan == false) because as you use a exitWith{} the code will run only if _isMan is false
Firstly you don't need an == to check the state of a boolean. Just return the boolean itself (or its inverse with ! to "true if false")
Secondly, you don't need to check if _isMan is false - you know that from the result of the exitwith.
Got this then with the extra if layer removed
Also, if you want to check a boolean value for "false" you can use
if (!_isMan) then {...}
The ! check confirms on "false" value. Its faster then ==
I usually avoid short-circuits until I can confirm the long version logic works since I tend to have bad luck with typos in complex conditions haha
Haha, I couldn't see anything of this happen to me kappa
Its just that the comparison is much fast with ! than with ==
Was just a hint.
having a wee spot of bother with getting a trigger to fire, I need it to fire when a unit is in the trigger and another variable has been checked, I have it set up as the attached image but it doesnt seem to want to fire
you can use:
this && insdetained
this in the Condition field uses the condition set in the trigger module
Aye but I dont want it to fire with the Bluefor Units in the trigger, I want it to fire once the detainee has been brought into the trigger zone so ive used in thislist
Ah, sorry, my fault. Got you wrong.
All good
Heres also the unit thats getting detained, firing the condition to true, so unless im missing something the set up I have should work?
As long as you are not sure that both triggers run in the same Namespace, you should use
publicVariable "insdetained";
to make the variable available on all machines, including server
It's a local trigger, so it will be true on every client .
But you may need add
this && ins in thisList && insdetained
hello, i want to add some Control on ace_arsenal_display to show some stuff i need ( on 3den )
its posible adding it in the description ext, or need to be done by mod?
All no joy there either, Im wondering if ace_captive is messing with it
Did you debug it and check if the "in thislist" command is working on the trigger when you don't use the other check on the variable?
Well, but that helps in terms of we can concentrate debugging on the ins in thisLIst issue
You could try with an alternative and use
ins inArea thisTrigger
If you would give the Trigger a variable name it could be:
ins inArea triggerVariable;
Hey, you are welcome. Have fun with missionmaking
Oh im definitley increasing the speed my hairline receeds, but its fun all the same!
I feel you man. 😄
I've been using lineIntersectWith and it works fine but seems to ignore characters. Is this expected?
anybody know why a task notification wont come up when i enter a trigger area connected to the task and the activation is "any player" and "present"?
task probably isnt set up right. show screens of everything you got so far. trigger and tasks
change the task state change trigger (task1_complete) activation to Anybody and try again. Sometimes custom conditions need it to be on Anybody for thisList to work right
ahh ok, also i shouldve sent this one lol.. i did that for the task1_complete trigger, but this is the trigger im trying to get to notify the player of the hostage rescue task, sorry gunna send it now
was a silly mistake by me my bad
THIS is the trigger connected to the task
which one? the one that creates task1?
yeah its
hold on ill show you how its connected
i want when the player enters that zone they get the notification for task1, yes
anybody means anybody, including any unit with a brain in any side
ok
you have a red unit in there, could be setting it off early
would any player be ok?
any player is okay as long as all your players are on the same side. zeus flying through can also trigger it I've seen
I've never seen Zeus set off triggers by moving the camera through them. The Zeus player's actual position is where the Zeus module or player body is, not where the camera is.
Mods could change that though I guess.
its been a while, but I remember it happening a few years ago. don't know if it was ZEN causing it or something
@austere grove do you have any blufor AI on the map? if not, and its all players, you could just change it to BLUFOR PRESENT
i dont
if im using a us army mod but theyre under BLUFOR anyways, would that matter?
cause if you have it on BLUFOR and PRESET, blufor AI can set off the trigger
Side is what matters, not faction
fine for what you want to do
does it matter how quickly you go through the zone? i set the players into a cargo plane to paradrop out of
im almost thinking they clear the zone too quick or something
but idk LOL im completely new to everything
The trigger has a field for the check rate. I think the default is every 0.5 seconds. If they pass through quicker than that, they might not be detected if the timing is perfect. Otherwise they should be detected.
how can i make it so that only a specific player can interact with something?
Interact as in?
like opening a door or entering a car
Not impossible. Both works differently
Locking a door is usually done with setVariable. Lock is done with lock
Hm wait, lock is a global command so may not possible to do it only for some player?
You can't fully lock vehicles for specific players, but you can use getIn EHs to boot out unauthorised persons as soon as they enter
Just lock each frame on each client 
It doesn't seem to broadcast anything and you end up with different locked state for different clients
What I do in KotH:
{
_x lock (_x call client_func_locking_isVehicleLocked);
} forEach (client_locking_vehiclesList inAreaArray [getPosWorld cameraOn, 10, 10, 0, false, -1]);
each frame
This... is seriously overcomplicated workaround for a very simple task
Yeah, nothing is easy in Arma
I wish we can just duplicate Dedmen
Honestly locks should be per entity even
10 times and send them back in time to 2011 or something
2009 even
Hes gonna buy all bitcoin and leave BI as soon as price goes up
Or not, maybe he enjoys fixing this ancient engine
I guess you have to
Considering how much the game is client-sided its so weird that lots of stuff is global where it clearly should be local, locking is one such example
Meanwhile, allowDamage isn't global when its clearly should be
I miss local weather of OA
Hmm, maybe there could be something like
ENTITY setLockLocal BOOL
```which would stop changing locking flags from network updates
Would make things much easier
_remote_car setLockLocal true;
_remote_car lock true; // Only locked for you
hi
i have the code to save unit loadout (onPlayerKilled.sqf) but instead of writing each units variable, i would like it to work on all players in multiplayer
UNITVARIABLENAME setVariable ['Saved_Loadout_UNITVARIABLENAME", getunitloadout UNITVARIABLENAME];
{
private _plr = _x;
_plr setVariable ["Saved_Loadout", getunitloadout _plr ];
} foreach allPlayers;
Ty
Is there any way to set mission General attributes from script ? Im tryning to set it with:
set3DENMissionAttributes [["Preferences", "Saving", false]];
And i execute this command right in eden editor via Debug Console
~~ Enable Saving Section is 'General'~~
Enable saving Section is Scenario ,
So
set3DENMissionAttributes [["Scenario", "Saving", false]];
works
Why this isnt in documentation?
Well #community_wiki , There is place where you can ask ppl Who has the rights to edit / add documentation to wiki
sorry one more thing, would the following work to include all players for the OnPlayerRespawn.sqf?
{
removeAllWeapons _x;
removeGoggles _x;
removeHeadgear _x;
removeVest _x;
removeUniform _x;
removeAllAssignedItems _x;
clearAllItemsFromBackpack _x;
removeBackpack _x;
_x setUnitLoadout (_x getVariable ["Saved_Loadout", []]);
} forEach allPlayers;
OnPlayerRespawn.sqf runs for just one player (at a time), so you probably want to set only that player's loadout
You don't need remove.
You could use example from wiki
//Strip unit of everything:
_unit setUnitLoadout (configFile >> "EmptyLoadout");
so this will work only for single unit?
i want it to apply to all players in the mission
You want all players to have their equipment reset when one player respawns?
If you understand what John said.
Current forEach all players command will save for every client , everyone's loadout.
And if you do set forEach it will add every client saved loadout when one client respawn.
If you want to save locally and only add on unit who is respawning saved loadout.
//initPlayerLocal.sqf
player setVariable ["TAG_StartLoadout", getUnitLoadout player];
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_StartLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];
https://community.bistudio.com/wiki/Arma_3:_Respawn#Respawn_with_Original_Loadout
There is all that you need.
ty
so no need to use the onPlayerRespawn.sqf and onPlayerKilled.sqf if i just use this in the initPlayerLocal.sqf?
Is there a way to use a non-array for the array part of orderGetIn? I have a 4 groups of prisoners that's supposed to go into a helicopter, but it's dynamic so I cannot just use an array.
Well, you can use a single-element array ([_unit]). But you should be able to dynamically build an array based on the units involved.
e.g.
units _prisonerGroup orderGetIn true;
//
private _prisonerGroup = _potentialUnits select {captive _x};
_prisonerGroup orderGetIn true;
// there are many other ways```
Well, I'm running the script from a trigger as
[prisonersGroup1] execVM 'prisonerMovement.sqf'
and then the group is defined in the script itself as:
prisonersGroup1 = [prisoner1, prisoner2, prisoner3, prisoner4];
Does that mean that I just have to put the units infront of the orderGetIn to make it work?
No , if you dont want save unitloadout when he dies.
So it will respawn with loadout that he had before he get killed
ah ok
there is example under save starting loadout.
-->
Respawn with Death Loadout
The following code makes the player respawn with the loadout they had on death:
//initPlayerLocal.sqf
player addEventHandler ["Killed", { player setVariable ["TAG_DeathLoadout", getUnitLoadout player]; }];
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_DeathLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];
The units command is (in this case) for getting an array of the units that are in an actual Group (data type). That's what you'd need to do it if you had a reference to a Group.
If you are doing this:
prisonersGroup1 = [prisoner1,prisoner2, ...];
[prisonersGroup1] execVM 'prisonerMovement.sqf';
then......you already have an array of units which is perfectly suitable for passing to orderGetIn.
prisonersGroup1 = [prisoner1,prisoner2, ...];
[prisonersGroup1] execVM 'prisonerMovement.sqf';
// in prisonerMovement.sqf
params ["_prisonerGroup"];
_prisonerGroup orderGetIn true;```
Or even simpler:
prisonersGroup1 = [prisoner1,prisoner2, ...];
prisonersGroup1 execVM 'prisonerMovement.sqf';
// in prisonerMovement.sqf
_this orderGetIn true;```
Hi, I'm working on a script, that calls a dll file, that makes a network call.
When making calls to a public domain everyting works fine.
I'm trying to create a local development environment, when I try the dll with a consle test app it also works great, but when the dll is part of arma it doesnt send requests to localhost all the sudden.
Any help?
arma "receives" an empty response from the server, when it didn't even send a request
I see the issue here.. and it's as stupid as a spelling mistake :p
I have params ["_prisoners"]; in the sqf, but called _prisoner in the script :p
in addition, i want to have all players get the loadout they had at the start of the mission when they respawn or die
so onPlayerKilled.sqf:
{
private _plr = _x;
_plr setVariable ["Saved_Loadout", getunitloadout _plr ];
} foreach allPlayers;
onPlayerRespawn.sqf:
player addEventHandler ["Killed", { player setVariable ["TAG_DeathLoadout", getUnitLoadout player]; }];
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_DeathLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];
so instead of using the code u mentioned above loadout on death, would this work to get the original loadout on death and respawn for all players?
So quick question. Is there a event or somekind a better way to check has player put gasmask and then show the picture and when he takes gasmask off to remove the picture. Right now i have this:
maskArray = ["kat_mask_M50","kat_mask_M04"];
addMissionEventHandler ["EachFrame", {
if (goggles player in maskArray) then
{
0 cutRsc ["overlay_texture","PLAIN", 1, true];
}else {
0 cutText ["","PLAIN"];
};
}];
But this is so ugly and its make a new picture each frame. So any solutions ?
If you want unit spawns with loadout what he got when he died.
Use this.
Respawn with Death Loadout
The following code makes the player respawn with the loadout they had on death:
//initPlayerLocal.sqf
player addEventHandler ["Killed", {
player setVariable ["TAG_DeathLoadout", getUnitLoadout player];
}];
player addEventHandler ["Respawn", {
private _loadout = player getVariable "TAG_DeathLoadout";
if (!isNil "_loadout") then { player setUnitLoadout _loadout; };
}];
You don't need to use it for each player,
Just player
It's local, and it will have its own loadout of what he got when he died.
Same stuff.
Hello! I made this script to put a text in the head of a NPC but it isnt working, TiendaArmas is the variable name of the NPC.
private _unit = TiendaArmas;
private _pos = (_unit modelToWorldVisual (_unit selectionPosition "head"));
_pos set [2, (_pos select 2) + 0.7];
drawIcon3D["i\icono_armas.paa",[1,1,1,0.8],_pos,0.65,0.65,0,"Buy Weapons Here!",2,0.03,"PuristaMedium"];
inb4 not calling it every frame
Are you doing it inside Draw3D event handler?
Oops, I forgot that, inside the EH there is only the drawIcon3D, isn't it?
You need to calculate position each frame too
Now I'm getting this error lol
KOTH Academy 💀
Hello. Is there any command to detect if a box is full of items?
Anybody know any method via scripting or modding or difficulty settings that curtails vehicle gunners ability to pinpoint your position if you shoot at their vehicle?
I have this simple script `// Function to handle the bullet hit
scriptName "BulletHitHandler";
params ["_projectile"];
systemChat "function called";
private _target;
private _bulletFired = false;
// Continuously check if the bullet hits a target
while {alive _projectile} do {
// Keep updating the nearest enemy
_target = nearestObjects [_projectile,["Man","Tank","Car"], 1] select 0;
_bulletFired = true;
systemChat format ["target %1", _target];
// Sleep to reduce CPU load
sleep 0.0001;
};
if (!alive _projectile && _bulletFired) then {
hint format ["Target was %1 with type of %2", _target, typeOf _target];
};
` but it throws a "general syntax error in expression" error message at line 18 "sleep 0.0001". The syntax there is obviously fine but there's no more info to actually find the problem. Please help.
Are you sure you're calling this from spawn or execVM
non, I just call the function with this script fired = "_this call Phosphorus_serpenta_fnc_BulletHitHandler";
Then that's the issue
https://community.bistudio.com/wiki/Scheduler
tldr, you can't use sleep in some context
Thank you @warm hedge
Whenever someone JIP on my mission it cycles through all the completed tasks on every client. Anyone know of a way to fix this?
Post your code
I use the editor to place task modules.
So you activate them by Trigger?
Are the Triggers set to server only and not repeatable?
Triggers are NOT set to server only. They are not repeatable either. Is this OK?
Try the Server Only Option. I am not sure but I think this should do the trick.
Thanks I'll give it a shot
Anyone have knowledge of moveOut not working as intended?
It's pretty reliable IME.
What do you do and what unintended behavior?
It moves out alive players but not dead players
Depends how long they've been dead for, IIRC.
Worked fine for me, still works fine.
Put it into "Killed" EH and done.
if !(isNull objectParent player) then
{
unassignVehicle player;
moveOut player;
};
so i have this which i basically just copy and pasted from a forums post. how do i change this so that it just detects whenever a smoke grenade is thrown? ive never used event handlers before, theyre way too confusing for me lmao
["ace_firedPlayer", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_toCheck = "SP_mk4a_smokeGrenade";
_last = magazines _unit findIf {_x isEqualTo _toCheck} < 0;
if (_last) then {hint "test"};
}] call CBA_fnc_addEventHandler;
in text form
You can check what _this returns upon you throw a smoke
sorry but how would i go about doing that?
systemChat str _this
should i put that line underneath the "if" line?
No. Just put that as the entire EH code
["ace_firedPlayer", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
systemChat str _this
}] call CBA_fnc_addEventHandler;
this good?
Yes
alright, what will this do?
Prints a debug log
got it
Hi! I have this code, everything works fine except the valign, which does nothing:
_bluforPoints ctrlSetStructuredText parseText format ["<t size='1.25' align='center' valign='middle' font='RobotoCondensedBold'>%1</t>", missionNamespace getVariable "blueTotalKills"];
valign is weird, change it for elements inside your text instead
It makes sure you have line numbers when a script error happens.
idrk if this is the right channel but i need help and im desperate lol.
I made a faction orbat with alive and i have more than one faction i want to put into mods but putting all the pbos into a file doesnt seem to work?
A pbo is a file. You cannot put pbo into pbo.
You put pbo's into the same folder
Hello 👋 Does anybody know if there is a way (using event handlers) to detect when a vehicle was reloaded using setVehicleAmmo?
What about this? https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Reloaded
Wut
This does not get triggered on vehicles 😢
To my knowledge, there is no event handler that triggers when you manually set the ammo value, only when the reloading animation is finished. You can create your own function that sets the vehicle ammo and performs other subsequent actions. Instead of directly calling setVehicleAmmo, you would call your custom function, like this: _vehicle call resupplyMyVehicle;. It could add the ammo, and them send a message to the chat or play a sound, whatever you wish.
I thought so… That’s unfortunate because I’m creating a mod which should do stuff automatically. Seems like there is no way around that limitation and I need to offer a function which the consumer needs to call every time the loadout changes. Thanks for the help and confirming my assumption!
I am not sure exactly what you are trying to do, but it sounds like this is certainly possible to solve. There are other events for handling invetory related actions if you are talking about units, not vehicles, like SlotItemChanged, Realoaded, MagazineUnloaded, InventoryOpened, InventoryClosed.
CBA has a event that is called when loadout is changed example:
["loadout", {systemChat str _this}] call CBA_fnc_addPlayerEventHandler;
private _GPS = ("toLowerANSI getText (_x / 'simulation') in ['ItemGPS'] && {getNumber (_x /'type') in [131072]} && {getNumber (_x /'scope') == 2}" configClasses (configFile /"cfgWeapons")) apply {configName _x};
private _GPSinbox = (itemCargo _container) arrayIntersect (_GPS);
private _UnitGPS = if ((count _GPSinbox) > 0) then { selectrandom _GPSinbox } else { "" };
private _amountofGPS = {_x in _GPS} count (items _unit);
private _UnitCurrentGPS = _unit getSlotItemName 612;
if ((_UnitCurrentGPS == "") && (_amountofGPS == 0)) then {
if ((count _UnitGPS) > 0) then {
_unit linkitem _UnitGPS;
_container additemCargoGlobal [_UnitGPS, -1];
} else {
};
};
Can someone say what is wrong there? _GPSinbox shows - [] , but there are 5 GPS in box...
add diag_log's to log _GPS and itemCargo _container
To see whats in there. Then you can manually try to do arrayIntersect in your head, and you'll probably see the issue
Hello, if this chat isn't taken then may I ask how would I print the 3D coordinates of an object (example: helicopter in mid-flight) that I click in Zeus?
Assuming I click it with a composition with the appropriate code inside to print the object's position?
Like the vanilla Zeus lightning, arsenal and remote control modules that somehow detect the object without the 3D position part.
How can I know if an attachment is an optic, bipod, mizzle or pointer? Because on the CfgWeapons, in type, every attachment have the same type number (131072)
I believe you need to look for the type attribute in the itemInfo subclass
this addEventHandler ["CuratorObjectSelectionChanged", {
params ["_curator", "_entity"];
hint format ["Pos: %1", getposATL _entity];
}];
doesnt https://community.bistudio.com/wiki/BIS_fnc_itemType give you the type?
One second let me test that.
Quick question does anybody here have expirience with particles. What is the best way to crate them and edit them so its in real time?
I need it for GAS zones That would be around the map.
I am looking for something like in DAYZ gas zone.
How would I make it work inside of init file of a, let's say invisible helipad composition? As I put that there and it didn't print anything after selecting anything from the curator view, nor did it from placing the composition on top of objects visible through the curator view.
Please bear with me as I'm a beginner in Arma 3 scripting.