#arma3_scripting

1 messages Β· Page 758 of 1

proven silo
#

how would I use this? I have this in my init for the independent players. ```sqf
if (side player == GUERRILA) then {
[] execVM "test.sqf";
};

quasi rover
#

thanks. I'll look into it.

fair drum
#

i can help more after this HLL match

proven silo
#

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

loud ginkgo
#

anyone have any good resources for extDB3? cant find any good documentation.

hallow mortar
little raptor
#

what he's written is better

dusky wolf
#

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?

solid ocean
#

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?

warm hedge
#

setMass

solid ocean
#

ive search the biki

#

but cant make heads or tails

warm hedge
#

Heads? Tails? What are you talking about, center of mass?

winter rose
solid ocean
#

means i didnt undestand the biki

warm hedge
#

Fair

solid ocean
warm hedge
#

What's unclear?

ivory lake
solid ocean
#

the numbers what do they mean

#

excellent thank you

ivory lake
#

theyre supposedly KG

#

or atleast.. ive been treating it as such

winter rose
#

nope
they are "arma weight/size unit" iirc

#

but you can get a general idea with getMass'ing many vehicles

warm hedge
#

Whatever it is, 0 = 0, 1 = 1, 1000 = 1000

solid ocean
#

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

warm hedge
#

You better to test it first, you can worry about it later

noble zealot
#

There is a distance limit for terrainIntersect and terrainIntersectASL functions? BIKI says nothing about that.

granite sky
#

I would expect not, but longer distance is likely to have worse performance.

winter rose
finite bone
#

Apologies, moved to the correct forum

white moth
#

Guys quick question is it possible to make a fly by wire in arma?
like mouse aim from war thunder

hollow thistle
#

Fly by fire for what? Ammo can be configured as such without any scripting.

warm hedge
#

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

hollow thistle
#

Ah he meant planes, I thought about wire guided missiles like TOW meowsweats

white moth
#

i see, thanks for the quick reply πŸ˜„

steel fox
white moth
steel fox
# white moth plane

Doesn't Arma already support that? Same way you can steer your car with mouse.

white moth
south gale
#

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;}];

south gale
#

This isnt the channel to discuss this as this isnt something you could script anyways

pliant stream
#

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

brazen lagoon
#

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

nocturne garden
#

Vector difference

#

Would be the System

sudden yacht
#

[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?

granite sky
#

@south gale Is this for singleplayer, localhost or a dedicated server?

granite sky
#

assignCurator is server-only, so normally you have to do:

[player, myCurator] remoteExec ["assignCurator", 2]
brazen lagoon
#

@little raptor ah can you not? then it's doa ye

south gale
steel fox
tranquil jasper
#

I keep typing nil in my code at work lol

finite bone
#

Similar to how ACE has 'bodyparts' for humans, is there a method to add ace damage to vehicles (Air, Water, and Land)?

fair drum
#

ACE uses the base game's hit index / selection system

finite bone
#

Is there a global list of hitpoints available somewhere?

fair drum
#

its based on vehicle config

finite bone
#

Oh ok thanks!

vast kayak
#

hello, I have a question. How do i use a trigger to detect if an item is placed into a box?

brazen lagoon
#

is there any way to determine if a variable is "any"?

brazen lagoon
#

I wasn't sure if that worked for any

#

cool, thanks

little raptor
#

e.g the return value of call, or arg of params

finite bone
copper raven
finite bone
#

Damn, ok thanks!

copper raven
cold pebble
#

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

finite bone
cold pebble
jade acorn
#

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

granite sky
#

With selectPlayer, the player is now the new unit, so isPlayer on the old unit will return false.

little raptor
tepid vigil
#

Is there a command that can take attachments off of weapons?

crude vigil
# finite bone Are there any documentation available for making a menu that lets you select 'op...

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.

finite bone
#

As of now, I just made 8 functions with 8 separate SQF πŸ˜„

crude vigil
# finite bone Perfect thanks!

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)

finite bone
#

How do I check if any player has thrown a grenade/smoke shell and then subsequently execute an sqf without disturbing my other scripts?

tranquil jasper
#

"throw" event handler

finite bone
#
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?
tranquil jasper
#

sorry it's "fired" event handler

#

I had to go searching through my old code to see how I did this long ago

#

It looks like the second parameter (_this # 1) equals "Throw"

finite bone
#

Thanks! Also @tranquil jasper, how do I ensure this is run in the background for each player locally instead of server?

tranquil jasper
#

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"
winter rose
#

gniiiiii!

tranquil jasper
#

After that, well, it just depends on what your code does, to determine how to make sure it only runs locally

open fractal
#

private ["_throwable"]; _throwable = _this select 6; _shooter = _this select 0;
I don't know why this upsets me so much

tranquil jasper
#

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)

open fractal
#

params my beloved

crude vigil
# open fractal `params` my beloved

I hate it when people use params only to define like one or two things from a 6 7 elements array meowtrash 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?"

open fractal
#

hmmmm you're weird πŸ’―

#

i just slap the params array in there and call it a day

crude vigil
tranquil jasper
#

Mistakes have already been made by this point, but it could cause readability problems if you have very long code (goes off the screen)

crude vigil
#

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. blobdoggoshruggoogly

#

then they dont understand what params actually do then forget it sometimes and ask "wait, isnt it called _shooter, why doesnt it work?"

winter rose
crude vigil
winter rose
#

ez```sqf
params ["_unit", "", "", "", "", "", "_otherStuff", ""];

crude vigil
#

Afaik, it is worse performance wise as well (using this card I really dont care at all for minor cases meowtrash )

winter rose
#

I thought on the contrary that it drops var/value assignation and therefore noicer

#

look
I'm green
you're white
I win

#

πŸ˜„

crude vigil
#

but but...

tranquil jasper
#

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

winter rose
#

let's wait for Dedmen to tell us πŸ™‚

crude vigil
#

Of course it really depends on what sort of things you work on as well as your practices in general

winter rose
#

then you can use```sqf
params ["", "", "", "", "", "", "_otherStuff", ""];

tranquil jasper
crude vigil
#

Not gonna lie though, sometimes my code ends up having _this select X spams cos I just define what Im about to use. meowtrash

tranquil jasper
#

switch to # to scare noobs away

crude vigil
#

I tried

#

Im just too used to it to change it. I dont write as much as I used to anymore anyways.

winter rose
#

all this to get paddlin'

tranquil jasper
#

take a 6 year break like me heheheh

#

last time I did scripting I didn't know about # and now I cant get enough

crude vigil
winter rose
tranquil jasper
#

eh, the forum has rep now, so it's not a total loss 🀣 still have your rep

crude vigil
tranquil jasper
#

it's pretty fun answering people's questions sometimes ngl

crude vigil
#

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.

tranquil jasper
#

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

crude vigil
#

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

tranquil jasper
#

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

crude vigil
#

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 blobdoggoshruggoogly

tranquil jasper
#

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

crude vigil
#

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. 😁

tranquil jasper
#

Hmm, I was thinking that he made far too many edits for 1 person...crowdsourced knowledge...genius

winter rose
#

we are millions

crude vigil
#

Thats his evil plans, to take credits for all. meowtrash πŸ˜›

tranquil jasper
#

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

crude vigil
#

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!

tranquil jasper
#

^ 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 πŸ˜’

crude vigil
#

In my case, it is Lou's concern. meowtrash

tranquil jasper
#

well back then I figured more people editing means more info, even if my stuff needs a little housekeeping heheh

finite bone
#

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.

tranquil jasper
#

a guy can dream lol

#

problem is theres like 8 games using sqf, so probably a bit much for 1 guy

finite bone
#

But the next game is C# (or a hybrid of this) and not SQF as per their official release info/statements.

open fractal
#

and we will be seeing enfusion tools soon

winter rose
open fractal
#

certified Lou moment Lou

hallow mortar
#

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.

winter rose
#

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!

open fractal
#

Real virtuality is aged like fine spaghetti, a delicacy among the green and blue people of the discord

hallow mortar
#

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.

north leaf
#

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

granite sky
#

There is this. MIght be useful:

if (_mass != 0) then {
    [QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // force global sync
};
finite bone
#

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.)! pepe_Hype

tranquil jasper
#

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

halcyon arrow
#

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

little raptor
little raptor
tranquil jasper
#

Ah, I came up with a similar solution, teleport the unit 3 meters up and let him drop haha

finite bone
#

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.

drifting portal
#

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

granite sky
#

You really should use indentation.

drifting portal
#

added a comment at the top to explain the variables

drifting portal
granite sky
#

Have you ever read anyone else's code? :P

drifting portal
#

I was doing this hastily

#

kind of a test

#

proof of concept

drifting portal
drifting portal
#

got it fixed thanks

cursive hazel
#

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.

vast kayak
#

how do you set up a boundary around your mission to contain the players - kill them if they leave an area?

cursive hazel
#

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.

cursive hazel
granite sky
cursive hazel
#

So is it then the [itemEnable] that acts as "expression"?

granite sky
#

BIS_fnc_createMenu might pass through visible/active info as specified there but it's not clear from the description.

cursive hazel
#

Because I already use showCommandingMenu to display the BIS_FNC_createmenu menu.

granite sky
#

seems like it's easier to just make your own array tbh :P

cursive hazel
#

How does that work?
I've only used the function.

granite sky
#

There's some pretty good user documentation in showCommandingMenu

cursive hazel
#

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! garfdisgust

cursive hazel
cursive hazel
#

Uh . . . ?

#

So. No?

sharp grotto
cursive hazel
#

Okay. Good to know. garfsmile

winter rose
kindred zephyr
#

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?
lapis ivy
#

Does the event handler check the action every second? Or how does it work? Will it load the server?

kindred zephyr
still forum
#

when a action happens, it checks if there are eventhandlers present

#

not other way around

winter rose
kindred zephyr
lapis ivy
#

Is there an eventHandler for taking off the uniform?

#

Or some other way that will help track if the uniform has been removed.

granite sky
#

inventoryClosed might be good enough, depending on what you're trying to do.

lapis ivy
#

I just need to be banned from taking off my uniform.

little raptor
#

Well you can use the Put EH

granite sky
#

Now wondering whether Put triggers if you put your uniform inside your backpack :P

#

Sounds like it will from the hint about magazines.

finite bone
steel fox
finite bone
#

Zeus

steel fox
#

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?

finite bone
#

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.

indigo wolf
#

Hi! How do I execute initPlayerLocal.sqf when run inside an addon in a dedicated server?

finite bone
# indigo wolf Hi! How do I execute initPlayerLocal.sqf when run inside an addon in a dedicated...

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.

indigo wolf
#

thx

copper imp
#

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.

finite bone
copper imp
finite bone
#

Use a trigger, set the timeout conditions and sync it with the module.

copper imp
#

Alright, thanks

wind flax
#

Is there a way to detect ambient light (from street lights, or light bulbs)?

brazen lagoon
#

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?

little raptor
little raptor
brazen lagoon
#

oh ok. what commands?

little raptor
#

How are you gonna check for a door?

#

You need something like nearestObjects

brazen lagoon
#

I thought you could access everything in intercept so I thought it would be much faster

little raptor
#

You can, but they're still sqf, and the cost of a command is roughly the same no matter where you execute it

brazen lagoon
#

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.

little raptor
#

Still slow

brazen lagoon
#

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

little raptor
brazen lagoon
#

what do you mean where you run it?

little raptor
#

If you only expect to have like 5~10 AIs it could work

little raptor
brazen lagoon
#

hmm i would have guessed short raycasts would be relatively performant because you don't need to consider everything far away

#

but fair enough

little raptor
#

What I said was for only a few objects in the way

#

You can try it yourself if you want

brazen lagoon
#

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

little raptor
#

And try it on yourself

brazen lagoon
#

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?

little raptor
#

But anyway yeah

brazen lagoon
#

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?

little raptor
#

but anyway that's not in your control

brazen lagoon
#

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

little raptor
#

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... blobdoggoshruggoogly

#

except for rewriting the AI πŸ˜›

dusky wolf
#

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

granite sky
#

Huh. Command looks broken-by-design.

dusky wolf
#

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

winter rose
#

you could use a customChat?

dusky wolf
#

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

open fractal
dusky wolf
#

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

open fractal
#

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

wary python
#

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?

finite bone
#

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?

open fractal
#

or ```sqf
forEach ((_entity nearEntities [["CAManBase"],25]) - ["VirtualCurator_F"])

open fractal
#

doesn’t work with strings?

little raptor
#

so ofc nothing will be removed

open fractal
#

you’re right

#

for some reason I had the idea that it was strings

little raptor
open fractal
#

that I did

little raptor
#

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 thonk

little raptor
#

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...

open fractal
#

yeah array of objects rather than classnames

#

L + ratio for me

finite bone
open fractal
finite bone
#

oh yea that should work

finite bone
little raptor
#

CAManBase has nothing to do with VirtualCurator_F

#

I blame @open fractal

open fractal
#

I am a criminal getreal

little raptor
#

but like I said objects that are CAManBase (men) are never VirtualCurator_F (a module) so it never removes anything

little raptor
#

but anyway if it is then it works

finite bone
#

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

open fractal
#

I think that’s what tripped me up, VirtualCurator_F is a classname and it was apparently in the list

#

but nothing is real getreal

finite bone
#

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.

still forum
still forum
cursive hazel
#

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?

steel fox
#

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.

cursive hazel
#

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.

steel fox
#

Any files in mission folder are present on all machines.

cursive hazel
#

So any call or spawn's that happen on other clients always have access to files in mission folder?

steel fox
#

call simple executes code on the client as if it was done locally and spawn schedules it. Nothing special about it.

cursive hazel
#

garfsmug That's good. I was getting worried with Lou Montana's answer. garfspin

steel fox
#

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.

cursive hazel
#

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.

steel fox
#

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.

cursive hazel
#

Got more questions! garfsmile
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?

pulsar bluff
#

in editor or multiplayer?

cursive hazel
#

Editor.

#

But I wish it to work in MP too.

winter rose
cursive hazel
#

Inside mission.

winter rose
#

some animations weirdly don't work on players, only AI

cursive hazel
#

Whuh. garfhuh

finite bone
#

is it possible to have a condition inside selectRandom ?

cursive hazel
#

The syntax for selectRandom is only an array.

#

Conditions/ logic has to be made around it.

finite bone
#

for example something similar to _myrandom = selectRandom _list_of_items but I don't want to it to select a specific type of class.

winter rose
#
selectRandom ([1,2,3,4,5,6,7,8] select { _x > 5 });
finite bone
#

ah I was searching for 'where'

cursive hazel
#

Can the player be disconnected from the unit (but keep the camera), then play animation, then reset player?
How would one go about that?

winter rose
#

some awful selectPlayer/switchCamera mess I would guess

cursive hazel
#

Can the player be assigned a null unit or something?
Perhaps a logic unit can suffice.

winter rose
#

selectNoPlayer

#

but before that, try switchMove without any mods and from the Debug Console:

0.5 spawn {
  sleep _this;
  player switchMove "TheAnimation";
};
cursive hazel
ebon citrus
winter rose
#

selectPlayer objNull may then

cursive hazel
calm charm
winter rose
cursive hazel
cursive hazel
calm charm
cursive hazel
#

Ah. Did not read them then.

ebon citrus
#

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?

granite sky
#

I think they're referring to onKeyDown where you can return true to override the default action.

ebon citrus
#

but youi cant override onmousebuttondown?

granite sky
#

If you can then it's not documented.

cursive hazel
#

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.

ebon citrus
#

no, i mean overriding base-game functions

exotic tinsel
#

is there a function for getting the enemy side of a given unit?

winter rose
ebon citrus
#

can i override onmousebuttondown?

#

actually, no, that's a silly idea since we dont even get LBclicked

ebon citrus
#

why do we get LBdblclicked but no LBclicked?

winter rose
#

most likely because reasons πŸ˜„

ebon citrus
tender fossil
#

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)

winter rose
tender fossil
winter rose
#

so yeah, you have an issue somewhere else πŸ™‚

granite sky
#

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.

tender fossil
tender fossil
# winter rose so yeah, you have an issue somewhere else πŸ™‚

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

winter rose
#

the addAction itself is not the issue, there might be missing ; or some invisible character (Β ) there

granite sky
#

The third addAction there has fourth parameter (priority) missing.

#

It's complaining about the sixth parameter, which is supposed to be the seventh.

granite sky
#

I guess Arma 2 doesn't have sort...

granite sky
#

or deleteAt :D

#

Apparently I'm spoiled by A3.

winter rose
#

oh yes, Arma 3 spoiled us all πŸ₯°

tender fossil
#

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

winter rose
#

Error distance: Type String

#

either _current or _object is a String

tender fossil
#

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)

granite sky
#

Break it down and check your assumptions. diag_log spam if you have to.

tender fossil
#

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" πŸ˜„

open fractal
#

why do that when I can spend hours on trial and error

still forum
#

Or just attach a debugger and step through :poutcat:

winter rose
still forum
#

:poutcat:

#

It could if I had more time 🀣

winter rose
tender fossil
ivory locust
#

why isn't my task showing up on the player's HUD as a waypoint

winter rose
#

cuz something is wrong

tepid vigil
#
{
                                _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?

winter rose
#

yeah, _currentVal # 1 might not exist

tepid vigil
#

How does forEach run code for something that doesn't exist meowhuh

winter rose
#

oh wait, I misread (and I'm tired too)

#

wait no, if a value of this is nil

tepid vigil
#

Adding a check if (isNil "_x") exitWith {} makes the error disappear but then it doesn't function properly anymore

winter rose
#

then { continue }

tepid vigil
winter rose
tepid vigil
#

Oh, right... I guess I am tired as well...

tough abyss
#

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

granite sky
#

@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.

tough abyss
#

Yeah I saw that but I thought it was more internal
I will make some tests

granite sky
#

If you want to do a lot of stuff in ACE you have to use internal functionality :P

tough abyss
#

Ok ^^ I will check that, thanks man

ivory locust
#

why doesn't this show a 3d hud waypoint like in official scenarios

#

it's on a custom map if that matters

ivory locust
#

it's a game logic flag

#

the marker shows up on the map just not on the player's hud

#

task is assigned properly

winter rose
#

(also, _marker is useless here)

winter rose
ivory locust
#

thank you wise arma guru

#

why is marker useless

winter rose
#

_marker = getPosATL _objLocation; does nothing

ivory locust
#

because there's no parenthesis?

#

what do you mean

winter rose
#

I mean, the _marker variable is not used

ivory locust
#

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

winter rose
#

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"

ivory locust
#

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

coarse dragon
#

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

crisp jacinth
#

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

ebon citrus
#

is the defaultValue value of getVariable interpreted in case of script?

still forum
#

You know how SQF works right?

ebon citrus
#

not always

still forum
#

The array is built, before getVariable gets called

ebon citrus
#

right, so if i have a script there, it runs

#

even if the default value is not returned

still forum
#

same as if you'd remove the getVariable and just write [a,b,c]

ebon citrus
#

what i want is to do something like thisd

#
player getVariable["goKart", "goKartClass" createVehicle position player]```
still forum
#

just use objNull as default

#

and check isNull on the returned value

ebon citrus
#

can do, i was just asking if that's possible

still forum
#

don't know a easier way

still forum
#

well it will always spawn

#

as I explained above

ebon citrus
#

right

still forum
#

which i don't think is what you want

ebon citrus
#

nope

#

yep, that answers my question

#

thank you ❀️

little raptor
tough abyss
#

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

little raptor
tough abyss
#

Does it support transparency/alpha channel?

little raptor
#

Dunno never tried it

tough abyss
#

Trying to find a better way to do animated blood pools

little raptor
#

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

little raptor
#

Tho that'll probably look weird...

open fractal
#

would there be too much network traffic from looping setobjectscale on multiple objects or would that not be an issue?

tough abyss
#

Oh yeah, I have blood flowing animations, scaling one texture/object would look awkward

#

Like those oldschool blood pools from the old GTAs

open fractal
#

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?

open fractal
#

setObjectScale is global effect

little raptor
#

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 notlikemeow

open fractal
#

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

tough abyss
#

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

open fractal
#

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 :)

tough abyss
#

What I’m curious about is what the global effect would be if trying to scale an object local to a client?

open fractal
#

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

tough abyss
#

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

open fractal
#

can you tag me if you find out how it works

tough abyss
#

Sure, but I don’t plan on testing this out tonight πŸ˜‚

#

Just found it interesting

little raptor
little raptor
versed belfry
#

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 ^_^]

little raptor
#

hideObject disables collision too

versed belfry
little raptor
versed belfry
#

Just a normal arma 3 unit

#

CSAT Rifleman for example

little raptor
#

it's hidden

versed belfry
#

And it takes bullet damage?

little raptor
#

yes

versed belfry
#

πŸ‘

#

Cheers for the help

versed belfry
#

Explosions can damage it but not bullets sadly.

little raptor
versed belfry
#

But I need something that is both invisible and can take bullet damage.

#

Or at least register that a bullet went through it

little raptor
#

it doesn't have to be something special

#

you can just make a cube

versed belfry
little raptor
#

you can leave other LODs empty

versed belfry
#

by figure out I mean the whole object editor thing xD

#

But thanks a lot for the help so far

little raptor
versed belfry
little raptor
#

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

versed belfry
little raptor
versed belfry
little raptor
#

at the very least the head will be visible

#

probably the hands too

little raptor
#

it becomes fully hidden

versed belfry
fringe ingot
#

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?

tough abyss
#

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

warm hedge
#

You can just use setCombatMode and setBehaviour after the spawn

tough abyss
#

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

warm hedge
#

Every scripts are predetermined?

#

I don't really understand what

manually entering it every time I spawn an opfor aircraft
you mean

tough abyss
#

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

warm hedge
#

Well I have no idea how you did execute the script

tough abyss
#

I usually use MCC or zues to spawn enemies

#

If that makes this make more sense

warm hedge
#

It does. But I never used MCC so...

tough abyss
#

You ought to give it a try sometime. Makes occupying towns with enemies super fast

#

And they generate their own waypoints and all that

hallow mortar
#

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?

tough abyss
#

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

winter rose
jade acorn
#

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)

steel fox
# fringe ingot quick question for those ace aficionados, I currently have a functioning ace int...

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.

real epoch
#

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?

winter rose
granite sky
#

I think the physX scenery objects are "thingX"

#

ammo crates and such

exotic yarrow
#

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.

real epoch
# winter rose try checking its simulation yes

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.

real epoch
granite sky
#

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

real epoch
winter rose
open fractal
tepid vigil
#

Is BIS_fnc_buildingPositions obsolete with buildingPos with an index of -1?

granite sky
#

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.

coarse dragon
#

How tricky would it be to do a Cinematic that pans around where a battle is happening. With txt explaining what's happening

coarse dragon
#

Wouldn't happen to know of a guide on how to do it?

ebon citrus
#

Mill around here a bit

#

Then you should look at either cuttext, titlecut or any of the other bis functions

coarse dragon
#

😬

#

You said it would be easy πŸ˜΅β€πŸ’«

exotic yarrow
#

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);
};
little raptor
exotic yarrow
little raptor
#

modelToWorld is wrong too

#

You must use abs coords. i.e. ASL ones

exotic yarrow
#

Ok will try

coarse dragon
#

Is there a way to Eject the troops from a helicopter when the helo lands.

granite sky
#

@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.

coarse dragon
#

Yea but it's slow

granite sky
#

normal

#

If you want them to get out any faster then you have to abuse moveOut.

coarse dragon
#

Need faster especially for a chinok

granite sky
#

In general, AI units will disembark slowly, one at a time.

coarse dragon
#

Yea that be the problem notlikemeow

#

There's a eject action

little raptor
coarse dragon
#

Looks complex

little raptor
#

And the eject action is simple? thonk

coarse dragon
#

Yea

#

unitΒ action ["eject",Β vehicle]

open fractal
#

you can also use setPosATL on the units if you want to move them out instantly

little raptor
little raptor
open fractal
coarse dragon
#

The example looks more complex than that

open fractal
#

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

copper raven
#

otherwise it does nothing

#

(just use moveOut)

open fractal
#

(i agree)

copper raven
#

you can do [_unit, getPosATL player] remoteExec ["setPosATL", _unit]

#

then moveOut is not needed

copper raven
open fractal
#

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;
copper raven
#

no

winter rose
#

agrrrrrr Γ¨_Γ©

open fractal
#

he has been summoned

ruby bronze
#

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?

winter rose
ruby bronze
#

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.

coarse dragon
#

Get eden enhanced you can change the trait in the units settings @ruby bronze

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)

ruby bronze
#

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?

cosmic lichen
#

Just set it on the respawn event

ruby bronze
#

Would that be through onPlayerRespawn.sqf?

cosmic lichen
#

yes

#

Or event handler

ruby bronze
#

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

cosmic lichen
#

yes

ruby bronze
#

Cool, I'll give that a try

#

Thank you, and thanks Lou and skullbits for info as well

ruby bronze
#

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];};```
finite bone
#

so it would be sqf if (role == "Medic") then {player setUnitTrait ["Medic", true];};

ruby bronze
#

Thank you for catching that, I will test it on my dedicated server and report back

finite bone
#

You also need to add a unit to set the trait

ruby bronze
#

I had a feeling I should have added "player" haha, thanks

ruby bronze
#

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

steel fox
noble zealot
#

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.

tropic mirage
#

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?

pulsar bluff
#

give it a go

#

try yourself first and will help tomorrow

tropic mirage
#

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";

    };
};
pulsar bluff
#

nice!

tropic mirage
#

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

pulsar bluff
#

i use the animation event handlers to detect when the animation is complete

tropic mirage
ruby bronze
steel fox
#

You are try to set a unit to the medical trait right? What is the full document/code?

ruby bronze
#

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

tropic mirage
#

longshot but yeh

little raptor
little raptor
tropic mirage
#

Whats the difference between uiSleep and sleep? Im trying out new functions

little raptor
#

uiSleep doesn't wait when the game is paused
And doesn't accelerate when the game's accelerated

little raptor
tropic mirage
little raptor
# tropic mirage right I realised I should rephrase. So I am trying to run a script where it heal...

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?

radiant siren
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
tropic mirage
little raptor
#

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

rancid nacelle
#

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.

open fractal
#

you can put this in the init

rancid nacelle
#

Alright, thank you very much!

open fractal
#

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

rancid nacelle
#

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?

little raptor
rancid nacelle
#

Group being a rifleman squad?

#

Not the singular unit within that squad?

little raptor
#

yes

rancid nacelle
#

Alright.

little raptor
#

if you want to do it on the group you should use:

{
  _x disableAI "PATH"
} forEach units this
rancid nacelle
#

Gotcha.

#

Thanks, been quite stuck on that. I kept using it on the squad level lol.

agile pumice
#

can setObjectTexture be done for headgear or no?

warm hedge
#

No

agile pumice
#

I feared that would be the answer

finite bone
#

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.

dusky wolf
#

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

finite bone
#

I've been trying to understand how to create one by reverse pbo'ing other mods from the workshop and its still difficult blobsweat

little raptor
#

actually nvm. that doesn't take the object

#

I'm pretty sure there was one tho thonk

dusky wolf
dusky wolf
#

Pretty sure that is it

#

Still isn't easy, but it's something

finite bone
#

Well thats a good starting point. Better than nothing so thanks πŸ‘

tough abyss
#

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];

little raptor
tough abyss
#

thats funny my hpp to sqf converter converted it differently than when ive used it earlier

exotic yarrow
#

nvm, atan2

little raptor
normal garden
#

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"; ```
winter rose
normal garden
#

quoted it in the script, i think it doesn't recognise _newpos as an array

winter rose
#

what is marker1?

normal garden
#

gameLogic

#

The code worked fine until I tried to create the marker _respawneast

winter rose
#

systemChat its value to be sure

normal garden
#

systemChat (format ["%1",_ma1]) ?

#

Like this?

#

It displayed array

winter rose
#

str _value
but I thought your issue was with another variable

#

you are mixing _ma1 and _newpos

#

also

#

!quote 5

lyric schoonerBOT
normal garden
#

str_value displayed any for _newpos and _ma1

normal garden
lyric schoonerBOT
winter rose
normal garden
#

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! :))

little raptor
hallow mortar
#

I don't see why getPosATL wouldn't work on a game logic

normal garden
normal garden
little raptor
#

I thought you meant discord thread πŸ˜…

normal garden
#

Oh no sorry, I posted a thread on the forums

coarse dragon
#

Would switch player work with a trigger that detects when Opforce isn't present

coarse dragon
#

Sweet

pulsar bluff
#

I think there is if the Shooter is local

sullen sigil
#

hey folks, is there any way to make people spawn at one of six positions from the same respawn module position?

open fractal
#

what?

sullen sigil
#

one module

#

multiple positions people can spawn in at if they use that respawn module

coarse dragon
#

Yea. Use empty markers and stuff

sullen sigil
#

que

coarse dragon
#

Wot?

sullen sigil
#

how does that work

coarse dragon
#

I have no idea

sullen sigil
#

figured it out but doesnt work because of how enclosed the spaces are

#

ty anyways

#

(use multiple respawn_west markers)

halcyon arrow
#

just wondering peoples opinion, is it fine if i just use @Enhanced Movement or should I also uise @Enhanced Movement Rework

coarse dragon
#

Doesn't rework require the 1st one?

buoyant abyss
#

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

halcyon arrow
coarse dragon
#

!Alive goes into conditions?

frank mango
coarse dragon
#

Ace.. I didn't enjoy that mod at all notlikemeow

frank mango
frank mango
coarse dragon
#

Yea the guy who asked about the
!Alive thing. Will know how to edit a mod πŸ˜‚

tough abyss
#

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.

graceful kelp
#

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 -

tough abyss
#

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

open fractal
#

what got you back into bloodlust? i remember your mod from years ago

tough abyss
open fractal
#

always cool to see older projects get revived

#

time for the existential dread with 2017 being 5 years ago

trim tree
#

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?

tough abyss
#

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);
still forum
#

simple, you don't

tough abyss
#

lol thanks

still forum
#

local variables are local, they are not visible outside the scope

#

but you can make them not local

tranquil jasper
#

what you're trying to do specifically defeats the purpose of a local variable

still forum
#

if you make them global, you can access them

tough abyss
#

thats what I thought.

still forum
#

if you have multiple of these, you could put them all into a global variable as an array

tough abyss
#

yeppers, dread put me on the right path there.

tranquil jasper
#

nah forget global, you have a switch so do this:

private "_vehicle";
switch {whatever} do {
  case 0: {
    //etc
  };
}
tough abyss
#

just wanted to make sure I wasn't missing something. Thanks guys!

finite bone
#

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?

granite sky
#

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.

dusky wolf
#

Anybody know if it is possible to force an item into a uniform or vest even if there isn't room for it?

granite sky
#

addItemToUniform doesn't work?

#

I imagine you can get the container and then use the container adding functions if not.

warm hedge
#

I recall there's a command to enlarge/vice versa container size. Wonder what it was

granite sky
#

I'm fairly sure you can overstuff with the container-adding functions anyway.

warm hedge
#

setMaxLoad yes

dusky wolf
warm hedge
#

I think I know the goal but unfortunately it needs to check for the space

granite sky
#

try (uniformContainer player) addItemCargoGlobal [whatever]

dusky wolf
#

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

warm hedge
#

It was added very recently

dusky wolf
#

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

warm hedge
#

Think you'll need to use carefully if is for MP, BIKI suggests so

ebon citrus
ebon citrus
#

by default, filterString only allows for A-Z, a-z, 0-9 and _

tough abyss
#

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
warm hedge
#

What is this in this context?

tough abyss
#

Acre setting vehicle rack for vehicle. It worked when I self hosted failed on the server side

warm hedge
#

I asked about this I mean

#

The vehicle?

tough abyss
#

yes

warm hedge
#

And this is Init of the vehicle?

tough abyss
#

yes

little raptor
#

the most accurate one for what you want would be FIRE

warm hedge
#

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?

little raptor
tough abyss
#

idk yet fully I'm just digging around trying to find a way to set all vehicles with a specific rack

little raptor
tough abyss
#

no

little raptor
#

add a bit of sleep then

tough abyss
#

it works my side just not server side

little raptor
#

you're putting that in init, so it runs for everybody

#

it doesn't look like it's client side

tough abyss
#

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
 */
little raptor
#

it says so in the description

#

Must be executed in the server.

tough abyss
#

how though so api?

little raptor
#

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
};
sullen latch
warm hedge
#

Do you know how to run a simple code 101 in the first place?

sullen latch
#

never ran a code in arma

#

like at all

graceful kelp
tough abyss
little raptor
#

or splitString

graceful kelp
#

never heard of it

warm hedge
graceful kelp
#

this works fine for me

_ammoname = [_ammoname] call BIS_fnc_filterString;
little raptor
graceful kelp
#

ah thanks

sullen latch
little raptor
ebon citrus
#

In this context that is

warm hedge
little raptor
ebon citrus
#

For static lookup times

graceful kelp
#

someone did recommend that

#

but i dont know the first thing about hashmaps

ebon citrus
#

But in this case, either one of Leopard's solutions of the bis function would do best

ebon citrus
little raptor
ebon citrus
little raptor
#

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"
ebon citrus
#

But dont do that in this case. Just int he future, you should know how to use a hashmap

#

Theyre very handy

graceful kelp
#

i will learn it eventualy when i really need it, thats how i learn

#

when im desperate

ebon citrus
#

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

little raptor
ebon citrus
graceful kelp
ebon citrus
#

Depends on what youre doing

little raptor
#

simply switching to hashmap would give you a huge performance boost

graceful kelp
#

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

graceful kelp
#

ended up a pretty beffy script

ebon citrus
#

Hahaha, that's pretty funny

#

I think the funniest thing i did was make a replica of my room in arma, have a camera in my ceiling trcak when my cat entered and left my room and track it's position and heading and move a simple cat object along with it in arma