#arma3_scripting

1 messages · Page 32 of 1

hallow mortar
#

Interesting. I figured handling velocity stuff would be done by physics. So what actually happens if you setVelocity a non-physics object? It just...goes forever?

tough abyss
#

Come to think of it, there's a chance I'm misremembering. Going to test now to be sure.

#

Yup nevermind lol it does depend on physics, I must've been thinking of something else

granite sky
#

My recollection of setVelocity on non-physics objects is that it makes them silently lethal :P

#

They don't move, but if you touch them then you die.

tough abyss
#

🤔

#

just tested, yup, makes them lethal

granite sky
#

We had an issue that was quite hard to resolve where the velocity would transfer (and remain) if you detached them while moving.

tough abyss
#

I find anything to do with attaching to be messy business

granite sky
#

Trouble is that the detaching messes with the locality, and setVelocity needs to be local.

hallow mortar
#

Seems like a remoteExec with the object as locality argument would solve that neatly

granite sky
#

Nah, because the locality switch isn't instantaneous.

hallow mortar
#

Okay, but if it hasn't switched yet the command should still end up in the right place because the remoteExec locality argument automatically targets wherever it's currently local, no?

granite sky
#

Might be misremembering. I think it worked out by doing setVelocity twice.

#

Once locally and once on with the targeted remoteExec.

#

Otherwise the player that dropped the object could be killed before the setVelocity landed.

hallow mortar
#

Interesting. I would have thought that if the remoteExec target resolved as the local client, it wouldn't need to go all the way out and back in again before taking effect

granite sky
#

I'm not sure I ever checked where the remoteExec actually ended up.

#

Possibly setVelocity works like setMass, and has a local effect on non-local objects until the sync catches up.

hallow mortar
#

Dude setMass locality is such a pain. I used it for a towing thing and I ended up having to force set the owner of the vehicle and remoteExec setMass twice. Otherwise it would just. not do anything

tough abyss
#

I had a lot of fun with velocity and mass locality with a black hole script

#

never got it to work as smoothly in MP as in SP but it was good enough lol

manic kettle
#

Hello gents,
I want to replicate Alive logistics functionality of allowing players to pick up specific objects and move them around (static objects, turrets, etc). So far i believe this is probably done by attaching the object to the player and then releasing it on an action? This seems like one possibility but not the best. Ideally i would like for them to rotate objects.

Would anyone have any advice?

tough abyss
#

The bigger question would be how to implement the controls for rotation; it could be anything as simple (but imprecise) as actions for rotating in 30/60/90 degree increments on different axes, or a more versatile system based on keybinds or some other sort of smooth tracking.

manic kettle
#

Yes thank you that's exactly what I'm looking for. Good insight. I was thinking of keybind route but a simple rotate 45 degrees could be sufficient. I'll have to think on it

tough abyss
#

👍

#

Also keep in mind (if you don't know already) that objects have no collisions while attached to other objects.

#

So if your application requires any sort of bound checking, you'll need to do it manually.

manic kettle
#

Ah i didn't consider that, makes sense. Is there a function that checks for collisions? I'll have a look around

chrome hinge
#

anyone know how BIS_fnc_threat is calculated?

tough abyss
#

Ultimately you may end up wanting to use a raycasting-based technique with something like lineIntersectsSurfaces

tough abyss
manic kettle
#

I think surface collision would be my primary concern for this application. I'll have a look and play with those, thank you again.

tough abyss
#

Yup no problem

rigid cedar
#

Can anyone remind me if the doStop this; command works?

#

I tried it on AI recently and it just stopped them from moving altogether

jade acorn
#

it does

rigid cedar
#

Hmm, ill have to check it out

wary sandal
#

well

#

i had that in mind but how do i move the static element then?

#

i've tried setVelocityTransformation and setPosASL in an onEachFrame loop but it doesn't seem to move

#

is it because it is static or something?

#

i'm using a sandbag for the test

#

the code : ```
onEachFrame { hint "test";
this setVelocityTransformation [
[-4, -153, 195.97],
[-4, -200, 195.97],
[0,0,0],
[0,0,0],
[0,1,0],
[0,1,0],
[0,0,1],
[0,0,1],
0
]
};

south swan
#

"this" isn't defined inside onEachFrame, most likely

wary sandal
#

if it isn't

sharp grotto
#

it was just a guess on my side

wary sandal
wary sandal
sharp grotto
#

you can still attach it to a different vehicle like the other guys mentioned ^^

wary sandal
#

if i use a boat the whole ship would be affected by the swell

#

plus AI sailing is kinda wacky, it starts going right and left when i tell it to go foward

#

hmm

tough abyss
#

lol I see the issue

tough abyss
wary sandal
#

it's set to 0 on the example wiki code

tough abyss
#

Indeed but it's probably not the type of interval you're thinking of (i.e. a time interval)

wary sandal
#

update delta or something?

#

what should i set it to

tough abyss
#

it's the interval of the translation as a whole, 0 means it stays exactly as it starts

wary sandal
#

ooooh

tough abyss
#

1 means it's at the final position/orientation

wary sandal
#

basically it's just a lerp

tough abyss
#

bingo

wary sandal
#

nice, got it

tough abyss
#

the first 8 parameters are just defining the initial/final position/velocity/rotation

#

then it lerps them all w/ the interval param

wary sandal
#

still does nothing

#

it should move the object half way to the end position right

tough abyss
#

nope, that's telling it to set everything to halfway

#

you need to increment the interval yourself

#

from 0-1

wary sandal
#

the object stays still

#

doesn't move at all

#

it should from my understanding

tough abyss
#

Is it in the same spot if the interval's set to 0?

wary sandal
#

yeah

#

what objects does this command work with?

tough abyss
#

should work with anything, I've used it for multi-piece ships like that before myself

#

I suspect something else is wrong

wary sandal
#

included as much detail as i could

tough abyss
#

mm

#

do me a favor and just run this on its own

#
this setVelocityTransformation [ 
[0, 0, 186.014], 
[0, -200, 186.014], 
[0,0,0],  
[0,0,0],  
[0,1,0],  
[0,1,0],  
[0,0,1],  
[0,0,1], 
0.5
];
#

and see if it moves

wary sandal
#

so something is wrong with oneachframe

tough abyss
#

Yeah, that's not the best way to do each-frame stuff anymore anyways

#

highly discourage using it

wary sandal
#

what do you recommend me to use?

tough abyss
#

use ```sqf
addMissionEventHandler ["EachFrame", {
// code here
}];

instead
wary sandal
#

oh nice

#

yeah that looks a bit more fancy

tough abyss
#

regardless, none of this is going to fix the underlying issue, which is that you still need to increment the interval yourself if you want smooth movement

#

as it currently goes you're just setting a fixed pos

wary sandal
#

lol

tough abyss
#

what's the current code?

wary sandal
# tough abyss what's the current code?
addMissionEventHandler ["EachFrame", { 
this setVelocityTransformation [  
[0, 0, 186.014],  
[0, 200, 186.014],  
[0,0,0],   
[0,0,0],   
[0,1,0],   
[0,1,0],   
[0,0,1],   
[0,0,1],  
interval 
]
}];```
tough abyss
#

yup this isn't gonna work anymore as it won't carry into the EH scope

#

nor will interval

wary sandal
#

by throwing an error

tough abyss
#

oh don't give it too much credit, arma loves to be unhelpful

wary sandal
#

indeed

tough abyss
#

anyways it's an easy issue to get around

#

addMissionEventHandler takes a third param for passing parameters to the EH

#

which you can access inside the EH via _thisArgs

wary sandal
#

}, interval, this]; like this?

tough abyss
#

}, [interval, this]];

wary sandal
#

i know this

tough abyss
#

almost everything other than init statements uses _this, it's the general magic variable for parameters

#

this particular EH uses _thisArgs

#

and just like _this you can format it into vars using params

wary sandal
#

just like this params["interval", "this"]?

tough abyss
#

i.e. in the EH you can do

_thisArgs params ["_interval", "_boat"];
#

using _boat instead of _this because _this is still a "reserved" variable name

wary sandal
#

indeed

#

my bad

#

back to the initial topic

#

incrementing the interval value

#

i do something like _interval = _interval + 1/60 ?

tough abyss
#

something like that would do, yeah

#

you'll also want to detect when the interval reaches 1 and exit the EH accordingly

#

which you can do from inside the EH via:

#
removeMissionEventHandler ["EachFrame", _thisEventHandler];
wary sandal
#

i have an issue there

tough abyss
#

?

wary sandal
#

when i increment _interval it just says 1/60

#

it doesn't actually increment

#

hold on

#

addMissionEventHandler ["EachFrame", {
_thisArgs params ["_interval", "_boat"];
_interval = _interval + 1 / 60;
hint (str _interval);
_boat setVelocityTransformation [  
[0, 0, 0],  
[0, 200, 0],  
[0,0,0],   
[0,0,0],   
[0,-1,0],   
[0,-1,0],   
[0,0,1],   
[0,0,1],  
_interval
]
}, [interval, this]];```
tough abyss
#

how about

#
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_interval", "_boat"];
_thisArgs set [0, _interval + 1 / 60];
hint (str _interval);
_boat setVelocityTransformation [  
[0, 0, 0],  
[0, 200, 0],  
[0,0,0],   
[0,0,0],   
[0,-1,0],   
[0,-1,0],   
[0,0,1],   
[0,0,1],  
_interval
]
}, [0, this]];
wary sandal
#

oo

#

_thisArgs set

#

also since when does discord support sqf?

tough abyss
#

discord uses an external formatting library for text highlighting which happens to support (most) of sqf

#

aside from some of the newer stuff

wary sandal
#

sweet

tough abyss
wary sandal
#

perfect

#

it works like a charm

#

thanks mate!

tough abyss
#

no problem

#

(make sure to add that 1 cutoff if you've not yet)

#

otherwise it's gonna keep looping every frame and incrementing

wary sandal
tough abyss
#

As in, from inside the EH or outside?

wary sandal
#

from inside

tough abyss
wary sandal
#

oh

#

didn't realize this variable was a thing haha

tough abyss
#

yup another wonderful magic variable

#

^ full documentation

wary sandal
#
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_interval", "_boat", "_thisEventHandler"];
_thisArgs set [0, _interval + (1/60 / 3)];

if (_interval > 1) then { removeMissionEventHandler ["EachFrame", _thisEventHandler]; return };

_boat setVelocityTransformation [  
[0, 0, 0],  
[0, 200, 0],  
[0,0,0],   
[0,0,0],   
[0,-1,0],   
[0,-1,0],   
[0,0,1],   
[0,0,1],  
_interval
]
}, [0, this]];```
#

should do its job

#

another question if it isn't too much asked, is it possible to attach speedboats at the bow of the ship to add some foam effects?

tough abyss
#

careful, return isn't valid sqf

south swan
#

_thisArgs params ["_interval", "_boat", "_thisEventHandler"]; wut

tough abyss
#

^ and that

wary sandal
tough abyss
#

I would recommend

if (_interval > 1) exitWith { removeMissionEventHandler ["EachFrame", _thisEventHandler] };

:)

#

understandable, I sometimes find myself writing SQF like C and have to slap myself

south swan
#

still better than writing C like SQF

tough abyss
#

very true

wary sandal
tough abyss
#

at least a C compiler will actually give me helpful errors

#

unlike... something else...

wary sandal
tough abyss
#

anyone's guess meowsweats

wary sandal
#

imma ask again since my question has gone unnoticed

tough abyss
#

possible, yes, I have no idea if it'll work nearly as well as you may require

wary sandal
#

or maybe i can directly use particle emitters or some stuff? I have no clue how this works on arma

south swan
#

at least it doesn't point to different statement 10 lines away with strangely fitting error message

tough abyss
#

particle emitters would probably be the way to go

#

but they're... complicated

#

especially if you want to do them purely with SQF and no CfgCloudlets trickery

#

there might be an existing particle effect for ocean foam, but I'm not aware of one

wary sandal
#

i know there's the splendid config viewer but it has no search function

tough abyss
#

You can dig through CfgCloudlets in config viewer

#

or you can unpack the game files and dig through \A3\Data_F\ParticleEffects for the actual particle resources

#

as for a clean list... I'm not aware of one

#

welcome to Arma!

#

if you want to "easily" see everything in CfgCloudlets, though, you can run the following and work with the output:

#
"true" configClasses (configFile >> "CfgCloudlets");
#

that'll get you every class

wary sandal
wary sandal
tough abyss
#

lots and lots of fun parameters

#

I hope you like typing

wary sandal
wary sandal
#

i've managed to get it to emit pretty easily but some particles don't work for some reasons

#

WaterSplash works but WaterWave doesn't

tough abyss
#

would probably need to mess with the particleparams to get some of them working

chrome hinge
#

Is it possible to have a trigger triggered by blufor presence but have it not trigger if blufor name is in a array?

little raptor
#

yes

chrome hinge
#

How can i do that?

little raptor
#
this && {!(_name in thisList)}
#

by _name I meant unit btw

#

not actual name

south swan
#

or this && {(thisList - _ignoreList) isNotEqualTo []}

little raptor
#

findAny is faster

south swan
#

except doesn't actually fit the logic of "trigger on all blufor unit that are not in the list" 🤔

polar belfry
#

are there any global variables like one that means all planes

chrome hinge
#

should it still work?

little raptor
south swan
#
thisList = [1,2,3,4]; 
_ignoreList = [1,2,3];
thisList findAny _ignoreList == 1; // < 0 == false
thisList - _ignoreList == [4]; // isNotEqualTo [] == true```
chrome hinge
south swan
#

this && {thisList findIf {!(_x in _ignoreList)} > -1} to stop the execution on first match, probably

chrome hinge
#

Alrighty i think this is enough to get testing going

#

thanks a lot lads 🙂

polar belfry
#

I have a question a lot of people online write in their code _truck or _plane

#

what does it mean

south swan
#

_varName means that variable is local/private and isn't accessible from other scope/scripts, only current and child ones;
varName means that variable is global and is accessible pretty much anywhere after it's declared.
Looks like convention, but seems to actually work on syntax level 🤷‍♂️

polar belfry
#

ok

#

cause I was thinking running a radio alpha type trigger that would repair the vehicle of the player that called it

#

It's for a boss fight

polar belfry
#

condition (objectParent boss == plane)
on activation plane setVehicleAmmo 1;
Don't know if it's correct

dreamy kestrel
#

oh it appears even stranger than I first suspected... which brings me back maybe I need to measure a sensible timer between a button click and click and hold gestures... this is what I get for a typical mouse click, distilled from log.

fn_buildUI_ctrlBg_onMouseButtonDown
fn_buildUI_ctrlBg_onMouseButtonUp
fn_buildUI_ctrlBg_onMouseButtonDown
fn_buildUI_ctrlBg_onMouseButtonUp
fn_buildUI_ctrlBg_onMouseButtonDown
fn_buildUI_ctrlBg_onMouseButtonUp
fn_buildUI_ctrlBg_onMouseButtonClick
fn_buildUI_ctrlBg_onMouseButtonDown
fn_buildUI_ctrlBg_onMouseButtonUp
fn_buildUI_ctrlBg_onMouseButtonClick

Not sure why the down up down up gymnastics... oh wait I think I know, between right clicks and engaging the toolbox, that is what that is.
But at some level that at least jives with what I would otherwise expect.

dreamy kestrel
polar belfry
#

mp

#

I want only the plane that the boss is in to be rearmed

dreamy kestrel
south swan
#

condition/activation sounds kinda like trigger 🤷‍♂️

polar belfry
#

it's a trigger that the boss(one of the zeuses) can call with support radio

dreamy kestrel
little raptor
#

I also changed it to setVehicleAmmoDef because I think you want to restore all of its ammo

polar belfry
#

I want to restore all it's ammo

#

I found a ready script

#

I'll be calling that

#

thanks for the help

agile cargo
#

anyone got a snippet to teleport a large amount of players to a position safely and avoid getting people Arma'd?

winter rose
#
{ _x setPos getPos _theDestination } forEach units _theGroup;
```😂
agile cargo
hallow mortar
south swan
#

and placement

agile cargo
#

I saw that, but I'm not sure it will recognize new vehicles(players) being teleported in the same execution

#

I'll do some tests

thorny gull
#

I’m currently working on a loadout script, and I am wondering if I have to name every unit with a variable name, or if there is a way to simplify it to a script in the unit using something like “_this” instead of “[Variable Name]”

#

Because I don’t want to make 98 Variable names

#

The loadout script uses a line in the Init that executes an SQF with the loadout in it, as well as a line of code that checks to see if a player is in the slot

little raptor
thorny gull
#

I’m doing it with a Separate SQF so that I can give the files to mission makers within the unit

#

I’m wondering if there is a magic variable or something that can take the place of the variable name

little raptor
#

well if you have all units in an array you can do a forEach loop and use the magic variable _x

#

but in any case showing a snippet of your scripts would be more useful than explaining it in words

thorny gull
#

Unit Init:
[Variable Name] execVM "Loadout.sqf

#

Loadout Sqf:
`waitUntil {!isNull player};

[Loadout stuff here/below]`

little raptor
little raptor
thorny gull
#

I tried _this execVM etc

little raptor
#

this not _this

little raptor
#

if you use player to set the loudout

#

init runs for every joining unit

thorny gull
#

ah

thorny gull
little raptor
#

have you put that in the init of more than 1 unit?

thorny gull
#

o h

thorny gull
little raptor
#

everytime a new player joins

thorny gull
#

ah

#

would removing it fix that?

#

without breaking the script

little raptor
#

removing what?

thorny gull
#

that line

little raptor
#

no

thorny gull
#

would I then replace the player variable with a this variable?

#

also the Sqf only runs when its called for by the execVM in each units init, wouldnt that line only run for that slot?

little raptor
#

no. change it to:

if (local this) then {
  [this] execVM "Loadout.sqf"
};

and:

params ["_unit"];

[Loadout stuff here/below]
_unit setUnitLoadout ...
thorny gull
#

since its only being called on that one unit?

little raptor
#

well for that unit yes, but for previous units it runs again and again every time a new player joins

#

also one other thing I forgot to mention is that you can't change the unit loadout like that if you use respawn loadouts

thorny gull
#

there isnt respawn loadouts, each loadout is set at the start

little raptor
#

you did something wrong blobdoggoshruggoogly

thorny gull
#

I got it to work

mental prairie
#

Is edge detection post processing possible in arma without the use of external stuff?

dreamy kestrel
#

short answer I don't think so; there is crude support for .paa internal image resources, loading those and such, that's about it, AFAIK.

mental prairie
dreamy kestrel
#

I duck that phrase and it pops up with image processing.

manic kettle
#

I understated it as typically image processing yeah

dreamy kestrel
#

collision detection perhaps? otherwise I have no idea 🤷‍♂️

hallow mortar
#

Post-processing is processing the game does to the final render of the 3D scene. Examples would be colour correction, contrast etc. Edge detection post-processing is stuff that's based on...detecting edges in the scene. This would be stuff like anti-aliasing or one of those "cartoon" filters that draws lines on edges.

dreamy kestrel
#

it does feel something like a 'toy' sim from time to time, in that regard. and yes tricks like aliasing helps to soften those edges a bit. depends on the models too how sharp those edges are, I think.

#

IDK if that is what the OP meant

jade acorn
#

I assume exer brought this topic because people really want to make that new US thermal vision imagery in game, where it shows outlines of objects pretty well

#

possible with reshade to a certain point, probably impossible to be done in-game without injecting stuff through a custom dll

#

but then it would be still the same thing as using reshade.

dreamy kestrel
#

really hmm... I have noticed that, on some models. but mostly, depending on the camera view range, zoom, etc, all you get is the heat splotch, which is pretty realistic, I think.

jade acorn
#

(or to highlight objects you're looking at, I tried to get some info about it but impossible to be done too)

hallow mortar
#

I guess with a custom DLL/extension you might be able to actually mechanically tie it to use of night vision, rather than Reshade just being on all the time or manually toggled on an honour system.
I don't know enough about Arma extensions to say if it's possible to actually hack the renderer like that though.

  • duh reshade does it of course it's possible. What I mean is how easy it is to connect a reshadealike to a proper A3 extension that can communicate with the game
dreamy kestrel
#

I'm not sure why you'd want to...

hallow mortar
#

...because you want to create post-processing effects that are not otherwise possible, like we've just been talking about?

wraith umbra
#

So how would I use the _obj setObjectTexture [0, "#(rgb,8,8,3)color(1,0,0,1)"]; command to set something to a different color? I wanna set a Little Bird to be a specific color of green

#

Specifically, what part of the [0, "#(rgb,8,8,3)color(1,0,0,1)"]; part would I want to change?

hallow mortar
wraith umbra
#

Alright, thanks.

#

Sweet, got a blue Little Bird

dreamy kestrel
#

Q: is there a vector or other way of merging two or more vectors together, item for item. i.e.

_a = [...];
_b = [...];
_z = [[_a select 0, _b select 0], [_a select 1, _b select 1], ...];
dreamy kestrel
dreamy kestrel
tough abyss
#

@dreamy kestrel what exactly should the end result look like? Confused at what you want here

#

Mm nvm I see above

#
{
_a set [_forEachIndex, [_x, _b#_forEachIndex]];
} forEach _a;
#

Will convert _a to what you want

copper raven
fair drum
#

is there a command to check if a number given is a float?

torpid quartz
#

Hey just a questions with the example on
https://community.bistudio.com/wiki/BIS_fnc_fadeEffect

[1, "WHITE", 5, 1] spawn BIS_fnc_fadeEffect;```

I've tried running this on a trigger and in Zues with the exe module, but both times it will just flash white for a split second, then blur the player's vission before returning it to normal.

I can turn off the blur by making the last "1" a "0" but changing the duration does nothing.

Is this broken at the moment? should I be using something else?
fair drum
copper raven
torpid quartz
fair drum
copper raven
#

there's no built in command, no

#

but keep in mind for bigger numbers it will become unreliable fast

fair drum
tough abyss
#

^ may be useful

chrome hinge
#

does commander immediatedly get the knowsabout value of subordinates targets?

tough abyss
#

@chrome hinge See the notes on this page;

naive needle
#

Is there a way to check if the action is showing ?

#

I dont mean the scrollwheel menu on the left, because there is a command for that. I mean when you hover over a door for example. I want to know when the Action is visible

radiant siren
naive needle
#

I know a workaround but I would need to check with getCursorObjectParams if its a door for example. And other checks for other actions. But maybe there is some sort of command to check if its open ?

winter rose
#

there is isActionMenuVisible but the scroll wheel menu has to be opened, not just "an action is possible"

naive needle
#

yea thats what I said earlier , unlucky

#

I think I have to go with the workaround

winter rose
#

there is inGameUISetEventHandler but it is a set, not an add

naive needle
fallow pawn
#

This question may be a stretch, sorry if it is, but:
Can one intercept (and eventually change) the code fired, let's say, from a "Get In" action on a vanilla vehicle WITHOUT inGameUISetEventHandler nor mods?

hallow mortar
#

You can't stop the action (other than by locking the vehicle) but you can use a GetIn/GetInMan event handler to immediately counteract it

fallow pawn
#

Thanks for clarification

tough abyss
#

best-practice in arma meowsweats

wary sandal
#

doesn't come as close to the default foam effect but i'm fine by this one

tough abyss
#

very nice!

pulsar bluff
#

is there a conventional way to delete/remove a backpack (or other item) from a crate

#

like there is no "removeBackpackCargo" command

#

or "removeWeaponCargo" etc

winter rose
#

no

pulsar bluff
#

if a crate were overfilled, what would be a good way to "un over fill" it

#

my initial thought is to add up the mass of the items inside until the threshold, clear it, then add only those items back

opal zephyr
#

^I think that would be the best option, another would be to track the items getting put into it, and then as soon as it gets overfilled, remove the last item that was put in. I did something similarly for a player carryweight system

granite sky
#

IIRC it is lacking functions to remove items from containers though, so clear & refill might be the only way.

opal zephyr
#

woops, misinterpreted the msg

sharp grotto
jade acorn
#

wait there's really no way to remove container from container other than taking it out manually?

sharp grotto
jade acorn
#

omg

naive needle
#

That was so much pain writing that script... Removing items from a sub container of an container notlikemeow

pulsar bluff
#

yea im not doing sub containers

#

@jade acorn yea there is only "addMagazineCargo" and "clearMagazineCargo"

#

to subtract, you need to clear, do the math and re-add

#

in any case ive solved the issues in my system .. basically preventing overfilling

#

basically this sort of structure

#
case (isclass (configfile >> "cfgweapons" >> _class)): {
    _mass = getNumber (configFile >> "cfgweapons" >> _class >> "WeaponSlotsInfo" >> "mass");
    if ((_speculativeLoad + _mass) <= _maxLoad) then {
        for '_z' from 1 to _value step 1 do {
            _a = _a + 1;
            _speculativeLoad = _speculativeLoad + _mass;
            if (_speculativeLoad >= _maxLoad) exitWith {};
        };
        if (_speculativeLoad > _maxLoad) then {
            _a = _a - 1;
        };
        _weaponsToLoad pushBack [_class,_a];
    };
};```
#

my guess is @meager granite has some workaround using a dummy unit to remove items from the crate or something

manic kettle
#

You could eliminate an if statement if you used else instead

granite sky
#

Uh, most of the code can be replaced with divide + floor :P

#

Like _maxCount = floor ((_maxLoad - _curLoad) / _itemMass);

meager granite
dreamy kestrel
shut reef
wary needle
#

how do i attach a thing to a vics turrent, like a sheild

dreamy kestrel
hallow mortar
stable dune
#

Hi, how do I configure safepos if I want to randomly spawn objects in a specific area (marker area) but I want them at least 100m apart but randomly in that area if there is no spawn it will remove the current object.

wary sandal
#

i've seen a walkable ship library somewhere, it shouldn't be too hard to use my particle thing with it

frank mango
#

Attempting to use bis_fnc_target for the Scoreboard UI.
So far, everything apart from targets registering hits seems to work.

Are there some targets that are compatible and some that aren't?; atm I am using "Pop-Up Target 1"

exotic flame
#

Is there a command to force the player to switch to run ?

winter rose
#

no.

winter rose
ripe sapphire
exotic flame
winter rose
#

well, unless heavy scripting I guess

drowsy geyser
#

releated to this:
i guess it is not possible to switch the Speed mode of a player via code?

#

can I force a player to sprint when he presses 'W'?

willow hound
#

???

drowsy geyser
#

I mean there are different speed modes and i was asking if I can force the players speed mode to sprinting only

tough abyss
#

player setVelocity _newVel meowsweats

willow hound
#

I am confused because Lou answered that same exact question right above where you asked it, and you even wrote that your question is related to that conversation.

dreamy kestrel
#

Q: re: switch, cases evaluate in sequence? like a series of nested if statements? i.e. if (cond1) then {} else {if (cond2) then {} else {...}}? thanks...

dreamy kestrel
south swan
#

Checks if the given parameter matches any case. If so, the code block of that case will be executed. After that the switch ends so no further cases will be checked.
Going by bare documentation your assumption is correct

dreamy kestrel
#

mainly for use cases such as:

switch (true) do {
  case (_cond1): {};
  case (_cond2): {}; // !_cond1
  case (_cond3): {}; // !(_cond1 || _cond2)
  // ...
};
copper raven
#

if cond1 had a body then yes

#

yes, exactly what you wrote

dreamy kestrel
#

sweet cool thanks

copper raven
#

alive doesn't take string

#

it takes an object

#

game won't magically guess which B_Truck_01_transport_F you're referring to

#

assign it to a global variable or something

#

when you're creating it

#

it doesn't matter, you need an object reference, even if it's the only one

#
tag_myVehicle = createVehicle ...;

// sometime later
if !alive tag_myVehicle then { hint "its destroyed" }
astral bone
#

I don't suppose anyone already has something that will have AI avoid an area?

#

or well- hm- idk how to ask that xD

#

Basically, I wanna have an area that when the AI enter, they will try to leave. However, somehow, I'd like it so you can tell them to ignore the area and proceed as normal, although that isn't strictly required.

#

Wondering if anyone has any ideas how to go about doing this. I am gonna have a gameLogic that will call a function to create a trigger and marker for said trigger. Then the trigger will activate when anyone enters. If the unit is not apart of friendly sides, it will should try getting the unit out of the trigger area. But curious how I should get them out.

#

Just put a move waypoint directly behind them? Well then they'd need to turn around completely and if they're a plane, it'd probably mean they'd spend more time in the area.

#

But I do think I will make them be set to careless, then the waypoint resumes their behavior.

runic stratus
#

Is there anyway to check if a unit is either surrendered or cuffed via ACE3?

hallow mortar
#

You could try captiveNum, but ACE might track it with a variable of its own instead. You'd retrieve that with getVariable but you'll want to check the ACE documentation to find the name of it.

runic stratus
#

cheers, turned out the variable is ace_captives_ishandcuffed
was trying via the captive method from basegame 🤦‍♂️

shut reef
wary sandal
#

he said in his github that you could walk and land helis on it

#

not sure tho

#

it was even possible back in 2013 haha

south swan
wary sandal
#

Does anyone know why is my light flare not appearing?

private _lightpoint = "#lightpoint" createVehicleLocal [0, 0, 0];
_lightpoint attachTo [this, [0, 0, 10]];
_lightpoint setLightColor [1,0,0]; 
_lightpoint setLightAmbient [1,0,0]; 
_lightpoint setLightUseFlare true;
_lightpoint setLightFlareSize 10;
_lightpoint setLightFlareMaxDistance 2; 
_lightpoint setLightBrightness 2;
_lightpoint setLightDayLight true;
#

i might be misunderstanding how light sources work there

south swan
#

Sets max distance where the flare is visible.
are those meters?

shut reef
wary sandal
#

i just had to read the property name again

#

it's the distance at which the flare is displayed

#

i thought it was connected to the ambient light but no

honest pilot
#

Hey,
so I'm trying to see if there is a script for Disable an UGV (like an RCWS)
the script would make the UGV point the turret to the ground avoid autocombat and firing with the engine off

granite sky
#

Deleting the crew would be the easiest way.

honest pilot
#

but its an UVG

warm hedge
#

UAV/UGV have their "invisible" crews

quaint oyster
#

Is it possible to disable "open door" and most of the other default scroll actions?

copper raven
#

but that won't remove the action (like i said), it will still be there except that it won't do anything if you activate it

quaint oyster
#

hmm, that might work out, some chap released a lockpicking script and it uses the default funcitons, but players are bypassing the lockpicking currently with "open door"

hallow mortar
#

A good lock picking script should use the standard ability to lock doors: https://forums.bohemia.net/forums/topic/146824-locking-doors/?do=findComment&comment=2347647 which cannot be bypassed just by using the "open door" action. The script may be intended to work in tandem with your own implementation of this, or it may handle it itself and it just needs some configuration. You'd need to check the script's documentation to see how you're supposed to use it.

quaint oyster
#

I think the problem might be I'm using a building script that replaces the default buildings with livonia ones, then I had this variable mistyped:

  _parent_object setVariable ["bis_disabled_1", (selectRandom [1,2]), true];
#

I think its supposed to be

  _parent_object setVariable ["bis_disabled_door_1", (selectRandom [1,2]), true];
#

if i understood correctly

copper raven
#

the latter is correct

cobalt path
#

Long ago I was looking for a script that when I press a key on my keyboard, it executes an sqf
I remember I got a code like this:

moduleName_keyDownEHId = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 71) then {["radioprofile1.sqf"] remoteExec ["execVM", 0];}}];
moduleName_keyDownEHId = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 72) then {["radioprofile2.sqf"] remoteExec ["execVM", 0];}}];
moduleName_keyDownEHId = (findDisplay 312) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 71) then {["radioprofile1.sqf"] remoteExec ["execVM", 0];}}];
moduleName_keyDownEHId = (findDisplay 312) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 72) then {["radioprofile2.sqf"] remoteExec ["execVM", 0];}}];

Issue is, if I execute it locally, I can press the button but the sqf (which displays a picture on people screen) will only do it to me. And if I execute it server side, than everyone can press that button and it gets executed.
Anyway to do it so only when I press it it works?

little raptor
cobalt path
#

They should not have access to activation, they should feel the effect

little raptor
#

you can check for player uid

#

or if you have a special role (e.g. admin) there are ways to make it only work for admins as well

cobalt path
#

hmm fair point, I might look into whole uid thing

little raptor
#

another way is executing the script via your own player's init

#

and checking for local

#

but you only need that if you want to share your mission

cobalt path
#

is that execution via eden or zeus

#

you sure? Because wont local execute on player just means people wont be able to see the effect, only I will

little raptor
#

that's not what I meant

#

in player's init:

if (local this) then {
  execVM "script.sqf";
}
little raptor
#

but you need to add a waitUntil {!isNull findDisplay 46} in there too

cobalt path
#

okay gotcha

#

I think I understand

chrome hinge
#

Does triggerAttachVehicle work to multiple units?

cosmic lichen
hallow mortar
#

On the other hand, for some reason its targets parameter is an array, which seems unnecessary if it can't be used with multiple objects

copper raven
#

If [] is given, the trigger is decoupled from the assigned vehicle (example 2).

hallow mortar
#

In my experience, single-target commands usually use objNull for that rather than making the whole thing a 1-entry array just so they can accept []. It isn't impossible that that's what's happening, but I think there is room for reasonable doubt until it gets clarified.

copper raven
#

yeah, probably just some older command

chrome hinge
#

Also the parameters say objects, but when i tested it said 1 is expected

vernal mural
#

I had a strange error a few minutes ago :
Error GIO pre stack size violation

#

I have no idea what I did to provoke this (it was during a mission startup triggered with the "Restart" button in Eden solo preview)

#

I can't have it again since, and still no idea what I changed in my init.sqf to make this appear

#

any idea of what it means ?

#

going back my git log, it seems that this is due to a select {code} statement on an array

granite sky
#

It's probably a badly handled syntax error.

#

Is it the first error in the RPT?

vernal mural
#

the expression was, until a few commits ago :
{_x getVariable ["some_variable", ""]}

#

this is wrong of course

#

since as soon as there is an object in the array that does not have said variable defined, the code default to an empty string, which is not a valid boolean value

#

That said, I have no idea why this error happens only now. The chance of having encountered only objects with defined variable prior to now are very very close to zero

granite sky
#

You'd probably get a different error in that case anyway.

vernal mural
#

Replacing the default "" with false" make the error go away, that's what I changed without paying to much attention

vernal mural
#

this is a "lab" mission that I use to develop some proof of concept

#

there is a loooooot of bad code out there

granite sky
#

I'm confused. Is it working now or not :P

vernal mural
#

now it does

#

and I know why

#

but before, it did too

#

and I don't know why

#

(and it is not so important, I'm just curious at this point)

#

getting "new" errors after years of SQF coding is not that common

#

usually it means it f*cked up really hard

granite sky
#

Dedmen does attempt to fix stuff. When you fix things in Arma it's often going to break something else :P

vernal mural
#

I like breaking stuff that he didnt fix yet

#

makes me feel like a deep jungle explorer

#

a wild, forgotten world with antique ruins

#

mystery at every corner

#

and a very weird, forgotten language

#

"This sculpture is engraved with words.... I can barely read.... Error GIO... pre stack size... violation. I wonder what this mean. Beware for traps !"

#

anyway, I'm getting lost here

#

thanks @granite sky

copper raven
#

i was never able to reproduce that error 😄

#

and it's always something with getVariable

vernal mural
#

Well the narrative of the lost jungle civilization thickens

#

"Look ! Footsteps ! We are not the first ones here, someone is prowling around..."

tough abyss
#
KK_fnc_forceRagdoll = {
    if (vehicle player != player) exitWith {};
    private "_rag";
    _rag = "Land_Can_V3_F" createVehicleLocal [0,0,0];
    _rag setMass 1e10;
    _rag attachTo [_list, [0,0,0], "Spine3"];
    _rag setVelocity [0,0,6];
    detach _rag;
    0 = _rag spawn {
        deleteVehicle _this;
    };
};

ncl_spookparticle = [] spawn  
{ 
_ps1 = "#particlesource" createVehicle getpos spawnpos3; 
[_ps1, [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,13,2,0],"","Billboard",0.07,5,[0,0,0],[0,0,6],0,0,7.9,0.1,[0.5],[[0.305037,0,1,0.555015]],[1000],1,0,"","","",0,false,0,[[0,0,0,0]]]] remoteExec ["setParticleParams"]; 
[_ps1, [1,[2,2,2],[0,0,15],20,0,[0.550799,0,1,0.146989],0,0,1,0]] remoteExec ["setParticleRandom"]; 
[_ps1, [0,[0,0,0]]] remoteExec ["setParticleCircle"]; 
[_ps1, [0,0,0]] remoteExec ["setParticleFire"]; 
[_ps1, 0.01] remoteExec ["setDropInterval"]; 
while {true} do 
{ 
sleep 2; 
_List = spawnpos3 nearEntities ["man", 5]; 
{

call KK_fnc_forceRagdoll;

} foreach _List; 
}; 
};
``` so im trying to make particles appear and when a player steps into them they have kk_fnc_forceragdoll called/remotexecuted on them but i am kinda stupid and cant remember how to best apply a function on a player would it be best to use call or remotexec?
#

nothing happens when i call the fnc how should i go about it?

hallow mortar
#

It depends on the locality of the function.
In this case it appears the function uses local commands such as player, so it needs to be remoteExec'd with the player in question as the locality target.

#

That is, assuming this code is being executed only on the server

tough abyss
hallow mortar
#

No, init fields are executed on all machines

tough abyss
#

ah ok

hallow mortar
#
  • move the function definition to CfgFunctions
  • change the particle creation to a function and remoteExec that - using createVehicleLocal - instead of remoteExecing every command in it
  • remoteExec your functions from a server-only context to avoid duplication
  • when remoteExecing the ragdoll function, use _list as the locality target instead of doing forEach
  • consider adding a filter to confirm the units in _list are actually players
#

Note: the system could also be changed to operate locally on each client instead of using remoteExec, but this is more complex to explain how to get there from here

pulsar bluff
#

@tough abyss that is an old method for unit/player knock down

tough abyss
#

easiest way i can see to set their velocity after ragdolling them

pulsar bluff
#

how do you want them to go flying

tough abyss
#

setvelocity

warm hedge
#

He meant addForce is much more reliable and newer way

pulsar bluff
#
TAG_fnc_knockDown = {
    if !(canSuspend) exitWith {systemchat 'you need to spawn this function, not call it';};
    params [
        ['_unit',player],
        ['_force',[[0,1,0],[0,0,0]]]
    ];
    _unit addForce _force;
    waitUntil {
        (
            ((pose _unit) isEqualTo 'ERROR') ||
            ((lifeState _unit) isNotEqualTo 'INCAPACITATED')
        )
    };
    if ((lifeState _unit) isEqualTo 'INCAPACITATED') then {
        _unit setUnconscious FALSE;
    };
};
//
[player] spawn TAG_fnc_knockDown;```
jade tendon
#

Is there a way that i can make this find all building within a marker instead of having to write everyone?

 _buildings = nearestObjects [getMarkerPos "buildingsInArea",["Land_i_Barracks_V2_F", "Land_House_Big_03_F", "Land_FuelStation_Build_F", "Land_i_Garage_V1_F", "Land_i_Shop_01_V3_F", "Land_i_Shop_02_V3_F", "Land_Unfinished_Building_02_F", "Land_WIP_F", "Land_Offices_01_V1_F", "Land_WoodenCrate_01_stack_x5_F", "Land_i_Shop_01_V2_F", "Land_Cargo_HQ_V3_F", "Land_i_House_Big_01_V3_F", "Land_FuelStation_01_workshop_F", "Land_MilOffices_V1_F", "Land_i_House_Small_02_V3_F", "Land_u_Addon_01_V1_F", "Land_Unfinished_Building_01_F", "Land_Canal_WallSmall_10m_F", "Land_i_House_Big_01_V2_F", "Land_CncWall4_F", "Land_i_House_Small_03_V1_F", "Land_u_Shop_02_V1_F"], 200];

{
_bbp2 = (0 boundingBoxReal _x) select 1;
_resize = 0.8;
_mrkr = createMarkerLocal [str(_x),getPos _x];
_mrkr setMarkerShape "RECTANGLE";
_mrkr setMarkerSize [(_bbp2 select 0)*_resize, (_bbp2 select 1)*_resize];
_mrkr setMarkerDir (getDir _x);
_mrkr setMarkerColorLocal "Colorwhite";
} forEach _buildings;
pulsar bluff
#
0 spawn {
    sleep 3;
    [
        player,
        [
            player vectorModelToWorld [0,2500,1000],
            getCenterOfMass player
        ]
    ] spawn TAG_fnc_knockDown;
};```
granite sky
#

@jade tendon You can try _buildings = nearestObjects [getMarkerPos "buildingsInArea", ["House", "Building"], 200];

#

It's inheritance-based though, so sanity is not guaranteed.

fair drum
#

Can even filter out building position number so that you get only the bigger buildings

#
_buildings = nearestObjects [getMarkerPos "buildingsInArea", ["House", "Building"], 200];
_buildings = _buildings select {count (_x buildingPos -1) >= 2};
granite sky
#

They have some walls and crate stacks in there so I'm not sure about the intention :P

gusty forum
#

Heeey :) I need some serious help with unitCapture. I'm trying to have a playersquad detachment inserted via heli into a hotzone, but letting players pilot just makes room for failure. I've tried scripting it but man is it overwhelming, I've never really done any scripting other than basic stuff, so I come here looking for salvation

copper raven
gusty forum
copper raven
#

if you want to, sure

#

you can use debug console aswell

gusty forum
#

ahh might do console instead then, thanks

gusty forum
copper raven
#

wp1.sqf is wrong

#

did you put the data in that file?

gusty forum
#

Yeah I put all the flight data in there

copper raven
#

don't use quotes for the addAction expression, use brackets, i.e., { }, you want something like this:
dane addAction ["play", { [viperpilot, call compileScript ["wp1.sqf"]] call BIS_fnc_unitPlay }]

#

but i'd suggest you compile that file once and reuse the result

#

i.e., in some init script,
TAG_myUnitPlayData = call compileScript ["wp1.sqf"];, then
dane addAction ["play", { [viperpilot, TAG_myUnitPlayData] call BIS_fnc_unitPlay }]

gusty forum
#

greatly appreciated I'll try it out and see if it works, thanks

#

getting this error now

copper raven
#

;, then what is that?

#

ah, you copy pasted my message 😅

gusty forum
#

ohhh I'm dumb 💀

#

apologies xd

copper raven
#

actually TAG_myUnitPlayData = parseSimpleArray loadFile "wp1.sqf"; is probably more suitable, use that instead

gusty forum
#

I'll try that, because now I'm not getting any errors but when I activate "play" the heli just stands still

copper raven
#

try passing the vehicle itself

#

not the pilot

gusty forum
#

while that did make it move, it now levitates menacingly

#

okay so uh it took off but engines are turned off etc.

#

it's flying without the rotor spinning xd

copper raven
#

try turning it's engine on

#

vehicle engineOn true

#

but the AI might turn it back off, i'm not sure

gusty forum
#

dane addAction ["play", {escortviper engineOn true; [escortviper, TAG_myUnitPlayData] call BIS_fnc_unitPlay }]

#

like this?

#

does it need a comma?

copper raven
#

vehicle is a placeholder, put the variable name in there

gusty forum
#

ahh right

copper raven
#

}{ this part is wrong, should be just a semicolon

gusty forum
#

will do that then, thanks, also it works now

#

still levitates while engine is starting up before actual takeoff but I suspect that might be an issue with when I did unitCapture so I'll re-do that

copper raven
#

yeah, start capturing with engine off, you will still need to turn it on manually, via script (it doesn't capture the engine states), but it will look like you didn't

gusty forum
#

one thing I did notice is that it didn't capture the rocketpods firing off

copper raven
#

but i'm not sure if it will work with vehicles 🤔 give it a try

gusty forum
#

parameter 4 doesn't work on vehicles it seems

copper raven
#

did you try it?

gusty forum
#

yeah it was already in the line I used to record 1st time

#

[viperpilot, 9999, 100, true, 0] spawn BIS_fnc_unitCapture;

#

[viperpilot, 9999, 100, false, 0] spawn BIS_fnc_unitCapture;
[viperpilot, 9999, 0] spawn BIS_fnc_unitCaptureFiring;

#

what about doing that in debug?

copper raven
#

try it

#

it'll be tricky with getting the data, both of those commands copy to clipboard once you press esc, so you have to play with the startTime stuff i think

#

(and duration)

gusty forum
#

it's a bit weird, both times the fire data just returns []

#

when recording is done you press F1 to copy flight data and F2 to copy fire data, so it doesn't copy them at the same time, think the wiki is outdated

copper raven
#

it has to be the vehicle

gusty forum
#

ahh I get it now

#

to record movement I have to use the pilot, because that's the one controlling it, when I tried using the heli itself it just froze

#

but maybe I have to use the heli itself for fire data like you said?

copper raven
#

try it

#

i'm not familiar with the capture stuff

gusty forum
#

me neither 💀

#

help is greatly appreciated tho

copper raven
#

i just tried it

gusty forum
#

looks like it works when I use the heli for fire capture

gusty forum
#

okay so recording works perfect with this in debug:
[viperpilot, 9999, 100, false, 0] spawn BIS_fnc_unitCapture;
[escortviper, 9999, 0] spawn BIS_fnc_unitCaptureFiring;

#

I assume I make another sqf file like "wp1fire.sqf" and paste the fire data in there, then loadFile with a fire tag?

copper raven
#

you don't need to use BIS_fnc_unitCaptureFiring

#

BIS_fnc_unitCapture captures movement and firing

gusty forum
# copper raven yes

you're a godsend, it doesn't levitate anymore and flies perfectly without jitters but I have just one issue, it still doesn't fire, is it due to how I added the firing script?
init.sqf
VP1_myUnitPlayData = parseSimpleArray loadFile "wp1.sqf";
FI1_myUnitPlayData = parseSimpleArray loadFile "wp1fire.sqf";
dane addAction ["play", {escortviper engineOn true; [escortviper, VP1_myUnitPlayData] call BIS_fnc_unitPlay; [escortviper, FI1_myUnitPlayData] call BIS_fnc_unitPlayFiring }]

copper raven
#

change call to spawn for the BIS_fnc_unitPlay

gusty forum
#

only the movement or also firing?

copper raven
#

only the movement

gusty forum
#

okay

#

what's the difference? is call just a way to mark the end of script/last line?

south swan
#

call is "start function and wait for its return". spawn is "start it and let it run"

copper raven
#

you block the script from executing further with call, so your BIS_fnc_unitPlay finishes, then the BIS_fnc_unitPlayFiring is called

gusty forum
#

ahh thanks for clarifying, still doesn't fire tho, this is how it's looking now
dane addAction ["play", {escortviper engineOn true; [escortviper, VP1_myUnitPlayData] spawn BIS_fnc_unitPlay; [escortviper, FI1_myUnitPlayData] call BIS_fnc_unitPlayFiring }]

copper raven
copper raven
gusty forum
#

weird

#

my wp1fire.sqf is:
[[17.604,"rhs_weap_FFARLauncher"],[19.192,"rhs_weap_FFARLauncher"],[19.273,"rhs_weap_FFARLauncher"],[20.741,"rhs_weap_FFARLauncher"],[20.842,"rhs_weap_FFARLauncher"],[21.415,"rhs_weap_FFARLauncher"],[21.514,"rhs_weap_FFARLauncher"],[21.623,"rhs_weap_FFARLauncher"],[21.702,"rhs_weap_FFARLauncher"],[21.807,"rhs_weap_FFARLauncher"],[21.917,"rhs_weap_FFARLauncher"],[22.001,"rhs_weap_FFARLauncher"],[22.086,"rhs_weap_FFARLauncher"],[22.411,"rhs_weap_AIM9M"],[22.582,"rhs_weap_AIM9M"],[23.284,"rhs_weap_FFARLauncher"],[23.943,"rhs_weap_FFARLauncher"],[24.062,"rhs_weap_FFARLauncher"],[24.304,"rhs_weap_FFARLauncher"],[24.442,"rhs_weap_FFARLauncher"],[24.559,"rhs_weap_FFARLauncher"],[24.7,"rhs_weap_FFARLauncher"],[25.044,"rhs_weap_FFARLauncher"],[25.084,"rhs_weap_FFARLauncher"],[25.298,"rhs_weap_FFARLauncher"],[25.338,"rhs_weap_FFARLauncher"],[25.576,"rhs_weap_FFARLauncher"],[25.616,"rhs_weap_FFARLauncher"],[25.816,"rhs_weap_FFARLauncher"],[25.893,"rhs_weap_FFARLauncher"],[25.968,"rhsusf_weap_CMDispenser_ANALE39"],[26.074,"rhs_weap_FFARLauncher"],[26.147,"rhsusf_weap_CMDispenser_ANALE39"],[26.36,"rhsusf_weap_CMDispenser_ANALE39"],[26.564,"rhsusf_weap_CMDispenser_ANALE39"],[26.787,"rhsusf_weap_CMDispenser_ANALE39"],[27.146,"rhsusf_weap_CMDispenser_ANALE39"],[27.325,"rhsusf_weap_CMDispenser_ANALE39"],[27.552,"rhsusf_weap_CMDispenser_ANALE39"],[27.767,"rhsusf_weap_CMDispenser_ANALE39"],[27.986,"rhsusf_weap_CMDispenser_ANALE39"],[28.493,"rhsusf_weap_CMDispenser_ANALE39"],[28.701,"rhsusf_weap_CMDispenser_ANALE39"],[28.908,"rhsusf_weap_CMDispenser_ANALE39"],[29.117,"rhsusf_weap_CMDispenser_ANALE39"],[29.324,"rhsusf_weap_CMDispenser_ANALE39"],[29.658,"rhsusf_weap_CMDispenser_ANALE39"],[29.841,"rhsusf_weap_CMDispenser_ANALE39"],[30.062,"rhsusf_weap_CMDispenser_ANALE39"],[30.278,"rhsusf_weap_CMDispenser_ANALE39"],[30.476,"rhsusf_weap_CMDispenser_ANALE39"]]

#

could it have anything to do with "myUnitPlayData"?

copper raven
#

put FI1_myUnitPlayData in debug console, see if it's there

#

i see nothing wrong with that code

gusty forum
copper raven
#

then the file isn't present

#

wp1fire.sqf

gusty forum
#

looks like it is 💀

copper raven
#

did you reload the mission?

gusty forum
#

yeah I saved visual studio and re-opened mission every time

copper raven
#

systemChat str [FI1_myUnitPlayData] put this in debug console, what does it print in the chat?

gusty forum
copper raven
#

do you have an AI in the vehicle?

gusty forum
#

yup both pilot and gunner

#

same ones used when unitCapture

#

how did you get it to work?

copper raven
#

what i wrote earlier

ember pier
#

Trying to use knowsAbout to check if a helicopter spotted a turret*
Helicopter: recon_heli
Anti air: aa_turret
Helicopter init:

if (recon_heli knowsAbout aa_turret > 0) then {
    hint "Anti air defenses are active"};
#

But I don't get the hint even when I'm fired at by the turret

copper raven
#

your code runs once at init

ember pier
#

😅

copper raven
#

since it runs only once, that condition is never checked again, thus that hint will never run

ember pier
#

Seems like I can't escape those event handlers

#

So I should add an KnowsAboutChanged event handler to the helicopters init?

copper raven
#

you could, you need to add it to the crew's group though

ember pier
#

Ah ok

copper raven
#

group driver this should get you the group

#

assuming it's in the init box (and the heli has a pilot)

ember pier
#

And do I need oldKnowsAbout and newKnowsAbout or can I ignore those parameters?

copper raven
#

no..

#

this event fires everytime knowsAbout changes

#

instead of writing a loop that polls it constantly, you have an event that fires exactly at that moment

#

where _newKnowsAbout is the current value at the time of executing the event handler, so all you need to do, is check if it's more than zero (what you originally intended to do)

#

(and also check if _targetUnit is the AA turret thing)

ember pier
#

So in the helicopters init;

_helicrew = group driver this;
_heliCrew addEventHandler ["KnowsAboutChanged", {
    if (_heliCrew knowsAbout aa_turret > 0) then {
    hint "Anti air defenses are active"};
}];

?

copper raven
#

that's totally not what i said

ember pier
#

Ah wait

copper raven
#
_heliCrew addEventHandler ["KnowsAboutChanged", {
  params ["", "_targetUnit", "_knowsAbout"];
  if (_knowsAbout == 0 || { _targetUnit isNotEqualTo aa_turret }) exitWith {};
  hint "Anti air defenses are active";
}];
ember pier
#

Well thanks but I still don't understand it 😅

copper raven
#

what part?

ember pier
# ember pier Ah wait

Well, I understand an eventHandler is added
Then the parameters are defined
But I dont get the if statement
Why _knowsAbout == 0, what is ||, why is the targetUnit not equal to the turret, what is exitWith 😅

#

Last one I can look up but the overall logic I don't understand

copper raven
#

otherwise the hint is printed

ember pier
#

Ah

copper raven
#

this event handler fires every time the knows about changes, not particularly when it changes for that one unit, so we have to filter the unit out

#

you could also write

if (_knowsAbout > 0 && { _targetUnit isEqualTo aa_turret }) then {
  hint "Anti air defenses are active";
};
ember pier
#

Ah so without isNotEqualTo every unit would trigger the thing?

copper raven
#

which is the same exact thing

ember pier
copper raven
#

the reason i chose the first way, is because it's more readable, you don't have to indent (tab) extra for the then scope

#

you also probably want to remove this event, otherwise you might get the hint multiple times

#
_heliCrew addEventHandler ["KnowsAboutChanged", {
  params ["_group", "_targetUnit", "_knowsAbout"];
  if (_knowsAbout == 0 || { _targetUnit isNotEqualTo aa_turret }) exitWith {};
  hint "Anti air defenses are active";
  _group removeEventHandler [_thisEvent, _thisEventHandler];
}];
ember pier
#

Ah well my knowledge is still very limited so I'll try to stick to the longer one first

copper raven
#

mixed the variable names, edited, there

ember pier
#

Yea I wanted to use a marker eventually, that should probably deleted

#

Like every time the heli spots the aa, marker appears, fades away in 2 mins, then the hidden marker gets deleted

#

But that's something I should be able to figure out

cursive silo
#

Hello so Im using nimitz carrier and I want people to spawn above so I used this script on a trigger in condition but arma says im missing a semi colon.

(player in thislist) && ((getPosASL player select 2) < 5)

in the on act: player setPosASL [getPosASL player select 0, getPosASL player select 1, 18.542];

copper raven
#

error is elsewhere, nothing wrong with that code

cursive silo
#

I swear ive used it before and it worked but maybe I got a different script.

copper raven
#

umm, well what you have there is certainly wrong

#

in the on act: is not valid sqf

#

put the code in the on activation field 😄

cursive silo
#

oh yeah i see needs to be split

#

ty for the help

ember pier
#

Okay so now I have this in the helicopters unit init;

_heliCrew = group driver recon_heli;
_heliCrew addEventHandler ["KnowsAboutChanged", { 
  params ["", "_targetUnit", "_knowsAbout"]; 
  if (_knowsAbout > 0 && { _targetUnit isEqualTo aa_turret }) then { 
  hint "AA spotted"};
}];

With recon_heli being the variable name of the helicopter and aa_turret being the variable name of the AA unit.
But I still get no hint, even when my crew mates have spotted the AA turret, they are shooting at it and the AA turret is shooting back

#

Also tried

_helicrew = this

But that also gives no hint when flying around the AA, spotting it and exchanging fire with it

jade acorn
#

params for KnowsAboutChanged EH are params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];, where did you get the _knowsAbout from? Do you define it somewhere?

ember pier
#

Ah wait

#

Should be newKnowsAbout?

copper raven
#

no, params identifiers have no relation to anything whatsoever

#

is aa_turret a unit or an object?

ember pier
#

Unit

copper raven
#

try the actual vehicle

#

not the crew

ember pier
#

Now it works

ember pier
copper raven
#

params just assigns some values to some variables, nothing special about it

#

[1, 2, 3] params ["_one", "_two", "_three"]

ember pier
#

Or is it because knowsAbout is an actual thing

copper raven
#

huh?

#

not sure i understand what you mean

ember pier
#

Like if I would put _peanut > 0 it doesn't work right?

copper raven
#

knowsAbout is a number, from 0 to 4

ember pier
#

What does the _ in front of knowsAbout in the script do?

copper raven
#

the knowsAbout has nothing to do with anything here, it's just a variable name

#
_heliCrew = group driver recon_heli;
_heliCrew addEventHandler ["KnowsAboutChanged", { 
  params ["", "_blabla", "_blablabla"]; 
  if (_blablabla > 0 && { _blabla isEqualTo aa_turret }) then { 
  hint "AA spotted"};
}];

would work fine

#

just like you named your vehicle recon_heli

#

except that it's a global variable (no _ in front of it)

ember pier
#

Ah and because "blabla" is the second param it has the role of the second param?

copper raven
#

yes

#

if params doesn't have a left argument, it implicitly picks _this and assigns from it

#

and _this is an array of values which are set by the engine (in this case)

#

put systemChat str _this anywhere in that event handler, you will get a better understanding

#

params ["_bla", "_blabla", "_blablabla"];

private _bla = _this select 0;
private _blabla = _this select 1;
private _blablabla = _this select 2;

these two are exact same thing, except the latter is slower (runtime)

south swan
#

and first doesn't error out if _this is too short 🍿

jade acorn
#

is there an alternative for get3DENMouseOver so it would find objects that are baked into the map? This seems to work only with stuff placed in Editor

copper raven
jade acorn
#

awesome, that works as I wanted

jade acorn
#

I'm trying to understand the Contact BIN_fnc_setDiaryRecord function. It declares a params list, in which there is f.e. ["_textInput",[],["",[]]],, and later _textInput has its own params declared:

_textInput params [
    ["_title",DEFAULT_TEXT,[""]],
    ["_text",DEFAULT_TEXT,[""]]
];```assuming `BIN_fnc_setDiaryRecord` would take only `_textInput`, should the call look like this?
```sqf
[["This is _title param text","This is _text param text"]] call BIN_fnc_setDiaryRecord```I'm asking because I cannot get the function to work no matter how many params I provide, and since there is no example, it feels a bit arduous
sudden yacht
#

is it possible to force a npc Calculated path? like manually input the path?

#

Draw like say its path? without the engine handling the npcs route

radiant fossil
#

ik this is the worng channel. but just installing arma 3 you got any tips?

sudden yacht
#

I would say be open minded. i see allot of people that expect arma to be what its not. Take it for what it is and if you dont find what your looking for ask around sometimes its just about finding the right people.

granite sky
sudden yacht
#

@granite sky ty

blazing loom
#

Trying to get brighter nights, tried the CHBN script but doesnt seem to be enough, what would be best way to go about setAperture script for night? i have found the right aperture values but cant get any of these to work

if sunOrMoon = 1 then setApertureNew [0, 0, 14, .9];

if sunOrMoon isEqualTo 0 exitWith setApertureNew [3, 3, 14, .9];  
if sunOrMoon isEqualTo 1 then setApertureNew [0, 0, 14, .9];

if time > 1800 then setApertureNew [3, 3, 14, .9];
if time < then setApertureNew [0, 0, 14, .9];```
granite sky
#

Is this with or without a moon?

blazing loom
#

id prefer to have a full moon but whatever script works really

granite sky
#

Your syntax is all busted. Not even sure where to start there.

blazing loom
#

thats just some examples and im asking which syntax to use

#

or if anyone had a night script that works

granite sky
#

Basic if/then looks like this:
if (condition) then { code };

#

The brackets around the condition are necessary unless the condition is a plain variable/bool. The brackets around the code are always necessary.

blazing loom
#

thank you!

granite sky
#

correct equality operator is == not =

#

= is for assignment.

#

isEqualTo and == do the same thing if both inputs are numbers.

#

sunOrMoon has transitional values between 0 and 1 so you need to handle those.

blazing loom
#

this works! will that work everynight on arma? or am i better off doing a timed one?

granite sky
#

Well, as written it only runs once.

blazing loom
#

yeah these work separately but not in same block.

if (sunOrMoon == 1) then {setApertureNew [0, 0, 0, 0]};```
granite sky
#

You might want to spawn something like this on the client:

while {true} do {
  if (sunOrMoon == 0) then { setApertureNew [3, 3, 14, .9] } else { setAperture -1 };
  sleep 15;
};
#

Antistasi (and I think Mike Force) have a routine that triggers on getLighting instead and looks like this:

darkMapFixRunning = true;
while {darkMapFixRunning} do {
    call {
        private _lightBrightness = getLighting select 1;

        if (4 < _lightBrightness && _lightBrightness < 120) exitWith {
            setApertureNew [4, 6, 9, 0.9];
        };

        if (_lightBrightness < 4) exitWith {
            private _minAperture = linearConversion [0, 4, _lightBrightness, 1, 3, true];
            setApertureNew [_minAperture, 6, 9, 0.9];
        };

        setAperture -1;
    };
    sleep 15;
};
blazing loom
#

ill try that, thanks heaps

granite sky
#

Caveat with that one: It superbrights everything for a bit after if you alt-tab.

blazing loom
#

the getLighting code, that would be run on serverInit rather than initplayerlocal? im trying to get it done on a life server

granite sky
#

nah, spawn in initPlayerLocal

#

I think there's a command somewhere to detect whether the client is minimized but the wiki search is useless.

#

isGameFocused maybe

blazing loom
#

gets brighter in ESC menu but nothing when i alt+tab.
thanks for the help! its better now

blazing loom
#

i get what you mean now, it does it for me too when back from alt+tab

blazing zodiac
#

is it worth setting dynamicSimulation on all machines since each machine has it's own dynamicSimulation system or just setting it on the server/object owner is sufficient?

#

Also, does dynamicSimulation work on triggers?

sharp valve
#

Hey, I have setup a trigger with the following code ok activation
hvtsniper doTarget HVT; hvtsniper doFire HVT; the trigger is set to a ai mode module to make sure the ai doesn't start shooting at players as i only want the ai to shoot the HVT and then stop shooting but currently the sniper starts shooting me instead of the HVT

copper raven
sharp valve
#

During the trigger activation?

gusty forum
#

of course they'd need to be completely unique, and probably make sure they're each assigned to BLUFOR and OPFOR respectively if it doesn't work first time

hallow mortar
#

???
No, don't do that, it will not help

#

Those "unit IDs" are the class names of the unit types. They don't refer to specific units, they're just the type of unit. You can use them to spawn a unit of that type, or collect all units of that type, but that's a completely unnecessary complication in this case. You could have the sniper and HVT be the only units of their types in the mission, and select them by getting all units of those types, but it would be 100% pointless. Using their variable names here is fine, it's exactly what they're for, that's not the problem here.

sharp valve
#

Not sure which panel but these are the names of the units can you show a picture

copper raven
#

if yes, then it's gonna be tricky

#

for the latter i think the only solution is to just make the player captive

ember pier
#

That the sniper would not fire, then when the trigger is activated it shoots the HVT, when that’s done it returns to do not fire

copper raven
sharp valve
#

Just to kill the HVT when players are about to extract him

copper raven
#

then just make him careless

sharp valve
#

Currently got 2 ai mode modules one to do nothing

copper raven
#

in this case i'd actually simulate a bullet

#

vs relying on AI hitting it

sharp valve
zenith vale
# jade acorn I'm trying to understand the Contact BIN_fnc_setDiaryRecord function. It declare...
if (_this isequaltype "" || {_this isequaltype [] && {_this isequaltypearray [""] || _this isequaltypearray ["",false]}}) then {
    _this = [configfile >> "CfgContact" >> "Diary" >> (_this param [0,""]),nil,nil,nil,nil,_this param [1,-1]];
};

params [
    ["_recordInput",[],["",[],confignull]],
    ["_textInput",[],["",[]]],
    ["_texture",DEFAULT_TEXT,[""]],
    ["_isLeaflet",-1,[false,0]],
    ["_updateList",true,[true]],
    ["_markAsRead",-1,[false,0]]
];

Here are all params in the function

copper raven
sharp valve
#

Can u give me some pointers? Somewhere to start from

#

Cnat find anything on simulating bullets

sharp valve
#

Much appreciated

quasi sedge
#

Hi everyone,
How to "collect garbage" such as ejector seats from RHS Helicopters/Jets and other mods?
Also RPG protective screen from Stryker MGS usually stays after wreck deleted, not sure from which mod

if bunch of people play my DM mission, FPS decreasing rapidly
https://imgur.com/a/xvv8Tra

willow hound
copper raven
jade acorn
#

kinda, still doesn't work fully but at least I got the title to show up

copper raven
quartz storm
#

чо

willow hound
sharp valve
#

I can't find them 😭

copper raven
#

CfgAmmo

#

or just do something like

player addEventHandler ["Fired", {
  private _type = typeOf (_this select 6);
  copyToClipboard _type;
  systemChat _type;
}];

and fire the gun

sharp valve
#

Ack

copper raven
#

yes

sharp valve
#

Oh, ok

quasi sedge
#

err, how to correct all errors here ?notlikemeow
InitServer.sqf

while {true} do {
sleep 60;
_allPlayers = allPlayers;
        {
        if ((count _allPlayers) <= 7) then  
        {};
        else {};
        
        if ((count _allPlayers) <= 8) then 
        {"respawn_east" setMarkerSize [1202, 1908];}
        else {};        
        
        if ((count _allPlayers) <= 25) then 
        {"respawn_east" setMarkerSize [1502, 1908];}
        else {};
        
        if ((count _allPlayers) <= 35) then 
        {"respawn_east" setMarkerSize [1902, 1908];}
         else {};
        
        if ((count _allPlayers) <= 45) then 
        {"respawn_east" setMarkerSize [2302, 1908];}
        else {};
        
        if ((count _allPlayers) <= 55) then 
        {"respawn_east" setMarkerSize [2602, 1908];}
        else {};
        
        if ((count _allPlayers) <= 65) then 
        {"respawn_east" setMarkerSize [3002, 1908];}
        else {};        
    };
};
winter rose
#

😐

zenith vale
coarse dragon
#
titleCut ["", "BLACK FADED", 999]; 
[] Spawn {


["<t color='WHITE' size='.8'>Vietnam<br />Area over run. Retake the area.</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;

sleep 3;
"dynamicBlur" ppEffectEnable true;   
"dynamicBlur" ppEffectAdjust [6];   
"dynamicBlur" ppEffectCommit 0;     
"dynamicBlur" ppEffectAdjust [0.0];  
"dynamicBlur" ppEffectCommit 5;  

titleCut ["", "BLACK IN", 5];

anyone know whats wrong with this?

copper raven
#

missing }?

copper raven
coarse dragon
quasi sedge
#

i'll try this

while {true} do {
    sleep 60;
    _numPlayers = count allPlayers;
            switch (true) do {
                case (_numPlayers <= 8): {"respawn_east" setMarkerSize [1202, 1908]};
                case (_numPlayers <= 25): {"respawn_east" setMarkerSize [1502, 1908]};
                case (_numPlayers <= 35): {"respawn_east" setMarkerSize [1902, 1908]};
                case (_numPlayers <= 45): {"respawn_east" setMarkerSize [2302, 1908]};
                case (_numPlayers <= 55): {"respawn_east" setMarkerSize [2602, 1908]};
                case (_numPlayers <= 65): {"respawn_east" setMarkerSize [3002, 1908]};
            };
};
zenith vale
# coarse dragon do you know where its missing?

The closing one.

titleCut ["", "BLACK FADED", 999];

[] Spawn {

    ["<t color='WHITE' size='.8'>Vietnam<br />Area over run. Retake the area.</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;

    sleep 3;
    "dynamicBlur" ppEffectEnable true;   
    "dynamicBlur" ppEffectAdjust [6];   
    "dynamicBlur" ppEffectCommit 0;     
    "dynamicBlur" ppEffectAdjust [0.0];  
    "dynamicBlur" ppEffectCommit 5;  

    titleCut ["", "BLACK IN", 5];

}; //<--- This 
hallow mortar
# coarse dragon do you know where its missing?

It should be pretty easy to figure out.
{} are used to enclose code blocks passed to commands. Presumably you know what you're trying to pass to the commands you're using, and only one in this script is using { at all. So the } comes at the other end of the block of code you're trying to pass to that command.

copper raven
#

edited (case if there are 75 or more players)

stable dune
#

Hello
Anyone have any information or maybe even already built?

I would like to get a certain marker area (rectangle) and I want to create a vehicle (objects) next to the road.
So how do I define that my target does not spawn on the road, but next to the road in those areas.

I know nearRoads or BIS_fnc_nearestRoad

distant egret
stable dune
#

I start with that, thanks

stable dune
distant egret
stable dune
#

i will try that out

granite sky
#

getRoadInfo width is not entirely consistent, IIRC

#

Gives fairly sensible values for vanilla road objects but not necessarily for mods.

stable dune
stable dune
granite sky
#

Usual issue where you let modders specify a value and it doesn't have immediate or obvious effects so they just ignore it :P

spare holly
#

hi guys, anyone have use any heli extraction/transport/taxi mod/script for multiplayer dedi server use?

stable dune
#

Is there way to separate area of marker/ trigger?

copper raven
#

what do you mean by that?

cosmic lichen
#

Does playSoundUI ignore sound volume defined in CfgSounds?

stable dune
cosmic lichen
#

Why not make 3 markers instead

#

A marker or trigger area is just a geometric definition. You can split it up as you wish

copper raven
stable dune
dreamy kestrel
#

Q: trying to understand vectorDir, at its basis, as I understand it, theta is like getDir _x, correct? then X component is calculated from cos theta, Y from sin theta, correct? Okay, well, given this:

_x = player;
_dir = getdir _x;
[_dir, vectordir _x, [cos _dir, sin _dir]];
// [97.7537, [0.990857,-0.134916,0],[-0.134916,0.990857]]

What I get seems reversed? The cos, sin components themselves seem correct however.

#

IIRC XY may be opposite from conventional 3D space examples... but I could be mistaken in my recollection along these lines...

copper raven
stable dune
#

Currently just
Bis_fnc_randomPos

dreamy kestrel
granite sky
#

0 direction and positive Y are north, positive x is east. Just map conventions.

dreamy kestrel
#

which is to say X components based on cos, Y sin. but if you run those numbers, you get reversed coordinates.

granite sky
#

It's just how you define the direction. 0 = positive Y and clockwise gives you flipped results from 0 = positive X and anticlockwise.

dreamy kestrel
granite sky
#

[cos _dir, sin _dir] assumes that you're measuring theta from 0 = positive X and anticlockwise.

#

just draw it out.

dreamy kestrel
#

ah ok I see, so difference is clockwise or not... conventional to Arma 3.

meager spear
#

I need a help with a very easy script

#

Arma 3 gives me back an error that _detonator is an unknow value

granite sky
#

If condition needs brackets: if count _result > 0 then {

meager spear
#

"not defined"

meager spear
#

u think is this the problem?

granite sky
#

You have two of them. They're both wrong.

#

Nah, if _detonator is undefined then you have a problem earlier.

meager spear
#

Have you understood what I wanna do?

#

Because I am not so expert with sqf

copper raven
granite sky
#

If this comment is correct then _detonator is undefined there:

class Extended_PostInit_EventHandlers {
    eug_post_init = "[_detonator] execVM ""\eughenos_clacker\scripts\satcom.sqf""";
};
#

so no, I don't know what you're trying to do.

meager spear
#

I am trying to "link"a clacker to another item. When the clacker is close to the item I want that an item's value (ace_explosives_Range) changes

stable dune
copper raven
#

Is rectangle? True false? Do i need define that there?
yes

stable dune
#

Good to know , thanks

granite sky
#

@meager spear It's not at all clear what the function's input is supposed to be.

meager spear
#

check if clacker is close to the item (satcom) 6 meters then change the clacker value (ace_explosives_Range) to 999999

granite sky
#

clacker is what though? An item in a unit's inventory?

meager spear
#

yes is a detonator

granite sky
#

While the satcom is an actual entity?

meager spear
#

satcom is another item placed by unit

granite sky
#

Ok, so your basic problem here is that inventory items aren't objects. They don't have their own position so you can't do nearObjects on them.

meager spear
#

how can I do it?

#

Is it a game limit?

granite sky
#

well, I also don't know what ace_explosives_range is

#

Like what sort of object does that apply to

meager spear
#

ace value linked to so many fncs that set the working range of the detonator

granite sky
#

Because again, you can't setVariable on an inventory item.

meager spear
#

outside that limit the detonator is not working

dreamy kestrel
#

AFAIK at best inventory items are class names and counts. sometimes also rounds depending on what it is.

granite sky
#

Looks like ACE_explosives_range is a config var, so you can't change that live.

#

What you'd need to do is swap out the inventory item for a dummy version with different range.

meager spear
#

mmmm

#

there is no way to change that value live?

granite sky
#

Nope.

meager spear
#

tfar jamming script are allowed to change tfar value settings

#

until the jammer is activated

granite sky
#

tfar has a battery of 1000 of each radio type and flips between them, holding information separately indexed.

meager spear
#

mhhhh interesting

granite sky
#

Arma holds barely any info on inventory items. Just a classname.

#

Magazines and weapons get a bit more.

#

So you have to do horrible hacks with identical-looking items that your script treats differently.

meager spear
#

Ok dude

#

thank you so much

#

to have opened my view

dreamy kestrel
granite sky
#

I hate these hacks because I have to work around all of them with the Antistasi arsenal :P

#

separately for each one, because there are no standards.

dreamy kestrel
#

and it is VERY easy to make a mistake and corrupt the whole thing, especially if you replace something inadvertently. 😛

#

there is a standard, consult with the wiki; that is the loadout shape bible.

granite sky
#

the what

dreamy kestrel
#

I do not have the url handy, but the loadout shapes are in the wiki.

granite sky
#

You just mean the loadout definition?

dreamy kestrel
#

it is basically a tuple; what I am calling shape. although folks will argue heterogeneous arrays are not tuples. oh yes they are; params can deconstruct them, happens all the time.

granite sky
#

Not sure how that's relevant.

dreamy kestrel
#

speaking in terms of inventories, containers (i.e. backpacks, vests, etc) and such...

granite sky
#

My issue is where mods define multiple item classes that look identical to the user, and then for a limited arsenal you have to put them all back into the same class.

dreamy kestrel
#

not sure what you mean limited arsenal... what happens, for instance, if you have partially spent mags?

granite sky
#

This one counts the damned bullets :P

#

(I wish it didn't)

dreamy kestrel
#

LOL didn't? it should.

granite sky
#

There are holes in the Arma command set for bullet counts, so it does some ridiculous stuff to keep it consistent.

dreamy kestrel
#

but yeah I digress a bit... loadouts, inventory, can be a PITA, if you are not aware of the shapes.

#

ah ok

sullen sigil
#
private _dose = ((player getVariable "KJW_Radiate_AverageCounts")*0.0002536783333);
private _accumulatedDose = (player getVariable "KJW_Radiate_AccumulatedDose");
systemChat str format["Dose: %1 microSv/minute",_dose];
player setVariable ["KJW_Radiate_AccumulatedDose", (_dose+_accumulatedDose)];
``` doesnt seem to work -- `KJW_Radiate_AccumulatedDose` is always default when trying to get it later on, am I just being stupid?
#

However replacing either local variable on the last line with a fixed number does seem to work

copper raven
#

do you initially set it anywhere?

#

if no, then it's simply nil everytime

sullen sigil
#

I set it at the top of my code to 10

#

A systemchat of it straight after that gives 10 properly

copper raven
#

both of them?

sullen sigil
#

Yes

#

running this in debug console will work for the first instance, but changing the values of the variables will return the same value no matter what

player setVariable ["KJW_Radiate_AccumulatedDose",10];
player setVariable ["KJW_Radiate_AverageCounts",20];
systemChat str (player getVariable "KJW_Radiate_AccumulatedDose");
systemChat str (player getVariable "KJW_Radiate_AverageCounts");

private _dose = ((player getVariable "KJW_Radiate_AverageCounts")*0.0002536783333);
private _accumulatedDose = (player getVariable "KJW_Radiate_AccumulatedDose");


systemChat str format["Dose: %1 microSv/minute",_dose];
player setVariable ["KJW_Radiate_AccumulatedDose", (_dose+_accumulatedDose)];
systemChat str (player getVariable "KJW_Radiate_AccumulatedDose");```
#

Ok, nvm it works but the amount is incredibly small when changing averagecounts

#

Which... shouldn't happen, but the maths should be correct

copper raven
#

Which... shouldn't happen
10 + 20 * 0.0002536783333 is almost 10 so, it should 😄

sullen sigil
#

systemChat str (player getVariable "KJW_Radiate_AccumulatedDose"); doesn't work inside a CBA pfh for some reason either thonk

#

nor does it work outside of one either

#

neither does copying to clipboard so...

copper raven
#

put [] around it

#

after str

sullen sigil
#

scalar NaN thonk

#

seems like player setVariable ["KJW_Radiate_AccumulatedDose", (_dose+_accumulatedDose)]; isnt working for some reason

#

Ah, so it's adding, just initially setting to 0 makes it not work..?

#

But it's set to 10

copper raven
#

like i said

#

you're assigning a nil somewhere somehow

sullen sigil
copper raven
#

the other value then

sullen sigil
#

systemchatting _dose and _accumulatedDose makes only _dose appear

copper raven
#

yeah because if an operand to a command is nil, it's silently ignored

sullen sigil
#

so its an issue with (player getVariable "KJW_Radiate_AccumulatedDose");

copper raven
#

put the expression into array, it's always printed then and easier to debug

sullen sigil
#

first loop its printed as [10], then goes to scalar NaN the next loop because of player setVariable ["KJW_Radiate_AccumulatedDose", (_dose+_accumulatedDose)];

#

commenting out that line makes it stay as 10

#
private _dose = ((player getVariable "KJW_Radiate_AverageCounts")*0.0002536783333);
private _accumulatedDose = (player getVariable "KJW_Radiate_AccumulatedDose");
systemChat str [player getVariable "KJW_Radiate_AccumulatedDose"];
player setVariable ["KJW_Radiate_AccumulatedDose", (_dose+_accumulatedDose)];
#

in fact i'll sqfbin the entire thing

copper raven
#
private _countsOld = player getVariable "KJW_Radiate_CountRate_Old";
player setVariable ["KJW_Radiate_AverageCounts", (_counts - _countsOld)*(random [18,20,22])];
#

this is the issue

#

_countsOld is nil

sullen sigil
#

the hints work fine though

#

oh wait it'll just be _counts - nil wont it

copper raven
#

you never hint it

sullen sigil
#

next line

#

KJW_Radiate_AverageCounts is hinted and works as intended

#

...however putting player setVariable ["KJW_Radiate_CountRate_Old",0]; at the top does seem to not be breaking it

#

works, thanks -- even though I've no idea why that doesn't work without thonk

#

Just need my maths to work properly 🤷

copper raven
#

your hint was only working after first iteration

#

also indent your code, easier to read

sullen sigil
#

Where would I do indentation in that instance? Inside the CBA PFHs?

copper raven
#

yes

sullen sigil
#

roger will do next time

#

just trying to figure out my maths now as ive no idea what i did the first time

copper raven
sullen sigil
#

Oh right, first loop around it sets KJW_Radiate_AccumulatedDose to nil and then next loop around it gets defined?

copper raven
#

no, the next loop it's nil again, but the other value isn't

sullen sigil
#

I think I vaguely understand

copper raven