#arma3_scripting
1 messages · Page 32 of 1
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
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.
We had an issue that was quite hard to resolve where the velocity would transfer (and remain) if you detached them while moving.
I find anything to do with attaching to be messy business
Trouble is that the detaching messes with the locality, and setVelocity needs to be local.
Seems like a remoteExec with the object as locality argument would solve that neatly
Nah, because the locality switch isn't instantaneous.
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?
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.
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
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.
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
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
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?
Attaching to player and releasing on an action is easily doable. Rotation is also easily doable in a variety of ways i.e. via BIS_fnc_rotateVector3D or BIS_fnc_transformVectorDirAndUp & etc.
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.
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
👍
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.
Ah i didn't consider that, makes sense. Is there a function that checks for collisions? I'll have a look around
anyone know how BIS_fnc_threat is calculated?
Not exactly. You could use a combination of inAreaArray and boundingBox, but that won't help for detecting collision with things that aren't objects like terrain.
Ultimately you may end up wanting to use a raycasting-based technique with something like lineIntersectsSurfaces
iirc threat values are defined in config for different things, so it's likely some sort of weighted value based on those
I think surface collision would be my primary concern for this application. I'll have a look and play with those, thank you again.
Yup no problem
Can anyone remind me if the doStop this; command works?
I tried it on AI recently and it just stopped them from moving altogether
it does
Hmm, ill have to check it out
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
]
};
"this" isn't defined inside onEachFrame, most likely
shouldn't it throw an error ?
if it isn't
#arma3_scripting message
read the messages here
it was just a guess on my side
didn't realize it was related to my problem
well that sucks
you can still attach it to a different vehicle like the other guys mentioned ^^
like what?
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
lol I see the issue
Take another look at the last parameter for setVelocityTransformation and I think you'll see the problem.
interval?
it's set to 0 on the example wiki code
Indeed but it's probably not the type of interval you're thinking of (i.e. a time interval)
it's the interval of the translation as a whole, 0 means it stays exactly as it starts
ooooh
1 means it's at the final position/orientation
basically it's just a lerp
bingo
nice, got it
the first 8 parameters are just defining the initial/final position/velocity/rotation
then it lerps them all w/ the interval param
interval = 0.5;
onEachFrame { hint str interval;
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
]
};
still does nothing
it should move the object half way to the end position right
nope, that's telling it to set everything to halfway
you need to increment the interval yourself
from 0-1
what do you mean?
the object stays still
doesn't move at all
it should from my understanding
Is it in the same spot if the interval's set to 0?
should work with anything, I've used it for multi-piece ships like that before myself
I suspect something else is wrong
very weird
included as much detail as i could
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
ha, it did
so something is wrong with oneachframe
Yeah, that's not the best way to do each-frame stuff anymore anyways
highly discourage using it
what do you recommend me to use?
use ```sqf
addMissionEventHandler ["EachFrame", {
// code here
}];
instead
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
the ship is stuck once again
lol
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
]
}];```
yup this isn't gonna work anymore as it won't carry into the EH scope
nor will interval
ha, arma could've atleast told me that
by throwing an error
oh don't give it too much credit, arma loves to be unhelpful
indeed
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
}, interval, this]; like this?
}, [interval, this]];
spawn uses _this
i know this
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
just like this params["interval", "this"]?
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
indeed
my bad
back to the initial topic
incrementing the interval value
i do something like _interval = _interval + 1/60 ?
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];
alright
i have an issue there
?
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]];```
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]];
discord uses an external formatting library for text highlighting which happens to support (most) of sqf
aside from some of the newer stuff
sweet
pretty sure it uses this, iirc:
https://github.com/highlightjs/highlight.js/
no problem
(make sure to add that 1 cutoff if you've not yet)
otherwise it's gonna keep looping every frame and incrementing
can i get the eventhandler from the event scope?
As in, from inside the EH or outside?
from inside
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?
careful, return isn't valid sqf
_thisArgs params ["_interval", "_boat", "_thisEventHandler"]; wut
^ and that
oopsies
my bad habits striking again
I would recommend
if (_interval > 1) exitWith { removeMissionEventHandler ["EachFrame", _thisEventHandler] };
:)
understandable, I sometimes find myself writing SQF like C and have to slap myself
still better than writing C like SQF
very true
lmao
at least a C compiler will actually give me helpful errors
unlike... something else...
clean looking
i wonder what
anyone's guess 
possible, yes, I have no idea if it'll work nearly as well as you may require
or maybe i can directly use particle emitters or some stuff? I have no clue how this works on arma
at least it doesn't point to different statement 10 lines away with strangely fitting error message
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
where can i browse all the arma3 particles?
i know there's the splendid config viewer but it has no search function
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
🤨
lmao
I'll dump this link for you but that's about as much as I can help for now:
https://community.bistudio.com/wiki/Particles_Tutorial
lots and lots of fun parameters
I hope you like typing
low WPM
alright thanks
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
would probably need to mess with the particleparams to get some of them working
Is it possible to have a trigger triggered by blufor presence but have it not trigger if blufor name is in a array?
yes
How can i do that?
or this && {(thisList - _ignoreList) isNotEqualTo []}
findAny is faster
except doesn't actually fit the logic of "trigger on all blufor unit that are not in the list" 🤔
are there any global variables like one that means all planes
i have this done to a music trigger that plays music to one side to exclude the other side. However in this instance im using the trigger to drop bombs so the trigger activating should not happen at all on anyone
should it still work?
I mean
this && {(thisList findAny _ignoreList) < 0}
thisList = [1,2,3,4];
_ignoreList = [1,2,3];
thisList findAny _ignoreList == 1; // < 0 == false
thisList - _ignoreList == [4]; // isNotEqualTo [] == true```
Does this still trigger if there are both a unit named in array and unit not named in array both in trigger zone?
this && {thisList findIf {!(_x in _ignoreList)} > -1} to stop the execution on first match, probably
I have a question a lot of people online write in their code _truck or _plane
what does it mean
_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 🤷♂️
https://community.bistudio.com/wiki/Variables#Scopes to read actual documentation instead of my ramblings
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
condition (objectParent boss == plane)
on activation plane setVehicleAmmo 1;
Don't know if it's correct
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.
And for click and hold gestures...
fn_buildUI_ctrlBg_onMouseButtonDown
fn_buildUI_ctrlBg_onMouseButtonClick
fn_buildUI_ctrlBg_onMouseButtonUp
fn_buildUI_ctrlBg_onMouseButtonDown
fn_buildUI_ctrlBg_onMouseButtonClick
fn_buildUI_ctrlBg_onMouseButtonUp
Having some difficulty not sure why gestures are not stopping however.
The EH boundaries seem about like I suspected.
is it for SP or MP?
condition in what context? menu action? checking boss is what? unit or player? vehicle boss isequalto plane along these lines?
I have not had much success with objectParent, if I want something attached, usually I end up having to resort to attachedTo for best results.
condition/activation sounds kinda like trigger 🤷♂️
it's a trigger that the boss(one of the zeuses) can call with support radio
ok well assuming you are slotted as the boss unit, you should be able to test that condition just in the debugger. as long as it works there, contexts being equal, should also work in your action (or support comm menu) context.
setVehicleAmmo takes local arg, so I recommend that you set your trigger to server only and change the on activation to:
[plane, 1] remoteExec ["setVehicleAmmoDef", plane];
I also changed it to setVehicleAmmoDef because I think you want to restore all of its ammo
I want to restore all it's ammo
I found a ready script
I'll be calling that
thanks for the help
anyone got a snippet to teleport a large amount of players to a position safely and avoid getting people Arma'd?
{ _x setPos getPos _theDestination } forEach units _theGroup;
```😂
use setVehiclePosition 🙂
so that will like prevent damage if like 30 people are TPed to the same XYZ?
https://community.bistudio.com/wiki/setVehiclePosition
Take note of the special parameter
and placement
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
it should
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
you can pass the unit object to the script and then use it as a parameter:
[player, ...(other args)] call MY_fnc_loadout
params ["_unit", ...];
_unit setUnitLoadout ...
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
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
Unit Init:
[Variable Name] execVM "Loadout.sqf
Loadout Sqf:
`waitUntil {!isNull player};
[Loadout stuff here/below]`
[this] execVM "Loadout.sqf
this is wrong
I tried _this execVM etc
this not _this
and like I said the problem is here
if you use player to set the loudout
init runs for every joining unit
ah
also in what way is that wrong?
have you put that in the init of more than 1 unit?
o h
everytime a new player joins or for each new player?
everytime a new player joins
removing what?
that line
no
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?
no. change it to:
if (local this) then {
[this] execVM "Loadout.sqf"
};
and:
params ["_unit"];
[Loadout stuff here/below]
_unit setUnitLoadout ...
since its only being called on that one unit?
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
there isnt respawn loadouts, each loadout is set at the start
that broke the sqf
you did something wrong 
I got it to work
Is edge detection post processing possible in arma without the use of external stuff?
like images and stuff?
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.
No, not images. I mean in game post processing.
Explain, edge detection?
I duck that phrase and it pops up with image processing.
I understated it as typically image processing yeah
collision detection perhaps? otherwise I have no idea 🤷♂️
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.
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
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.
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.
(or to highlight objects you're looking at, I tried to get some info about it but impossible to be done too)
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
I'm not sure why you'd want to...
...because you want to create post-processing effects that are not otherwise possible, like we've just been talking about?
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?
https://community.bistudio.com/wiki/Procedural_Textures
[selection, "#(format,width,height,mipmapsAmount)color(r,g,b,a,type)"]
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], ...];
I did not see anything in commands or functions under arrays or math etc that jumped out at me as such.
tried this, but no, there is deeper type checking, i.e. assuming the + operator would be applied agnostic of the element types.
_a = [1, 2, 3];
_b = [4, 5, 6];
[_a apply {[_x]}, _b apply {[_x]}] call bis_fnc_vectoradd
@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
private _result = [];
for "_i" from count (_array select 0) - 1 to 0 step - 1 do {
_result set [_i, _array apply { _x select _i }] // where _array is fx., [[1, 2, 3, 4], [2, 5, 4, 2]] ... etc
};
_result
if you need multiple values/more values per "tuple"
is there a command to check if a number given is a float?
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?
I typically use cutText or titleText for that
every number is a float in sqf, do you mean check if it has decimals?
thanks I'll look at using those instead 👍
sure that would work. just need to filter out decimal inputs. I could just ceil or floor everything, but wondered if there was a check already
there's no built in command, no
but keep in mind for bigger numbers it will become unreliable fast
you mean for ceiling or flooring every input?
does commander immediatedly get the knowsabout value of subordinates targets?
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
you want to know when the aciton is visible like you want an icon or something to be displayed for it? or?
I have an movement script binded on that key, but I dont want it to get it triggerd when an action is showing.
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 ?
there is isActionMenuVisible but the scroll wheel menu has to be opened, not just "an action is possible"
there is inGameUISetEventHandler but it is a set, not an add
that was my second thought, but the problem is that it triggers after onkeyEventhandler triggers, so its not viable
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?
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
Yeah, that's what I'm already doing. Thought there was a more best-practice way to do it without the need for modding.
Thanks for clarification
best-practice in arma 
||ignore the fact i'm replying 1 date late|| so after a bit of tweaking i got the result i wanted!
doesn't come as close to the default foam effect but i'm fine by this one
very nice!
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
no
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
^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
IIRC it is lacking functions to remove items from containers though, so clear & refill might be the only way.
woops, misinterpreted the msg
Exactly, could be job for dedmen 🤔
wait there's really no way to remove container from container other than taking it out manually?
no, you have to read the content, clear the whole container and re-add the stuff
omg
That was so much pain writing that script... Removing items from a sub container of an container 
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
You could eliminate an if statement if you used else instead
Uh, most of the code can be replaced with divide + floor :P
Like _maxCount = floor ((_maxLoad - _curLoad) / _itemMass);
Since backpacks are entities, you can just delete them. As for other items, no easy way.
is that a freaking particle effect fore and aft? pretty decent... question is, however, is it safe to engage with using assets? fixed or otherwise...
also bearing in mind, AFAIK, some LODs can be deleted and corrupt the whole thing... I know that happens on the Freedom from time to time.
That's pretty awesome actually
No way to walk on it while it moves, tho, right?
how do i attach a thing to a vics turrent, like a sheild
exactly my concern, I would think the LODs would not accommodate very well
You need to use attachTo, specifying a memory point and setting the follow bone rotation parameter to true
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.
not with my setup unfortunately, but particles just being particles you can use the same system everywhere
i've seen a walkable ship library somewhere, it shouldn't be too hard to use my particle thing with it
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"
Is there a command to force the player to switch to run ?
no.
what is the goal here?
Olympics game mode
when i use player forceWalk false the player can walk but he will not automatically switch to run. I want to automatically switch to run
you can force a unit to run by forcing animation, but you cannot force the "RUN WHEN PRESSING W"
well, unless heavy scripting I guess
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'?
???
I mean there are different speed modes and i was asking if I can force the players speed mode to sprinting only
player setVelocity _newVel 
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.
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...
specifically, if I have a switch falling through to second case, then I can safely assume !cond1 approaching cond2? whatever that condition was...
IOW, I do not need to be that verbose
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
mainly for use cases such as:
switch (true) do {
case (_cond1): {};
case (_cond2): {}; // !_cond1
case (_cond3): {}; // !(_cond1 || _cond2)
// ...
};
sweet cool thanks
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" }
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.
Is there anyway to check if a unit is either surrendered or cuffed via ACE3?
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.
cheers, turned out the variable is ace_captives_ishandcuffed
was trying via the captive method from basegame 🤦♂️
Oh your particles are great, but I was mostly interested in moving walkable ships 😄
Static USS Liberty + Scripting = Arma3 naval fun?? Maybe?
Feel free to check out our community at https://www.beowulfso.com :)
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
ArmA3 Dev - On a moving LCS deck
Recent change in a recent Dev branch of the Beta have much improved vehicles on a moving ship deck.
This is Mankyle LCS, an ingame test rig for all thing ship related .....
This LCS has been touched-up a little by me.
All other vehicles a vanilla ArmA3 Beta.
Unfortunately the man class is still falling through th...
https://community.bistudio.com/wiki/BIS_fnc_carrier01PosUpdate every frame would move the ship. Not very sure about the performance/network load, though
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
Sets max distance where the flare is visible.
are those meters?
That seems to be an actual ship and not just a static object
oh man i'm dumb
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
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
Deleting the crew would be the easiest way.
but its an UVG
UAV/UGV have their "invisible" crews
Is it possible to disable "open door" and most of the other default scroll actions?
you can't remove engine actions
for doors you can lock them, or override the action with https://community.bistudio.com/wiki/inGameUISetEventHandler (see examples)
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
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"
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.
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
the latter is correct
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?
Anyway to do it so only when I press it it works?
you mean other players should not have access to it right?
or do you mean the effect?
yes as in only when I press (lets say numpad 7) it executes sqf which than effects other people, but not when they do it
They should not have access to activation, they should feel the effect
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
hmm fair point, I might look into whole uid thing
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
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
that's not what I meant
in player's init:
if (local this) then {
execVM "script.sqf";
}
and script.sqf is this script
but you need to add a waitUntil {!isNull findDisplay 46} in there too
Does triggerAttachVehicle work to multiple units?
Since https://community.bistudio.com/wiki/triggerAttachedVehicle only returns an object, probably not.
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
If [] is given, the trigger is decoupled from the assigned vehicle (example 2).
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.
yeah, probably just some older command
Also the parameters say objects, but when i tested it said 1 is expected
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
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
You'd probably get a different error in that case anyway.
Replacing the default "" with false" make the error go away, that's what I changed without paying to much attention
probably, but as said, I encountered no error on this so far
this is a "lab" mission that I use to develop some proof of concept
there is a loooooot of bad code out there
I'm confused. Is it working now or not :P
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
Dedmen does attempt to fix stuff. When you fix things in Arma it's often going to break something else :P
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
i was never able to reproduce that error 😄
and it's always something with getVariable
Well the narrative of the lost jungle civilization thickens
"Look ! Footsteps ! We are not the first ones here, someone is prowling around..."
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?
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
it is inside an init box i believe that makes it local to an object?
No, init fields are executed on all machines
ah ok
- 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
@tough abyss that is an old method for unit/player knock down
yeah just planning to use it to ragdoll them then set the can's velocity so they go flying
easiest way i can see to set their velocity after ragdolling them
how do you want them to go flying
setvelocity
He meant addForce is much more reliable and newer way
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;```
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;
once youve compiled that function, heres an example of sending the player flying
0 spawn {
sleep 3;
[
player,
[
player vectorModelToWorld [0,2500,1000],
getCenterOfMass player
]
] spawn TAG_fnc_knockDown;
};```
@jade tendon You can try _buildings = nearestObjects [getMarkerPos "buildingsInArea", ["House", "Building"], 200];
It's inheritance-based though, so sanity is not guaranteed.
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};
They have some walls and crate stacks in there so I'm not sure about the intention :P
thanks for the help
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
unitCapture is really simple, you first record the movement with https://community.bistudio.com/wiki/BIS_fnc_unitCapture then, use the data it returns with https://community.bistudio.com/wiki/BIS_fnc_unitPlay to replay the movement
Can I start the unitCapture datacollection with addAction?
ahh might do console instead then, thanks
Why does this say it's missing a bracket somewhere?
dane addAction ["play", "[viperpilot, wp1.sqf] spawn BIS_fnc_unitPlay"];
Yeah I put all the flight data in there
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 }]
greatly appreciated I'll try it out and see if it works, thanks
getting this error now
actually TAG_myUnitPlayData = parseSimpleArray loadFile "wp1.sqf"; is probably more suitable, use that instead
I'll try that, because now I'm not getting any errors but when I activate "play" the heli just stands still
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
try turning it's engine on
vehicle engineOn true
but the AI might turn it back off, i'm not sure
dane addAction ["play", {escortviper engineOn true; [escortviper, TAG_myUnitPlayData] call BIS_fnc_unitPlay }]
like this?
does it need a comma?
vehicle is a placeholder, put the variable name in there
ahh right
}{ this part is wrong, should be just a semicolon
also TAG_myUnitPlayData TAG part is also a placeholder, you should make up your own tag, see https://community.bistudio.com/wiki/OFPEC_tags
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
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
one thing I did notice is that it didn't capture the rocketpods firing off
or maybe https://community.bistudio.com/wiki/BIS_fnc_unitCapture parameter 4, firing, pass true
but i'm not sure if it will work with vehicles 🤔 give it a try
parameter 4 doesn't work on vehicles it seems
did you try it?
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?
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)
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
you used the pilot again, that's why
it has to be the vehicle
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?
it froze because you ended the capturing
i just tried it
looks like it works when I use the heli for fire capture
use https://community.bistudio.com/wiki/BIS_fnc_unitCapture once done capturing, f1 copies movement, f2 copies firing (like you said)
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?
you don't need to use BIS_fnc_unitCaptureFiring
BIS_fnc_unitCapture captures movement and firing
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 }]
change call to spawn for the BIS_fnc_unitPlay
only the movement or also firing?
only the movement
call is "start function and wait for its return". spawn is "start it and let it run"
you block the script from executing further with call, so your BIS_fnc_unitPlay finishes, then the BIS_fnc_unitPlayFiring is called
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 }]
it's a bit "advanced" https://community.bistudio.com/wiki/Scheduler
you captured the data wrong then or something, i tried this and it worked fine for me
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"?
put FI1_myUnitPlayData in debug console, see if it's there
i see nothing wrong with that code
I don't get anything from that
looks like it is 💀
did you reload the mission?
yeah I saved visual studio and re-opened mission every time
systemChat str [FI1_myUnitPlayData] put this in debug console, what does it print in the chat?
do you have an AI in the vehicle?
yup both pilot and gunner
same ones used when unitCapture
how did you get it to work?
what i wrote earlier
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
😅
since it runs only once, that condition is never checked again, thus that hint will never run
Seems like I can't escape those event handlers
So I should add an KnowsAboutChanged event handler to the helicopters init?
you could, you need to add it to the crew's group though
Ah ok
group driver this should get you the group
assuming it's in the init box (and the heli has a pilot)
And do I need oldKnowsAbout and newKnowsAbout or can I ignore those parameters?
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)
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"};
}];
?
that's totally not what i said
Ah wait
_heliCrew addEventHandler ["KnowsAboutChanged", {
params ["", "_targetUnit", "_knowsAbout"];
if (_knowsAbout == 0 || { _targetUnit isNotEqualTo aa_turret }) exitWith {};
hint "Anti air defenses are active";
}];
Well thanks but I still don't understand it 😅
what part?
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
|| is logical or, https://community.bistudio.com/wiki/a_or_b
the if statement, if knows about is zero, or the _targetUnit is not aa_turret, exit the current scope https://community.bistudio.com/wiki/exitWith
otherwise the hint is printed
Ah
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";
};
Ah so without isNotEqualTo every unit would trigger the thing?
which is the same exact thing
Yea this is closer to how I would write it, if I knew how 😂
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];
}];
Ah well my knowledge is still very limited so I'll try to stick to the longer one first
mixed the variable names, edited, there
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
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];
error is elsewhere, nothing wrong with that code
I swear ive used it before and it worked but maybe I got a different script.
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 😄
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
params for KnowsAboutChanged EH are params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];, where did you get the _knowsAbout from? Do you define it somewhere?
no, params identifiers have no relation to anything whatsoever
is aa_turret a unit or an object?
Unit
@copper raven But how works this? Is KnowsAbout also recognized by the event handler or can you name it how you want it
params just assigns some values to some variables, nothing special about it
[1, 2, 3] params ["_one", "_two", "_three"]
Or is it because knowsAbout is an actual thing
Like if I would put _peanut > 0 it doesn't work right?
knowsAbout is a number, from 0 to 4
What does the _ in front of knowsAbout in the script do?
_ prefixed variables are local variables https://community.bistudio.com/wiki/Variables#Local_Variables_Scope
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)
Ah and because "blabla" is the second param it has the role of the second param?
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)
and first doesn't error out if _this is too short 🍿
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
try something like lineIntersectsWith [getPosASL get3DENCamera, AGLToASL screenToWorld getMousePosition] param [0, objNull]
awesome, that works as I wanted
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
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
ik this is the worng channel. but just installing arma 3 you got any tips?
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.
For units? I don't think so. Best you get is commands that ignore group formation (temporarily).
@granite sky ty
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];```
Is this with or without a moon?
id prefer to have a full moon but whatever script works really
Your syntax is all busted. Not even sure where to start there.
thats just some examples and im asking which syntax to use
or if anyone had a night script that works
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.
thank you!
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.
this works! will that work everynight on arma? or am i better off doing a timed one?
Well, as written it only runs once.
yeah these work separately but not in same block.
if (sunOrMoon == 1) then {setApertureNew [0, 0, 0, 0]};```
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;
};
ill try that, thanks heaps
Caveat with that one: It superbrights everything for a bit after if you alt-tab.
the getLighting code, that would be run on serverInit rather than initplayerlocal? im trying to get it done on a life server
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
gets brighter in ESC menu but nothing when i alt+tab.
thanks for the help! its better now
i get what you mean now, it does it for me too when back from alt+tab
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?
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
try making their behavior careless
During the trigger activation?
Instead of 'hvtsniper' and 'HVT', try using the unit IDs, like the text that appears when you hover over a unit in the right side spawn panel in EDEN
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
???
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.
Not sure which panel but these are the names of the units can you show a picture
do you need the sniper to fire at things prior to that?
if yes, then it's gonna be tricky
for the latter i think the only solution is to just make the player captive
Would these type of commands overwrite eg ‘Do not fire’ or ‘Do not fire unless fired upon’ unit settings?
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
that looks correct, yes
It declares a params list, in which there is f.e.
what are the other parameters? they might be required
Nope
Just to kill the HVT when players are about to extract him
then just make him careless
Currently got 2 ai mode modules one to do nothing
How would I do that?
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
createVehicle + some vector math
Can u give me some pointers? Somewhere to start from
Cnat find anything on simulating bullets
to get the direction you can use https://community.bistudio.com/wiki/vectorFromTo
Much appreciated
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
@jade acorn Based on that
information, you should be able to call the function like so:
[[], ["This is _title param text", "This is _text param text"]] call BIN_fnc_setDiaryRecord;
```The first `[]` skips the `_recordInput` parameter by using its default value (this could also be done with `nil`).
they figured it out in #contact_discussion
kinda, still doesn't work fully but at least I got the title to show up
that's what i initially thought too 
чо
You need to write (or find) a dedicated script to delete things like ejection seats and cockpit canopies. The garbage collection of the engine does not clean those up for some reason.
Would you happen to know the object I'd or under which category bullets are?
I can't find them 😭
CfgAmmo
or just do something like
player addEventHandler ["Fired", {
private _type = typeOf (_this select 6);
copyToClipboard _type;
systemChat _type;
}];
and fire the gun
Ack
Was that for me?
yes
Oh, ok
err, how to correct all errors here ?
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 {};
};
};
you can use https://community.bistudio.com/wiki/switch
😐
Wouldn't a switch be better?
I haven't tested this, but I think you can see what we're getting at. Might be a better way to implement the switch:
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]};
};
};
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?
missing }?
do you really need those antipattern values? this could be alot simpler otherwise
do you know where its missing?
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]};
};
};
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
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.
you can replace that switch with "respawn_east" setMarkerSize [[1202, 1502, 1902, 2302, 2602, 3002] select floor ( (_numPlayers - 15 max 0 ) / 10 ) min 5, 1908]
edited (case if there are 75 or more players)
Thanks
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
getRoadInfo and use the width perhaps?
I start with that, thanks
Thanks alot for pointing to correct way, just added random +value to Y position from start position, and random to between start and end
You can also getRelPos half width at 90 degrees of road. That's what I did in my script I believe.
i will try that out
getRoadInfo width is not entirely consistent, IIRC
Gives fairly sensible values for vanilla road objects but not necessarily for mods.
I added random 10-20m, so i get them x m from Road , i need more testing how current workaround works for random maps
This what i scare, and don't know how to do with mod objects
Usual issue where you let modders specify a value and it doesn't have immediate or obvious effects so they just ignore it :P
hi guys, anyone have use any heli extraction/transport/taxi mod/script for multiplayer dedi server use?
Is there way to separate area of marker/ trigger?
what do you mean by that?
Does playSoundUI ignore sound volume defined in CfgSounds?
If i do let's say 600*600 marker, can get that to 3 parts?
To sections 1 2 3
Why not make 3 markers instead
A marker or trigger area is just a geometric definition. You can split it up as you wish
depends on what you are willing to do with them
Spawning bombs, but i want them some distance in area
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...
how are you calculating the position?
Currently just
Bis_fnc_randomPos
running with this as the assumption for now... would like to understand a bit better why however.
0 direction and positive Y are north, positive x is east. Just map conventions.
yes I understand that much. I am trying to align that in my thinking with the conventional calculus of it all.
which is to say X components based on cos, Y sin. but if you run those numbers, you get reversed coordinates.
It's just how you define the direction. 0 = positive Y and clockwise gives you flipped results from 0 = positive X and anticlockwise.
I still don't understand... so what is different from vectordir _x versus [cos _dir, sin _dir]? again if trying to frame it in terms of conventional calculus wisdom... the result literally being [0.990857,-0.134916,0] versus [-0.134916,0.990857] in this case, assuming 97.7537 theta.
[cos _dir, sin _dir] assumes that you're measuring theta from 0 = positive X and anticlockwise.
just draw it out.
ah ok I see, so difference is clockwise or not... conventional to Arma 3.
I need a help with a very easy script
Arma 3 gives me back an error that _detonator is an unknow value
If condition needs brackets: if count _result > 0 then {
"not defined"
where?
u think is this the problem?
You have two of them. They're both wrong.
Nah, if _detonator is undefined then you have a problem earlier.
https://community.bistudio.com/wiki/BIS_fnc_randomPos
Array - in format [center, radius] or [center, [a, b, angle, rect]]
use the latter format
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.
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
What means rect? ,
Is rectangle? True false? Do i need define that there?
I can get that from module attributes, but i just ask for sure what these params means
Is rectangle? True false? Do i need define that there?
yes
Good to know , thanks
@meager spear It's not at all clear what the function's input is supposed to be.
check if clacker is close to the item (satcom) 6 meters then change the clacker value (ace_explosives_Range) to 999999
clacker is what though? An item in a unit's inventory?
yes is a detonator
While the satcom is an actual entity?
satcom is another item placed by unit
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.
well, I also don't know what ace_explosives_range is
Like what sort of object does that apply to
ace value linked to so many fncs that set the working range of the detonator
Because again, you can't setVariable on an inventory item.
outside that limit the detonator is not working
AFAIK at best inventory items are class names and counts. sometimes also rounds depending on what it is.
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.
Nope.
tfar jamming script are allowed to change tfar value settings
until the jammer is activated
tfar has a battery of 1000 of each radio type and flips between them, holding information separately indexed.
mhhhh interesting
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.
it's not terrible. I once did a 'loadout sharing dialog' to distribute my saved loadouts among AI units. based on the ACE verification stuff. ACE makes it a bit more difficult than it needs to be in their macros and such. the shapes can be complex, but it is not that complex.
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.
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.
the what
I do not have the url handy, but the loadout shapes are in the wiki.
You just mean the loadout definition?
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.
Not sure how that's relevant.
speaking in terms of inventories, containers (i.e. backpacks, vests, etc) and such...
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.
not sure what you mean limited arsenal... what happens, for instance, if you have partially spent mags?
LOL didn't? it should.
There are holes in the Arma command set for bullet counts, so it does some ridiculous stuff to keep it consistent.
but yeah I digress a bit... loadouts, inventory, can be a PITA, if you are not aware of the shapes.
ah ok
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
I set it at the top of my code to 10
A systemchat of it straight after that gives 10 properly
both of them?
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
Which... shouldn't happen
10 + 20 * 0.0002536783333is almost10so, it should 😄
systemChat str (player getVariable "KJW_Radiate_AccumulatedDose"); doesn't work inside a CBA pfh for some reason either 
nor does it work outside of one either
neither does copying to clipboard so...
scalar NaN 
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
that's nil
like i said
you're assigning a nil somewhere somehow
the only time it's set is at the top and in that line
the other value then
systemchatting _dose and _accumulatedDose makes only _dose appear
yeah because if an operand to a command is nil, it's silently ignored
so its an issue with (player getVariable "KJW_Radiate_AccumulatedDose");
put the expression into array, it's always printed then and easier to debug
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
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
you never hint it
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 
Just need my maths to work properly 🤷
your hint was only working after first iteration
also indent your code, easier to read
Where would I do indentation in that instance? Inside the CBA PFHs?
yes
roger will do next time
just trying to figure out my maths now as ive no idea what i did the first time
because it's nil, after this line player setVariable ["KJW_Radiate_CountRate_Old", player getVariable "KJW_Radiate_CountRate"]; you define it, but KJW_Radiate_AccumulatedDose remains nil forever
Oh right, first loop around it sets KJW_Radiate_AccumulatedDose to nil and then next loop around it gets defined?
no, the next loop it's nil again, but the other value isn't
I think I vaguely understand