#arma3_scripting
1 messages Β· Page 42 of 1
how do I do that?
diag_log ["_ctrlName", _ctrlName];
Either you assigned nil to it somehow (some command returned it?) or _ctrlName is not even initialized, check your code scopes and what calls what.
instead of your hint everyone is there thing, run script, spawn or call or execVM whatever is convenient
Is there a command to extract a config out of an object
I want to make a SOG F4 similar to the F4E AUP
maybe mess with a few others
tried config viewer but I didn't see the components for the Pylons
this is the general way to access the plane config
(configFile >> "CfgVehicles" >> _classname)
for specific entries you can use getText, getArray or getNumber commands before the opening parenthesis and adding another pair of > to the right of classname and then writting the entry name in quotes.
To get each part of the config you can loop and verify which type of entry it is and then get it with the required command. Not much else to do besides that if you are not looking for something specific.
If you need help with config itself you could ask in #arma3_config
Pylons may also be stored in a sub class
i need some help im trying to make use of the Scriptdone func, but the script handle becomes <NULL-script> when the script finished and the scriptdone command gives no return to that value
scriptDone scriptNull returns true. There is something wrong with your code.
private _FuncHook = [_heli getVariable "fza_audio_FuncHook"];
if (_FuncHook isequalto []) then {
_FuncHook = [_heli] spawn fza_audioSystem_fnc_audioSystemHandler;
_heli setVariable ["fza_audio_FuncHook", _FuncHook];
} else {
if (scriptDone _FuncHook) then {
_FuncHook = [_heli] spawn fza_audioSystem_fnc_audioSystemHandler;
_heli setVariable ["fza_audio_FuncHook", _FuncHook];
};
};
the handle returns
<NULL-script>
The isEqualTo comparison is bogus, because you're likely comparing [nil] to [] which returns false.
that was to kick start it with the variable init value
Yes, but it's wrong.
just default your variable instead of making the comparison
You want to do something like this:
private _FuncHook = _heli getVariable ["fza_audio_FuncHook", scriptNull];
if (scriptDone _FuncHook) then {
_FuncHook = [_heli] spawn fza_audioSystem_fnc_audioSystemHandler;
_heli setVariable ["fza_audio_FuncHook", _FuncHook];
};
^^
im sure iv tried something similar to that to begin with , but il give it another go thanks
and it works thank you, it tried looking for a scriptnull like objnull but couldnt find it earlier so thank you
For reference this is the slightly messier version that you can do without knowing about scriptNull:
private _FuncHook = _heli getVariable "fza_audio_FuncHook";
if (isNil "_FuncHook" or {scriptDone _FuncHook}) then {
_FuncHook = [_heli] spawn fza_audioSystem_fnc_audioSystemHandler;
_heli setVariable ["fza_audio_FuncHook", _FuncHook];
};
i think i found my earlier issuie, evan when i predefine the variable with scriptnull in another place it dosent work
and when it becomes <NULL-script>, the default value you added to the get variable must override that to make it work
<NULL-script> is just how it prints scriptNull.
thanks
predefining the var on the heli as scriptNull would also work. If it doesn't then there's probably another issue in your code.
no dont do this to me, i have enough issuies
cackles
Resolve weirdness early. Hurts less in the long run :P
Except with AI code, where trying to figure out the weird occasional bugs will drive you insane because Arma AI is a black box full of disaster spaghetti.
is it just me or did the syntax highlight colors change
it did
on the 6th of January
how did you go about submitting a syntax to discord? since I can use this syntax on every server
strings and local variable names**share too much of a similar color now imo
_thisIs = "a bit similar imo";
https://github.com/highlightjs/highlight.js I think you submit it here
i dont want to make you work more but... its posible to make discord scrap the syntax of a command when you link it?
something like this? ()
https://community.bistudio.com/wiki/finite
doesn't look like it would work well with commands having up to what? 12? syntaxes :3
at least only the syntax part of it
is it possible to make arma read from a csv?
loadFile?
I don't know if there's a CSV parser for SQF around somewhere. Otherwise it's a fair amount of work.
honestly i think txt would work. Thanks!
i guess is just this
_sep = ";";
_file = loadfile "test.csv";
_data = _file splitstring "\n";
_data = _data apply {_x splitstring _sep};
I didn't, they just changed the theme
Depends. CSV is poorly defined so you have \n vs \n\r and quoted value issues.
no idea how Discord does its stuff really
If it's your own CSV then you can workaround that.
; separator? sounds French
my condolences
csv stands for comma-separated values after all π
Question regarding say3D vs playSound3D:
I am using playSound3D to play a sound, but I want to be able to stop the sound while it's active, so I need to use Say3D from what I can tell. However, I cannot seem to get the sound work when I give the parameter as a full path to the sound whilst using say3d. What do I need to put in order to get Say3D to play the sound when I only know it's path?
say3D can't use direct file references.
However, you can make your own CfgSounds entry in description.ext, to define that sound for use with say3D (yes, even if it's a base game sound) https://community.bistudio.com/wiki/Description.ext#CfgSounds
Thank you @hallow mortar! Do you also happen to know if there is a way to stop a playSound3D before it's done playing? Or is it true that you need say3D for this?
I don't know of any way to do that. It's possible it creates one of those virtual soundsource objects to play the sound from, in which case deleting that would stop it...but if it does create one, it doesn't return a reference to it, so you'd have to manually find it (huge pain in the ass).
In other words, use say3D :U
Gracias again
Hey, for anyone who is able to help. I've set up a cutscene using AL_Intro scripts and it seems to work when I host a server but when I try and use it on a dedicated server
It doesn't work.
Anyone able to help?
Does anybody have any scripts regarding Respawn points on vehicles. Like having infantry respawn on a medical helicopter ore medical vehicle in some form
Q: first form type createVehicle position takes what, POSITION ASL?
it disregards the Z component of provided position and spawns at 0 height ATL, iirc
cool thanks
I seem to be having an odd error when passing a list of variable names to a script
In my mission, I have x objects named foo_bar_x
In a script, I have a list of those variable names, and I want to pass that list to another function that loops over those objects and does something with them. However, I ran into an issue where passing the list of all of the variable names, did not pass it correctly.
_listObjects =
[
foo_bar_0,
foo_bar_1,
...
];
_this addAction ["1", { ["someValue", _listObjects] execVM "someOtherFile"; }];
However, I then get an error saying that _x is not defined when looping over the objects.
When printing out the stringified version of the array to chat, it simply reads [any].
When passing some of the variable names as an array directly, it works as intended
Fix
_this addAction ["1", { ["someValue", **_this select 3, _listObjects**] execVM "someOtherFile"; }];
(Asterisks are added to spot the correction more easily)
In the action _listObjects doesn't exist
Ooooh yep forgot about addAction being like that
What is the script command to force AI to stay standing? I found https://community.bistudio.com/wiki/stance, but that just returns their stance
_unit setUnitPos "UP"
Oh I saw unit pos on the stance page, thought it might have been something else
Thanks!
The ai doesnt know the vehicle is empty.I assume the vehicle has been abandoned and it hasnt started the mission empty.
Hi guys. Need some help. How to work with RscMapControls? I need to put the cut out map in a frame so that it can be moved. How to do it?
hey how would i use a script to spawn a vehicle in a certain direction ive already got it spawning the vehicle but i need it to be facing east instead of north
im spawning vehicles via scripts so i can spawn multiple in at the same point for like reinserts and such
setDir
//spawn vehicle code
"UK3CB_BAF_LandRover_WMIK_GPMG_FFR_green_A" createVehicle getMarkerPos "vs1";
where would i put that in that code?
separate command after that line
and if i just do setDir would i change the direction for all the vehicles spawned with that command?
private _vehicle = "UK3CB_BAF_LandRover_WMIK_GPMG_FFR_green_A" createVehicle getMarkerPos "vs1";
_vehicle setDir 90;
// reuse private variable once you're done editing the first one
_vehicle = "class2" createVehicle getMarkerPos "spawn2";
_vehicle setDir 90;
You would need to do setDir for each spawned vehicle.
It's a very easy one to test, but I would expect not, because you don't get into the drone when you control it. Remote control and being in the vehicle are different.
is there a way of disabling inventories of an object without setting it to a simple object or stopping it from being able to ace interact
does it work on objects such as crates thoe?
Yes
I assume you mean in the object's init field?
Yes, that's how the command works, as described.
thanks
do you happen to know if this command just cancels the opening / closes instantly the inventory or does it prevent the inventory being opened?
Prevents it being opened. It's the equivalent of lock. If you want to close it immediately after being opened you'll need some kind of EH.
yeah, its what im doing with some containers. But this might be even better.
ye it straight up doesnt allow you to access the inventory which i like
I'm having an issue setting up a trader system. I get this error:
https://cdn.discordapp.com/attachments/656953401070059541/1066052601684181012/image.png
but there isnt an issue with line 268: {"CUP_H_US_patrol_cap_OD",1500,"true"},
what about line 269
{"rhs_beanie_green",600,"true"},
{"rhs_6b28_green_bala",1400,"true"},
sorry, should i move it over to #arma3_config?
1 sec
{ "B_Kitbag_mcamo"6250, "true" },
// ...
{ "rhs_weap_aks74n"4950, "true" },
@valid abyss ^
what line is that?
ahhh
thanks ill see if it fixes the problem
that fixed it
tysm ive been trying to fix this issue for about an hour
I don't know if this is the right channel but, can someone help me? (its in warlords, i I tried to make
custom faction)
(better screen of the error?)
Well, you probably put a syntax error in a unit array and broke the spawning.
Although given that it's doing floor random it's vulnerable to the random N = N bug :P
uuuh,how do i fix it? (im stupid so don't expect too much from me)
Write your custom faction without making errors.
Check the RPT. There's often an earlier error that tells you where you screwed up.
oook, Thanks so much :D
uuh i double checked the description.ext file but everything seems fine, sooo whats the problem?
it seems all ok
Oh, it's config for Warlords?
Wrong channel then :P
But you'd probably need to find someone who knows Warlords.
ooof
(config is not script)
Where I have to go?
im stupid as fuck, sorry for wasting time :c
Hey guys, question for you all
I've run a custom range scoring script that I made years ago, and it's been running well for years. The gist of it is I had an event handler on each target that adds to a score when the "Hit" event handler is triggered on the target. All of these targets are invincible, as many of you may know that gunfire destroys pop-up targets in Arma (which seems like an oversight).
target1_1 addEventHandler ["Hit", {lane1score = lane1score+1; publicVariable "lane1score";}];
However, recently the "Hit" event handler no longer goes off if the target has damage disabled. I expect this was likely part of one of the recent Arma updates.
Anyone have a simple way I can make these targets indestructible without requiring enableDamage = False? I have a few potential ways in mind but ideally looking for the simplest way possible, as I have a LOT of targets.
HandleDamage event handler
You can return the value you want as damage
If you set {0} will be the same as invulnerable, and you will detect the hits
you're literally talking something like:
target1_1 addEventHandler ["HandleDamage", {0}];
?
You will find more info the wiki, Iβm at the phone atm so find it itβs quite hard π₯²
haha all good, I'm trying it right now here
The handleDamage entry on the wiki is kinda barren, so I'm just winging it
bit of a conceptual question, Lets say I have a per frame handler for each AI (by a certain criteria) I spawn that does something rather simple. So if I have 5 AI that meets this criteria then I would have 5 PFH running .Would it better have 1 pFH that loops through a list (maybe a hashmap) of these AI instead?
Not an expert here but I imagine PFH setup should, in theory, have a low overhead. If not, then your list idea sounds good such that you would only use 1 PFH. Most important is probably that the contents of your PFH is "rather simple" like you state.
yeah so the most expensive part I can see is just get/setvariable, and accessing hashmap inside my PFH. Nothing that would require spawn so no suspending
thats wat I was wondering, cause I say 5 AI, but wat about 100 AI? will teh overhead be significant at that point?
better to have one pfh handling that; if not all meet the criteria then you never touch all of them vs having the pfh cycling every time for every ai
oh so I only add the PFH if its an AI I want to run on it, when I meant 100 AI I meant 100 AI that would have a PFH on it
Yeah if many AI, probably single PFH
out of curiosity really, is there a way to test something like this?
Will it be happening every single cycle of the PFH? Still probably more efficient to have one regardless
Use code performance test I would presume
I was gonna have the pfh run every 1 second, ill try out the 1 master PFH idea then
Probably better to do 1 pfh if it's on more than like 5 ai ngl
if it's just variable juggling the pfh itself will have worse performance hit
makes sense, ill try it out. My next worry is how will I add/remove/update the list of AI that the PFH should check over
idk if there will be any race conditions
Hey everybody. Anyone have ideas why scroll wheel menu disappears when someone dies in scenario multiplayer and gets teamswitched to other character? The menu works fine if switched normally without death
PFH should run every frame by definition. Whatever data you need to calculate, do so outside the PFH, eg in a spawn script that updates every so often, and save the results somewhere you can access quickly in the PFH. The PFH handler should ideally just read cached data and display it in the UI.
I use the CBA one where it has a param for how offten to run
For testing, maybe try it with large numbers (ie "stress test") and see how it performs. Check the wiki for diag commands if you want to try timing code and stuff.
Are you running a script to determine if the AI should be checked? If so can just make a global array/hashmap of all the units, that's what I did in my radiation mod
OIC not familiar with the CBA one. Regardless, still do any expensive calculations outside so you can avoid dropping frames once per second.
yeah in AI init. as for the hashmap how are you saving the unit as a key? do you just do what it says here https://community.bistudio.com/wiki/HashMap#Unsupported_Key_Types
ill try π
I actually use an array because I'm too stupid to use hashmaps, but think you should be able to treat it like a normal array? May need to experiment with that
did u ever have any issues where maybe while ur in the middle of looping through the array, a unit gets deleted, and thus maybe the loop skips over a unit?
nope but that'd be as I was using objects with nearObjects or something with units instead but principle remains the same
probably would have the same issue if deleting the object but iteration would be so short I doubt there'd be issues
completely forgotten i had done it that way around tbh
the natural way of hashmaps
Hi there. I am messing around with the ORBAT system at the current moment, trying to understand how it works, and I'm wondering if there's any way to remove the markers that the "ORBAT Group" module creates. I be pretty new to this, so don't expect me to understand much though.
@vital dome The ORBAT Group module markers are meant to stay all mission. If you want to remove them mid mission, it may be possible to iterate through all markers in the mission and remove them manually, but I haven't tried this.
So far figured that you can add them on the map whenever, but can try and see if that's possible.
Checked real quick with allMapMarkers, seems the ORBAT markers aren't part of this list at all.
Damn. Maybe they use GUI elements then, which is black magic to me.
Ah fair, will just keep digging around then.
Why might this script not work reliably on a server? (Players teams only updated sometimes when it's run)
_players = _this nearEntities ["man", 5];
_list = "Roster: \n";
_players = _players call BIS_fnc_arrayShuffle;
{
if ( _forEachIndex % 2 == 0) then {
[_x] join createGroup west;
_list = _list + (name _x) + ' is Blue\n';
}else{
[_x] join createGroup independent;
_list = _list + (name _x) + ' is Green\n';
}
} forEach _players;
hint _list;
Ah, never mind, it was not executing on Target machine.
Are addactions always handled on the local player?
addaction is local, yes
you can add actions to any object, but addAction needs to be executed on the machine of whoever is supposed to see the action
yes so thats wwhat i mean
in the case that i add an addaction to an object for the player to interact with...Is it considered local to the player? or is it being run on the server inside that object?
basically do i need a remoteExec to send stuff to server from an addaction
if you want an action to tell the server to do something you need to use remoteexec
gotcha, thanks π
Suppose I want to replace a unit's uniform and have it keep the inventory from their current uniform, how should I go about that?
I am so far able to do the replace a uniform part of that task, it's the inventory that's giving me problems. I see i can use uniformContainer but I don't see the counterpart to that whereby I put it back into a uniform
addItemToUniform
theres no need for a PFH at all .. PFH should really only be used for object simulation and UI. most else should be done scheduled since it doesnt matter which frame a thing happens on, and PFH spends a lot of CPU time evaluating that
save the array before iterating over it to prevent this. save the array to a lower variable and iterate over that variable... eg
I'm working on a script to add a long list of items, weapons, magazines, and backpacks to an ammo crate. It must be MP compatible. I see we have addItemCargoGlobal, addWeaponWithAttachmentsCargoGlobal, addMagazineAmmoCargo (global effect), and addBackpackCargoGlobal. Is it wasteful to have this long list of global effect calls? Is there some way to add everything to the ammo crate locally, then do a final network sync at the end? Similar to how the wiki recommends with the map marker mutation local/global effect commands.
Also, is there a command to add a backpack containing specific items to an ammo crate?
Just run it on the server.
I am, but I'm wondering if the network updates can be batched.
Run it on mission start, no issues.
Sorry but that doesn't answer my question. It must be supported mid mission in this case, so I'm wondering if batching is possible or even necessary.
no theres no way to batch the inventory cargo commands
Ok, thanks.
if you were OCD you could just run it locally on each machine but ...
bite the bullet and use the global command, no one will notice
Fair enough, will test it out, if issues that sounds like a good Plan B.
each time a vehicle or unit is spawned, its gear is propagated globally in a similar manner by the engine
it would be nice to have control of the network component, but we dont
Darn. Yeah I'm working on something that will continuously spawn units and vehicles, and want to avoid lag spikes.
my approach to that was to spawn simple object props that players can convert to vehicles
so when the asset is first spawned in its just the model and then later if/when needed it gets simulated with all the bells & whistles
i wonder if a vehicle is "enable simulation false" is its inventory state propagated or if thats held back till simulation enabled ... i dont know
Nice, yeah that sounds like a good balance regarding props.
Not sure regarding that last bit.
In addition to crates, my script also spawns enemy units/vehicles continuously (with throttling and a max number units), kind of like Invade & Annex. Any general tips to keep good performance?
well the throttling and max units is a good start ... really depends on the gameplay. ideal is to spread everyone out evenly over the entire terrain to keep high simulation entities (units) away from players ... but that isnt necessarily fun gameplay
if you get excited and have a spare week or three to bang your head against a wall, you could create an asset recycler ... imagine those crates dont delete, instead just get moved around/hidden. this vastly reduces the amount of crate filling you'd have to do
imagine units/vehicles aren't deleted and then created, but simply repurposed. intercept "deletevehicle" + "createvehicle" with instead an array of "delete soon" objects that are accessible by the "createvehicle" logic for repurpose
I found a solution in using set/get unitLoadout
ah i didnt suggest that since i thought you wanted to add one by one. But good!
@pulsar bluff Thanks for the tips. I'll work on getting even unit distribution and avoiding thick clusters. The asset recycler sounds like a good idea too, kind of like how iOS apps recycle table view cells.
I'll need to bang my head on the wall a few more times for that one.
inb4 custom damage handlers that just teleport the AI unit to spawn when damage threshold is reached to avoid spawning new units
to keep good performance obviously monitor "allMissionObjects" to see any unwanted buildup, rule of thumb keep AI under 100 and reduce the evaluation frequency of any scripts to as-infrequent-as-possible while still getting the job done. this is heresy to the "PFH solves everything" crowd however
so since I just need to run every 1 second, just have a while loop and just use sleep?
Yeah that's what I do usually. Earlier I mistakenly thought you meant you had to display some UI every frame.
0 spawn {
_sleep = 0.3;
private _time = diag_tickTime;
private _everySecond = -1;
private _everyTenSeconds = -1;
private _everyMinute = -1;
while {whatever} do {
uiSleep _sleep;
_time = diag_tickTime;
if (_time > _everySecond) then {
// Do something every second
_everySecond = _time + 1;
};
if (_time > _everyTenSeconds) then {
// Do something every 10 seconds
_everyTenSeconds = _time + 10;
};
if (_time > _everyMinute) then {
// Do something every minute
_everyMinute = _time + 60;
};
};
};```
oh no nothing like that. for context im doing something that has like a recharge per second thing.
fair enough, I always thought it be best to avoid while loops
there is some propaganda against the scheduler/while loops in the "varsity team" modding communities
"varsity team" 
generally if you're making a mod for others to use, you want to avoid them yes ... if you're making a mission in which you control the end product, then the scheduler should take as much of the workload as you can offload to it
while loop without sleep should be avoided, but with sleep its just another tool in the toolbox.... the wrong tool for simulating vehicle movement or GUI (where visual smoothness matters), but the right tool for things which dont need to be evaluated each simulation/render frame
fair enough, ill try this out and see how it goes
I still tend to prefer timers executed in PFH. Store them in a priority queue, and check for expiry each frame.
if you need to do something once every 10 seconds, with "sleep 1" expiry is evaluated ~10 times ... in PFH at 60 fps thats 600 evaluations ... 10 vs 600
You only need one queue though. And there's other benefits like precision and unscheduled execution.
Actually what matters more is what % of frame time
How many times is typically irrelevant
Hey, I'm trying to figure out how to make my intro.sqf to run on the clients only once at mission start, but not after respawn / JIP / Reconnect etc.
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
remoteExec [["scripts/briefing.sqf"],_this,true]
remoteExec [["scripts/intro.sqf"],_this,true];
}];`
So far got this but no luck. Tried using initPlayerLocal and initServer to init it.
what was the problem with initPlayerLocal? I don't think your remoteExec is valid syntax
initPlayerLocal is also executed for JIP and they don't want that
You can't use remoteExec with raw script files, it only accepts commands and functions. Make a function or remoteExec execVM instead
you can do (in initPlayerLocal.sqf) ```sqf
if(!_didJIP) then { execVM "scripts/intro.sqf"; };
oh right
Also, the format is wrong: you're passing the command (or the script file which should be a command) as an array, when a string is expected, and you're passing _this as the targets argument, which contains...the entire params array. Pass _id for that instead.
So this would work? Awesome
it should
Imma try it
if (hasInterface) then {
0 = [] execVM "scripts\briefing.sqf";
1 = [] if(!_didJIP) then { execVM "scripts/intro.sqf"; };
};
This is my initPlayerLocal, looks correct?
Just try: ```sqf
params ["_player", "_didJIP"];
execVM "scripts\briefing.sqf";
if(!_didJIP) then { execVM "scripts/intro.sqf"; };
you dont need hasInterface if this is in initPlayerLocal.sqf
Aigh, imma try that
uuh, still not firing up
Does it make a difference, because I'm running a dedicated server?
I think that should work for client even dedi is running
Well, that doesn't seem to be the case. Imma try locally too
Nope, just something wrong with the script
well you can turn script errors on and maybe add small sleep in intro.sqf because sometimes you need that
I assume you have confirmed that intro.sqf actually works in itself
Yes, it did work earlier
if (hasInterface) then {
0 = [] execVM "scripts\briefing.sqf";
1 = [] execVM "scripts\intro.sqf";
};
``` I ran it like this before and worked fine
The 0 = and 1 = are unnecessary. That means you're saving the return of execVM (a script handle) as variables called 0 and 1.
It used to be necessary to do this in the Editor because of a quirk of Editor code fields, but it's never been required in script files and is no longer needed in the Editor. Since you don't use the script handles you don't need to save them.
The [] is also unnecessary. This means you're passing an empty array of arguments to the script. execVM doesn't require it if you don't want to pass anything. Leaving it won't break anything but neither will removing it.
β‘οΈ It doesn't work because the file path given for intro.sqf has a / when it should have a \ β¬ οΈ
Afternoon all,
Feel like I'm being gas lit here - I know a variant of the classname exists for SmokeShell however it has an infinite duration. Can't find anything about it but I swear it exists!
Anyone remember what it is?
Units lose their side when they die and become civilian
Check the group's side instead, or use the faction
yes because dead units are removed from their group too
they shouldn't be removed that soon tho
they should still be in their group when the killed EH triggers
did you actually verify that using a systemChat or hint or something?
Hi, CLBT is friend of mine and I didn't resolve this one. So I said to him ask here. And glad you helped out.
Weird think here is that , current slash issue doenst give any error. Not on screen or RPT.
It should give error file doesn't found, right?
Β―_(γ)_/Β―
Hi, i want to do a zeus module and need to somehow get the units variable that i drop that module onto. Is curatorSelected the correct command here, since i dont have it selected before i drop the module on it.
I tried looking how ACE or ZEN do it, but i am too dumb to see how they achieve it over on their githubs :/
sorry, i meant curatorMouseOver
with "drop module onto" i mean like how you do with the suppressive fire module or others which only apply when you drop them onto a unit
how local is breakTo? do I need to worry about unique scopeName names between files/functions?
do I need to worry about unique scopeName names between files/functions?
no. but it can break out of the function if that's what you mean
afaik it only cares about the "topmost" (most recent) scope name
The entity that has the module dropped on it is passed to the module code. https://github.com/zen-mod/ZEN/blob/master/addons/modules/functions/fnc_addTeleporterAction.sqf#L18
I have an issue regarding scope. I have defined an array as SESO_playerGear to keep track of players' weapons and magazines. However, the innermost scope of SESO_playerGear is not the same as the outermost scope of SESO_playerGear. Any advice on how to make them equal?
Code is here:
params ["_ammoBox"];
// Generate list of ammo
if (isNil "SESO_playerGear") then {
SESO_playerGear = [];
{
SESO_playerGear = SESO_playerGear + magazines _x;
SESO_playerGear = SESO_playerGear + weapons _x;
} forEach (playableUnits);
};
count SESO_playerGear; //returns 0, SESO_playerGear is [];
you are using global variables. something is modifying your variable elsewhere. scope won't matter with your variable since its global, something is overwriting it/messing it up
you could be running it on multiple "ammobox"es
in schd env
I have no idea why you'd exec something like that schd tho
Indeed, I loop through mutliple ammoBoxes to run this code but I only want to generate the player gear once.
why are you looping then if you only want it once?
I guess I could keep the ammo generation in initServer but I want to keep the code clean and have this in the function
you can still have a function and call it from the init
what's the point of _ammoBox var then?
It's used for adding the gear to _ammoBox
// Remove gear from box
clearMagazineCargoGlobal _ammoBox;
clearWeaponCargoGlobal _ammoBox;
// Add items to box until it reaches random maxLoad
while { loadAbs _ammoBox < random (maxLoad _ammoBox) } do {
if (isNil "SESO_playerGear") exitWith {systemChat "ERROR: No player gear set, ending generateAmmo..."};
_ammoBox addItemCargoGlobal [selectRandom SESO_playerGear, random [0, 0, 10]];
};
both are within the same function
give us a full picture. post the whole function in sqfbin.com or pastebin as well as what you are doing to call the function and where
Sure, gimme a bit
Layer "Ammo"
Basic Weapons [ACR] (testBox)
Basic Weapons [ACR]
Basic Weapons [ACR]
Basic Weapons [ACR]
initServer.sqf
// Generate Ammo
{
[_x] call SESO_fnc_generateAmmo;
}forEach ((getMissionLayerEntities "Ammo") select 0);
fn_generateAmmo.sqf
params ["_ammoBox"];
// Generate list of ammo
if (isNil "SESO_playerGear") then {
SESO_playerGear = [];
{
SESO_playerGear = SESO_playerGear + magazines _x;
SESO_playerGear = SESO_playerGear + weapons _x;
} forEach (playableUnits);
};
// Remove gear from box
clearMagazineCargoGlobal _ammoBox;
clearWeaponCargoGlobal _ammoBox;
// Add items to box until it reaches random maxLoad
while { loadAbs _ammoBox < random (maxLoad _ammoBox) } do {
if (isNil "SESO_playerGear") exitWith {systemChat "ERROR: No player gear set, ending generateAmmo..."};
_ammoBox addItemCargoGlobal [selectRandom SESO_playerGear, random [0, 0, 10]];
};
the reason that array is empty is not because of schd env
it's because you're looping over an empty array of playableUnits I guess
yeah I was gonna say, something has to be going on with playableUnits
I'll log playableUnits in the function and see what it says
Yep, you are right, playableUnits is empty during the function's execution
are you testing in multiplayer? playableUnits I think is empty in single player
I was testing in SP
do it in MP
no it shouldn't be
or am I thinking of switchable units?
Using allPlayers, the function works. The log shows me on the allPlayers array
just confirmed, playableUnits in singleplayer returns []
The usual solution is to use (playableUnits + switchableUnits) to account for both
New issue is this: if I use allPlayers, is it reliable for this script? I fear that using allPlayers means when the function executes in initServer, it will run too early before most players would have finished loading into the mission. Any advice for this?
look at Nikko's comment above
I see, I'll try that. Thanks!
might grab double though
Good note for future scripts. For this function, duplicates are okay.
It won't grab double in SP because playableUnits will be empty. In most conditions in MP it won't grab double because switchableUnits is usually empty:
In Multiplayer, switchableUnits are only available when respawn type is set to SIDE or GROUP, the mission contains units marked playable and player is able to switch to any of those units. On dedicated servers, this command returns an empty array,.
While ya'll am here, there is another script I would appreciate your advice on.
In the mission, the Squad Leader unit is marked as seso_leader within a group called "Bravo". Other playable units are in groups "Bravo Red", "Bravo Blue", "Bravo Green". I want to preconfigure the units' colors and radio channels according to the group they chose to join in the briefing. The following script almost works, excepts for assigning the player to a team. Instead of being in RED, BLUE, or GREEN players who join seso_leader's group remain white. However, the rest of the script, such as presetting their radio channel, runs correctly. Any advice?
initPlayerLocal.sqf
waitUntil {(!isNull player) && (time > 0)};
//Assign Appropriate Color/Team to groups with "Bravo" in name
private _bravoGroupID = groupID (group player);
if (["Bravo", _bravoGroupID, false] call BIS_fnc_inString) then {
[_bravoGroupID] spawn {
waitUntil { time > 60 || !isNull seso_leader};
[player] join (group seso_leader);
waitUntil { ([] call acre_api_fnc_isInitialized) };
params ["_bravoGroupID"];
switch _bravoGroupID do {
case "Bravo": {player assignTeam "YELLOW";[(["ACRE_PRC343"] call acre_api_fnc_getRadioByType), 6] call acre_api_fnc_setRadioChannel;};
case "Bravo Red": {player assignTeam "RED";[(["ACRE_PRC343"] call acre_api_fnc_getRadioByType), 1] call acre_api_fnc_setRadioChannel;};
case "Bravo Blue": {player assignTeam "BLUE";[(["ACRE_PRC343"] call acre_api_fnc_getRadioByType), 2] call acre_api_fnc_setRadioChannel;};
case "Bravo Green": {player assignTeam "GREEN";[(["ACRE_PRC343"] call acre_api_fnc_getRadioByType), 3] call acre_api_fnc_setRadioChannel;};
};
};
};
might have something to do how acre does it's stuff, might be reassigning teamss
try assigning the team after, the acre stuff
or removing acre stuff completely and see if it works
good idea, I'll try that
thought it would be odd because YELLOW gets assigned (the only one that is already in seso_leader's group)
Joining might take a little time, and if you set the team colour before joining it won't carry over to the new group. Try adding a small delay between joining and setting the team.
Hey, is it possible to delete already created particles like smoke or fire? I mean the ones that are in the air. Was trying with #particlesource but, well, didn't work
I need some clarification
if i set a variable lets call it "_myVar" then it would be local to a script
if i set a variable "myVar" and use publicVariable "myVar" it will get broadcasted to all clients and be known as a public variable....
if i set a variable "myVar" without broadcasting it, inside an addaction, is it only available to that player?
context: I'm trying to use a keyEventHandler to move an object (Press the key, move the object 1m in x,y or z). How would i access the object to move it?
when would I want to use the seed syntax of random? what benefit do I get for seeding a random number over just random or gaussian? Not a big math person.
if i set a variable "myVar" without broadcasting it, inside an addaction, is it only available to that player?
that machine, yes
If you want the output to always be the same if the input is the same. For example, minecraft worlds are random but you can always get the same world using a seed if you wish
Anyone know of any scripts that are multiplayer friendly where you can set up a camp to sleep/skip time?
no need to know, we can write one!
see skipTime (to be executed server-side)
Iβll fiddle with it tomorrow when Iβm back at my pc
Ideally Iβd like it be a deployable object (tent, fireplace, chair) that you could then use to skip time
anyone know if its possible to make key handlers overwrite existing keybinds?
does anyone know syntax for addForceGeneratorRTD?
AFAIK it should be possible using CBA keybinds. I am not sure about CfgActions.
Keybinds yeah but I want it for key handlers, so that I can make keys run functions in a script
And then remove them after
anyone have experience using this object oriented scripting shell for SQF?
https://forums.bohemia.net/forums/topic/211621-oop-object-oriented-programming-sqf-scripting-and-compiling/
i've been using it and modified it for my own personal use (made everything lowercase, added extra macros for getting vars/setting vars/executing functions because all three were originally 1 macro). I've found it very useful for making complicated scripting much more organized, and having the option to use OOP is really useful in a lot of cases
OOP LANGUAGE version : 0.5 Release: https://github.com/code34/oop.h/releases/ Wiki : https://github.com/code34/oop.h/wiki reference : Initial project Hi Guys, As certainly a part of you know, its a long time i develop now in OO way with ARMA and OOP. It is definitely great and allowed me to devel...
What is the way to get a list of actually houses/building. When I use things like nearObjects, I get an array of random stuff that is not actually an enterable building like lights, runway_edgelight, etc.
It's complicated :P
You could maybe try nearObjects + nearestBuilding. I don't know if there's a better way to check for path LODs, although I'm not sure every enterable building has a path LOD either.
Anybody knows what defines amount of flinch when you hit a unit?
Is it only affected by projectile impulse amount and nothing else?
I filter it by using the amount of positions a building has
can triggers detect wrecks?
Is there a way to make it so that the Hint Script, when activated, shows text only on the client that activated it and not server wide?
from what ive seen, people using oop franeworks spend most of their time organising and refactoring and close to nil time actually creating anything (for fear of disorganisation?)
its just another wrapper for sqf commands imo
when player A skips time, is player B also wanting to skip time?
where in your code are you using the hint now?
I don't know about any frameworks, but SQF code absolutely benefits from OOP, at least the C kind.
I don't have code written up right now. But it would be something along the lines of;
Player/Client on Server Interacts with Object using addAction
Only the Client that interacted with certain object gets shown a hint
Other Clients connected to server do not have a hint being displayed.
well that's easy then because addaction should be run on each client anyways and each client using the addaction will see the hint and no one else
Ah okay, how would I go about doing it if I want the hint to be activated by a trigger rather then addAction?
any git links to projects done in that style?
player in thislist as condition is good option, in more complex situation you gonna end with remoteexec
https://github.com/CBATeam/CBA_A3/tree/master/addons/statemachine
Something like this i suppose. Instead of location you could use an array or hashmap though.
https://github.com/DayZMod/DayZ/tree/Development/SQF/dayz_code/util
Here's some i wrote a long time ago. Anything i've done since is still private.
Heyo! Dipping my toes into A3 modding and I'm confused about why you need a P drive for it. I keep seeing explanations on how you do it but nothing on why you would need it? Anybody able to help here?
Also apologies if it's the wrong channel, haven't really found one for general modding.
Hello, i have a script to make the heli crash inta designated area and works in the mo editor butbon the dedicated server i can't make the heli invincible. The trigger executing the script is set to server Only.
you dont need P drive for scripting. I think it's just for terrain making etc
Are you using hideObject command?
Nope. allowDamage false
Okey, just thought If you want make heli invincible (like you ask earlier) , there is command hideObject, which is local. And global one ishideObjectGlobal.
And your command does
Enables / disables an entity's ability to receive damage.
Yes?
invincible and invisible are different things
Yeah lol
I don't have any headless client or anything
And thebobject is a vehcile
So don't think it would be changing locality?
Damn I need classes π₯Έ
π€·ββοΈ is it piloted by a player at any point? If yes - it changes locality to pilot's machine.
is there a way to access map properties?
i want to find the closest forest (ideally border), and also town tile.
"FOREST TRIANGLE" in nearestTerrainObjects doesnt seem to work (on tanoa)
P drive simulates the games file structure so a path P:\some\folder\to\file.thing becomes some\folder\to\file.thing in game.
Also all the tools are designed around the P drive existing and being set up right (yes one can make mods without it but usually this means errors get packed in)
In case you do anything more complex and want use mikeros tools for pbo packing with proper debugging, P drive is essential.
Hello scripters!
I'm making addon for manual static/vehicle weapons ammo loading.
The thing is to reammo weapon of vehicle's turret if there is no magazine in it.
Now I've faced with some trouble - how can I count not empty magazines in certain turret of vehicle?
magazinesTurret always returns magazines which were loaded before even if they are empty.
magazineTurretAmmo returns no ammo if magazine is loaded but its not currentMagazineTurret
Using some "workaround" with magazines _veh, but there will be a problem with two different turrets with similar weapons uses same magazines - if even one of this turret is loaded.
Some sample video: https://youtu.be/7TWu07daK7E
until you do modelling or anything beyond just config stuff/scripting you dont really need one
Yeah Iβd want it to skip time for everyone. Weβre doing a Vietnam Alive so no NVGs or anything. So I figured itβs make sense for us to set up a camp to skip time until the morning
Arma 3 syncs time regularly, so "only one player" would only be temporary for them, then synced back to server's mission daytime
Cc @vocal valley
this addAction ["Sleep for 4 hours", { [4] remoteExec ["skipTime", 2]; }];
```that's the rough one, there are BIS functions that do some nice skip text, fadeout etc
ehm so my marker is facing dir south 180, when set to "setMarkerDir 90" ?
depends on marker
Oh.
Yes it will be piloted by a person
If i remove the server checks it should be fine right?
and even so, periodically is an understatement, time sync to server is almost instantaneous at this point, less than 1 second iirc
I thought it was something around 5s, but like a regular one (so if you skipTime after 3s, the game syncs after 2s)
i guess it could depend on hardware, for us even doing it OEF would yield some weird results
Ok.. So i have gotten a test module to work, but only when i write all the code inside the Arguments (like how its done here in the example https://zen-mod.github.io/ZEN/#/frameworks/custom_modules?id=module-function). However, I would like to have the code in a separate file but when doing so (via a execVM) the _object doesnt get carried over into the script file, which is to be expected, but how do i remedy that?
same way you pass arguments to anything
[_object] execVM "yourfile.sqf"
(Don't forget params inside the receiving script to retrieve it)
alright, gonna try that out later, thanks π
it faces right by default then
Hwllo! I am using this script > https://sourceb.in/Usz6bAq3sZ
the heli takes damage and lands fine but ends up exploding when playing on a dedicated server and a person is flying it. i beleive if (local _heli) then{ handles locality? i disabled server only on the trigger
how u run it?
A trigger
what script line?
sorry?
what did u type in the trigger?
[heli, "markervariable"] execVM "crashHere.sqf"
the script executes and disables damage but heli still blows up
is markervariable a valid marker name in the mission?
well i dont know if this helps but the script must be run where the heli is local to the PC
so you could run it on every PC (including server) it should work from there
publicVariable is one option https://community.bistudio.com/wiki/publicVariable
I was never able to make anything like that happen; was nearly instantaneous
^
only exception was an oneachframe but thats obviously resource intensive
ah well, okay then ^^
anyone know how to get the specific # of items a player has?
For example how can i find out how many ACE_bananas a player has in their inventory?
combine items and count
Sorry i should have been more clear in my language
I'm looking for counting how many bananas a player has, not how many overall items
yes, I know, you can do that
it seems items returns just a list, no scalars for how many of each item
If there's more than one of an item it appears more than once in the list
ah so it does
And you can count that, or select and then count
{_x == "ACE_banana"} count (items _unit)```
Yes i got it! Thanks Nikko
How might I get an arrow drawn via BIS_fnc_drawArrow to showup in the zeus map as well?
Best way to override a default arma UI element? (via an addon ofcourse)
Change its config?
Hm - Didn't think of that.. Clearly I've been up way too long.
Check a3\ui_f\config.cpp for the list of Arma UI controls and its properties
Then you can create your own addon with config replacement
Means your script has broken the SQF parser, I think.
Solved: Last line of function being called was _variable = someData; Correct: last line changed to someData;
What blender said, just remember some of them are hardcoded ;(
iirc they are runtime errors
I'm trying to replace the loading screen - I've gotten the one - but how would I go about doing a config replacement?
I wrote a script to spawn ai based off of a list of object variable names, and I wanted to make it so that the ai face the direction of the object itself, and then to also disable their ability to move (but not look around)
// Spawning logic up here
_unitType createUnit [position _x, _group, "unit = this;"];
unit setUnitPos "UP"; // Force the AI to stand
unit setDir (getDir _x); // Make AI face the direction of the marker
unit setPosASL (getPosASL _x); // createUnit doesn't accept ASL ; set unit to proper pos
unit disableAI "PATH"; // Disable the AI's ability to move around
Everything works except the setting direction part, when googling this I found that sometimes it requires a position change to re-sync with the client/server, but I already update their position after the direction.
inhert it and redefine it?
I even tried moving the line of code further up/down to see if maybe that was affecting it, but I had no change in behavior
When printing getDir _x (just with systemChat), it does display the correct direction, the ai is just not set to the correct direction
are you sure it's not just turning back afterwards? you can check getDir unit, and try doWatch to keep them facing the way you want
Doing getDir unit returns 0, and doWatch only makes them look at an object, so I'd have to spawn an object in front of them, and then delete it
doWatch works with position as well, and i mean getDir unit after the setDir.
Sorry - I could probably figure it out on my own, I'm just gonna get some sleep - way too tired for this haha
Doing it afterward does return the correct value, but the ai is still facing the wrong way
But yes
I think they are just turning in place to face the way they want to.
With doWatch I'd still have to find some position in the direction they should be facing and have them look at that
yes. use getPos syntax 3
Well no
You override it
So you just define RscDisplayLoadingScreen or whatever its called again in your addon
Didn't know getPos had that syntax, but when using it to look at a position 5 meters ahead of them, they just look straight down because doWatch only takes a (2d) position
_faceMe = unit getPos [5, getDir _x];
unit doWatch _faceMe;
_faceMe is probably [_x, _y, 0]. set the height before you doWatch
Misread something, yeah it's because the third syntax returns PosAGL
I've been trying to crack the nut of getting a list of road intersections for a while, I think I'm overthinking this. Is there anything out there already that solves this
You are not overthinking it :P
I suppose that means a ready made solution isn't out there waiting to lift me up
How precise do you need it to be?
Is this like "all the road intersections on the map" or what?
Need is a good question, I'm hoping to lay ground work for multiple tasks, but the reason I set out on this boat in the first place was for the purpose of setting up roadblocks and such
In a region, here is a recent test
you can see various false positives
ah yes :P
Overlaps, and short segments at intersections are the key problem generators
There's a routine in Antistasi that will find the real intersection point of two roads. You could use that and then merge close results.
My current angle is to iterate through every road segment, put a polygon around it, and test for points inside it, returning the one closest to the center of that road
You know of getRoadInfo?
What I do is a 2d line intersection between startA->endA and startB->endB.
doWatch actually only accepts a 2d position, trying to pass a 3d one causes an error
but then junction filtering is still pretty fuzzy.
Didn't really need it for my purposes.
It definitely takes 3d. How are you setting the height? https://youtu.be/TcPfTkfiB9o?t=39
Yeah, a line intersection might be the way to go. There's not a method for this in Arma is there?
Nope.
Antistasi Community Version - work in progress - Discord https://discord.com/invite/TYDwCRKnKX - A3-Antistasi/fn_roadConnPoint.sqf at master Β· official-antistasi-community/A3-Antistasi
It's an infinite line intersect. They don't have to actually cross.
Ah
You figure that they're adjacent from the other info.
Okay I guess something just didn't save properly with the file, restarted and it had worked fine
Thank ya for all the help
I think I might have burnt as much midnight oil as I'm going to spend on this tonight. I appreciate the resources/help
Ill give that a good look and see what wisdom it holds
This is more for identifying the correct point once you found a junction, so it's only half of your problem.
It's used with some slightly crazy code that does an A-star with road objects :P
That's what I figured - My only worry is all these damn imports ect - lol
That's the fun part
Hahaha ofcourse it is :D
Dangerous. items can get extremely large, especially while using ACE.
Much better:
https://community.bistudio.com/wiki/uniqueUnitItems
Example 1 has a example on how to check how many of an item a player has
I need some assistance, I am trying to create a script that will make a helicopter loose its engine on an action, and I keep getting errors, I am somewhat new to this language, and I have tried some troubleshooting already, but nothing has worked so far
this addAction ["<t color='#FF0000'>Engine Failure</t>", {(vehicle player) setHitPointDamage ["hitEngine", 1.0];}; nil, 1.5, true, false, "", "true", 5, false, "", ""];
Missing colon between } and nil
Also it is good habit to tell us what exactly is the error
Ive gotten a few the most recent was missing; ] though I checked with notepad++ and I had all the brackets in place
still getting that same error
another question I have is, once this line does work, could I add it to a sqf file and will it be accessable if I use execVM in the vehicle's init
Yes
ok, currently still getting the Missing ] Error
As I said missing colon
this addAction ["<t color='#FF0000'>Engine Failure</t>", {(vehicle player) setHitPointDamage ["hitEngine", 1.0];}, nil, 1.5, true, false, "", "true", 5, false, "", ""];```
o h h, I put a semicolon on accident
thank you
So I got it launching, no errors ect - but it's not overwriting the old RscDisplayLoadMission
Any idea's
cfgPatch <-- ?
hmm? What about it
Did you add the ui_F to the required Addons?
requiredAddons[] = {"A3_UI_F"};
Congratulations ;)
Hi everyone!. Anyone know how reportremotetarget target sharing works?
I have a mission where one greenfor player gets reportremotetarget data fed in from AI on his side showing players of opposing team on map if AI finds them. However this did not work when this greenfor player was as a client, but did work when he was hosting the session. Is side a local entity that can be moved to other client or should the troops (high command troops) be localized to the greenfor player? Any ideas?
If it still doesn't work -> *.rpt is your friend
one greenfor player gets reportremotetarget data fed in from AI
how isreportRemoteTargetused in this case?
https://community.bistudio.com/wiki/reportRemoteTarget
This is running on a repeating trigger
oh the setgroupowner part was e trying to fix it
thisTrigger setVariable ["TAG_detect", true];
thisTrigger spawn {
{independent reportRemoteTarget [(assignedTarget _x), 15];} forEach units independent;
sleep 7;
{_x doWatch objnull;} forEach units independent; sleep 7;
_this setVariable ["TAG_detect", false];}; This is the actual code
And the greenfor player receives this information when he is in a datalinked vehicle
Not working, no errors in RPT
class CfgPatches {
class YOUR_AWESOME_ADDON_NAME {
units[]={};
weapons[]={};
requiredAddons[]={ "A3_UI_F" };
requiredVersion = 1.38;
};
};
class CfgLoadingScreens
{
class Screen1
{
text = "\YOUR_ADDON\YOUR_IMAGE.paa";
};
};
I do notice, it's loading my @addons before /addons/
that is weird, it should work, maybe it needs a remote execution on the assignedTarget machine
The target being observed?
and dont forget about $PBOPREFIX$
or the greenfor player?
If he is using it.
ah wait
assignedTarget requires locality π
okay so does it mean the Ai groups have to be local to the greenfor player?
what
no
it means that the server doesn't know the assignedTarget of a remote unit
can't really one-line this one
ar ehigh command groups local to the server or client?
He should because of image path
"high command groups"?
Groups of Ai soldiers under human high command player
Of course, but i still know some guys, that just pack the addons (without a prefix)
subordinates to human player
Just trying to get it work - I'll add the prefix after :3
doesn't matter, the group leader is AI, the rest is scripts
Okay
The trigger running that script is not set to server only so it should execute on greenfor player too, you have any ideas on what i could do to troubleshoot this?
you can't one-line this
you would need to have a script running locally that would frequently save/update the assignedTarget to e.g the soldier's Object namespace (setVariable)
and the server-only trigger would collect this info and report remote targets by getting the variable (getVariable)β¦ but all that would be network traffic-heavy
ooor something dirty: a remote-exec call
{
[[_x], { independent remoteRemoteTarget [assignedTarget (_this select 0), 15] }] remoteExec ["call", _x];
} forEach units independent;
is it heavy if there are no targets being seen currently? There are total of 10 targets Ai can observe and it would be very rare for them all to see same target at once.
I have file.txt file where I load it to variable like private _string = loadFile "file.txt";
tag1 group1 name1 = true;
tag1 group1 name2 = true;
tag2 group2 name3 = false;
is there a way to identify EOL ( end of line ) ? so I can split string by rows ?
Sigh - still no luck :S
So being a call would mean this gets only excuted when some AI has a assigned target?
Or would this have to be mangled trough eventhandler?
private _string = loadFile "file.txt";
// private _lines = _string splitString toString [13, 10];
private _lines = _string splitString endl;
Are you sure that your addon is loaded?
why specifically that representation? you can just write a valid sqf array and use https://community.bistudio.com/wiki/parseSimpleArray
Trying to adapt the below script to use with the Spawn AI module's Expression field, which behaves as follows: "Code executed when group is spawned. Passed arguments are [<group>,<module>,<groupData>]."
The script in its current form, which virtualizes groups with ALiVE's Virtual AI system:
if ((leader (group _unit)) == _unit) then {
["NONE", [], false, [group _unit], []] call ALiVE_fnc_createProfilesFromUnits;
};```
What would I need to change here, and what would be the best way to get the script to fire? Basically I just need it to virtualize the groups spawned by the module.
Did it work?
it did
great π
that was dataset I was given, sadly
Ahha! I think I got it
the call is doing what you want, once
the "do remote exec a random piece of code" is dirty, that's it
you could reformat it with regex π
new to CfgRemoteExec - tried to read up on the BIKI, forums, etc but not quite clear to me is the following setup:
- mod has CfgRemoteExec. adds a couple of functions with allowedTargets = 0; and jip = 0;
- mission has CfgRemoteExec. with mode=1; and jip=1; for functions class itself
now the mission blocks the mod functions. why is that?
https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec this states the priority and makes sense overall, but shouldnt it still not ignore the mod function definitions?
now the mission blocks the mod functions. why is that?
do you mean "the mission setting is not overriding the mod setting"?
no
the mod whitelists some functions
the mission apparently discards that
Scripting function 'XXX' is not allowed to be remotely executed
the mod has 0 on both mode & jip you said
mode 0 = remote execution is blocked
jip 0 = no flag can be set
OK. Seems that we've used wrong class
Try this:
@tough abyss http://pastebin.com/5weYHEEf
Hi
Can I set explosive damage to 0 via script?
not what i said - mode is not set by the mod. aka the default 2 from A3 itself is active
Does anyone know how i can add a player animation to an action? For example lets say the addaction fixes a vehicle. How can i add an appropriate animation & end it if the player wants to stop the animation midway?
look into handleDamage
ah yep, mixed a level here - mb
check holdAction function
yeah that looks like what i want, thanks!
@mystic shell basically, most of what you've posted in mission_makers does not make sense as an Arma 3 SQF script. π€·ββοΈ As such: consult the documentation at bohemian wiki, it's good.
https://community.bistudio.com/wiki/addAction doesn't mention anywhere setting a _x magic variable, so it isn't likely to do anything useful. From the context, just using player should be enough
_x inVehicle (player inVehicle) doesn't make sense twice. First, if the command takes one argument - it goes to the right. Second - inVehicle isn't a command. See example 2 at https://community.bistudio.com/wiki/vehicle to check if player is on foot.
vehicle vic1 crew _x == driver - same stuff. Doesn't make sense at every literal turn. vehicle is a command that takes one unit as argument and returns the vehicle it's in. So vehicle vic1 is "vehicle where vic1 sits". If vic1 is a variable name assigned to vehicle - just vic1 is enough to reference it. crew is a command that takes one vehicle as argument and returns all units that are inside it. driver is a command that takes one vehicle as argument and returns its driver. If you want to check if player is the current driver of said vehicle, you need to run player == driver vic1. That's all. Except it doesn't sound like a possible outcome given the "vic1 is somewhere remote and player teleports to it". Maybe assignedDriver would work, never tested that.
serves me right for getting ChatGPT to merge 3 different scripts for me lol
Do not use AI generation for scripting. It does not work. It creates things that look like SQF, but it does not understand SQF and cannot be relied on to make good or even functional code.
Half the time it canβt even make SQF cause its so esoteric
one of the first things I did with chatgpt was ask it to write a basic sqf function and it failed miserably
still doesnt work ):
I got this in my init
["FEC", "Transfer AI to HC", {[_object] execVM "fec_hctransfer.sqf"}] call zen_custom_modules_fnc_register;
and this in the fec_hctransfer.sqf (it throws the error that _object isnt defined right on line 1)
params [_object];
hint str _object;
_grp = group _object;
params syntax is wrong in there
in what fashion? Im not very good with scripting
params ["_argument"];
``` needs to be in quotes
throws the same error, but now on
hint str _object
at [_object] execVM "fec_hctransfer.sqf" _object isn't known.
the parameters passed to the code in zen_custom_modules_fnc_register are Position and Object https://zen-mod.github.io/ZEN/#/frameworks/custom_modules?id=module-function
so at the least you need
["FEC", "Transfer AI to HC", {
params ["_position", "_object"];
[_object] execVM "fec_hctransfer.sqf";
}] call zen_custom_modules_fnc_register;
ok, that worked. Thank you π
Hmm
That changes what?
I'm trying to overwrite the whole load screen when connecting to a server
for example
I got it working to a certain point, but it just turns the whole screen black 0.0
That changes startup loading screen :)
Figured
Yeah, trying to override the server connect scren
Yep - screen still stays completely black
:/
Hey guys, any recommendations for adding an event handler to all units placed by Zeus?
I'm using CuratorObjectPlaced right now, but it does not cover vehicle crew. If I try to call the crew of the vehicle, it seems they're not yet spawned in the vehicle at the time of the event handler firing.
params["_curator"];
_curator addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
systemChat format ["%1 has placed %2", _curator, _entity];
if (_entity isKindOf "Man") then {
_entity addEventHandler ["Killed", {
params ["_unit", "_killer"];
systemChat format ["%1 has been killed by %2", _unit, _killer];
}];
}
}];
};```
confirm kill is called on the Zeus module init.
give it a couple years of training
I fixed my issue, apparently the crew not returning was a me issue, not a timing issue π if anyone searches for this issue in the future, I'll leave the solution here for posterity
params["_curator"];
_curator addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
systemChat format ["%1 has placed %2", _curator, _entity];
if (_entity isKindOf "Man") then {
_entity addEventHandler ["Killed", {
params ["_unit", "_killer"];
systemChat format ["%1 has been killed by %2", _unit, _killer];
}];
}
else {
if (_entity isKindOf "AllVehicles") then {
{
_x addEventHandler ["Killed", {
params ["_unit", "_killer"];
systemChat format ["%1 has been killed by %2", _unit, _killer];
}];
} forEach (crew _entity);
};
};
}];
};```
still don't know if "AllVehicles" is safe to use, but it works for now
I wish we could use the debuglog command :(
I'm sure this is going to be a easy solve,
But I'm struggling with DrawIcon3D taking a string.
putting name player directly into the EH works fine, but feeding it from a var isn't? Is there a formatting trick?
_label = name player;
addMissionEventHandler ["draw3D",
{
drawIcon3D
[
"\a3\ui_f\data\IGUI\Cfg\Radar\radar_ca.paa",
[0,0,1,1],
iconPos,
5,
5,
getDirVisual player,
_label,
0,
0.3,
"PuristaMedium",
"center",
true
];
}];```
You are outside the scope.
Ie. You define _label in a separate scope that the drawIcon3D command runs in. So it does not exist.
Solution is to pass _label as an argument, see wiki on how -> https://community.bistudio.com/wiki/addMissionEventHandler
Or define _label inside the eventhandler scope.
Ta, i need to re-evaluate.
Is _vehicle deleteVehicleCrew _unit functionally identical to moveOut _unit; deleteVehicle _unit, or is there a good reason to prefer deleteVehicleCrew?
Anyone got any stats for how accurate base game performance test is? Not entirely convinced setObjectScale of a unit is 0.0005ms 
so im doing an op where the lads storm an AQ tunnel, but i need some help on a few things, basically first the tunnel entrance, im thinking of doing a holdAction and once the thing is done it plays a little fade in fade out to transition the player teleporting into the tunnels, is this possible?
second, the tunnels itself, i'd like if possible for the tunnels to be dark, even if the outside is bright, eg. SOG tunnels, is this possible?
First one is possible, I have a script for it somewhere.
Tunnels aren't possible in MP due to server syncing time. Already asked Dedmen if it's possible for this to be looked at but don't rely on it and certainly don't expect it
well, i did download fata tunnels, so i already got that covered
this addAction ["YourAction",{
[] spawn
{
titleText ["", "BLACK OUT", 2];
sleep 3;
player setPosATL (getPosATL tplocation);
titleText ["", "BLACK IN", 2];
};}];```
however, its just that, i need a portion of the map to be dark once the players are in it (or maybe perhaps after they enter the entrance?)
that'll fade to black, tp the player, fade back out
Not possible in MP as far as I am aware
You're probably passing nil as the unit, which means the command is silently skipped
Nope, I'm using it on a unit and watching it change scale π€
Used inside an onEachFrame as well to make sure and it's working as... "intended"
then idk what black magic they did in sogpf, so i think i should there, lol, maybe its something with post processing? ill look there
It's SP isn't it
if scale is unchanged, it might just do nothing inside the command.
So 10k runs only the first one actually does something
i swear iβve seen sog tunnels basically be darker than the outside, and thats in mp
Scale is changing to 5, on units it changes back to normal the next frame so oneachframe "keeps" the scale π€
i mean inside your performance test run
Possible it's changing aperture then, but I'd double check it exists before trying to go down the hole of realistic tunnels (pun intended)
I think I'm confused by what you mean now
ok bye
roughly same within an oneachframe (within measurement error)
Oh right, I understand what you mean now
But has barely any performance increase I would imagine is from the getObjectScale
Also, how come that moveOut doesn't recommend or require the vehicle to be local, unlike every other command with a similar effect. The only other command like this is deleteVehicleCrew, which also recommends being ran locally.
Is moveOut just superior or is there something going on that's not documented into the biki?
Why do you expect poor performance for this command?
because i would expect more than 0.0005ms for virtually any command that isnt just changing a simple variable
So why do you think it isn't just changing a simple variable?
var = "hi";
var = "hi2";``` has worse performance at 0.0008ms
Well that makes a lot of sense.
not really given thats not even running inside an oneachframe either
That's doing a lot. Two hash table lookups at the least. Perhaps even allocating memory.
That setObjectScale might just mutate some field on the object in question.
Just because you see something happening, doesn't mean there's a lot of code being executed in the scope of that native function you're calling.
Based on the results you're seeing, it really is probably just updating a float on that entity.
base game has a speedometer for code performance test, im using advanced developer tools where you click the stopwatch
- in the debug console
yeah advanced developer tools is made by leopard, get it off steam workshop -- will save you tons of time
How do I get the nearest object of a certain classname, or alternatively the nearest object in a global array?
nearest object of a certain classname
nearestObject
nearest object in a global array
you can either loop over the array and find the closest one or sort the array usingBIS_fnc_sortBy, then pick the first element
Alright thanks, I'd tried this before and it didn't work, but I guess my mistake was elsewhere since it works now.
Ugh damn I just learned a lesson the hard way
should have been using private for so many of my functions
how much has this been wrecking me
Arma 4 needs a less painful language
Ouch. But all programming languages are painful.
Is there a reliable way to get a list of all ground textures used as part of a terrain ground texture? I would like to avoid doing the brute force method by probing a bunch of points through the https://community.bistudio.com/wiki/surfaceTexture method, because you could miss a bunch of textures.
So, you can use markdown in this chat, which will help :)
while{true} do {
diag_log format ["STIME: %1 DTIME: %2",serverTime, diag_tickTime];
uiSleep 1;
};
why would you need that
i would like to be able to select one of the textures in a eden attribute to assign it to a part of the model that is supposed to mimic the ground. But in order to have a dropdown menu with options i first need to assemble all of the options in a list.
the dynamic scoping can be pretty useful though
much not C#
If a player stopped one of their AIs with the command bar stop order, is there any way to undo or at least detect that in script? stopped returns false and stop, doStop and commandFollow have no effect.
commandFollow does the same radio chat as "regroup" but it doesn't unstop the unit.
currentCommand to detect: https://community.bistudio.com/wiki/currentCommand
Pretty sure commandFollow or doFollow should unstop them, but not sure if it works when player used command bar like you mention.
what version u on?
how?
Is there a vectorAdd that takes n-sized vectors?
@peak pond currentCommand works at least. Thanks.
If it's got more than 3 elements it's not a vector, it's just an array of numbers.
There is no such command, but you could slice up your array into 3-element chunks and do vectorAdd on them, or you could make your own apply-based function that can work on any array size.
That syntax is added in 2.11. 2.11 is the current dev branch, to be released in update 2.12. Current main branch is 2.10; if you're on stable, you don't have this syntax yet.
Oh daang
Consider my mind boggled
one because I happened to stumble upon something unreleased
two because something so useful hasn't been added in what, 11 years?
There are a lot of things like that in SQF.
Honestly, for a large part of that time, there have been bigger fish to fry. That syntax is a nice QoL thing but you can achieve the same result by reversing the array and then doing a normal select on it, so it's not technically necessary.
I suppose if you are building a ladder to the moon you gotta a skip a few pegs
BIS had odd priorities⦠they should have had guys like @unique sundial and @tough abyssmen on the project from the start, instead of spending resources on things like Argo
so we are getting all this cool stuff backloaded onto the game
Pinging them at 5am for a random conversation seems like a great way to receive an orbital strike :U
Yeah, I got the language tag wrong
Yes, and we have now achieved Contact with the lunar surface, and it's time to go back and fill in the gaps so it's safe for the tourists to climb it. The last few months have been very good for QoL/weird feature improvements.
yea 2022 was a great year for SQF. i had βretiredβ from arma dev in 2018
but the new stuff (and fixes) was enough to make fiddling interesting again
I can't imagine it being worse than this, I've only been at this for a week and It's like pulling a push mower to get things done sometimes
works for JS
var s = "JavaScript syntax highlighting";
alert(s);
I guess I picked a good time to get into the scene
you wont last long then, and therefore should just quit now to save time π€£
what are you working on @velvet flicker
I got started a week ago making small tools for my unit, right now I'm working on walling off outposts using convex hulls
Honestly the language is the least bad part these days :P
convex hulls?
SQF can be challenging to get into. It's probably actually worse if you already know another language - SQF isn't a normal language, it's a user-facing middle layer that then talks to the game's actual language, which is some kind of C, and that means it doesn't behave how you'd expect if you already have good coding habits. But, once you figure out the principles and learn some of the nerdier commands, it can be pretty powerful.
But then my perspective may be coloured by trying to make AIs do stuff.
so vector/centroid/geometry stuff
Yeah, I think i'm pretty close to cracking the nut. I made a method to draw h barriers along a straight segment and now I just need to get outline going
Note that SQF is very very slow.
im wary of procedural stuff like that. do you have good grasp of surface normals and Z adjustments?
Yeah, most of my fight is just figuring out the SQF syntax to do stuff
i see line intersection tests and bounding boxes in your future
I already did that
theres a little lake in VR editor, good for making sure your stuff works around slopes and water
Helpful to know!
road intersections
Oh you mean line intersections for the walling off haha
Yeah, I have a vague plan for that
what happens if theres a player driving a tank thru at the same moment the wall is being laid down
ah cool
Though I suppose it could be used for such evil...
like a βfortify townβ function
Yeah, that's the spirit of what I've been doing
sounds hard
Tackling it piece meal so if SQF kills it for me they can have the half filled toolbox
Got the hostage script working though
if the result is always the same, could you exec in the editor and then save the result to a file?
Only certain bit work tho..
/*
* 3/5/13
* This program will sort the word "typewriter" in alphabetical order.
*
*/
public class SortingString {
public static void main(String[] args)
{
String s = "typewriter";
for (int i = 0; i < Integer.MAX_VALUE; i++)
{
s = randomSort(s);
if (s.equals("eeiprrttwy"))
{
System.out.println(s);
break;
}
if (i == Integer.MAX_VALUE - 1)
{
i = 0;
}
}
}
how to expose sqf commands not yet available in the build/from special branches, so the compiler doesnt bug out parsing the script?
I use #define NewCommand (psuedo commands)
Something this maybe?
#if __GAME_BUILD__ < 999999
#define thisCommandDoesNotExist ;
#endif
123 thisCommandDoesNotExist [player, "something"];
Probably can cause problems if that command is used in some code structures
Maybe there is a better way?
#define thisCommandDoesNotExist isEqualType
```?
I guess it depends on if command is binary, unary or nular
And what it returns
I was working on that once and had it working, but then never finished it.
I'll put it on the list for 2.14.... nvm microsoft teams todo list is broken and I can't add things. π
poor ded guy
or can just make your own slopes in VR with setTerrainHeight xD
Preprocessor like Sa-Matra posted, look up preprocessor commands on wiki, there are things for game build and game version
What's with HandleDamage triggering on remote units (and doing nothing of course)?
thanks guys πββοΈ
you can still use the event to do other stuff than to apply damage
Yeah, I'm just confused with all its oddities. It firing for some selections and doing nothing, then firing for same selections again but this time damage applies. Having it on remote units triggers the EH but it does nothing there.
Trying to create complex damage tracking system and this mess confuses me
https://community.bistudio.com/wiki/PreProcessor_Commands
am i blind or is there none for branch type? like i want to disable some diag commands if people run stable branch
#if productVersion # 4 != 'stable'
```Should work?
No it doesn't
#if has limited operators
its not sqf script
oof the wiki documentation on #if is actually quite bad
// Very basic #if MACRO OPERATOR NUMBER
// <, >, <=, >=, ==, !=
Guess no way then
Ah game version doesn't work because diag vs normal
Fixed.
#ifdef or #if __A3_DIAG__
starting next dev branch
Now just someone add that to wiki page, thanku
just have it scan its position on init, you won't need dropdown selection
can do. same values like productVersion?
accurate thing in #community_wiki plox ( :
@still forum Why HandleDamage does false fires on local units?
By false I mean they make no sense and their return also doesn't even apply the damage.
Here is HandleDamage log in table form: https://pastebin.com/raw/t7di9apG (_wanted_damage is _damage from EH) All fires are in single frame, first two fires for head and [TOTAL] overall damage do nothing. Why do these events even trigger?
Already raised this topic here a week ago but it still bothers me
no, its 1 on diag, undefined otherwise
dunno. I saw you asking that a week ago and I ignored it because I dunno
Guess its not worth it touching it and leave it broken for compatibility?

Armanormality
I guess I'll just have to build my code around these bugs then have it break if its fixed some day
what is the problem? you can just exit if unit is not local. for other ppl the EH behavior has benefits
Check my log, first two lines is HandleDamage firing and doing nothing (returned damage value is not set)
Then it goes through each selection including these false fires and works properly
That issue of EH firing on remote unit (and doing nothing) is another part of HandleDamage being wonky
_current_damage is actual damage on the moment of EH fire
_wanted_damage is damage from EH array
_new_damage is what EH returns (what it should set damage to)
_saved_damage is script-saved damage, what _new_damage was last time for that selection (or overall)
if they were added in 2.02 yes. I don't remember if they maybe were there before?
Fire 1: head, doesn't do anything, returned damage is not applied
Fire 2: overall damage, doesn't do anything again
Fire 3+: Goes through all selections and overall and finally works as it should
Fire 1 and 2 marked:
i dont have these false fires
if u can give a reliable repro ill check it out
its unusual to use handledamage on remote units
i do have them on local units π€·ββοΈ
or was that "hitPart", lemme recheck π€
"HandleDamage" does produce double fires on "" and "Head" selections for me. productVersion is ["Arma 3","Arma3",210,150255,"Stable",false,"Windows","x64"]
Test environment: 3DEN, one playable unit, one AI unit with following Init: sqf this disableAI "ALL"; this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"]; diag_log ["HandleDamage",diag_frameNo, _this, _hitIndex, _unit getHitIndex _hitIndex]; _damage / 10 }]; part of resulting log corresponding to 2 headshots: https://pastebin.com/in9FZMFr, lines in question: L1 is duplicate of L6, but one frame earlier; 2/3, 10/15, 11/13. The actual hitpoint damage value doesn't seem to be updated after the first instance fires.
_damage / 10 is not how you divide damage by 10
The depends relations may play a role here
class HitHead: HitNeck
{
armor = 1;
material = -1;
name = "head";
passThrough = 0.8;
radius = 0.2;
explosionShielding = 0.5;
minimalHit = 0.01;
depends = "HitFace max HitNeck";
};```
Another element is there should be an event for impact (even on deflection) and another for penetration - in the same frame if I am not mistaken.
As such you can see double entries for "".
works good enough for illustration purposes. I've just needed any dynamic value there π€·ββοΈ Heck, random 0.5 would've worked better, now that i think about it π€£
best to use the shots diag in combination to see what is happening in terms of penetration/projectile path and what selections may have been triggered as a result
https://pastebin.com/Jz0sHd00 with "HitPart" EH added to player's projectile as well. Lists one impact with target model. Target still fires "HitPart" EH in two separate frames, with projectile hitting the ground surface on the first of them already.
also, on the first frame the listed selections are still "head" and "" even when target is shot to the leg π€·ββοΈ
player addEventHandler ["HandleDamage", {diag_log [diag_frameno, _this]; _this select 2}]
Interesting theory about it being related to "depends"
The damage was from falling btw, no penetration or anything
Just falling from few meters
well from what i recall falling damage is special in itself
The issue is the same for other damages too
Grenade self damage
Also adds another event trigger on next frame that does 0 damage
Idential picture when done on another unit (AI)
Shooting a leg of an AI
i still stand by the theory that "bust" and the "body" are separate entities that both count as a target, but "bust" calculations happen one frame early and get dropped :3
π€
i am seeing only head twice here on my end
eyyyy, consistency
dupes both "head" and "" on stable build on my machine as well (["Arma 3","Arma3",210,149954,"Stable",false,"Windows","x64"]). Switching to dev for maximal memeness
dupes on dev as well ["Arma 3","Arma3",211,150223,"Development",false,"Windows","x64"]
Is this an alive unit?
Maybe try non-killing damage?
dupes both even on dead infantry on dev build 
HD is only exposing the underlying mechanic - there is zero chance Dedmen would still change anything with that
you can handle double execution yourself (but beware even multiple HD events can happen in one frame upon penetration)
i am pretty sure its also long known only the last HD event in a frame on the given selection gets applied
you can have multiple stacking EH events. yet if those build upon each other in terms of damage or all prior damage adjustments in the same frame get ignored, i dont reacall. Sa-Matra's logging suggests the latter
0: position (for supported types see BIS_fnc_position). Screen center is used by default
from what i can see the latter statement is wrong - it takes the first selected object as center, no?
is there a way to easily filter weapons/vehicles for arsenal/garage per side/faction?
or is the only practical way to iterate through cfgVehicles and build an inventory of the used weapons/vehicles for the given side/faction
Good day, could you tell me what variable to use so that when entering the trigger, this or that weapon spawns? I figured out the spawn of vehicle, I use "rhs_m2a2" createVehicle getMarkerPos "marker_26"; , but I can't do it with weapons.
example 9 at https://community.bistudio.com/wiki/createVehicle
By the chance, is there any way to enforce unconscious post effect (grey screen, vignette) by script?πΈ
yes, you check if the player is unconcious during a hit, handledamage or EOF EH and then apply a PP effect to your preference
Just use SQL
or C++
How should I set up a command to apply a set of given liveries to a vehicle in the editor? The textures I've found digging through the textureSources section of the vehicle's config entry read:
hiddenSelectionsTextures[] = {"\OPTRE_Vehicles\Warthog\data\M12HogMaav_extupper_co.paa","\OPTRE_Vehicles\Warthog\data\M12HogMaav_extunder_co.paa","\OPTRE_Vehicles\Warthog\data\turrets\m12_turret_co.paa"};
How would I apply these from script?
setObjectTexture in the vehicle's init would do it. Note that those are 3 textures that go together at the same time (one for the upper body, index 0, one for the lower body, index 1, one for the turret, index 2) not 3 alternate textures.
Don't forget to check the vehicle's Virtual Garage options via rightclick>Customise - it may be possible to apply alternate textures without needing scripting.
Yeah, the issue is when they respawn, that doesn't persist/come back. Need to write a small script to apply these attributes from the Expression field of the Vehicle Respawn module.
What about things like camo nets?
So this appeared a week ago on the Wiki: "From Arma 3 v1.53.132890 arrays are limited to maximum of 999999 (sometimes 1000000) elements"
Does anyone have any info why is this changing, as in, is the underlying structure being changed to support something? The only thing that comes to mind is the problems they had with huge arrays stored in profile namespace that were wrecking performance for people.
Just to check by the way, currently calling this as:
_this execVM "vehATHog.sqf";
from expression field, then vehATHog.sqf has:
_vehicle = _this select 0; _vehicle setObjectTexture [0, "OPTRE_Vehicles\Warthog\data\M12HogMaav_extupper_co.paa"]; _vehicle setObjectTexture [1, "OPTRE_Vehicles\Warthog\data\M12HogMaav_extunder_co.paa"]; _vehicle setObjectTexture [2, "OPTRE_Vehicles\Warthog\data\turrets\m12_turret_co.paa"]; clearWeaponCargoGlobal _vehicle; clearMagazineCargoGlobal _vehicle;
it's probably to avoid hackers and script kiddies to destroy your server
What about arrays in arrays?
running a count on an array so big would kill the scheduler
thats not how count works in Arma
or in most languages
WELL
if you use count as it should be
which is with no args
@lone glade That and maybe it is a limit in unscheduled space? ( wasn't it 10k loops ?)
10K loops for schedulded yes
but comparing arrays with such a number of elements, oh boi
The most hilarious thing about the message is "limited to maximum of 999999 (sometimes 1000000) elements"
In true Arma style. "Sometimes". :D
You may need setObjectTextureGlobal, I'm not sure if the module expression is executed globally or server only or what
You can use https://community.bistudio.com/wiki/BIS_fnc_initVehicle to apply virtual garage customisations like camo nets. You can use this to do textures in the same function call, but only texture sets that are available as selectable options in the garage, not individual or custom textures.
Definitely, doing a limited test on the server and the textures didn't apply for clients. Thanks for the tip
Hi. Im trying to rpt log zeus spawns for my server but I cant seem to get it to work. Im trying to use
CuratorObjectPlaced
but because it is local, i cant get it to work to log on the rpt file of the server
@grizzled cliff but I like execVM. :(
@grizzled cliff It's all depends on what you wanna do ;)
make the client send the data you need to server via remoteExec
then server can log it
#server_admins message you were already told what to do few days ago, didn't it work?
nope
my code goes like this
params ["_curator", "_entity"];
private _message = format ["%1 has placed: %2", _curator, _entity];
_message remoteExec ["diag_log", 2];
"HELLO WORLD" remoteExec ["diag_log", 0];
}];
OH WAIT OMFG I FOUND THE PROBLEM
^ how we write proper code
Hello, I need your help please. I created a custom menu to issue commands to my AI squad. Option 2,3,4 work perfectly fine but for some reason option 5 (Follow me) does not show up in the menu and every time when i open the menu via hotkey it immediately executes "spawn CommandDispatcher".
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
mymod_fnc_showGameHint = {
MENU_COMMS_2 =
[
["Submenu", true],
["Move", [2], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""\script\CircleStand.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
["Sneak", [3], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""\script\Circle.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
["Waypoint", [4], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5]] execVM ""\script\Waypoint.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
["Follow me", [5], "", -5, [[[player, "vn_handsignal_move_out"] spawn CommandDispatcher]], "1", "1"]
];
showCommandingMenu "#USER:MENU_COMMS_2"
};
What am I doing wrong and why does option 5 do not show in the menu
?
if you are on PC, the syntax highlight should tell you why
your option code is not in a string, it is directly-executed-in-this-scope code π
and it is perhaps missing the ["expression"] part too
eyy, Lou saves the day
I see
@velvet merlin Tried removing depends from HitHead and making it armor = 1000, still same picture
Still not sure what the correct code is
I guess the engine is hardcoded to damage "HitHead" all the time or something
Tried many things but can't get it working
First it does that hardcoded damage, then overall damage because of it
Then it does normal walk through all hit parts
copy a line from above, and place your code where it belongs in it
π§ remove/rename the head hitpoint and check if it still shows for dupe
I did exactly this before but got errors
Not sure what I did wrong
errors being?
[player, "vn_handsignal_move_out"] spawn CommandDispatcher;
This works fine one a standalone basis but I did not find a way to copy it correctly into one of the existing lines.
["Follow me", [6], "", -5, [["expression", "[player, "vn_handsignal_move_out"], screenToWorld [0.5, 0.5]] spawn CommandDispatcher"]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
This is what I got
see the syntax highlight
if you want a " in a string " ", double it " quote "" here"
Like this?
["Follow me", [6], "", -5, [["expression", "[player, "vn_handsignal_move_out"], screenToWorld [0.5, 0.5]] spawn CommandDispatcher""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
Now I get an error. Unclosed bracket missing.
as you can see, no
["Follow me", [6], "", -5, [["expression", "[player, ""vn_handsignal_move_out""], screenToWorld [0.5, 0.5]] spawn CommandDispatcher"]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
```or better```sqf
["Follow me", [6], "", -5, [["expression", toString { [player, "vn_handsignal_move_out"], screenToWorld [0.5, 0.5]] spawn CommandDispatcher }]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
execVM is bullshit
I will try the first one but the second code is giving me an error
will report back in a min
Arma 3?
yes
what is the error?
ah yes, a comma
right after "vn_handsignal_move_out"], the , should not be there
except it probably should and there should be extra [ before the [player,
or screenToWorld [0.5,0.5] should be removed π€
something fishy is going on
["Follow me", [5], "", -5, [["expression", toString {[player, "vn_handsignal_move_out"] spawn CommandDispatcher}]], "1", "1"]```
Still getting 3 errors. Unclosed {, Unclosed } and Unclosed [
Let me try
wait yep, always a good thing of doing 3 things at the same time π
This one gives the error: Missing ;
When I excecute from the menu. But it shows at least in the menu.
it is not chris5790
but it is used for every shit most of the time which causes it to be garbage
yeah, we agreed to not use this one
what artemoz posted
trying it now. 1 sec
in theory you do can totally ignore that command
with all hitpoints renamed it skips "HitHead" on the first frame/pass and only dupes the "" 
practically, you might want it
if you enable filepatching you can use execVM to reload a config for example
wat
execVM is obsolete since cfgFunctions is there. For final products it should be nerver used
you can reload configs one by one, there's a debug tool on the dev branch available
or so I've heard
This works fine, thank you both. I am just wondering how to incorporate the screenToWorld as I need it for some other commands?
@lone glade talking about variable config shit and only as mind-concept
hey so just to check for this script, the fade in/out only occurs to the person interacting with this right...?
@shut flower im with ya on that topic, however, we wont get rid of that command thus we should at least teach its only allowed usage correctly
because in all other cases ... that command is complete garbage
just this lil one edge case
saves you a few ms
as execVM is one command whilst spawn compile preprocessFileLineNumbers are 3
SQF configs are crap too
actually they are not as they are way faster
configBin >> "anything" is WAY slower then a simple variable lookup
but more dynamic
not rly
you can also setup your config variable to be as dynamic
requires quite some defines etc. but its all possible
if I have the choice between a arrayception or a binary config I will take the binary
thats true
here you don't need it
it is used in the commands above to use the location at which the player is looking, so it doesn't make sense with "regroup"
Yes, that's right but I am have other commands which I want to add which need a location.
then use that
is there a good way to clean up vehicle crew not deleted by BI garage collector that deleted the vehicle?
(aka the crew remains floating at their vehicle crew position - also naked but thats another issue..)
one option.. save the vehicle the crew belongs to. _crewMan setVariable ["vehicle", _veh]; then loop (from time to time) those crew men and see if their vehicle is deleted and if so delete the crew also
Hello everyone, hopefully in the right area here, was torn between this and #arma3_scenario.
I have created a training map in which I would like players to be able to 'Show/Hide' various formations through use of an AddAction on a Laptop. The action will either Show or Hide flags indicating positions.
On the Laptop I have placed the following in it's init:
this addAction ["<t color='##0000FF'>Show All Round Defence Marker</t>", "ambushscripts\showARDmarkers.sqf"];
The 'showARDmarkers.sqf' reads as follows:
ARDMARKER_1 hideObjectGlobal false; ARDMARKER_2 hideObjectGlobal false; ARDMARKER_3 hideObjectGlobal false; ARDMARKER_4 hideObjectGlobal false;
The objects 'ARDMARKER_1' etc, are initially hidden on mission start.
On Single-player this works just fine however not so much on the server itself.
I have utilised Google but found a lot of different options. I was hoping the most suitable could be provided here.
I feel like this is relatively simple but I'm a complete novice so any and all help is appreciated.
haaah less line returns haaah
also ```sqf π
'I'm a complete novice' π₯Ί
hideObjectGlobal is a server-side command; it has to be remote-executed from the client to the server, using remoteExec
in singleplayer, the local machine is the server
[ARDMarker_1, false] remoteExec ["hideObjectGlobal", 2]; // target 2 = server
Ok, thank you. I'll take a look at everything! Would deep dive the wiki if I had more time aha!
yep true. possibly even getIn/getOut EH could be used to set the var
i wonder if getout triggers when the vehicle is deleted π€
I dare say no - also we don't have an "EntityDeleted" mission EH (@still forum? ^^ (too expensive EH?))
I dare say that deleting the vehicle itself might bring a memleak too (if deleteVehicle does when deleting a boarded unit vs deleteVehicleCrew), to be confirmed
Does the "deleted" EH not trigger before actual deletion?
So add it when adding the vehicle to the garbage collector.
Or is the garbage collector adding the items automatically?
ah didn't know such EH existed! but crew _vehicle in the EH returns empty array π
Is there any way to change BIS_fnc_holdKey text message without creating new control? It is Press "KEY" to advance by default
you can copy the function and adapt the string