#arma3_scripting

1 messages Β· Page 35 of 1

jade acorn
#

you have your answer then, biki is your friend

boreal parcel
#

what is QGVAR()?

#include "script_component.hpp"

params ["_source", "_url"];

private _ret = "";

private _existing = _source getVariable [QGVAR(active), []];
if !(_existing isEqualTo []) then {
    if ((_existing select 1) isEqualTo _url) then {
        _ret = _existing select 0;
    } else {
        [QGVAR(stop), [_existing select 0]] call CBA_fnc_globalEvent;
    };
};
granite sky
#

If you follow the #include chain for long enough you'll get to it

#

Q means quote, GVAR means TAG_x more or less.

#

where TAG is PREFIX_COMPONENT

boreal parcel
#

hmm alright, im following it then. I am trying to "fix" the Live Radio mod so that the radio stops playing when players leave the server lol so I am trying to see how this mod works first

granite sky
#

typically script_component.hpp has COMPONENT defined and script_mod.hpp has PREFIX

#

The actual defines like QGVAR are a couple of levels deeper

boreal parcel
#

gotcha, I am mostly looking for these active and stop functions then

granite sky
#

They're vars, not functions.

boreal parcel
#

right

#

my bad

granite sky
#

globalEvent is just throwing a string out there and anything can trigger on it.

#

If you're lucky then all the other references are using the same QGVAR(x) define.

boreal parcel
#

hopefully that is so

boreal parcel
#

the script component seems to lead back to a script_mod and script_macros

granite sky
#

One more level. script_macros_common IIRC

boreal parcel
#

im not finding any script_macros_common scripts in this github for the mod, but I am seeing it reference a script_macros_common in CBA

granite sky
#

yeah, it's using the CBA one directly.

radiant siren
#

a way to make this for opfor and blufor? not specific unit but entire side?

jade acorn
#

or ((units side west) + (units side east)) or something like that if you want to cover more sides

radiant siren
jade acorn
#
{
  if ((side _x == BLUFOR) || (side _x == OPFOR)) then 
  {
      _x addEventHandler ["GestureChanged", {
      //rest of your code here
      }; ];
  };
} forEach allUnits;``` seen something like this too
radiant siren
jade acorn
#

just make sure brackets are okay, I might have missed something or added too many of them

wary sandal
#

How do i remove/edit the second tag when using the sideChat command?

#

the first tag is the group name

jade acorn
#

you can't hide unit name from the sidechat and using group ID for names isn't that good either, try using this setName [YourName, Your, Name] in your unit's init instead

wary sandal
#

what else should i use for names?

jade acorn
#

player setName ["Dude Dudowski","Dude","Dudowski"]; works for me thonk

wary sandal
hallow mortar
#

Setting player name doesn't work in MP btw

#

In MP you always have your profile name

#

Also, for sideChat AI unit names don't appear, only their group name, so watch out for that

wary sandal
#

setting a different group name doesn't really bother me

tough abyss
#

Is it possible to animate PAA's on transparent textures?

#

Like the water puddle objects?

copper raven
leaden ibex
#

Hey there, it's me again.

I am trying to create an option for some people to choose their spawn. The way I want to achieve this by adding the same number of spawns to the player action menu.
What I am having trouble with is "remembering" which spawn I chose, as all the vars are no longer available when executing the code inside the addAction

What I have so far

params ["_points"];

[_points] spawn {
    params ["_points"];
    // Not needed when on dedi, but well, I am testing on local
    waitUntil {!isNil "IMF_warmup_state"};

    if (IMF_warmup_state == 2) exitWith {};

    private _ids = [];

    private _spawnLoc = -1;
    private _cntr = 0;
    {
        private _nbr = _cntr;
        private _id = player addAction ["Spawn: " + _x, {_spawnLoc = _nbr}];  // <----- PROBLEM
        _ids pushBack _id;
        _cntr = _cntr + 1;
    } forEach _points;

    // Wait for warmup end
    waitUntil {sleep 0.5; IMF_warmup_state == 2};

    // Teleport
    //hint _spawnLoc;
        
    // Remove the actions
    {
        player removeAction _x;
    } forEach _ids;
};

The _nbr is no longer available when I click in game on the action. How would you tackle this problem? Can't think of anything right now.

copper raven
leaden ibex
copper raven
#

always tag your global variables

leaden ibex
#

I usually do with "IMF" (totally not ilbinek mission framework)
But this variable is player only, no need to make it "global global"

#

I should save it in the player varSpace, if I want to be proper

copper raven
#

whether its a ui namespace, object namespace, mission namespace, always tag. you never know, especially if you run mods

leaden ibex
#

Alright, will do, thanks for the advise.
Yep, mods... Plenty of mods

feral zodiac
#

Anyone know of an exile function that will get helmets from cargo? I was able to get mags, vests, backpacks, weapons using get*****cargo, but I have not been able to find a function for headgear. Any ideas?

tough abyss
#

@feral zodiac Does getItemCargo not work for headgear?

#

could also try just itemCargo

feral zodiac
formal vale
#

#ifdef DEVELOPER
How can I execute the code in this mode

#

thanks

tough abyss
#

Does anyone know if it's possible to animate textures on the puddle BI textures?

tough abyss
still forum
#

if they are in the mission yes, not if they are a serverside mod

valid abyss
still forum
#

make a mod, load it with -servermod start parameter

valid abyss
#

Sounds easy enough

gaunt tendon
#

does

isFlatEmpty

still use the radius of the bounding sphere for surrounding objects?

halcyon temple
#

is this valid?

TAG_forSomething setVariable [{"TAG_" + _var/* string */}, _someOtherVar]
copper raven
#

you're trying to pass code there

halcyon temple
#

right

#

is it possible to construct a variable dynamically?

copper raven
#

not sure what you mean by that

halcyon temple
#

"make" an identifier, instead of explicitly giving a string. Make sense?

copper raven
#

"TAG_" + _var?

halcyon temple
#

nice thx, i'll give it try

#

so the name in ```sqf
varspace setVariable [name, value, public]

may be any string, and this string becomes the identifier?
copper raven
#

not any string, there are some limitations

halcyon temple
#

yes, commands

copper raven
#

for example you can't assign to a command name, or some other "reserved variable"

halcyon temple
#

opfor for example

#

thx

winter rose
#

you can in object namespace iirc, but let's say that's still bad practice

jade acorn
#

they are allowed, but trees are hidden from the 3den editor menu.

#

so you can either use scripts to place hidden objects or get a mod that changes config to re-enable these trees (this makes a dependency tho)

silk ravine
#

WTF is the deal with BIS_fnc_trackMissionTime does it save a specific time value and can delete what ever time will output on the server?

#

Or does it only export time to profileNamespace?

#

Also why profileNamespace if it says missionTime? Shouldn't that be a queriable value from missionNamespace?

south swan
#

looks like it's for tracking the total mission run time across saves/loads or something like that πŸ€·β€β™‚οΈ

silk ravine
#

screw that, I'm gonna build my own function for a queriable missionTime xD

silk ravine
#

I sort of expected, that a queriable value would already exist, Especially in MP environment.

south swan
#
_time = profilenamespace getvariable [VAR_TIME,0];
_timeLoad = missionnamespace getvariable ["BIS_fnc_missionHandlers_time",time];
_timeAdd = time - _timeLoad;
_time = _time + _timeAdd;``` the entire time-related logic of that function
#

"get saved value, add current time, subtract whatever time was spent on loading currently running mission" or something like that

silk ravine
#

that... looks very complicated for something, that is only supposed to do something like this:

// isDedi
missionNamespace setVariable [MISSIONTIME, time, false];
sleep 1;
south swan
#

there's more. From what i see in code it doesn't look working at all πŸ€”

silk ravine
#

ok, in that case I will just stay far away from it πŸ˜‚

south swan
#

because "BIS_fnc_missionHandlers_time" doesn't seem to be set anywhere (it's commented wherever it was before). And if it isn't there - BIS_fnc_trackMissionTime effectively uses time - time πŸ€”

#

seems to always return 0 in my test runs as well

silk ravine
#

thats dividing by zero and will make mommy universe implode like a bubble, so it had to delete itself from the wiki and the devs gave up on retyping it

south swan
#

another day, another broken piece of code found in Arma

winter rose
south swan
#

what i posted. Line 2. "BIS_fnc_missionHandlers_time" isn't set anywhere, so _timeLoad is set to time.
Line 3 is equivalent to _timeAdd = time - time; then.

winter rose
#

yeah it's like "first call of this, define the variable"?

south swan
#

this function doesn't set "BIS_fnc_missionHandlers_time" anywhere, it only nils it on delete

#

the only place i've found that had set "BIS_fnc_missionHandlers_time" before has it commented now

winter rose
#

correct, BIS_fnc_missionHandlers_time vs VAR_TIME indeed

velvet merlin
#

is there a way for force load a specific mission on a dedicated server via sqf / aside from the mission cycle definition?

hallow mortar
#

If the #mission command works with serverCommand, then that

proven charm
#

what's the best way to save player backpack , remove it and then give it back to the player?

proven charm
winter rose
#

oh, I think I did something like that at one point

#

…or use getUnitLoadout/setUnitLoadout 😁

proven charm
#

nice idea

#

bit extreme but nice

#

it works πŸ˜ƒ

hallow mortar
#

Usually just save backpack _unit and backpackItems _unit, then removeBackpack _unit, then addBackpack and addItemToBackpack

velvet merlin
proven charm
hallow mortar
#

neither does getUnitLoadout. In fact, the only way to do that is to use magazinesDetailBackpack and parse the ammo count for each magazine - then you have to use addMagazine to replace them with the correct count, which doesn't allow you to target the backpack specifically

proven charm
#

hmmm setUnitLoadout is restoring the ammo count to at least for the main weapon

hallow mortar
#

Oh, it seems it does, you just have to go into a different page to see where it says that, not the main one

velvet merlin
#

seems #mission[s] can only be done by the admin - not the server 😭

kindred zephyr
hallow mortar
proven charm
#

SP is good, never know about MP

kindred zephyr
#

it works in MP

#

its a global effect set/get pair afterall

hallow mortar
#

my concern is not that it might not work, I know it works, it's that it might cause a brief flash of the unit being naked while the loadout is being changed, which may be undesirable. It might also reset any custom uniform texture applied to the unit.

kindred zephyr
#

the unit doesnt get naked, it just pass from one uniform to another, however textures are reset indeed

dreamy kestrel
#

Q: re: ParticleArray object (18) ...
https://community.bistudio.com/wiki/ParticleArray

Object - If this parameter isn't objNull, the particle source will be attached to the object. The source will stop to generate its particles when the distahce between the object and the source is further than Object View Distance.

We're talking about Object View Distance optimizations here, correct?
It seems that the "#particlesource" object attaches to this object. Check.
But what does this have to do with distances between object and source (i.e. "#particlesource")?
If I simply attach it to a target object i.e. let's say "Land_Wreck_Heli_Attack_01_F", then the player Object View Distance governs whether particles are generated in proximity of that object?
I don't know who wrote that but seems like they got wrapped around that axel somewhat. Besides which the spelling gaffes "distahce "...

hallow mortar
#

Attaching an object can be done at any distance and doesn't necessarily imply that the objects are near each other.
Let's say you have an object view distance of 1600m. You have a reference object, and you place your particle source 1800m away from the reference, and attach it. The particle source is still 1800m away but it's attached. What this says is that since the distance between object and source is larger than the view distance, the source will stop emitting particles. I suspect this is due to simulation stuff. I also suspect this might not be phrased 100% correctly - I think it's probably that if the reference object is outside of your view distance, while the source is inside it, the source won't emit because its simulation is tied to an object that's not being simulated due to being out of range. But you'd want to test that.

dreamy kestrel
#

and which the #ps appears then to move with that object, as would somewhat be expected. but this is not what I think is implied by the verbiage. or perhaps I read that incorrectly.

hallow mortar
dreamy kestrel
#

well, I don't care how it is attached; I am using setParticleParams as my interface, not attachTo. how the engine handles that internally is not my concern. what is, is the confusing verbiage of the object language.

#

again if we're talking Object View Distance, that seems in relation to player, but I do not think that is the intent with object to provide player as the object.

hallow mortar
#

Well, I'm trying to explain the verbiage to you, but it seems like you're not listening.
I also did not say you were using attachTo, nor did I mention attachTo anywhere in my message.

dreamy kestrel
hallow mortar
#

That was a rhetorical question to demonstrate that the behaviour of an attachment created with attachTo is highly likely to be the same as the behaviour of an attachment created with this. Not that it really matters, because my original message never mentioned attachTo and I don't know why you brought it up.

dreamy kestrel
#

okay fair enough, enough about that axel please. still, I think I understand how it works, but player is never mentioned, which is usually in relation to Object View Distance, maybe that should be clarified in the docs. when object#1 is not the same as object#2 for instance.

#

in other words, the #ps tracks with the object, which I should think is exactly what you want. i.e. let's say a snow storm, buffeted snow bank, etc... Arrange the #ps then manipulate the buffet accordingly...

#

the optimization to do with Object View Distance, which is to say distance from buffet to player, in this illustration

hallow mortar
dreamy kestrel
#

so to recap, there are three objects in play there, the #ps particle source, the target object to which that #ps shall be attached (however it got so πŸ˜‰), and player, in relation to which Object View Distance is the question.

dreamy kestrel
#

heck that should be a diagram on the ParticleArray page I think... besides clarifying the verbiage itself.

hallow mortar
#

It shouldn't until it's been tested. At the moment the left half is simply a demonstration of the existing words, which are mildly dubious, and the right half is speculative.

light nimbus
#

I'll wait until you guys're done btw I don't wanna clog your conversation

hallow mortar
#

No no, go ahead

light nimbus
#

really?

#

personally I get anxious when 2 conversations go on simultaneously in the same channel

#

maybe it's just me

#

you guys had it first

#

so i figured I'd be polite

hallow mortar
#

Happens all the time here. I think we were about done anyway.

light nimbus
#

oh sweet

dreamy kestrel
#

I have tested in a couple scenarios. assuming player is object, #ps tracks with player. so it cannot be that scenario. I think the diagram is excellent.

light nimbus
#

lemme check on what you're talking about maybe I can help

#

lol I have no idea πŸ˜…

#

sorry can't help

hallow mortar
#

Go ahead and ask your question. Thanks to the magic of the reply function it'll be possible to keep track even if we're still stuck on the other thing.

dreamy kestrel
#

appreciate your clarity of thought @hallow mortar with the illustration and all. really, that is not what I read in the docs.

hallow mortar
dreamy kestrel
#

literally this is what the docs say, "The source will stop to generate its particles when the distahce between the object and the source is further than Object View Distance." If one of those objects is not player, then what is the point of involving OVD?

#

anyway, the illustration clarifies perfectly.

hallow mortar
#

That's one of the reasons why I think the left scenario (which is what the documentation describes) is not what actually happens.

light nimbus
#

I was told by a modder it is possible to make a script where if my character equips a uniform rigged to a different skeleton, the script can instantly change my character's unit to one with that skeleton so I can equip that uniform and not just become naked and bugged. Is this true? How would I go about this?

#

also he did not provide me said script obviously πŸ˜…

#

and I myself am an absolute noob at scripting

dreamy kestrel
#

I mean if it read simply, "The source will stop generating its particles when the distance between the player and the source is further than Object View Distance." okay sweet perfect.

hallow mortar
dreamy kestrel
#

anyway sorry @light nimbus good luck sir

hallow mortar
light nimbus
#

I'm fine I just didn't wanna bother you guys

dreamy kestrel
#

Sure maybe so, then if it is not relevant, or causing confusion otherwise, then drop it. either way.

dreamy kestrel
hallow mortar
kindred zephyr
#

^^

dreamy kestrel
#

anyway I'm moving on. appreciate the help.

hallow mortar
#

Arma's support for different unit skeletons isn't...extensive, and this is one reason among many why people usually try to avoid doing it.

light nimbus
kindred zephyr
#

if this is either from TIOW or OB mods, you should ask them for specific solutions. us assuming how their units with custom skeleton works basically guarantees breaking their systems if they are running extra stuff

thick oar
#

It used to outright cause a CTD when equipping human skeleton items like vests on other skeletons, but it was fixed. 🀞

hallow mortar
#

Crash to desktop

light nimbus
#

aaah

#

it's for OpTre btw

#

the spartans

brazen lagoon
#

talk to the TIOW guys I think they have a script for just that

hallow mortar
#

I would strongly recommend just having a Spartan unit and a normal unit and keeping them separate. There might be scripts to get around some of the issues but in my view it's not worth the risk of breaking something.

brazen lagoon
#

I would also recommend this

light nimbus
brazen lagoon
#

having tried myself it's not easy

light nimbus
#

but yeah that's what I'm doing for now

brazen lagoon
#

I mean I'm not sure of it but I think they do

light nimbus
#

takes more time and work basically

brazen lagoon
#

yeah what you want is doable but kind of a pain

kindred zephyr
#

alternatively you could take control of the unit with custom skeleton, but that also breaks unit binded systems πŸ€”

granite sky
#

I imagine that's the general principle though. Lots of selectPlayer.

wary sandal
#

player customChat [1, "customChat"];

copper raven
#

did you add the radio channel?

wary sandal
#

isn't 1 (side) already a radio channel?

winter rose
hallow mortar
#

Each base channel has their own command for sending on it (e.g. sideChat). customChat is for sending on custom user-created channels (where you can choose what makes up the sender's callsign) and can't be used to send on base channels.

wary sandal
#

can i get this color? (using BIS_fnc_sideColor)

#

passing west to the function gives a dark blue

light nimbus
#

is there a script to possibly change a unit's faction in game? I hate the idea I may need to create like, 3 spartan units just so the chinese don't shoot me as soon as I get tired of being the dominant faction every single time

#

like, Hetman war stories

#

I spawn a spartan II in zeus then possess him while playing CSAT? They all turn around like I was the guy to crash FTX

south swan
light nimbus
#

@wary sandal godly profile pic btw πŸ˜‚πŸ‘Œ

kindred zephyr
light nimbus
#

in game or in config?

kindred zephyr
#

in game

light nimbus
#

you can do that?!

#

how?!

kindred zephyr
#

i dont use Zeus, but i imagine you can group units to groups just as in the Eden Editor, making them change sides in the process

#

using code you just do:


[yourSpartanUnit] join targetGroup;
#

and thats it, it can become any faction acording to the group to whom you are making the unit join

winter rose
#

Eden allows you to link to an enemy then set their probability to zero (creating the group but not the opfor leader himself)
scripts allow you to join a new group as said above ^ yep

south swan
#

oof, the sheer dirtyness of that hack

winter rose
#

the proba thing? yep πŸ˜„

#

since 2001 \Β©

south swan
#

just deleting the old leader worked for me just now πŸ€”

wary sandal
#

radioChannelCreate takes RGBA values

light nimbus
#

thanks btw

#

BTW

#

i meant btw lol

south swan
#

no, arma configs return whatever they want. This specific entry is array of 3 strings and 1 number that can be converted to rgba array of 4 numbers in the end πŸ€·β€β™‚οΈ

light nimbus
#

πŸ˜…

#

"thanks bye"

#

not what I meant

winter rose
light nimbus
#

πŸ˜†

kindred zephyr
#

LOL

kindred zephyr
light nimbus
#

oh ok cool

halcyon temple
#

any of you use VSCode?

granite sky
#

sadly yes

halcyon temple
#

with SkaceKachna's SQFLint?

granite sky
#

Nope. Is it any good?

halcyon temple
#

I was actually looking answers...

having an issues with sqflint.includePrefixes parameter

halcyon temple
halcyon temple
granite sky
#

Armitxes SQF language. It's not great though.

#

but then I was using editpad before so whatever.

halcyon temple
#

blackfisch has an updated version blackfisch.sqf-language

can't say it is an improvement... some commands are addded

#

what do you guys use? Poseidon/sublime or plain notepad++

wary sandal
#

some detail i have in my mission bothers me, i have some unit set in repair ambient anim with a hammer attached to it (hammer attachTo [unit, [0, 0, 0], "lefthand"]) but the thing is that the hammer only updates at like 15fps unlike the unit which doesn't look all that good

#

do anyone have a clue why it does it? i think i broke it after changing a setting

#

hammer:

fair drum
#

This happens with light points as well when you are on a client. The objects position still needs to sync to where it will be over the network, resulting in choppyness

#

It's smoother if you are the server. Clients it's always choppy. Unfortunately how it works.

wary sandal
#

but then i changed something and broke it

fair drum
wary sandal
#

||also props to you for reading french||

fair drum
#

I don't, I'm just deductive lol

#

Recreate the unit fresh and start over again is the next troubleshooting step

pliant ginkgo
#

Hey, anyone here know if there's a way to end a mission but skip the end screen? so an equivalent of endMission "END1"; but it basically throws you out immediately

fair drum
#

You can create your own ending sequences with it at the end.

pliant ginkgo
#

I'm trying forceEnd but it's not doing anything for me, any special thing you need to set up for it to do anything?

leaden ibex
#

Hello there, is there a way to get classname of a vehicle using SQF?
Let's say a have tank that I can reference in code, but need to get it's classname, so I can properly use findEmptyPosition.
Any ideas?

granite sky
#

If it's an object then just typeOf _vehicle

leaden ibex
#

wonderful, makes sense, thanks!

#

Yep, makes exactly what I needed, thank you!

fair drum
#

I think it's only MP. Verify that for me as I'm away from home.

pliant ginkgo
#

I'm in singleplayer, so that might be it

dreamy kestrel
#

Q: why would I be seeing an error in my particle sources under setParticleParams, shows up repeatedly...

16:26:11 LODShape::Preload: shape '' not found
16:26:11 Warning Message: Cannot open object 
dreamy kestrel
#

working from the fire effects modules, trying to adapt the fire algo

dreamy kestrel
#

initial error in the log is:

16:56:19 Error in expression <ramsRandDirIntensityMeters = 0.02;

_ps setParticleParams [
_fireParticleShape
,>
16:56:19   Error position: <setParticleParams [
_fireParticleShape
,>

which leads me to believe that somehow _ps is null or nil, but I have a debug sent to systemChat that verifies I have both, _ps (#particlesource) and _lp (#lightpoint) are not null.
by contrast, the light point is showing correctly.
also the smoke algorithm is working correctly as well.

hallow mortar
#

It says "shape not found" which suggests to me that something is wrong with _fireParticleShape

dreamy kestrel
#

it is set to ["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32], exactly what was in the fire effects module.

royal spruce
#

is there any way to change the class of an item while retaining its storage (the item is a vest on the ground in my case)

dreamy kestrel
#

on the plus side the PE is trying to generate

hallow mortar
#

It looks like the path you've given should be correct

#

Can I see the full particle array (with the contents of variables) please?

dreamy kestrel
#
_ps setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,50,[0,0,0],[0,0,0.4],0,0.0565,0.05,0.03,[0.9,0],[[0.5,0.5,0.5,-0],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,0]],[1],0.01,0.02,"","",18bfdf0d600# 1780478: wreck_heli_attack_01_f.p3d,5.4,false,-1,[[3,3,3]]];
#

I did find one discrepancy in the _particleLifeTime, but nothing that seemed congruent with the errors:

...
17:58:13 LODShape::Preload: shape '' not found
17:58:13 Warning Message: Cannot open object 
17:58:13 LODShape::Preload: shape '' not found
17:58:13 Warning Message: Cannot open object 
17:58:13 LODShape::Preload: shape '' not found
17:58:13 Warning Message: Cannot open object 
...
hallow mortar
#

What's up with the negative numbers in the array of colours? I don't think you can have negative alpha values

dreamy kestrel
#

this is what it was from the module effects fire:

_emitter setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,0.4*_particleSpeed],0,0.0565,0.05,0.03,[0.9*_particleSize,0],
[[1*_colorRed,1*_colorGreen,1*_colorBlue,-0],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,0]],
[1], 0.01, 0.02, "", "", "",_orientation,false,-1,[[3,3,3,0]]];
#

with preceding defaults:

_colorRed = _logic getVariable ["ColorRed",0.5];
_colorGreen = _logic getVariable ["ColorGreen",0.5];
_colorBlue = _logic getVariable ["ColorBlue",0.5];
_timeout = _logic getVariable ["Timeout",0];
_particleLifeTime = _logic getVariable ["ParticleLifeTime",2];
_particleDensity = _logic getVariable ["ParticleDensity",20];
_particleSize = _logic getVariable ["ParticleSize",1];
_particleSpeed = _logic getVariable ["ParticleSpeed",1];
_effectSize = _logic getVariable ["EffectSize",1];
_orientation = _logic getVariable ["ParticleOrientation",5.4];
_damage = _logic getVariable ["FireDamage",1];
hallow mortar
#

interesting

dreamy kestrel
#

yeah I'd say

#

afk for a few

wary sandal
#

so recently i learnt about #define (courtesy of @copper raven blobcloseenjoy ) but i'm not 100% how it works. I'm trying to enable the simulation of an unit passed through this SIMENABLE macro function but to no avail (it throws me a semicolon error for some reasons?)

#define SIMENABLE(OBJ) OBJ enableSimulation true\ OBJ enableDynamicSimulation true;

...
[] spawn {
  SIMENABLE(unit);
};

fair drum
fair drum
#

at the end of line

wary sandal
#

2 semi colons?

#

weird haha

fair drum
#

either remove the semi from the macro, or remove it from the call line

wary sandal
#

for example

fair drum
#

either or, cause right now, you'll have two after it replaces SIMENABLE(unit)

#

i would remove it from the macro

wary sandal
#

it now tells me that i have a missing ;

copper raven
wary sandal
#
#define SIMENABLE(OBJ) OBJ enableSimulation true\ OBJ enableDynamicSimulation true
someVariable = false;

[] spawn {
    SIMENABLE(unit1);
    SIMENABLE(unit2);
};
copper raven
#

you don't put a linebreak after it, so the replacement includes the \

#

replace \ with ; and the problem will go away

fair drum
#

oh i didn't catch that, yeah that's why

wary sandal
copper raven
#

also remove the ; at the end of the macro content, it's a "guideline" kinda thing, you want to put a ; after the macro instead, i.e.,

#define MY_MACRO(x) x
                     ^ no semicolon
MY_MACRO(1337);
              ^ semicolon
wary sandal
hallow mortar
#

(you also have some work to do on the velocity, gravity etc but that's up to you)

#

The emissive colour should be format RGBA - 4 values, you only pass 3. The engine requires that fourth value even if it doesn't do much in this case.

torn solstice
#

Is it possible to assign 2 variables to 1 player unit?

hallow mortar
#

Do you mean storing multiple variables in a player unit's namespace using setVariable? Yes.
Do you mean giving a player unit 2 variable names that both refer to it? Also yes, actually, but usually better to just use the one if possible

torn solstice
#

So my scenario is a little complicated. I currently have 4 player slots whitelisted on resistance side (checks using playerSide == resistance) and they are using *isSneaky * variable from INCONTINENTIA'S UNDERCOVER scripts. I am moving those players over to blufor but now require another variable (alongside isSneaky) to whitelist those 4 slots on blufor.

#

I think I have found a work around and am going to try using roleDescription player == "<role_desc_here>"

#

furthermore, does anyone know how to whitelist Respawn Positions?

dreamy kestrel
cursive elk
#

How do I animate a helo's landing gear up or down by script?

hallow mortar
#

You can try this: https://community.bistudio.com/wiki/Arma_3:_Actions#LandGear
apart from that, I believe it's an engine-controlled animation and won't respond to normal animation commands.
(Note: for static screenshot posing ONLY, you can use POLPOX's Artwork Supporter to convert the helo to a simple object and control its animations manually.)

cursive elk
#

Actually, I just want to spawn it with gear closed so I can simulate a crash

#

From the editor

fair drum
hallow mortar
cursive elk
#

I see

#

maybe it would be possible to use the action commands with AI mid air and then delete him, reposition the helo later

hallow mortar
#

Probably sort of possible but seems likely to either lead to unintended consequences or require a lot more work than you might expect. I'd recommend figuring out simple object manipulation; it's awkward to learn but you only need the one command and once you know how it works, it's not too hard.
...Or just leave the gear alone and cover it up with a crater object

cursive elk
#

I see

#

Thanks for the assistance

cursive elk
royal spruce
#

and with removing the current bag, would i use deleteVehicle?

fair drum
#

Yeah, just grab the class names and the amount of each item into an array first

royal spruce
#

and im assuming that to store the items, i'd have to use a local variable

#

how would i set the storage of the newly created item? where would i plug that local variable into?

fair drum
#

You'd create a function and do everything in that to convert the bag. You can use a local var inside that function. Are you wanting a list of commands you can look up and use?

royal spruce
#

i think ive come across that page on the wiki, i can probably find it again

fair drum
#

Well come up with some stuff and I'll help you through when you get stuck. Just know that it is possible and not too hard. I'm lying in bed though so I won't respond till tomorrow.

royal spruce
#

alrighty

pulsar bluff
#

anyone good with regex here?

#

trying to do something in text editor, applying to thousands of lines

warm hedge
#

And this might be a better resource for you since you're way better to read English, no?

pulsar bluff
#

trying to convert this ["o_mrap_02_gmg_f",""], ["o_mrap_02_hmg_f",""], ["o_lsv_02_at_f",""], ["o_lsv_02_armed_f",""], ["o_lsv_02_unarmed_f",""], ["o_quadbike_01_f",""], into this ["o_mrap_02_gmg_f","o_mrap_02_gmg_f"], ["o_mrap_02_hmg_f","o_mrap_02_hmg_f"], ["o_lsv_02_at_f","o_lsv_02_at_f"], ["o_lsv_02_armed_f","o_lsv_02_armed_f"], ["o_lsv_02_unarmed_f","o_lsv_02_unarmed_f"], ["o_quadbike_01_f","o_quadbike_01_f"],

#

basically pasting across

warm hedge
#

Or, you might can just use SQF to re-make the array?

little raptor
#
_arr apply {[_x#0, _x#0]}
```?
warm hedge
#

That was I meant to say ye

pulsar bluff
#

but only in cases where there exists the ""

#

there are other lines like this ["b_static_designator_01_f","B_W_Static_Designator_01_F"],

little raptor
#
{
  if (_x#1 == "") then {_x set [1, _x#0]}
} forEach _arr;
pulsar bluff
#

hmm

#

maybe that is the simplest way πŸ˜„

#

i was thinking something to paste across where "" exists

onyx breach
#

No idea if its a script issue or mod issue so not sure where to put it but
Secondary layer not supported here
gets spammed in my RPT and my server crashes

still forum
#

Ah found it, game should crash right after that message, it shouldn't be able to spam.. Or maybe thats different in retail πŸ€”
Well some animation thing does a thing that the engine doesn't support πŸ€”

tough abyss
#

I could really use some advice about building a mod dependent on CBA_A3

still forum
#

Just ask away. Specific questions are best

tough abyss
#

I'm just not sure where to start...

jade acorn
#

here's best to start

tough abyss
#

What is the structure of a mod file?

#

And what if my mod needs access to data on the server?

#

For example markers from other players

jade acorn
#

so you don't know how to make a mod at all then?

tough abyss
#

I've written scripts etc. But never mods.

jade acorn
tough abyss
#

No no just map markers of other players

#

_USER_ID#

hallow mortar
#

A script in a mod operates much like any other script, once it's running

#

So if you need map markers you retrieve them the same as you would if it wasn't a mod (however that may be)

tough abyss
#

Ah I thought running client side it would restrict access to data

tough abyss
little raptor
#

unless the mod contains stuff that cannot be changed by a mission, e.g. vehicles

tough abyss
#

It's only images and scripts right now.

little raptor
#

well then you can make a mission
inside the mission folder make a folder as your addon folder (this will be built as the PBO)
then use description.ext to #include "addon\config.cpp" of your addon

tough abyss
#

Ah so leave the @ off while it's in the mission folder?

little raptor
#

what @?

tough abyss
#

All mods have a @Mod

little raptor
#

that's just for the mod folder, not addon folder

tough abyss
#

Ah k

hallow mortar
stable dune
#

Hi,
If i create _groups with for loop,
Lets say 6.
pushBack those is array.
Or something.
How do I check / delete those from array or something when group dies, if i use deletewhenempty , but still it gives with _myAiGroups select {isNull _x} , nothing.
So those aren't null.
maybe a very unclear question but I'll ask anyway

copper raven
#

you probably want to use a killed EH on every unit in the group, and manage the groups array from it

south swan
#

inb4 it fires at the same time as old empty group deletion

copper raven
#

unit left, but not when they died right?

winter rose
#

I guess when the leader realises the loss (just before identity loss)
but use the Empty EH

#

or use Deleted to know if/when it is by the engine

stable dune
#

Awesome! thanks guys!

tough abyss
#

Anyone know how to pull the ACE3 heart rate data and blood pressure from the player?

little raptor
tough abyss
#

Thank you.

drowsy geyser
#

is it possible to load a pbo file via a mission?

winter rose
drowsy geyser
#

I wanted to flood the altis salt lake and AFAIK that is not possible without a pbo

winter rose
#

you can by script

drowsy geyser
#

Oh cool, how would I do that and would it be mp compatible?

winter rose
#

yes

#

they will not be simulated, no wind, not destructible etc

#

create simple object is createSimpleObject, which takes a P3D and not a config-defined vehicle

drowsy geyser
winter rose
#

no idea

fair drum
#

I'm gonna guess no you can't

#

Report back

little raptor
#

you can swim in it at least πŸ˜…

halcyon temple
#

hey guys
I'm having some trouble working on a function to retrieve a value from an array

Possible cases:

myArray = [
    ["myString1", "myValue1" /* scalar / string / boolean / array */],
    ["myString2", "myValue2" /* scalar / string / boolean / array */]
];
_myValue = [myArray, "myString1"] call TAG_fnc_myToComplicatedForMyHeadFunction;
_myValue = [myArray, ["myString1"]] call TAG_fnc_myToComplicatedForMyHeadFunction;

or

myArray = [
    ["myString1", [
        ["myOtherString1", "myValue1" /* scalar / string / boolean / array */],
        ["myOtherString2", "myValue2" /* scalar / string / boolean / array */]
    ]],
    ["myString2", [
        ["myOtherString3", "myValue3" /* scalar / string / boolean / array */],
        ["myOtherString4", "myValue4" /* scalar / string / boolean / array */]
    ]]
];
_myValue = [myArray, ["myString1", "myOtherString1"]] call TAG_fnc_myToComplicatedForMyHeadFunction;

or

#
myArray = [
    ["myString1", [
        ["myOtherString1", [
            ["myYetAnotherString1", "myValue1" /* scalar / string / boolean / array */],
            ["myYetAnotherString2", "myValue2" /* scalar / string / boolean / array */]
        ]],
        ["myOtherString2", [
            ["myYetAnotherString3", "myValue3" /* scalar / string / boolean / array */],
            ["myYetAnotherString4", "myValue4" /* scalar / string / boolean / array */]
        ]]
    ]],
    ["myString2", [
        ["myOtherString3", [
            ["myYetAnotherString5", "myValue5" /* scalar / string / boolean / array */],
            ["myYetAnotherString6", "myValue6" /* scalar / string / boolean / array */]
        ]],
        ["myOtherString4", [
            ["myYetAnotherString7", "myValue7" /* scalar / string / boolean / array */],
            ["myYetAnotherString8", "myValue8" /* scalar / string / boolean / array */]
        ]]
    ]]
];
_myValue = [myArray, ["myString1", "myOtherString1", "myYetAnotherString1"]] call TAG_fnc_myToComplicatedForMyHeadFunction;

and so on... so far I got this

#
params [
    ["_arr", [], [[]]],
    ["_key", "", ["", []]]
];

// If _arr is empty, or the _key is an empty array or string, I dont think this will work
if (_arr isEqualTo [] || (_key isEqualTo [] || _key isEqualTo "")) exitWith { systemChat "myToComplicatedForMyHeadFunction invalid params"; };

private ["_id"];

// _key is an array and has more then one element
if (_key isEqualType [] && (count _key) > 1) exitWith {

    // get the id of the array which has the first element equal to the first element of _key
    _id = _arr findIf { (_x select 0) isEqualTo _key select 0; };

    // incase nothing comes up
    if (_id == -1) exitWith { systemChat format ["There is no value with '%1' as key in '%2'", str _key, str _arr]; nil; };

    // call this function again, but with the array found previousely, and without the first element of _key
    [_arr select _id, _key - [_key select 0]] call TAG_fnc_myToComplicatedForMyHeadFunction;
};

// _key is an array with only one element, hopefully
if (_key isEqualType [] ) then { _key = _key select 0; };

_id = _arr findIf { (_x select 0) isEqualTo _key; };

if (_id == -1) exitWith { systemChat format ["There is no value with '%1' as key in '%2'", str _key, str _arr]; nil; };

private _return = (_arr select _id) select 1;

_return;
#

@south swan I know

south swan
#

do you specifically need arrays? Sounds like a hashMap kind of storage to me

copper raven
#

you know that hashmaps exist right?

halcyon temple
#

haven't got my head around it

halcyon temple
winter rose
#

well, unles you use the local parameter to create it locally

#

e.g initServer.sqf if you will yeah

wet geode
#

Is there a way to create a flexible joint? Tried ropes but it did not work. Trying to link the RHS Pontoons.

little raptor
#

it should work if you simply set the public flag to true

little raptor
#

I've seen people do that

#

it will set the latest one

#

why the while?

#

you don't need to waste performance with that

#

so?

#

you're the one changing it

#

you can just send a "signal"

#

also I'm not sure if you understood what I meant by public flag: profileNamespace setVariable ["rewardRecieved", false, true]

little raptor
#

again, you're changing it

#

isn't that your variable? or is it coming from a mod?

#

then you don't need to "check if" it changed.
you KNOW when

#

let me show you an example:
case 1: using a loop: (slow and wastes performance)

SomeVar = false;

player addAction ["Change var", {
  SomeVar = true;
}];

waitUntil {SomeVar};
// do other stuff

case 2: Using a helper function which serves as event handler:

SomeVar = false;
player addAction ["Change var", {
  [true] call TAG_fnc_EH_SomeVarChanged
}];

fn_EH_SomeVarChanged.sqf:

params ["_newValue"];
SomeVar = _newValue;
// do other stuff
#

similar to normal EHs, there's no loop. you execute the "other stuff" exactly when you want it

#

I don't follow what you mean
addActions have a condition. you can just put SomeVar in its condition and it'll only show when the var is true

wet geode
little raptor
#

what are A and p_2?

wet geode
little raptor
# wet geode A is pontoon 1 and p_2 is the second one

there's a problem with how you've set things up. there's no guarantee that the other pontoon exists before the first one.
try running that in debug console once you're in the game to see if it even works
also not all objects support ropes

wet geode
#

thanks

hallow mortar
#

Yes, but it's pretty unlikely. You should use something to round the result, the default precision is something like 4 decimals (e.g. 5.5344)

south swan
halcyon temple
#

what?

heavy lily
south swan
#

what "what"? Your screenshot looks like "nested structures are still arrays, what to do with them?". If not - then i misread and can't say anything more without further explanations πŸ€·β€β™‚οΈ

jade acorn
#

once you open the mission you'll have some folder called Scripts or whatever, open any sqf file inside and they should have comments added

heavy lily
#

I did watch the video tutorial, felt more lost, didn't explain where to find stuff and unfortunately being newer at this, I don't even know what to start searching lol tried though, just got more frustrated. I'll give that a go. Thanks for the direction

kindred zephyr
#

Can lazy evaluation be applied to waitUntil and whiles?

hallow mortar
#

Well, it can be applied within the waitUntil condition, since it's part of the and command - if you're using and in the condition then you can use lazy evaluation with it

stable dune
#

A lightpoint is local to the computer where the script has been called; one player could see a light in the dark while another would not have such light "object" created.

So no1 won't see that, only if you host , you see current light effect.
You need remoteExec createVehicleLocal

hallow mortar
#

ideally, put all your light commands in a function and remoteExec that, rather than remoteExecing one at a time

hallow mortar
#

Technically yes you can make a function like that but you shouldn't

royal spruce
#

let's say i use createVehicle to create a new item

#

how would i store the object i just created as a variable to use commands like addItemToVest?

winter rose
#

variables

#
private _myStuff = createVehicle ["abc", etc];
_myStuff setDamage 1; // boom, destroyed
royal spruce
#

i just preface this by saying my scripting knowledge is like a caveman discovering fire for the first time

winter rose
#

then no worries, we're here to guide πŸ™‚

royal spruce
#

holy moly that looks easier than i was fearing, tyvm

winter rose
royal spruce
#

luckily ive figured that much out

when i finish doing commands on the object, is there a way to unassign it as a variable?

winter rose
#

no need, the variable is deleted when the code exits the scope

#

(note: not the object itself, just the var)

royal spruce
#

thats awesome

stable dune
#

Did you get correct way do handle lights to shown everybody? πŸ€”

royal spruce
#

im assuming since a vest is defined as a weapon in the config, i would use createWeapon to spawn in things like vests?

still forum
#

HashMaps meowheart

royal spruce
#

is that even a thing?

winter rose
#

nope, that's why I ask

royal spruce
#

what would the command be to create a vest? would i still use createVehicle?

winter rose
#

you would have to createVehicle a WeaponHolder_scripted, and addItem to it iirc

royal spruce
#

i was approaching it all wrong then ahahah

#

its starting to make more sense

winter rose
#

Yeah, weapons are unfortunately not objects in Arma, but proxies

royal spruce
#

very interesting

#

off topic, but does enfusion handle it the same way?

boreal parcel
#

heyo, I am planning to modify our invade and annex mission to re-enable pathing on garrisoned troops when there is a certain number left alive and I wanted some opinions from you guys who know more about what your doing than I do.

so in the spawner script they disable the ais pathing on spawn:

{
        private _unitType = ([(selectRandom _unitTypes), _enemyFactionHash] call AW_fnc_getUnitsFromHash);
        private _unit = _garrisongroup createUnit [_unitType, _x, [], 0, "CAN_COLLIDE"];

        _unit disableAI "PATH";
        _unit setUnitPos "UP";
        _units pushBack _unit;

        _unitCount = _unitCount + 1;

        sleep 0.1;

        if (_forEachIndex >= 8) then {break};
        if (_unitCount >= _maxUnits) then {break};
        if ((count (units _garrisongroup)) >= (ceil ((count _infbuildingpos) / 2))) then {break};
    } forEach _infbuildingpos;

I was thinking I push _unit to a global variable and in another script I have a forever running while loop, in the while loop I every like second I check which units are alive and pop the dead units in the array.

And basically once the array of units is less than say 15 units alive I re-enable pathing for each unit and set a waypoint to the nearest player.

What do you guys think? How should I go about this?

hallow mortar
#

This already creates a _units array containing all the units it creates.
After the forEach you can do things with that array. For example:

_units spawn {
   waitUntil { sleep 5; (count (_this select {alive _x})) < 15 };
   { _x enableAI "PATH" } forEach _this;
};```
tough abyss
#

How do you get the NVGs a player is wearing?

#

nvm found it

boreal parcel
#

and enableAI wont error at all if path is already enabled on some units right?

tough abyss
#

Anyone know how to get ACRE2's current frequency and channel number etc?

devout gazelle
#

Hey all!
Trying to learn how to call params for scripts/functions. My first time with this.
Got stuck on how to call /change these in a script/trigger. I struggle to wrap my head around this 😐
Would appreciate some advice!


//PARAMS 
params [
    ["_IDArray",[]], 
    ["_settingsArray",[]]
];


//PARAM PARAMS
_IDArray params [
    ["_spotterGroup",grpNull],
    ["_artyID",objNull]
];
_settingsArray params [
    ["_debug",false],
    ["_artyChance",50],
    ["_targetting","side"],
    ["_artyVirtual",true],
    ["_zeroing",true],
    ["_zeroingCoef",0.5],
    ["_setuptime",20],
    ["_flightTime",15],
    ["_timeBtweenShells",10],
    ["_rounds",10]
];
devout gazelle
# copper raven what function/script is that?

Well... I tried to make a arty script to the best of my ability πŸ˜‚
And I am trying to call it from a trigger.
I just don't know how to set up the call function.

A friend of mine made something similar like this:

if (isServer) then
{[ [(group GroupName),units EAST], MortarName, ["",true], 1, [true,false], [25,10,7],[12,64]] remoteExec ["pr_fnc_artySpotter", [0, 2] select isDedicated];
};

But it makes no sense how the arrays are separated...
This is his params that matches with the call above:

//PARAMS
params [
    ["_grpArray",[]],
    ["_arty",objNull],
    ["_typeArray",[]],
    ["_numShells",1],
    ["_hitTargetArray",[]],
    ["_sleepArray",[]],
    ["_roundsArray",[]],
    ["_shellTime",300] // only instance, want to keep?
];

// PARAM-PARAMS
_grpArray       params [
    ["_spotterGroup",grpNull],
    ["_grpToChase",playableUnits],
    ["_whoToWatch",objNull]
];

_typeArray      params [
    ["_typeShell",""],
    ["_unlimited",false]
];

_hitTargetArray params [
    ["_hitTarget",true],
    ["_giveAfuck", false],
    ["_dangerCloseDist",150],
    ["_kaFriendly",1],
    ["_error",500],
    ["_zeroRounds",4]
];
_sleepArray     params [
    ["_sleep",(30 + random 15)],
    ["_random",0],
    ["_zeroedSleep",7]
];

_roundsArray    params [
    ["_requestedRounds",4 + random 6],
    ["_maxRounds",32]
];
devout gazelle
#

Question is whats the logic - how does it fit?

copper raven
#

all params does is assigns values from an array, fx, they pass [12,64] as _roundsArray, then they params from it which assigns _requestedRounds and _maxRounds

devout gazelle
#

And the mortar name and the numShells aren't in [] because the main param doesnt have ["",[]]?

#

I think I get it now

copper raven
#

mortar name?

devout gazelle
#

Yeah - it's mentioned in the exec above - Mortar/arty is _arty

copper raven
#

and yes, _arty

cobalt path
#

Is there a script that would give an aircraft infinite amount of flares/chaff?

velvet merlin
#

is there a way to use filePatching on the server without windows locking the files?

wary sandal
#

is there any event to detect armament changes in the arsenal?

pulsar bluff
#

event? no

#

but the player is in Arsenal, so you can just run a per-frame check of inventory for changes

#

something like this

#
TAG_items = [];
TAG_GearChangeEvent = addMissionEventHandler [
    'EachFrame',
    {
        _items = toArray (uniqueUnitItems player);
        if (TAG_items isNotEqualTo _items) then {
            TAG_items = _items;
            // Event code below




        
        };
    }
];```
copper raven
pulsar bluff
#

there are key events to handle too in that case ... like [ctrl]+[r] applies random gear

#

@velvet merlin what is the best way to check if a particular mod is running

velvet merlin
#

isClass cfgPatches

pulsar bluff
#

for instance im using this for GM

#

if (isClass (configFile >> 'CfgAddons' >> 'PreloadAddons' >> 'gm_core')) exitWith {

velvet merlin
#

these days its not as important as clients have to have the same pbos too

#

only optional mods are somewhat special

pulsar bluff
#

ahh for my use its for server to determine what units/vehicles to spawn πŸ™‚

velvet merlin
#

in the end checking for something actually to be use (ie cfgVehicles) would be safest

pulsar bluff
#

also to run a mod properly, does mission.sqm need anything in it? using GM as example

#

thinking addons[]={} class AddonsMetaData {}; dlcs[]={}

warm hedge
#

Thing where you select your weapons/equipment/whatevers

wary sandal
#

with an event

warm hedge
#

That's why sharp. mentioned it is complex

velvet merlin
#

activateAddons command is likely doing something similar

#

alternatively i would spawn the to be used assets away from the mission area at mission start

cobalt path
#

@copper raven I assume the issue is that I need to know the name of the magazine aswell. I tried:

this setMagazineTurretAmmo ["300Rnd_CMFlare_Chaff_Magazine", 100, [0]];

And it doesnt change anything

copper raven
#

the fired EH gives you the magazine used

#

it also gives you the vehicle which fired

#

i don't know why are you using this

#

, [0] turret path also seems wrong, it should be the driver's turret, which is [-1]

wary sandal
#

why does my black background disappear after like 15 seconds? cutText ["Press the SPACE key", "BLACK FADED", 2]

#

i just realized

cobalt path
cobalt path
copper raven
#

if you run that once, it will not result in infinite chaffs

#

you need to use a fired EH like i told you

copper raven
onyx breach
# still forum Send me the crash .mdmp file, maybe I can see smth

Luckily found the issue, I believe it maybe something with mikeros new pboproject. It was a mod on the server causing it, I just put the old version back in and fixed it. Packed with PBOProject and it crashes, Addonbuilder it doesn't no obfuscation. Possibly was a different issue the layer bug.

thick merlin
#

hey guys, ran into a issue with a script .was wondering if someone could tell me where iam going wrong.iam trying to define the script ,Without the defines it runs.,but if i define it i get a wait untill error

#
private["_grp","_crew","_heli","_this"];
_grp = grp1;
_crew = copilot;
_heli = h1;
_this = this;

{unassignvehicle _x;_x action ["Eject", vehicle _x]} foreach units _this;
0 = [] spawn {waitUntil {{!(alive _x) || _x in _heli} count units _grp == 0}; 
_crew vehicleRadio "RadioMsg_boots_on_the_ground3";};
task1 setTaskState "Succeeded";
activate2 = true;
};  ```
#

Any help would be great.Thnx.

stable dune
#
 {!(alive _x) || _x in _heli} count units _grp == 0}

This gives error.
So you want check is _x in heli or _x is not alive, from which group?

stable dune
#

And when you spawn, you need pass yours _heli, _crew and group there.

[_heli,_grp,_crew] spawn {
    params ["_heli","_grp","_crew"];
    // Your code here
};
willow hound
#

foreach units _this also doesn't make too much sense.

south swan
#

_this = this sounds fishy if we start at that πŸ€·β€β™‚οΈ

hallow mortar
# thick merlin ```GF_Eject1 = { private["_grp","_crew","_heli","_this"]; _grp = grp1; _crew = c...
// anzac_fnc_gf_eject1 defined in cfgFunctions like a civilised person
// defining local variables just to hardcode them as references to global variables is silly, use function arguments
// [grp1,copilot,h1] call anzac_fnc_gf_eject1

// the distinction between _grp and _this is unclear, it seems like they should be the same thing.
params ["_grp","_crew","_heli"];

{
  unassignVehicle _x;
  _x action ["Eject",vehicle _x];
} forEach units _grp;

[_heli,_grp,_crew] spawn {
  // this is dubious, it waits until there are no dead members of _grp, so if one dies during the unload process for any reason, the script won't complete until they get cleaned up from the group
  waitUntil { ({!(alive _x) || _x in _heli} count units _grp) == 0 };
  _crew vehicleRadio "RadioMsg_boots_on_the_ground3";
};
// properly tag your global vars to avoid conflicts
anzac_task1 setTaskState "Succeeded";
anzac_activate2 = true;```
wary sandal
#

any ideas?

#

this is the code that triggers the fade

    waitUntil {!isNull findDisplay 46};
    [findDisplay 46, 57, 1, {
        introCinematicHandle = execVM "scripts\introCinematic.sqf";
        publicVariable "introCinematicHandle";

        [1, "BLACK", 1.5, 1, "EventTrack02_F_EPA"] spawn BIS_fnc_fadeEffect;

        sleep 1.5;

        ["USS Liberty", "Task Force AEGIS", format ["Year %1", date select 0]] spawn BIS_fnc_infoText;
    }] call BIS_fnc_holdKey;
wary sandal
#

sometimes, like 1/4 of the time the cutscene cinematic "bars" disappear too

#

i'm confused as to why

willow hound
#

Does it also happen if you use cutText (or equivalent) directly instead of using BIS_fnc_fadeEffect?

wary sandal
willow hound
#

I don't understand.

wary sandal
still forum
wary sandal
#

how can i check whether a mission handler is null or not?
my attempt:

if (!wjtk_gearChangedEvent isEqualTo objNull) then {```
proven charm
wary sandal
#

Type number, ... Location expected

proven charm
#

it means wjtk_gearChangedEvent is number

wary sandal
#

but it isn't lol

#
    wjtk_gearChangedEvent = addMissionEventHandler ["EachFrame",
    {
        private _items = toArray (uniqueUnitItems player);
        if (wjtk_items isNotEqualTo _items) then {
            wjtk_items = _items;
            player sideChat str (_items call wjtk_fnc_isIncognito);
        };
    }];
still forum
#

It is

wary sandal
#

it should return an handle?

still forum
#

addEH Returns the Id of the EH, which is number

#

Handle is a number

#

You want is is isNil "varname" to check if the variable has been set

wary sandal
#

i thought it returned an event handle

hallow mortar
#

It does, but an event handler's handle is just a numerical ID. It doesn't have a special reference type, it just has a number.

wary sandal
#

another question can a forEach loop be broken?

still forum
#

Broken? break works yes

torpid mica
#

exitWith

still forum
#

We have break (we do right? Next to continue?)

wary sandal
#

would that return the value inside the {}?

still forum
#

Well if you need that, that should work

patent bear
#

Hi! I'm trying to use Sector Capture module. I want to reward side when one side capture all of the sectors and then lock capture of this sectors for 30minutes. After that time re-enable sector capture. I don't know how to prevent sector capture. enableSimulation =false locks it forever and it can't be captured after I set enableSimulation =true. Any ideas?

tough abyss
#

Is there any real point to obfuscating your ArmA code?

#

I mean KOTH even already has bootleg versions...

pulsar bluff
#

there is at the server/community level

#

i did in 2016

#

when tanoa launched, i wanted 24/7 full server to dev on. if i open souced, other existing communities simply re-host and then you find server is not 24/7 full as players spread out.

#

immediately after i shut my server down i published to public repo

copper raven
halcyon temple
#

hey guys,

In SQF, you can use the typename keyword to define a new type, which can then be used to create variables and arrays of that type. You can use the typename keyword to define a data structure that is similar to a struct in C++ or other programming languages.

is this true?

warm hedge
#

Who said so?

tough abyss
#

Well it definitely wouldn't be similar to a struct

#

A struct is stored on the heap.

#

Nothing to do with structs.

warm hedge
tough abyss
#

Arma doesn't allow binary files apart from SQFC in terms of code or you can use an extension.

#

But definitely nothing like a struct.

#

SQF is a purely procedural language.

halcyon temple
warm hedge
#

lol

tough abyss
#

ChatGPT needs to die

#

Doesn't even generate the correct code.

#

Stack overflow has banned it's use in coding questions.

#

ML models for text are horrendous they aren't able to determine intention and they certainly don't understand common sense.

#

The future of AI is less data not more.

halcyon temple
tough abyss
#

snide huh? Just stating facts.

halcyon temple
#

it wasn't a reference to you

tough abyss
#

Oh.

#

If people give you snide comments meh just ignore them, focus on getting help (scripting, GUI etc)

halcyon temple
#

but there names are in green and blue xD

tough abyss
#

Meh, I work on my own projects. Like a working IVAS UI

halcyon temple
#

it does interpret my code pretty well, but then again it's my code... simple and buggy...

tough abyss
#

ML models have a lot of problems, like they don't deal with ambiguity well. Humans can work out something with incomplete information ML models just can't. They also can't be trained in real time and updated in real time either.

halcyon temple
#

hum... I gave it snippets, and it made a nice complete picture.... but then again, my code...

tough abyss
#

I can see how it didn't understand what TypeName was.

#

It probably assumed that was a data type declaration.

#

Like int, double , struct etc.

warm hedge
#

Let's focus on real SQF, not how the AI's horrible?

halcyon temple
tough abyss
#

If it had getTypeName. it probably wouldn't have messed up just food for thought agreed back to SQF

tough abyss
warm hedge
#

Huh?

tough abyss
#

cfgBrains.hpp

warm hedge
#

Do not think have ever did

tough abyss
#

Lots of interesting stuff in the examples files

#

A lot of it wasn't there what 2 years ago I think

#

Even custom fonts.

warm hedge
#

I don't think there's anything interesting

#

What exactly are you talking about? A font does nothing to do with CfgBrains

tough abyss
#

Just mentioning the random stuff in the Samples folder

warm hedge
#

Then it is not a question?

tough abyss
#

k nvm

warm hedge
#

I don't mean you can't chat so, but I've expected to be a question

tough abyss
#

Can description.exts take cfgPatches.hpp ?

warm hedge
#

Never think so

#

Why you'd ask in the first place? CfgPatches exists to manage the load orders of an addon/config

tough abyss
#

So just comment out the cfgPatches section and just include the UI headers? Functions etc?

#

It's for testing a mod.

warm hedge
#

What UI headers? What's the situation?

tough abyss
#

I've got a mod which is basically the Integrated Visual Augmentation System

#

The UI functionality for it, I use someone elses already made mod to act like the initializer.

#

And it has functions, the usual.

#

How can I test most of it's functionality within a mission?

warm hedge
#

A UI entry can be included into a description.ext indeed

tough abyss
#

Yeah so can the cfgFunctions.hpp

warm hedge
#

A hpp more like #include does mean nothing, but it is just a text file

#

#include does only a dumb copy and paste

tough abyss
#

Ahhhh. Okay so it's just copying everything in the path back to that file?

warm hedge
#

Yes. Not even mandatory to do, but it makes somewhat easy to debug or manage

#

Just a practice, nothing more or less

tough abyss
#

Okay.

#

What is the preferred way to build a Addon HEMTT?

#

or CBA_A3's tools?

warm hedge
#

Eh?

#

What is

Addon HEMMT
?

tough abyss
#

Thats HEMTT

warm hedge
#

And what is

build
?

tough abyss
#

Configures dependencies, file paths, things a bit like CBA_A3's build system for addons?

warm hedge
#

I don't know the build system that CBA has you say

proven charm
#

can you make marker visible in map but not in GPS?

warm hedge
#

Use drawIcon instead

proven charm
#

isnt that slow?

warm hedge
#

Unfortunately

proven charm
#

πŸ˜΅β€πŸ’«

velvet merlin
#

at times CBA console looses the stores code for the watcher fields - is it known what causes this? too much code? "unclean" game exit?

#

@proven charm GPS has its own UI classes you can modify - pretty sure there is also a parameter for marker display now

#

however if you are mission/game mode only, doesnt help - alternative is to make your own GPS/minimap UI

proven charm
#

I'm probably just going to use addMissionEventHandler ["Map", ... and hide those markers

jade acorn
copper raven
#

so if that gets corrupted, as you said, by a bad game exit/whatever, the data will be lost

velvet merlin
#

well its not all fields necessarily - can be, but can be also just one of the four

copper raven
#

actually, for the watch fields cba doesn't do anything

#

it's all vanilla

dreamy kestrel
#

Q: is there a function, scripting command or BIS function, that converts degree direction to cardinal directions? i.e. 0 'N', 15 'N NE' and so on

little raptor
#

_angle must be between 0 and 360 ofc

copper raven
#

do a % 8 πŸ˜„ so it's "safe"

little raptor
#

if not make sure it is (this supports angles in range [-360, INF))

(_angle + 360) % 360
little raptor
#

I put "N" twice

copper raven
#

i meant if angle is something out of "range"

dreamy kestrel
#

nice. I elaborated a bit, supports a couple different divisions if more precision is required.

private _cardinals = switch (_divisions) do {
    case 0: {
        [
            Q(N)
            , Q(E)
            , Q(S)
            , Q(W)
            , Q(N)
        ];
    };
    case 1: {
        [
            Q(N)
            , Q(NE)
            , Q(E)
            , Q(SE)
            , Q(S)
            , Q(SW)
            , Q(W)
            , Q(NW)
            , Q(N)
        ];
    };
    default {
        [
            Q(N)
            , Q(NNE)
            , Q(NE)
            , Q(ENE)
            , Q(E)
            , Q(ESE)
            , Q(SE)
            , Q(SSE)
            , Q(S)
            , Q(SSW)
            , Q(SW)
            , Q(WSW)
            , Q(W)
            , Q(WNW)
            , Q(NW)
            , Q(NNW)
            , Q(N)
        ];
    };
};
private _divAngle = 360 / (count _cardinals - 1);
_cardinals select ((_dir % 360) / _divAngle);
#

excuse the macro script component stuff

dreamy kestrel
#

initially I started with algo to calculate the gaps in the "NESW" but this is straightforward enough.

wicked sparrow
little raptor
#

and how do you do that exactly?

#

terminate simply tells the scheduler to remove a script from the processing queue using its handle

wicked sparrow
#

Hmmm, so is there a other way in killing a running function? Like I got a function that runs about 10m changing stamina and so on. but when you respawn it just keeps running like nothing happened. So I need to kill that function now somehow.

little raptor
#

how do you run the function, and how do you terminate it?

wicked sparrow
#

I run the function upon respawn. The function is not terminated.

#

Like if you respawn this function will reset all the values.

little raptor
#

I mean show me some code

wicked sparrow
#

That is what I've tried so far but it only resets the stamina, it does not remove the chroma effect or stops that "PervitinLocal" function from continuing executing.

/// Clear Stamina 
if (ACEGVAR(advanced_fatigue,enabled)) then {
    
    ["PDF"] call ace_advanced_fatigue_fnc_removeDutyFactor;
    ["EDF"] call ace_advanced_fatigue_fnc_removeDutyFactor;

} else {

    params ["_patient"];

    _patient enableStamina true;
    _patient setAnimSpeedCoef 1;

};

/// Clear chroma effect

params ["_handle"];
ppEffectDestroy _handle;

/// Terminate script
_script = [] execVM "fnc_treatmentAdvanced_PervitinLocal.sqf";
terminate _script;
#

the last part is only important cause that is the one I added.

open fractal
#
/// Terminate script
_script = [] execVM "fnc_treatmentAdvanced_PervitinLocal.sqf";
terminate _script;
``` you're executing the script then immediately terminating it?
wicked sparrow
open fractal
#

store the script handle to a variable when you first execute it

#

then terminate it with that variable later

wicked sparrow
#

How do I do that exactly? Sry, I'm kinda new to arma coding and lack a lot of things (started 2 weeks ago)

open fractal
#
//execute the script
my_global_variable = [] execVM "...";

//terminate it later
terminate my_global_variable
#

variables that start with a _ underscore are local and can only be referenced within that scope. If you want to store a variable in one script and reference it in another you can name it without an underscore at the beginning and it will automatically be stored in the mission namespace (persisting as long as the mission is running)

gaunt tendon
#

can bounding box data be obtained through config?

granite sky
#

I don't think so. It's only present in the models, and you have to create an object to get bounding box data for it in scripts.

tough abyss
#

Doesn't need all that.

#

Map your 360 degree into a range of 0 - 15

#

Then select each element based on an

_headings = ["N","S","E","W"] ;
_index = round(((getDir player) % 360) / 22.5);
_compassDir = _headings select _index;
#

Much faster than multi level case select code

tough abyss
#

Is there a line of script or smth I can put into a character to double their health? Ace Medical’s pretty annoying when it comes to concussions and headshots and I’d rather not have to use Zeus every time.

wicked sparrow
wicked sparrow
open fractal
#

I can't help right now, sorry

boreal parcel
#

heyo, 2 questions. Is there a better way of setting event handlers for CBA? can i provide an array of classes to set the event handler to?

And is there a better way to check if the vehicle is disabled? It is a pain when vehicles in ace survive 5 rockets and the mission requires that they die.

["rhs_t80ue1", "HandleDamage", {
    if ((_this select 2) < 20) then {
        _this setDamage 100;
    };
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_t72be_tv", "HandleDamage", {
    if ((_this select 2) < 20) then {
        _this setDamage 100;
    };
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_t90sm_tv", "HandleDamage", {
    if ((_this select 2) < 20) then {
        _this setDamage 100;
    };
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_t14_tv", "HandleDamage", {
    if ((_this select 2) < 20) then {
        _this setDamage 100;
    };
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_zsu234_aa", "HandleDamage", {
    if ((_this select 2) < 20) then {
        _this setDamage 100;
    };
}, true, [], true] call CBA_fnc_addClassEventHandler;
light nimbus
#

does this imply it is possible to, in singleplayer campaign, switch the player character to another unit without decompiling the entire mission and switching said unit to be the player?

#

I tried using it, but it didn't seem to work. Also is the name of a unit simply what it reads off as in Zeus? the wiki didn't seem clear on this

fair drum
fair drum
light nimbus
#

I know almost nothing about scripting in arma 3

#

i don't even know how to get the name of a specific character in-game

fair drum
#

is it possible, yes, but not really. you'll need a good amount of work arounds. you'll have to grab the variable name of the unit you want to change to (BIS typically names all their units - you'll have to decompile to easily grab the one you want). Then you'll have to gather all event handlers/effects on that unit + the unit variable, delete the unit, then recreate the unit all in post init (which then that can cause problems with any scripts that will run on that unit because the object variable will become nil/null and mess that up). then you'll have to store that unit as the variable from before and apply all events/effects on that unit after its creation. And that's if you really take that warning to heart on the wiki page - you can risk it as well and ignore it.

#

so for for you at your current knowledge level, no its not possible.

light nimbus
#

oh.. ouch

#

so just for clarification, my problem is basically, whenever I spawn an OpTre spartan with Zeus then possess him with the possession mod, I can play as him, but none of the level triggers respond to him like, for example I can't trigger cutscenes and stuff unless I'm in the base-mission's unit. Is it possible to make this new possessed unit trigger the mission scripts and stuff, or is that impossible?

fair drum
fair drum
light nimbus
#

oh thank god

#

is this within my skill range then?

fair drum
#

then you can have in a particular trigger to wait until that variable exists, then continue with evaluating the trigger

light nimbus
#

like, East Wind for example. I can get on the buzzard as my spartan, but the chopper doesn't move until Kerry specifically hops on

#

how would I make the chopper leave when only the spartan hops on, without decompiling?

fair drum
#

I'm gonna stop you right now, this undertaking that you want to do of converting east wind into a optre mission, its not going to be worth your time. it would be faster to just recreate your version of the mission itself

light nimbus
#

πŸ˜†

fair drum
#

you're gonna hit a bunch of walls

light nimbus
#

well I mean, to be fair, if you think I'm...

#

to keep things short for clarification it's just that one spartan

#

still too hard?

fair drum
#

you have to make your spartan the same variable as kerry... its BIS_something i don't remember

light nimbus
#

oh perfect so just change that one variable?

fair drum
#

you know what would be easier?

light nimbus
#

(also thabks for the help btw. I literally know like 0 of this)

fair drum
#

just giving the equipment you want to the default character

light nimbus
light nimbus
fair drum
#

the rest literally doesn't matter

#

oh... i see

light nimbus
#

infact the spartan itself is irrelevant. I just wanna play as my model from gmod, but he's too big for the normal skeleton, so I have to spawn a whole spartan just to play as him

#

πŸ˜…

fair drum
#

okay so try these steps:

  • get zeus enhanced
  • spawn your unit
  • double click unit and open up its interface, look at bottom for script box
  • put in (now remember i can't remember the variable BIS uses for the player/kerry) BIS_something = _this and run it
fair drum
light nimbus
#

screenshotted. Thank you SOOOOOO much man you'll've saved me ages of effort if this works

#

uh... anywhere you think of I could look for that code liney thing Bohemia used on Kerry?

boreal parcel
fair drum
#

well your condition is wrong

#

but the foreach setup is correct

#

remember, the parameters for HandleDamage is

params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
boreal parcel
#

ahhh right

#

fixed, thanks for reminding me lol

fair drum
#

and setDamage is on a 0-1 scale

#

and also your condition as is, will blow it up if either of the canX is false

#

not if both are false

boreal parcel
#

yes I understand that, the enemy doesnt try to repair so as long it cant fire I dont mind total destruction

fair drum
#
!(true && false) is !(false)
boreal parcel
#

vehicles cant be captured either so it doesnt matter too much

light nimbus
#

would anyone know what variable Bohemia used to like, make Kerry's presence trigger events in the East Wind missions?

#

like, what variable would I add to another unit if I wanted another unit to trigger all the cutscenes and stuff like Kerry does?

hallow mortar
#

I strongly doubt it's that simple

#

You're trying to replace yourself with a Spartan, right? That's probably going to break stuff. BI campaign missions do a lot of things like playing specific animations on the player, and those won't work with the Spartan skeleton

boreal parcel
# fair drum well your condition is wrong

is there a possibility that canFire and canMove do not work with ace? I just hit a ZSU with 3 heat rounds, every part is read but it still lives.

{
    // Current result is saved in variable _x
    [_x, "HandleDamage", {
        if !(canFire (_this select 0) && canMove (_this select 0)) then {
            (_this select 0) setDamage 1;
        };
    }, true, [], true] call CBA_fnc_addClassEventHandler;
} forEach ["rhs_zsu234_aa", "rhs_t90sm_tv", "rhs_t72be_tv", "rhs_t80ue1"];
light nimbus
#

it certainly worked in old man atleast. The only problem with east wind is the helicopter won't move unless kerry specifically sits in it

fair drum
#

why are you using _this select blah anyways, params is cleaner

boreal parcel
boreal parcel
fair drum
#

well canFire looks to have some wonky results in the last note posted. might want to do a damage check on the selection (second param)

gaunt tendon
#

any idea how to make this?

tough abyss
#

Math

#

drawPolygon scripting command

dreamy kestrel
#

anyone remember the hex role playing mat... LOL

warm hedge
#

No need to drawPolygon, use negative X and Y for a Ellipse marker

#

It does make it hex somehow, perhaps it is just a bug but still alive

south swan
#

looks too intentional, tbh

gaunt tendon
#

interesting, will certainly help not drawing 6 triangles with drawTriangle, since drawPolygon does not support color fill

warm hedge
#

Nobody really knows the truth

#

You can use 4 triangles to draw a hex tho

gaunt tendon
#

lol nice

tough abyss
#

Or 6 triangles or 2 Isosceles Trapeziums

#

The 6 triangles would probably be much neater

gaunt tendon
# tough abyss The 6 triangles would probably be much neater
  for "_iTri" from 0 to 5 do{
    _Dir0 = -30 + _iTri*60;
    _Dirf = _Dir0 + 60;

    _cMap drawTriangle [
      [
        _Center,
        (_Center vectorAdd ([sin _Dir0, cos _Dir0, 0] vectorMultiply _EXRad)),
        (_Center vectorAdd ([sin _Dirf, cos _Dirf, 0] vectorMultiply _EXRad))
      ],
      [1,1,1,1],
      (format ["#(rgb,1,1,1)color(%1,0.20)", _Color])
    ];
  };

true

tough abyss
#

Reason it works the point of a triangle overlaps the interior of a hexagon at 60 degrees equilateral triangle. starting at 0. When they meet at the point the 60 * 6 = 360 degrees in the center.

dreamy kestrel
#

would 3 triangles work? cut the baselines across opposite corners. and the third point any of the others, walk that around three times.

tough abyss
#

It's messy but yes.

dreamy kestrel
#

and the overlapping fills.

tough abyss
#

With the 6 triangles you can treat them like a sort of quadrant system.

#

Allowing you to detect if it's in each triangle.

#

More specifically you can use polar representation for it.

#

And check the angle using 2D dot product.

gaunt tendon
#

ty for the insight

#

trying to map spawnable areas

tough abyss
#

Take the inverse cosine there you go got your angle.

#

@gaunt tendon Best way to determine your spawn able area would be to check if certain objects intersect with those locations, Check for things that would cause collisions, Trees, rocks, buildings, or terrains with too sharper gradients. Then probably store that as a precomputed array

gaunt tendon
tough abyss
#

You can use the surface normals to check the gradient which is basically the vector facing away from the tangent intersection at the terrain if you want to run your own

gaunt tendon
#

yea, was thinking to get an average of multiple samples of a small area to get an idea of the terrain gradient

tough abyss
#

At least you don't have to take the derivative of any parametric curves, or partial derivatives.

#

Unless you really want to get a vector valued function then plot multiple points on the surface normal.

#

The number of samples would determine the accuracy of your gradient.

#

As graphics environments are subject to aliasing on data.

gaunt tendon
#

maybe I should πŸ€”

tough abyss
#

Bare in mind anything in terms of real analysis, will be subject to computational restrictions.

#

Might also be useful

gaunt tendon
#

thanks mate πŸ‘

warm hedge
#

Is there any way to make AI weapon control more precisely?

Context: I'm trying to make an AI on a Praetorian more robotic so should move the turret precisely

#

It is okay if is a vehicle/turret or probably the AI unit config related

stable dune
#

With 1st Google search to question
"Does eh get removed when unit get deletes"
Was "yes", but some comments was
"Soο»Ώ it is betterο»Ώ to remove all ehs to be sure"

So if i build eh where current unit get delete, i should remove eventhandler there too? Right?

tough abyss
stable dune
#

Good to know! Thanks

agile pumice
#

Is there a lazy evaluation solution for this block of code?

All_Map_Vehicles = nearestObjects [GF_VRC_centerPosition, ["Landvehicle","Air","Ship"], worldSize];    
{
  _Vehicle = _x;
  if ( 
  (!(typeof _Vehicle in GF_VRC_tpw_radio_carlist)) 
  && {!(_Vehicle iskindof "StaticWeapon")} 
  && {!(_Vehicle iskindof "ParachuteBase")} 
  && (isNull (attachedTo _Vehicle)) 
  && (!((typeOf _x) in Vehicle_Exclude_List)) 
  ) then {
    All_Map_Vehicles = All_Map_Vehicles - [_x];
  };
} forEach All_Map_Vehicles;
#

Basically define All_Map_Vehicles with the conditions in the if statement

slender olive
#

So I want to place an ACE Arsenal on a vehicle that can be accessed only by OPFOR alongside being a respawn truck of sorts for them (I know how to do the latter half). How do I make the ACE Arsenal only allowed to be accessed by OFPOR?
This is for a multiplayer pvp scenario btw

south swan
#

Where is the laziness supposed to be if you check all the vehicles anyways?

agile pumice
#

the laziness being not defining an array, running an if else loop inside a foreach that subtracts from the original array

winter rose
#

select

agile pumice
#

That's it, thanks Lou

south swan
#

All_Map_Vehicles select {condition} to not re-create array a thousand times over is the only obvious optimisation πŸ€·β€β™‚οΈ

agile pumice
#

yes, thats what I was looking for. Apologise for mischaracterizing that was lazy eval

winter rose
#

@agile pumice you may also be better useing vehicles, no? (+ excluding weapon holders)

agile pumice
#

Probably. I was asked to make this code run better and I'm not sure of what the exact edge cases they want to consider are

#

Is there an eventhandler that handles vehicles created mid-mission via sqf or otherwise? (excluding zeus placed as I know that has its own event handler)

south swan
agile pumice
#

Thank you

boreal parcel
#

whats the best way to find the closest player within 800 meters? I was thinking nearestObjects [_unit, ["player"], 800]; but im not sure yet if there is a player classname like that

hallow mortar
#

There is not

dreamy kestrel
#

Anyone know if in vanilla or even CBA/ACE there is something like a funeral director, i.e. that watches corpses, and after time time, does an automatic GC?

dreamy kestrel
#

Ah perfect, thanks! conversely, addToRemainsCollector, assuming that is not the default disposition.

dreamy kestrel
#

I run a similar sort of calculation on secondary objectives, establish nearest player in proximity of that objective, and then shade a gradient circle shape lighter or darker, depending on proximity.

#

sort of like that childhood game, marco polo, colder warmer, etc.

boreal parcel
#

hmm, that does look to do what I need but I believe the code is running on the server so I am about to try Nikkos suggestion of nearestPosition

        private _nearestPlayer = [playableUnits, _x] call BIS_fnc_nearestPosition;
        if (_nearestPlayer distance2D _x <= 800) then {
            (group _x) addWaypoint [position _nearestPlayer, 10];
        } else {
            (group _x) addWaypoint [position _x, 10];
        };
dreamy kestrel
#

interesting, did not know about that one.

thorn saffron
#

I'm trying to write a new FSM, but I cannot save anything in .fsm format. I get an error "No Compile Config Specified" and I have no idea how to fix it. Where are those compile config files?

winter rose
winter rose
thorn saffron
#

derp

little raptor
boreal parcel
little raptor
#

what you wrote should be slower when there are many players. If we had nearestEntities it would be no question but now... blobdoggoshruggoogly

granite sky
#

Well, if you want to optimise that code then you should do inAreaArray before BIS_fnc_nearestPosition, although if all the players are usually within 800m it won't help.

#

In some cases it's actually worth it to chain inAreaArray calls with different distances.

#

probably not here, although it depends on typical player count/distribution.

#

BIS_fnc_nearestPosition could really do with an engine solution :P

south swan
#

Or just think about how frequently that search is performed and if it's rare enough - just write whatever and don't touch unless it creates a noticeable performance problems πŸ˜›

boreal parcel
# little raptor depends how many players there are

well it wouldnt be rare for players to be all over the map, there is 1 main ao that is 800 meters wide and then multiple sub objectives around the map. Currently the playercount is low around 5-10 a day but I would likely forget about this in the future so its better to do what is most performant now. I will attempt that, I see there is a "man" class I assume that will get players, but it will also get ai wont it? that could be an issue due to a constant large-ish number of ai on map

boreal parcel
# south swan Or just think about how frequently that search is performed and if it's rare eno...

in spawn code executed at the start of every AO

_units spawn {
    waitUntil { sleep 5; (count (_this select {alive _x})) < 25 };
    { 
        _x enableAI "PATH";
        private _nearestPlayer = [playableUnits, _x] call BIS_fnc_nearestPosition;
        if (_nearestPlayer distance2D _x <= 800) then {
            (group _x) addWaypoint [position _nearestPlayer, 10];
        } else {
            (group _x) addWaypoint [position _x, 10];
        };
    } forEach _this;
};
#

but it shouldnt execute till near the end of each main ao

hallow mortar
#

There is no classname that can only get players, because any unit class that could be a player could also be an AI. Player isn't a class, it's a state.

granite sky
#

Are these 1-unit groups?

hallow mortar
#

That is of course unless, as the mission designer, you know exactly what classes the playable units are, and specify those. That's very mission-specific though and not futureproof.

boreal parcel
south swan
#

Well, i'd say move the player search outside of forEach loop so ot is once per "ao" and not 25 times in a row and don't bother optimising that further πŸ˜›

granite sky
#

If you can check against AO position rather than unit position, sure.

little raptor
#

yeah for low player count it's not worth optimizing
also the code is not running in any "critical" place so that makes it even less worthwhile

boreal parcel
#

alright I understand, well ill fix the many waypoint issue and leave it for now

#

I think ill leave the player search in the for each loop though cause if I dont then all ai in the zone would go to one player, whereas now they should go to whichever player is nearest to them id hope

boreal parcel
#

hmm is it affecting performance alot to do the search?

#

its not a huge deal just thought it would be interesting to have the ai act like that

little raptor
south swan
#

25 searches without any sleeps are 25x more likely to cause a lag spike

boreal parcel
#

gotcha alright ill fix it

little raptor
south swan
#

Well, okay, i'm overexagerrating

granite sky
#

I'd be very careful with N-squared code in SQF, but if the worst case here is 25x10 and you're only running one of those at a time (not clear here) then it won't be a problem.

radiant siren
#

HELP WITH ropeCreate:

how to cut ropeCreate when it's a certain length and then destroy it? or just destroy it when it gets pulled at certain length?
mycode:
myRope = ropeCreate [cnn, "usti hlavne", player, "Righthand", 2, "usti hlavne", "RightHand", "Rope"];

round scroll
#

anyone got experience with dev build and Text/UI on Texture, as described as WIP in https://community.bistudio.com/wiki/Procedural_Textures ? Currently trying to add a LSO camera to the Nimitz and it has all kind of text info on the camera - Date, Time, Airspeed, Distance, Descent Rate, Deck Status, Carrier Number and Wind Over Deck. Some of this is static, but for example time of course changes every second. I wonder what's a good approach there, maybe make a UI out of it and then try #(rgb,Width,Height,MipCount)ui("DisplayClassName","UniqueName","texType") on the hiddenselection for the face in front of the camera?

round scroll
small dome
#

how could i assign a faction to independent forces?
i tried side=2; however upon loading the game the faction is still BLUFOR

hallow mortar
tough abyss
tough abyss
#

See if you need to evalulate certain things or could you reduce it in any possible way.

tough abyss
#

Why does bi, constantly add new commands that are basically almost the same functionality as others, then give them new names, when they do the same thing if not better? Why not just internally redesign the code to behave in the same manner?

granite sky
#

Example?

tough abyss
#

findif vs foreach etc

#

I am pretty sure I know why, backward compatibility?

#

So the new updates don't catastrophically break everything else?

#

For each could have been adapted to behave like findif

#

if you just did say.

{} foreach ["true"];

#

Things like that.

#

Or it could have been generalised to

#

{} forEach ["delete"];
{} forEach["Insert"];
etc?

granite sky
#

blinks

#

I have no idea what your syntax is supposed to do.

#

People used to use forEach as a findIf because there wasn't one, but it was hacky and slow.

tough abyss
#

well {_x] forEach ["operation",_array];

{_x} forEach ["delete",_array,_element];

#

Then again I can definitely see this getting out of hand and for brevitivity is probably why by BI never goes this route. Just food for thought.

#

My point is why create new commands when you could simply adapt existing ones? I mean as a scripting language ArmA 3 is very.... verbose?

#

over 2000+ different commands. Conventional scripting languages say powershell, or python, or even Ruby have neat and tidy limit on how many commands exist.

granite sky
#

Uh, because it's the API not the language.

tough abyss
#

Isn't the scripting language even if conditions also commands themselves?

granite sky
#

Yes, there's no distinction in SQF. But hence you can't compare the command count to general-purpose programming languages.

tough abyss
#

Fair enough.

tough abyss
#

The core actual "language" features of SQF aren't that verbose; you have your basic set of conditionals, loops, etc. that every language has, plus some SQF-ified equivalents of things like foreach and find/indexOf

#

95% of the verbosity of SQF is due to the fact that SQF also functions as the API for doing... almost everything in the game

#

hence it's necessary for there to be a command for almost everything, and generalizing it down to commands taking string inputs isn't exactly the cleanest way to go about handling it

#

imo bigger issue in my eyes in that the language still features a plethora of broken commands of varying usefulness, many of which it's uncertain will ever be fixed

royal spruce
#

does find work with two arrays?

warm hedge
#

In what sense?

royal spruce
#

let's say i have this array:
_testArray1 = ["AAA","BBB","CCC","DDD","EEE"];

with how find usually works, it'd return position 0 if I wanted to find "AAA"

i'm trying to do the same thing, but instead of a single string i want to find anything within another array, like this:

_testArray2 = ["BBB","EEE"];
and return 1

#

i tried

_testArray2 = ["BBB","EEE"];
_output = {_testArray1 find _x}forEach _testArray2;```
but unsurprisingly it didn't work and returned with 4
#

wait

open fractal
#

you're not storing the return for the first iteration so it's overwritten by the second one

royal spruce
#

am i stupid

open fractal
#

this can get you an array of indices

royal spruce
#

holy moly

#

actual lifesaver

tough abyss
#

@royal spruce there's also arrayIntersect :)

royal spruce
#

i would do arrayIntersect but i need the position of the search target in the array im looking in

tough abyss
#

ah, disregard then

tough abyss
#
Heli1 addAction ["open Jukebox", {
    _display = (findDisplay 46) createDisplay 'RscDisplayEmpty';

    _RscListbox_1500 = _display ctrlCreate ["RscListbox", 1500];
    _RscListbox_1500 ctrlSetPosition [13 * GUI_GRID_W + GUI_GRID_X, 6 * GUI_GRID_H + GUI_GRID_Y, 11.5 * GUI_GRID_W, 11.5 * GUI_GRID_H];
    _RscListbox_1500 ctrlCommit 0;
    _RscListbox_1500 = lbAdd ["Fortunate sun"];
    _RscListbox_1500 = lbAdd ["ride of the valkyries"];
    _RscListbox_1500 = lbAdd ["for what it's worth"];
    _RscListbox_1500 = lbAdd ["house of the rising sun"];
    _RscListbox_1500 = lbAdd ["i was only 19"];
    _RscListbox_1500 lbSetCurSel 0;

    _RscText_1000 = _display ctrlCreate ["RscText", 1000];
    _RscText_1000 ctrlSetText "Radio Jukebox";
    _RscText_1000 ctrlSetPosition [13.5 * GUI_GRID_W + GUI_GRID_X, 4.5 * GUI_GRID_H + GUI_GRID_Y, 11 * GUI_GRID_W, 1.5 * GUI_GRID_H];
    _RscText_1000 ctrlCommit 0;

    _RscButton_1600 = _display ctrlCreate ["RscButton", 1600];
    _RscButton_1600 ctrlSetPosition [13 * GUI_GRID_W + GUI_GRID_X, 17.5 * GUI_GRID_H + GUI_GRID_Y, 11.5 * GUI_GRID_W, 1.5 * GUI_GRID_H];
    _RscButton_1600 ctrlCommit 0;
    _RscButton_1600 ctrlAddEventHandler["ButtonClick",{
        params ["_control"];
        _display = ctrlParent _control;
        _listBox = _display displayCtrl 1500;
        _index = lbCurSel _listBox;
        systemChat format['Song is: %1',_listBox lbText _index];
        playSound3D ["", Heli1];
    }]
}];
```giving me an error undefined variable at  ```#[13.5 * GUI_GRID_W + GUI_GRID_X, 4.5 * GUI_GRID_H + ```
#

have i messed up the gui?

winter rose
#

no, the vars are just not defined

hallow mortar
#

setPylonLoadout is local effect. If a player JIPs, will they see the vehicle's default config loadout, or the vehicle's loadout as the server sees it?
If they see the default loadout, what's a good way of applying setPylonLoadout for JIP clients so that they see the current loadout (i.e. minus expended ammunition) rather than the initial full load?

hallow mortar
#

Well, I had a look at some previous discussion and it seems like the answer is "JIP gets the server configuration". Here's hopin'.

proven charm
granite sky
#

Why it's a local-effect command in the first place is baffling to me.

hallow mortar
#

My guess would be "designed for SP, didn't think about MP"

ocean folio
#

is there some way that vehicle wrecks differ to vehicles as an object? I'm trying to find a way to get Enhanced Sling Loading to let me attach ropes to a wreck. it recognizes that I can, but then the ropes just get dropped when I actually hit the button

warm vapor
#

Question: In terms of performance, how expensive is this operation.

Every n seconds, iterate through 300-400 AI, and disable their path ability

#

It's a somewhat crude solution, but I can't think of any better way to ensure that AI transferred to headless keep their disabled path trait

#

Like, if I ran that every 5 seconds, how much is that going to suck

kindred zephyr
warm vapor
#

@kindred zephyr

Not entirely sure how to do that. Even if I set ownership as part of unit init, I'm still transferring it aren't I? I know I could run a spawn script as part of the headless client's init.sqf, but given the number of AI and how precisely they are all placed, I'm not sure how practical it is to do that.

We use Zulu Headless Client to transfer things, but obviously we wouldn't know when the AI transfers as it does balancing over time. That was why my hope was to iterate through and just keep disabling pathing to account for rebalancing.

The mission takes place in a massive interior. A lot of units have fixed positions, and if they wander around for more than a second, they'll probably clip through the floor or walk through a wall, etc

kindred zephyr
# warm vapor <@381655357551804426> Not entirely sure how to do that. Even if I set ownershi...

are these enemies being constantly spawn in? or just a one time spawn thing?

Dont do work in units inits, or atleast create them and then execute whatever you want the unit to execute when creating them instead of doing it by default.
Depending on third party tools is never great unless they are properly documented anyway.

If the units must not move even for a sec, its better if you create them and immediately disable their pathing AI, as locality transfer and how quick will the AI be disabled is not guaranteed as it depends on both bandwith and processing speed.

Its better if you prepare a script that precisely do what you want directly over HC, at least it seems much more convenient that constantly checking if the AI has pathing disabled.

edit: For 400 units, are you fighting them all at the same time too? Or are they just there standing waiting their turn for engagement? If this is the case, you might have a mission design issue then because having 400 AI doing nothing at all time even transfered its not good.

hallow mortar
#

400 AI is a lot. You should look into some kind of dynamic spawning or at very least aggressive caching. I accidentally put 400 AI in a mission recently and that was causing a sFPS crunch even before they went active (don't worry, that version never went to the live server...).

kindred zephyr
#

^ once you figure out how you want to spawn you units instead of preplacing them, just remote execute to the HC

formal stirrup
#

So im trying to create a unit by an action, Give the player control of them, then by another action delete the unit and then go back to controling the actual player.

I have it good up to the going back to the player part, For some reason it switches my camera back correctly but it wont give me control, any idea?

this addAction ["Control a Hunter", { 
    params ["_caller"]; 
 
 
"WBK_HunterSynth_1" createUnit [position hunter_pad1, group player, "hunter = this"]; 
 
player remoteControl hunter; 
 
hunter switchCamera "Internal"; 
 
removeAllActions hunter; 
 
 
hunter addAction ["Exit the hunter", { 
 
selectPlayer kilo1; 
removeAllActions hunter;
player switchCamera "Internal"; 
 
objNull remoteControl player; 
deleteVehicle hunter; 
 
}]; 
 
}];
kindred zephyr
south swan
#

also, objNull remoteControl player;? What?

formal stirrup
formal stirrup
south swan
formal stirrup
#

Holy crap im stupid

#

thank you so much

#

not sure why my brain didnt click

kindred zephyr
#

^ its most likely that by using objNull as the left side parameter you cancel the remoteControl