#arma3_scripting
1 messages Β· Page 758 of 1
thanks. I'll look into it.
its best if you just use onPlayerRespawn.sqf and then do your filters in there
i can help more after this HLL match
Thats what I was thinking would be easiest but I don't know how to apply it to that code and that would be awesome thanks
anyone have any good resources for extDB3? cant find any good documentation.
GUERRILA doesn't seem to be a valid side
https://community.bistudio.com/wiki/Side
The "Commands" column here shows the words you can use to compare with the output of the side command
what he's written is better
I'm working on a script to drop a backpack on a rape from a player when using a parachute. backpacks groundholders don't have physics so I'm attaching it to an ammo box which works great. Unfortunately, when the crate is hidden it loses its physics and doesn't fall anymore. Is there anyway I can force a hidden object to still have normal physics?
howdy all
one of the vehicles im using is bouncing about i think its a problem with its weight
is there a way i can increase the weight without having to mess with the config?
setMass
is there a limit on it i.e. 0 = 0 1= 100?
ive search the biki
but cant make heads or tails
Heads? Tails? What are you talking about, center of mass?
mass is not on a 0..1 range if this is your question
sorry its an expression my uk slang coming out
means i didnt undestand the biki
Fair
so if i want it to weigh a ton i put 1000?
What's unclear?
yes
nope
they are "arma weight/size unit" iirc
but you can get a general idea with getMass'ing many vehicles
Whatever it is, 0 = 0, 1 = 1, 1000 = 1000
alright ill give it a go if not i might have to do something in the config i hope not because id be looking at it as if i were blind
You better to test it first, you can worry about it later
There is a distance limit for terrainIntersect and terrainIntersectASL functions? BIKI says nothing about that.
I would expect not, but longer distance is likely to have worse performance.
that's not scripting, more #arma3_config π
Apologies, moved to the correct forum
Guys quick question is it possible to make a fly by wire in arma?
like mouse aim from war thunder
Fly by fire for what? Ammo can be configured as such without any scripting.
I don't even think that's called fly by wire
War Thunder style plane controlling, is not possible. Or, possible with a overcomplex script
Ah he meant planes, I thought about wire guided missiles like TOW 
someone told me it was called fly by wire my bad
i see, thanks for the quick reply π
Mouse aim for a plane or an ATGM?
plane
Doesn't Arma already support that? Same way you can steer your car with mouse.
you can use your mouse to fly yes, but what im was asking was something like the mouse aim mode you have in war thunder where your mouse moves a "circle" and your planes follows it
I'm trying to add an addAction to an object so that when a player does the action it makes them a Zeus
I have a game master module named myCurator
Why isnt this addAction working?
this addAction ["Spectate Mission", {player assignCurator myCurator;}];
I play WT and I can confirm I have found no mods or anything like that that can recreate the circle flying in Arma
This isnt the channel to discuss this as this isnt something you could script anyways
fly-by-wire is an internal implementation mechanism of actual airplanes
it means that control input goes through a computer instead of mechanical transfer
it's analogous to electronic vs hydraulic brakes in cars
are you sure? I'm not sure you can't
thinking about it you could compare where the aircraft is pointing vs. where the camera is looking
and then apply control inputs
i'm pretty sure you can script control inputs
[BIS_Mortar,BIS_Player,"8Rnd_82mm_Mo_shells",100,24,10] spawn BIS_fnc_fireSupport; I was looking for a similar command to this. But for air support. So i could have a unit assign a bombing run. Any ideas?
@south gale Is this for singleplayer, localhost or a dedicated server?
No
assignCurator is server-only, so normally you have to do:
[player, myCurator] remoteExec ["assignCurator", 2]
@little raptor ah can you not? then it's doa ye
I already managed to get it working, thanks though
Probably possible. but you'll have to figure out the details yourself or find a script that already does it.
I keep typing nil in my code at work lol
Similar to how ACE has 'bodyparts' for humans, is there a method to add ace damage to vehicles (Air, Water, and Land)?
The ACE VehicleDamage File (https://github.com/acemod/ACE3/blob/master/addons/vehicle_damage/functions/fnc_addDamage.sqf) has this feature, but is there a way to damage specific parts as opposed to overall damage?
Is there a global list of hitpoints available somewhere?
its based on vehicle config
Oh ok thanks!
hello, I have a question. How do i use a trigger to detect if an item is placed into a box?
no need for a trigger. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Put
is there any way to determine if a variable is "any"?
isNil?
any is nil
except if you see that in command types which means it can be anything
e.g the return value of call, or arg of params
Are there any documentation available for making a menu that lets you select 'options' when placing a module in Zeus?
The Wiki (https://community.bistudio.com/wiki/Modules) confuses me under the 'Attributes' section
you basically inherit, combo, edit, etc, give it a unique classname, and then get it's value from the logic(the latter examples). for the documentation, i don't think there is one, you probably have to look at config viewer on how other modules are made
Damn, ok thanks!
any is not exactly nil, it's just a value type. what you're referring to is "a nil value of type any", nil value just holds an x amount of value types.
very random question, not too sure where it'll belong, but trying to release my latest scripted creation on workshop, but I can't seem to figure out how to give it a nice thumbnail so it doesn't just say arma workshop, anyone able to direct me to how to do it?: https://steamcommunity.com/sharedfiles/filedetails/?id=2793205082
Use the Publisher if you already have Arma 3 Tools installed. Otherwise, try the workshop's edit page.
I have tried the workshop edit page, nothing π¦ And publisher doesn't work for scenarios Figured it out - gotta be done in arma
how can I check if, after using selectPlayer, the player is controlling other AI? I am building a scenario where upon death player is transferred to another man and after that, everything around the previous body will be deleted
With selectPlayer, the player is now the new unit, so isPlayer on the old unit will return false.
I mean the any you get when you do str [nil]
Is there a command that can take attachments off of weapons?
Best place you ll find information is inside game. I suggest you to read module configs inside cfgVehicles.
Modules in zeus iirc, contain 2 functions.
One is for actual function when it is activated, uses the attribute: function.
One is for getting information from the user by UI(upon putting a module down or double clicked), uses the attribute: curatorInfoType. I believe this is what you are asking.
Then you simply setVariable bunch of stuff from **curatorInfoType **into your module's namespace and getVariable those in your function.
It is of course not required to have curatorInfoType if you got no parameters to take from player.
Perfect thanks!
As of now, I just made 8 functions with 8 separate SQF π
If you need more information, you can just access Module_F_Curator from Arma addons easily if in game it feels too confusing. (It is tidier, with all its functions and config)
How do I check if any player has thrown a grenade/smoke shell and then subsequently execute an sqf without disturbing my other scripts?
"throw" event handler
player addEventHandler ["Fired", {private ["_throwable"]; _throwable = _this select 6; _shooter = _this select 0;
[_throwable] execVM "detect_throw_and_warn.sqf"}];
``` This is what I have currently from searching/scrolling around. Now,
(A) Would this be sufficient
(B) Where do I place this/invoke so it runs on the local player than the entire server?
sorry it's "fired" event handler
I had to go searching through my old code to see how I did this long ago
This should give you a good start:
https://forums.bohemia.net/forums/topic/188323-code-snippet-throw-magazines-to-your-teammates/
I made this years ago and only recently started scripting again so I barely remember how this works
It looks like the second parameter (_this # 1) equals "Throw"
Thanks! Also @tranquil jasper, how do I ensure this is run in the background for each player locally instead of server?
Before you even worry about that I recommend using the Functions Library for this since execVM causes disk access every time and players could end up throwing a lot of grenades
https://community.bistudio.com/wiki/Arma_3:_Functions_Library
Or you could also do some trickery like this:
detect_throw_and_warn = compile preprocessFile "detect_throw_and_warn.sqf"
gniiiiii!
After that, well, it just depends on what your code does, to determine how to make sure it only runs locally
private ["_throwable"]; _throwable = _this select 6; _shooter = _this select 0;
I don't know why this upsets me so much
haha I know why. "array" input of private command but only 1 element. using private + assignment vs params. _shooter isn't scope-safe (although I think EH's are already scope-safe but could be wrong)
params my beloved
I hate it when people use params only to define like one or two things from a 6 7 elements array
Just define what you use, it is also easier when you read it since you dont be like "wait where is this parameter used then?"
Cant argue that π
Mistakes have already been made by this point, but it could cause readability problems if you have very long code (goes off the screen)
Of course Im talking about it for the long codes. Not some 4 5 liners
if it is 4 5 lines, chances are that, they are copy pasted from BIKI anyways. 
then they dont understand what params actually do then forget it sometimes and ask "wait, isnt it called _shooter, why doesnt it work?"
params ["_unit", "", "_otherStuff"];
Now do it for 8 parameters
ez```sqf
params ["_unit", "", "", "", "", "", "_otherStuff", ""];
Afaik, it is worse performance wise as well (using this card I really dont care at all for minor cases
)
I thought on the contrary that it drops var/value assignation and therefore noicer
look
I'm green
you're white
I win
π
but but...
I try to define variables as close as I can to the code that uses them generally, in the working world you'll be dealing with objects that possibly have dozens of properties so 3-6 parameters isn't too hard to remember
let's wait for Dedmen to tell us π
Exactly, so parameters defined waaaay above ur code compared to where you start using therefore increases distance wise
Of course it really depends on what sort of things you work on as well as your practices in general
then you can use```sqf
params ["", "", "", "", "", "", "_otherStuff", ""];
Is this proper usage Lou?
params ["_unit", "", "", "", "" ,"" ,"", ""];
params ["", "_shooter", "", "", "" ,"" ,"", ""];
params ["", "", "", "", "" ,"" ,"_otherStuff", ""];
Not gonna lie though, sometimes my code ends up having _this select X spams cos I just define what Im about to use. 
switch to # to scare noobs away
I tried
Im just too used to it to change it. I dont write as much as I used to anymore anyways.
all this to get paddlin'
take a 6 year break like me heheheh
last time I did scripting I didn't know about # and now I cant get enough
if I take it , I ll have nothing to return to though. π
eh, the forum has rep now, so it's not a total loss π€£ still have your rep
All these years, still no forum comment 
it's pretty fun answering people's questions sometimes ngl
Oh I got my own students I teach SQF , I think it has been 10 students so far. Sometimes giving hours of hours teachings, that satisfies me enough in that aspect, Im also assisting here sometimes but people mostly come to grab codes more than learning it so I kind a stopped it.
It is even more fun when you see how happy/surprised they are with what they achieve.
facts
you get an eye for the people that just want a copy/paste. I just skip those or simply post the wiki page for the command they need
teaching also teaches you new stuff that you never been into in case they want to do something you have never been into
yeah I do the same.
Altho I supply code if I find the idea cool and unique
I used to be able to post something in just about any post, most of that knowledge is long gone unfortunately. But if I saw real effort I'll spend days helping, maybe even just write your script for you
Yeah, pretty much the same. If you care about it and truly want it, I ll be there to support you; but if it is just "give me what I want", it is an ignore or it is ingredients only... aka BIKI links 
plus I make/have made many edits and notes on the wiki so depending on what commands they need, I've already put in hours months/years ago helping them lol
I could also put many information and tried to register back then but I did not really know this discord was a thing which I could use to reach to Dwarden, I needed to come here over an IP dispute then I just started hanging in the Creative Editing section basically. Now if I even register, all that information is either gone or pretty edge cases that most people wont care for.
The current information I can supply is enough to share through instead of a new account mostly thanks to @winter rose who is always there to update stuff when needed. π
Hmm, I was thinking that he made far too many edits for 1 person...crowdsourced knowledge...genius
we are millions
Thats his evil plans, to take credits for all.
π
Btw /Discussion (talk page) is a great place for weird edge cases. I always look if I see people have put notes there; it's drugs to fuel my code-bender
*benders
As far as I know, usually talk pages are there to be available for everyone to write some stuff, but it is not the case in BIKI anyways so it is still only for people that can modify the page can access those I believe.
There is always more information behind information to dig in some cases, that you should just get your hands dirty. It sometimes gets you tired knowing that there is no posted information about what you are looking for.
Sometimes curiosity pushes in and has the opposite effect though!
^ me trying to help somebody with their animations in a forum post a few days ago loool
Just have to be careful when you put stuff on the wiki, as some people get understandably upset if you post wrong stuff; I have gotten some chewing out myself π
There are always people that take stuff for granted
In my case, it is Lou's concern. 
but we still love you
well back then I figured more people editing means more info, even if my stuff needs a little housekeeping heheh
I really hope the next ARMA game will have proper documentation thats easy to follow. Now that they actually have a guy just to write documentation and tutorials for the engine.
a guy can dream lol
problem is theres like 8 games using sqf, so probably a bit much for 1 guy
But the next game is C# (or a hybrid of this) and not SQF as per their official release info/statements.
hey! :'(
certified Lou moment 
The next Arma has the major benefit of being developed to modern documentation standards from the start. A lot of new A3 stuff is well-documented; the problem is the amount of stuff that was written on the fly by a company half the size 20 years ago. Documentation being written at the time of development rather than as an archaeological exercise should be much better.
Documentation being written at the time of development rather than as an archaeological exercise should be much better
I cannot agree more - a bit less fun, but a lot more fruitful!
Real virtuality is aged like fine spaghetti, a delicacy among the green and blue people of the discord
I think it will help that many things that were late-development hacks and workarounds in A3 will probably be integrated earlier and better in Enfusion. That should reduce (albeit never entirely eliminate) the amount of stuff that's not documented because it's an...unintended behaviour.
Does anyone know of an Event Handler for ACE, I'm looking to fire a script to save an object's location once the player stops carrying / dragging an item. Couldn't see it in the ACE Framework info though
There is this. MIght be useful:
if (_mass != 0) then {
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // force global sync
};
Thanks to all of you guys I finally got my first mod published in the workshop! Albeit, its a remake of an existing script with just Zeus Module and ACE Compatibility. (Yes, I did get authorization and approval from the original creator for modification and redistribution.)! 
Are there any commands that will trigger a "HandleDamage" EH? I've been playing a lot of Antistasi and the revive system makes me mad and wonder if I can whip up a better one in a night, so far going well heh
Yeah Iβm just wondering if anyone could help me out? Iβm trying to get loot to spawn on chernarus 2035, I have the building spawns and everything setup but for some reason loot still isnβt spawning. Iβm using exile mod as well
no command can trigger it by itself, no
but the EH may trigger as a result of that command
What command?
e.g. player setVelocity [0,0,-10]
Ah, I came up with a similar solution, teleport the unit 3 meters up and let him drop haha
Whenever I try to place a module closer to the player's position, sometimes, I get BIS_functions_mainscope missing error. The same module when placed say X distance away from the player, it works perfectly fine. The mainscope error, once received, is persistent for all other custom addons that place an entity, until I restart my mission. What would be the cause behind this?
I already tried applying a fix suggested in the forum which is a replica of how CBA does it automatically. It didn't work and I also have CBA as a dependency for my addon.
this requires a medium tier help
can't paste code here because its too long
this is a civilian traffic script I'm trying to make
it works fine, civilians spawn somewhere on the surrounding roads and drive normally
but lets say you are on stratis airport
and this script tries to spawn a civilian vehicle somewhere around you
it spawns it at [0,0,0] for some reason
and the whole vehicle sinks
I want to avoid that
I already tried doing
if (surfaceIsWater position _veh) then {deleteVehicle _veh;
deleteVehicle _refpoint;
deleteVehicle driver _veh;
};
// and
if ((_veh distance2d [0,0,0]) < 100) then {deleteVehicle _veh;
deleteVehicle _refpoint;
deleteVehicle driver _veh;
};
but the vehicle still spawns in the water [0,0,0] rather than land if you are standing at stratis airport
You really should use indentation.
added a comment at the top to explain the variables
can you please elaborate?
Have you ever read anyone else's code? :P
ah I get what you mean
I was doing this hastily
kind of a test
proof of concept
thats why I added the comment above
got it fixed thanks
So I am using BIS_FNC_createmenu and I would like to make some menu items not appear/ grey out under certain conditions.
Is this possible? I presumed that the [itemEnable] array element was for this purpose but appears to not do anything.
how do you set up a boundary around your mission to contain the players - kill them if they leave an area?
Multiple ways to do this.
You can probably just use a trigger box and kill anyone outside it.
Or script wise you can have an infinite loop that checks distance between all players and center of boundary and if distance exceeds boundary size: kill.
Just don't forget to have a sleep on that loop. It will otherwise drain performance.
Considering it's not mission critical that a player gets killed the instant they leave the boundary you can probably afford having a few seconds between each iteration. This way it will not affect performance nearly at all.
Still need help with this though if someone has experience using this function.
You might want to consider using the lower-level functionality:
https://community.bistudio.com/wiki/showCommandingMenu
So is it then the [itemEnable] that acts as "expression"?
BIS_fnc_createMenu might pass through visible/active info as specified there but it's not clear from the description.
Because I already use showCommandingMenu to display the BIS_FNC_createmenu menu.
seems like it's easier to just make your own array tbh :P
How does that work?
I've only used the function.
There's some pretty good user documentation in showCommandingMenu
Hm. Will have to look into this.
Hmm. This does look much more versatile than the function.
But damn it then I must rewrite it! 
Is showCommandingMenu local effect?
Wouldn't want a menu opening in one's face when someone else tries to open it.
Or worse, everyone gets the menu at the same time. 
yyyes
It's local
Okay. Good to know. 
Basically, you can consider almost if not all UI commands local yeah π
Hey.
How does one uses ```sqf
Size
command?
I know it takes a location, but how should it be fed?
config wise?
Does it only takes custom locations?
Does the event handler check the action every second? Or how does it work? Will it load the server?
they only check when the event happens.
when a action happens, it checks if there are eventhandlers present
not other way around
see https://community.bistudio.com/wiki/size
it takes a Location "object" and returns x/y size array
see https://community.bistudio.com/wiki/Category:Command_Group:_Locations for all Locations-related commands π
yeah, i've read that and tried using the command multiple times but I always get an empty return when trying to use it. Figured out it was better than manually using the ellipse the config reference for each town but i could not make it work for me haha
Is there an eventHandler for taking off the uniform?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
I can't find it here
Or some other way that will help track if the uniform has been removed.
no
inventoryClosed might be good enough, depending on what you're trying to do.
I just need to be banned from taking off my uniform.
Well you can use the Put EH
Now wondering whether Put triggers if you put your uniform inside your backpack :P
Sounds like it will from the hint about magazines.
Damn no one has any info about this?
Zeus or Eden modules?
Zeus
Ah yeah they suck to get right. I personally haven't gotten that error ever though. Are you loading any mods besides your own and CBA?
Few other like ACE and RHS that I've been using for over few years. I noticed this problem only when I started building my own addon.
Hi! How do I execute initPlayerLocal.sqf when run inside an addon in a dedicated server?
There are two methods in accomplishing this. Both involves modifying your config.cpp file. Assuming you have all of the functions inside the initPlayerLocal.sqf stored in a different sqf, say for example postInit.sqf
Method A - Add these lines after you define CfgFunctions
class Extended_PostInit_EventHandlers
{
class YourPostInit
{
init = "call compile preprocessFileLineNumbers '\Absoloute_Path_To_Your_SQF_File\postInit.sqf'";
disableModuload = 1;
};
};
Method B - Add these lines inside your CfgFunctions
class postInit
{
postInit = 1;
file = '\Absoloute_Path_To_Your_SQF_File\postInit.sqf';
};
It is also recommended to have waitUntil {!isNull player}; at the beginning of your postInit.sqf file.
thx
Can anyone help me write a script? I'm trying to get a tracer module to delete itself after a short delay and I'm not sure how to go about it.
You want to do it in editor or in Zeus?
I'm doing it in eden
Use a trigger, set the timeout conditions and sync it with the module.
Alright, thanks
Is there a way to detect ambient light (from street lights, or light bulbs)?
So this is partway between here and #arma3_ai but one thing that one of my friends has complained about being immersion breaking is AI phasing through walls/doors. I'm thinking about solutions for that and the naive one (checking every frame for a door) is going to be way too slow in SQF. But if I did it in Intercept, would that be fast enough?
That's not "ambient light". Ambient light is from sun and moon.
If you just want the light properties (color, intensity, etc.) you can use getLightingAt
No. You'll still use a lot of sqf commands. It won't make much difference
oh ok. what commands?
I thought you could access everything in intercept so I thought it would be much faster
You can, but they're still sqf, and the cost of a command is roughly the same no matter where you execute it
hmm fair
could you do something like draw a vector from every AI unit and see if there is an object of type HOUSE in front of them? Obviously limit the raycast to like a few meters.. dunno if that would work.
Still slow
dang really? Even for a raycast a few meters in front of a unit?
hmm.. I would suggest the inverse and have triggers on houses but that seems even more performance intensive
It depends where you run it. For a single unit it can range from ~.002ms to ~ .1 ms
Now multiply it by the number of potential AIs
what do you mean where you run it?
If you only expect to have like 5~10 AIs it could work
An empty map, an empty area of the map, an area of map full of objects, etc.
It also heavily depends on object complexity
E.g. it'll be a lot slower on a rock than a wall
hmm i would have guessed short raycasts would be relatively performant because you don't need to consider everything far away
but fair enough
What I said was for only a few objects in the way
You can try it yourself if you want
I mean I can't even figure out how I would cast a ray like that to start with so I'll just take your word for it
You can use modelToWorldWorld
And try it on yourself
like do something like private _playersFrontWorld = player modelToWorldWorld [0,1,0]; and use the resulting coordinate to see if there's something in front of you?
You should put that a little higher
But anyway yeah
right
I thought there was an engine built in for raycasts but I guess you'd have to do it all yourself
wait crazy idea @little raptor - how does the engine calculate bullet trajectories? Is there some way of using that?
You'd have to assume bullet trajectories have to be cheap because there's guns in the game that fire 1200rpm
What if you "fired" a "bullet" every second with a 1 second fuse that left no decals and had no object or sound and checked to see if it hit anything?
afaik it's the same line intersection thing
except it might store the last quadtree node for the next frame, or something like that, to make it faster 
but anyway that's not in your control
I wonder if my insane idea would work. Problem is it would probably still trigger a bunch of EHs
that also would be a lot of work just to test something that probably 1. isnt even faster and 2. breaks a bunch of shit
if all you want is make an AI not go through walls I can teach you a trick which is a lot faster, but that'll also break many things
there's really no good way to do this so... 
except for rewriting the AI π
I'm trying to use vehicleChat to have players (or AI) send a chat message in the vehicle channel from a script. Unfortunately, it seems that I can only get the driver to send the message. Does anybody know of a way to get a passenger scripted chat message?
https://community.bistudio.com/wiki/vehicleChat
Huh. Command looks broken-by-design.
as far as I know, no can do
That's a little disappointing. I'm just going to put it in system chat and make it look like vehicle chat in that case
you could use a customChat?
I was looking into it but I feel it may be more trouble than it's worth for what I'm doing at best. I would need to be able to assign all the units in the vehicle to that chat when the code gets executed
you could just use a getter like crew
The problem is the command takes the vehicle name, not the player. So sleeve is the driver will be the one that says it, or whoever is in the first crew index presumably
for customChat?
I should clarify I don't think getting the crew and adding to the channel would be the best way to go about it
maybe something more like this
if !isServer exitWith {};
private _vic = theVehicle;
private _id = radioChannelCreate [...];
_vic setVariable ["whit_radioID",_id];
_vic addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
private _id = _vehicle getVariable "whit_radioID";
_id radioChannelAdd [_unit];
}];
//getout and killed event handlers for removing from channel
and this can be a function called for every vehicle
I need to append multiple filenames from my mission folder to an array, is there a way to cycle through all files and get their names somehow?
Consider this code:
{
if !(isPlayer _x) then
{
_bodyPart = ["Head", "RightLeg", "LeftArm", "Body", "LeftLeg", "RightArm"] selectRandomWeighted [0.3,0.8,0.65,0.5,0.8,0.65];
_dmgType = selectRandom ["backblast", "bite", "bullet", "explosive", "falling", "grenade", "punch", "ropeburn", "shell", "stab", "unknown", "vehiclecrash"];
[_x, 0.4, _bodyPart, _dmgType] call ace_medical_fnc_addDamageToUnit;
}
} forEach (_entity nearEntities [["CAManBase"],25]);
Now the code _entity nearEntities [["CAManBase"] also includes VirtualCurator_F in the list. How do I safely use deleteAt or if (_x == "VirtualCurator_F") exitWith { _x }; without messing up the forEach?
if (!isPlayer _x && _x != "VirtualCurator_F") then
```?
or ```sqf
forEach ((_entity nearEntities [["CAManBase"],25]) - ["VirtualCurator_F"])
this doesn't work
doesnβt work with strings?
you're subtracting an array of strings from an array of objects
so ofc nothing will be removed
you probably meant:
((_entity nearEntities [["CAManBase"],25]) - (_entity nearEntities [["VirtualCurator_F"],25]))
that I did
as for which is faster, it depends on the number of objects in that radius
if too few, ofc the first one is faster
if many, the second one is faster I think 
this is wrong too btw
should either be !(_x isKindOf "VirtualCurator_F") or typeOf _x != "VirtualCurator_F"
they're not the same thing tho, but I don't expect anything to inherit from VirtualCurator_F...
Apparently, when I try to list the stuff/entities it has discovered upon executing nearEntities command - I get the variable name of my Virtual Zeus Entity zeus_1 instead of the class name VirtualCurator_F. Moreover, it also finds another 'entity' called Agent 0x<somthing>6e
leopard addressed this, you can use typeOf _x to check for the classname
oh yea that should work
Out of curiosity, wouldn't this return all objects that do not intersect with these two entities in the set area?
now that I look at it again it makes no sense π€£
CAManBase has nothing to do with VirtualCurator_F
I blame @open fractal
I am a criminal 
but anyway it would return all objects that are CAManBase but are not VirtualCurator_F
but like I said objects that are CAManBase (men) are never VirtualCurator_F (a module) so it never removes anything
_entity nearEntities [["CAManBase"] also includes VirtualCurator_F in the list.
pretty sure that's not true
but anyway if it is then it works
it does not include the class "VirtualCurator_F" in the list but the variable name of the curator active near it along with Agent 0x<somthing>6e
I think thatβs what tripped me up, VirtualCurator_F is a classname and it was apparently in the list
but nothing is real 
So If I place down a Zeus Virtual Entity and name it ZVE and sync it to the game master then procced to go near the CAManBase entity, the sqf (ASLToAGL getPosASL _entity) nearEntities ["CAManBase",25]; picks up the ZVE and Agent 0x<something>6e
For practicality, and sanity, I was looking at how to generalize the exception for curator rather than personalize/customize it for my specific usecase with the variable name.
Don't let design department hear that 
There is fileExists to check if file is there
But nothing that lists all files that are there
When the server remoteExec's something and the script has call's or spawn's that are files on the server computer, how does the script handle this? Does it reach over to the host and run those scripts or do those need to be passed over in some way?
nope, local
If you are refering to execVM and such. Those acces the files where they are executed. So if you remoteExec to every client a function that execVM's a file, every client will need that file.
Are there methods to access file scripts on the host machine from a remoteExec/ execVM script?
For clarification: I have multiple (many) .sqf files in the mission folder (together with init.sqf).
Say I have a script that only runs on the host machine and it requires that another client must run a script from one of the files.
The host execVM's that file to the client, but that file script then calls/ spawns another file from the mission folder.
How does this work is what I am asking.
Any files in mission folder are present on all machines.
So any call or spawn's that happen on other clients always have access to files in mission folder?
call simple executes code on the client as if it was done locally and spawn schedules it. Nothing special about it.
That's good. I was getting worried with Lou Montana's answer. 
try and avoid overuse of execVM though. If you execute a function more then once, its always better to just make it a CfgFunction or save it in missionNamespace.
But it's not bad if the execVM script has a lot of spawn's or call's I assume?
In the scope of networking, of course.
the only networking affect is the remoteExec itself, simple calling or spawning code on a client (as its local) doesn't inherently do anything to the network.
Got more questions! 
Why is it that some animations when I attempt to use switchMove don't appear to animate?
All of them make sounds and move the camera as if the animation is happening but the character is not moving.
I am aware that playMove and similar won't play animations in the cutscene or Unknown categories. switchMove should though?
in editor or multiplayer?
in mission or still in the editor UI?
Inside mission.
some animations weirdly don't work on players, only AI
Whuh. 
is it possible to have a condition inside selectRandom ?
The syntax for selectRandom is only an array.
Conditions/ logic has to be made around it.
for example something similar to _myrandom = selectRandom _list_of_items but I don't want to it to select a specific type of class.
selectRandom ([1,2,3,4,5,6,7,8] select { _x > 5 });
ah I was searching for 'where'
Know about any workarounds?
Can the player be disconnected from the unit (but keep the camera), then play animation, then reset player?
How would one go about that?
some awful selectPlayer/switchCamera mess I would guess
Can the player be assigned a null unit or something?
Perhaps a logic unit can suffice.
selectNoPlayer
but before that, try switchMove without any mods and from the Debug Console:
0.5 spawn {
sleep _this;
player switchMove "TheAnimation";
};
Does not work in multiplayer. Hmm. 
can somebody see if https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onLBDragging works? It should work with all the same parameters as https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onLBDrag , but it doesnt work at all.
selectPlayer objNull may then
Tried multiple times with different commands and animations. 
Rough multiplayer emulation:_noPlayer = createGroup sideLogic createUnit [ "Logic", [0,0,1000], [], 0, "NONE" ]; selectPlayer _noPlayer; hint str player; //Β L Charlie 4-3:1 (KK)
I mean without mods
because switchMove sure works on players for most animations
If I understand this correctly this creates a logic unit and assigns player to it?
If that's correct then that's what I had in mind.
I am working entirely mod-less.
It is taken from the wiki examples
Ah. Did not read them then.
in https://community.bistudio.com/wiki/ctrlAddEventHandler it states that
Control event handlers are processed in reversed order, i.e. last added: first, first added: last. So if you have an override it should be set up in the 1st added EH.
So does this mean that there are methods to override ctrl events?
I think they're referring to onKeyDown where you can return true to override the default action.
but youi cant override onmousebuttondown?
If you can then it's not documented.
Switching to a logic unit apparently creates an awful vignette post processing.
What's an easy way to get rid of it? I'm no good with post processing.
no, i mean overriding base-game functions
is there a function for getting the enemy side of a given unit?
yeah, some if you return true
can i override onmousebuttondown?
actually, no, that's a silly idea since we dont even get LBclicked
why do we get LBdblclicked but no LBclicked?
most likely because reasons π
thx mate
Miller needed it for his hunt for the east wind device
Hm. I can't figure this one out: ```sqf
_unit addAction [
("<t color='#00e83e'>" + "LOAD " + " str (((call GetClosestFriendlyLocation) getVariable 'supplyValue') * WFBE_C_ECONOMY_SUPPLY_MISSION_MULTIPLIER)" + " SUPPLY TO TRUCK" + "</t>"),
It's complaining about this:
Error position: <addAction [
("<t color='#00e83e'>" + "LO>
Error Type String, expected Bool
(NOTE: Arma 2 OA)
what if you replace all this string with "text"?
Error in expression <yer distance cursorTarget<5)"
];
_unit addAction [
("text"),
("Client\Module\s>
Error position: <addAction [
("text"),
("Client\Module\s>
Error Type String, expected Bool
That error might not be telling you what you think it is. When it marks a command as the error position, it can be any of the command's parameters which are incorrect.
Oh true, forgot
Here are the related scripts and functions. https://sqfbin.com/axubirowesusicemezuq
So it gives the following errors:
On client: ```Error in expression <yer distance cursorTarget<5)"
];
_unit addAction [
("text"),
("Client\Module\s>
Error position: <addAction [
("text"),
("Client\Module\s>
Error Type String, expected Bool```
On server: ```
Error in expression <objects select _j;
_distance = _current distance _object;
if (_distance < _neare>
Error position: <distance _object;
if (_distance < _neare>
Error distance: Type String, expected Array,Object,Location
File mpmissions[55-2hc]warfarev2_073v48co.chernarus\Common\Functions\Common_SortByDistance.sqf, line 21
So something is type String for some reason
the addAction itself is not the issue, there might be missing ; or some invisible character (Β ) there
The third addAction there has fourth parameter (priority) missing.
It's complaining about the sixth parameter, which is supposed to be the seventh.
Damn! Nice catch π
I guess Arma 2 doesn't have sort...
BIS_fnc_sortNum is a thing though
oh yes, Arma 3 spoiled us all π₯°
Arma 3 added a current 1199 commands to the engine
https://community.bistudio.com/wiki/Category:Arma_3:_New_Scripting_Commands
Hm. It's still complaining: ```
Error in expression <objects select _j;
_distance = _current distance _object;
if (_distance < _neare>
Error position: <distance _object;
if (_distance < _neare>
Error distance: Type String, expected Array,Object,Location
File mpmissions[55-2hc]warfarev2_073v48co.chernarus\Common\Functions\Common_SortByDistance.sqf, line 21
It bugs out when this code calls it:
Private["_friendlyTowns","_object","_nearest","_side"];
_friendlyTowns = (side player) Call GetSideTowns;
_nearest = objNull;
if (count _friendlyTowns > 0) then {
_nearests = [player,_friendlyTowns] Call SortByDistance;
_nearest = _nearests select 0;
};
_nearest
And GetSideTowns:
Private ['_sideID','_towns'];
_sideID = (_this) Call GetSideID;
_towns = [];
{
if ((_x getVariable 'sideID') == _sideID) then {_towns = _towns + [_x]};
} forEach towns;
_towns
The towns are objects (I think?), from mission.sqm:
class Item25
{
side="LOGIC";
class Vehicles
{
items=4;
class Item0
{
position[]={11395.063,254.27736,5510.4722};
azimut=15;
special="NONE";
id=75;
side="LOGIC";
vehicle="LocationLogicDepot";
leader=1;
skill=0.60000002;
text="Msta";
init="nullReturn = [this,""Msta"",""+"",10,30,100,""TinyTown1""] execVM ""Common\Init\Init_Town.sqf"";this enableSimulation false;";
synchronizations[]={76,77,78};
};
(Init_Town.sqf adds the town logic object to towns global variable)
Break it down and check your assumptions. diag_log spam if you have to.
Yeah, gotta do that. If something, I've learnt that assuming things in programming is the source of all evil π
Oh, and the quote from famous programming course: "The difference between rookie and master programmer is that the latter uses debug logging 100 times more" π
why do that when I can spend hours on trial and error
Or just attach a debugger and step through :poutcat:
works for A2?
buy more time!
Still wondering about this.
"_current value: Mogilevka, type: OBJECT"
"_object value: B Delta:1 (Net_2), type: OBJECT"
Both are objects consistently. The error I mentioned previously seems to be caused by some completely another script by pure luck (...) π
why isn't my task showing up on the player's HUD as a waypoint
cuz something is wrong
{
_x params [
["_itemClass","",[""]],
["_itemCount",0,[0]]
];
if (_itemCount > 0 && (_itemClass isNotEqualTo "")) then {
_warehouse setVariable [format["item_%1",_itemClass],[_itemClass,_itemCount],true];
};
} forEach (_currentVal # 1);
This is giving me an error "Error undefined variable _x", but it is doing what it is supposed to. Any idea what im doing wrong?
yeah, _currentVal # 1 might not exist
How does forEach run code for something that doesn't exist 
Adding a check if (isNil "_x") exitWith {} makes the error disappear but then it doesn't function properly anymore
then { continue }
Continuing works, I wonder why the exitWith method doesn't work. Thanks!
exitWith will stop the whole loop, whereas continue will just jump the element π
Oh, right... I guess I am tired as well...
Hello, using ACE3 : anyone know if an event handler is fired when the action of dragging a body is finished?
I tried to search everywhere in the ACE documentation, I found nothing
The only way I found is to check the AnimChanged EVH but it is really not optimized
@tough abyss Best I found in the ACE code was this:
if (_mass != 0) then {
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // force global sync
};
Haven't tried it though, and I'm not sure if bodies have mass in Arma.
Yeah I saw that but I thought it was more internal
I will make some tests
If you want to do a lot of stuff in ACE you have to use internal functionality :P
Ok ^^ I will check that, thanks man
_marker = getPosATL _objLocation;
[true,"Test Task",[
(format["Go to this area"]),
"Go to area.",
"_marker"
],getPosATL _objLocation,true,0,true,"",true] call BIS_fnc_taskCreate;
```
why doesn't this show a 3d hud waypoint like in official scenarios
it's on a custom map if that matters
what is _objLocation?
it's a game logic flag
the marker shows up on the map just not on the player's hud
task is assigned properly
(also, _marker is useless here)
oh then it might be a difficulty setting thing
fixed instantly
thank you wise arma guru
why is marker useless
_marker = getPosATL _objLocation; does nothing
I mean, the _marker variable is not used
i was guessing it was passed by name to the last entry in the description parameter array
not totally clear on what a "marker" is
ah negative, it would be the marker's name, as in, a "real" marker
map marker π
wait, no
I'm really tired today
"marker" as in "text shown on the Task (3D) marker"
that makes way more sense thank you
i see what you meant by _marker does nothing, it's supposed to be in the location field, got messed up when i was paring the code down into a minimum viable example
hey umm i have this txt but have forgetten where i got it from.
["<t color='#ff0000' size='.8'>OPERATION<br />DRAW, Objective Draw VC from frontlines in a prolonged attack from behind them</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;
nvm lol
Is there a good way I could make a teleport pole setup but give one unit of the players an ace menu interaction to move the flag on to their postion, so basically make it a moveable thing the squadleader as an example can put on a reinsert point for people who died, spawn on base and interact with the pole there. Thanks in advance frens
is the defaultValue value of getVariable interpreted in case of script?
You know how SQF works right?
not always
The array is built, before getVariable gets called
right, so if i have a script there, it runs
even if the default value is not returned
same as if you'd remove the getVariable and just write [a,b,c]
what i want is to do something like thisd
player getVariable["goKart", "goKartClass" createVehicle position player]```
can do, i was just asking if that's possible
don't know a easier way
this is not possible?
right
which i don't think is what you want
Everything in an sqf script always runs, unless wrapped in {} (a code), which only runs under certain conditions
Is there an efficient way to animate an object texture, like using a spritesheet and animating the UV coords?
As opposed to doing something like swapping an object texture via scripting and a bunch of individual images as frames
Maybe you can display a video on them instead
Oh is that possible??
Does it support transparency/alpha channel?
Dunno never tried it
Trying to find a better way to do animated blood pools
Tho it seems playing another video will stop the last one played π¬
Not sure if that's an engine limitation or that's how that function works
Another alternative that comes to mind is using setObjectScale (resizing it every frame)
Tho that'll probably look weird...
would there be too much network traffic from looping setobjectscale on multiple objects or would that not be an issue?
Oh yeah, I have blood flowing animations, scaling one texture/object would look awkward
Like those oldschool blood pools from the old GTAs
there's a note from, uh, Waffle SS on the setObjectScale page saying that performance would likely be terrible from running setObjectScale on every frame, but has anyone confirmed the impact of this?
wasn't it local effect?
setObjectScale is global effect
I don't think it'll be "terrible"
Tho depends how the game stores it
If it's stored separately it's fine
If it stores it into the transformation matrix/quaternion then it's bad 
setObjectScale still seems like a big question mark when it comes to its potential uses
I might try some shenanigans later
may or may not be picturing assets growing on trees
What about setting object scale on a local object, through something like createVehicleLocal?
Havenβt looked up the command docs yet, but Iβd think for network performance, if you have an object that doesnβt need to be replicated exactly across all clients, or for some one off thing, you could create a local object and scale it each frame, triggered by some broadcasted command / execRemote or whatever (not networking the scaling itself but the initiation of it).
Been a good five or so years since I last dived into ArmA scripting so Iβm prob misremembering some of the command names
I'm having a hard time finding how setObjectScale would behave in that instance
you could absolutely remoteExec a function to scale an object, but whether there's a performance impact on other machines from the global execution of setObjectScale is another question
and I hope someone who knows the engine better can answer that :)
What Iβm curious about is what the global effect would be if trying to scale an object local to a client?
that's what im wondering too
if every machine is receiving setObjectScale information on every frame from every other machine that's probably far from ideal
or negligible
i couldn't tell you
Still unnecessary at least
Would need to know what information gets broadcasted. I would think at best just the object ID, and the scale.
Not a big deal I would think
can you tag me if you find out how it works
Nothing. It just runs locally. No network cost
You just run the command locally for that local copy of the object
Nice
Question, is there a way to have a hidden unit be damaged by bullets some how?
I have a "monster" that is supposed to chase the players with a small effect around him but he's hidden. However I can't find a way to either make him take damage while hidden or at least be unhidden when taken damage.
[Please ping when you answer ^_^]
the only way is hiding it without hideObject
hideObject disables collision too
How would I got about achieving that? π
what kind of object is your "monster"?
And it takes bullet damage?
yes
@little raptor doesn't seem like it does :(
Made sure to add event handlers for hit and it didn't trigger
Explosions can damage it but not bullets sadly.

try another object. does it have to be a unit?
I mean I can technically attach the object to the unit and if the object is hit apply damage to the unit.
But I need something that is both invisible and can take bullet damage.
Or at least register that a bullet went through it
if you don't mind using a mod you can make one such object yourself in object builder
it doesn't have to be something special
you can just make a cube
Don't mind at all, this would be helpful for so many more OPs in the future, but need to figure out how to do that now xD
all you need is an object with Fire Geometry LOD and some hit points
you can leave other LODs empty
by figure out I mean the whole object editor thing xD
But thanks a lot for the help so far
btw does your mission take place in the day or night?
Both, it's a campaign kind of thing.
if it's night you can just remove a vanilla object's textures and it becomes hidden. but it might cast shadows in the day
That can be a temporary solution I can work with, and I can just say the "shadow appearing" is the monster's weakness or something idk.
What script/command/function would I use for this?
you can just use the quadbike with this:
{
bike setObjectTextureGlobal [_forEachIndex, ""];
} forEach getObjectTextures bike;
Can it work on a unit? would help if the object is humanoid.
no
at the very least the head will be visible
probably the hands too
actually there's a better object you can use: Box_NATO_Uniforms_F
it becomes fully hidden
Will try thanks :D
quick question for those ace aficionados, I currently have a functioning ace interaction that attaches an stretcher to the nearest vehicle using attachTo relative, the problem is I need to carry it put it in place and some geometry lods don't have a opening to slide a stretcher in, for example the alive UH-1Y. My question is how can I have the player carry the object in the right position then use the interaction on the stretcher(all possible with current soultion) then have ace release the stretcher without having it remove the attach to?
Any way to set any enemy that spawns to aware and open fire? I noticed when it comes to spawning enemy planes they are automatically set on fire until fired upon
You can just use setCombatMode and setBehaviour after the spawn
Can I use a predetermined script that automatically does that for me? Instead of manually entering it every time I spawn an opfor aircraft
I want them to come after me. Almost like how the lambs rush module works
Every scripts are predetermined?
I don't really understand what
manually entering it every time I spawn an opfor aircraft
you mean
You made it seem like every time I spawn an enemy Id have to go into the enemy I spawned and type in the script
I would just like to spawn an enemy and have it automatically set to aware and open fire
Well I have no idea how you did execute the script
It does. But I never used MCC so...
You ought to give it a try sometime. Makes occupying towns with enemies super fast
And they generate their own waypoints and all that
Assuming you need a while loop, is it more performance efficient to have a function that contains the while loop, or a while loop that runs the function?
I don't really understand any of that. Is there a guide/video that I could watch that would make that make more sense to me? I never really messed with scripting before
I would say function hosting the loop is better, so provide an array to it
Do I have to make a custom GUI to show a custom pointer/cursor as there's one in Old Man scenario? What I need is a simple dot in the center of the screen to make aiming at stuff easier (mainly for interactions on small objects)
So the strecher is properly attached right up until you release the ace dragging/carrying?
Ah yes, the object is attached to you and get detached upon release, so it will also detach from the vehicle. https://github.com/acemod/ACE3/blob/master/addons/dragging/functions/fnc_dropObject_carry.sqf
You'd probably have to make it so the action that attached the strecher also does part of what this script does and releases the strecher you're dragging.
Hi, is there a way to read out via the function "configFile" whether the object can fall to the ground or stay in the air (e.g. boxes fall to the ground and walls stay in the air). or can I only go via class names?
try checking its simulation yes
Hello everyone, does anyone have a script example of rotating the camera with the mouse, as in 3DEN? I'm just curious to know the algorithm how it works.
If I place a canal wall and a crate 1m in the air in the EdenEditor. I start the mission, the create falls down and the wall does not. But with "simulationEnabled cursorobject" it returns True for both.
this does not cover all falling objects, but then I go via the class names, which is not a big problem now, just wanted to know if there is an easier way.
There are a finite number of simulations and they'll have defined behaviour. I don't think this is documented anywhere though, so some trial and error may be required.
All simulations for vanilla CfgVehicles:
["","invisible","car","motorcycle","tank","soldier","animal","helicopter","airplanex","ship","parachute","laserTarget","nvmarker","artillerymarker","suppresstarget","house","rope","airport","flagcarrier","vasi","thing","thingeffect","windAnomaly","tankX","church","shipX","thingX","fire","fountain","House","headlessclient","carx","CarX","helicopterrtd","paraglide","shipx","submarinex","UAVPilot","curator","airplaneX"]
If we assume it's not case-sensitive then this will be a bit shorter :P
Yes, that's how I did it last time, but I wanted to know if there is a better / faster / more accurate way. Thanks for the quick answers. π
I mean what @granite sky meant; the simulation config value
If you canβt find a BIS function for it the ace spectator should be on GitHub
Is BIS_fnc_buildingPositions obsolete with buildingPos with an index of -1?
Currently it uses buildingPos with an index of -1, so the only additional functionality it provides is resizing the output array when you specify the second parameter.
So short answer: yes.
How tricky would it be to do a Cinematic that pans around where a battle is happening. With txt explaining what's happening
Easy
Wouldn't happen to know of a guide on how to do it?
Mill around here a bit
Then you should look at either cuttext, titlecut or any of the other bis functions
Is it possible to convert a position to velocity?
I'm trying to make an object fly to the position of my cursor. I tried using such code, but it doesn't work well:
power = 10;
onEachFrame {
private _direction = (getPos object) vectorFromTo (screenToWorld getMousePosition);
object setVelocity (_direction vectorMultiply power);
};
Because:
- You're using getPos which is AGLS
- You're using screenToWorld which only works if you look at the terrain
Yes, thanks, I changed getPos to modelToWorldVisual and it worked
Ok will try
Is there a way to Eject the troops from a helicopter when the helo lands.
Ur amazing thanks!
@coarse dragon If they're a separate group from the pilots then they'll get out if the pilots are given a transport unload waypoint.
Otherwise you can forcibly unassign the units and they'll get out.
Yea but it's slow
Need faster especially for a chinok
In general, AI units will disembark slowly, one at a time.
Just use moveOut like John Jordan said
Looks complex
And the eject action is simple? 
you can also use setPosATL on the units if you want to move them out instantly
And with moveOut you just do moveOut unit
You have to move them out first
disagree
The example looks more complex than that
Did you mean they won't be taken out of the vehicle or that they will run and get back in?
I just tested it and ```sqf
_unit = selectRandom (crew heli);
_unit setposatl getposatl player;
teleports one of the crew out of the helicopter to the player's position
though you're right moveOut is better
it will only move out if _unit is local
otherwise it does nothing
(just use moveOut)
that shouldn't be a problem if the units are governed by the server
(i agree)
you can do [_unit, getPosATL player] remoteExec ["setPosATL", _unit]
then moveOut is not needed
well then, it'll work
enough fooling around
let's get down to brass tacks
private _pos = (_vehicle getRelPos [3,90]);
{
[[_x, _pos], "setPos", _unit] call BIS_fnc_MP;
} forEach _group;
["SEAL TEAM SIX HAS ARRIVED ON STATION!!!!!", "hint"] call BIS_fnc_MP;
no
NO BIS_fnc_MP, EVER
agrrrrrr Γ¨_Γ©
he has been summoned
In a unit loadout config file, would it be possible to make sure the medic loadout also gives the medic trait? Like would role = "Medic"; work?
you may want to check the documentation for this
Currently looking around the configs wiki for a list of possible options, will report back if I find something.
Found all the options for loadout configs on the "Unit Loadout Array" page. Unfortunately, assigning traits is not possible through loadout config, in case anyone else has a similar question in the future.
https://community.bistudio.com/wiki/setUnitLoadout says no
https://community.bistudio.com/wiki/Description.ext#CfgRespawnInventory says no
using setUnitTrait works though
Get eden enhanced you can change the trait in the units settings @ruby bronze
I'm aware of doing it in the editor. My issue stems from our respawn system. We send people to spectator when they die, and we can select individual players to respawn (and with what custom loadout). But when they are respawned in this manner, they don't have any traits (such as medic)
Wait so there is a CfgRoles according to that second link
Oh nvm that's not quite right. I'm still looking at the CfgRespawnInventory though
setUnitTrait wouldn't work inside a loadout.hpp file though would it?
it would not, indeed.
Just set it on the respawn event
Would that be through onPlayerRespawn.sqf?
Ah okay, so maybe I can set it to look for role = "medic", so when a player respawns with medic role it'll assign the trait
yes
For sanity's sake, how does this look for the formatting (must work on a dedicated server too)
onPlayerRespawn.sqf
if (role = "Medic") then {setUnitTrait ["Medic", true];};```
use double equal == to compare and single equal = to assign.
so it would be sqf if (role == "Medic") then {player setUnitTrait ["Medic", true];};
Thank you for catching that, I will test it on my dedicated server and report back
You also need to add a unit to set the trait
I had a feeling I should have added "player" haha, thanks
So far still no dice with the respawn event method. However... inside the loadout.hpp file, along with things like primaryWeapon[] = {}; and such,
there is a code = ""; option as well, that I somehow had not noticed. It says the code entered in there will be executed when the unit is initialized.
I've been trying to insert the player setUnitTrait ["Medic", true]; code into that in all sorts of ways, but I haven't figured out exactly how to get it working between the " ", keeps breaking the loadouts completely
if you need to put quote in quote you can use either code = " 'Quotes and apostrophes' " or code = " ""Double Double Quotes "" "
When i'm specting another player (alive player) withsqf switchCamera _anotherPlayer;and the spected player disconnect, sometimes his player model don't disappears, the model only disappears when i stop specting hin.
This is a bug?
Normal behavious for alive disconnecting player is the model dissapears.
This is not related to script stuff, it's Arma 3 behaviour.
why don't you make it automatically stop spectating the player?
Also how would I execute a while or for loop to check the animation state of the player whilst running an uiSleep for 5 seconds healing the player?
oh I did ahha
So far I got a character constantly doing the same animation
TEST_fnc_Heal =
{
private _isHealed = false;
player removeAction 0;
if(isNull objectParent player) then {
while {damage player < 100} do {
if ( animationState player != "AinvPknlMstpSnonWnonDnon_medic_1" ) then {
player switchMove "AinvPknlMstpSnonWnonDnon_medic_1";
player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
};
if (_isHealed) exitWith {
hint "Player healed to 100%";
};
};
uiSleep 5;
private _isHealed = true;
player switchMove "AidlPknlMstpSnonWnonDnon_AI";
player setDamage 0;
} else {
hint "Please get out of a vehicle first";
};
};
nice!
yeh so far I am stuck in the animation. But I have no clue on how to run a while loop in an inline function as well as run the healing portion at the same time
i use the animation event handlers to detect when the animation is complete
would it possible to run an event handler in an inline function?
Unfortunately, double quotes didn't solve it either =( I'm about ready to rip my hair out lmao
You are try to set a unit to the medical trait right? What is the full document/code?
Trying to grant the medic trait through this loadout config because otherwise, if the medic dies, goes into spectator, and then is respawned, they will no longer have the medical trait.
I'll pass you the loadout config in DM
maybe try to set it in a playerRespawned.sqf file? Check if he has the right var and if he does set his medic trait
longshot but yeh
First of all damage is between 0 and 1. Not 0 and 100
Second of all, you never change the _isHealed variable, so your loop never stops...
You have to use sleep, not uiSleep
As for the healing, grab the current damage, then subtract it by the healing value, and set the damage
Then set the while condition to damage _unit > 0
Whats the difference between uiSleep and sleep? Im trying out new functions
uiSleep doesn't wait when the game is paused
And doesn't accelerate when the game's accelerated
Aight thanks
And I'm not sure what you mean by an "inline function" (I mean I know what is is in general but I don't get your question)
right I realised I should rephrase. So I am trying to run a script where it heals the player and runs an animation at the same time. The healing should only take 5 seconds and I should have a loop to make sure that when I am healing, if the animation does change it should be put back straight away
One thing worth mentioning here, in case you're not familiar with the scheduler, is that you can't make sure it takes 5 seconds using a scheduled script (such as the one you're using now)
If you want accurate timings you should use the unscheduled environment, tho I don't think it's very important in this case
Also one thing is still kinda vague for me. Do you want the healing to be continuous during that 5 seconds? Or just instant healing after?
_unit = _this select 0;
_caller = _this select 1;
_action = _this select 2;
_unit removeAction _action;
guy1 setDamage 0;
[person1, 'animName'] remoteExec ['switchMove', 0];
(if multiplayer, if not, guy1 switchMove animName; will work)
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
It should be instant after the end of the animation
player switchMove _anim;
player playMoveNow _anim;
sleep 5;
if (animationState player == _anim) then {player setDamage 0};
Sorry for the slow typing. I'm on mobile
Instead of sleep you can also do:
_endTime = time + 5;
_skipped = false;
waitUntil {
time >= _endTime || {
_skipped = animationState player != _anim;
_skipped
}
};
if (!_skipped) then {player setDamage 0}
Tho no need to do it this way for what you're doing rn, since the result is only important after 5 seconds and you don't care what happens during that time. But if you did that's what you should use
a simple sleep is enough
Can someone help me with disabling AI movement? I'm new to this game, and I am setting up a small campaign with friends, but I want some units to stay in one place.
I also have like zero coding skills so I'm sorta learning on the job here.
if isServer then {
this disableAI "PATH";
};
you can put this in the init
Alright, thank you very much!
the init box executes code on every machine, which is unnecessary if it's just the server controlling the ai
and disableAI is just a useful command for stuff like that
I've tried disableAI with no use.
It keeps saying uh.
Lemme check.
Oh yeah.
I'm in Eden, will that matter?
But yeah, it keeps saying" Error disableai: Type Group, expected object"
Do I need to give them variable names?
because you're using that on the group and not the unit
yes
Alright.
if you want to do it on the group you should use:
{
_x disableAI "PATH"
} forEach units this
Gotcha.
Thanks, been quite stuck on that. I kept using it on the squad level lol.
can setObjectTexture be done for headgear or no?
No
I feared that would be the answer
I've been trying to create a menu for when placing a module, the user can input necessary values for customized triggering of events. After struggling to make do with CfgClasses, I saw that most addons use ZEN's custom_addon_register function. While I did get the basics of it, I don't know what possible combinations are inside the parameters (like checkbox, toolbox) and what parameters/options should I provide for each one.
I'd check out #arma3_gui and #arma3_config. The documentation on that stuff is really difficult to follow along with, at least for me
Does anybody know of a command to take a backpack from a weaponholder and place it on a unit? It needs to be the same object (with contents) not just the same classname
I've been trying to understand how to create one by reverse pbo'ing other mods from the workshop and its still difficult 
you can only do that via actions afaik
actually nvm. that doesn't take the object
I'm pretty sure there was one tho 
right it's this this one I think:
https://community.bistudio.com/wiki/Arma_3:_Actions#TakeBag
oh, Oh, I'll give that a try. Thanks
I found an application before that allows you to make gui configs to put in missions. All you need to do then is call them in a mission. There's still a fair bit of messing around with the config to get it right but it can get you up an running
Pretty sure that is it
Still isn't easy, but it's something
Well thats a good starting point. Better than nothing so thanks π
getting a invalid number error at any ideas? im new to gui scripting ```sqf
_RscText_1000 ctrlSetPosition [6 * GUI_GRID_W + GUI_GRID_X, //error here , 23.5 * GUI_GRID_W, 3.5 * GUI_GRID_H];
GUI_GRID_W and GUI_GRID_X are not defined
thats funny my hpp to sqf converter converted it differently than when ive used it earlier
nvm, atan2
it's impossible to convert object orientation into a single angle
Hey guys! Can anyone help me with my script?
_ma1 = getPosATL marker1;
_ma2 = getPosATL marker2;
_ma3 = getPosATL marker3;
_ma0 = getPosATL marker0;
_newpos = +_ma1;
_newpos set [1, (_newpos select 1) + random [500, 800, 1000]];
_newpos set [2, (_newpos select 2) + 1];
_newpos set [0, (_newpos select 0) + 1];
player setpos (_ma1);
"respawn_west_1" setMarkerPos (_ma1);
_respawneast = createMarker ["Runner Spawn", _newpos]; //the issue is with this one: error 0 elements provided, expected 3//
_respawneast setMarkerType "b_med";
_respawneast setMarkerColor "ColorRed"; ```
sure, what's the issue?
quoted it in the script, i think it doesn't recognise _newpos as an array
what is marker1?
systemChat its value to be sure
str _value
but I thought your issue was with another variable
you are mixing _ma1 and _newpos
also
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
str_value displayed any for _newpos and _ma1
yes because I want to randomise one of the coordinates for the new marker
:(( it was for testing

so your vars are invalid somewhere
marker1 is undefined then
A guy in a thread i made helped me out in the mean time. The problem was that marker 1 needs to be a marker not a game logic object
Then the _newpos vars could get those coordinates from it
Thanks for the help and effort tho! :))
we don't allow threads here tho 
I don't see why getPosATL wouldn't work on a game logic
On the bohemia forums website?
Me neither, i just changed them to markers and it works fine
I thought you meant discord thread π
Oh no sorry, I posted a thread on the forums
Would switch player work with a trigger that detects when Opforce isn't present
it can work anywhere
Sweet
I think there is if the Shooter is local
hey folks, is there any way to make people spawn at one of six positions from the same respawn module position?
what?
one module
multiple positions people can spawn in at if they use that respawn module
Yea. Use empty markers and stuff
que
Wot?
how does that work
I have no idea
figured it out but doesnt work because of how enclosed the spaces are
ty anyways
(use multiple respawn_west markers)
just wondering peoples opinion, is it fine if i just use @Enhanced Movement or should I also uise @Enhanced Movement Rework
Doesn't rework require the 1st one?
Hello
Just wanted to ask something about scripting ace cargo
So I have a piece of artillery with me
and I have a specific vehicle I want to load it into
The problem is that the vehicle itself is not built with cargo space
So my question is, how do I add cargo space into it so that I can load the piece of artillery into the vehicle?
I currently can't check the ace cargo framework since the Ace3 website is down
so I decided to ask here
Anyway
thanks
yeah I'm just wondering if its worth using rework or if original is fine
!Alive goes into conditions?
yes. and rework changes, fixes and updates the old one. (no need to load the ace fix version which is now not fixed due to their last big update)
Ace.. I didn't enjoy that mod at all 
Its free to edit.. take out the bits you dont like and leave the bits you like :/
you can edit the vehicle cargo spaces and/or the cargo in the attributes under ACE
Yea the guy who asked about the
!Alive thing. Will know how to edit a mod π
Is there an LOD Iβm not aware of for doing a lineIntersectsSurfaces that is more accurate to the actual displayed mesh? For my BloodLust mod, Iβve noticed that blood splatters can spawn inside of walls of certain house models, and that sidewalks arenβt getting intersected with unless I check for PHYSX LODs, which also have meshes that donβt cleanly align with the displayed surface.
Even the FIRE LOD seems inaccurate for some models like the interior walls of some houses, where you donβt even see the generic bullet hole decal that should appear on the surface because the LOD is within the wall itself (which makes sense for performance/optimization).
Iβve tried a lot of different LOD permutations but had no luck with one that lined up with the actual visible surface unfortunately.
is there a way using script i could remove a single character from a series of text
so agm-114k to agm114k
i want to remove the -
Not on my PC atm so I canβt test this, but try looking at example 1 in https://community.bistudio.com/wiki/joinString
Split the string by the -, then join the result which should have filtered out the dash
Forming the new string
Iβd be surprised if there wasnβt already a standard function for doing a string replace though in the bis_fnc library
what got you back into bloodlust? i remember your mod from years ago
I quit my job, got some free time while I interview at new places
always cool to see older projects get revived
time for the existential dread with 2017 being 5 years ago
Hello,
i am trying to make a little intro where group of AI's is moving in a close formation towards a c130 (as one would do when boarding the aircraft). Now I am not sure on how to approach it to get it looking good.
I tried the simple version of just giving each of them a waypoint, but a) they start moving simultaneously which results in the animation being synced and looking unnatural and b) after a couple of meters they start going left/right and arent in the formation anymore.
So now I thought of using the Keyframe modules, since the path is set and the ai cant deviate from it. But i am having trouble with animating the walking.
I found this snippet here (but with a generic unit variable and animation name)
s1 switchMove "AmovPercMwlkSlowWrflDf";
s1 playMoveNow "AmovPercMwlkSlowWrflDf";
s1 setVariable ["WAG_loopAnim", true];
s1 addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
if (_unit getVariable ["WAG_loopAnim", false]) then {
_unit switchMove _anim;
_unit playMoveNow _anim;
} else {
_unit removeEventHandler ["AnimDone", _thisEventHandler];
}
}];
but while it loops okayish (there is some stutter when the anim starts playing again), the animation itself looks kinda laggy.
Is there anything I could do about that or should I try a different approach altogether?
quick question....
How do you reference a local variable when it is inside brackets? Is it possible. Or do I just need to make it global, drop the private, and the underscore.
for example...
case 0:
{ //CSTO Ammo Depot
raidComp = ["CSTOAmmoDepot",getMarkerPos "raidLOGMrkr1",[0,0,0],_raidCompDir] call LARs_fnc_spawnComp;
waitUntil {sleep .1; (!isNil "raidComp")};
Private _vehicle = [_raidLOGPos1,_raidCompDir,"O_T_Truck_03_ammo_ghex_F",east] call BIS_fnc_spawnVehicle;
(_vehicle select 0) setFuel 0
};
I need to clean up after mission complete further down in the script.
deleteVehicle (_vehicle select 0);
simple, you don't
lol thanks
local variables are local, they are not visible outside the scope
but you can make them not local
what you're trying to do specifically defeats the purpose of a local variable
if you make them global, you can access them
thats what I thought.
if you have multiple of these, you could put them all into a global variable as an array
yeppers, dread put me on the right path there.
nah forget global, you have a switch so do this:
private "_vehicle";
switch {whatever} do {
case 0: {
//etc
};
}
just wanted to make sure I wasn't missing something. Thanks guys!
If I have to convert a string of different classnames with a comma seperator (Ex: MineDetector, GreenSmokeShell, WhiteSmokeShell ) to an array, is it better to use toArray or parseSimpleArray?
toArray splits to characters so probably not optimal for anything. parseSimpleArray requires stringified input so might be problematic. splitString would be the more generally useful command.
Anybody know if it is possible to force an item into a uniform or vest even if there isn't room for it?
addItemToUniform doesn't work?
I imagine you can get the container and then use the container adding functions if not.
I recall there's a command to enlarge/vice versa container size. Wonder what it was
I'm fairly sure you can overstuff with the container-adding functions anyway.
setMaxLoad yes
Doesn't seem to, no. Still checks for space.
I think I know the goal but unfortunately it needs to check for the space
try (uniformContainer player) addItemCargoGlobal [whatever]
That does it!!!
vestContainer _unit setMaxLoad 300;
For reference the default maxLoad for a chest rig is 140
Didn't realize that was even possible, thought the load limits were locked to the config
I can up the max load, add the item, then replace the original limit
It was added very recently
It's funny cause I think the old glitch still exists where you can add magazines to a container my removing it from your magazine slot (bypasses check for container being full)
Maybe that was patched though
Think you'll need to use carefully if is for MP, BIKI suggests so
["agm-114K"] call BIS_fnc_filterString;
returns "agm114K"
thanks
by default, filterString only allows for A-Z, a-z, 0-9 and _
you can use the second parameter for handing it more/less allowed characters. See documentation here https://community.bistudio.com/wiki/BIS_fnc_filterString
How would I be able to use remoteExec for this?
[this, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["inside"], [], "ACRE_PRC77", [], []], true] call acre_api_fnc_addRackToVehicle;
[this, ["ACRE_VRC103", "Lower Dash", "Dash", false, ["inside"], [], "ACRE_PRC77", [], []], true] call acre_api_fnc_addRackToVehicle
What is this in this context?
Acre setting vehicle rack for vehicle. It worked when I self hosted failed on the server side
yes
And this is Init of the vehicle?
yes
no. that would require the resolution lods which the command doesn't support. (and they would be extremely slow, due to high number of triangles)
the most accurate one for what you want would be FIRE
Guess you shouldn't. Init of the vehicle will run on everyone, even if the one is JIP. I don't know how ACRE things work but it have to be run on every client?
that's because you're using the keyFrame thing
don't
to move soldiers smoothly, either let them run for themselves, or use setVelocityTransformation
idk yet fully I'm just digging around trying to find a way to set all vehicles with a specific rack
why do you even want to remoteExec it? does it not work as it is?
no
add a bit of sleep then
it works my side just not server side
you're putting that in init, so it runs for everybody
it doesn't look like it's client side
its on the init of the vehile
i was following this
/*
* Author: ACRE2Team
* Initialises all racks in the vehicle. Must be executed in the server. If no condition is specified,
* the radio will be configured to match the vehicle preset defined using acre_api_fnc_setVehicleRacksPreset
* or the preset of the first player that matches the given condition if the vehicle preset is not defined.
*
* Arguments:
* 0: Vehicle <OBJECT> (default: objNull)
* 1: Rack configuration <ARRAY>
* 0: Base classname of the rack (Without ID) <STRING> (default: "")
* 1: Rackname - this is diplayed to the user. Ideally short <STRING> (default: "")
* 2: Rack short name - displayed in GUI information. Max 4 characters <STRING> (default: "")
* 3: Is mounted radio removable <BOOLEAN> (default: false)
* 4: Access - Determines who can use the rack <ARRAY> (default: ["inside"])
* 5: Disabled positions - Blacklist rack use positions <ARRAY> (default: [])
* 6: Base classname of the mounted radio (Without ID). Empty string for no radio <STRING> (default: "")
* 7: Components <ARRAY> (default: [])
* 8: Connected intercoms <ARRAY> (default: [])
* 2: Force initialisation <BOOL> (default: false)
* 3: Condition called with argument "_unit". If a longer function is given, it should be precompiled. <CODE> (default: {})
*
* Return Value:
* Rack added successfully <BOOL>
*
* Example:
* [cursorTarget, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["external"], [], "ACRE_PRC117F", [], ["intercom_1"]], false] call acre_api_fnc_addRackToVehicle
*
* Public: Yes
*/
as I guessed, it's server only
it says so in the description
Must be executed in the server.
how though so api?
huh?
anyway, since you're putting that in init, this is what you should do to fix it:
if (!isServer) exitWith {};
this spawn {
sleep 1;
[_this, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["inside"], [], "ACRE_PRC77", [], []], true] call acre_api_fnc_addRackToVehicle;
[_this, ["ACRE_VRC103", "Lower Dash", "Dash", false, ["inside"], [], "ACRE_PRC77", [], []], true] call acre_api_fnc_addRackToVehicle
};
not sure if someone can help me,im looking at https://community.bistudio.com/wiki/BIS_fnc_ambientAnim and i want to set some dudes up to have animations,now how would i go about doing it?
Do you know how to run a simple code 101 in the first place?
my holy savior if not for this, i was gona do this
private _ammonameconverter = [["AGM-114A","AGM114A"],["AGM-114C","AGM114C"],["AGM-114M","AGM114M"],["AGM-114N","AGM114N"],["AGM-114L","AGM114L"],["AGM-114K","AGM114K"]];
{
if (_x#0 == _ammoname) then {
_ammoname = _x#1;
};
} foreach _ammonameconverter;
yes it work thank you going to look into wiki to learn
if (!isServer) exitWith {};
this spawn {
sleep 1;
you could just use regex
or splitString
never heard of it
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Read through this one. Guess you can understand this one better than me since I guess you're a native Englishman
this works fine for me
_ammoname = [_ammoname] call BIS_fnc_filterString;
"AGM-114A" splitString "-" joinString ""
or
"AGM-114A" regexReplace ["-", ""]
ah thanks
thank you,jee there is already so much to understand
first line exits the script if it's not running on the server
second line creates a scheduled script, because it needs to run with delay (running 1 second later)
Makes no difference, really
In this context that is
That thing is bit overcomplicated IMO but will do a bit of basics
I meant instead of doing what he intended to do
If you ever end up doing stuff like this, you should use a hashmap for those key-value pairs
For static lookup times
But in this case, either one of Leopard's solutions of the bis function would do best
Good thing you dont need to. The engine does it for you
hashmaps are like a "dictionary"
you look up for a "keyword" and find its "value"
it's very fast for lookup
Read here for juicy hashmap lore
you could convert your array into hashmap very easily:
_ammonameconverter = [["AGM-114A","AGM114A"],["AGM-114C","AGM114C"],["AGM-114M","AGM114M"],["AGM-114N","AGM114N"],["AGM-114L","AGM114L"],["AGM-114K","AGM114K"]];
_ammoMap = createHashmapFromArray _ammonameconverter;
_ammoMap get "AGM-114A"; // returns "AGM114A"
But dont do that in this case. Just int he future, you should know how to use a hashmap
Theyre very handy
i will learn it eventualy when i really need it, thats how i learn
when im desperate
And i dont know who it was who managed to arm wrestle BI to eventually expose them on SQF side, but whoever it was, theyre awesome
the thing with hashmap is that you don't "need" it. you can just use arrays
but in this case if you use it you get much better performance
Read the BIKI like a bible. Page a day and random bits and bobs here and there on the toielt or bus
the intended use is far and few between
iirc you had other scripts where you needed to find something in an array
simply switching to hashmap would give you a huge performance boost
i was using it as part of a script to take a json output from a website, convert it to usable info, then use that to set the pylons and vehicle settings
il look into that
ended up a pretty beffy script

