#arma3_scripting
1 messages ยท Page 83 of 1
Is there a way to access the "Description" editor field of a unit from sqf?
hmm. Don't think so.
! is a modifier that inverts whatever boolean (true/false) you give it. For example, !alive takes the bool result of the alive command and inverts it, so the overall expression returns false if alive would return true, and vice versa.
This modifier can be applied to any bool, including the result of triggerActivated, in the same way.
(! is a shorthand for not, if that helps)
I hope the new 3d editor format can be accessed like the description.ext
you'd think getDescription would do it, but no
Is is possible to kick someone who is already in freefall out of it?
I know you can set the global freefall height but that doesnt seem to do anything if they are already freefalling other than prevent it from happening after they naturally exit freefall
That could be it
"Returns unit description set in Editor and visible on role selection screen in MP. Works in MP and SP.
"
@candid sun Maybe, thanks. I'll give that a try, brb :)
1.48, so it's pretty new
I'm somewhat expecting it to return "MEDIC", "ENGINEER", etc. If it wasn't such a new command I wouldn't even be surprised it if returned "zdravotnรญk", "inลพenรฝr", etc ;)
@tough abyss Awesome, thanks!
Thank 25252551, he found it
@candid sun Thanks :)
Probably by changing animation?
Is there any way to test what stance a unit has been ordered by the player to take?
my pleasure
so would !triggerActivated work? I tried it out, and it didn't seem to work
is there any way to set the texture for a 3D dialog object?
iirc triggerActivated only stays true while the condition is true. So if your trigger is only activated for a second, triggerActivated will only be true for a second.
I use it like this and it works like a charm, breaks the while loop as soon as someone enters the trigger
while {!(triggerActivated _trigger)} do {
// code
sleep 5;
};
need something like ctrlSetModelTexture
was wondering if it was called something less intuitive
like the black MX gun - that uses the same model as the normal MX. if you create the black MX as a dialog object it's not black though
use the icon ?
where's the fun in that though?
It's a different weapon class (with the same model). It has a different icon I think
^
icon is definitely different yeah
just looks silly when i create a 3D object from a list which has the icons, but the object is a different colour
What 3d object?
Can anybody think of a way of choosing a waypoint part way to a destination, on a road that a group will actually use to get to that destination?
Simplest solution I can think is to split distance to a destination by x number of points...or say every 200m.
Then use the NearestRoads function to find the nearest road segment, set waypoint to it and repeat
I've already tried that, but that causes a lot of double backing because the nearest road is not necessarily the road the ai chooses to drive on to get to the destination.
Ok, why not this then https://community.bistudio.com/wiki/calculatePath
It doesn't look like that gives me any control over the length of the path segment calculated
like i'm going through cfgWeapons, getting weapon icons + names, adding them to a list
I've never used it. But it seems to give you an array of positions go the destination. I don't know how long each position is, but it may be used every x positions...
Just a guess.
Actually, what would be more useful is a way of detecting when a group can reach a waypoint
I feel like if you use the above to sum a distance and divide by speed you could get that.
then creating a 3D dialog object of the selected weapon using it's defined model
Also, a way of choosing how direct a path the group takes. They tend to flank way far wide.
but it's not consistent for weapons with non default textures like the black mx
is there a way to branch atomically in sqf?
branch?
if x then y otherwise z
it's not atomic
Hello all... can someone tell me what language you are using to script for arma?
Ah, thank you :)
it's a nice little language with the friendliness of assembly but worse syntax ;)
I come from MONO-C C# will that be of any use to me?
i think that's always a silly question. "i know X programming language, will that be useful for language Y?"
sqf and arma configs are c like acording to Flummi
if you know basic programming principles that will be useful to you
alright
OOP will be useful
i have another silly question if you do not mind :)
Why do you specifically need to branch atomically?
basically all my knowledge about Arma engine is either from youtube video's or playing DayZ.... a bad thing to start using scriping right away?
no
start scripting yesterday imo
@sullen marsh i dislike the idea of the scheduler fucking my shit up
can't do that if i don't let it
is it possible to script AI behaviour?
don't wanna miss any of that good banging-your-head-against-a-wall time
Sounds like you've got some sort of race condition going on there
Why not just not use the scheduler?
Hey
i want to set an variable to the object leaving the trigger
How can i do that?
I tried this but it wont work (the hint works, but the var does not)
_trg setTriggerStatements [
"this",
"hint 'In Gas'; [] spawn tag_fnc_teargas;",
"hint 'Kein Gas'; player setVariable ['outOfGas', false];"
];
i wouldn't have to worry if it was unscheduled now would i
the entire script would be atomic
Seems nothing's wrong
It'd be synchronous actually
What is the teargas function? Does it have outOfGas variable in it?
is the trigger server-side perhaps?
Atomic means it'd all execute inside a single cpu cycle
its created on the unit placing the gas
It should trigger for every unit on the server
here is more code
if (_ammo isEqualTo "SmokeShellYellow") exitWith {
private _trg = createTrigger ["EmptyDetector", getPos player];
_trg attachTo [_projectile, [0, 0, 0]];
_trg setTriggerArea [10, 10, 5, false];
_trg setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trg setTriggerStatements [
"this",
"hint 'In Gas'; [] spawn ES_fnc_teargas;",
"hint 'Kein Gas'; player setVariable ['outOfGas', false];"
];
_projectile setVariable ["trigger", _trg, true];
[_projectile] remoteExecCall ["ES_fnc_teargasDelete", 2];
};
And that'd be a pretty small script
that's what it means in another context yeah
its created on the unit placing the gas
what does that mean?
and where is this code executed?
every unit / player has an firedman evh, there it is executed?
well, hint works so code should run on said client machine
either way let's not argue semantics
fucking hell
sorry
i want to set it to true, not false
synchronous then
man thats embarrassing
thanks for your help
Yeah that's what I thought actually. It happens whenever it happens
what i mean is that a script in the scheduled environment can be paused while unscheduled they cannot
I assume you need some multi-path branch like a switch
if (x) then { y } else { z }; if x takes more than 3ms the scheduler will pause before y
Well, in that case there's nothing else that will be atomic
there also exists unsuspendable sheduled environment. Which is governed by the rules of the sheduler but you still can't use sleep, waitUntil and uiSleep
e.g.
0 spawn {call {"unsuspendable sheduled"}};
you what now
Just because you use call doesn't mean it's unsheduled
I still get the feeling there's some race condition you're trying to outrun with this search, what are you actually trying to do in the script
i know that commy i don't think anyone said otherwise
but take these two examples X; X; X; [X, X, X] if X is some statement that takes more than 3ms the first one will pause twice but the second one won't
No
I don't think you're going to find a way
when a unit dies, player can pick up its weapon without having to open unit's inventory - so I assume it creates a groundweaponholder. I'd like to set damage to that weapon (or to the weaponholedr) so it cannot be looted by the player but I don't see any eventhandler that would include the dropping weapon event
possibly something else than damaging every holder in player's vicinity every frame
why not just delete the groundweaponholder?
weapon will disappear then, no?
yeah
I want to keep as many visual elements as possible and get rid of only the gameplay ones, so far I have solved the problem of lifting uniforms and everything else from corpses by disabling the inventory window when trying to loot, only the issue of weapons that can be picked up separately remains
I guess I will be just deleting them if there is no cool solution
disable its simulation
there is also lockInventory. iirc it's still bugged but I think it was fixed for 2.14
no not fixed yet: https://feedback.bistudio.com/T171320
but how do I find that groundweaponholder? Is it created right after unit gets its damage 1 or after it's ragdoll is disabled?
use the killed event handler
then search the nearby weapon holders and get the one for which getCorpse is the dead unit
btw disabling simulation on a body doesn't lock player from looting worn headgear and facewear ๐
disabling simulation on a weapon holder also doesn't prevent seeing the action (it prevents from taking the weapon though)
this does not really matter as long as player can't grab it
trying to pick up a weapon with simulation disabled may change its position I guess, I remember some falling through walls when being interacted with in this state
still a better option than removing stuff from units ๐
Will the trigger not work if i create it from the server?
Or better said, the code in activation / deactivation will be executed locally for the unit triggering the trigger right?
So if i use hint it will show for every player actiavting that trigger and not only for the creator of the trigger right?
no
server triggers only execute on the server
triggers execute their codes locally
Only for the creator then?
yeah okay thats what locally means xD
if not a local trigger then no
it executes the code locally on each client separately (if it triggers for them)
I think 
It does.
those that you create in 3den will behave like this tho
Afaik condition evaluates where trigger is local no?
dunno 
I think it executes locally everywhere, same as statements
will try this out later, thanks
but maybe you can help me with this
I want to create an trigger when a smoke is thrown, i attachted the trigger to the smoke
When the smoke is gone i want the trigger to get deleted
With the evh firedMan i check for the smoke, created the trigger and safed him into a var on the smoke
Than i remote execd to the server with the smoke as a paramter
The server attaches the deleted evh and when the smoke is deleted the trigger gets deleted to
This works ~1-2 times and than suddenly stops working, the server still recives the object etc and executes the function but somehow the evh for deleted does not get triggered
Any idear why?
Or how i could solve this in a other way?
I dont want the "thrower" to remove the trigger becuase he could disconnect
if you create the trigger only on the client, the server cannot delete it
the trigger has makeGlobal on true
and the server did delete it once
but maybe this is the reason why it bugs so much
then make the client call a server-side trigger creation function
no need for the client to do tons of stuff
otherwise, FiredMan โ create trigger + smoke death event = trigger deleted on client - on disconnect, the trigger doesn't exist anymore
given the feature, IDK what is your stuff, client-side trigger may be wrong.
feature is a gas granade, it gets thrown and the trigger should handle adding / remove the effect for players getting near the gas
If i put the trigger on the server, what should be the code in the setTriggerStatements / activation?
I tried this but then only the server got the code executed
don't use server triggers
use local triggers
projectiles are local
basically what Lou said
why not?
he wants to show effects for players
better use local triggers anyway
otherwise he'll need remoteExec for something that is local -> pure waste of resources
so client throws -> remoteexec to every client a local trigger and the EVH that when the projectile is gone the trigger gets deleted?
uhmmm 
do you want to show the effects for a specific type of projectile?
only if a yellow smoke is thrown
what is the effect you have, client-side?
you can use projectileCreated event handler locally on each client. no need for remoteExec then
camera shake etc.
https://forums.bohemia.net/forums/topic/180844-teargas-toxic-gas-script-help/
basicly i want to take this script but i dont want to have a constant loop on a client
addMissionEventHandler ["projectileCreated", {
params ["_projectile"];
if (typeof _projectile != "blabla") exitWith {};
_trigger = createTrigger ["EmptyDetector", [0,0,0], false];
_trigger attachTo [_projectile, [0,0,0]];
_projectile setVariable ["trigger", _trigger]
_projectile addEventHandler ["deleted", {
params ["_proj"];
deleteVehicle (_proj getVariable ["trigger", objNull]);
}];
}];
something like that
yes that looks good and kinda similar to my approach xD
Dont think that this will be important for my usecase but what could i do if i want this to be JIP?
I think it will be JIP compatible as it is
they should still have a projectile created for them
except this doesn't need any remoteExec
everything is local
including the trigger
just that people joining after the throw and before smoke deletion might not have the effect
not sure if projectileCreated triggers on JIP projectile creation
Thank you guys ๐
Works like a charm
Hello! I want one of the three bots on the red side to randomly run the script (_killer setcaptive false ) when a bot comes from the blue side
please tell me the script below i have an example of the script but it does not work
private _killer = selectRandom [a1,a2,a3];
if ((bob distance _killer) < 5) then {
_killer setcaptive false;
};
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
private _killer = selectRandom [a1, a2, a3];
waitUntil { sleep 1; bob distance _killer < 5 };
_killer setCaptive false;
Ive tried running switchMove but all it does is kick me back into the halo jump animation
switchMove + set freefall height
Ill play around with that combo a bit thank you
// Find the MHQ1 asset
_mhq1 = nearestObject [player, "MHQ1"];
// Check if the MHQ1 asset is found
if (isObjectHidden _mhq1) then {
hint "MHQ1 not found!";
} else {
// Teleport the player to the position of MHQ1
player setPos getPos _mhq1;
hint "Teleported to MHQ1!";
}
This is the teleport string I use attached, in regards to #arma3_editor
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
How do not use โSetPosโ for a teleporting feature
by using any sane setPos* command. Like setPosASL
setPosWorld, setPosASL, setPosATL, etc yes
// Check if the MHQ1 asset is found
if (isObjectHidden _mhq1) then {
```hmmm nope, try```sqf
if (not isNull _mhq1) then {
When using a MineActivated event handler, do I put it in a trigger and also for the projectile, does that mean the mine I am using?
sorry, say again?
the "MineActivated" EH must be added to the projectile - it is documented here https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MineActivated
But does that solve the issue of the vehicle not respawning at all despite the module being used.
So in the init box of the mine I am using?
do I write it in sqs format or do I write it in the editor itself ?
it should work I think
I wouldn't recommend writing anything in SQS format as it is deprecated. Use SQF instead.
it doesn't have anything to do with vehicles respawning
thanks!
Okay, I was seeing if my scripting is messing with the vehicle respawning.
yep, where did you write this?
in the sqs script
The only proper way is very, very complicated. You don't wanna go there unless you're making it a pathfinding project.
no.
write in the game editor itself?
define "the sqs script" please
as NikkoJT told here, SQS is obsolete - use SQF
what's the model command you're supposed to use with set/getPosWorld? modelToWorldWorld?
the model command? get the model-relative pos?
yees
i think the model offset is causing me problems as am using setPosASL with modelToWorldWorld
https://community.bistudio.com/wiki/modelToWorldWorld
and use setPosWorld with this one
kinda
Finally, how do I put the mine in the players inventory, without making them pick it up?
ah ty
i'll see if this fixes my issue
havent done any scripting for nearly a month now ๐
use the Arsenal
but then your script won't be used
boooooo!
is there any command that puts it in the players inv?
you can use addItem or addMagazine
i have 4 projects on the go that i want to do no work on any of so its not my fault!!!
but then you will have to use a "Put" EH on the player to know if they fired a mine, then use that projectile EH on the placed mine
I did it! Thank you for your help! I just didn't run the script correctly)
thx
updating mods after yo urelease them is for cowards
this channel is (surprisingly) about scripting ๐
wrong channel this is for scripting (code not plays)
ok
though i suppose the channel topic doesnt eliminate screenplays about arma 3 from here
you can ask in #reforger_questions
thanks
Is there a way to incorporate a live feed of an area in game?
Like seeing a pos from a UAV but without using the UAV terminal
fuck you beat me to it
it did, problem was with my capital ships mod where banking and accelerating forwards would cause the ship to move in the direction the ship was banked in
which is ok for planes, not really ok for a big non aerodynamic blob
now i just have the problem of turning whilst moving is significantly faster 
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
So im using this snippet. It is trigged whilst the user is already in the freefall mode.
The animation on line 61 triggers but then the user goes right back into the freefall animation.
Will follow!
setUnitFreefallHeight also needs to be run local to the player.
upon recording this i realised its not actually bugged and just looks it for some reason so have a funny submarine flying around
yes there is no way
you must prevent it altogether
Guys, can you suggest a script for ejecting weapons from the hands of a bot?
nvm yes i do
24.67s moving
192.41s unmoving
and yet the orientation code doesnt touch the velocity code, standby for an sqfbin 
nvm sqfbin down again ๐ฆ
https://pastebin.com/pUZVQ1vd
orientation doesn't touch velocity and vice versa so i'm totally stumped here 
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
hmmโฆ isn't "AfalPerc" a fall animation?
it is yeah
in any case you can't "snap" units out of freefall anim. you should just make sure they never get into it in the first place
@finite dirge fyi
...though my problem could be a lack of diag_deltaTime in KJW_CapitalShips_fnc_orientShip buuuutttt wouldn't make sense for its time to change upon the ship starting movement 
why do you add 3 per frame EHs? 
and why do you keep reading configs every frame? 
and also I have no idea what you're doing in that code ๐
because i havent bothered performance optimising yet because its just in single player
configs im going to end up caching when i can be bothered
but the code takes an object that doesnt move and sets its position and orientation etc in accordance with the variables (targetvelocity and targetorientation)
as seen here
but for some reason its much quicker at orienting while its moving when it should(?) be the same speed surely
I know I mean I can't read it ๐
oh
KJW_CapitalShips_fnc_turnShip and KJW_CapitalShips_fnc_accelerateShip just handle changing the target variables in accordance with their speeds and so on so can be ignored really
i'll do another pastebin with just the ones that matter
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
(i know the eachframe config lookups are horrible im going to just stick all of the config information into a variable on it when the ship is initialised once i have energy to do that)
the object is quicker at changing orientation when its moving than when its stationary
to do a loop de loop
24.67s moving
192.41s unmoving
what does this even mean? 
hang on i'll draw a diagram to compensate for my poor written communication skills
doing this
when its moving it takes ~25 seconds to point upwards again
when its not moving it takes ~192 seconds to point upwards again
(to do a 360 in pitch i suppose)
does that help
I doubt it's related to this then
AHA
found it
_ship setVectorDirAndUp ([_dir, _up] apply {_ship vectorModelToWorldVisual _x});
changing it to vectorModelToWorld has solved it
going to double check
yeah turning on the spot is just as fast
just need to tweak config values now and (probably) change the config lookups to variable checks
though i will say i only noticed a .0005ms difference in performance in either so ๐คท
it's much bigger than that
i probably didnt test it correctly then
as a sidenote the multiple pfhs are purely for organisations sake right now and will be consolodated into one eventually don't worry
are purely for organisations sake
you can just make separete functions
i know i just find it easier this way
you iterate over the same objs every frame
so you should just do [_x] call fnc1; [x] call fnc2 for each obj in 1 each frame
im changing the configs to variables now then im putting it into one pfh
oh i didn't even think of that boost either
...evidently
Would this work for placeable sandbags?
Kind of like what SOG does with its FOB creations
// Define the sandbag barrier object class name
_barrierClassname = "Land_HBarrierWall4_F";
// Define the initial health and decay rate of the barrier
_initialHealth = 100;
_decayRate = 1;
// Define the required supplies for maintenance
_requiredSupplies = 10;
// Create a sandbag barrier
_createBarrier = {
private["_position", "_barrier"];
_position = _this;
// Create the barrier object at the specified position
_barrier = createVehicle [_barrierClassname, _position, [], 0, "NONE"];
// Set the initial health of the barrier
_barrier setVariable ["health", _initialHealth, true];
// Add the barrier to the global array for tracking
barriersArray pushBack _barrier;
};
// Decay the barriers over time and handle maintenance
_decayAndMaintenanceLoop = {
while {true} do {
{
private ["_barrier", "_health", "_supplies"];
_barrier = _x;
// Decay the barrier health based on the decay rate
_health = _barrier getVariable ["health", _initialHealth];
_health = _health - _decayRate;
// Check if the barrier needs maintenance
if (_health <= 0) then {
// Find the nearest player/team or modify as per your requirements
_supplies = player getVariable ["supplies", 0];
// Check if there are enough supplies for maintenance
if (_supplies >= _requiredSupplies) then {
// Deduct the required supplies
player setVariable ["supplies", _supplies - _requiredSupplies, true];
// Reset the barrier health to the initial value
_health = _initialHealth;
// Update the barrier's health variable
_barrier setVariable ["health", _health, true];
// Play a maintenance sound or show a message
hint "Barrier maintained!";
} else {
// Play a decayed sound or show a message
hint "Barrier decayed!";
// Alternatively, you can remove the barrier here using `deleteVehicle _barrier;`
}
} else {
// Update the barrier's health variable
_barrier setVariable ["health", _health, true];
}
} forEach barriersArray;
sleep 1; // Adjust the decay rate by changing the sleep time
}
};
// Create an array to store the barriers
barriersArray = [];
// Execute the decay and maintenance loop
[] spawn _decayAndMaintenanceLoop;
// Example usage:
{
// Specify the positions where the barriers should be created
[_x, 0] call _createBarrier;
} forEach [
// Provide the positions for the barriers here
[1000, 1000, 0],
[2000, 2000, 0]
];
there we go
leopard can sleep better now
i did a job interview with this font on having forgotten about it; it helps me read it so i have an excuse
monocraft
vet29 made an arma mod for it as well
but its on his gh unreleased on ws
Is there any way to run script code if a Man hits a wall? Like isTouchingGround but for non-vertical collisions
I tried the EpeContact EventHandler, but it (predictably) didn't ever fire, since Man isn't a PhysX object
not out of the box no
sad.. thanks, though ๐
I'll figure something else out using lineIntersectsSurfaces, math, and possibly a hackhack or two
How would you go about creating a server function within a mod? I'm assuming I need to create a initServer.sqf, but I'm not quite sure which event handler to use on the config end
"creating a server function"? Assuming that you didn't scramble that request, best to use CfgFunctions.
Basically I need a function which is packed within the mod, which would on the the server
client -> someFunction (some function is defined within the mod)
I think someone botted or DDoS'd it sadly, even through CF. It was taking 224 hits a second for hours.
I'll see what I can do.
(Thanks for the heads up)
Should be back up for now ๐
sorry to hear, and thank you!
Is there any way to force ai groups to take more direct paths to far away destinations? Is the "suppression" mechanic part of the reason they flank so wide? What about the "general" or "command" skills of the group leader? The problem I'm having is east and west forces are flanking so wide, they're spreading out over several miles, and often going around each other entirely. It gets worse the longer the mission is played, which makes me wonder if the ai are trying to bypass "beaten" zones, hence the question about the suppression mechanism.
Infantry?
Infantry and vehicles
Infantry go quite direct unless distracted by nearby enemies, in my experience.
I've got two objectives about 2 km apart from each other. Guys and vehicles spawning at each objective going to the other end up spread out like 3km perpedicular to the direction between the objectives. Now, I can mitigate this by giving them waypoints part way to their destination, BUT, I cannot figure out a way to do this while keeping vehicles on roads leading to their destination. And without keeping vehicles on the roads, they tend to try to go through areas they cannot really pass through.
I honestly don't know how you're making your infantry drift that much.
Maybe with full reveal + search & destroy waypoints.
they spread out more and more over time. After about 45 minutes, they're going way out in the boonies. I think they're trying to go around beaten zones, but I'm not sure.
Attached objects won't collide with eachother
they start out in cars.
or apcs/tanks
But anyway, everybody ends up flanking way too far wide
There isn't a waypoint that makes ai move toward and attack enemies on their way to a destination, is there???
1/ mods? like, AI mods?
2/ "wander" waypoint?
- No ai mods except for my own, which currently only changes cfgskills and ai related weapon / ammo parameters. 2) I don't recall what a wander waypoint is. Dismissed??? If so, then not using any of those waypoints.
"move"
I'd avoid search and destroy if you care about where they go.
Can't really tell what you're talking about though.
Doesn't correspond to any AI behaviour I've seen, and I've watched a lot of vanilla AI behaviour.
If AIs have a move order to a destination but they're moving continually away from that, it's usually because they're fleeing. But that's very post-engagement.
You can disable fleeing.
There's also a mechanic where squad leaders will split off a couple of squad members to investigate a position, but in that case it's obviously a split squad.
Can I post a screenshot here?
I'll use imgur. https://imgur.com/dfFNSUk This is after only about 5 minutes of mission time. You can see that some blue groups are already flanking way around unnecessarily. Why aren't they taking a more direct path?
And after another 5 minutes, it's slowly gettting worse. https://imgur.com/lW9l8IS Why is that opfor group flanking so far around???
I'd rather have that in #arma3_scenario tbh ๐
should i avoid using globals in EachFrame events to maximize perf?
Well, it's going to be a scripting solution if there is one.
unless we find out there is something fishy in mods :p
(or anywhere else for that matter)
whenever possible, but sometimes you just can't do otherwise
ideally grab the data in one array and make private vars of it
What kinds of modifications could cause this???
This group has gone almost to the edge of the map trying to go around enemies: https://imgur.com/Xhnx4ty There aren't even any enemies nearby.
hmm, this looks awful but if it can save me some performance...
maybe i could make an _functionlib array that contains all the functions
IDK, try in pure vanilla
As an asside, what happens when there is a conflict between a group's combat behaviour and the combat behaviour of the units in that group?
Any ideas to this
yeah, sqfbin.com
As far as I can tell, some aspects always use the unit behaviour and some use the group behaviour.
Do you know which aspects use which?
Only some. Unit position is individual for example. Vehicle navigation is always group behaviour.
What about bounding overwatch? group, or unit?
No idea.
is the movement planning of idividual units based on the unit or group behaviour? For example, can I have some units in a group moving stealthily, and not others?
You certainly can for a player group. I imagine the same applies to AI squads.
(but this doesn't completely follow, as some player group orders act on a level that's not even script-accessible)
Another asside. Is it possible to determine what stance a player commanded unit has been ordered by the player to assume?
I'm going to guess not.
Although given that commanded pos is highest priority, I guess that's just the stance they're in? so unitPos
Although maybe that only returns the setUnitPos value.
as "upload it to an external site so it's easier to read"
Apparently unitpos does return what the unit was ordered by the player to assume. Someobody told me yesterday that it does not.
maybe they meant setUnitPosWeak
What kind of mod is this?
It's my own mission. Only mod in effect is changing some basic stuff like cfgskills and some weapon and ammo ai related parameters.
bots are able to think and make decisions at the company command level?
No, they're just being sent directly to the next objective. I do not understand why they are flanking so far around.
everything is in meters on arma right?
yes
Or do you mean there is some kind of strategic decision making going on in the base game that I've never heard about before?
unitPos
yeah but I corrected it a few comments later
Didn't notice, sorry.
I guess I was thinking about the fact that setUnitPos can't change player issued stance
you sure the code didn't send them there? maybe you had an objective there before?
I've never seen AI flank like that
it could be because the group is fleeing 
did you check that?
this one is kind of suspicious of being sent to [0,0,0] (maybe objective was an object that was invalid or deleted?)
or maybe fleeing
I disabled fleeing, they still flank really far
I'm pretty sure they were not being sent anywhere except to an area near the correct objective
still if it happens again try to log the fleeing
I think they still flee when they're out of ammo
does the group as a whole flee, or individual units?
I don't remember but I think individuals 
IME the whole group flees at once, but then the getter is on the units.
I just tested it again, no sign of any fleeing going on. Still flanking very wide, even after just a few minutes of mission time.
Did you actually check fleeing _unit?
yes
Could "safe" combat behavior or "green" combat mode cause them to want to go the long way around to an objective?
It seems like if anything that should make them take a more direct path
In vehicles, yes. Not seen it with infantry but then I don't normally use safe for moving towards an enemy objective.
In vehicles careless is the only one that doesn't avoid threats, IIRC
I'm using SAFE and GREEN in an attempt to make them move more quickly when they are not in contact with the enemy
I'm not sure why those guys down in the corner would even know about the enemy.
Some of them immediately set out on a round about path as soon as they spawn, even when no enemies are within kms of their position.
hmm, I wonder if you're hitting a specific blocked path case here.
Like it first tries the direct route, but it's impassable so it random-rolls some bullshit.
it happens on any map, seemingly regardless where the bases are located
yeah no idea then. Not seen it.
Like in Antistasi I routinely buy squads and send them at enemy objectives. They take the direct path.
Hmm... setting them to "AWARE" and "YELLOW" instead of "SAFE" and "GREEN" hasn't fixed the problem
I notice that for like half a second after a group is initially created, they show up as their position at map origin. I wonder if that could have something to do with it.
Try replicating the behaviour with no mods and outside your mission.
It's a common thing to spawn units elsewhere and then move them. Pretty dangerous.
Ideally don't do that, or at least only give them the waypoint after they've been placed properly.
I'm not spawning them elsewhere, I just see that for a moment it shows the group position at map origin.
Sorry, I mean it shows the leader's position at map origin. But I am creating them at the location they're supposed to start at.
Oh never mind that... the marker is at the origin... it hasn't updated for the goup's position yet. However, all the rest of the problem still remains.
is there a way to get the new player unit in onPlayerKilled.sqf?
similar to onPlayerRespawn.sqf's _newUnit, _oldUnit
How more intensive are hashmaps compared to arrays?
Basically
Hashmaps are drastically faster in finding keys and values
Probably not because it hasn't been created at that point.
alright, then a question about respawn templates instead. When a player is killed, is onPlayerRespawn also called? or does it only call onPlayerKilled?
onPlayerKilled.sqf firing does not necessarily mean that a new player unit exists or ever will exist - it is possible to completely disable respawning. So it would be difficult for it to reliably provide that.
they usually use much more memory
and they're slower when iterating over them (probably not that imprtant in SQF since it's not that fast anyway)
and unlike arrays they don't support all data types
onPlayerRespawn is called if/when the player respawns. I'm not sure what's ambiguous about that unless you're concerned about frame timings.
I think the default behaviour is that the player is force-respawned after 15 seconds of being dead. So in that case the killed handlers would fire 15 seconds before the respawn handlers.
ah alright thats basically what I wanted to know, I wasnt sure if being killed would call something else to handle the player afterwards or if it would call onPlayerRespawn. Thank you
I also understand its probably not onPlayerKilled calling onPlayerRespawn, just not sure how to word it
It's similar to events. Arma calls them when specific things happen.
Although it does apparently run those scheduled, unlike events which are all unscheduled.
so im using this mod atm
https://steamcommunity.com/sharedfiles/filedetails/?id=2141020863
i tick the client and server override in the setting but it resets when the server restarts, is there a file i can put the exported setting in so the server always loads them
My problem with ai groups flanking wide to get to objectives definitely has something to do with the presence of enemies. When I remove all enemies, the remaining groups on that single side take direct paths to the objective.
have you tried setting your ai groups to careless?
Not really an option because that causes infantry to move very slowly.
have you tried using setSpeedMode to counter that?
https://community.bistudio.com/wiki/setSpeedMode
cba_settings.sqf goes in root where mission.sqm is
yes, and make sure cba_settings_hasSettingsFile = 1; is in your description.ext
lovely, thank you!
no problem
so i have an issuie, were using input action to get the inputs of the helicopter, but when in free look and the cyclic input isint being touched, just the view controls, it still registers the cyclic controls, the helicopter itself dosent move but the inputaction thinks something is happeneing
whale, _this select 1 is what you're looking for
caller (_this select 1): Object - the unit that activated the action
Anyone know if there is a way to promote someone to zeus like in the way its done in the zeus enhanced mod?
how can I make a thermal-only lightsource? I have a unit in uniform that is almost transparent and player should be able to see that unit only in thermals (but it is invisible in every camera mode). So far I have an eventhandler to switch the uniform to a similar one with "hot" rvmat but was thinking about attaching a thermal light source to his body to make the entity visible in TI, but not fully. setLightIR works only for NVGs
that'sโฆ #arma3_config ?
I was hoping for a config-less script as it's for a mission rather than a mod
Amm laser command can create ir only light, but light source cant. So i guess, eh, and if player puts on nvg, create light source, if they take it off, delete light source
Light source can create an IR-only light (https://community.bistudio.com/wiki/setLightIR).
The problem is that IR lights are not thermal heat sources.
Right. Light has no heat
Hello everyone, Im having some trouble with an arma script I recently wrote, it errors saying _scrapCarried is undefined.
https://sqfbin.com/fogopevuqajisaxoyanu
RPT Log:
13:44:05 Error in expression <se 1 past.";
private _currentScrap = _scrapCarried getOrDefaultCall [_callerU>
13:44:05 Error position: <_scrapCarried getOrDefaultCall [_callerU>
13:44:05 Error Undefined variable in expression: _scrapcarried
hi
โ please use https://sqfbin.com/, don't post blocks of code like that
โ _currentScrap is a local variable, and the action's code is not aware of it (different scope)
โ you keep using public variables but for the one you need a public variable
sup, i wanted to do marker area like in pic using script so i wrote this code
_markers = TRA_Markers; // Array
_markersNum = count allMapMarkers;
_markerPos = []; // Array of x, y, z pos of every marker
{
_Pos = getMarkerPos _x;
_markerPos pushBack _pos; // pushing each pos
} forEach _markers;
{
_newMarker = createMarker ["Area_Marker", _x];
"Area_Marker" setMarkerShape "ELLIPSE";
"Area_Marker" setMarkerColor "colorOPFOR";
"Area_Marker" setMarkerSize [200, 200];
}forEach _markerPos;
but still not making the marker
marker names need to be different
private _markers = TRA_Markers; // array of markers
{
private _name = format ["Area_Marker%1", _forEachIndex];
createMarker [_name, getMarkerPos _x];
_name setMarkerShape "ELLIPSE";
_name setMarkerColor "colorOPFOR";
_name setMarkerSize [200, 200];
} forEach _markers;
Hi, it's me again;
For some reason my target vehicle is not being deleted after the action is completed. The 'vehicle' in the image should be deleted after the action is complete.
again, using global var target (but that's not the issue)
params ["_target", "_caller", "_actionId", "_arguments"];
// ...
deleteVehicle _target;
also currentScrap is not used
wait, I did not notice - I do not know CBA_fnc_progressBar
that's fine, CBA progressbar code
I wanted to access _target within the progressbar code but it no workey
Im going to try like this, but last time it did not work
*corrected _this
check their doc, they might accept parameters too
they do, that's why im asking...
Not entirely sure how to pass _target from addAction down to the progressbar scope
how about joining ACE discord where CBA devs are too and ask directly at source ๐
Shouldnt be an issue, its rather related to a general arma scripting issue
anyways, i've figured it out regardless
i just made target a public variable and now it seems to work
it won't as soon as you click one then the other scrap before the 3s are up
The progressbar prevents movement unless aborted so it shouldnt be a problem
ok, good then
Unless a player found a way to perfectly align his camera with 2 scrap pieces it shouldnt pose an issue
also, even if the player dies, he gets monies
I dont think the player will die grabbing scrap
Do hashmaps always return strings? Whenever I set my hashmap and try to return its data using getOrDefault it always gives me "any"
Well any is not a string if that's what you mean
And no they don't always return string
well, surely.. im just generally confused
for some reason my hashmap wont get the new data
How do you set it?
_generatedScrap addAction ["Obtain Scrap", {
private _caller = _this select 1;
callerUID = getPlayerUID _caller;
private _currentScrap = scrapCarried getOrDefault [callerUID, 0];
target = _this select 0;
["Obtaining Scrap...", 3, {
true
}, {
private _scrapMined = selectRandom scrapAmmount;
hint format ["+%1 Scrap!", _scrapMined];
systemChat format ["%1", _scrapMined];
{
scrapCarried set [callerUID, _scrapMined];
deleteVehicle target;
} remoteExec ["call", 0];
}, {
hint "Aborted!"
}] call CBA_fnc_progressBar;
}];
I get the data using getOrDefault as seen
then I set the data using set
i get no errors
Well then you must've set it to nil
shouldnt be nil... i'll double check.
Or scrapCarried is nil itself
scrapCarried nil? But that would mean set and get wouldnt work.. or?
this is how its defined
It would mean they return nil
In unscheduled environment they would just silently fail. In scheduled you'd get an undefined var error
You're in addAction which is scheduled
From what I see it could be that scrapAmount is not defined
Oh, @little raptor i figured it out
Inside the remoteExec "_scrapMined" becomes "any"
Yes
What I said here
It's most likely not defined everywhere otherwise you wouldn't get a nil
Oh wait your remoteExec code doesn't include the _scrapMined var at all
Didn't notice on mobile
I fixed it by making _scrapMined a public variable
Well ofc it's not defined then
Pass it as args to remoteExec
what
[_scrapMined] {
private _scrapMined = _this select 0;
scrapCarried set [callerUID, _scrapMined];
deleteVehicle target;
} remoteExec ["call", 0];
wold this work?
If you fix it yes
what do you mean?
Well target's not defined either
ah no that's fine
I mean the brachets and ,
[[scrap], {}] remoteExec
See the pins to see how to write remoteExec
You told me to put my sandbag placement and decay in sqfbin.com I placed the screenshot
[[_scrapMined], {
private _scrapMined = _this select 0;
scrapCarried set [callerUID, ];
deleteVehicle target;
}] remoteExec ["call", 0]
Yeah
Well there's nothing after set 
You cut it out
its alriiiighttt ๐
yeah fixin thatr
@little raptor working flawlessly, thanks again.
Guess who's back. Just a small question, @little raptor . How would I go in adding more arguments?
I tried adding more to the array _scrapMined was located at:
[[_scrapMined, _myOtherVariable], ...
though it seems not to work.
- I fixed it by not passing the variable and just re-obtainingt he data
โฆplease provide the URL here ๐
thanks
so the original question is "would this work"
my answer would be "try and see"?
Haha okay!
it does work
I should classify the file as, sandbag.sqf?
if you want to? you could name it "potato.sqf" that it would work the same ^^
Q: is there a way to intercept when a function is called?
no
And for the variable of supplies required would I use _spawn?
So it would spawn that exact variable each time?
Hey im trying to figure out if its possible to whitelist items in the arsenal to a players uid has anyone done it
This has a good reference
Thank you
Ofc
no reply? I gather there is not then?
as KJW said no
whatcha trying to do?
there may be better ways to do this, looking into one upstream approach now...
I want to tell when BIS|ACE arsenal has been configured with virtual items...
or at minimum inquire what those items might be
I'm sure there are ways to detect that but I dont use arsenal my self so...
is there not a cba event for ace arsenal
preOpen/open/close events for arsenal are available even in vanilla 
but inventory change... 
not looking for hooks to the arsenal itself. for the virtual items.
for an inventory manager thing I am doing. draws from the same set of items.
so I need to know either upstream when that set is assembled, or when the virtual items have been discovered.
surely you only need to know when the manager is in use? 
"set is assembled"/"virtual items have been discovered" aren't exactly self-explanatory (at least for my ear) 
no like I said, when inventory manager is opened, it will load the virtual items
yeah, so just query the items in the arsenal when the manager is opened 
so just calling the BIS fnc getVirtualWhateverCargo functions, for BIS... and/or in the ACE variety?
code
assume its just a getvariable, check ace docs
isnt createvehicle at 0,0,0 then setposasl faster
except it gets rid of the entire point of 10-meter positioning radius set in the command 
exactly.
createVehicle with CAN_COLLIDE then setPosXXX is faster
ah
and if scripter doesn't want to find a non-colliding position, why bother with setting 10 meter radius in the command call?
this has nothing to do with unschd env as you said
put vehicle in pos i tell it to ๐
sure I'll check it out, thanks...
I mean maybe it gets damaged
is getvariable literally the same thing as using hurrdurrmyvariablename
unarmed uses the minigun model and just hides the weapons and doesn't configure turrets to use them 
It is essentially the same, if
- the variable is in missionNamespace
- you do not specify a default value to use if the variable is not defined
If either or both of those things is not true, then it's different.
e๐ ฑ๏ธic thanks
Also as long as you don't use with, but no-one does that.
what the hell is with
switching default namespace
i am terrified of that
as you should be
either way im now being distracted by a bug in my code thats just making everything spin around faster and faster its quite fun
I have a couple questions about hashmaps, can you set multiple key/values at once? or do you need to set one at a time?
also, I want to store some code in each value for my hashmaps like a function or something, is that possible? something like
params["_thing"];
TRA_buildObjectInits set [
"object_class",
{
params ["_thing"];
// modify thing, probably addActions
}
];
[_thing] call (TRA_buildObjectInits get "object_class");
Values can be anything (unlike keys). Code is fine.
sick so I can actually call it like that? perfect
You can use insert to add multiple values at once.
i believe you can use emojis as keys
You can use emojis as keys if it's a supported unicode character, because you can use strings as keys
(or just createHashMapFromArray)
private _myhash = createHashmap;
_myhash insert [["๐","i like trains"], ["๐ ","i hate trains"]];
private _trains = _myhash get "๐"```
sidenote: we get OOP support in v2.14 which essentially does that
is there any difference in speed of creation and what not? although I dont think it matters much as itll only create on server start.
TRA_buildObjectInits insert [
[
"object_class",
{
}
],
[
"object_class",
{
}
]
];
oh neato, been a bit since I worked with oop looks like ill have to re familiarize myself
I was gonna say its not very pretty looking
pretty looking? sqf? wake up
how dare you. everything I code is gorgeous.
mine isnt ๐
some people are real masochists and it shows
It would be pretty if you weren't using the minecraft font
it helps me read it
best part? thats a shit ton of cba waituntilandexecutes just beneath it
๐ fuck the scheduler ๐
hes learned to code on that one minecraft mod that adds programmable computers and robots
i had a job interview and forgot to turn the font off before it
Aint nobody stopping you from writing everything unscheduled ๐
Doesn't need to be supported unicode character, can be total garbage too
real talk
Interesting
@pliant stream Out of interest, what do you need uninterrupted branching for? If you've got something where you want the action to happen while the condition is still in the 'correct' state, you're not going to be able to guarantee that unless the condition is only determined by local effects, the action only has local effect and you're running in unscheduled code. Since the first two are usually not true, synchronous branches wouldn't do you much good anyway.
Your code: hacky, technical, nerdy
My code: classy, refined, gentlemanly
i hate that even more than i hate my own code
and im 5 months into this project and have been "nearly finished" for 2 of them
n++ is dreadful use vscode
Nope.
this is far better
Nope.
player addEventHandler ["VisionModeChanged", {
params ["_person", "_visionMode", "_TIindex", "_visionModePrev", "_TIindexPrev", "_vehicle", "_turret"];
_arrayOfUnits = entities [["O_G_Survivor_F"], [], false, true];
if (_visionMode == 2) then {
{ _x forceAddUniform "TCGM_m_BodyErebus_G" } forEach _arrayOfUnits; } else {
{ _x forceAddUniform "TCGM_m_BodyTransparent_G"}; forEach _arrayOfUnits;
};
hint str _visionMode;
}];``` any suggestions on how to optimize this? New entities of that class may be spawned during the scenario so I cannot keep the _arrayOfUnits outside
(I gave up with the TI light idea)
can you not add an init field piece of code to add to the arrayofunits or something?
or must it stay out of a mod
mission, not mod
see i make mods for missions then just never do the missions
but i think thats probably the best you're going to be getting without modifying other classes
insofar as reliability
You could keep the array of units in mission namespace and have an entityCreated EH that adds new ones to it.
I dunno if there's a huge amount of optimising that needs to be done though unless you expect to have a lot of these units. Your entities is tightly targeted and shouldn't take too long if there aren't a lot of them to collect.
If you're looking for a font, FiraCode
"nerd font" is the first result of google after searching that
i only write in python sqf and c# so its not that big of a deal for me
just readability is nicest in monocraft
I thought of adding a distance check so the EH would check only for units within 500 meters or so from the player, but not sure where to add it there
distance check is probably more expensive than just inserting into the array tbh
Also if you fancy total garbage as variable names i guess you could do this missionNamespace setVariable["Dยฎ%cc|",1234]; //or missionNamespace setVariable ["หลฑโd Xing โ ยซล $&*", 123]
and now I'm thinking that there might be no performance benefit from this
ye
shit wrong screenshot
i was wondering whose balls those were
anyway, here's a theme to accompany your font
i cant read any of that
wouldnt CBA's class event handler work?
errrr
probably actually
if he was to use CBA
i know honger hates ace idk about cba
I am using cba indeed, actually forced to use it
good
ive never used remoteexec in my life thanks to cba
and this works with both preplaced and later added units?
yes
5: _applyInitRetroactively Apply โinitโ event type on existing units that have already been initilized. [optional] <BOOLEAN> ((default: false) should be true though for u
alright, I'll try it
real talk
your mod should rely on gaslighting players
omg i should make a mod that does nothing except add a cfgpatches entry but i claim it gives +12% fps
im going to make a mod specifically to down your FPS to 1
just because
but ill label it as the ultimate star wars mod pack
Iโm having some issues related to using the vehicle respawning module
it is broken
vehicles respawning and exploding infinitely?
oh is it?
everytime I used it in scenarios it would constantly respawn and explode vehicles
I had no idea, totally nearly ruined a mission using it
Itโs not doing that, itโs respawning correctly
it was borked by some update I reckon, unusable imo
yeah same here, eventually after battling with it to delete the wrecks it stopped spawning vehicles
Is there a way I can prevent that by maybe disabling the damage to said vehicle?
you should try running an event handler or a trigger instead
it might "work" in your case because 0,0,0 is land if I see it on your screenshot correctly
if it's water like Altis or Stratis the vehicles will be destroyed, get respawned again and eventually just start flying, really really borked
unscheduled is always uninterrupted, the whole point is to have the same behavior for a critical section in the scheduled environment
Would something like this work
// Vehicle Respawn Script
// Place this code in the vehicle's init field or in a trigger
_vehicle = _this select 0; // Get the vehicle object
_respawnDelay = 300; // Respawn delay in seconds
// Save the vehicle's initial position and rotation
_initialPos = getPosATL _vehicle;
_initialDir = getDir _vehicle;
// Start the respawn loop
_respawnLoop = {
waitUntil { sleep _respawnDelay; true }; // Wait for the respawn delay
// Delete the current vehicle
deleteVehicle _vehicle;
// Create a new vehicle at the initial position and rotation
_newVehicle = createVehicle [_vehicleModel, _initialPos, [], 0, "CAN_COLLIDE"];
_newVehicle setDir _initialDir;
// Assign any desired attributes to the new vehicle, such as loadouts, crew, etc.
// Start the respawn loop again for the new vehicle
_vehicle = _newVehicle;
call _respawnLoop;
};
// Start the initial respawn loop
call _respawnLoop;
I don't get it. You only have a time delay on respawn? Nothing about the status of the previous vehicle?
The module was set to delete the wreck after 250 seconds
So the wreck would be deleted and the new one would spawn
and networked effects would obviously require more complex synchronization i'm not thinking about that
Are you trying to replace the module or fix it?
nice one! thnx! ๐
Iโm wanting to fix it, but if I need to replace it I can
It only matters that the vehicle can respawn, and has the marker attached
Ok, isn't the point to respawn the vehicle when it's destroyed?
You have nothing in your code that detects whether or when the vehicle is destroyed.
okay, so with ACE virtual arsenal config, easy enough to follow along how that is arrayed.
analog to that, BIS, I gather not as discriminating? i.e.
// _type:
// 0: generally 'items'
// 1: 'weapons'
// 2: 'magazines'
// 3: 'backpacks'
private _cargo = _object getvariable ["bis_addVirtualWeaponCargo_cargo",[[],[],[],[]]];
// ^^ ^^ ^^ ^^
private _cargoArray = _cargo select _type;
is that accurate?
@pliant stream My point was that unscheduled is only 1/3rd of the necessary requirements to get a real benefit in most'interesting' cases where a player would notice it if an if/else branch was taken on 'stale' condition data.
Thatโs cause I have the module right now.
The code I have isnโt being used yet
Iโve been using the module and itโs broken apparently
Have you tried writing your critical bit in sqs? iirc that's always executed uninterrupted
yeah and as i said i'm not thinking about networked state here
and no i haven't looked into sqs, but i guess i should check it out
can I get an object by its variable name set in editor via
missionNamespace getVariable ["vehicle_var", objNull];
```?
and also would isNil find that vehicle isNil "vehicle_var"?
by contrast the ACE buckets already pretty much there and organized, correct? i.e. "ace_arsenal_virtualItems", whereas "bis_addVirtualWeaponCargo_cargo", not so much, or with additional post-processing.
Oh, interesting alternative to writing it all in sqs (which, apaprently, sucks pretty hard). KillzoneKid suggests having an *.sqs script that only does a single thing
_this call someFunctionWrittenInSQF
@boreal parcel Uh, yes? You can think of object variable names as doing vehicle_var = this in the init box.
More interesting questions are like whether they're updated to track new units on respawn.
huh
alright thanks, and yeah thankfully in the scenario im using it in I dont need to worry about respawn
I'm not sure though if the engine complains when you try and call sqs stuff from the scheduled environment
so exec is like call but for SQS?
That's a question for the real old-timers in here. I only know sqs as "ye olde language"
is there a command like entities that also retrieves empty/crewed vehicles?
a command that retrieves units, vehicles, projectiles (and flares) would be ideal for me
i'll try it out thanks
vehicles are entities, aren't they?
Not sure what the best command is for projectiles. Maybe some variant of allObjects
vehicles select { crew _x isEqualTo [] };
```?
if that pans out it would allow for a generic implementation of synchronous code blocks
gonna assume this is accurate, running with this in mind... but if someone has any insights I am missing, please do chime in ๐ ... thanks...
something i've been searching for a while
exec is for .sqs, what execVM is for .sqf
right thats what i'd thought as well
we need more goto's
you probably want to avoid using .sqs
Is initPlayerLocal called before or after you actually spawn in as your unit?
i dont know arma's inside but it might fire up a separate parser / lexicon / whatever programming term it is
yeah i only would have used it if exec was blocking and allowed me to call an sqf script passed to it
use execVM for .sqf?
B4
no that doesn't help me
i want to run a piece of code synchronously in the scheduled environment
i can already run multiple atomic statements synchronously but not branch
Is there any reliable way to execute a script only after someone has spawned in?
and it's taking longer than 3ms?
From my understanding exec will spawn a new thread. This new thread might have to wait until it is executed but when its turn comes up, it will execute without interruptions.
any reason the deactivation would fire shortly after trigger activation even though the player never leaves the trigger area? it does it over and over again, activates and deactivates
// Create trigger
_trigger = createTrigger["EmptyDetector", getMarkerPos _x, true];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerArea [TRA_milActivationRadius, TRA_milActivationRadius, 0, true];
// Set Trigger Statements
_trigger setTriggerStatements
[
format["this && (thisTrigger getVariable ['%1%2', false] isEqualTo false) && (TRA_zonesActive < TRA_maxZonesActive) && (TRA_activeAi < TRA_maxAiActive)", _x, '_active'],
format["[thisTrigger, %1] spawn TRA_fnc_spawnMilitary;", str _x],
format["[thisTrigger, %1] spawn TRA_fnc_deactivateZone;", str _x]
];
no most likely not but what if the statements before it take 2.99ms ;D
and yeah it's probably unlikely but hey i like correctness
you might reach 3ms by using all your workarounds for correctness ;)
but if my code works it doesn't matter if my script runs 17ms when it never gets interrupted
something wrong with your variables. or maybe the spawnMilitary function that you spawn does something wrong
also is _x a string?
yeah im not entirely sure why I had to str it, I remember I was getting issues before though. Ill look into that later
my spawnMilitary is basically 3 spawned for loops that use createUnit and it also sets two variables on the trigger itself
also it's not like i'm writing huge critical sections, more like 3 simple statements
Is the alternative syntax for "assignedItems" deprecated? I tried to use it and got a syntax error:
assignedItems [player, false, false]; // Error Assigneditems: Type Array, Expected Object
I do need some clarification... by discriminating I mean, the BIS "items" element generally contains all the bits other than mags, weaps, etc, i.e. your 'headgear', 'facewear', or even weapon attachments, sights, muzzles, and so forth... ?
ohhhhhh i see. thank you for pointing that out
onPlayerRespawn.sqf
Without having them respawn on start, is my thing
Basically there's an OnPlayerRespawn script already
and I'm wondering how to mirror the radio code I have to the same slots without them respawning
it had to be a string. otherwise it would be wrong. I was just making sure
you might wanna avoid spawning so many stuff... 
it also sets two variables on the trigger itself
that's the point
if those setVariables are related to the trigger activation code then it makes sense that it deactivates
There's a reason it was depreciated O_O
in description.ext set respawnOnStart = 0; that will run onPlayerRespawn.sqf when player first spawns/joins
but only
Available only for INSTANT and BASE respawn types.
if you use something else, then you might as well use postInit and waitUntil player is alive
if you have any examples of this you can link to I'd love it, but if they're not handy / easy I'll just look it up myself
illegal to spend effort on my laziness
examples for?
the postInit/waitUntil method for doing something
like I mean if you literally already have something lying around, otherwise I'll just go figure it out later
postInit is defined inside function class in cfgFunction,
But you could also do something like init.sqf
[] spawn
{
waitUntil{alive player};
//player is now alive, but might not have his screen game screen yet
};
will this fire once or on respawn as well
once
hmm ahhh there's the issue. I was setting _trigger setVariable [format["%1%2", _marker, "_active"], true]; so it didnt activate again. Ill just do a check for that variable inside of the spawnMilitary script instead of the trigger condition
What is the simplest way to interact with a dialog? I made one called TruckDialog, I init it using createDialog;
private _userDialog = createDialog "TruckDialog";
the dialog id is 3000, and the button id is 3002
how can i make it so when a button is pressed, some code is executed?
Is there any way to show/hide proxies on a characters uniform model?
^could this be done through animations?
My end goal is to be able to show and hide them via script
Hey! I'm looking for a script that could create a circle of fire/smoke around an area. I know very little about particle emiters but I have some basic knowledge about SQF. If you have a quick implementation idea I could orient myself with, that'd be of great help!
-Found Emitter 3Ditor thanks!
I'm having issues with making my script here work.
I'm working on a fork of ZEI (code is https://github.com/hbjydev/lrpgzei)
My RPT is here: https://sqfbin.com/igonupatuxagohomisom
I'm trying to add a new template, same format as the existing ones, but I keep hitting Trying to create an invalid center EMPTY as seen in the RPT I linked.
I'm happy to share any specifics if need be. ๐
Is there a way to run code when a specific gun is being fired? RIght now I'm using a Fired eventhandler that exits if the passed _weapon argument does not match the gun I want, but I'm wondering if there's a way (probably with a CBA eventhandler or something in the weapon config) to add the script specifically on that gun (instead of using Fired eventhandler and exiting if wrong gun) to save frames.
I don't believe so. If there was it would probably have to be setup through the config of the weapon
i cant seem to find a link to an SQF download for NotePad ++ anyone have a link or another solution?
The Notepad++ SQF extension does appear to be dead.
Mostly people surrender to Microsoft and use VS Code.
I got VS Code life is good now. Thxs
but why?
No idea.
Long shot but, how would I go about running an init through a config eventhandler? I have tried using the animationSources entry, but they always revert as soon as I spawn the vehicle, regardless of initPhase.
this execVM 'this AnimateSource ["hide_gunnerfa_gun", 0, 0}';
This is the last ditch effort because I don't know how else to force that Source on lol
How do I whitelist a certain player to a like defined roles
I am having trouble finding the info i need to complete this script. I am trying to find the correct terminology when it comes to limiting the players view. Limiting their view for things like when they look through NVGs.
I am making the Altyn helmet usable but I want there vision to be limited when they toggle the visor down
probably making a HUD is the best option.
https://community.bistudio.com/wiki/GUI_Tutorial#HUDs
create an image of inside the helmet, and overlay that in the players view
How to script a waves attacks??
Where multiple enemies attack in waves and when you survive one wave the next starts
I have a mod that makes it so that when you have a simunition mag in, the AI only get incapacitated rather than actually getting hurt when you shoot them. I want to make it so enemies will no longer shoot at me and will just sit down and wait after they go unconscious the first time. The problem is using _x and forEach. it works fine when I put in a specific units variable name and ask it to do the script, but whenever I use forEach it says that _x is undefined. Here is the code:
_bluforGroup = createGroup blufor;
while {true} do
{
if (lifeState _x == "INCAPACITATED") then
{
hint "He's Down!";
[_x] joinSilent _bluforGroup;
_x setBehaviour "CARELESS";
while {lifeState _x == "INCAPACITATED"} do
{
sleep 1;
if (lifeState _x == "HEALTHY") then
{
hint "I'm Dead";
sleep 4;
_x action ["SitDown", _x];
};
};
};
sleep 1;
} forEach units side resistance;
- don't use while
- you are trying to use the same { } code block for while and forEach
- use a Hit or HandleDamage EH
class myClass
{
init = "\
params ['_entity'];\
if (local _entity) then {\
_entity animateSource ['myanimation', 0, 0];\
};\
";
};
Q: about JIP procedures... these happen when players join a MP server, correct?
What happens following that, i.e. during player deployment, i.e. if your mission has any concept of spawn points, respawning, etc.
If you are connecting any variables on a JIP player object, would these not be invalid by the time players (re-)spawned?
right I understand that. but there's a divide isn't there? from joining, to respawned and/or deployment, correct? i.e. in terms of the actual OBJECT that is considered to be player, per se, is there not?
IOW, we are creating an object that is subsequently assigned as the player object, IIRC.
So player joins, chooses spawn point, deploys, then a new object is created.
So anything that might have been attached to the joining object, no longer valid, correct?
respawn and deployment imply player has already joined the server. Joining in progress does everything as in normal joining with the start of a mission, except global scripts are re-executed again, like it's written in the article I linked.
I'm not sure that's what I am asking...
Mission in progress, that much is understood...
Player is joining, his object (loosely at that point) is staring out into oblivion, until the spawn point is chosen.
That is one player object.
After spawn chosen and deployed, that is a whole other object to be considered. Anything JIP that might have put variables or what not on the joining player object, cannot be relied upon. IIRC, but I am seeking clarification where that is concerned.
IOW the hidden slot objects are the object that JIP sees initially as player? The thing that ends up deploying to a given point, that is a different object than those.
yes no maybe?
my smol brain is having hard time comprehending the jibby jabby you throw at me despite my highest intentions to help you. I have no idea what do you mean by the hidden slot objects. Do you have an example of a code that you are afraid it might not consider JIP players when triggered? Is it about some scripted event that happens when players - who join with the mission start - deploy, but will not run for JIP ones?
rule is that whatever you have scripted to be run on mission start for players, it wil be re-run again every time a player joins mid-mission.
unless you store code that goes through didJIP to prevent that.
well, again, I'm not questioning the consistency that JIP runs when join happens.
my question is more to do with the slot objects. those are actual Man objects that are the things players choose going in, commander, squad lead, whatever. are you with me that far?
if by slot objects you mean playable entities that are left non-taken or AI controlled in the lobby then yes.
right okay. my question is, when players are joining, is it these objects in particular that JIP sees? i.e. if we have anything touching player in any regard during JIP.
JIP player jumps into the lobby, sees the list of playable entities part of which is already taken by players who joined with the start of the mission, the rest are "empty". JIP player takes one of these free slots and goes through the same process the earlier players had gone, including activating any globally executed scripts and whatever you have put in initPlayerLocal or similar. Units are synchronized over the network so JIP will see everything the "normal" players see and hhave seen.
fair enough, I understand that; full faith and confidence JIP will run.
player chooses point and deploys, between joining and deployment, I think we are creating a new Man object.
so anything we did to player object during JIP, forget about it, disregard...
something along those lines.
I mean if I am asking you something, you don't know what you don't know, or have not had the experience with it, fair enough...
just trying to sort out virtual arsenal, in particular ACE VA, and it is installing some JIP features involving player.
but frankly I do not think these can be depended upon.
which is one reason in previous iterations, I want to say that ACE VA was installed on actual secondary objects, arsenal box, fob building, mobile respawn, things of this nature, for a reason.
because while still JIP, the objects should be relatively static, for JIP purposes
so too their corresponding actions
anyway, I appreciate the effort, thanks, man ๐ป
Usually author moved on or doesn't have time
Quick question dose anybody know how to make object face up.
here is example code i have so far:
LEG_createRune = {
params ["_pos"];
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorUp surfaceNormal position _textureObj;
};
He has vectorUp
try setting vectorDir to surfaceNormal and control rotation with vectorUp 
I mange to get it to face up with this:
LEG_createRune = {
params ["_pos"];
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [[0,0,-1], [0,1,0]];
_textureObj setVectorUp surfaceNormal position _textureObj;
};
``` But now i have a problem when i am on a slope i want it to follow the terain and not to half be in terrain and half floating.
that's a _pos problem
How ? I get position good but the problem is that. The object is not Align with a terrain surface. Witch i am trying to move with this Line of code but it isn't aligning for some reason.
_textureObj setVectorUp surfaceNormal position _textureObj;
try this```sqf
LEG_createRune_that_should_be_a_CfgFunctions_fnc = {
params ["_pos"];
private _surfaceNormal = surfaceNormal _pos;
_pos = _pos vectorAdd _surfaceNormal;
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [[0,0,-1], [0,1,0]];
_textureObj setVectorUp _surfaceNormal;
};
Same
did you try the version after my edits?
Yep and now floats in air https://imgur.com/a/c1PGt9M
what was your goal again? I have no idea what you want to do
half-terrain + half-floating should not happen if set to follow surfaceNormal
Is there any way to generate files through SQF code? Looking to create persistent data.
no
you have to use a dll extension to eventually use SQL db
Sqlite compatible?
if an extension does that, sure
I'll see. Do you have any wiki page or anything with more info on this?
no, know that DLLs are not official and require trusting the author
I see, thanks.
not exactly, buuut the recommended one for big chunks of data (like unit saving etc)
My goal was to place it on the ground face up and to follow the terrain.
this is what i have currently
https://imgur.com/a/aPvzjTC
then the _textureObj setVectorUp _surfaceNormal; seems to not work
This is the Code that gives me this resoult:
https://imgur.com/a/aPvzjTC
LEG_createRune = {
params ["_pos"];
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [[0,0,-1], [0,1,0]];
};
and This is the code that you provided
https://imgur.com/a/c1PGt9M.
Perhaps the up dimension of UserTexture1m_F is not what you think it is.
this ^
try this perhaps (I'm poop @ 3D)
LEG_createRune = {
params ["_pos"];
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDir surfaceNormal _pos;
};
That is not it either. BTW did i mention i hate 3D rotations and directions.
with that Object is Facing Forward tilted.
If the up dimension of UserTexture1m_F is what I think it is, I believe you need _textureObj setVectorDirAndUp [_surfaceNormal, _vectorDir].
What would be _vectorDir ?
I'm not sure. I doubt that something simple like [0, 1, 0] (i.e. a vector pointing straight north) works in this case - but do try ๐คทโโ๏ธ.
maybe just vectorDir _textureObj
with this:
LEG_createRune = {
params ["_pos"];
private _surfaceNormal = surfaceNormal _pos;
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [_surfaceNormal, vectorDir _textureObj];
};
``` Its spawning face Down. Is there a way to myb not reverse but flip the numbers in array? _surfaceNormal?
LEG_createRune = {
params ["_pos"];
private _surfaceNormal = surfaceNormal _pos;
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [_surfaceNormal, [0,-1,0]];
};
eventually
_surfaceNormal vectorMultiply -1 
I mange to make it to work:
LEG_createRune = {
params ["_pos"];
private _surfaceNormal = surfaceNormal _pos;
private _surfaceNormalFlip = _surfaceNormal apply {_x * -1};
private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [_surfaceNormalFlip, vectorDir _textureObj];
};
``` ty very mutch guys.
shush, you and your 3D knowledge
all hail the mighty eventually, it hath come!
How do I check whether an object is a vehicle (like boat, plane, heli, UAV/UGV, etc...) or a man?
I hate that arma considers men and items on the grounds as vehicles
iskindof
private _isMan = _thing isKindOf "CAManBase";
i know, but i'm asking for classes that differientate men and actual vehicles
thanks, is there a class like that one for vehicles ?
they are like "Ship" "Plane" "Tank" etc
"LandVehicle", "Air", "Boat" iirc (but maybe I'm wrong)
what GC8 said etc ๐
so there is no class for every type of vehicles
!(_thing isKindOf "CAManBase")
But then you might get static objects too
I wonder why Bohemia chose to design it like this
it's not very intuitive nor logical
hmm, where did the link go?
I wasn't sure if that was correct, it seems it was but A3 has assets , thanks Lou
Because the class names are 99% of the time irrelevant
Even what Lou said isKindOf "CAManBase" is not completely foolproof
More technically a man is a "vehicle" that uses the "soldier" simulation and uses the CfgMovesMaleSdr animations
Would Ace Fortify overrule my sandbag placement script?
I did the testing of it last night, there wasnโt a single issue shown except I literally couldnโt place anything except through ace fortify
little unsure how the PositionAGL works for example with nearobjects. if the nearobjects center is on water should i pass getposASL to it? and if the nearobjects is on ground then use getposATL?
mampf Popcorn? Anyone?
IDK ACE
so it AGL
huh?
so is* AGL
still dont get it ๐
ASL above water, ATL above terrain?
right?
wait, I think we really don't understand each other ๐
lol
well i think you need to feed the nearObjects zero z when you want objects on sea level or on ground level
and it does the rest
yeah, that's what it means
afaik
0 = sea level or terrain level, depending of over sea true or false
yep
Are there any optimizing pre-processors/transpilers for sqf? I.e. anything that could auto-inline functions?
macros FTW :)
Do anybody know how to script wave attacks?
Just use ASLtoAGL
that will also check if pos on water/ground ?
Yes. It just converts the ASL pos to AGL pos
cool

