#arma3_scripting

1 messages · Page 145 of 1

exotic gyro
#

You'd have to make a mod that fixes the modded building, basically

mossy dove
#

ah i understand. we just thought about including a eventhandler.

#

i will ask there. maybe thats a little better then working with eventhandlers

last tapir
#

anyone? Up!1

winter rose
#

no workaround for sides

last tapir
#

so its not possible to create groups that are full hostile to eveyone?

last tapir
winter rose
#

the closest you can get is resistance hostile to everyone but civilians

last tapir
winter rose
#

wat

last tapir
#

like, if i create a group like _grp1 = create group blabla "resistence hostile", _grp2 = create group blabla "resistence hostile"

#

fill them up with units

winter rose
#

they will fight together

last tapir
#

hmpf

winter rose
#

not one against each other

#

as I said, don't think about it, it's a (known) limitation

last tapir
#

ok, that resistence hostile is what GUER? as side?

undone flower
#

side independent returns "GUER"

#

afaik

winter rose
#

independent is resistance is guer

last tapir
# undone flower afaik

what is this? i am not familiar with the term, and its like the 10th time that i saw this

last tapir
winter rose
#

what? no

#

west is west, east is east, resistance is resistance
the editor allows you to set resistance's friendliness, it can be to everyone, west only, east only, or no one

kindred zephyr
last tapir
winter rose
kindred zephyr
#

you could imagine i was surprised when a 9 man squad began swiss cheesing a barn in chernarus

hallow mortar
# last tapir so its the same as using GUER setFriendly [east,0]?

You can't actually use "GUER" for stuff because "GUER" is just the string representation of the Side data type returned by the independent and resistance commands. It's the human-readable representation of a non-human-readable data entity, and the engine doesn't use it itself.

#

Like "GUER" == resistance will return false, because one is a String and one is a Side

winter rose
#
str resistance == "GUER" //yes
last tapir
#

awesome. thanks!

last tapir
wooden moss
#

I am trying to write a function that disables simulation for an entire layer. Initially I was gonna write a function for every single layer but I thought that the code should at least be a little clean, so I tried writing one single function that takes in parameters.
However, it seems like I don't get how function parameters work since I can't get this script to work.

The error I get is something like "Expected Number, got string".
Can I get some help with this?

maroPeople = (getMissionLayerEntities "MaroPeople") select 0;
artillery = (getMissionLayerEntities "Artillery Position") select 0;

MY_fnc_disableUnits = {
  param ["_toDisable"];
  _removeArray = _toDisable;
  sleep 10;
{
  _x enableSimulationGlobal false;
} forEach _removeArray;

};
[maroPeople] call MY_fnc_disableUnits;
[artillery] call MY_fnc_disableUnits;
#

(Everything has been Frankensteined out of the wiki pages.)

#

Oh, also, I removed this useless part that I tried to use as a solution. Line 10 is just forEach _toDisable; now.

_removeArray = _toDisable;

hallow mortar
#

param and params are different. You've used params syntax with param.

wooden moss
#

Oh my god

#

I didn't look what autofill corrected it to

#

Thank you

hallow mortar
#

Just change it to params and you should be fine

#

Make sure this script only runs on the server btw - getMissionLayerEntities and enableSimulationGlobal only work on the server.

wooden moss
#

This actually runs on init.sqf, does that run on clients too? If so, is there a way to not do that?

hallow mortar
#

init.sqf runs on all machines during mission initialistion, or when they join if it's a JIP client

#

You could move it to initServer.sqf to run only on the server, or use an if isServer then { ... }; or if !isServer exitWith{}; check if you'd prefer to keep it here for organisation.

wooden moss
#

Thanks a lot

exotic flame
#

Is there a way to change an object direction without resetting velocity ?

undone flower
#

i'm looking to use images in my structured text hints. are there any resources for icons/images I can use?

dim elk
#

Not sure which to put this in exactly, trying to set up a HC on my VPS, IPs is defined correctly along with battlEye license in my server.cfg, but for some reason when I launch my .bat file and the HC tries to connect to my server it says it tries to load content that's been deleted and shtufff. But In my .bat file I feel like I made it load mods correctly:

@echo off

start /min "" "C:\arma\arma\arma3server_x64.exe"^
 -profiles="C:\arma\arma\Arma 3 Server\Profiles"^
 -client^
 -connect=127.0.0.1^
 -port=2302^
 -password=****^
 "-Mod=C:\AllMyMods\@ace;C:\AllMyMods\@Hatchet H-60 pack - Stable Version;C:\AllMyMods\@Hatchet Framework - Stable Version;C:\AllMyMods\@ACE3 Arsenal Extended - Core;C:\AllMyMods\@ALiVE;C:\AllMyMods\@CBA_A3;C:\AllMyMods\@CUP Terrains - Core;C:\AllMyMods\@DSqn - Effects;C:\AllMyMods\@DSqn - Functions;C:\AllMyMods\@"DSqn- Gear;C:\AllMyMods\@DSqn - Maps;C:\AllMyMods\@Dsqn - Objects;C:\AllMyMods\@DSqn - Units;C:\AllMyMods\@DSqn - Vehicles;C:\AllMyMods\@Dsqn - Weapons;C:\AllMyMods\@KAT - Advanced Medical; C:\AllMyMods\@RHSAFRF;C:\AllMyMods\@RHSGREF;C:\AllMyMods\@RHSSAF;C:\AllMyMods\@RHSUSAF;C:\AllMyMods\@Task Force Arrowhead Radio (BETA!!!);C:\AllMyMods\@USAF Mod - Main;C:\AllMyMods\@USAF Mod - Utility"
Exit
#

my server and HC are both run on the same VPS if what

dim elk
#

Ok, fixed it, current .bat file looks like this for anyone in the fututre to reference:

start /min "" "C:\arma\arma\arma3server_x64.exe" -client -connect=127.0.0.1 -port=2302 -password=SFOD "-mod=C:\AllMyMods\@ALiVE;C:\AllMyMods\@DSqn - Maps;C:\AllMyMods\@USAF Mod - Utility;C:\AllMyMods\@USAF Mod - Main;C:\AllMyMods\@Task Force Arrowhead Radio (BETA!!!);C:\AllMyMods\@RHSUSAF;C:\AllMyMods\@RHSSAF;C:\AllMyMods\@RHSGREF;C:\AllMyMods\@RHSAFRF;C:\AllMyMods\@KAT - Advanced Medical;C:\AllMyMods\@Hatchet H-60 pack - Stable Version;C:\AllMyMods\@Hatchet Framework - Stable Version;C:\AllMyMods\@DSqn - Weapons;C:\AllMyMods\@DSqn - Vehicles;C:\AllMyMods\@DSqn - Units;C:\AllMyMods\@DSqn - Objects;C:\AllMyMods\@DSqn - Gear;C:\AllMyMods\@DSqn - Functions;C:\AllMyMods\@DSqn - Effects;C:\AllMyMods\@CUP Terrains - Core;C:\AllMyMods\@CBA_A3;C:\AllMyMods\@ACE3 Arsenal Extended - Core;C:\AllMyMods\@ace"

ornate whale
#

What would be the faster way to send data to the server, which should then be saved in an object's namespace?

  1. _unit setVariable ["myVarName", _value, 2];
  2. [_unit, _value] remoteExecCall ["TAG_fnc_updateMyVar",2];
  3. any other?

I want to use it to keep track of the current weapon and ammo type of a player. Other real-time mechanics executed on the server depend on this information, so the faster the better. Unfortunately, I did not find any effective, purely server-side solution. Therefore, I register the change on the client and then distribute it to the server.

The only options I have are to either do all the computation on the client and then send the result, or notify the server and do the computation there. I'm not sure which configuration will yield the best results. Either way, I will have to send a message, and I am not sure which of the the two commands is better.

Thank you.

granite sky
#

I'd hope that setVariable was slightly better because it's not sending an array, but only BI would know.

bold comet
#

when using nearObjects, is there a way to differentiate buildings from the world vs buildings created by the mission ?

edgy dune
#

does anyone have the documentation on Extended_PostInit_EventHandlers vs Extended_InitPost_EventHandlers I cant seem for the life of me find it

candid sun
fair drum
edgy dune
# fair drum As far as setting them up? Or when the fire?

I when they fire, I am tryning to add a CBA EH on mission start so I have it added on Extended_PostInit_EventHandlers. But because I think the main menu has a mission file in the background when I get into an actual mission (lets say ace arsenal or virtual arsenal) the PFH isnt running anymore (it also isnt added twice since I check with get/setvariable if its already been added to prevent duplicate PFH from being added, so maybe thats not needed)

#

actually let me more simply state my goal, I want to add only 1 PFH on the start of a mission, whats the reccomended way of adding it?

bold comet
#

thanks, i'll give it a try

opal zephyr
last tapir
#

hey guys! quick question for me to check if a array is only filled with string types would this do the trick?
if (_lootValues isEqualType [""])

#

i know that this:
if (_lootValues isEqualType [])
validates if the variable is a array, but i need to check if it is a array with a bunch of random types or just strings

#

in this case, just class names

bold comet
#

works perfectly

#

I just added ( getObjectType _x >= 8 ) everywhere and my scripts stop reacting to world stuff

#

thanks a bunch

candid sun
#

nice nice, i noticed that command the other day, had been waiting for a chance to use it somewhere :)

bold comet
#

:p

#

I have a FOB building module that uses buildings from the world, so I could interact with every cargo house on the map

ornate whale
meager granite
#

_x isEqualType "" is modern approach

last tapir
meager granite
last tapir
#

OH

meager granite
last tapir
#

got it

meager granite
#

You want your array to have strings and arrays containing strings but no other types?

last tapir
#

i need to check how is the array constructed. because its a function that spawns loot in DMS. i need for this part that i am working with, i want it to spawn a static loot crate instead of the random that it already do

#

so, its a new format that i am trying

edgy dune
little raptor
#

Try lodIndex 1 or others too

#

Also lods 0 and 1 (and other vis lods) are only loaded when the unit is visible afaik

meager granite
#

Works for memory LOD (index=9)

meager granite
#

Wish there was more options for ARRAY find ELEMENT, like starting search from index, reverse search, etc.

#

ARRAY find [ELEMENT, INDEX, INCREMENTING]

#

For findIf too

#

Sure there is for with any indexes you want, but its my muh microseconds moment again

meager granite
#

Is there a reliable way to tell if vehicle is "out"?

#

Drones and statics can be checked with !isNull objectParent, what about other entities?

#

Gear containers too

#

ENTITY in vehicles sort of works, but what if entity is not that list

#

Wondering if there is a reliable way for everything

opal zephyr
sturdy prairie
#

Hey, I had a horrible idea and I'd like to see if it's feasible at all before diving deeper.
I want to see if I can repurpose the Futura's railgun and make a Handheld railgun-like weapon.
I saw that the tank uses a normal cannon and a placeholder one for its script, since we can only hold one weapon at a time as characters, would I have to completely rewrite the script or is there some possibility of using the Futura's?

little raptor
#

One takes LOD resolution, the other takes LOD index

#

So try a different index

undone flower
#

if there's no player in hearing range of a falling tree, does it make a sound?

opal zephyr
opal zephyr
little raptor
#

Also what about non-render version? (Render flag false)

little raptor
#

So I checked the source code. Both syntaxes use the same code except the binary version is always render scope (and it converts the lod res to lod index like the unary syntax)

#

So there's no way that only the unary version is broken

#

If that's broken the binary version should be broken too

little raptor
#

I just tested it for myself. It seems that only proxies work in res LODs which is weird (proxies use a different code tho)

#

I guess it's worth making a ticket. Something is probably broken (it's probably always been like this tho. it wasn't broken recently)

opal zephyr
#

Thanks for testing it Leopard!

undone flower
#

how do I know if a player's currentThrowable is actually a lethal grenade?

#

(with support for mods)

last tapir
#

hey, how is everyone going?!

so i am using one of these cup bad boys for a custom mission that gets dynamically spawned in my server:

#

but i noted a problem where sometimes the terrain does not help a lot and it starts flickering and some times is sent flying in the air killing the nearby ai

#

i tried disabling simulation, but that also stop the AI from using its m135 (this heli is a static machine gun)

#

this problem sometimes happens with other static guns that spawn around it as well

#

is there a way to only disable physics of a static machine gun to lock it in place without disabling it for usage?

#

basically make the vehicle stuck and not been able to move, but preserve its attributes

#

M134*

hallow mortar
#

You could attach it to something

tough abyss
#

@moses it doesn't the keydown keyup handlers are not 100% reliable.

last tapir
#

🤔

#

that could be a way...

tough abyss
#

Also, actionKeys can be tricked by rebinding vault to 2xv

last tapir
# hallow mortar You could attach it to something

i am just thinking on how i would do that since the objects are spawned dynamically and dont have variable names.... i would need to code a bit for that, but would definitely do it, maybe i could script the mg spawn script to also create a small object below it and attach it. Just to be sure... attach does not mean it needs to be touching right? i could spawn one prop like, 20m below it and attach right?

#

a prop without simulation

tough abyss
#

If it works for the average player then fine, but I would still be able to vault, just saying ; )

last tapir
#

also, if i create a object and attach it to other object without passing offset, both keep their positions right?

oblique current
#

Hi, I've got a "generic expression error (line 26 is flagged)" ` However, I've spent hours searching and still can't figure out why. Any help please? I've attached the script.

warm hedge
#

Can you tell the EXACT error message?

oblique current
#

Here it is

warm hedge
#

What is _rider?

#

More like what is _this?

oblique current
#

Should be the unit which the function is attached to. In this case the vehicle (I think)

warm hedge
#

What exactly it is?

#

What is passed into this script?

oblique current
#

it has zero prams. This is how I call it within an eventHandler [] call Rider_LanceAttack; I assume _this would be the unit the handler is attached to

warm hedge
#

So _this is nil?

last tapir
# oblique current Here it is

seems like it is not liking what are you trying to compare with _rider, try logging what _x is each time to see if is compatible, you might need to use isTypeOf before

oblique current
oblique current
#

@warm hedge Thanks. I'll make some tweaks with your input.

ornate whale
#

I don´t get why the init order seems to change randomly sometimes. I feel like the game tries to troll me.

#

I expect it to run like initServer, initPlayerLocal, initPlayerServer, onRespawnPlayer. But it changes wildly from time to time.

#

And it is not just when I switch from SP to MP (there is difference), but sometimes even when I just restart the mission.

little raptor
undone flower
undone flower
#

now I need to remove a single grenade from the unit's inventory

#

removeMagazine seems to have the side effect of making the grenade unselectable until it is moved using the inventory

fair drum
#

for example, a section in initPlayerLocal.sqf:

waitUntil {
    private _index = [
        "variable_1",
        "variable_2",
        "variable_3"
    ] findIf {isNil _x};
    diag_log format["Public Variable [%1] not populated...", _index];
    _index == -1;
};

// Yay all the stuff is populated, lets continue!
undone flower
#

or is this a BIS problem?

hallow mortar
last tapir
#

@hallow mortar will "attachTo" remove the object collision? 🧐

#

what i am doing is, instead of just spawning the HMG in its position, i am spawning a brick in the same position but with Z -20

#

and i will attach the HMG to the brick

#

but i am worried that it can disable the HMG colision with the player

#

any info on that?

#

i mean... i prefere the no colision then a buggy HMG but... its not ideal :/

hallow mortar
last tapir
#

yeap, i just wanted to get a little ahead before coding

#

hehe

#

but i am already doing it

hallow mortar
last tapir
#

wiki dont say anything about collision, i guess i will have to try

hallow mortar
#

I have previously attached things and had them retain their collision; other times different objects have been less consistent. So I can't give you a solid answer, try it with your particular object.

#

You don't have to try it in your full mission if that's inconvenient because of mission mechanics - this is a simple test that can be done in an empty VR mission.

last tapir
#

@hallow mortar it worked awesomely!

#

thanks for remebering me of attachTo command

last tapir
#

this worked so well that i honestly i dont know why DMS was not done like this since day 1

opal zephyr
#

Anyone here good with vector math? I'm trying to have an object, an arrow in this case, follow another objects up and dir vectors while maintaining its initial offset in said vectors.
My test case is two arrows, one vertical and the other perpendicular to it. I am trying to make the arrow that perpendicular stay perpendicular when the vertical arrow tilts.

This is the code I'm trying:

_c1VectorDir = vectorDir c1;
_c1VectorUp = vectorUp c1;

_c2VectorDir = vectorDir c2;
_c2VectorUp = vectorUp c2;


_newUpVector = _c1VectorUp vectorDiff _c2VectorUp;

c2 setVectorDirAndUp [_newUpVector, _c2VectorDir];

c1 is the vertical arrow and c2 is the perpendicular one.

The current result is that c2's up direction changes on every run of the code in a seemingly random direction..

stuck palm
#

I’m using Larrows Eden composition spawning script to spawn in compositions (fobs). I have it set up to create a trigger and set the terrain height inside the trigger to the height of the trigger. Seems ok, but is there a way to “smooth” the terrain in say a 100m radius so that the transition isn’t as obvious?

Just looking for some pointers on how I might go about this

south swan
# opal zephyr Anyone here good with vector math? I'm trying to have an object, an arrow in thi...

For vector-y approach, this can probably work (or not) ```sqf
_localDir = c1 vectorWorldToModel (vectorDir c2);
_localUp = c1 vectorWorldToModel (vectorUp c2);
MEME_localDirAndUp = [_localDir, _localUp];
// following would need to run every frame or whatever
c2 setVectorDirAndUp
[
c1 vectorModelToWorld MEME_localDirAndUp#0,
c1 vectorModelToWorld MEME_localDirAndUp#1
];

Dumb and easy way would be to spawn a logic at c2's location, sync its rotation with c1, `attachTo` c2 to it sync logic rotation to c1's afterwards. And probably faster, as i suspect attachment would be processed engine-side 🤷‍♂️
fair drum
south swan
#

like "further modify the terrain mesh", probably. There's "set the terrain height inside the trigger to the height of the trigger" part already :3

stuck palm
# fair drum you mean like modify the terrain mesh?

Not quite there with the vernacular. Just basically using some maths to calculate setTerrainHeight for a radius outside the trigger.

Something like get terrain height in area triggernname. Then get the terrain height for each “grid” (I think there is get terrain info), for each outer “grid” and step level the terrain in between to slope and match.

Basically would make placing bases and other compositions a breeze.

Sorry if that doesn’t make sense.

Here’s a trigger that sets the terrain height. Not at home, but I’ve modified this to basically set the terrain height to the trigger height.

https://www.reddit.com/r/armadev/s/lCCYkxzAnY

What I want to do is slope the surrounding area terrain height up or down from around 50 or 100m out to the trigger, so that the height transitions look more natural.

Reddit

Explore this post and more from the armadev community

warm hedge
#

So clarify, you want to flatten a place, and make the gap smooth so there won't be a noticeable "gap"?

sullen trellis
#
_sounds = ["sellervoice1","sellervoice2"];
fr1 say3D [(selectrandom _sounds), 15, 5, 0, 0, true];

it gives an error 6 elements provided 1 expected
though i copied the example from the website and just changed some of it what am i missing?

warm hedge
#

What is fr1?

sullen trellis
# warm hedge What is `fr1`?

its the unit name

fr1 say3d (selectrandom ["sellervoice1","sellervoice2"]);

this works, but the previous one i sent doesnt work, im trying to get more options for the sound

stuck palm
warm hedge
south swan
#

linear conversion of distance between square inside and round outside doesn't sound exactly simple, though 🤣

stuck palm
#

Trigger will be square. I just threw something up as an example

warm hedge
#

Converting square into sphere is the most complicated thing if that's the case, yes

stuck palm
#

Don’t think I’d need to do that. It’s fine with a square trigger and square surrounding area.

south swan
#

strictly square, not rectangle?

sullen trellis
warm hedge
#

So 2.16?

sullen trellis
warm hedge
#

That means you can't have the last argument you use there

sullen trellis
#

so say3d was updated long ago im assuming

warm hedge
#

Read BIKI. The last argument is only added 2.18

south swan
#

(and 2.18 is in the future)

stuck palm
sullen trellis
warm hedge
# stuck palm Not so much a gap, but if you raise terrain or lower it in an area, I want to fi...
_r = [] ;
triggerArea trig params ["_trigX","_trigY"] ;
_pos = getPosWorld trig ;
_grid = getTerrainInfo#2 ;
_diag = sqrt ((_trigX^2) + (_trigY^2)) ;

for "_xx" from -(_trigX*3) to _trigX*3 step _grid do {
    for "_yy" from -(_trigY*3) to _trigY*3 step _grid do {
        if ((abs _xx > _trigX) or (abs _yy > _trigY)) then {
            private _posLocal = [_pos#0 + _xx,_pos#1 + _yy] ;
            _r pushBack [
                _pos#0 + _xx,_pos#1 + _yy,
                linearConversion [
                    _diag,_diag*1.5,
                    trig distance2D _posLocal,
                    60,
                    getTerrainHeightASL _posLocal,
                    true
                ]
            ] ;
        } else {
            _r pushBack [_pos#0 + _xx,_pos#1 + _yy,60] ;
        } ;
    } ;
} ;

setTerrainHeight [_r]```Definitely not perfect but my idea is somewhat this
warm hedge
#

It's very janky so it may not match to the actual dimension, but the math itself is not complicated so you can guess

south swan
#

that... looks like it's going for circles around the square trigger?

warm hedge
#

Yes

south swan
#

well, for square-ish square you can possibly go for linearConversion [_trigX, _trigX + 100, (abs _yy) max (abs _xx), ... (assuming _trigX and _trigY are equal) 🤔

warm hedge
#

I spend no effort there 😄

#

Oh stupid Ctrl+H did it

south swan
#

inb4 smoothstep

south swan
stuck palm
#

No worries. I’m about to leave work and will mess with it as soon as I get home

stuck palm
#

Both versions work great. Thanks @warm hedge and @south swan

undone flower
#

my code literally works because of an unintended oversight

#

"this isn't supposed to work, but it does"

#

I love programming,.........................

south swan
#

"we call them happy little accidents" BobRoss.jpg

exotic flame
stuck palm
south swan
#

wat

stuck palm
#

I assume there's come variances in positions. Seemed to work in VR, less so in Altis.

  
  _logicPos = getPosWorld _logic;

    diag_log format ["_logicPos %1", _logicPos];

     //Create trigger to flatten terrain on the logic entity.
    _flattenTrigger = createTrigger ["EmptyDetector", _logicPos];
    _flattenTriggerSize = [100, 100, 0, true, 1]; 
    _flattenTrigger setTriggerArea _flattenTriggerSize;
    
    _r = [] ;
    triggerArea _flattenTrigger params ["_trigX","_trigY"] ;
    _pos = getPosWorld _flattenTrigger;
    _grid = getTerrainInfo#2 ;
    _diag = sqrt ((_trigX^2) + (_trigY^2)) ;

    for "_xx" from -(_trigX*3) to _trigX*3 step _grid do {
        for "_yy" from -(_trigY*3) to _trigY*3 step _grid do {
            if ((abs _xx > _trigX) or (abs _yy > _trigY)) then {
                private _posLocal = [_pos#0 + _xx,_pos#1 + _yy] ;
                _r pushBack [
                    _pos#0 + _xx,_pos#1 + _yy,
                    linearConversion [
                        _diag,_diag*1.5,
                        _flattenTrigger distance2D _posLocal,
                        60,
                        getTerrainHeightASL _posLocal,
                        true
                    ]
            ] ;
        } else {
            _r pushBack [_pos#0 + _xx,_pos#1 + _yy,60] ;
        } ;
    } ;
} ;


    setTerrainHeight [_r, false];

Figured since I am creating a trigger at the logic worldpos, it'd be consistent. Instead the terrain either envelopes the base or is meters under it.

south swan
#

terrain goes to 60, because 60 is listed in the code 🤷‍♂️

stuck palm
#

_flattenTrigger distance2D _posLocal,
60,

and
_r pushBack [_pos#0 + _xx,_pos#1 + _yy,60] ;

?

south swan
#

yes

stuck palm
#

Ah, I was trying to flatten it to the height of the trigger as well.

undone flower
#

download soon, however still debating if I should do the grenade workaround

#

if anyone has questions on how I made the mod feel free to ask

stuck palm
#

I think I got it.

_logicPos = getPosWorld _logic;
_zOffsetLogicPos = (_logicPos select 2) - 2.357;

//...

 linearConversion [
  _diag,_diag*1.5,
  _flattenTrigger distance2D _posLocal,
  _zOffsetLogicPos,
  getTerrainHeightASL _posLocal,
  true
  ]
//...
_r pushBack [_pos#0 + _xx,_pos#1 + _yy, _zOffsetLogicPos] ;

seems to work

opal zephyr
south swan
opal zephyr
#

@south swan Do you happen to know how to do the same thing but with a provided vectorDir and vectorUp instead of an object? For example instead of using c1 as an object, can we use it as a set of vectors? This would lose out on the currently used "vectorWorldToModel" function

#

I guess what Im asking, is how does Bi's vectorWorldToModel function actually works, since I want to provide my own position and vectors instead of using an object

little raptor
#

The equivalent of VectorModelToWorld in SQF is essentially this:

_vx = _vy vectorCrossProduct _vz;
_mat = matrixTranspose [_vx, _vy, _vz];
flatten (_mat matrixMultiply (_modelVector apply {[_x]})

_vy and _vz are vectorDir and vectorUp, respectively

little raptor
#

(assuming the vectors are normalized and perpendicular, otherwise you have to compute the inverse of _mat)

little raptor
opal zephyr
#

what are the _vx/y/z's? Are they vectors in just that direction?

little raptor
#

3 perpendicular world vectors

#

Like vectorSide,vectorDir,vectorUp

opal zephyr
#

ahhh

#

ok

#

ill give it a try without the transpose then, thankyou!

south swan
little raptor
#

Yeah that works too

#

And for vectorWorldToModel it's:

// _obj vectorWorldToModel _worldVec
// assuming the object is not scaled/skewed
_vx = vectorSide _obj;
_vy = vectorDir _obj;
_vz = vectorUp _obj;
[
 _vx vectorDotProduct _worldVec,
 _vy vectorDotProduct _worldVec,
 _vz vectorDotProduct _worldVec
]
little raptor
south swan
#

Oops

#

Anyways, i'd argue it's the worldToModel part that's the most interesting out there

#

With calculating the inverse transform matrix and stuff

little raptor
#

You don't really need inverse if object is not scaled and skewed

little raptor
opal zephyr
little raptor
south swan
#

ah, good old "just project onto basis vectors, lol". Sheesh, i was trained at that half my life ago (but even then i wasn't good)

opal zephyr
#

You both have been INCREDIBLY helpful, I've been stuck on this for way too long. Thankyou thankyou thankyou

rocky cairn
#

Anyone know if with ACRE2 it's possible to set 2 groups in the same faction to different channels by default

indigo snow
#

"by default"

#

there are functions that influence what channel a radio is on

rocky cairn
#

Do you happen to know what these functions are?

indigo snow
#

Here's the API

ripe sapphire
#

nice this works

#
onLoad = "_this select 0 ctrlSetURL 'http://arma3.com/';";
#

so this config parameter works but it only works on the second and subsequent clicks

#

the first click only adds the url

#

it only opens browser after the 2nd click

warm hedge
#

If you want to open it without any user input, there is a way to force click a button

#

I forgot but recently mentioned here

wind hull
#

hey im new to the game anyone have a discord server i can join

ripe sapphire
#

but it doesnt open the link still

#

i think it doesnt work because the command doesnt activate the button action and UI event handling

#

the alternative syntax to simulate full button action is not implemented until 2.18 so will have to wait to test that one i guess

drifting sky
#

I can't force the ai to throw a grenade using any method that used to work. Anyone know any way that still works?

#

I only need him to actually fire, doesn't matter at what or in what direction

granite sky
#

forceWeaponFire works.

#

bit of a pain digging up the right muzzle given a grenade magazine.

drifting sky
#

None of these work any longer:

                [_unit, "HandGrenadeMuzzle"] call BIS_fnc_fire; 
                _unit forceWeaponFire ["HandGrenadeMuzzle","HandGrenadeMuzzle"];
                
                _unit fire ["HandGrenadeMuzzle", "HandGrenadeMuzzle", _magazine];
                _unit fire "HandGrenadeMuzzle";

The first one,
[_unit, "HandGrenadeMuzzle"] call BIS_fnc_fire;
Was working fine and was what I was using, until it stopped working some weeks ago.

granite sky
#

Are you sure that's the right muzzle for your grenade?

drifting sky
#

Pretty sure. It was working before.

hallow mortar
#

Are you on perf or dev branch? The last update to main branch was...more than some weeks ago.

drifting sky
#

Hmm.... seems to be something wrong specifically with CUP hand grenades

#

maybe it was a CUP update that broke them

granite sky
#

uh, CUP hand grenades don't use HandGrenadeMuzzle.

#

Every grenade magazine has a different muzzle.

#

Look at CfgWeapons >> Throw

drifting sky
#

huh, that's weird, the generic HandGrenadeMuzzle used to work for cup grenades of all types

granite sky
#

It's not even supposed to work with all vanilla grenades.

#

Like the RGN uses MiniGrenadeMuzzle.

#

smokes have a different muzzle for each colour.

drifting sky
#

I guess I was thrown off by a lucky glitch that must have been fixed at some point

hallow mortar
meager granite
#
ENTITY stopVariablesReplication ARRAY;
player stopVariablesReplication ["var1", "var2"];
player setVariable ["var1", 123];
forceRespawn player;
...
player getVariable "var1"; // nil
spring stone
#

Can I somehow change the values of the new stamina system? Like for example how weight influences the stamina? I don't want to turn it off...I just want to change it to my needs!

meager mist
#

I have 2 part question.. I have a script that makes a bunch of prisoners follow a player whoever steps into a trigger first. Works fine, but 1. I would want them to go into the helicopter naturally via waypoint and not instant with moveInCargo. I tried adding setWaypoint and setWaypointType but that didn't seem to do the trick :/ then 2. after the prisoners are extracted I would want them to get out of the helicopter via waypoint too, to just naturally get them out instead of instant.

Here's the script

params ["_prisoners"];

// Make the given group of prisoners follow the player and get into a nearby helicopter
while {true} do {
    {
        private _prisoner = _x;
        private _nearbyHelicopters = nearestObjects [player, ["Air"], 6]; // Find helicopters within 5 meters of the player

        if (count _nearbyHelicopters > 0) then {
            private _helicopter = _nearbyHelicopters select 0; // Select the nearest helicopter
            _prisoner doMove (position _helicopter); // Move the AI to the helicopter's position

            // Wait until the prisoner is within 5 meters of the helicopter
            waitUntil {sleep 1; _prisoner distance _helicopter < 6};

            // Add a small delay before getting into the helicopter
            sleep 2;

            // Get into the helicopter
            _prisoner assignAsCargo _helicopter;
            _prisoner moveInCargo _helicopter;
        } else {
            _prisoner doMove (position player); // Move the AI to the player's position
        };
    } forEach _prisoners;
    sleep 1; // Wait for 1 second before repeating the loop
};
#

I have my triggers and prison groups (in total there will be 4) set up in a BEAR_postInit.sqf

meager mist
#

Ah, is the difference between moveInCargo and orderGetIn that the latter is acting like how AI would move with a waypoint?

meager granite
#

moveIn* are instant commands

warm hedge
#

Being inside of a vehicle does not always mean the group leader wants to let him in, too

south swan
#

only sending the prisoner to the heli position once seems like it's prone to break if the heli moves a bit. Especially when the entire group's brain is halted in waitUntil until that one prisoner gets close to the heli

candid sun
spring stone
#

So these are values I can actually change: "staminaDuration" ... "maxSoldierLoad"?

late drum
#

Hi! Does anyone know how I can make RscText text bold or change the font size? At the moment I managed to center the text using style = ST_CENTER;?

little raptor
#

font size is the sizeEx property

#

You can't make it bold tho

#

You have to change the font

south swan
#

or go RscStructuredText, probably

little raptor
#

List of available fonts. Either use those or make your own font (which is too much hassle)

late drum
#

Okay, tysm

indigo snow
#

mod? yes. mission? no.

meager granite
#
18:36:29 ["174360","playerRespawnTime","0"]
18:36:29 Respawn failed - body disappeared
18:36:29 ["174361","playerRespawnTime","1999998"]
#

After I did setPlayerRespawnTime 0;

kindred lichen
#

You can write a stamina script to constantly deal with stamina. R34per's missions all have a stamina script which stretches your stamina pool.

#

You'd need something that'll check you're stamina delta and then reduce or enlarge it.

ripe sapphire
#

Yo bros is it possible to trigger an inputAction via script?

opal zephyr
#

Not that I know of, but you can normally emulate the desired effect through script

ornate whale
#

Does remoteExec or remoteExecCall wait until the command is finished on the remote machines or it just moves on?

granite sky
#

From the calling script? It just puts them in the network queue and moves on.

warped hornet
#

Anyone know if its possible to attach something to the moving part of a door and have it move with it? My experimenting suggests not

stable dune
vapid cloak
#

How do i place a camera thet films me playing like an other player or as similer as possibale in singelplayer

stable dune
#

Like in example demo charge it doesn't follow.
But if you use

private _expl1 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl1 attachTo [player, [-0.15, 0.13, -0.18], "spine3",true];
_expl1 setVectorDirAndUp [[-0.707107,-0.707107,0],[0.707107,-0.707107,0]];        
private _expl2 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl2 attachTo [player, [0.15, 0.13, -0.18], "spine3",true];
_expl2 setVectorDirAndUp [[-0.707107,0.707107,0],[-0.707107,-0.707107,0]];
private _expl3 = "DemoCharge_Remote_Ammo" createVehicle position player;
_expl3 attachTo [player , [0, 0.2, -0.18], "spine3",true];
_expl3 setVectorDirAndUp [[-1,0,0],[-0,-1,0]];

It will follow.
Like if you set unit unco

warped hornet
late drum
#

Hello! How can I make a local variable accesible for all the scripts? Because if I have a _param = _this select 0; and I want to use that _param inside an if it says Undefined variable

meager granite
late drum
little raptor
#

Post the whole code in that function

remote cobalt
#

Hey folks,

I am having trouble with using Variables in initPlayerLocal that are created in initServer

The idea is, that I create a publicVariable in initServer and use this in initPlayerLocal.

But sometimes when the initPlayerLocal script runs, the Variable is not yet initialised. I am solving this currently with a random sleep, but thought it would be nicer to just use a waitUntil and check if the Variable is initialised.

How would I do this? Would I check on "objNull" or is there another function like that checks if the Variable exists that I am not aware of?

hallow mortar
#

isNil

undone flower
#

waitUntil not isNil

hallow mortar
#

Both

#
waitUntil {!isNil "my_varname"};```
exotic flame
#

Is there actually a way to destroy a flying missile ? Missiles doesn't have damage system

warm hedge
#

triggerAmmo

#

Or if you mean shoot down... try something scripted

exotic flame
south swan
#

inb4 deleteVehicle

meager granite
#

Somehow deleting previous body causes respawn to fail 🤔

13:15:58 Respawn failed - body disappeared
meager granite
#

Seeing really weird stuff, dead ex-player unit never goes into ragdoll, always has group no matter how long you wait

#

And if you delete it, next respawn fails like this

#

Armanormal activity

#

[isPlayer player, alive player, player, getPlayerUID player, name player]
=>
[false,false,1ce63c40400# 1780850: b_soldier_01.p3d,"","Sa-Matra"]

#

Thank you Arma, very cool

#

You can also delete your corpse just fine
player => <NULL-object>

remote cobalt
meager granite
#

Result of pretty much

player setDamage 1;
selectPlayer anotherUnit;
#

Probably repro-able

#

Player unit remains without ragdoll, never loses group and if you delete it, it messes up new player's respawn

#

No more ragdolls finally 🎉

#

You can keep adding the corpse to your group

#

Group bar with just you there, never seen this before

late drum
#

Hi, I have a question, I have this code to add a list of weapons to a Listbox, how can I get the icon and put it in front of the weapon name? I know that to get the path of the icon is with getText(configFile >> "CfgWeapons" >> _weaponName >> "uipicture"), what I need is to add it in front of each object in the Listbox. The code is this:

{
        private _weaponData = _x;
        private _weaponName = _weaponData select 0;
        private _weaponDisplayName = getText (configFile >> "CfgWeapons" >> _weaponName >> "displayName");
        private _weaponIcon = getText (configFile >> "CfgWeapons" >> _weaponName >> "uipicture");
        _listaArmas lbAdd _weaponDisplayName;
    } forEach _primaryWeapons;
#

Right now it looks like this:

meager granite
#

uipicture is a tiny icon for group bar at the bottom of the screen, picture is the image you see in inventory and such

#

Anyway, you need

private _index = _listaArmas lbAdd _weaponDisplayName;
_lastArmas lbSetPicture [_index, _weaponIcon];
#

Or even a one-liner if you don't need index for anything else

_lastArmas lbSetPicture [_listaArmas lbAdd _weaponDisplayName, _weaponIcon];
meager granite
#

Still having problems with making body die for good, any ideas how to accelerate body's "brain" dying faster? (group becoming null)

ripe sapphire
#

yo bros how do you get the script that runs when an inputaction is triggered

#

like inputaction showMap the script would probably be openMap

hallow mortar
#

The idea that inputActions trigger a script and not enginestuff is a very big assumption

#

For modded keybindings that do definitely trigger a script, you can do a config lookup in CfgUserActions, but vanilla inputActions do a lot of things that aren't accessible by script at all. They have direct engine access.

ripe sapphire
#

damn

#

i need that vanilla inputaction

ripe sapphire
#

if I define a variable like this

myVar= 123;

does that become a global variable that gets added to mission namespace?

hallow mortar
ripe sapphire
#

ahh ok so unless you use with its always in missionnamespace?

#

im trying to understand these namespace concepts

#

can you give examples on what purposes certain namespaces would be used

hallow mortar
#

The missionNamespace is the default namespace. If you want to work with variables in a different namespace, you have to use with or setVariable.

#

An example could be that you want to track object-specific attributes of some kind. You'd want to store those in the object's namespace so they don't conflict with attributes belonging to other objects, and so they can easily be retrieved by referencing the object.

#

Alternatively, you'd use profileNamespace if you want to store information that needs to persist outside the current mission.

ripe sapphire
#

I see so its possible to create 2 variables with the same name but they exist on 2 different namespaces (namespace of object 1 and object 2)

hallow mortar
#

Example: I want to add an action to some objects, and be able to remove them later. I can use the object's namespace to store the action ID on the object.

private _actionID = _object addAction [ ... ];
_object setVariable ["my_actionID",_actionID];
// ...
_object removeAction (_object getVariable ["my_actionID",0]);```
ripe sapphire
hallow mortar
ripe sapphire
hallow mortar
#

essentially the same thing

ripe sapphire
ripe sapphire
hallow mortar
#

That command is for the global namespaces that aren't associated with any specific entity

oblique current
#

I've been trying to run "ammoHit" Event handler within an ammo class. class EventHandlers { //init = "systemChat format ['init ammo EH output: %1 [time: %2]', _this, time]"; fired = "systemChat format ['fired ammo EH output: %1 [time: %2]', _this, time]"; ammoHit = "systemChat format ['ammoHit EH output: %1 [time: %2]', _this, time]"; }; only fired works. Please is this EH no longer supported?

hallow mortar
fair drum
#

@ripe sapphire your default namespace can change when using with as well so be careful. Check out my note on the with wiki page.

hallow mortar
#

I'm almost sure I mentioned that earlier 🤔

fair drum
#

Oh yeah it looks like you did.

ripe sapphire
hallow mortar
#

Yes, that's the point of namespaces

#

A namespace is a space in which names are searched for. Names (and the things attached to those names) outside of that space are ignored.

ripe sapphire
#

i see, but will it affect execution of normal scripts (e.g running hint "hello" within mission namespace and object namespace)

hallow mortar
#

Namespace controls which set of variable names are referenced. hint "hello" is not referencing any variable names so it's completely unaffected.

spring stone
#

Meh... thanks anyway

ripe sapphire
#

ahhh gotcha so as long as no variables are in use the namespace of the code have no significance

astral bone
#

What do I need if I am trying to place something, and over land it's fine, but over sea, it's below where it should be? Is that ASLToAGL?

hallow mortar
#

Usually I just create the object and then immediately setPosASL it to the correct position rather than fucking around trying to get the right position for createVehicle

astral bone
#

Another mod is setting positions, and that's happening to the units it sets the positions of

ripe sapphire
#
#line 1 "A3\functions_f\Debug\fn_camera.sqf [BIS_fnc_camera]"
#line 0 "/temp/bin/A3/Functions_F/Debug/fn_camera.sqf"

what does this command do?

#

the #line

crude flame
#

how would i make a fake explosion

#

and a fake missile launch

green night
#

Whats a fake explosion? Like one that looks like one, but is really something else? Just make a real explosion by spawning a missile, bomb or set off a satchel charge

crude flame
#

i need like the sound and the effect

#

because a realone would do dmg to the heli i dont want

green night
#

Allowdammage false will stop heli taking damage.

crude flame
#

then how would i spawn a missile targettting the heli and know exactly when it hits

cunning zephyr
crude flame
#

but i need like a missile coming so we get the rwr warning

cunning zephyr
#

you can script a missle to hit target, but I do not know if that gives an RWR warning.

crude flame
#

the thing is i dont know how to

green night
#

Just make an Armour AA unit shoot at it

cunning zephyr
crude flame
#

firstly zsu ai do not care if i set there amoo to zero turn off there ability to shoot

crude flame
#

zsu ai use magic to shoot even when they have 0 ammo

crude flame
#

i need to know when the heli is hit

ripe sapphire
#

yo bros does displayAddEventHandler work before a display is created? and does the EH stay after display is closed and then re opened again? or do i have to add the EH everytime

simple trout
#

everytime

#

and you have to have a display already created for displayAddEventHandler

crude flame
#

i made a script to do it for me

#

how would i remove all counter measures from a vehcile

crude flame
#

an also i need to stop ai from shooting the player after they scuttle the heli even tho theres no one inside

meager granite
#

I love how A3 non-ragdoll bodies retain aiming pitch

#

Arma is indeed a paranormal game, yesterday I had the bug where dead body was not dying completely and breaking the respawn, today it doesn't happen in exact same setup anymore

#

All I did was restart Windows

#

I love spending 2 days figuring out the bug, isolating it, trying different approaches to bypass it only for it to never happen the next day

warm hedge
#

You love to break two decades old game

crude flame
#

how the fuck do the ai figure out that i scuttled the helicopter when there on the other side of the map and not in the same group

meager granite
crude flame
#

even tho the helicopter was empty

#

like why cant i stop them from doing it

sharp grotto
crude flame
#

like why do ai ff you when you destroy a empty helicopter

crude flame
#

i can now become the rank god

crude flame
#

still got shot

meager granite
#

Do side player and see if it returns ENEMY

#

After you become hostile

crude flame
#

yep

#

i become enemy after

#

the heli is a civ after me and the ai leave it

meager granite
#

Some scripting might be removing the rating

#

Or you didn't execute the script

#

Or at the wrong time (when there is no player yet)

crude flame
meager granite
#

You need to wait until player inits

#
0 spawn {
    waitUntil {alive player};
    player addRating 1e6;
};
crude flame
#

thanks but i dont need it i have it in a trigger

ripe sapphire
warm hedge
#

An EH is only alive as long as the parent thing is alive, in this case display

ripe sapphire
#

Ahhh gotcha

#

So whats the best way to detect when a display is created, do i have to use a condition check loop

#

I want to add a new EH to the splendid camera display

ripe sapphire
#

Banger nice thanks

proven charm
#

kinda curious why this code doesnt always work (test works but sometimes params messes up things ```sqf
private _testNum = 0;

_coords = [123,888];

_coords params ["_testNum","_notUsed"];

systemchat format ["test %1 %2",_testNum]; // Prints 123

meager granite
#

What doesn't work exactly?

proven charm
#

in some cases params doesn't set the new value to _testNum

meager granite
#

You probably supply nil or empty array there

#

systemchat format ["test %1 %2",_testNum, _coords]; to see what's up

proven charm
#

idk i had to switch to select to get it working _testNum = _coords # 0; and get rid of params

meager granite
#

You're supplying either nil or empty array as _coords, log data to see where it goes wrong

proven charm
#

like i said using select instead of params worked for me, in my project. and the test code provied always works

meager granite
#

select and params behave differently in case of wrong data

#

If you expect to always have first element in the array, both will work the same

#

but you supply bad data and that's where your problem is

proven charm
#

the data was good in the end

meager granite
#
private _testNum = 0;
_coords = [123,888]; 
_coords params ["_testNum","_notUsed"]; 
// _testNum is 123
_testNum = _coords # 0;
// _testNum is 123
private _testNum = 0;
_coords = []; 
_coords params ["_testNum","_notUsed"]; 
// _testNum is 0
_testNum = _coords # 0;
// _testNum is nil
private _testNum = 0;
_coords = nil; 
_coords params ["_testNum","_notUsed"]; 
// _testNum is 0
_testNum = _coords # 0;
// _testNum is nil
proven charm
#

interesting, could be something like that but then again the data was good

#

this is copy of the actualy code that i couldnt get working with params ```sqf
private _coords = [_fob,side _group] call getOutsidePlaceCoord;

//_coords params ["_startAngle","_spawnDist"]; // Must be commented out or _spawnDist will be zero

_spawnDist = _coords # 1;

#

it works only without params

#

_spawnDist is defined above that code

meager granite
#

Looks like your function fails and returns nil

proven charm
#

umm but _spawnDist is correct in the end

undone flower
meager granite
#

2001 gameplay mechanics

proven charm
#

figured the problem out that I had. it was scope issue ```sqf
private _testNum = 0;

call
{
_coords = [123,888];

_coords params ["_testNum","_notUsed"];
};
systemchat format ["test %1",_testNum]; // Prints zero

stable dune
proven charm
#

yeah I get that params acts like the private command

serene sentinel
#

I want to put unit's weapon in box and give him weapon from box. How can I save all the attachments that both weapons have, including magazines with the number of rounds? Something with weaponsItems command?

_unit removeweapon _unitrifle;
_container addweaponCargoGlobal [_unitrifle, 1];
_unit addweapon _ARifleinbox;
_container addweaponCargoGlobal [_ARifleinbox, -1];

What i need to add here?

serene sentinel
#

It is for weapon that going to the box

#

How about from box to unit?

meager granite
#

Alt syntax

serene sentinel
#

@meager granite Can you explain in more detail for the incomprehensible? 🙂

meager granite
#

Do test runs of the command and you'll see what it returns

serene sentinel
#

@meager granite weaponsItems returns all weapons. How can I drop to the box only PrimaryWeapon?

meager granite
#

Walk through array and find it in the array

#

I don't know if addWeaponWithAttachmentsCargoGlobal supports negative amount, if it doesn't then its futile and you'll need to do hacky stuff

meager granite
#

Wow, you get variables copied from 2 bodies ago!

#
  1. Player unit #1 dies
  2. selectPlayer unit #2
  3. Player unit #2 dies
  4. Player respawns into unit #3
  5. Vars from unit #1 are copied to unit #3
#

These respawn events and variables are a fucking curse

#

And yeah you can't even nil variables on unit #1 because nils are also copied

meager granite
#

Didn't happen yesterday, started again today

#

I didn't even touch the code there, I swear

fair drum
#

open source Arma 3 when?

meager granite
#

player in playableUnits => false

#

Wanted to do an arrange of bugged non-ragdoll units but one unit didn't die! Now he's the only unit in playableUnits

#

allPlayers - just me
playableUnits - just that bot unit

#

playableUnitsReal when?

#

O mighty bugged unit tell us your secret why you happen randomly

hallow mortar
#

One of my favourite rare bugs in this field is when a player disconnects from a slot that has AI on (so their old body stays alive as an AI), then when they reconnect to the same slot, instead of taking over the old body again like normal, they create a second copy of themselves. It doesn't happen often but it's always funny

meager granite
#

Nowadays I just delete lobby unit and createUnit the player

#

You get these other bugs though

serene sentinel
#

@meager granite

_WeapItUnit = weaponsitems _unit;
_PrimWeapUnit = _WeapItUnit select 0;

This way i found primaryweapon array in weaponitems. How can I use this with addWeaponWithAttachmentsCargoGlobal ?

meager granite
#

Check what format it wants vs what format weaponsItems returns, build new array and feed it into command

#

They're probably similar

serene sentinel
#

For you maybe 😄

meager granite
#

Returned by weaponsItems: format [weapon, muzzle, flashlight, optics, [magazine, ammo], [magazine, ammo], bipod]:
Wanted by addWeaponWithAttachmentsCargoGlobal : weaponConfiguration: Array in format [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]

#

Same format even, no actions needed

#

But again addWeaponWithAttachmentsCargoGlobal might not support negative counts to remove the weapon, only to add

serene sentinel
#

_container addWeaponWithAttachmentsCargoGlobal [_PrimWeapUnit, 1]

meager granite
#

Yeah, try it

serene sentinel
#

i don't need to delete with addWeaponWithAttachmentsCargoGlobal , i will do it with addweaponCargoGlobal, it supports negative amount for sure

meager granite
#

What if you have two different weapons with different attachments?

#

You'll delete the wrong one

#

Check if longer command works first

serene sentinel
#

thanks

#

What about adding weapon with attachments to unit from box?

_unit addweapon _ARifleinbox;

How can I use weaponsItems there?

meager granite
#

You'll need to add weapon and then edit it with addWeaponItem

#

also adding weapon auto loads the mag from gear so its another issue

terse tinsel
#

I have a question for you: Is it possible to make the irlaser turn on for Ai even when it is not in COMBAT mode??? When I make such a script, the laser simply appears sometimes and then not. null=[] spawn { while {true} do { player action ["IRLaserOn", "name AI"]; sleep 0.01};};

meager granite
#

Try each frame

terse tinsel
# meager granite Try each frame

I already checked. it's exactly the same problem. At normal game speed you can't see anything, and when I do this 4 times, the laser flashes. I don't know where the problem is 😦

meager granite
#

Post code how you did it each frame

#

yours is scheduled

terse tinsel
meager granite
#

🤔

#

Maybe disbling some kind of AI behaviour will help

terse tinsel
#

Is there any way to make a unit enter combat mode and stay there permanently??? (script). to get around it 🙂

terse tinsel
hallow mortar
terse tinsel
terse tinsel
#

very strange, but I put something like this _h = aaa spawn { while {true} do { player action ["IRLaserOn", aaa]; sleep 0.01};}; and at game speed 1x inc is not visible, at 2x it works almost fine, and at 4x it flickers

meager granite
#

Try

onEachFrame {aaa action ["IRLaserOn",aaa];};
#

See if it makes any difference

#

Alternatively

addMissionEventHandler ["Draw3d", {aaa action ["IRLaserOn",aaa];}];
#

second one could be different because of different part of frame

terse tinsel
terse tinsel
#

I'll check it this way, for now it's flashing like a strobe at game speed 1x onEachFrame { if (diag_frameNo mod 60 isEqualTo 0) then { player action ["IRLaserOn", aaa] } };

terse tinsel
terse tinsel
#

hmmm, it's funny, but I just noticed that when the unit is very far from the player, the script works and the laser burns at normal game speed, but when the AI ​​gets closer to the player, the laser is no longer visible.. strange. It's probably a display problem 😦 I won't bother you anymore. and thank you for trying to help

fair drum
#

i'm really tempted to experiment with hashmapObjects

fair drum
#

the big question is locality. anytime I make a change to the hashobject, I bet I have to send the whole hashobject over the network

#

oooo one potential flaw with them is that I don't think you can prevent their overwrite. a bad actor could come in and destroy the whole hashmapObject variable. that's really bad, especially if you have a lot of methods in it.

edit: nvm, compileFinal now takes a Hashmap to prevent this
edit2: that still bad because now you can't set new keys to the hashmapobject if you also protect the instance

blissful current
#

Any ideas how to remoteExec this? Currently it just plays on the local machine that activates it.

[ 
 [ 
  ["Recon Position", "<t align = 'center' shadow = '1' size = '1.5' font='tt2020style_e_vn_bold'>%1</t><br/>"],  
  ["0557h", "<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]
 ] 
] spawn vn_ms_fnc_sfx_typeText;};```
fair drum
blissful current
#

Lemme look up on Biki what that is

blissful current
#

So I need to assign a class for it? Sorry I'm just getting back into this

#

I'm pretty good at copy and pasting frankenstein code from the 2014 forums tho.🤣

fair drum
#
// description.ext for a mission, config.cpp for addon
class CfgFunctions {
  class Fox {
    class fnc {
      file = "pathtofunctions";
      class MyLocalFunction {}; // looks for fn_MyLocalFunction.sqf
    };
  };
};
[] remoteExec ["Fox_fnc_MyLocalFunction", _targets];
blissful current
#

So if Im understanding then "fn_MyLocalFunction.sqf" is where I place my code that I originally posted? I tested it as such and get an error for unverified _targets

fair drum
#

_targets is just an example

#

Put in a number/obj/etc or array of numbers/obj/etc for the client computers. Look at the remoteExec wiki page.

blissful current
#

I tried with "player" there but nothing happened. Thank you for the help btw! I'll try the wikipage too.

#

Ohhhh is there where I can write 0 and it goes out to all computers? I'll try that next. Edit: I tried 0 but nothing happened.

distant venture
#

Hi Team, struggling to put a texture onto the Billboard Blank. For some reason this is not working, as far as I am aware the file path is correct and simulation is enabled. Any pointers or hints

fair drum
fair drum
blissful current
#

I'm not sure how to use the config viewer. I will try that now though.

distant venture
distant venture
blissful current
distant venture
warm hedge
#

Check RPT. Make sure it isn't throwing missing file error

distant venture
warm hedge
#

It doesn't matter

distant venture
#

Its saying it isnt found

warm hedge
#

Then it isn't there. Make 100% sure the filepath

#

Where exactly your jpg is?

fair drum
distant venture
#

Inside my mission folder

fair drum
#

um... how did you make that .paa file...

warm hedge
#

That too

distant venture
warm hedge
#

That's not how it works

fair drum
#

not how that works

warm hedge
#

Just use JPG if you don't know what is PAA

distant venture
#

Still no luck

warm hedge
#

...You sure the mission folder you put the picture is correct?

distant venture
#

........

#

Does this now

#

I had two folders the same

warm hedge
#

You were editing the temp folder then

#

Then next up: make sure your JPG has correct resolution (power of 2)

distant venture
warm hedge
#

No

#

2014 is not

distant venture
warm hedge
#

Yes

#

You said 2014

distant venture
#

whoops

#

meant 1024

#

1024x1024

warm hedge
#

Okay, then... just in case, didn't you changed extension to convert PNG to JPG?

distant venture
distant venture
warm hedge
#

Linked in Workshop

#

I don't know what is unclear to you, that module is very straightforward

distant venture
#

And how they intereact wth each other

warm hedge
molten yacht
#

is there a way to check via script to see if an object is visible on a local player's screen

#

i.e. "is someone looking at this"

warm hedge
#

positionCameraToWorld maybe is an idea

molten yacht
#

hmm

#

wait duh

#

get direction of object from player's position, check if that direction is within 160 degrees or so of the player's getDirVisual

#

if it's not, spin the spooky object to face them.

granite sky
#

worldToScreen is the direct method.

#

You can do a full frustum check yourself but it's not necessary.

meager granite
#

Basically, selectPlayer and setPlayerRespawnTime are dangerious and must be used carefully

#

Wrong order or timing and everything goes to hell

#

Still, its 2024 and we can't properly stop ragdolls on dead bodies and its a big shame

#

selectPlayer and setDamage lets you turn ex-player unit into non-ragdolled body

#

Not very useful unless you do that during player loading or something

meager granite
#

Seeing how ropes can be scaled by XYZ makes me wish we had a command for that so it can be tried against objects that support it, could be very useful

#
  • Just had a need for invisible barrier objects of various shapes, so objects with bad geometry can be fixed and can't be hidden inside or easily peeked through.
#

Current list of ideas for objects to request to be added to base game:

  • Invisible object to attach rope to. (Needs simulation chosen, maybe several simulations as they have different properties)
  • Invisible object to attach to rope. (Same, needs simulation selected, maybe several simulations)
  • UserTexture as ground decal (Several sizes)
  • Standalone engine flag object with nothing but flag proxy to use with forceFlagTexture
  • Even larger clutter cutter object.
  • Invisible roadway object (Several sizes?)
  • Invisible geometry object to block bad areas (Several sizes?)
#

Wont mind if somebody can take a lead on that, create sample configs or even models and file a ticket, maybe its not too late for 2.18

#

I suck as both models and configs

halcyon creek
#

Finaly figured this one out, the code was perfect, however adding a holdAction to an object that is damaged doesnt work, it has to be an object that is "Alive"

halcyon creek
#

Here's a loosely scripting related question, anyone know how to get the BI Wiki to stay in dark mode 😂 Changes back on every new page and its frustrating

little raptor
halcyon creek
#

Now that is a great extension, cheers!

unkempt marsh
#

How do you go about changing the players respawn time mid mission once a trigger is activated?

unkempt marsh
proven charm
unkempt marsh
#

yes

proven charm
#

strange

unkempt marsh
#

is it doing it once, and on the second death resetting the respawn timer to the original? that's what its doing for me

proven charm
#

not resetting for me. tried editor - MP

unkempt marsh
#

that is strange... so you have respawn setup in the editor for a different time and its changing it to the set time permanently?

proven charm
#

yes

unkempt marsh
#

I'll try disabling respawn in wave

#

that might work

proven charm
#

i just selected multiplayer -> Respawn at the position of death

unkempt marsh
# unkempt marsh that might work

didn't work, i've set it to 45 seconds respawn usual, but then once a trigger is set to start a big attack i have the on activation line saying "setPlayerRespawnTime 10", after one death it sets it to 10 seconds, but after a second it then sets it back to 45 seconds

proven charm
#

test it in console

#

dont use trigger

unkempt marsh
#

i need it to be based off trigger though for the mission, is there any way to do it with the trigger?

proven charm
#

id test first in console

unkempt marsh
#

still didn't work

#

worked once then back to 45 seconds

proven charm
#

maybe script line is setting it back

unkempt marsh
#

i haven't messed with it anywhere else

#

it's only in this one line that it's applied, is there a risk that the normal settings override it upon respawn?

proven charm
#

dunno

#

try with new mission

unkempt marsh
#

worked in the new mission. which is strange

proven charm
#

u sure you didnt forget the script that calls setPlayerRespawnTime somewhere? maybe another trigger?

unkempt marsh
#

i only just started trying to use it for the first time with this one

#

and theres no point either where it would be set back to the mission default by a trigger either

#

the only thing i changed about the other mission it worked in was the respawn settings, being respawn on position of death and also respawn doesn't allow for choosing position or loadout in the other one. it's plausible that choosing where to spawn somehow calls a function to set it to the mission default

unkempt marsh
proven charm
#

good to hear you found the problem. I wonder whats the logic behind in resetting the respawn time

unkempt marsh
#

does anyone know a method by trigger to change the default respawn time?

proven charm
#

that should be run in init.sqf or something

unkempt marsh
#

I'll look around the wiki to see how to get this to activate by a trigger, thanks

proven charm
#

u shouldnt because it uses addMissionEventHandler

unkempt marsh
#

but a conversion, to get the trigger to change a variable that when changed adds the mission event handler or something

proven charm
#

you could do something like ```sqf
playerResTime = 1;
setPlayerRespawnTime playerResTime;

unkempt marsh
#

i used to have the trigger just set the time to 10 directly, only worked once. but if i can get a system that re-applies the code every death then i can simply have that applied after calling a function, so im trying that now

proven charm
#

then run the addMissionEventHandler code in initPlayerLocal.sqf

#

yeah my code re-applies the time after every respawn

unkempt marsh
#

so im going to try and put it into a function, so that when the trigger is activated it can call the function and add the event handler on to each playable unit or onto the mission, whichever works

halcyon creek
#

trying to add a trigger that fires a notification when 2 conditions are met, Script triggers the conditions but how do I phrase it in the condition of the trigger?

#

Say the conitions are "Leave 1" and "Leave 2" do I just put Leave 1 & Leave 2; as the condition?

warm hedge
#

and or &&

unkempt marsh
halcyon creek
#

Perfect, thanks guys

unkempt marsh
meager granite
#

Requiring admin rights to use diag_codePerformance is such a nuisance

blissful current
#

Is there a way to make the briefing screens stay up until all players press "OK"? Currently I'm reading my missions briefing and the game dumps me into the start of the mission after about 60 seconds. I'd like to be able to read everything at my leisure then decide when to enter the game.

sullen trellis
#
_eastGrp spawn { sleep 5; 
_unitpresent = {typeof _x isEqualTo "B_Soldier_A_F"} count thisList > 0;
waituntil { {(_x distance _unitpresent) < 30} foreach units _this; }; 
hint "deleting units";
{deleteVehicle _x} foreach units _this; 
};

trying to delete a group of units when a unit classname is nearby,
i get an error just before thisList > 0

hallow mortar
#

What does the error actually say?

#

Given that you've just spawned a new scope, it's likely that thisList is not defined, since it's only available in specific scopes and if was available in the parent scope, you've just left it.

#

Also, your variable _unitpresent is going to contain a bool (true or false). You then use _unitpresent in a distance check, which is impossible.

proven charm
hallow mortar
#

It looks like one, but it's not. How could it be? Its content is scope-specific.

#

It's like this in an init field.

proven charm
sullen trellis
hallow mortar
#

e.g.

[_eastGrp, thisList] spawn {
    params ["_group", "_list"];
sullen trellis
# hallow mortar You need to pass `thisList` into the `spawn`ed scope as an argument, like you're...
[_eastGrp, thisList] spawn { 
    params ["_group", "_list"];
 sleep 5; 
_unitpresent = {typeof _x isEqualTo "B_W_Soldier_LAT2_F"} count _list > 0; 
waituntil { {(_x distance _unitpresent) < 30} foreach units _group; }; 
hint "deleting units";
{deleteVehicle _x} foreach units _group; 
};

great now it no longer gives error for thisList, for now the _unitpresent is the problem.
the error lies just behind distance how will i be able to swap _unitpresent to something that works

hallow mortar
#

What are you trying to do here? Like what's the expected result of this code?

sullen trellis
hallow mortar
#

Classnames refer to a type of unit, not a specific one. There could be multiple units of that type in the trigger. How sure are you that there will be only one (and it will be the right one)?

sullen trellis
#

basically i have a script that spawns infantry garrisoned units randomly in buildings, as well as random zombies from another script, though sometimes they spawn on the same building which is annoying, so i want only one of them to be in a specific building

hallow mortar
#

So, the waitUntil means the game will keep checking until the condition returns true (if the condition works but yours doesn't but we'll get to that in a minute). This means that even if there isn't initially a LAT2 near the group, if one walks in 5 minutes later the group will be deleted then. Is that the behaviour you want?

sullen trellis
sullen trellis
hallow mortar
#

This checks every 5 seconds to see if any group member is near one of the specified classes (you can add more classes to the array to check them all in the same check). If any group member is within 30 metres of one of that class, the group is deleted.

_eastGrp spawn {
    params ["_group"];
    waitUntil {
        sleep 5;
        (units _group findIf {
            private _nearZombies = _x nearEntities [["B_W_Soldier_LAT2_F"], 30];
            count _nearZombies > 0;
        }) > -1
    };

    hint "deleting units";
    {deleteVehicle _x} forEach units _group;
};```
sullen trellis
halcyon creek
#
this setCaptive true; if (isServer) then { 
 [[this, "KNEEL","LIGHT",arrow1], BIS_fnc_ambientAnim] remoteExec ["call"]}; 
 0 = this spawn {waitUntil {sleep 1; player distance _this <5}; 
 _this call BIS_fnc_ambientAnim _terminate; [_this, true] call ACE_captives_fnc_setSurrendered;};

Can anyone see if im missing a ; On this?

opal zephyr
#

"0 = this" doesnt make any sense to me, but the problem is likely in the remoteExec itself. You should be putting "BIS_fnc_ambientAnim" where the "call" is, since thats the function

halcyon creek
#

Im not following?

#

Which call?

#

This is going off a video I was following for ace surrenders, but its rather old so may no longer work that way

hallow mortar
#
[[this, "KNEEL","LIGHT",arrow1], BIS_fnc_ambientAnim] remoteExec ["call"]};```
->
```sqf
[this,"KNEEL","LIGHT",arrow1] remoteExec ["BIS_fnc_ambientAnim"];```
#

However, I think the issue is actually not that.

#
_this call BIS_fnc_ambientAnim _terminate;

should be;

_this call BIS_fnc_ambientAnim__terminate;```
halcyon creek
#

So ```sqf
this setCaptive true; if (isServer) then {
[this,"KNEEL","LIGHT",arrow1] remoteExec ["BIS_fnc_ambientAnim"];
0 = this spawn {waitUntil {sleep 1; player distance _this <5};
_this call BIS_fnc_ambientAnim__terminate; [_this, true] call ACE_captives_fnc_setSurrendered;};

hallow mortar
#

Well, you have a second instance of remoteExecing ambientAnim. You should change that as well.

halcyon creek
#

Sorry that was in my scratch pad not actually part of the script

hallow mortar
#

You also don't have a closing }; for the if isServer then {

#

The 0 = this spawn { is not technically wrong, but completely unnecessary. Just use this spawn {, there's no need to do anything with the return value.

halcyon creek
#
this setCaptive true; if (isServer) then {
    [this,"KNEEL","LIGHT",arrow1] remoteExec ["BIS_fnc_ambientAnim"]; 
    this spawn {waitUntil {sleep 1; player distance _this <5}}; 
    _this call BIS_fnc_ambientAnim__terminate; [_this, true] call ACE_captives_fnc_setSurrendered;};
hallow mortar
#

Actually this won't work at all because you're trying to use player on the server

halcyon creek
#

What would you suggest as a work around?

hallow mortar
#
if (local this) then {
  this setCaptive true;
  [this,"KNEEL","LIGHT",arrow1] call BIS_fnc_ambientAnim;
  this spawn {
    waitUntil {
      sleep 1;
      ((playableUnits + switchableUnits) findIf {_x distance _this < 5}) > -1
    };
    _this call BIS_fnc_ambientAnim__terminate;
    [_this, true] call ACE_captives_fnc_setSurrendered;
  };
};```
halcyon creek
#

Works perfectly, Appreciate it!

remote cobalt
#

Hey Folks,

weird question: Can I check if an item is a Backpack?

Following Background:
I want to write a Supply Drop function that gets an array of Items and Amount of them and fill them into a container.

The array has the following format:

[[itemClass_1,2],[itemClass_2,4],[itemClass_2,4]];

and so on.

I just want to make it super easy to fill this array.

with addItemCargoGlobal I can fill everything in the Container at the right amount, but addItemCargoGlobal is not working for Backpacks.

I was hoping there was a smart way to check if the itemClass in the array is a Backpack and if so, choose another option to move the Item into the Container.

something like:

if (_x select 0 isBackpack) then { _Box addBackpackCargo [_x select 0,_x select 1]; } else { _Box addItemCargoGlobal [_x select 0,_x select 1]; };

But I seem I cant find anything thats close. Does anyone know a better way to do this?

fair drum
#

first, make your array easier to work with (more readable):

_x params ["_class", "_count"];
#

is the backpack on a player? is it just on the ground? is the backpack inside of the container and you want to fill that container in a container?

hallow mortar
#

I'm pretty sure you can find something in the item's config that determines whether it's a backpack. Checking that would account for all cases

remote cobalt
#

No, I just want to write a function that makes it possible for me to call a supply drop and fill the supply drop with Items I want.

So I can call the Function with [_cargo] fnc_SupplyDrop and use it for multiple missions.

fair drum
#

and you want to be able to drop a backpack object as well? or should we just forget about the backpack thing for now?

#

oh i see now

#

idk why my brain wanted to focus on filling a backpack within a crate.

#

yes there is a config value for backpack, let me look it up

remote cobalt
#

Oh, I think i found it: vehicleClass

fair drum
#

no
getNumber (configFile >> "CfgVehicles" >> "backpackclassnamehere" >> "isbackpack")
for example

will return 0 or 1

remote cobalt
#

OKay, great, thank you guys. Was so focused on finding a function that I forgot to check in CFG

#

Awesome, sometimes you just strike a wall and need a change of perspective. Thank you so much

austere grove
#

can anybody help with how i'd write setting off a trigger once i free a hostage in a mission/have them join my group? hostage name is hostage1

#

i have the hold action from 3den enhanced set up already, just need to have a trigger for the success of the task

fair drum
austere grove
#

so id code going into the next task into the action code?

fair drum
#

yes, the task framework functions were created to be a global system, so it doesn't matter where it fires from (local to the computer that did the action in your case)

austere grove
#

oh ok cool

#

thank you, i might need help setting the success task off but im gunna research on google/youtube first

fair drum
#

forget both of those

#

just use the wiki

#

all that other stuff is outdated

austere grove
#

ok will do

tidal idol
#

Any idea on this error popup? This script is in the config init eventhandler of an ammo class.

hallow mortar
#

Wrong exitwith syntax

tidal idol
#

I've tried if () exitWith {} else {} but that will throw errors too

hallow mortar
#

Because that is also wrong exitwith syntax

#

It's JUST if () exitwith {};

#

Else is implied - other code after that can't possibly run if the script exits, but will if it doesn't

tidal idol
#

How about this?

remote cobalt
hallow mortar
#

Firstly you don't need an == to check the state of a boolean. Just return the boolean itself (or its inverse with ! to "true if false")
Secondly, you don't need to check if _isMan is false - you know that from the result of the exitwith.

tidal idol
#

Got this then with the extra if layer removed

remote cobalt
#

Also, if you want to check a boolean value for "false" you can use

if (!_isMan) then {...}

The ! check confirms on "false" value. Its faster then ==

tidal idol
remote cobalt
halcyon creek
#

having a wee spot of bother with getting a trigger to fire, I need it to fire when a unit is in the trigger and another variable has been checked, I have it set up as the attached image but it doesnt seem to want to fire

remote cobalt
#

you can use:

this && insdetained

#

this in the Condition field uses the condition set in the trigger module

halcyon creek
#

Aye but I dont want it to fire with the Bluefor Units in the trigger, I want it to fire once the detainee has been brought into the trigger zone so ive used in thislist

remote cobalt
halcyon creek
#

All good

#

Heres also the unit thats getting detained, firing the condition to true, so unless im missing something the set up I have should work?

remote cobalt
#

As long as you are not sure that both triggers run in the same Namespace, you should use

publicVariable "insdetained";

to make the variable available on all machines, including server

stable dune
open hollow
#

hello, i want to add some Control on ace_arsenal_display to show some stuff i need ( on 3den )

its posible adding it in the description ext, or need to be done by mod?

halcyon creek
remote cobalt
halcyon creek
#

I have not, ill give that a wee spin

#

No joy there either im affraid

remote cobalt
#

Well, but that helps in terms of we can concentrate debugging on the ins in thisLIst issue

#

You could try with an alternative and use

ins inArea thisTrigger

#

If you would give the Trigger a variable name it could be:

ins inArea triggerVariable;

halcyon creek
#

Oh that one worked

#

Thank you very much!

remote cobalt
#

Hey, you are welcome. Have fun with missionmaking

halcyon creek
#

Oh im definitley increasing the speed my hairline receeds, but its fun all the same!

oblique current
#

I've been using lineIntersectWith and it works fine but seems to ignore characters. Is this expected?

austere grove
#

anybody know why a task notification wont come up when i enter a trigger area connected to the task and the activation is "any player" and "present"?

fair drum
austere grove
#

ok

#

first image is of trigger connected to first task

fair drum
#

change the task state change trigger (task1_complete) activation to Anybody and try again. Sometimes custom conditions need it to be on Anybody for thisList to work right

austere grove
#

ahh ok, also i shouldve sent this one lol.. i did that for the task1_complete trigger, but this is the trigger im trying to get to notify the player of the hostage rescue task, sorry gunna send it now

#

was a silly mistake by me my bad

#

THIS is the trigger connected to the task

fair drum
#

which one? the one that creates task1?

austere grove
#

yeah its

#

hold on ill show you how its connected

#

i want when the player enters that zone they get the notification for task1, yes

fair drum
#

anybody means anybody, including any unit with a brain in any side

austere grove
#

ok

fair drum
#

you have a red unit in there, could be setting it off early

austere grove
#

would any player be ok?

fair drum
#

any player is okay as long as all your players are on the same side. zeus flying through can also trigger it I've seen

austere grove
#

oh wow

#

ok

#

yeah all players are on blufor

hallow mortar
#

I've never seen Zeus set off triggers by moving the camera through them. The Zeus player's actual position is where the Zeus module or player body is, not where the camera is.

#

Mods could change that though I guess.

fair drum
#

its been a while, but I remember it happening a few years ago. don't know if it was ZEN causing it or something

#

@austere grove do you have any blufor AI on the map? if not, and its all players, you could just change it to BLUFOR PRESENT

austere grove
#

i dont

#

if im using a us army mod but theyre under BLUFOR anyways, would that matter?

fair drum
#

cause if you have it on BLUFOR and PRESET, blufor AI can set off the trigger

hallow mortar
#

Side is what matters, not faction

austere grove
#

ok

#

and i forgot i do have more blufor on map

#

ill keep it to player

fair drum
#

fine for what you want to do

austere grove
#

does it matter how quickly you go through the zone? i set the players into a cargo plane to paradrop out of

#

im almost thinking they clear the zone too quick or something

#

but idk LOL im completely new to everything

hallow mortar
#

The trigger has a field for the check rate. I think the default is every 0.5 seconds. If they pass through quicker than that, they might not be detected if the timing is perfect. Otherwise they should be detected.

gloomy lily
#

how can i make it so that only a specific player can interact with something?

warm hedge
#

Interact as in?

gloomy lily
#

like opening a door or entering a car

warm hedge
#

Not impossible. Both works differently

#

Locking a door is usually done with setVariable. Lock is done with lock

#

Hm wait, lock is a global command so may not possible to do it only for some player?

hallow mortar
#

You can't fully lock vehicles for specific players, but you can use getIn EHs to boot out unauthorised persons as soon as they enter

meager granite
#

It doesn't seem to broadcast anything and you end up with different locked state for different clients

#

What I do in KotH:

    {
        _x lock (_x call client_func_locking_isVehicleLocked);
    } forEach (client_locking_vehiclesList inAreaArray [getPosWorld cameraOn, 10, 10, 0, false, -1]);
#

each frame

warm hedge
#

This... is seriously overcomplicated workaround for a very simple task

meager granite
#

Yeah, nothing is easy in Arma

warm hedge
#

I wish we can just duplicate Dedmen

meager granite
#

Honestly locks should be per entity even

meager granite
warm hedge
#

2009 even

meager granite
#

Hes gonna buy all bitcoin and leave BI as soon as price goes up

#

Or not, maybe he enjoys fixing this ancient engine

#

I guess you have to

#

Considering how much the game is client-sided its so weird that lots of stuff is global where it clearly should be local, locking is one such example

#

Meanwhile, allowDamage isn't global when its clearly should be

#

I miss local weather of OA

#

Hmm, maybe there could be something like

ENTITY setLockLocal BOOL
```which would stop changing locking flags from network updates
#

Would make things much easier

#
_remote_car setLockLocal true;
_remote_car lock true; // Only locked for you
analog mulch
#

hi
i have the code to save unit loadout (onPlayerKilled.sqf) but instead of writing each units variable, i would like it to work on all players in multiplayer

#
UNITVARIABLENAME setVariable ['Saved_Loadout_UNITVARIABLENAME", getunitloadout UNITVARIABLENAME];
proven charm
analog mulch
#

Ty

delicate hedge
#

Is there any way to set mission General attributes from script ? Im tryning to set it with:
set3DENMissionAttributes [["Preferences", "Saving", false]];
And i execute this command right in eden editor via Debug Console

stable dune
delicate hedge
stable dune
#

Well #community_wiki , There is place where you can ask ppl Who has the rights to edit / add documentation to wiki

analog mulch
proven charm
#

OnPlayerRespawn.sqf runs for just one player (at a time), so you probably want to set only that player's loadout

stable dune
analog mulch
#

so this will work only for single unit?
i want it to apply to all players in the mission

granite sky
#

You want all players to have their equipment reset when one player respawns?

analog mulch
#

yes

#

have them respawn with what the saved loadout

stable dune
# analog mulch have them respawn with what the saved loadout

If you understand what John said.
Current forEach all players command will save for every client , everyone's loadout.
And if you do set forEach it will add every client saved loadout when one client respawn.
If you want to save locally and only add on unit who is respawning saved loadout.

//initPlayerLocal.sqf
player setVariable ["TAG_StartLoadout", getUnitLoadout player];
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_StartLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];

https://community.bistudio.com/wiki/Arma_3:_Respawn#Respawn_with_Original_Loadout

There is all that you need.

analog mulch
#

ty

analog mulch
meager mist
#

Is there a way to use a non-array for the array part of orderGetIn? I have a 4 groups of prisoners that's supposed to go into a helicopter, but it's dynamic so I cannot just use an array.

hallow mortar
#

Well, you can use a single-element array ([_unit]). But you should be able to dynamically build an array based on the units involved.

#

e.g.

units _prisonerGroup orderGetIn true;
//
private _prisonerGroup = _potentialUnits select {captive _x};
_prisonerGroup orderGetIn true;
// there are many other ways```
meager mist
#

Well, I'm running the script from a trigger as

[prisonersGroup1] execVM 'prisonerMovement.sqf'

and then the group is defined in the script itself as:

prisonersGroup1 = [prisoner1, prisoner2, prisoner3, prisoner4];

Does that mean that I just have to put the units infront of the orderGetIn to make it work?

stable dune
analog mulch
#

ah ok

stable dune
#

there is example under save starting loadout.
-->

Respawn with Death Loadout
The following code makes the player respawn with the loadout they had on death:

//initPlayerLocal.sqf

player addEventHandler ["Killed", { player setVariable ["TAG_DeathLoadout", getUnitLoadout player]; }];
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_DeathLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];
hallow mortar
hallow mortar
# meager mist Well, I'm running the script from a trigger as ```sqf [prisonersGroup1] execVM ...

If you are doing this:

prisonersGroup1 = [prisoner1,prisoner2, ...];
[prisonersGroup1] execVM 'prisonerMovement.sqf';

then......you already have an array of units which is perfectly suitable for passing to orderGetIn.

prisonersGroup1 = [prisoner1,prisoner2, ...];
[prisonersGroup1] execVM 'prisonerMovement.sqf';
// in prisonerMovement.sqf
params ["_prisonerGroup"];
_prisonerGroup orderGetIn true;```
#

Or even simpler:

prisonersGroup1 = [prisoner1,prisoner2, ...];
prisonersGroup1 execVM 'prisonerMovement.sqf';
// in prisonerMovement.sqf
_this orderGetIn true;```
viscid anvil
#

Hi, I'm working on a script, that calls a dll file, that makes a network call.
When making calls to a public domain everyting works fine.
I'm trying to create a local development environment, when I try the dll with a consle test app it also works great, but when the dll is part of arma it doesnt send requests to localhost all the sudden.
Any help?

#

arma "receives" an empty response from the server, when it didn't even send a request

meager mist
#

I have params ["_prisoners"]; in the sqf, but called _prisoner in the script :p

analog mulch
#

so onPlayerKilled.sqf:

{
 private _plr = _x;
_plr setVariable ["Saved_Loadout", getunitloadout _plr ];
} foreach allPlayers;
#

onPlayerRespawn.sqf:

player addEventHandler ["Killed", { player setVariable ["TAG_DeathLoadout", getUnitLoadout player]; }];
player addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_DeathLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];
#

so instead of using the code u mentioned above loadout on death, would this work to get the original loadout on death and respawn for all players?

fleet sand
#

So quick question. Is there a event or somekind a better way to check has player put gasmask and then show the picture and when he takes gasmask off to remove the picture. Right now i have this:

maskArray = ["kat_mask_M50","kat_mask_M04"];


addMissionEventHandler ["EachFrame", {
    if (goggles player in maskArray) then
    {
        0 cutRsc ["overlay_texture","PLAIN", 1, true];
    }else {
        0 cutText ["","PLAIN"];
    };
}];

But this is so ugly and its make a new picture each frame. So any solutions ?

stable dune
# analog mulch so instead of using the code u mentioned above loadout on death, would this work...

If you want unit spawns with loadout what he got when he died.
Use this.

Respawn with Death Loadout
The following code makes the player respawn with the loadout they had on death:

//initPlayerLocal.sqf
player addEventHandler ["Killed", {
    player setVariable ["TAG_DeathLoadout", getUnitLoadout player]; 
}];
player addEventHandler ["Respawn", { 
    private _loadout = player getVariable "TAG_DeathLoadout"; 
    if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; 
}];

You don't need to use it for each player,
Just player
It's local, and it will have its own loadout of what he got when he died.
Same stuff.

late drum
#

Hello! I made this script to put a text in the head of a NPC but it isnt working, TiendaArmas is the variable name of the NPC.

private _unit       = TiendaArmas;

private _pos        = (_unit modelToWorldVisual (_unit selectionPosition "head"));
_pos set [2, (_pos select 2) + 0.7];

drawIcon3D["i\icono_armas.paa",[1,1,1,0.8],_pos,0.65,0.65,0,"Buy Weapons Here!",2,0.03,"PuristaMedium"]; 
south swan
#

inb4 not calling it every frame

meager granite
#

Are you doing it inside Draw3D event handler?

late drum
meager granite
#

You need to calculate position each frame too

late drum
#

Now I'm getting this error lol

south swan
#

looks self-describing, though?

#

and totally unrelated to the code above

glossy pine
#

KOTH Academy 💀

thin fox
#

Hello. Is there any command to detect if a box is full of items?

drifting sky
#

Anybody know any method via scripting or modding or difficulty settings that curtails vehicle gunners ability to pinpoint your position if you shoot at their vehicle?

oblique current
#

I have this simple script `// Function to handle the bullet hit
scriptName "BulletHitHandler";

params ["_projectile"];
systemChat "function called";

private _target;
private _bulletFired = false;

// Continuously check if the bullet hits a target
while {alive _projectile} do {
    // Keep updating the nearest enemy
    _target =  nearestObjects [_projectile,["Man","Tank","Car"], 1] select 0;
    _bulletFired = true;
    systemChat format ["target %1", _target];

    // Sleep to reduce CPU load
    sleep 0.0001;
};

if (!alive _projectile && _bulletFired) then {
    hint format ["Target was %1 with type of %2", _target, typeOf _target];
};

` but it throws a "general syntax error in expression" error message at line 18 "sleep 0.0001". The syntax there is obviously fine but there's no more info to actually find the problem. Please help.

warm hedge
#

Are you sure you're calling this from spawn or execVM

oblique current
#

non, I just call the function with this script fired = "_this call Phosphorus_serpenta_fnc_BulletHitHandler";

warm hedge
#

Then that's the issue

oblique current
#

Thank you @warm hedge

blissful current
#

Whenever someone JIP on my mission it cycles through all the completed tasks on every client. Anyone know of a way to fix this?

warm hedge
#

Post your code

blissful current
#

I use the editor to place task modules.

remote cobalt
blissful current
remote cobalt
blissful current
storm arch
#

Anyone have knowledge of moveOut not working as intended?

granite sky
#

It's pretty reliable IME.

warm hedge
#

What do you do and what unintended behavior?

storm arch
#

It moves out alive players but not dead players

granite sky
#

Depends how long they've been dead for, IIRC.

sharp grotto
junior moat
#

so i have this which i basically just copy and pasted from a forums post. how do i change this so that it just detects whenever a smoke grenade is thrown? ive never used event handlers before, theyre way too confusing for me lmao

#
["ace_firedPlayer", {
  params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
  _toCheck = "SP_mk4a_smokeGrenade";
  _last = magazines _unit findIf {_x isEqualTo _toCheck} < 0;
  if (_last) then {hint "test"};
}] call CBA_fnc_addEventHandler;

in text form

warm hedge
#

You can check what _this returns upon you throw a smoke

junior moat
warm hedge
#

systemChat str _this

junior moat
#

should i put that line underneath the "if" line?

warm hedge
#

No. Just put that as the entire EH code

junior moat
#
["ace_firedPlayer", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    systemChat str _this
}] call CBA_fnc_addEventHandler;

this good?

warm hedge
#

Yes

junior moat
#

alright, what will this do?

warm hedge
#

Prints a debug log

junior moat
#

got it

late drum
#

Hi! I have this code, everything works fine except the valign, which does nothing:

_bluforPoints ctrlSetStructuredText parseText format ["<t size='1.25' align='center' valign='middle' font='RobotoCondensedBold'>%1</t>", missionNamespace getVariable "blueTotalKills"];
meager granite
#

valign is weird, change it for elements inside your text instead

still forum
woven rain
#

idrk if this is the right channel but i need help and im desperate lol.
I made a faction orbat with alive and i have more than one faction i want to put into mods but putting all the pbos into a file doesnt seem to work?

still forum
#

A pbo is a file. You cannot put pbo into pbo.
You put pbo's into the same folder

past sundial
#

Hello 👋 Does anybody know if there is a way (using event handlers) to detect when a vehicle was reloaded using setVehicleAmmo?

south swan
#

Wut

past sundial
ornate whale
# past sundial Hello 👋 Does anybody know if there is a way (using event handlers) to detect w...

To my knowledge, there is no event handler that triggers when you manually set the ammo value, only when the reloading animation is finished. You can create your own function that sets the vehicle ammo and performs other subsequent actions. Instead of directly calling setVehicleAmmo, you would call your custom function, like this: _vehicle call resupplyMyVehicle;. It could add the ammo, and them send a message to the chat or play a sound, whatever you wish.

past sundial
ornate whale
fleet sand
serene sentinel
#
private _GPS = ("toLowerANSI getText (_x / 'simulation') in ['ItemGPS'] && {getNumber (_x /'type') in [131072]} && {getNumber (_x /'scope') == 2}" configClasses (configFile /"cfgWeapons")) apply {configName _x};
private _GPSinbox = (itemCargo _container) arrayIntersect (_GPS);
private _UnitGPS = if ((count _GPSinbox) > 0) then { selectrandom _GPSinbox } else { "" };
private _amountofGPS = {_x in _GPS} count (items _unit);
private _UnitCurrentGPS = _unit getSlotItemName 612;
if ((_UnitCurrentGPS == "") && (_amountofGPS == 0)) then {
    if ((count _UnitGPS) > 0) then {
                _unit linkitem _UnitGPS;
                _container additemCargoGlobal [_UnitGPS, -1];
            } else {
    };    
};

Can someone say what is wrong there? _GPSinbox shows - [] , but there are 5 GPS in box...

still forum
#

add diag_log's to log _GPS and itemCargo _container
To see whats in there. Then you can manually try to do arrayIntersect in your head, and you'll probably see the issue

lyric plover
#

Hello, if this chat isn't taken then may I ask how would I print the 3D coordinates of an object (example: helicopter in mid-flight) that I click in Zeus?

#

Assuming I click it with a composition with the appropriate code inside to print the object's position?

#

Like the vanilla Zeus lightning, arsenal and remote control modules that somehow detect the object without the 3D position part.

late drum
#

How can I know if an attachment is an optic, bipod, mizzle or pointer? Because on the CfgWeapons, in type, every attachment have the same type number (131072)

hallow mortar
proven charm
#
this addEventHandler ["CuratorObjectSelectionChanged", {
 params ["_curator", "_entity"];
 hint format ["Pos: %1", getposATL _entity];
}];
fleet sand
#

Quick question does anybody here have expirience with particles. What is the best way to crate them and edit them so its in real time?
I need it for GAS zones That would be around the map.
I am looking for something like in DAYZ gas zone.

lyric plover
#

Please bear with me as I'm a beginner in Arma 3 scripting.