#arma3_scripting
1 messages Β· Page 87 of 1
Now the problem is that Unit dies but LEG_doctorHealth variable still shows like 30 or 40
_doctor addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
_unit setVariable ["LEG_doctorHealth",((1 - damage _unit) * 100)];
private _currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
private _takenDmg = _damage - _currentDmg;
_currentDmg + _takenDmg / 5;
hintSilent format ["Current DMG: %1 \n Taken DMG: %2 \n Var DMG: %3",_currentDmg,_takenDmg,_unit getVariable "LEG_doctorHealth"];
}];
Well, you're saving the variable based on damage _unit before the new damage is applied
so it will be whatever their health was before they got hit
How would i deal with that ?
properly
what's your end goal: just displaying a life bar or still having this "4 hits dead" unit?
Well I would like to display a health bar but also i would like a variable like a number that if the number is higher the unit can take more dmg.
I didn't understand that last part
Yea so variable to control how much dmg can unit take before it dies.
Example something like this:
LEG_HardnessToKill = 10;
this addEventHandler ["",{
params ["_unit", "", "_damage", "", "", "", "", "", ""];
_damage = _damage / LEG_HardnessToKill;
}];
so you want a damage ratio modifier, ok
there is no "health bar" in Arma - you can die with 0.5 total damage for example
you can trick it with "if not alive then health = 0" but that doesn't make the life bar linear like any other game.
untested
this setVariable ["LEG_DamageRatio", 0.5]; // half the damage
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage"];
if (isNil { _unit getVariable "LEG_Damages" }) then { _unit setVariable ["LEG_Damages", createHashMap]; };
private _damageHashMap = _unit getVariable "LEG_Damages";
private _selectionDamage = _damageHashMap getOrDefault [_selection, 0, true];
private _ratio = _unit getVariable ["LEG_DamageRatio", 1];
if (_ratio != 1 && _selectionDamage < _damage) then
{
private _damageDiff = _damage - _selectionDamage;
_damageDiff = _damageDiff * _ratio;
_damage = _selectionDamage + _damageDiff;
};
_damageHashMap set [_selection, _damage];
_damage;
}];
if (_ratio != 1) This in code was it supose to exit or ?
fixed
I don't know how to thank you enough. You gave me a grate idea. I made a bit more linear way for health bar to go down and also a way to Control Damage ratio modifier. Instead of getting dmg directly from a unit i can count a number of times unit got hit and base of that i can have linear and consistant way of control.
Code:
LEG_DoctorHitPoints = 100;
_doctor addMPEventHandler ["MPHit",{
params ["_unit", "_source", "_damage", "_instigator"];
private _hits = _unit getVariable ["LEG_targetHit",0];
_hits = _hits + 1;
_unit setVariable ["LEG_targetHit",_hits];
private _dmg = (_hits / LEG_DoctorHitPoints) * 100;
private _health = 100 - _dmg;
_unit setVariable ["LEG_health",_health];
hintSilent format ["Total HitPoints: %1 \n Num Hits: %2 \n How mutch Damage: %3 \n Current Health: %4 %",LEG_DoctorHitPoints,_hits,_dmg,_health];
}];
_doctor addEventHandler ["HandleDamage",{
params ["_unit"];
if((_unit getVariable "LEG_health") isEqualTo 0) then {1}else {0};
}];```
Hello scripters!
I come with a question!
Is it possible to call a faction from a mod at the server, or mission file, level that duplicates the faction to appear on a different side inside the zeus console without using custom units in something like ZEN?
Looking to make a blufor faction also spawnable as opfor without having to jump through hoops to spawn items for zeuses that may not be as technically skilled.
Is this a question better asked to config makers instead?
config only.
thank you! π
do anyone have a script that makes ai fire and maneuvor or peel or flank whatever you wanna call it
Is there an example somewhere on how to use the Arma 3 apex campaign lobby?
new to scripting every time i paste something into the init of units i get the init: error thingy can anyone help? if so ping me
you will need to bring the error in
Hey there
Im attempting to patch a mod to allow a weapon to be put into the launcher slot instead of the rifle slot
I think I have made the CPP file correctly but I dont seem to be able to binarise it
Can anyone help?
Just to clarify Im trying to make the patch an independent mod
Your class inheritance looks fucked up to the extent that I'm not sure what you're trying to do.
The intention is just to modify rhs_weap_m32_Base_F?
Classic
Thats what I get for copying some code and adapting it
Im trying to change the weapon type from 1 to 4
and yeah thats what Im trying to modify
#arma3_config plox
Sweet my bad I shall move this there
Thanks
probably because you don't remove the comments
that is true and im a f*cking Ret@rd
thankyou good sir for pointing out what would be obvious to anyone who get enough sleep π
so the code im trying to excecute is this:
_squadLeader = leader group player;
_flankWaypoint1 = [getPos player, 100, 0] call BIS_fnc_findSafePos;
_flankWaypoint2 = [getPos player, 200, 0] call BIS_fnc_findSafePos;
_flankingBehavior = {
params ["_unit"];
_smokePosition = getPosATL _unit;
_smokePosition set [2, 5]; // Adjust the height of smoke grenades if needed
_unit addMagazine "SmokeShell";
_unit addMagazine "SmokeShell";
_unit throw [_smokePosition, "SmokeShell", 2];
_unit groupChat "Moving to flank!";
_unit setCurrentWaypoint [_flankWaypoint1, 0];
sleep 5;
_unit setCurrentWaypoint [_flankWaypoint2, 0];
};
_trigger = createTrigger ["EmptyDetector", [0, 0, 0], false];
_trigger setTriggerArea [200, 200, 0, false];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerStatements ["this", "call _flankingBehavior", ""];
_squadLeader addRadioItem ["Flank on Contact", {
_trigger execVM "flankScript.sqf";
hint "Flanking script executed!";
}];
from chat gbt it is props broken but i should atleast get the: hint "Flanking script executed!"; if its activated corretly so i could rule out wrongfull activation
so according to chat gbt im suppost to post this message: execVM "flankScript.sqf" in the ordinarry chat cinda like if you login as admin
but nothing happend
now i get an error where it says there was an error at line 21
please use https://sqfbin.com/
also
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
!quote 6
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
fair
yeah as i stated way earlier im like just started to even explore the possebilites of scripting so i essentially have no idea what im doing
lol:
_unit throw [_smokePosition, "SmokeShell", 2];
Unfortunately neither does ChatGPT.
The code it's generated here is structurally deeply flawed, contains commands that don't exist, and does many things that don't make any sense. It's not really a useful starting point - it needs to be completely redone.
I don't know exactly what you're trying to do here, but you could begin by going to the wiki and looking up every command ChatGPT tried to use here and seeing how they actually work (the ones that exist anyway). That might give you some initial clues.
i wanna see a squad taking contact 1 part of the squad is laying still in their start positions and another part is running like 100 meters to either side
essentially very basic peeling if you are familiar with that term
Controlling individual AI behaviour, especially in combat, is one of the more complex...and annoying...aspects of Arma scripting. It's typically handled, in the rare cases it is handled, by mods made by teams of experienced authors. I would not recommend it for your first script.
Even the "throw a smoke grenade at a position" part is extremely complex in Arma.
I figured with addRadioItem personally π it's late
okay i guess i have not encountered any ai mods that does this despite looking all over for them what i have tried:
vcom
lambs
dco
bcombat
asr ai
tcl also the newer revork whatever its called
immersive ai
cant find anything that remotely does what im looking for
That may be because it's extremely difficult and potentially even impossible to make work reliably
goddamit arma
That one sounds plausible but fiddly.
AI mods tend to go for sticking a black box on top of the black box rather than providing features for users.
which kinda makes sense given the lack of structure.
I think lambs does add a waypoint type or two.
sog AI has peeling but it's for your own squad I believe.
narh so lambs is very go in a straight line and pray to god you dont get shot approach
It's a reaction to vanilla AI being... overly defensive but not actually good at using cover.
but yeah, you don't get a lot of input. Add AI mod, all behaviour changes to the mod author's preferences.
the closest i got was dco but it essentially was max like 20 meter flank witch really dosent matter when you engage from 200-500 meters out on average
Vanilla AI has its own logic which splits off units to engage contacts, so you'd need to eliminate that first.
Using fired eh is there anyway to get the last position of the projectile or should I just get it's position when it's velocity is 0?
use the fired EH to get the projectile, and add an EH on it
i see thank you lou
boo
Mmm, the best rants are the ones where people have a totally incorrect understanding of the relationship between BIS/BISim and Arma/VBS. Never fails to entertain.
Is there a non pc crashing way to edit the height of all terrain nodes on the map?
I tried chunking it out and using 'spawn' to put the chunks in the scheduler but it still was gory
No
Hey there, anyone have any codesnippets to make an ai man lean?
no
I am talking about the upper-body lean that happens when pressing q or e?
yep - no
https://community.bistudio.com/wiki/playAction for other things than that
Hi can anyone help me with scripting the arma 3 spotter like in arma 2 OA that the spotter will said the distance of the enemy
@daring zinc I will never listen to you. You're just pushing your MACRO-ist agenda. ;)
[I love how this channel is 50% really in-depth discussion about SQF and 50% random rants]
yeah in arma 2 OA there is a mission that you are a sniper and you have a spotter and then when you hold right click on enemy the spotter will say the distance so you can adjust your zeroing
i think the spotter AI in arma 3 is broken or useless
That is not an AI, just a script
yeah the FNC_spotter but i think it is not working on current arma 3 :/
why?
i've tried that before and it doesnt work compared on arma 2.
what have you tried, what code and where?
[player, unitSpotter] call BIS_fnc_spotter;
that code i've binded it on my player init
and it doesnt work on arma 3
cool, did you name a unit unitSpotter?
i will try it again today
irenamed the object name of spotter and ive changed that unitSpotter
I don't call it is βit doesn't workβ, it is a crash. Because it requires spawn, due to while and sleep ez fix
But anyways, it is legacy function indeed
yep, no workies
I would say it is better to rewrite for A3, since it has a lot more advanced commands
yeah i've read that one on the articles on Bohemia forum.
Didnt that function just print "Unit name: Range x m"
Measured from player. So basically just textified range finder
the spotter actually said distances in A2OA
private _fnc_spotter = {
params ["_sniper","_spotter"] ;
if (group _spotter == group _sniper) then {
[_spotter] joinSilent grpNull ; // force degroup
} ;
// keep the spotter silent
_spotter setUnitCombatMode "BLUE" ;
_spotter setBehaviour "STEALTH";
(group _sniper) setVariable ["spotter",_spotter] ;
(group _sniper) setVariable ["sniper",_sniper] ;
(group _sniper) addEventHandler ["KnowsAboutChanged", {
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"] ;
// if is enemy and you know where he is
if (_newKnowsAbout == 4 and [side _group,side _targetUnit] call BIS_fnc_sideIsEnemy) then {
private _spotter = _group getVariable ["spotter",objNull] ;
private _sniper = _group getVariable ["sniper",objNull] ;
private _targetName = getText (configOf _targetUnit >> "displayName") ;
// report
_spotter globalChat format [
"%1 - bearing %2 - distance %3 m",
_targetName,
round (_sniper getRelDir _targetUnit),
(round ((_sniper distance _targetUnit)/10)*10) // 10 m precision
] ;
} ;
}];
} ;
// execution
[player,unitSpotter] call _fnc_spotter ;```Quick mockup. Lovely to execute this in unscheduled
Yes in a mission where you had to shoot out the supports for scud missile.
What's the role of the spotter here?! π
You can spot enemies yourself 
I know but did that also just use the knowsAbout?
I dont remember exactly. Its been years. But i think you could range anything. So basically distance from eye position to cursor
(I could be wrong)
kb conversations speech where :p
"Lovely weather innit bruv?"
"they say it's gonna stay like this for a while"
these things are like burnt in my memory, halp
Not happened yets
I don't think the vast majority of people would enjoy VBS, even if it were <$100. It has different design goals. It would be an even more niche market.
Hopefully someone can tell me where i'm going wrong here.
I'm spawning a group of men (section) and a vehicle with crew.
When they spawn I'm using the below to tell them to start patrolling in the area
// Section
[_grp, _townLoc, 700] call BIS_fnc_taskPatrol;
// Vehicle
[group _vehicle, _townLoc, 500] call BIS_fnc_taskPatrol;
For some reason I'm missing, this works for the Section, but the vehicle doesn't get any move orders assigned
for example
_vehicle defined?
Yes it's defined, otherwise it wouldn't spawn at all
Good iea
i think it does if the vehicle is somehow first assigned to the group
in this case it sounds like its not
No dice on tyhis
Have a look at BIS_fnc_taskPatrol in the Functions Viewer and see if it has anything that might block it if a vehicle is involved. It might not support them properly and decide to exit instead of even trying.
I'm dubious of this because if it did, there would have been no need to add assignedGroup
hint format ["Debug: %1 %2", _vehicle, group _vehicle];
``` debug check
dunno i recall using group on vehices
it works on editor placed vehicles, just tested
15:42:57 "Debug: vehicle_10 <NULL-group>"
Yeah so it doesn't register the group.
_vehicle is empty?
No I got it
The driver is spawning outside the vehicle to start with then getting in
which is why the group is null whne checking
Right thanks for rubber ducking chaps π
Ask the server to give it to you
There is a script command that lists all players info
Maybe the cid is in there?
But that command might be server only,and i forgot the name
Can't set variable public param also take object?
Remote exec can take object as target i think
You can remoteExec the setvariable π
Ask server for cid if you do it more than a dozen times
RE is slightly less efficient. And object passing might fail if other player dies and respawns
Yeah sending reply back is annoying
That's why that userInfo command thing. Check if that's maybe available on clients
That would be best solution if it's avail
remoteExecCall ["giveMePlayerList", 2]; // In client
giveMePlayerList = // In server
{
[plr1,plr2,plr3] remoteExecCall ["HereYouGo", client];
};
HereYouGo = // In client
{
params ["_plrListFromServer"];
};
``` Something like that π
PSA: Small update of Poseidon Tools (0.91.2):
https://forums.bistudio.com/topic/155514-poseidon-advanced-text-editor-for-scripts-configs/?p=2935109
Page 16 of 16 - Poseidon: advanced text editor for Scripts & Configs - posted in ARMA 3 - COMMUNITY MADE UTILITIES:
i have a question. ive been using poseidon for awhile now no issues but i put a new windows on a new hdd, got everything working, poseidon is installed, yet it only runs if i open it. i cant open it by double clicking an SQF file anymore, it gives me an unspecified error. poseidon error: file path is what it looks like. i can access my SQFs manually if i open poseidon f...
If you're using this a lot for some reason then you might want to setVariable the owner IDs on the player objects.
Q: about structured text, it seems that the descriptionShort configuration for some classes has embedded i.e. "<br />", assuming that is intended for structured text. I'm not sure how consistent that is, number one; or whether there would be other structured elements. That being said, I wonder if we can reliable interpret that for use with a TOOLTIP (?).
wiki says \n is for tooltip new line https://community.bistudio.com/wiki/ctrlSetTooltip
yep I see that now... doing some string replacement gymnastics to achieve the desired effect. don't hate the result, seems to be working well.
Could be a stupid question but... is there any advantage of using remoteExec on hint instead of calling it for each player?
would say 'it depends' on your scenario. I have a use case, for instance, in which I hint remotely to 'managers' when they have dialogs open. in order to signal certain conditions being met during the course of the dialog lifetime.
Oh, so you kinda need the sync part of remotexec in your case then?
not sure what you mean sync part. I am usually targeting specific players in these scenarios, so there is nothing scheduled or JIP in that case.
My case is pretty basic - displaying dialogs via hints and adding some sound with playSound on top of that.
depends on the dialog really. for most things like button presses, there is already sound. that's usually sufficient. the hint is the server to client feedback how the action was resolved.
anywho good luck good hunting.
Gotcha, thanks
How else would you be calling it for each player?
No. hint only has local effect.
and on server with 70 players it would just show the hint only to you (but 70 times) 
"text" remoteExec ["hint", 0, false];```This will do the trick
I think it's owner _player something like that when you want to target a client machine. only works on the server (2), however. in those scenarios I described in which only the manager(s) needs to see the hint.
of course 0 for ALL clients, but this may not be appropriate in your scenario. again, file under 'it depends'.
how is the array that the "crew" command returns sorted? is it in the same order as how they entered the vehicle?
looks like i have to keep record of it in my own variable
I think it's in seat type order.
Anyone out there have any advice for the best way performance wise to set up functions? Like fnc_myFunc = compile preprocessFileLineNumbers "fnc\myFunc.sqf"; vs cfgFunctions or any other better way performance wise?
CfgFunctions is a wiser choice, you will find additional information here: https://community.bistudio.com/wiki/Functions_Library_2.0
@icy herald What's your timezone? Because if I'm not mistaken it's not exactly standard business hours at BI headquarters ;)
Well, joker.... π
Awesome thanks for the tip, this discord server is an incredible resource.
how do I edit arsenal restrictions for BluFor and OpFor for a warlords mission?
can you guys help me find a script that does when the group hears gunfire they will presue them im not really a fan of ai mods due to the exsessive preformance loss and breaking waypoints and sometimes buggy ai
they will presue them
you need a time-travelling lawyers mod
excellent joke aside, you can use the "FiredNear" event handler (it checks up to 70m distance) to then issue a move command to the group
is there a way to check for more than 70m? you can hear gunfire about 800 meters out just saying
now do you really want all AI in a 800m radius converging to only one point
no like only 100 meters but it was a example
then use the "FiredMan" EH on whatever unit should be tracked and grab all groups in a 100m radius
thankyou
Has any of you used this? https://forums.bohemia.net/forums/topic/229503-release-grid-caching-system-gcs/
This works flawlessly on my local machine but upon upload to a dedi, nothing happens. Literally nothing
is there some sort of trick im missing for testing in MP surrounding lobbies/game ends or is it just a huge pain in the ass for testing? i.e restarting the mission, updating server mod, etc
filepatching - symbolic links
good tools
with filePatching you can skip the updating servermod part. or rather you can do it without repack/restart
if you want to test game ending, you probably are ending the mission so you need to restart it anyway
How do I skip updating the server mod part of that? 
with filepatching you can have the server mod files unpacked in arma dir
It's so nice for finding niche stuff that's undocumented.
I just create symbolic link from my mod folder to arma 3 root folder
Just started, but it's my goto resource for overly specific problems where their solutions often only come from experience and is relatively obscure in documentation.
I am suspicious... I ran my code and it worked first time... hmmmm
Is there a way to remove friction between the player and the ground, or at least keep some of the player's horizontal velocity while in the air once he hits the ground?
delete and rewrite everything, just in case π
no
shame, thanks anyways
Whats the difference between CfgFunctions and compile preprocess...?
automatization, standardization, finalization (although that can be achieved by compileFinal) 
CfgFunctions does compile preprocess... for you
Lmao. So I'm building a framework for my unit. I assume the standard practice would be to run initialization code through compile pre...?
no
What are you trying to do
What do you mean by initialization code
What I understand as initialization code is preInit, and.. you don't run that through compile... Usually.. I don't know what you're trying to do there
Initialize radios, loadouts, and a few other things.
that doesn't explain things
You want to create script functions?
So that you can call them
is there a reason why you do not want to use CfgFunctions?
No. Im trying to learn best practice.
What would the use case for compile pre... be?
CfgFunctions it is
none but testing
Questions answered. Thank yall
Im having a little trouble with unitplay. So i'm trying to make a helicopter crashlanding. But the moment i apply the damage via the script the unitplay just stops, and the helicopter falls out of the sky.
if i dont apply the damage, it goes on as normal and does the crashlanding
as soon as the vehicle cannot move, the script stops yes.
ignore the fool of a took that messed up the syntax on unitplay
it still ran, but ignored the true i gave in for stateIgnore
hehehe
I even forgot it had this param!
Man selectBestPlaces is doing my head in. How can i make it show sources on the edge of a city or the edge of a tree line? I thought if i do half houses and half meadows it might work but ti's all over the place.
No, it doesn't do that.
What do you mean. It seems perfect for that.
I can get hills so that vehicles actually can go to overwatch positions
I guess it depends whether a single position can have non-zero values for both "houses" and "meadow" for example.
you could test with getAllEnvSoundControllers
ooooh i have seen that pass
Is there a way to instantly skip time / black out the sky
but not sure what that is
So i can get my formula from that?
@molten yacht skiptime?
You can test whether it's possible to do what you want.
If a position at the edge of a city has houses 0.5 and meadows 0.5 then it's possible.
skipTime will have weather calculation hiccup, setDate will just set the date/time without further considerations
oh ffs, simple expressions don't support powers. Maybe impossible anyway then.
unless you can fudge it with envelope
So nobody has any real expierence with selectBestPlaces as a waypoint selector?
"as a waypoint selector"?
To give purpose to you waypoints instead of them being random
you will need to provide context here
a waypoint is not "random", it goes where you place it
(whether the AI goes where you place the waypoint is different :U)
that's another story π
as in, it'll keep the weather and such?
yup
cool, thanks
that's actually ideal
Do you need to unassign an item from a unit before removing it from the inventory?
You do need to unassign to remove something that's in an equipment slot
I'm guessing removeItem only looks at your cargo spaces, and things in your equipment slots aren't technically in your cargo spaces
noted, thanks
How can I pause a key frame animation when it reaches the end?
I'm working with moving a script I've been working on to a dedicated server and I'm having some trouble with locality. I've trimmed all my code down to obviously just the code I'm working with and it's working until the local part. It displays the "Running code for all players" part meaning the code is firing but I haven't been able to get the local code to run or at least it doesn't show being run cause the extra code I have in that section is placing markers on the map which works fine in SP but not in this MP environment. Anyone got a clue on what I'm doing wrong?
initServer.sqf
WAG_fnc_deployLootGenerationSystem = compileFinal preprocessFileLineNumbers "Functions\deployLootGenerationSystem.sqf";
[] spawn WAG_fnc_deployLootGenerationSystem;
deployLootGenerationSystem.sqf
while {true} do {
"Running code for all players" remoteExec ["hint",0,true];
// Trying to run code locally for player here
{
hint "Running local code for player";
systemChat "Running local code for player";
} remoteExec ["spawn", 0];
sleep LOOT_GENERATION_CHECK_TIME;
};
Been working on this for hours and still no clue on what to do
spawn takes two arguments
found it?
no :(
hint: 0 spawn {}
yeah but I'm trying to find the documentation saying how to pass a variable for remoteExec with the code and failing atm
{} remoteExec ["spawn", 0]; // wrong
[42, {}] remoteExec ["spawn"]; // correct
oh
When a player is looking thought a weapon scope, can i run a comand to change his view to default and not scoped view?

yes
switchCamera
Thanks.
I have a problem with attachTo .. i'm attaching a player to an object and i need to rotate the player. When attaching the player to an object that i spawned by my self i can rotate the player with setVectorDirAndUp but if the object was spawned by the mission its not working. Even if i execute setVectorDirAndUp server side. Am i doing anything wrong or am i missing something?
thx for the help
is there any way to secretly kill the engine while making it look fine
on a car
hmm maybe I can just use the engine event handler to turn it off a second after it turns on?
you can destroy it (will appear red in the UI)
you can set fuel to zero
maybe you can drown it, but IDK if it shows on the UI
I'm so confused...
This works just fine with sending my player on a dedicated server to the debug corner but...
[0,{
player setPos [0,0,0];
}] remoteExec ["spawn"];
...for some reason this is too much to ask for and returns an empty array :/
[0,{
_buildings = nearestObjects [player, ["house"], LOOT_GENERATION_CHECK_DISTANCE];
hint str _buildings; // Returns: []
}] remoteExec ["spawn"];
maybe you can drown it, but IDK if it shows on the UI
it does
dang it
BI, always ruining things
again, you are only sending one argument to spawn
also, , 0 is not needed
oh sorry I typed that out wrong it does have the second arg
and is LOOT_GENERATION_CHECK_DISTANCE defined there?
It should be as I define it in initServer.sqf just like the LOOT_GENERATION_CHECK_TIME in the code from earlier but I'll double check
I think this will work, more or less.... sqf (needs params); if (!(_this getVariable "activeEMP")) then { _this setVariable["activeEMP",true,true] // can set to false later _this addEventHandler ["Engine", {if((_this select 1)&&(_this activeEMP)) then { _this engineOn false; };}]; }; else { _this setVariable["activeEMP",false,true] }
"If you're not marked as EMPed, mark you as EMPed and add an event handler. If you are marked as EMPed, unmark you."
oh wait... that would define it for the server not the client 
ta-daaa
you can still pass it as an argument
may error as variable may be nil
getVariable with false as default variable instead
and will somewhat error anyway ; else
both of these can either be run completely on the server or completely locally as a remote executed function. You should really try to refrain from spawning raw code across the network like that.
yeah I actually looked at it in vs code and now I have ```sqf
params ["_this"];
if (!(_this getVariable ["activeEMP",false])) then {
_this setVariable["activeEMP",true,true]; // can set to false later
_this addEventHandler ["Engine", {if((_this select 1) && (_this getVariable ["activeEMP",false])) then { _this engineOn false; };}]; }
else { _this setVariable["activeEMP",false,true] }
I hope this code is not repeatable otherwise you may end up with multiple EHs
yeah, nah
it's not
I was thinking about how to make it so
pondering how I would get driver _this and send a hint to only them
"The engine sputters and won't start."
yeah and that would probably be easier too 
Q: it is valid to include these such as they are?
#include "\a3\ui_f\hpp\definedikcodes.inc"
no you might get pregnant
its fine
what did I just say
so many ways I could go with that one, but I digress π
I didn't even link it with DIK code indeed π
ah okay I see what you did there π
no joke, I didn't connect the dots myself π
Is there ANY mp friendly way to setScale on, say, a User Texture object?
I need to black out the sky in one area :P
What I use to do that is BIS_fnc_replaceWithSimpleObject and then setscale on the returned object. It should work fine as it has for me but if you use it on like +50 objects some may not scale up. As for it wokring with a custom texture I have no clue
if(isServer)then{
_tank = [tank] call BIS_fnc_replaceWithSimpleObject;
_tank setObjectScale 100;
};
If I remember correctly that's how I do it
heyo, i'm looking for some help in making a script in which a guy drops into an area (WWII) and has a small chance of loosing his equipment as a result of his drop. I've been hunting for something like this, but i can't find anything
create local versions
using createSimpleObject (set the local bool to true)
how much of it do you have figured out right now?
That no one has made a script for it. i'm not the best at writing scripts from scratch so i have to hunt for them, but so far i haven't found any at all in the last several hours that i've been searching
... 
well how does the "dropping" work? at the start of the mission? using an action?
so when a paratrooper lands on the ground, there could be a trigger that would run that said that there was a change his rifle, ammo, medical, or rations could be lost.
not sure really how to structure it but it would be a thing where i'd have to have all the class names for it
hell could even have either the backpack, vest, and helmet is lost
idk
well right now I'm asking how does "a paratrooper lands on the ground" even get started
like have you put some units in the editor and they're falling, or do you want them to paradrop from a vehicle, or do players just select some action, e.g. "Halo jump" and they click on the map, then they start paradropping?
or have you figured out this part and you only need help with the "losing equipment" part?
oh i have them jumping from a C-47. its the landing and losing the equipment part i'm stuck at.
@little raptor
ok. is the equipment lost permanently? or does it simply get dropped next to them where they land?
ahhh perm since many of the guys will be dropping into flooded fields that could be shoulder deepish
can someone confirm that the "HitPart" event is not working on local unit when bullet is fired by remote unit
there was a change note saying it was functioning but ... from my testing on DS, DS-owned units firing bullets do not trigger on local unit with hitpart event added locally
note in here https://dev.arma3.com/post/spotrep-00105
Tweaked: HitPart events now fire for remote rifle bullets (not missiles, grenades or other projectile types)
you can do something like this:
params ["_unit"];
waitUntil {getPos _unit#2 < 1};
private _loadout = getUnitLoadout;
private _weights = [-1, 2];
{
_weights append [_forEachIndex, [3,1] select (_forEachIndex in [3,4,5])];
} forEach _loadout;
private _lostIndex = selectRandomWeighted _weights;
if (_lostIndex < 0) exitWith {};
private _item = _loadout#_lostIndex;
if (_item isEqualType "") exitWith {_loadout set [_lostIndex, ""]; _unit setUnitLoadout _loadout;};
if (_item isEqualTo []) exitWith {};
_weights = [];
{
_weights append [_forEachIndex, [2,1] select (_x isEqualType [])];
} forEach _item;
private _lostSubIndex = selectRandomWeighted _weights;
private _lostSubItem = _item#_lostSubIndex;
if (_lostSubItem isEqualType []) then {_item set [_lostSubIndex, []]} else {_item set [_lostSubIndex, ""]};
_unit setUnitLoadout _loadout;
it should only run after the unit "jumps out". and it should be spawned/execVMed
i don't fully understand
params ["_unit"];
waitUntil {getPos _unit#2 < 1};
private _loadout = getUnitLoadout _unit;
private _weights = [-1, 2];
{
_weights append [_forEachIndex, [3,1] select (_forEachIndex in [3,4,5])];
} forEach _loadout;
private _lostIndex = selectRandomWeighted _weights;
if (_lostIndex < 0) exitWith {};
private _item = _loadout#_lostIndex;
if (_item isEqualType "") exitWith {_loadout set [_lostIndex, ""]; _unit setUnitLoadout _loadout;};
if (_item isEqualTo []) exitWith {};
_weights = [-1, 1];
{
_weights append [_forEachIndex, [2,1] select (_x isEqualType [])];
} forEach _item;
private _lostSubIndex = selectRandomWeighted _weights;
if (_lostSubIndex < 0 && {
_lostSubIndex = floor random count _item;
_lostIndex in [3,4,5] && {
_loadout set [_lostIndex, []];
_unit setUnitLoadout _loadout;
true
}
}) exitWith {
};
private _lostSubItem = _item#_lostSubIndex;
if (_lostSubItem isEqualType []) then {_item set [_lostSubIndex, []]} else {_item set [_lostSubIndex, ""]};
_unit setUnitLoadout _loadout;
that one also gets rid of backpacks/vests/etc.
can i put it in a trigger? or the init.sqf?
ye players will jump out of the vehicle themselves
put that script in some sqf file, let's say "loseItem.sqf" and add this in the players' inits:
this addEventHandler ["GetOutMan", {
params ["_unit"];
if (local _unit && getPos _unit#2 > 100) then {[_unit] execVM "loseItem.sqf"};
}];
hi guys, I used to use a command in the debug console to see how many opfor AI players were spawned in an Area.. I can't seem to find the command and am searchinng the www.. Would anyone here know what I could use...? cheers
units east inAreaArray trigger
or if no trigger then just units east
cheers
if you just want to know how many put count before it : count units east or count (units east inAreaArray trigger)
Brilliant! thank you
@little raptor worked a treat, thank you
@west hatch btw fixed a typo
you might want to copy it again
awsome, thank you!
btw do you want the uniform to be removed? I guess not?
ye no, just the possiblity of the equipment, weapon, items, and/or backpack
i'll give it a go tomorrow after work
thank you again!
this would suit your needs better then I guess:
params ["_unit"];
waitUntil {getPos _unit#2 < 1};
private _loadout = getUnitLoadout _unit;
private _weights = [-1, 2];
{
if (count _x == 0) then {continue;};
_weights append [_forEachIndex, ([3,1] select (_forEachIndex in [3,4,5]))];
} forEach _loadout;
private _lostIndex = selectRandomWeighted _weights;
if (isNil "_lostIndex" || {_lostIndex < 0}) exitWith {};
private _item = _loadout#_lostIndex;
if (_item isEqualType "") exitWith {_loadout set [_lostIndex, ""]; _unit setUnitLoadout _loadout;};
if (count _item == 0) exitWith {};
_weights = [];
if (_lostIndex in [3,4]) then {
_item = _item param [1, []];
};
if (_lostIndex == 5) then {_weights append [-1, 1]; _item = _item param [1, []];};
{
_weights append [_forEachIndex, [2,1] select (_x isEqualType [])];
} forEach _item;
private _lostSubIndex = selectRandomWeighted _weights;
if (_lostSubIndex < 0) exitWith {_loadout set [5, []]; _unit setUnitLoadout _loadout};
private _lostSubItem = _item#_lostSubIndex;
if (_lostSubItem isEqualType []) then {_item set [_lostSubIndex, []]} else {_item set [_lostSubIndex, ""]};
_unit setUnitLoadout _loadout;
If it is #define (which it looks to be because allcaps is the convention for it) it would work, because it gets replaced before the script runs, so the remoteExec would just send a number
https://www.youtube.com/watch?v=Oe-didKJZrU 5:24, does anyone know of the script that could do this
During the final days of Reach the last remaining regiments of UNSC marines are tasked with the defense of evacuation sites as humanity loses their grip on the planet. Watch as the members of Ignis are blasted to pieces by plasma as they "hold the line"!
If you enjoy the video consider subscribing and sticking around for the next one!
Support ...
Just setPos'ing a big object from far away?
thats setvelocitytransformation
ive got a capital ships mod finished code-wise that does a similar thing without svt so it can be flown too, just needs a bunch of config before relesse
alright i know nothing about scripting but ill try to do that stuff
Well, yeah I always forgot setVelocityTransformation since I know nothing about
is there any known bug that causes empty vehicles left on map even when you have call to deletevehicle?
"you, sir, are trying to justify a script issue you have by calling it game engine bug" π
what is your issue at hand? π
i dont know which one to hope, engine bug or my own doing
simple empty vehicles left on map, and IDK why my cleanup scripts dont deal with them (at the first place)
there used to be big problem with AI units not being deleted properly... but that should be fixed
MP?
unsure, this problem was reported to me
will need repro, or at least code involved π
yeah havent been able to repro yet
Is there an easy way to select the index of the current iteration loop?
Ie
list = [1,2,3];
{
diag_log format ["Position currently: %1", INDEX]
} foreach list;
yes for https://community.bistudio.com/wiki/forEach its _forEachIndex
how would i make it so that my own animation only plays the animation on trigger
sorry, meaning?
so ive got an animation with the timeline and rich curve
and wish for this animation to only play on a trigger so once i walk into it
if that makes sense
Do you think something running every frame, taking 0.00083 ms to run, is ok? π
I have an invincibility script but sometimes with some mods, I can still get injured. The mod has a "isInjured" function. I am wondering if doing an if check would be better done every so many frames, or if I could just do it every frame.
if it has to be each frame use EachFrame EH
yea ik
doesnt allowDamage command work then?
My issue is when I crash something, it can still damage me. Although- does that set allowDamage to true when I crash-?
Ok, I flew a helicopter into the ground and, no, b/c if it did, my script would detect damage allowed and then healed me x3
if(isDamageAllowed _x)then{
_x allowDamage false;
if(_x call ace_medical_ai_fnc_isinjured)then{
... ACE'S HEAL CODE ...
};
};
try https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage, it should handle collision damage too?
Oh huh-
I've had this for so long, idk if I wanna redo such a major portion of my code xD
right now atleast
makes sense but afaik it's not possible
oh ok
I'm kinda proud of my invincible script too heh
well the correct way to do it is using event handlers, not each frame loops (which won't necessarily work anyway)
a loop may not "see" that you took damage. EH always does
oh, there's more code to the loop. For a melee system specifically
I really doubt your code takes this long to run
The melee system would ignore the damage allowed completely, thus the script was made.
oh that's just to run "player call ace_medical_injured"
that's not even a function 
if(isDamageAllowed _x)then{
_x allowDamage false;
};
if(_x call ace_medical_ai_fnc_isinjured)then{
//... ACE'S HEAL CODE ...
};
I was wondering if I should do this instead basically
if(isNil "ratchet_InvincibleUnits")then{
ratchet_InvincibleUnits = [];
ratchet_InvincibleUnits_lastSystemTime = time;
_id = addMissionEventHandler["EachFrame",{
if(time > ratchet_InvincibleUnits_lastSystemTime)then{
ratchet_InvincibleUnits_lastSystemTime = time;
{
if(isDamageAllowed _x)then{
_x allowDamage false;
if(_x call ace_medical_ai_fnc_isinjured)then{
// ACE HEAL //
};
};
_curShield = (_x getVariable [/*melee shield thingy*/,0]);
if(typeName _curShield != "NUMBER")then{_curShield = 0;};
if(_curShield < 900)then{
_x setVariable [/*melee shield thingy*/,1000,true];
};
}forEach ratchet_InvincibleUnits;
};
}];
};```
This is the code rn, pretty much.
Ah ok, so if something does 'setDamage' then there could be an issue. Although- uh- if something did setdamage I imagine it'd either be 1 or 0 if it uses setDamage directly xD
Maybe I could make a version 2.0 that uses event handlers
did you benchmark this whole thing?
or just the bit you said?
I mean this
this
well just keep in mind that you have multiple "ratchet_InvincibleUnits". also it is only checking the if(isDamageAllowed _x)then{ bit
I'm assuming this is the actual one
so the function call is inside the if
a function call will definitely have a bigger overhead than 0.0008ms (at least on my PC)
but hopefully it will run once anyway (unless something else is messing with allowDamage)
Hey ho
I have created an arma 3 script. This is to be installed in the relevant screen called "Screen1". The problem here is that I get strange error messages (for Sleep 1; a ";" is missing) Does anyone have any ideas?
The Script:
[] spawn {
private _screen = screen1;
private _drone = vehicle player getVariable ["drone1", objNull];while {true} do {
if (!isNull _drone) then {
_drone camSetTarget _screen;
_drone camCommand "cameraEffect" params ["Internal","Back"];
_drone camPrepareTarget _screen;
_drone camCommit _screen;
}sleep 1;}
};
its for the Init in Screen1
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
don't forget a ; after while {} ;
Is there a way to load addon config settings from a .sqf / .ext file into your mission on startup?
yes with #include or execVM should work too
So I can just do and it'll apply them?
// INIT.sqf
execvm 'scripts\settings.sqf'
that depends on what you have in settings.sqf
and I think the path going to be something like execvm '\yourMod\scripts\settings.sqf'
// ACE Advanced Ballistics
force ace_advanced_ballistics_ammoTemperatureEnabled = true;
force ace_advanced_ballistics_barrelLengthInfluenceEnabled = true;
force ace_advanced_ballistics_bulletTraceEnabled = true;
i guess that works, havent see that force syntax before
Force is the override client iirc
doesn't work
It runs the SQF, but doesn't actually apply the settings
maybe you are running it at wrong time? let ACE start itself properly first
I still dont know what that "force" is, it maybe undefined macro?
It's fine, I know how to do it
You could just add a 'cba_settings.sqf' in the mission directory/PBO. CBA will pick that up automatically
Instead of changing the settings using the ingame settings menu, the mission maker can export all settings using the export funtion (described below) and paste them into the optional cba_settings.sqf file in the missions main folder. Settings that are defined using this method cannot be changed in the ingame settings menu.
see: https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System#mission-settings
What would be a good way to temporarily "disable" a vehicle?
Would stop it from moving/shooting for a given amount of time
Preferably would work for both player and ai controlled vehicles
Am I doing something dumb? I consistently crash my game when running this function:
disableSerialization;
createDialog "FRLN_orderVehicleGUI";
lbAdd [71685, "Test1"];
lbAdd [71685, "Test2"];
private _descriptionControl = (findDisplay 71684) displayCtrl 71688;
_descriptionControl ctrlSetStructuredText parseText "Test description";
Edit: I was indeed doing something dumb... I forgot that I had the dialog call this function on load -> status access violation 
Realized you could just remove the fuel and ammo for the vic
Hello
What is the correct animation to pick up?
When I pick up an item from the ground, what is that animation, what does the player do?
Spam-hinting animationState player can pick these up. otherwise logging with the AnimStateChanged EH.
Damn, you are smart. That I will do. Thanks.
Although that might be an action rather than a move so maybe it doesn't show.
I will test out
if you mean the hand grab, it's an action
see playAction + https://community.bistudio.com/wiki/playAction/actions for a list of actions
"PutDown" iirc
@stable dune β
any way to darken/tint an object
Since EXTDB3 was abandoned years ago, are there any better / usable DB extension for MySQL?
{
_x unassignItem "ItemMap";
_x removeItem "ItemMap";
_x unassignItem "ItemGPS";
_x removeItem "ItemGPS"; } forEach player in thisList
So
this is in a trigger
but that last syntax is a guess
How WOULD you write "For each unit in this list that is a player
{if (isPlayer _x) {
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";}} forEach thisList; ```
Like so?
because I'm only teleporting players and I'm stealing their shit :P
You forgot then
oh
well I'm confused
_dest = getPosATL exit3;
{ _rndDest = [_dest select 0, _dest select 1, _dest select 2];
if (isPlayer _x) then {
_x playSoundUI ["SZap", 0.8,1,true];
_x setPos _rndDest;
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";};} forEach thisList;
This gives a "missing ;"
I've tried removing or adding semicolons in places, but
it remains stubbornly so
wait nvm
bad code on the sound
ignore me
What's the point of the _dest -> _rndDest transcription? You're just copying the exact values of _dest
I'm gonna change it in a second to randomize it
but first I need to figure out
how best to playSoundUI only on players who are teleported
remoteExec with the player in question as the target
(make sure this code is only being executed on one machine)
server-side trigger
ohh, I see, remote exec's target could be _x
thanks!
["SZap", 0.8,1,true] remoteExec ["playSoundUI",_x]; I think??
You need double [] on the argument.
With only one set, remoteExec will think you're sending an array of separate arguments, like you would for a binary (arg1 command arg2) command, and get confused
Expansion:
[arg1,arg1,arg3???] is how remoteExec sees this. PlaySoundUI is an unary command - it only has one argument and that argument is an array. So you need to show remoteExec that the actual structure you're sending is [arg1]
I see. Thanks!
Random question, but can anybody think of how I could set up an Event Handler so that an addAction gets added to a TFAR SATCOM Antenna from TFAR every time it gets deployed? (ref to it here: https://www.fkgaming.eu/guides/fng-guides/fng-arma-guides/beginners-guide-tfar-r22/#satcom)
If you're not familiar with it, it gets deployed via Ace Self-Interaction. I think an EH makes sense, because the idea is that the antenna would get picked up/deployed many times by my player, and I want it to have the addAction each time. I originally thought that a "WeaponAssembled" EH might work, but the SATCOM antenna is obviously not a static weapon...
Table of Contents 1. Introduction 2. General Key Binds 3. General Radio Details 4. BLUFOR Radios 4a. Rifleman Short Range 4b. Personal Short Range 4c. Long Range 5. Rebinding the "Ping Key" 6. REDFOR Radios 6a. Rifleman Short Range 6b. Personal Short Range 6c. Long Range 7. Vehicle Radios 7a. Veh...
You look through TFAR's eventhandlers?
Maybe there?
also, does anyone know if _variables are shared among the trigger
i.e. could _bingus be assigned in On Activation and then acted on in On Deactivation
hmmm
I am doing something wrong but it's hard to know what
Okay, this seems to at least not instantly error, time to test if it works
hi im trying to have the cinema borders show then leave but when i run the script in execute code via zeus it starts the cinema bars fully showing and then leaving instead of them slowly appearing then leaving
Sleep 2;
[parseText "<t font='PuristaBold' size='2' color='#9da687'> Operation INSERT NAME </t><br /> SECOND LINE HERE", true, nil, 10, 0.7, 0] spawn BIS_fnc_textTiles;
Sleep 7;
[1,1,false] call BIS_fnc_cinemaBorder;```
almost like its skipping the first line
PlaySoundUI doesn't return anything in the current stable build, so you can't save its return to a variable (because there is no return). The number return, and stopSound, are on dev branch for release with the next update
What's the code to get an array of all Units inside of a trigger/marker area
thisList for init of trigger, or inArea "marker", or inAreaArray
https://community.bistudio.com/wiki/inAreaArray
https://community.bistudio.com/wiki/inArea
#arma3_scripting message
Leopard example for east units in area of trigger
so if I wanted to hand the array to a function I wrote,
[true, true, (units inAreaArray domeTrigger] call { "REV_fn_fx_stripTeleport";};```
_params call MY_fnc_Function;
so
[true, true, (units inAreaArray domeTrigger)] call REV_fn_fx_stripTeleport;
TFAR has no SATCOM antenna.
You mean from ILBE assault pack mod?
Not like that. But triggers are objects. And objects have namespaces.
thisTrigger setVariable...
thisTrigger getVariable...
thank you
bizzarely, this is complaining about a missing )
HoldAction "On Completion" sqf [exit3, 2, (units inAreaArray domeTrigger)] call REV_fn_fx_stripTeleport;
And then the contents of stripTeleport.sqf in the proper folder like my other functions are: ```sqf
params ["_destination","_radius","_targets"];
_dest = getPosATL _destination;
{ _rndDest = _dest getPos [_radius * (1 - abs random [-1, 0, 1]), random 360];
if (isPlayer _x) then {
[["DSidle1", 0.8,1,true]] remoteExec ["playSoundUI",_x];
_x setPos _rndDest;
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";};} forEach _targets
actually let me relaunch the game just in case it's a caching issue???
[exit3, 2, (allUnits inAreaArray domeTrigger)] call REV_fn_fx_stripTeleport;
shortnamed?
the wiki seems to say that you have to spell out the whole path for even built-in sounds
whereas with PlaySound (2d version) you can just say the sound's classname
and playsoundUI will also just take a classname
You can always stick it in a variable before the foreach and call it that way
i.e. [["DSidle1", 0.8,1,true]] remoteExec ["playSoundUI",_x];
wiki says PlaySound3D wants filename, so..
You can use a macro
Or a function
Btw, i suggest you use bis_fnc_findsafepos when getting the pos
....you have my immediate attention because I was actually really worried about that
but also, with playSound3D, how do you specify that soundPosition is blank while also setting volume/soundPitch
rather, how do you slip over an arg without setting it in any given function
....so you can never have a volume in playSound3D without setting soundPosition, which is a positionASL
It's optional?, cant you just NIL it?
no
meh, just pass in the randdest as the point then
I'm playing a sound with an invisible gamelogic as the source
(if that's a thing you can do)
(hope so)
_gl = getpos gamelogic;
playSound3D ["SoundFile", gamelogic, false, _gl, 1, soundPitch, distance, offset, local]
*getPosASL
doesn't really matter for game logic
Do you want all targets to go to the same location ?
yeah the script is intended to grab players from all over the AO and suddenly throw them out into a place where they're surrounded by shadowmen
afaik it uses the pos so yea it matters
And even if it didn't getPosASL is still faster than getPos (basically anything is faster than getPos/position)
ASL or ATL? Which is faster
params ["_destination","_radius","_targets"];
{
// Gives a random Destination using the point of reference, it will be outside of 100m but inside 3000m from the original point.
_dest = [_destination, 100, 3000, 5] call bis_fnc_findsafepos
if (isPlayer _x) then {
[["DSidle1", 0.8,1,true]] remoteExec ["playSoundUI",_x];
_x setPos _dest ;
_x unlinkItem "ItemMap";
_x unlinkItem "ItemGPS";
};
} forEach _targets;
reduce the size then /shrug π
heehoo spooki
You can also use setVehiclePosition
hi im trying to make a module that when you place it on an object it adds an ace interaction to that object. I've made the module part but im stuck with the scripting. Can anyone help with an idea of what the script should look like?
If you want to drag it on something you should use Zeus
It won't work in editor
yeah the module is a zeus module
Script wise, you need ace_interact_menu_fnc_createAction . ace_interact_menu_fnc_addActionToClass
https://ace3.acemod.org/wiki/framework/interactionmenu-framework#31-fnc_createaction
you place the module on an object and it would hopefully run the sqf
But anyway I think there are Curator events for detecting where the mouse is.
Check the remote execution module. it uses the same functionality
private _action =
{};
_action = {
"addPlayer",
"Add Player",
"\A3\ui_f\data\igui\cfg\actions\unloadVehicle_ca.paa",
{this call ace_interact_menu_fnc_createAction},
{true},
{},
[]
};
[_pos, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
If im understanding the wiki right?
does this exist? revive script that:
- lets all ai go down before dying
- has ai reviving both other ai and players
- multiplayer compatible
- hc compatible
ACE can do all that
yeah but someone in my unit explicitly cannot play with ace
might have to say sorry bro but we need this
ACE is not for everyone, especially since it adds a lot more than just medical stuff.
Although you can tweak the setting a lot, so you probably won't even notice the improvements (but can still use them if needed)
you can always start deleting pbos from ace
ace is so omnipotent, it has killed all competition especially in medical
they likely cannot play with ace due to not being able to run dlls
which medical does not use but other aspects do
Could they delete the dll's? There isnt that many and if it doesnt impact basic ace functions or ace medical then it should be fine
Also could be beneficial to look into the root of whatever reason it is that they cant run dll's
Ace advanced ballistics needs one. But can be disabled.
The split lines thing may be needed, don't know if it has script fallback
What do the dll's actually do in a arma mod sense?
things not possible with SQF scripting
Hm sounds like something fun to explore, thanks
IIRC ballistics only uses the extension for performance.
Like you could do the same thing in SQF but it'd be painful when the bullets started flying.
ACE medical AI is pretty weak. It won't help anyone while there's fighting going on.
I don't think you can actually
You'll run into precision issues probably
I mean yeah ok you can and ignore that
that's fine I wouldn't want that. it would just be nice to have help reviving
like after clearing an objective
player using geforce now. I'll probably just not load ace ballistics
looks like advanced ballistics, artillery tables, break line, clipboard, fcs
acemod says "not possible"
addToTrophy = {
params["_vehicle","_range"];
_null = [_vehicle,_range]spawn {
private["_vehicle","_range","_incoming","_target"];
_vehicle = _this select 0;
_range = _this select 1;
while{alive _vehicle}do{
_incoming = _vehicle nearObjects ["ShellBase",_range];
_incoming = _incoming + (_vehicle nearObjects ["MissileBase",_range]);
_incoming = _incoming + (_vehicle nearObjects ["RocketBase",_range]);
while{count _incoming > 0} do{
_target = _incoming select 0;
_fromTarget = _target getDir _vehicle;
_dirTarget = direction _target;
_targetZ = (getPosASL _target) select 2;
_vehicleZ = ((getPosASL _vehicle) select 2) + 1.8;
_targetSlope = (_targetZ - _vehicleZ) / (_vehicle distance2D _target);
if ((_dirTarget < _fromTarget + 30) && (_dirTarget > _fromTarget - 30) && (_targetSlope < 5.76) && (_targetSlope > -5.76)) then {
playSound3D ["A3\Sounds_F\sfx\blip1.wss", tank];
playSound3D ["A3\Sounds_F\sfx\blip1.wss", tank];
"SmallSecondary" createVehicle (getPos _target);
deleteVehicle _target;
_incoming = _incoming - [_target];
sleep 0.1;
};
};
if(count _incoming == 0)then{
sleep 0.05;
};
};
};
};
call addToTrophy;
im having issues getting this script to work.
im having some issues with varable locality _vehicle is not defined
but reading the code _vehicle = _this select 0. is _this not working as its staying inbeetween the brackets?
Because you have no array passed into the function
can you explan simpler?
Even though this function itself does have a lot of flaws, you haven't passed any data upon the execution (last line)
how would i do that
[yourVehicle, 100] call addToTrophy or whatever, I don't know what this fnc is
what does the 100 mean?
it works!!!!
active protection system
it only works the first time though
after that the missles stop getting shot down
hey guys anyone know what the script they use on hearts and minds or antistasi for percipient save?
Antistasi just writes arbitrary data to profileNamespace or missionProfileNamespace depending on whether you ticked the box.
Hello!
I need a little hint. I would like to create an if ... then ... script and for the if condition i would like to have a few factors checked. I have 3 conditions and i want the whole result to be true only if all 3 of them are true. Normally i would use && but according to wiki that's for comparing 2 conditions, can i use it for 3 as well? like conditin1 && condition2 && condition3 ?
In other words, is this correct? ```sqf
if (_key == DIK_RCONTROL && {vehicle player == player} && {side group player isEqualTo west}) then {
};
if you want to use && { }, you should do a && { b && { c } }
ok so first compare two and the result compare with third, right?
yep
if (_key == DIK_RCONTROL && { vehicle player == player && { side player isEqualTo west } }) then
great, thank you very much β€οΈ
and just to be sure this way the if gets a true result when a key is pressed and the player who pressed it is not sitting in a vehicle and is a blufor all at the same time, am i right?
I suppose so, if you set up the event properly yes
wonderful, thank you @winter rose
player can be null for a short time when the player dies and respawn?
I don't know, but it should not matter
It'll matter if you assume otherwise :P
I don't recall there being a null interval though. Maybe for one frame...
Is there any way to replace double quotes with single ones in a string? Not quite able to figure it out :p
and/or just use single quotes within format :p
im just sticking to ctrl+h seeing as i'll need to do it at some point anyways
next question.
i have created a script that should generate every possible combination of stuff for config based off of an array of hashmaps. its working nearly fine, except the non required values are only generating individually and not together. it should be generating them as combinations -- i.e buts, butsss and buts_butsss but it is not doing the last one. I think the issue is at line 20 but am unsure how to fix it, advice would be helpful
https://sqfbin.com/nacisugaqecuyubahagu
(yes ive indented it properly lou)
if somebody is interested, full dump of sublime definitions for 1.52
http://puu.sh/lcvqW/d6d94b44aa.rar
;)
Need help with chosing UI elemets? :)
createDialog "RscTestControlsGroupTooltip"
createDialog "RscTestControlStyles"
createDialog "RscTestControlTypes"
createDialog "RscTestObjectUI"
Have fun ;)
Thank you for the comment on line 13, I wouldn't know there's code below it if it didn't say so 
@sullen sigil I don't understand what you're trying to do there. buts_butsss is clearly impossible because the {_selections find _x == _i} part only ever includes each of them once, and in different passes?
but then why run the loop 17 times when there are only four combinations...
is there a reverse of compile command? something that converts code to string
Probably just str
oh i see
Is there a reason why SQF uses string variable names in for "_i" from 0 to 5 do? I can't think of any other languages that do that
But why not for _i from 0 to 5 do
No problem then
Actually SQF syntax is about two decades old. It is very hard to alter anything by now
yeah id figured that part however am unsure how to resolve it
as for extra loops its a relic of how i originally scripted it
i.e i tried <= and < etc but never generated all 4 combinations π
I take i that running this, and getting the return below means the map isn't setup properly?
_locations = nearestLocations [player,["NameLocal"],25000];
_location = selectrandom _locations;
_location
Location NameLocal at 533, 2396
What exactly you expect?
Townname at grid?
IE
Location Asper at 111,223
throwing Text in front of _location gives me the name..
Hmm
use text _location
Got there already π
Going to iterate through the CFG file instead
{_selections find _x < _i || {_selections find _x > _i}} gives every combination aside from none of the combinations of just required classes, anyone got any big brain ideas for that?
In essence, I need the condition to select every combination through the for loop whilst also always having the required selections
@final radish π Are you looking for this channel?
I was just reading through it, thanks again!
Spent the last several hours working on including a downing function into a damage handler script for my life server. Somehow, including hitBox as a parameter breaks the entire script without throwing a single error in the server or client rtp logs.
I don't really play Arma 3, I just am pretty experienced with C# which is essentially what the Arma SQF language is. So anyways, for the first time in years I was about to rip out some of my hair in frustration and give up lol
So anyways, my parameters look like this now.
params [
["_unit", objNull, [objNull]],
["_part", "", [""]],
// ["_hitBox", "", [""]],
["_damage", 0, [0]],
["_source", objNull, [objNull]],
["_projectile", "", [""]],
["_index", 0, [0]]
];
In my case, since hitBox was breaking the params I wasn't able to track the rest of the parameters of my script.
What is this params array used in, a handleDamage EH?
If so:
- you don't need the type validation or default values; the EH will always provide the correct types and some value for all its params
- you can't introduce an arbitrary new param in the middle.
paramsinterprets the params in order. The third param [in handleDamage] will always contain the damage value no matter what you call it, so trying to add hitBox there just makes hitBox contain the damage number and throws off every param after that.
why am I getting so much junk with vehicles command that are not operable vehicles but walls, sandbags etc? is it because I used createVehicle to create them?
you have to use setNoJunk on them first
otherwise no idea what you mean π€·ββοΈ
i thought vehicles returned only actual vehicles and not structures, sandbags etc?
ah, the vehicles command
afaik, it should return only drivable vehicles + weapon holders, but I may be wrong
an allVehicles could be nice if we need just a "all cars + bikes + helicopters + planes + drones" method
yep
it doesnt return editor placed structures but it does return structures placed during the mission via createVehicle
or maybe not all strutures but things like portablehelipadlight_01_f.p3d & pallet_f.p3d
Which event script should I ideally use to call setUnitLoadout? Can I use initserver.sqf or is there a more elegant one?
depends
its for players equipment.
This is also my answer because we were discussing it together π
who could have guessed setUnitLoadout was for equipment π
all joke aside though, what is the concern?
should the gear be set before the selection screen?
on mission start?
after mission has started?
why so many questions?
why do I add another one?
oh noes
anyway if you want gear set before mission starts, why not just use loadout editor in Eden Editor?
Im guessing due to some randomization stuff but @summer gale go ahead on this answer.
kicks AkcjaZnicz out of the server π
setUnitLoadout, while it is good to call before briefing screen, needs to be called in postInit functions at the earliest.
https://community.bistudio.com/wiki/Initialisation_Order
A CfgFunction with the postInit attribute set would be the obvious and simple solution.
https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Category
Look into the allObjects command. I cant remember all of it's functionality, but it might have what you want. I commonly use it to to turn off all the lights in the maps.
I.e. get all lamp objects and turn off lights
i tried 8 allObjects 1 but it too returns those portablehelipadlight_01_f objects
Hello!
I wrote a script but it doesn't work. I thought i made it right. Can someone help me identify, where is the problem?
after executing this: sqf ExecVm 'hadice\resp.sqf' i want this sqf file to run its code: sqf private _voj = _this select 1; removeBackpack _voj; _voj addBackpack "B_SCBA_01_F"; removeGoggles _voj; _voj addGoggles "G_RegulatorMask_F"; (backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"]; _voj addAction ["Drop respiration gear", { params ["_target", "_caller", "_actionId", "_arguments"]; removeBackpack _voj; removeGoggles _voj; }; ]; but in game nothing happens
have you tried using 16? Remember that arma is wierd, vehicle is its word for a generic object.
are there vehicles placed from editor and from zeus?
none
were you attempting to get all vehicles (actual vehicles) or buildings?
actual vehicles
so there are no vehicles placed, and the method that we think returns all (actual) vehicles didnt return anything?
PLACE SOME VEHICLES! Your soldiers need support
no all vehs are created via script
createVehicle?
yes
hmmmmm
vehicles command gets those but also returns some junk
i can filter those out but im looking to optimize the code
I wouldnt have to remoteExec it to sync across all machines right?
Asking just to be sure π
setUnitLoadout is global effect
different approach. Off the top of my head and as a guess: (as psuedo code)
_actualVehicles = vehicles select { _x isTypeOf [VEHICLE CLASS HERE] };
Was wondering whether CfgFunctions changes anything in this regard but I guess not
yea thx did that already π if(!(_veh iskindof "AllVehicles")) then { continue; };
What nikko said, so make sure not every client is running setUnitLoadout. While temporary, that will cause a performance hit during loading.
The whole point of vehicles is to detect actual vehicles. If it's returning non-actual-vehicles it may be worth making a bug report about that
true
https://community.bistudio.com/wiki/execVM
You need to use arguments like in examples.
[YourUnit] execVM "hadice\resp.sqf"
// In sqf
params ["_voj"];
// Then you use _voj, which is YourUnit
removeBackpack _voj;
...
So executing it only on the server would be the best way here?
wrong. It does secify it returns a few other non-actual vehicels, such as weapon placeholders.
Fine.
The whole point of vehicles is to detect actual vehicles and a couple of other specific things that aren't actual vehicles. If it's returning all other non-actual-vehicles it may be worth making a bug report about that
so you are suggesting to replace sqf private _voj = _this select 1; with this ```sqf
params ["_voj"];
Yes.
I mention this as I have a specific scenario where this might be considered reasonable.
Alternatively, you can have the object owner handle the setUnitLoadout. So server handles calling it on AI, players client calls it on their player object. You would use remoteExec for this. Consider your design implementation before doing something like this.
Understood, thanks a ton!
And Nikko too π
It is pretty stupid.
Yes.
_voj = select 1;
Select 2nd argument from params.
And you don't in params 2nd value to choose.
_voj = select 0; // is 1st object from params.
And with
execVM "yourScript.sqf"
Params in sqf are empty, because you do not use arguments which are sent to the script.
So you need to use an argument.
[YourUnit] execVM "yourScript.sqf
To start with, your probable issue is that you are selecting a null parameter.
If you are passing only 1 object as a parameter, you want to use this select 0, not this select 1
Yep, only I made the EH a bit more complicated than it should be. So the type validation is intentional, I am planning on passing a value for a side ammunition type.
And interesting, I wasn't aware that there was a set order to params. In my other working scripts they seem to work fine and return expected values in any given order
params are retrieved in the order they're passed, the names don't matter.
params ["_param1","_param2"];```
```sqf
private _param1 = _this select 0;
private _param2 = _this select 1;```
these are essentially the same
Second, I strongly recommend using params ["_voj"] instead, as it more clearly defines what you are doing.
Edit: If _voj is a non-english word, then I may be wrong below here.
Lastly, I recommend not shorthanding variable names, as it makes it a little difficult for people to understand what they reading. _player or _unit is more descriptive and understandable than _voj.
(i dont mean to narc on you, just giving some tips)
I'm pretty sure _voj is a readable name, it's just not in English
Ah, I get what you mean now
Thanks I'll keep that in mind, there's a few instances so far where I've used them but fortunately hadn't had much issue until now.
On a side note, there was an error being thrown that would have saved me so much time had it been logged in console instead of displaying on a screen that's covered up for several seconds before spawning into the server.
both are valid. So long as get the order correctly, neither one makes a difference.
Its just that params ["_param1", ...] (i assume) is easier to read for most people. Consider having to select 10 parameters vs params 10 parameters.
And params also features data validation
https://community.bistudio.com/wiki/params
They display errors on-screen π€£
Nothing was in rtp logs either. Found out when _source returning as nil
@limber panther does this select 0 fix the script?
You've got crossed over, BAXENATOR's message was about someone else's use of params
sorry i had to do something here, i'll test it right now
@vapid scarab allright so simply changing 1 to 0 didn't make it working
let me explain a little bit what i'm trying to do
a player in the game presses button on the kyboard (i chose right control) and a dialog window opens up, in the dialog window player presses a button which executes the sqf ExecVm 'hadice\resp.sqf' and this sqf file should give the player a defined backpack, respirator and add an addaction on himself, this addaction will then be responsible for deleting the backpack and respirator previously given via the dialog window
You can use
player execVM 'hadice\resp.sqf'
Then your player is used in your script.
If you do not use arguments. Your param select 0 is null,
So you need to use an argument when you execute the current script.
@stable dune so replace sqf ExecVm 'hadice\resp.sqf' with sqf player execVM 'hadice\resp.sqf' and replace sqf _voj = select 0; with ```sqf
params ["_voj"];
Yes.
And like NikkoT earlier said,
params ["_voj"];
Is equal to
private _voj = _this select 0;
And is equal to
_this
wonderfull π let me test it right now
+_this
You can also change _voj to player everywhere. Either or works
pardon me, where should i add _this?
private _voj = select 0;
// β
private _voj = _this select 0;
Don't mess him head anymore π
you did this!!1!1!
You're establishing the magic variable _this by passing it forward using Params.
Whatever you put before execvm is what your passing to the script
Params establishes this variable in the form of _this
also params ["_voj"]; is same as _this params ["_voj"];
Magic variables are fun. They take time to understand, just trust us
So now he have there
params ["_voj"];
_this params ["_voj"];
private _voj = _this select 0;
_voj = player;
_voj = _this;
ok so i tested and it still doesn't work, let me paste here what i currently have:
on button click this script gets executed: sqf player ExecVm 'hadice\resp.sqf' and the sqf file contains this: ```sqf
private _voj = _this select 0;
removeBackpack _voj;
_voj addBackpack "B_SCBA_01_F";
removeGoggles _voj;
_voj addGoggles "G_RegulatorMask_F";
(backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"];
_voj addAction ["Drop respiration gear",
{ params ["_target", "_caller", "_actionId", "_arguments"];
removeBackpack _voj;
removeGoggles _voj;
};
];
the code { } in addAction is not aware of the _voj variable
there is a matter of scope
but not even the initial remove backpack work
that's normal
you should even have an error
i didn't get any error
You can't use _this select 0 with player execVM ... because in that format, _this is not an array
player execVM "something.sqf
in something.sqf:
_this // it's player
player select 0 // error
params ["_voj"]; // takes the first array element or the argument if it's not an array
so i should replace sqf private _voj = _this select 0; with ```sqf
params ["_voj"];
_this select 0 would work if you were passing an array of arguments, e.g. [player] execVM ..., but if you're only passing a "naked" argument, it tries to select within that argument, not within the array of arguments - because select is used for selecting within things other than arrays, as well.
params is only used for parsing arrays, and is therefore smart enough to treat a non-array input as if it was a single-element array.
great tips, thank you guys, so what i have now is following: sqf player ExecVm 'hadice\resp.sqf' and sqf params ["_voj"]; removeBackpack _voj; _voj addBackpack "B_SCBA_01_F"; removeGoggles _voj; _voj addGoggles "G_RegulatorMask_F"; (backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"]; _voj addAction ["Drop respiration gear", { params ["_target", "_caller", "_actionId", "_arguments"]; removeBackpack _voj; removeGoggles _voj; }; ]; and these curently finally work at least up to the point where it gets the texture however no addaction is added to the unit @winter rose already mentioned a possible problem there i think?
My bad, I missed [ ] around the player so it's not the same.
But luckily ppl tell what is the difference between player execVM "script.sqf" and [player] execVM "script.sqf"
bumping this, though tl;dr I need a select BOOL condition within a for loop that will provide me with every possible combination of the array's elements
swf vs sqf?
I need stop drinking
addAction use params. And _voj is not in params.
So you need use _target in addAction , which is same as object where addaction is attached.
removeBackpack _target;
removeGoggles _target;
but the addaction doesn't even get created
however this is a great tip, thanks
so why is the addaction not being created? π€
take ; before ] away
like this? ```sqf
params ["_voj"];
removeBackpack _voj;
_voj addBackpack "B_SCBA_01_F";
removeGoggles _voj;
_voj addGoggles "G_RegulatorMask_F";
(backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"];
_voj addAction ["Drop respiration gear",
{ params ["_target", "_caller", "_actionId", "_arguments"];
removeBackpack _voj;
removeGoggles _voj;
}
];
ok, let me try π
No, you're still trying to use _voj inside the addAction code, where it isn't defined
{ params ["_target", "_caller", "_actionId", "_arguments"];
removeBackpack _target;
removeGoggles _target;
}```
sorry i pasted here previous script but i already fixed that, thanks for noticing tho π
and it finally works! i just spotted one little problem, on repeated use, the addaction stacks in the scroll menu, is there a way to delete the addaction after use?
And you have in params _actionID, you can use that
thank you, let me try it
this way? ```sqf
_target removeAction _actionId
i'll test it
Yes. Correct.
thank you very much it works π₯³
I want make a script that detect whether AI group low on ammo,if it is,then RTB for supply of call a supply logistic.But I don't know how to detect whether AI group low on ammo
Anyone know how to do that?
prisoner, BAXENATOR, NikkoJT, Lou Montana, Capt Clueless and GC8 thank you all for helping me with this script β€οΈ
private _mygroup = yourgrouphere;
private _groupmagazinecount = (units _mygroup) apply {count (magazines _x)};
if ((_groupmagazinecount/count (units _mygroup)) < 3) then { //roughly less than 3 magazines on average per unit
//do something...
};```
not exact but is the rough logic you want
thanks!
no problemo, dont expect it to work first time
So im trying to look into some custom squad marker drawing. I have seen the (from CBA) Extended_DisplayLoad_EventHandlers used. What is this and where do I find documentation on it?
undocumented on cba wiki but is found here on the githbu
https://github.com/CBATeam/CBA_A3/blob/master/addons/xeh/CfgEventHandlers.hpp#L85
Is there anything else? This is rather useless as far as I can tell (Correct me if im wrong, I dont mean to be rude here).
not as far as i could find
Thanks for looking! I couldn't find anything myself.
no worries; cba's wiki isnt anywhere near as useable as ace's
i mostly just use it for evading the scheduler π€·
I am getting kicked out from official server when i try to put a civilian with the below code.
Message: remoteexec restriction #22
Anyone can help?
this setCaptive true;
this disableAI "MOVE";
this switchmove "Acts_AidlPsitMstpSsurWnonDnon01";
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
_killer globalChat format ["A civilian was killed by %1!", name _killer];
}];
[
this,
"Free Hostage",
"\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
"true",
"true",
{},
{},
{
(_this select 0) switchMove "Acts_AidlPsitMstpSsurWnonDnon_out";
(_this select 0) enableAI "MOVE";
(_this select 0) enableAI "AUTOTARGET";
(_this select 0) enableAI "ANIM";
(_this select 0) setBehaviour "COMBAT";
private _undercover2 = createGroup east;
[(_this select 0)] joinSilent _undercover2;
sleep 3;
(_this select 0) removeEventHandler ["Killed", 0];
(_this select 0) addMagazine "30Rnd_9x21_Mag";
(_this select 0) addMagazine "30Rnd_9x21_Mag";
(_this select 0) addMagazine "30Rnd_9x21_Mag";
(_this select 0) addWeapon "hgun_P07_snds_F";
(_this select 0) doFire (_this select 1);
},
{},
[],
5,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];
please use https://sqfbin.com/
Just means that the server doesn't let you remoteExec BIS_fnc_holdActionAdd.
Probably the wrong place to ask why.
Just as i thought i finally understand it, i made a script that doesn't work again. Although it looks identical as another similar script that works, this one doesn't. Anyone knows what could have gone wrong?
- this script doesn't create the
addactionon the given unit
params ["_voj"];
private _had1 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had2 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had3 = createVehicle ["LayFlatHose_01_StraightShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_had1 attachto [_voj,[0.15,-0.21,1.21]];
_had1 setVectorDirAndUp [[0,-1,0], [-1,0,0]];
_had2 attachto [_voj,[0.15,-1.45,0.5]];
_had2 setVectorDirAndUp [[0,1,0], [-1,0,0]];
_had3 attachto [_voj,[0.15,-2.56,0.05]];
_voj setVariable ["fw_had1", _had1, true];
_voj setVariable ["fw_had2", _had2, true];
_voj setVariable ["fw_had3", _had3, true];
_voj addAction ["Drop flat hose standing",
{ params ["_target", "_caller", "_actionId", "_arguments"];
_had1A = _target getVariable ["fw_had1", []];
_had2A = _target getVariable ["fw_had2", []];
_had3A = _target getVariable ["fw_had3", []];
deletevehicle _had1A;
deletevehicle _had2A;
deletevehicle _had3A;
_target removeAction _actionId;
}
];
You have a bunch of missing semicolons in the addAction's script.
this way? β¬οΈ
yes.
allright but that's not the source of the problem is it?
Otherwise the code's probably not being called correctly.
But I don't know whether SQF ignores a garbage code object.
the rest works fine, just the addaction doesn't show up in the scroll menu
What is the difference between
loadout1 = [LOADOUT];
// and
_loadout1 = [LOADOUT];
More specifically, what does loadout1 do different to _loadout1?
If the code is running on a server, addAction is a local effect, requiring it to be executed on a client for it to appear.
it's literally the same thing we did today few hours earlier
let me show you
this one works perfectly: sqf params ["_voj"]; removeBackpack _voj; _voj addBackpack "B_SCBA_01_F"; removeGoggles _voj; _voj addGoggles "G_RegulatorMask_F"; (backpackContainer _voj) setObjectTextureGlobal [2, "a3\supplies_f_enoch\bags\data\b_scba_01_co.paa"]; _voj addAction ["Drop respiration gear", { params ["_target", "_caller", "_actionId", "_arguments"]; removeBackpack _target; removeGoggles _target; _target removeAction _actionId } ]; and this one doesn't work: ```sqf
params ["_voj"];
private _had1 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had2 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had3 = createVehicle ["LayFlatHose_01_StraightShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_had1 attachto [_voj,[0.15,-0.21,1.21]];
_had1 setVectorDirAndUp [[0,-1,0], [-1,0,0]];
_had2 attachto [_voj,[0.15,-1.45,0.5]];
_had2 setVectorDirAndUp [[0,1,0], [-1,0,0]];
_had3 attachto [_voj,[0.15,-2.56,0.05]];
_voj setVariable ["fw_had1", _had1, true];
_voj setVariable ["fw_had2", _had2, true];
_voj setVariable ["fw_had3", _had3, true];
_voj addAction ["Drop flat hose standing",
{ params ["_target", "_caller", "_actionId", "_arguments"];
_had1A = _target getVariable ["fw_had1", []];
_had2A = _target getVariable ["fw_had2", []];
_had3A = _target getVariable ["fw_had3", []];
deletevehicle _had1A;
deletevehicle _had2A;
deletevehicle _had3A;
_target removeAction _actionId;
}
];
i feel like it's the same case and it looks the same to me
they are both executed the same way - by pressing a button in a dialog window which executes exevVm script
this is the first one (working one): sqf player ExecVm 'hadice\resp.sqf' and this is the second one (the broken one): ```sqf
player ExecVm 'hadice\had_s.sqf'
It looks like it should work. Lets try this anyway:
_addActionParams = ...;
[_voj, _addActionParams] remoteExec ["addAction", _voj];
Replace the addaction line with this
For what it's worth, without the semicolons it simply doesn't run. So if you didn't actually bother testing it then you really wasted some time.
There might be an issue with the code being passed to the add action. I typically put code in its own function and pass "[...] execVm 'script.sqf';" for the code argument.
Original paste had a lot of missing semicolons in the addAction code.
never used execvm in my life, never will. cba events system πΏ
i tested that before you sent that message, yeah it works now, sorry about that, on the other hand it's weird to me because i thought a broken code inside addaction should not prevent the addaction from being created
Apparently it does.
best it stops it tbh
It's fairly logical because it'll fail to create the code object, and then you have an invalid parameter to the addAction.
help i cannot find the code object in eden
in the past when i made a broken code like this i ended up with an addaction that just simply didn't do anything when activated so that confused me this time
anyways
my apologies John and Bax and thanks again for your significant help
broken code =/= code that doesnt do what you want
Also there's code that'll fail on execution and code that'll fail to even parse.
who's know what this ?
For example if you try to use a global variable that doesn't exist, that'll parse fine (and hence create a valid code object) but fail on execution.
@tough abyss Wrong channel, go to #arma3_troubleshooting
understood, thank you
I only use it in live testing.
Also, got any good tutorials on using CBA?
i'll tryto remember it for next time
not really a tutorial but worth reading
https://ace3.acemod.org/wiki/development/arma-3-scheduler-and-our-practices.html
tl;dr do not use the scheduler (spawn etc)
...unless you're leopard
for your information, CBA's waitUntilAndExecute is not flawless either
i know π
well what am I talking about if you do know?
i do not know aside from nothing being flawless
i tend to rarely use waituntilandexecute anyways
then what do you use instead of spawn?
pfh for how often i want it to check then delete if necessary π
/waitandexecute loop
same difference
que
Don't know did anyone mentanion that you can use _arguments in addAction, so you don't need setVariable and getVariable if you want you could do
params ["_voj"];
private _had1 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had2 = createVehicle ["LayFlatHose_01_CurveShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _had3 = createVehicle ["LayFlatHose_01_StraightShort_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_had1 attachto [_voj,[0.15,-0.21,1.21]];
_had1 setVectorDirAndUp [[0,-1,0], [-1,0,0]];
_had2 attachto [_voj,[0.15,-1.45,0.5]];
_had2 setVectorDirAndUp [[0,1,0], [-1,0,0]];
_had3 attachto [_voj,[0.15,-2.56,0.05]];
_actionParams = [_had1, _had2, _had3];
_voj addAction ["Drop flat hose standing",
{ params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_had1", "_had2", "_had3"];
deletevehicle _had1;
deletevehicle _had2;
deletevehicle _had3;
_target removeAction _actionId;
},
_actionParams
];
does isNil not return false if variable is not nil? 
It's supposed to
wow i had no idea i could do it this way! thank you, this is going to save me so much time
doesn't seem to be doing that from my code and BIKI says it only does if it is nil π€―
let me guess, you forgot the quotes
first of all, when you push a new waitAndExecute, you force CBA to sort the array
second of all, every code is run in a forEach, adding its own overhead. there's also overhead in constantly calling the condition and the code
third of all, waitAndExecute runs unscheduled, which reduces performance without care
so yes, spawn is still useful. just not when you want to time things accurately
yes, i know it's still useful -- i use it in my undercover mod for the main loop -- but in 9 times out of 10 it is not
9 out of 10 it is
agree to disagree
Is there a extension for FSM on VS code?
I hope this is a simple fix to an issue i've been trying to figure out...
I am trying to set up a unitcapture scene where i have a squad of soldiers moving in a tactical wedge. I can record and playback everything just fine. But I cant seem to figure out how to get all the soldiers to move cohesively together. They never start together, which is causing them to not move like a group of soldiers would if they were moving in a tactial wedge.
any ideas?
https://sqfbin.com/keqijajuzapaxohoxoci
There you go. Anyone can figure why i am getting Remoteexec restriction #22 in official server?
@torpid palm You mean like the leader starts moving a bit earlier?
yeah, and the next in line starts late
I guess you could give them all doStop orders and then individual doMove orders, but I don't think this guarantees starting times either, because it has to wait for the pathfinding.
im using unitCapture
They aren't sync'd or moving as AI
What i could be trying to do could very well be outside of the scope of what the engine allows for but im not too sure
been stuck on this for about two weeks now lol
You mean the unitCapture data is synchronised but somehow it isn't on playback?
yeaaaah? I suppose that would be the best way to explain it. Let me see if I can record it rq
can't get the clip unfortunately.
I guess im going to just start back from zero. It has to be something that I'm doing wrong on the recording
not all servers allow remoteExec, for safety
that's not a script error.
Is there a CBA macro for #if and #ifdef?
if you mean you want to check if CBA exists you can use __has_include
but it's not a good way
check cfgPatches
I created a particle effect using vanilla stuff, it works perfectly, but it don't show itself to players more than 3000 meters away even if their vision (terrain and objects) is greater than that. This particle distance limit can be increased? Also set particle quality to High don't change that.
So im making my own mission framework. What benefits does using CBA to design everything give me?
Not that Im genius at this or whatnot, I did just get over learning most of the regular arma syntax regarding the description.ext file and most of its components. So Im wondering whether the CBA stuff is even worth learning?
if they offer something useful enough for you to make it a dependency, do it
if you don't need their tools, don't use it
in essence:
- don't use the scheduler if the code needs to be completed in a timely manner or at a precise time, use cba instead
- you can not use remoteexec, execvm etc by using cba's events systems. i prefer doing it that way by far, unsure if theres any difference network wise.
- cba state machines have a few useful applications, examples of which are ace medical and grad civilians.
- cba class event handlers and so on are quite useful for some use cases too; i've never used them myself though so cannot speak for them.
people will disagree with me here but that is common
as an example of when to use the scheduler for code, i use it in my undercover mod for the loop to check through AI to see if they can see the player and such. that isn't really time sensitive, so can be scheduled to reduce the performance impact. its just a while loop of 0.5 seconds, no other sleep, waituntil or scheduler specific functions in it
"KJW's Imposters" on the workshop if you wish to dissect it and look at how I use CBA versus the scheduler
are in, -, + supposed to work with code type? e.g
_someCode = {hint "Test"};
_array = _array + [_someCode];
_containsCode = _someCode in _array;
Hey everyone. By any chance does anyone know a script to make a vehicle have the attributes of a repair truck. Basically I want to turn a pickup truck into a repair truck. Thanks in advance
Are you using ace? or are you talking about vanilla arma?
tbf i'm shocked it just works and i don't have to invent much for making my event handlers
i can add and remove code from array without needing any kind of handle
Vanilla Arma
@drifting portal remember the pylon manager GUI you wrote up for me? overall its worked pretty well and its remained untouched since last year, but recently i've noticed a couple players having issues with the jet spawning after they clicked the button
today it happened 8+ times in a row for one player, and this is what i gathered from the server log: 19:25:25 "***** CAS RESPAWN ***** SPAWNING JET FOR ..." 19:25:25 " ***** JET TYPE: " 19:25:25 " ***** LOADOUT: []" 19:25:25 " ***** FAILED TO SPAWN CAS JET" i'm inferring that LocalVehicleObject was objNull each time, but the issue stopped after i asked the player to re-connect
would you happen to know what might cause this?
script: https://sqfbin.com/bibiwoyisucuguwopasu
my guess is that there might be a race condition between the code scheduled in _SpawnButton (L460-L469) and the unload handler for your window (L47-L54), so the fix im going to attempt later is moving L458 (VehicleSelectionDisplay closeDisplay 1) to L467 (after deleteVehicle _LocalVehicle)
also i did get them to record it and send their log; the local jet spawned in correctly with the armaments changing to their loadout before they pressed spawn, and there were no errors related to the mission
Beyond me right now. I don't know anything about the vanilla repair trucks (or that they even existed), Hopefully someone else gets to you.
Thank you anyways. I was hoping it would be like the medic trait in units but apparently not
yeah i read that it says "Anything" type, but still didn't quite believe it could be code
i'm not used to code being a variable type lol
perhaps you could inherit your truck from a repair truck and change the model?
(it's done in the config file)
It was just the default IDAP pickup with the service bar.
That might be too complicated because Iβm hosting the mission for a group
first class functions ftw
in that case you could probably just use setDamage 0; when near the truck
or put it in a spawn and slowly repair over time
when i ever will find the time ... i will write an UI Editor ...
are particles and lights the only things that can change color?
(in the 3D view, not the map/GUI)
What do you mean by change color?
like changing it from script dynamically
i can't change tint of a model material, can i?
what i'm trying to do is attach some thingy to a unit's shoulder that would change color based on what faction it belongs to
so far i could only think of using opaque particles
ideally it would be some small model like a ribbon with changeable tint
setObjectTexture/setObjectMatrial are thing
ooh, and i suspect _obj setObjectTexture [0, "#(rgb,8,8,3)color(1,0,0,1)"]; is for generating a flat-colored texture of any color?
great, thanks
Does anyone possibly know the scripts associated with the CAS support module??? Anyone??? Begging?
define "know", please. Where the script is located? How to work with it? How to modify it? What?
https://community.bistudio.com/wiki/Modules#Module_Documentation
BIS_fnc_moduleCAS
That's just specificity for the sake of it
You know how you can call in a CAS mission with an unguided bomb? I want to know the script in that module that controls that...
no, that's "please tell, what your question is"
We can probably find it in the config view right?
what Nikko said (you can see it in the in-game function viewer) or "P:\a3\modules_f_curator\cas\functions\fn_modulecas.sqf" if you have P-drive with unpacked game files