#arma3_scripting
1 messages · Page 118 of 1
Its just one display for everything, of course
class MyDisplay {
idd = -1;
onLoad = "_this select 0 call myUI2TextureLoad";
};
I dont think that can work for my use case. I need to be able to change one rendered display while leaving the others
Game creates new display for each new texture
To make each texture different through that display, you just pass your needed arguments to it
ok so this IS just to replace RscDisplayEmpty then
Yes, you can't do onLoad in RscDisplayEmpty which is needed for precise display initialization
There is another problem of your textures displayed inside ui2tex display being loaded or not though. Personally I solve this by first reloading needed textures before starting the display.
Same way, just use your own class instead
I've been told that the display initializes only once though when the setObjectTexture is called, and then after that if you try and call it again its just black
Wouldnt this be an issue?
Display is initialized when you see the procedural texture and then stays live.
Hm, I have not had that be true in my testing... If I use it on something far away and then walk up to it, its black since it wasnt being rendered when I called the setObjectTexture
Ive gotten around it by creating a small object in my view, and setting its texture to the display, that way its cached and can be applied to things far away
I suspect your scripts gave up before the display got initialized, thus you had 100% empty display which looks black because faces it was displayed on have no transparency.
I was using a waituntil, so in theory it should have waited until the display was no longer null
Do you think you could provide an example of what you mean by this?
If you display textures inside your ui2tex display and they aren't loaded yet, they might be invisible by the moment display first updates (invisible = black if texture is used on most objects)
I think dedmen tried to solve this by forcing the display to reload or something, but its still an issue on recent stable
Ah ok
How I solve this:
- Display needed textures on UI somewhere hidden
- Then do
setObjectTexturewith ui2texture that uses these textures
Last thing. I dont understand what I would put in the onLoad portion. The way I understand it, I will have already set the objects texture, and created the conntrols that I need to. what is left to do in the onLoad?
You do controls creation in that function instead of after waitUntils
Yes thats what I am doing currently, gotcha, thankyou for clarifying
ahhh, okok
I will give all this a try tomorrow, thankyou for all the suggestions and help!
👌
The more I work with the damage, the more I suffer
How come is player dead after this: https://pastebin.com/raw/GrPyftgG
This is a result of an empty car hitting fully healed player (car setVelocityModelSpace [0,-10,0])
Overall damage is 0.109323, the only parts exceeding 1 are hitabdomen, hitdiaphragm, hitchest but these don't kill you if you set them to 1 with setHitPointDamage
What's going on? Where other damage comes from?
Well, got my answer by asking the question
That's how it works, yes :P
HitBody has depends = "HitPelvis max HitAbdomen max HitDiaphragm max HitChest"; so it gets 1 after engine-driven damage to these parts, but not from script-driven damage
Yup.
and HitBody >= 1 does kill you
I'm not sure if I checked whether that's also true for the HitHead.
HitHead has depends = "HitFace max HitNeck";
BUT it processes in HandleDamage:
["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","head",0.552148,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",2,"<NULL-object> ()","hithead",false]
```unlike `HitBody` 
Oh, because HitHead has armor = 1;, while HitBody has armor = 1000;
Really weird choice
Also no bleeding in such case of damage, only that weird HitHead fire before overall damage. Complete mess.
players dont notice so why bother
Having them see the full picture of how they died after they died would be cool though
for [{_i = 1}, {_i <= 5}, {_i = _i + 1}] do {
_selectedLoot = selectRandom _lootPool;
_triggerPos = getPos (format ["damLoot%1", _i]);
// Create a loot holder at the trigger position
_lootHolder = "WeaponHolderSimulated" createVehicle _triggerPos;
// Add the selected loot to the loot holder
_lootHolder addItemCargoGlobal [_selectedLoot, 1];
// Set the position of the loot holder
_lootHolder setPosATL _triggerPos;
};```
I'm trying to get a single item from this pool to spawn for each "damLoot" trigger i have placed, but executing this code spits out an error, giving this line the fault for the error:
```_triggerPos = getPos (format ["damLoot%1", _i]);```
doing ```_triggerPos = getPos damLoot1;``` works as it should with the trigger.
I have no idea if I'm using "format" correctly or not.
Let me guess, ChatGPT?
lol yes, its actually helped me a few times
Why triggers for loot positions?
ChatGPT sucks at SQF and Arma in general, it doesn't have enough data to train on, so it can only produce the most basic code, anything higher than that and it spits out nonsense.
I don't believe it can help you learn and it certainly won't produce working code for anything more advanced than most basic things
Anyway, you need to do:
_triggerPos = getPos (missionNamespace getVariable format ["damLoot%1", _i]);
Also change getPos to getPosATL
format returns a String ("plain text"), which isn't a variable name.
As Sa-Matra shows, it is possible to procedurally generate variable names using format, but you need the intermediate step of getVariable to parse the generated string into an actual reference to the variable. The string on its own is just text.
is it worth the 200 hours of your expiring life to make it happen (maybe) tho?
No 
Its a sunk-cost fallacy at this point
hahaha
create a sunk cost objective for players as a satire allegory of the dev process of said objective
Q: I need to determine if two road objects are connected, that is, are traversable, between them. they can be separated by any distance, although usually anywhere from 500-1000m or so. it can vary. was looking at calculatePath, but I'm not sure that quite does it. the result needs to be somewhat instantaneous, i.e. "can the two roads be navigated pts A-B". any thoughts? thanks...
you need to write a dijkstra procedure for road connections (the road node + its neighbours), itll also give you the shortest path
it is reasonably instantaneous
use the “roadsConnectedTo” command to get the node neighbours
Yeah it does some magic to see if it tried to load images during the first render, if it did it keeps triggering displayUpdate, until there were not texture loads during the render, plus some backup extra cycles.
But its not very reliable
Cool observation about engine-driven vehicle explosion damage:
17:30:31 ---------------------------------------------------------
17:30:31 "Frame 1157837: Killed Both: B_MBT_01_cannon_F"
17:30:31 ["1a74d24e040# 1825868: mbt_01_cannon_f.p3d (B_MBT_01_cannon_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","<NULL-object> ()",true]
17:30:31 =========================================================
17:30:31 "Frame 1157838: HandleDamageMan: B_Soldier_F (ALIVE=true)"
17:30:31 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",4.00959,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",false]
17:30:31 =========================================================
17:30:31 "Frame 1157838: HandleDamageVehicle: B_T_APC_Tracked_01_rcws_F (ALIVE=true)"
17:30:31 ["1a5cacb0080# 1818587: apc_tracked_01_rcws_f.p3d (B_T_APC_Tracked_01_rcws_F)","",0,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",false]
17:30:31 =========================================================
17:30:31 "Frame 1157838: HandleDamageVehicle: B_MBT_01_cannon_F (ALIVE=false)"
17:30:31 ["1a74d24e040# 1825868: mbt_01_cannon_f.p3d (B_MBT_01_cannon_F)","",1.47041,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",true]
Tank blew up, _directHit is true for self damage from that explosion, false for damage to other entities
Still wishing for a better damage source info somehow
Just realised that it didn't work in my case because I used old ui2texture inside ui2texture to solve aspect ratio issue, so maybe it does work (your engine-driven updates were called for inner ui2texture while outer didn't update)
So don't quote me on your fixes for texture loading not working, I still use old hacky approach
Mostly working attributing damage towards EPE collisions 
Impossible to say who collided with whom of course
Why you put a comma after a line break 
Comma after line break gang 
Seriously though, its just easier to add new lines to arrays this way, I forget about trailing commas all the time, this solves it for me
So uh yeah, if you crash into a vehicle it will share the damage with?
_array = [
"Some data",
"Some data but longer so its harder to see if you have a comma or not"
];
```and if you add a new line
```sqf
_array = [
"Some data",
"Some data but longer so its harder to see if you have a comma or not"
"Some new line"
];
```its much harder to spot missing comma than if you had it like
```sqf
_array = [
"Some data"
,"Some data but longer so its harder to see if you have a comma or not"
"Some new line"
];
```you instantly see that there is no comma for the new line
Maybe 🤔
PHP spoiled me by letting me have trailing commas without next item in array
It seems to be somewhat random, some vehicle gets the damage, other doesn't, both get damage, none get damage
I base it off what engine provides in HandleDamage and if there is EPEContactStart on the same frame, I change no-source damage (_ammo="" , _source=null) to whatever was in EPEContactStart arguments
You also get buildings in EPEContactStart so I end up with damage reports with buildings as _source (_from_vehicle in my naming)
If only all this was provided by the engine right away, would've been much easier
Another difficulty would be figuring out how to attribute this damage to crew, its easy for local crew but remote crew doesn't trigger anything, just gets some damage number and that's it.
Anyway, enough boasting about the progress, time for more suffering
it is
cant you save locally a record of the last 3 second of vehicle movement, flag a collision with epe force to send both clients record to server for analysis
How do you tell who's at fault though?
analysis
Manual after the fact?
if you had the last 3 second of player movement from both parties
you could reasonably calculate fault, even automated
Just realized what I said, it IS possible to know who collided with whom, EPEContactStart reports two objects, meant to say who's at fault
As in who rammed whom
Often, but not always, you can slowly get in a way of fast moving player for example
i use things like proximity to road for fault
IE if player gets rammed while standing on a road, their report is given low weighting. if they are rammed while on hillside, then report given higher value
same with aircraft and helipad/runway. if you report a pilot for damaging you (on foot) while hes near a helipad, then your report is very low weight
ramming vehicle on vehicle is trickier obv
Hmm, good ideas, perhaps you can decide who's likely at fault with some meta data
and weighting based on likelihood
also need to handle report griefers, the kind who step in front of your car
but for vehicle ramming id just capture the vehicle movement and blame the one at higher speed where they are facing the target
after enough reports i just “soft lock” players. can still play but no vehicle turret/driver access, bullets deleted if there is a friendly in center area of screen, tiny movement penalty
keep them on the server to pad the server stats but limit their enjoyment
also speed limited zones for vehicle ramming “black spots” like heli pickup points. i want to use cruise control for it but velocity dampening just works
🤔
sounds great, thanks...
it's all about the style... it is a personal choice though, bit of an acquired taste.
ah for recursion... thanks again
Hello, is it possible somehow extract informations about mods from mission file, but to get exact name of mod, not of addon, or steam id of mod?
getLoadedModsInfo ?
That returns all the mods that are loaded, not only those used by the mission
use allAddonsInfo
_cfg = loadConfig "mission.sqm";
_missionaddons = getArray(_cfg >> "addons");
_mods = getLoadedModsInfo;
_alladdons = allAddonsInfo;
_missionMods = [];
{
_addon = toLowerANSI _x;
_addonIdx = _alladdons findIf {_x#0 find _addon >= 0};
if (_addonIdx >= 0) then {
_modIdx = _alladdons#_addonIdx#3;
if (_modIdx >= 0) then {
_modName = getLoadedModsInfo#_modIdx;
_missionMods pushBackUnique _modName;
};
};
} forEach _missionaddons;
actually allAddonsInfo returns the addon prefixes 
so you should load the cfgPatches name manually...
I guess using configSourceMod makes more sense here:
_cfg = loadConfig "mission.sqm";
_mods = getArray(_cfg >> "addons") apply { configSourceMod (configFile >> "cfgPatches" >> _x) };
_mods arrayIntersect _mods;
Great, this works, but for some mods, it returnet me empty name..
["","@CUP Terrains - Core","expansion","@Šumava","@Unconventional Actors","enoch","@3CB Factions","@ace","@CUP Vehicles","@RHSUSAF","orange","@CUP Units","curator","@RHSGREF","@Task Force Arrowhead Radio (BETA!!!)","@CUP Weapons","mark","@Arma Srbija-Dodatni Modovi","@RHSSAF","@CUP ACE3 Compatibility Addon - Weapons"]
First one is empty
that's a vanilla "mod" (A3)
so you can just remove it (_mods arrayIntersect _mods) - [""];
plausible road connectivity algo. iterative in nature. thoughts?
assumes player is nearby a road object to start with.
yanks at the connected roads threads until there is nothing further to pull.
ideally might like to 'simplify' as a recursive algo, though.
seems to work, and is reasonably quick about it.
_x = player;
_local = 25;
_i = -1;
_maxdist = 1000;
_mindist = 500;
_x nearroads _local params [['_root',objnull]];
_threads = [[_root]];
_thread_counts = [0];
// iterate while there are still growing threads
while { (_threads apply { count _x }) isnotequalto _thread_counts } do {
_y = _root;
_thread_counts = _threads apply { count _x };
_threads_to_pull = +_threads;
_threads = [];
{
_thread = _x;
_term = _thread param [0, objnull];
_roads = roadsconnectedto _term select {
!(_x in _thread) // putting the dijkstra in, preventing circular results, CRITICAL
&& { _x distance _root <= _maxdist }
};
systemchat format ['_i = %1, _thread = %2, _roads = %3, _thread_counts = %4', _i, count _thread, count _roads, str _thread_counts];
_i = _i + 1;
// grow the number of threads, or preserve the current one
{ _threads pushbackunique ([_x] + _thread) } foreach _roads;
if (_roads isequalto []) then {
_threads pushbackunique _thread;
};
} foreach _threads_to_pull;
};
// drop threads not meeting min dist criteria
_threads = _threads select {
_term = _x param [0, objnull];
_term distance _root >= _mindist
};
[_root, count _threads, _threads];
Thank you a lot, it means a lot 🙂
(_threads apply { count _x }) isnotequalto _thread_counts
if the number of connections repeats in 2 iterations, it won't work
also this is not exactly how a dijkstra algorithm is written
ideally might like to 'simplify' as a recursive algo, though.
in SQF the recursive one might get too slow
re: dijkstra, as I understand it, preventing the repeat visit. but I'll review my notes on the subject nonetheless.
re: connections, this is kind of the point, when the new connections are exhausted, that's the terminal case, there is nothing further to iterate.
my results are, [1788043: ,48, [...], [...]] which seems like a healthy result so far.
well I mean the count of your "old" connections are the same as "new" ones
yes, which is the point. the connections are only growing when there is a new connected road off the terminal one.
do you remove stuff then readd them to the list? (then iterate over them all over again?...)
in this case, yes. re-start with a fresh list. either preserve the current, or add the mutated set from the new connections. i.e.
{ _threads pushbackunique ([_x] + _thread) } foreach _roads;
if (_roads isequalto []) then {
_threads pushbackunique _thread;
};
Your going to find some issues. I have an astar road pathfinding system I am working on. In my esperience, I encountered not all maps are thoroughly connected esp around bridges and intersections. You'll come to a dead stop when you don't expect it. I wrote a system that actually fixes that by examining the while map and making my own nodes. Supports right and left hand drive. Adds 10 secs to load time but can pathfind across any map in a few seconds by batching the algorithm several nodes per frame.
also with the caveat that in ARMA, we are not guaranteed road connections are bidirectional. i.e. because B is connected to A, does not necessarily mean vice versa i.e. A-B is the case
I'm working right now but I can post a vid later and the source code
i just changed an sqf variable from "DOGDOG" to "CAT". I am so excited.
was just mentioning that caveat...
huh interesting, so you fix the unidirectional connection issue?
Did I mention I did this in C++? ;)
Yes, I use road connected to as a base but then do other searches. Check direction, etc.. Some maps namely altis, the main roads aren't even a proper class.
in a recursive approach, I would aim to take the mutated case, its terminal, and rinse and repeat the whole procedure. ideally.
as I said recursive one will get slow in SQF
right... roads in general, terrains, are not classes. covered that here in a prior thunk as a matter of fact. I'm not even that concerned about that much.
using a loop is better
true true might not be the best way to approach this particular algo.
i've got strings and numbers down, need to tackle arrays
I am making a libraary of hashmapobjects so this is a hashmapobject that builds the road system: https://github.com/XPS-Group/XPS_A3/blob/main/addons/pathfinding/typedefs/RoadGraph.sqf
and objects are easypeasy
Here is the ddocumentation on how to use it. (oops wrong link) here is correct one: https://xps-group.github.io/#SQFClass:pathfinding.XPS_PF_typ_RoadGraph
as a graph? really? i.e. with potential for circular patterns?
Q: is that a hashmap of hashmaps? just curious...
yes, I have a RoadGraph object that has RoadNode objects
which uses an AstarSearch object and JobScheduling object... it's fully OOP
I havent announced anything about it because of bug fixes with createhashmapobject still in dev
It also needs some work and refinement but you can use that code to see what I do
what I mean is, if there are any circular hashmap references. that can be problematic.
Is there any way to track if the current waypoint of a drone is 'LAND'?
no - no circular refs
It's an A* search graph
sure fair enough... Q: will it be intent as a serverMod, eventually? might make some sense, unless there is a need to make the thing public on all machines. depending on use cases, usage, etc.
A star or A Kleene search graph, right? I like it...
Yes my intention is to have it as a module you can place on a mission eventually but by being a hashmap Object you can inherit and override functions and tweak to your needs
on a mission yes, but serverMod, not mod, i.e. server side only. not intended for client side. i.e. for those server side scripts, state machines, or whatever.
have not explored createHashMapObject much yet since it was deployed. but it sounds interesting.
Yes, it can be made into a server mod. My intention is to have the mod which has the library of hashmapobjects which would be required client/server but then you could make a server mod that uses them.
Actually technically wouldnt need to be client side if you do it right
I'm all for helping reduce the mod set whenever possible. not opposed to adopting a serverMod, though, along similar likes as the Advanced Towing, genre, right...
If you know any java/c# etc.. my mod is like a core library for them. ala .Net / JDK etc..
yep.
I have some modules I am considering a similar deployment pattern.
one LINQ style analog, functions like where, sum, zip, selectMany, aggregate. I even fixed couple of buts with BIS_fnc_sortBy, my LINQ_fnc_orderBy. to name a few.
I would be interested in seeing that when you complete it.
LINQ_fnc_orderBy I am encouraged by... besides supporting the baseline sortBy intent, has the added nice benefit of emulating a LINQ style [orderBy, thenBy [, thenBy ...]], if you understand how that pattern works.
something which is rather broken if you ever tried that in sortBy.
I do! Worked with that stuff for 10+ years. Loved LINQ when I was doing ERP apps. I'm trying to work in Extension methods into my system also but it gets a bit.... wordy lol. SQF syntax isnt great for OOP style
there paradigms are dissimilar, to say the least. the intent there is not paradigm parity, only emulation. i.e. if there is an extension method pattern that seems useful, and can be expressed in SQF, adds value, etc. of course, if the basic operators, your select, apply, etc, work, then just use those.
or as the dotnet community likes to brand recently, idiomatic.
sum for instance, surprised there is not a Math or Statistics primitive for this, or even BIS function, right. so that seemed like an obvious winner to me. or more generally aggregate, has some interesting use cases as well.
Right, I was just considering how to emulate Ext Methods on Hashmapobjects. Which don't have all the niceties of an actual OOP lang like method signatures and type safety. Just trying to emulate the ability to take a pre-made HMobject and add functionality without having to pull it from say another mod and recompiling it into another.
I am interested in the LINQ stuff though.
but I like also incorporating SQF patterns like magic variables. making an effort for that to be consistent with the BIS functions, primitive operators in general, i.e. your _x, sometimes also _y, or in the case of orderBy, consistency with the sortBy function.
but I find that is also the benefit of a language idiom that SQF expresses. I try to do a similar thing in my secondary objective framework, 'OOP' style functions. just a shame that a proper OBJECT does not have such a mechanism.
well... caveat it does and it doesn't. just in how we use setVariable, getVariable. but not quite the same with the underlying intent of a createHashMapObject.
In my testing, hashmaps alone as like a property container or variable container was faster than setVariable/getVariable when you include having to make an actual object as a store. If you are just using units, vehicles,buildings, etc.. its same speed. But for example in A* and such where you are creating and throwing away things hashmaps and hashmapobjects are insanely quick
oh yes, I use HASHMAP for things like options sets in some places, telemetry is another example, when it makes sense to do so, simple KVP scenarios. but in the case of OBJECT, bit unavoidable there, because it is also intent that the objects may be shared across network.
fascinating talk, good luck with your stuff. you've also scratched a bit, got me piqued somewhat, to consider packaging, publishing my LINQ stuff. maybe next iteration or so when I come up for air will seriously consider that.
Sorry to have buried your question but, I don't think it's easy to check because I think it's a scripted waypoint as it is defined in the config? not 100% sure about that. Just replying to give my two cents and bubble this down in case anyone has further ideas other than checking if waypointtype == "SCRIPTED".
Ok, thanks!
You might be able to use https://community.bistudio.com/wiki/waypointScript and see if the return contains e.g. "land"
SQC is a neat thing (which I hope I can post a link to in a few minutes but content control blocks something on it)
OK, apparently it just is the "hidden" link part
@dreamy kestrel just some @ because also relevant
I have been working on the script for a long time (its been my pet project to learn scripting in arma) but I am stuck the issue of how to delete the lights if a "generator" is turned off. right now there is no way to remove them including the toggle lights zues module as well as deleting the assest its used in
``
_light = "#lightreflector" createVehicleLocal ASLToAGL getPosASL this;
_light setLightIntensity 300;
_light setLightAmbient [1,1,.6];
_light setLightColor [1,1,.6];
_light setLightConePars [300, 0, 1];
_light setVectorDirAndUp [[0,0,-1], [0, 1, 0]];
_light setLightDayLight true;
_light setLightUseFlare true;
_light setLightFlareSize .5;
_light setLightFlareMaxDistance 30;
_flare = "#lightreflector" createVehicleLocal ASLToAGL getPosASL this;
_flare setLightIR true;
_flare setLightIntensity 1000;
_flare setLightAmbient [1,1,.6];
_flare setLightColor [1,1,.6];
_flare setLightConePars [300, 0, 1];
_flare setVectorDirAndUp [[0,0,-1], [0, 1, 0]];
_flare setLightUseFlare true;
_flare setLightFlareSize 3.5;
_flare setLightFlareMaxDistance 30;
``
deleteVehicle
Everything that is of type "OBJECT" and was created prior can be deleted using deleteVehicle
deleteVehicle _light? if I have many of these will it delete all of them? again im using this to learn so some obvious things may not be so to me just yet
It will delete whatever you stored prior
Imagine the _light thing as a box
With = you put something in that box
Everything you do with _light will refer to you taking contents out of that box
And putting the contents back (aka: you never empty that box unless you do a =)
there is one special exception to this rule, and that is so called "scoping"
A scope usually is defined by the {}
oh ok nice so i can just do a trigger with something like when this is alive deleteVehicle _light
If you have a "box" prefixed with a _ you then will be local to that scope (which means that your box (variable) will become unavailable at the point where you leave the scope (}) initially created it by putting something in it using =)
Hope that helps
ok so I should use = intead of _ to widen my scope allowing it to be changed in the future
Hey people, I'm working on a custom curator module and I got some questions if anyone here has experience with those.
How does the curatorInfoType -display if used interact with the function that is played when the module is placed. Presumably the idea is that values are passed from the display to the eventual function (e.g. defining the length of a time skip).
Hello i've added an action for a vehicle,
Is it possible to timeout this action so it does not show again for 5 minutes?
When the action is used save a variable somewhere with the current time.
Then add a condition to the action that its not to be shown if the current time is less than 5mins from the time pulled from the variable.
correct, to prevent camouflaged malicious links
Hi guys,
can anyone help me with the If function? I've been trying to find the right syntax for the boolean but can't seem to get it right
Here is the code:
_caller = p5;
if ((_caller == p5) or (_caller == p6) or (_caller == p7) or (_caller == p8)) then {
hint "1";
} else {
hint "2";
};
this should work
if (_caller in [p5, p6, p7, p8]) then
{
hint "1";
}
else
{
hint "2";
};
```should work as well
yes that works 🙂
Thank you
here's the if doc https://community.bistudio.com/wiki/if
Is there a way to disable voice chat on a custom radio channel created with ‘radioChannelCreate’ ?
The wiki isn’t suggesting anything like that
https://community.bistudio.com/wiki/enableChannel
Pretty much it suggests you can
ah, of course its hidden inside a different command 
there is the Radio & Chat category 😉 https://community.bistudio.com/wiki/Category:Command_Group:_Radio_and_Chat
Yes, I think that is neat also. I discovered that about a week ago by accident. Great idea. It's an attempt at a new language though and a bit beyond what I am doing. I would probably use it or play with it if I didn't have so little free time.
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Don't bring ChatGPT here
Already seeing too much of it on r/armadev
Having such code often
private _unit = driver _vehicle;
if(isNull _unit) then {_unit = effectiveCommander _vehicle};
```makes me wish for something like
```sqf
private _unit = driver _vehicle orIfNull effectiveCommander _vehicle;
orIfDead too, perhaps (alive check)
It's a common construct but there are probably too many common conditions to make it worthwhile.
Yeah, perhaps its too specific.
ENTITY || ENTITY 
won't fit for alive variant though
I know you want engine based, but doesn't CBA have something like this?
or what about these?
private _unit = [effectiveCommander _vehicle, driver _vehicle] select (alive driver _vehicle)
private _unit = [effectiveCommander _vehicle, driver _vehicle] select (!isNull driver _vehicle)
no worries, you'll have to highlight a bit, what am I looking at?
mentioned tangentially in my reference to LINQ...
Yeah, still nowhere as pretty as a single command and much slower than original construct.
[driver _vehicle, effectiveCommander _vehicle] select { alive _x } params [["_unit", objNull]];
thats unfortunate
We don't want to debug a code that nobody knows what and how it would work, and even no then after a if
You mean you don't want to see:
"Can someone help me find why my code won't work"
Posts 200 lines of generated code with syntax issues throughout
this is true and i have only ever seen things lol, i havent done script stuff till now.
Anyway, i have an issue regarding a simple script that i seem to not understand
Reading someone else's code is pretty painful job to do after all. Even if who wrote is months ago me
guilty lol
im trying to make something to drop chemlights via Keybind/Keypress
doesn't ACE already do that for you? with throw options, drop, etc?
with this you wont need to carry chemlights
in inventory
with what youre referring to id need to have the grenade item
config for the bit im referring to
post init for after keypress
i dont script, so dont bash me too hard lol
https://cbateam.github.io/CBA_A3/docs/files/keybinding/fnc_addKeybind-sqf.html
since you are using CBA
i've got the basic framework working, i get ingame change keybinds thats all sorted its just on keypress there is no Chemlight at my feet lol
it throws an error in RPT
DropChemlightYellow = {
_chem1 = createVehicle ["Chemlight_yellow", _chem>
22:35:31 Error position: <createVehicle ["Chemlight_yellow", _chem>
22:35:31 Error 0 elements provided, 3 expected
22:35:31 File zulufunctions\functions.sqf..., line 6
22:35:31 Error in expression <5];
you are defining _chemPos after you try to create the chemlight
you are feeding createVehicle something that doesn't exist yet
hm, i see what youre saying. i just have such little knowledge of scripting lol
just switch them around
Pretty much almost everything will work top to bottom not vice versa
If you have something defined but in bottom, won't work
curious if you are new to scripting, why are you are jumping right into the CBA framework?
this is my first time even remotely making script and i did it very wrong lol so i appreciate the assistance
documented and CBA is required by most things
why not start near the heart of it
I don't rely on CBA though
if there is other easier alternatives, i dont mind you sharing i just thought everyone utilized CBA honestly.
I noticed that today, all your stuff AFAIK is independent
CBA is great, especially their state machine and their unscheduled per frame handler/execute system. you just are diving into the deep end first.
DropChemlightYellow = {
_chem1 = createVehicle ["Chemlight_yellow", _chem>
22:50:54 Error position: <createVehicle ["Chemlight_yellow", _chem>
22:50:54 Error 0 elements provided, 3 expected
22:50:54 File zulufunctions\functions.sqf..., line 6
22:50:54 Error in expression <5];
};
think it spit the same issue out
i dunno honestly lol, i just do whatever i see most common
forgot to flip them in my functions.sqf
just read that RPT a second time and noticed that lol
hold up, so you are defining this function in two different places?
well at first i was doing 1 keybind, for all the chemlights with CBA option to change color of the Chemlight that you drop rather than doing what im doing now and making each individual one a keybind
forgot to comment out my Functions.sqf
i shouldnt need it i believe.
actually, after reading the function, I needed to use addVehicle on the vehicle crew I created
right now, your function isn't secure. nafarious people can overwrite it.
define your functions either in CfgFunctions or use PREP in CBA
XEH_PREP.hpp
then you include that in preStart and preInit. preStart caches it in uiNamespace, then compileFinal's it.
Gotcha, ill see what i can break 💀
if you are on the ACE discord, this series of comments tells you why:
Fun fact: it doesn't recompile a function in uiNamespace when recompiling is enabled and if you use that function in uiNamespace you might get very angry that it hasn't been recompiled.
Another fun fact, it only recompiles anything inside "CfgFunctions"
Hmmm I think if they are in PREP they are recompiled or I might be wrong.
Another fun fact: It used to be illegal in Switzerland to have only one guinea pig. They didn't want them to feel lonely since they are such social animals.
A different syntax for sqf, which makes things more streamlined with other languages
And "direct" oop support, even tho a tad bit outdated as now I could add in full support thanks to hashmap pseudo objects
hallo, i have this script that i got from the internet
nul = [9000] execVM "AL_intro\intro.sqf";
how do i make it remote exec to all machines at once
Use remoteExec
what would be the exact code? 🤔
[[9000],"AL_intro\intro.sqf"] remoteExec ["execVM"]```
Well, it follows the rules of sqf, so not really much new to learn 😂
would anyone happen to know why the BIS_fnc_exportEditorPreviews when trying to export via DLC as seen in example 4 and 6 in the wiki doesnt seem to work and just pops up with this error? https://community.bistudio.com/wiki/BIS_fnc_exportEditorPreviews
https://cdn.discordapp.com/attachments/221488699484012566/1182971079841546240/image.png?ex=6586a2ab&is=65742dab&hm=a125816497c6bd89ce70a52b399eec73841647d8b31ab0e3002fee86e0533a53&
What exactly you've done
I originally just used the Marksman DLC one and just replaced Mark with the name of the DLC i want
and when that didnt work, I just wanted to test the Orginal code, to which also gave me the same error
I call that a summary and not what I want in order to help you. What code you've used
fair fair
my bad
1 sec
[nil, "vehicles", [west], ["OPTRE"]] spawn BIS_fnc_exportEditorPreviews;
Literally just that, even [nil, "vehicles", [west], ["mark"]] spawn BIS_fnc_exportEditorPreviews; didnt work
Didn't work how? The error you've posted?
Yes
At least the later one did work very finely for me
No, your something is broken
Oh
It's very easy to verify. You can just run in vanilla, so you know who is the faulty
loaded nothing but base Arma and still got it
Looked into the function
_mods = param [3,[],[[]]];
``` (`["mark"]`)
then
```sqf
_mods = +_mods;
{
_mods set [_foreachindex,tolower _x];
} foreach _mods;
```and then
```sqf
{
private _list = getArray (configFile >> "CfgAddons" >> "PreloadAddons" >> (_x # 0) >> "list");
if(_cfgPatches in _list)exitWith
{
_dlc = _x # 1;
};
}foreach _mods;
```it iterates through it as if it was array inside array and not just a string
_fnc_getDlc changed at some point, looks like function is bugged now
tragic
The exact code worked very finely on 2.15
Bugs out in ["Arma 3","Arma3",214,150957,"Stable",false,"Windows","x64"]
Maybe its fixed in dev branch then?
Try the dev branch
fair enough, yeah, I saw the blurb on 'extension functions', for instance.
though with such a time investment in SQF, not sure I'd ever shift to SFC at all.
but curious nonetheless, thanks...
@tough abyss could always RYO patch function for the time being...
that's what I ended up doing to work around the complex ordering algo bug with BIS_fnc_sortBy.
now my LINQ_fnc_orderBy works very well.
There is not much of a difference beyond a syntax tho 🤪
beyond syntax... he has jokes... 🤣
what's an LALR grammar between friends right...
16:58:37 No entry 'bin\config.bin/CfgPatches.rocket_s_r'.
How do i know what mod this is?
Anyone know of a simple farming/mining script/github link?
It is js in sqf 
And I hate js
js in sqf? I'm not sure I follow. as in JavaScript? what's wrong with JavaScript?
Yea that worked, Thanks
I've got a question about https://community.bistudio.com/wiki/publicVariable
"Using publicVariable too frequently and/or with a lot of data can cause other aspects of the game to experience bandwidth problems."
Does it only count for the publicVariable command or or also for the variable itself?
I don't understand the question.
publicVariable is potentially expensive because it's a network broadcast.
The word count very much confuses me in this context
Uhm, what I meant is: the warning says the frequent use of publicVariable might cause problems. But does this also count for the call of the variable itself or only for the command?
call of the varaible as in?
if u mean use that variable after make it public no, its already broadcasted
publicVariable broadcasts it once and once only. If you then modify that variable on one machine, that value isn't broadcast anywhere else unless you use publicVariable again.
hey guys not sure if this should be in here or config makers as its a bit of both.
im trying to turn some code I made for a mission into a mini script mod for a community that requested it.
The below code is saved in a file called "ResupplyBox.sqf" the code worked when running in a server init file for a mission but I changed it slightly for turning it into a mod. I added the Params that come from ticking the box in eden editor (added in the config.cpp ill post after this) and just changed the param of the object the addaction is running for.
params ["_targetEden", "_value"];
[_targetEden, ["<t>Resupply</t> <img size='2' image='\a3\ui_f\data\IGUI\Cfg\Actions\reammo_ca'/>",{
params ["_target", "_caller", "_actionId", "_arguments"];
loadout = [_caller,[localNamespace, getPlayerUID _caller]] call BIS_fnc_loadInventory;
_target setVariable [getPlayerUID _caller, false];
},nil,100,true,true,"","_target getVariable [getPlayerUID _this, true]",3]] remoteExec ["addAction", 0, true];
This is my config.cpp and the file structure of the mod is
@MaddonutsToolBox
addons
ResupplyBox (this is packed to PBO for testing ofcurse)
functions
ResupplyBox.sqf
config.cpp
mod.cpp
class CfgPatches
{
class ResupplyBox
{
name = "Resupply Box";
author = "Maddonut2";
url = "";
requiredVersion = 1.60;
requiredAddons[] = { "3den", "A3_Data_F_Decade_Loadorder" };
skipWhenMissingDependencies = 0;
};
};
class CfgFunctions
{
class TAG
{
class ResupplyObjectFnc
{
tag = "RSO"; //RSO_fnc_ResupplyObjectFnc
file = "functions";
class TAG_fnc_ResupplyObject {
file = "ResupplyBox\functions\ResupplyBox.sqf";
};
};
};
};
class Cfg3DEN
{
class Object
{
class AttributeCategories
{
class MaddonutsTools
{
displayName = "Maddonut's Tool Box";
collapsed = 1;
class Attributes
{
class ResupplyObject
{
displayName = "Is Resupply Object";
tooltip = "This will make this object a resupply object and add a one time use button per player to resupply their loadout from the last loadout they exited the Ace Arsnel with";
property = "ResupplyObjectProp";
control = "Checkbox";
expression = "[_this,_value] call RSO_fnc_ResupplyObjectFnc;";
defaultValue = "false";
};
};
};
};
};
};
I wonder why isSimpleObject doesn't return true for map-placed simple objects (bushes, rocks, etc.) that don't have a class name?
Is it really different kind of object or it checks for object being mission-placed?
@royal quartz This is going to make a function called RSO_fnc_TAG_fnc_ResupplyObject. Probably:
class TAG_fnc_ResupplyObject {
oh whoops thanks.
i have just modfied it from
class TAG_fnc_ResupplyObject {
To
class ResupplyObject {
will test now thanks
Did you set a prefix on your addon PBO or are you using the undocumented implicit prefix?
no I havent, I am just using pbo manager to pack the file to a pbo not the arma 3 server tool addon builder
You can set the prefix manually in PBO manager, but bear in mind that it creates broken PBOs that won't load with signature verification enabled.
currently thats fine as im just doing this for testing the mod by add it as a local mod, once I publish it I will use the addon builder and sign the files
k
I tested with the code change I made above and it dident work so I guess your saying I need an addon prefix to point the cfgfunctions in the .cpp file to the right .sqf?
I don't know. Dedmen said that addons without a prefix get a default one based on the filename, but I don't think that's documented anywhere.
Safer to set a prefix anyway. In your case it's just ResupplyBox
ah so just setting it as the addon folder name
and then will I need to change anything in the config.cpp for the location of the .sqf for the function?
well, you're addressing the function file as ResupplyBox\functions\ResupplyBox.sqf
The prefix is where the ResupplyBox at the start comes from. Hence prefix.
oh right I see okay ill use addon builder to define a prefix repack the addon and see if that fixes it (also made the change for the function being called wrong thanks!)
You can edit the prefix manually in PBO manager.
Hmm, maybe you can't add one there, only edit them.
ah no, you can right-click in the box.
Ahh its actually documented on this article how to add one with PBO Manager by just placing a file in the addon folder 🙂 and it works.
https://community.bistudio.com/wiki/PBOPREFIX
Just tested with these changes though and it still dosnt run the .sqf file. Copying the code out of it and running it in debug console works. (ofcourse changing _targetEden to a objects variable name.
@meager granite Are you around, do you think you could give me a hand with the display stuff?
My textures are loading as black, and last night you gave this suggestion to fix it. However I cant get it to load as anything but black even when I "refresh" the textures by applying them to a different object
_
It does look like I have found another solution to fix the screens I was creating not being deleted, Which was making the waituntil infinite. So the problem is solved. If you do have the time though Sa-Matra, id love to send you the onload code to see where I went wrong
Sure, I can have a look
This is the code that creates it at the start of the mission:
UIE_texHashMap set [_uniqueUIName,_x];
_unit setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("UIE_Display","%3")', _texSize#0, _texSize#1, _uniqueUIName]];
And this is what the onLoad looks like of UIE_Display:
params ["_display", ["_config", configNull]];
_uniqueUIName = displayUniqueName _display;`
_tex = UIE_texHashMap get _uniqueUIName;
_screen = createSimpleObject ["J3FF_screenTest", AGLTOASL positionCameraToWorld [0,0,0], true];
_screen setObjectTexture [0, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 512, 512, _uniqueUIName]];
systemChat (format["%1",_tex]);
_pic1 = _display displayCtrl 1001;
_pic2 = _display displayCtrl 1002;
if ((ctrlText _pic1)=="" && (ctrlText _pic2)=="") then{
//Re-apply the original camo texture.
_pic1 ctrlSetText _tex;
//Apply the blank blood texture.
_pic2 ctrlSetText "";
};
//Update Changes.
_pic1 ctrlCommit 0;
waitUntil {ctrlCommitted _pic1};
_pic2 ctrlCommit 0;
waitUntil {ctrlCommitted _pic2};
displayUpdate _display;
deleteVehicle _screen;
@meager granite ^
How does your onLoad looks like?
Why have _screen and delete it right away?
You don't need ctrlCommit for ctrlSetText btw
The onLoad just calls the code that I showed above
You have waitUntils so its probably spawned or execVM'ed
The _screen is something I used to use to cache the texture when it was too far to be rendered
But _screen will create only if you're already close for it to be rendered, because its the moment of your UIE_Display creation
I use call, and it never gave any errors, which thinking about it is kinda strange. I did however try it without the waitUntils and had the same results
setObjectTexture doesn't create the display, looking at the texture does
So you if you set the texture for a far away entity, no display will create until camera is looking at it
You're right, Im confused at the order and how you go about refreshing your display when it would be black otherwise
Im on perf profiling btw
Another odd thing was that the unload wasnt firing for the display. I just had a systemchat in it and it never fired
Just tested it and it works properly, no black textures
Added stripes to vehicle textures
Textures werent loaded before
Spawned a new vehicle that I didn't see this game launch, worked properly again
Spawned brand new vehicle 1km behind me (didn't see it this game launch yet so neither texture nor model was loaded)
- Vehicle spawned, nothing in chat (no textures loaded yet)
- Turned around, some textures loaded (that are needed for low LOD)
- Going closer, more textures
- Up close, textures are properly loaded for ui2texture
So I guess dedmen's fix did work
Hm alright, so im just doing something wrong then
maybe its my config:
class UIE_Display
{
idd = 6767;
onLoad = "call J3FF_fnc_setControls";
onUnload = "systemChat 'UnLoaded'";
class Controls
{
class RscPicture;
class pic1:RscPicture
{
idc = 1001;
text = "";
x = 0;
y = 0;
w = 1;
h = 1;
};
class pic2:RscPicture
{
idc = 1002;
text = "";
x = 0;
y = 0;
w = 1;
h = 1;
};
};
};
Here is a mission I threw together for this test
Execute in debug console:
["I_MBT_03_cannon_F", 1000] call func_createTexturedObject
will spawn a tank 1000 meters behind camera
Do a fresh game start, go into this mission and spawn some vehicles and let me know if you'll have a black texture anywhere
It doesnt recognize your function haha, I guess its not initializing, hold on
Your code works
Try reducing yours until its close to mine
I've reduced it until it is now fundamently the same, or atleast appears to be to me, and it still doenst work
Hold on, I made a mistake. I think its working now
maybe its because I was using precreated controls instead of creating them like you were?
Shouldn't be an issue
Try getting rid of waitUntils and displayUntil, make sure you call your function with your display from onLoad
I assume the code you posted is J3FF_fnc_setControls?
yes
My onUnload still doesnt run, should that happen when the texture isnt loaded anymore? Like if I go out of its render distance
Not sure how it works exactly, display probably gets unloaded once texture is unloaded completely
Through FLUSH or something like that perhaps
Looking away or having camera far away shouldn't be enough for texture to unload
Or that onUnload is just ignored, like it was for RscTitles until recently
Ah alright ill do some performance testing and determine if I need to unload it manually or not. I was finding lots of displays to be a little laggy before
Thankyou again for all your help with the onLoad stuff, was annoying trying to make it work
You don't need to worry about unloading, game handles that itself
Note that onLoad is weird and gets called before the display's controls are created. Hence people often spawn from it instead.
Is that why using existing controls might be an issue?
Try systemChat'ing them to see if they're null?
I haven't read your code. It's just a common error.
Good point. My code recalls the part that creates the controlls at some points so I was just checking if they existed and if not then creating new ones. I didnt think to reuse it here
Thought I could make cool flaming texture tank but it looks meh
Either way ui2texture is cool
Wreck has a separate texture that you can't control, might have looked better there
Hatchback wreck is retexturable and it looks alright-ish there
How do you get it to come up on your screen when you do it? I was looking earlier and couldnt find a simple way
private _test = findDisplay 46 ctrlCreate ["RscPicture", -1];
_test ctrlSetPosition [0.2*_forEachIndex,0,0.2,0.2];
_test ctrlSetText format ["#(argb,%1,%2,1)ui('ui2TextureDisplay','%3','ca')", _w, _h, _display_name];
_test ctrlCommit 0;
```below my `_veh setObjectTexture ...`
Does anyone knows how audibleFire values, in ammo config, translate to distance in game? The MX has something like 45, the UGL has 30, while welrod from SOG has 0.035. Is it a curve or a linear interpolation or what?
nvm it was a bugged map lol
#arma3_editor message
Hello. Can somebody help me?
I'm assuming you have this placed in the init of the unit? Does this unit belong to a mod where it does custom loadouts during init?
It is in Init-section of RWR mod unit
As far as I know
What should I screenshot to help you?
Are you using 3den enhanced? It will help you find what I'm going to ask for faster
Yes
Ok, right click the unit and click find in config. Then in the config select the subclass event handlers. See if there is a property called init and see if it is loading a custom loadout function
config didn't show up
Link me the mod. In the mean time, copy your current load out to a base arma unit and use the same code you have above and see if it works.
This is a big modpack, it would be too much to ask you to do this.
Then try what I suggested with using a base arma unit
I did, same result
I see an error in the console, but it's not from here.
But i can remove weapons from debug console
But other unit's under AI control is stripped
what...
When stuff like this starts to happen, remove all mods and see if the code works in vanilla.
also please don't crosspost, thank you
how would i go about editing an already existing faction, im looking to edit the NATO faction and replace everything with modded gear
are you SURE you want to edit vs duplicate and edit
wdym
if you replace the NATO faction, your mod will not be compatible with vanilla and can cause conflicts with other mods that use the vanilla as their base classes
its best to use the base classes of the vanilla factions as an inherit for your new classes
i see, im looking to edit the whole faction so i can use it in the singleplayer campaign
Hey folks!
Do characters have mempoints for different body parts? I kinda wanna see if I can attach stuff to specific body parts.
oh i see. well sure then. hop over to #arma3_config is where you need to be then. i'll help you there
they do. they are called selections
when you use attachTo, you can attach things to a memPoint
thanks Hypoxic!
hey guys i have a small datatype problem. i need a number but unfortunately the datatype of a position is a string. how can i convert it?
(getArray(configfile >> "CfgWorlds" >> worldName >> "Names">> "hama" >> "position")select 0)
return = "2280.96+2560"
Hey. Is there a way to reduce/remove weapon sway? I tried setCustomAimCoef but it doesnt seem to do anything
I am using ace
parseNumber only gives me 2280.96 but not the sum
try without ACE
Well... ace is a requirement. But ace guys helped me out over on their discord.
ace_common_fnc_addSwayFactor
just some random assumption @placid root ...
your config says position[] = {"2280.96 + 2560", ...}?
because thats BS in its purest form
configs do not know SQF ((think there was something with the _EXEC macro to make it work, still its bad practise))
Go to your ACE Fatigue settings in addon options. Adjust the sway sliders there. ACE added an infinite loop that you can't toggle off at the moment for their sway settings. It will constantly be running setCustomAimCoef.
Double-click a waypoint On Activation: vehicle this land 'get in'; and the heli flies up without me. I'm following a yt tutorial but this part is not working. How to make heli wait until I get in?
well i want to get a insurgency mission working on all locationtypes on PR Fata. unfortunately PR decided to put it's position coordinatea as a sum in a string. now i am trying to fix it in the insurgency script handling some exeptions
call compile
and yes that's what the position[] says
that was easy ^^
thx
i love you works like a charm
{
if (typeName _x == "STRING") then
{
_this set [_forEachIndex, call compile _x];
};
} foreach _this;
};
_result call _toCompiledArray ;```
feel free to use that lil function @placid root
should work
but maybe it does not
my sense of humour is absolutely broken because why is this the funniest thing ive seen all week 😂 😂
thx ^^.
private _players = allUnits select {isPlayer _x};
_players findIf {alive _x && !(_x in myVehicleHere)} == -1;
that goes in the waypoint completion condition
there's no return value!
yup
so?
it expects an array reference dude :P
_arr = _result;
_arr set [1, "MEH"];
diag_log str (_result select 1);
//RPT contains "MEH" now```
thats also why i said "might not work"
it should if arma handles arrays consistent
if it does not (which is something i never checked) then the code above will not work indeed
Hi all, still looking at somehow implementing this if not already existing - https://77th-jsoc.com/forum/viewtopic.php?f=36&t=11256&sid=7fec5c49f4e823952e7bceb6f129efd7
register teleporter module
well i guess it doesn't solve your exclusiveness to the teleporter, might have to add that in on the next patch. it does do side exclusion though
Thank you, the unit I am in already has something similar, with the option to select a location, though I am looking for linking two singular teleports up
Hi guys cant seem to define this function correctly. Below is the config.cpp I am trying to call it in the new eden attribute defined in the config too.
Calling it with, which is commented out as I have it working with "ExecVM" but I would prefer to have it defined as a function
expression = "[_this,_value] call RSO_fnc_ResupplyObject;";
class CfgPatches
{
class ResupplyBox
{
name = "Resupply Box";
author = "Maddonut2";
url = "";
requiredVersion = 1.60;
requiredAddons[] = { "3den", "A3_Data_F_Decade_Loadorder" };
skipWhenMissingDependencies = 0;
};
};
class CfgFunctions
{
class ResupplyBoxFnc
{
tag = "RSO"; //RSO_fnc_ResupplyObject
file = "ResupplyBox\functions";
class ResupplyObject {
file = "ResupplyBox\functions\fn_ResupplyObject.sqf";
};
};
};
class Cfg3DEN
{
class Object
{
class AttributeCategories
{
class MaddonutsTools
{
displayName = "Maddonut's Tool Box";
collapsed = 1;
class Attributes
{
class ResupplyObject
{
displayName = "Is Resupply Object";
tooltip = "This will make this object a resupply object and add a one time use button per player to resupply their loadout from the last loadout they exited the Ace Arsnel with";
property = "ResupplyObjectProp";
control = "Checkbox";
//expression = "[_this,_value] call RSO_fnc_ResupplyObject;";
expression = "[_this, _value] execVM 'ResupplyBox\functions\fn_ResupplyObject.sqf';";
defaultValue = "false";
};
};
};
};
};
};
I can see the function in the config viewer with it pointing at the file but cant call it.
You're missing the Category class
class CfgFunctions
{
class RSO
{
class Category // Not in your config
{
class ResupplyObject {
file = "ResupplyBox\functions\fn_ResupplyObject.sqf";
};
};
};
};
I though the category name is changeable to whatever you wish to name your category? put a comment in the line below? Or do I specifically need one called "Category"
class CfgFunctions
{
class ResupplyBoxFnc // <-- this is the category?
{
tag = "RSO"; //RSO_fnc_ResupplyObject
file = "ResupplyBox\functions";
class ResupplyObject {
file = "ResupplyBox\functions\fn_ResupplyObject.sqf";
};
};
};
This is 3 levels. You need 4.
ahh that edit helped me understand thanks
so you can change the TAG to whatever your TAG is
and the category name too? but you just need 4 levels
Right
If you don't specify the file attribute then it uses the category name to determine the file path.
But even if you're specifying all your paths manually you still need the extra level.
id prefer not to specify the paths manually I just couldnt get it to work so I guess this would work?
class CfgFunctions
{
class RSO
{
tag = "RSO"; //RSO_fnc_ResupplyObject
file = "ResupplyBox\functions";
class ResupplyObjectScripts {
class ResupplyObject;
};
};
};
and then the path forthe function would be "ResupplyBox\functions\fn_ResupplyObject.sqf"?
and then I can call it via call RSO_fnc_ResupplyObject;?
yes it works! thank you so much guys
You don't need to specify tag = "RSO"; - it will be automatically detected based on the top-level class being RSO
ahh okay thanks Ill remove that line aswell
how do you do inline code snippets? I only know how to do blocks
Something else I wasnt sure on is when writing mods how to you get scripts or functions to e.g on respawn, or when a player is initialized.
im talking about these files from missions but in mods
initPlayerLocal.sqf
onPlayerRespawn.sqf
If you don't have a mission in your mod? You need to use preInit or postInit attributes on an init function. In the case of respawn, you'd add an event handler for respawn.
yeah id want some code to run on respawn and on init of the player only if that tick box I created in the eden editor is ticked. So I guess I just need to find out how to add an event handler for that but i guess I can do it just with the CBA function.
CBA_fnc_addEventHandler
Use single `
Note that syntax highlighting is not available for inline code, only for blocks
ah cheers
I am creating a vehicle that spawns in front of the player, in the direction the player is facing, and as close to the terrain as possible to prevent the vehicle from bouncing or falling which will kill the player if they move too quickly before it settles. However, sloped terrain is an issue since I want the vehicle to be pitched at the same angle as the terrain.
Here is the code I have so far:
_vehicleClass = "B_T_QuadBike_01_F";
_player = player;
_spawnPos = player modelToWorld [0,3,0.8];
_spawnDir = direction _player;
_vehObj = createVehicle [_vehicleClass, _spawnPos, [], 0, "CAN_COLLIDE"];
_vehObj setDir _spawnDir;
[_vehObj, 15, 0] call BIS_fnc_setPitchBank;
_vehObj setVelocity [0,0,0];
This works, but if I go to a different hill or terrain, the pitchBank angles still tilt the vehicle at a different angle than the terrain. Any idea how I can automate that so that it always uses the correct angles no matter the terrain slope? I'd imagine that I'd want to automate the setPitchBank and Z-index for modelToWorld -- just not sure the best practice on doing that.
Any particular vector commands? I'm pretty new trying to do things with vectors so not exactly sure where to start. 😅
setVectorDirAndUp
setVectorUp alone might also be enough, but it won't be a precise direction depending on a slope
_vehObj setVectorUp surfaceNormal _spawnPos;
```instead of `setPitchBank`
I think this is working correctly, thank you all. 🙂 The only issue I am seeming to have now is needing to automate the Z-index for _spawnPos's modelToWorld - otherwise it spawns in the air instead of snug against the ground the moment I change slopes.
Rocks or other obstacles is fine, if someone deploys it in such a way then I feel like that's on them lol.
This fits in after the surfaceNormal line?
after you set the _spawnPos
Seems to be working ❤️ Thanks for the help!
I wonder, is there some limit to PIP displays on at the same time? While testing a security camera system I noticed that 1 out of 9 camera screens will always appear black.
When resetting them the 1 black screen is always the last display being re-enabled, meaning it's not a specific pip camera being broken.
I would usually recommend spawning a vehicle about 0.5 to 1 metres above the ground level. This will give it space to land on top of any small obstacles or irregularities in the ground (spawning at the bottom of a dip, for example) instead of clipping with them and exploding, and such a short fall is survivable without damage for most vehicles.
Makes sense. 👍
is there some easy way to stop units freefalling
setunitfreefallheight doesnt re-evaluate if unit should continue freefalling
(for obvious reasons)
Maybe switchMove
i wouldve preferred to not set animation but if thats the only way to do it then fair enough
switchMove does not actually do it 😄
Are you trying to stop someone who is actively falling?
trying to change it to freefalling
not freefalling
other way around
freefalling to regular falling after change in unit freefall height
Do you need them to be in a standing position?
the normal falling that happens if you fall off a building or something
If switchMove doesnt work then all I can think of is to make the unit land on a surface and then switch the animation to standing and then resume the falling.
You could use a invisible object for them to land on for example
player setUnitFreefallHeight -1;
player setposasl ((getposasl player) vectorAdd [0,0,200]);
0 spawn {
private _veh = "babe_helper" createVehicleLocal [0,0,0];
sleep(0.1);
player setUnitFreefallHeight 1000;
_veh setposasl (getposasl player);
sleep(0.1);
player switchMove "afalpercmstpsraswrfldnon";
sleep(0.1);
deleteVehicle _veh;
};```
this seems to work *ish*
just test code but
ideally it will work in mp without too much bullshittery
oh you dont actually need the sleeps 😂
well fuck me, you're right, i just tested it
its callen "pass by reference"
thats why you sometimes see stuff like
foo = +array; in peoples code
and thats also why you should not change an arrays content inside of a function
((unless you do exactly that lil +array thingy :)))
i just don't get it, i'd have thought
_arr = _result;
would make a copy of _result
hello, looking for help on a piece of code i had
systemChat "DEBUG: part 1";
_wp = createTrigger ["EmptyDetector", getPos player];
_wp setTriggerArea [100,100,0,false, -1];
_wp setTriggerActivation ["GROUP","PRESENT", true];
systemChat "DEBUG: part 2";
if (triggerActivated _wp) then
{
systemChat "DEBUG: part 3";
(driver (vehicle _x)) action ["engineOff", (vehicle _x)];
_x action ["Eject", vehicle _x];
};
sleep 10;
} forEach [Hunter1,Hunter2]; ```
Only part 1 and part 2 fires, the trigger does not activate at all. Script is for 2 hunting squads to come for the player. The seeking scripts are not here, if someone could help much thanks
is that... while true do {} forEach ...?
or have you just got really really badly indented code
its stupid but eh works for now
it doesnt.
Um yeah
is this chatgpt generated
no i just suck at coding
refer to biki
you cant do that.
use advanced developer tools for syntax stuff in debug console
Huh?
elaborate please
Oh alright
it will give you a better debug console
Cool thanks
What are you trying to do anyways?
The hunters are on trucks, so when they are in the radius of the player the troops dismount
What is Hunter1 and Hunter2? Unit, vehicle, group?
group
I have no idea how triggers work 
I don't know much either but i used this (And it worked (Multiplayer server))
_trgspos = [8148.1,14199.3,0];
_trgs = createTrigger ["EmptyDetector", _trgspos, false];
_trgs setTriggerArea [750, 750, 0, false];
_trgs setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trgs setTriggerStatements
[
"vehicle player in thisList",
"
if(ExilePlayerInSafezone)exitWith{};
[""|> Entered Buffer Zone <|""] spawn ExileClient_gui_baguette_show;
if((driver (vehicle player)) isEqualTo player) then {vehicle player setCruiseControl [0, false]};
",
"
if(ExilePlayerInSafezone)exitWith{};
[""|> Left Buffer Zone <|""] spawn ExileClient_gui_baguette_show;
if((driver (vehicle player)) isEqualTo player) then {vehicle player setCruiseControl [0, false]};
"
];
That's because you think like a sane person :P
So if the vehicle drives into the safezone it will automatically stop?
It was for limiting speed when players drove into safezone (because #arma)
Oh, ok actually yeah imma try that
The code inside was just as example for the trigger ^^
Ok
How does this "GROUP" activation even works? I can't find any answers 🤔
Trying to synchronizeObjectsAdd player to trigger and other way around, trigger still never triggers
i think i just activates when everyone is inside
Whole Group - This option is only available if the trigger is linked to a unit. The trigger will activate when the linked unit's entire group satisfy whichever of the six conditions below is being used.
PerhapssynchronizeObjectsAddis not right command to link through a script?
Can you even link entities through script at all? Can't find any other commands.
Is it just an editor thing?
Wish there was a way for color procedural texture to be non-1x1
For dynamically making text and list image spacers of needed width
@candid sun nope
its valid for values
but arrays are references to arrays
has to do with the underlying logic behind it
_arr2 = _arr1;```
is more or less this here:
```char[] arr1 = {1, 2, 3, 4};
char* arr2 = arr1;```
arr1 contains a pointer to the first element
and you give arr2 the value of the pointer
thus both point to the first element of the same array
See, the insanity :D
i'm not sure i want to go further in learning sqf...it seems dangerous to mental health
@candid sun thats programming in general
do not do it if you enjoy being normal
Actually, many languages will let you have value semantics - the sane way. C++ included.
C not so much.
There are some fairly good reasons for this reference semantics thing, but making sense was not part of it.
ehrm ... in nearly no language you will have value semantics with arrays and objects
the reason why you do it is also simple: speed
If you stay away from the C part, C++ will easily allow you to do it - and thus use reference semantics only explicitly.
it wont "allow you to do"
you fucked your code if you do so as it is unperformant
pass by reference is way faster as soon as you go above a single value value
as you do not have to copy everything first and instead just the reference to one object
in most cases you also just want to read from an object
Use vector<int> or array<int,5> instead of int x[5]. Use string instead of char*. Then you have to explicitly use & to get reference semantics.
i'm no expert but i'm half decent in php and i prefer it's method of dealing with arrays
even if it's also a horrible language
$bar = $foo; // copy
$bar = &$foo; // reference
and what will you do in all those cases @gray bramble? pass by reference
why? because it is faster
there are barely cases where you want passByValue
It doesn't matter if it's fast if you cannot get it correct because you cannot reason about it.
feel free to read
reason why is because it is fucking expensive to do passByValue
as you have to copy the whole object
I "grew up" in C, so I know that stuff.
I would have loved a const ref construct in sqf, btw. But I don't see a way it could be done reasonably.
tbh ... you should just think how many poorly optimized scripts you would have then
most would not know whats the difference and just ignore it straight thus ending up in a copy mess of arrays
Hey all. I'm looking for a way to kick a specific player via script executed on the server and have been having some trouble making something work. I've tested the RCON send commands and can kick with them by using slots and iterating through all players but I haven't been able to kick an individual player by name of directPlayID.
I know what you're saying, and, in the context of sqf, I agree - I was just wishing we could have a const ref, such that we know some function is not going to change our stuff underneath us.
In teaching C++ the sane way, you do introduce references early, and explain how to use them, what they're good for. Even as you stay away from pointers for as long as possible.
The key is that it's obvious when you're referring to the same object.
Compared to the 'surprise reference semantics' we saw above.
i'm gonna create a ticket on the feedback tracker. see if they'll change the name of SQF to FML
private _UIDToKick = "SteamID";
"RCONPW" serverCommand format ["#kick %1",_UIDToKick];
Im trying to chain some basic BIS_fnc_dynamicText together within a single trigger, with a delay between each, but i cant seem to get it to work using sleep or uisleep.
["<t size='2' color='#ffffff'>TEST TEXT ONE</t>",0,0.3,3,2] spawn bis_fnc_dynamictext;
uisleep 4;
["<t size='2' color='#ffffff'>TEST TEXT TWO</t>",0,0.3,3,1] spawn bis_fnc_dynamictext;```
Please help, im really new to this and would love to get some basic subtitles made
It gives "Suspending not allowed in this context"?
You cannot make a sleep or uiSleep or any other suspend commands in some certain codes (More info at https://community.bistudio.com/wiki/Scheduler)
Use spawn and wrap every codes there is a workaround
yeah
do you have any documentation or links on how i can do this?
Literally I linked
Yeh, then take a look poplox link
Ah right it's all in there, gotcha
0 spawn { // This will allow the use of sleep/uisleep in the "Scheduled Environment"
["<t size='2' color='#ffffff'>TEST TEXT ONE</t>",0,0.3,3,2] spawn bis_fnc_dynamictext;
uisleep 4;
["<t size='2' color='#ffffff'>TEST TEXT TWO</t>",0,0.3,3,1] spawn bis_fnc_dynamictext;
};
im getting an invalid number expression when trying to put that into the onActivation box
You need take
```//this will...```` comment away
gotcha, assumed thatd be ignored given its a commen 
but thats a really nice way to visualize it and makes it easily expandable, much appreciated!
Ignoring comments is done by the preprocessor, but most/all in-game code fields don't go through the preprocessor. You also wouldn't be able to use other preprocessor commands like #include
Hello people of the scripting subsection. Is there a script that hides terrain objects in every map, vanilla or not?
You can create a function that runs on the init anytime a mission is loaded. There probably isn't one already written readily available atm. Can't write you one till later after work though.
https://community.bistudio.com/wiki/BIS_fnc_moduleHideTerrainObjects Anyone have info if this function has additional syntax? The module itself allows similar shape changes as triggers do. Can that be done by scripting?
Hi, one more question, is it possible that it shows dependency mods also?
FML? @candid sun
Fuck My Life
Hey, How do I make ai scan horizon
I have this recon unit that I want to look around a lil
there's no scripting command for it
you have to use a while/for loop and use doWatch
it is
just check requiredAddons in CfgPatches recursively to build a list of all addons, then use the same code as before to convert them into mods
Hey Im looking to make an AI unit invisible to everyone except for one player is this possible?
hideObject
ty
anyone have a link to a vanilla weed harvest/gather script?
or know a script to gather from a placed object like a plant
yo anyone got a example or any info on a server script to blacklist mods, basically disconnect someone if they have a specific mod loaded?
Does it have to be a scripted solution? In Engine wise there is a way to kick if someone has not signed or accepted key'd Mod
Engine's a whitelist rather than a blacklist.
It's not a difficult thing to implement with cfgPatches checks and endMission anyway, but it's really a client-side rather than server-side script.
In most cases I'd say that verifysig is the correct approach, because "acceptable" mods often still break when they're not running globally.
Could use https://community.bistudio.com/wiki/allAddonsInfo and make a whitelist for allowed mod hashes and kick everything else
I thought about it a while ago because the BE signature kicks can get quiet annoying (Super buggy imho).
I'd say checking CfgPatches is better
this is what i got for now :
if(isClass(configFile>>"CfgPatches">>"modname1") || isClass(configFile>>"CfgPatches">>"modname2")) then {
forceEnd;
};
}```
it works when i put it in a init.sqf file
in the mission
Wouldn't that a bad idea actually
i mean, it dont stop someone from having their own version of the mod and changing the cfgpatches name
but you know, thats already 99% of players dealt with
but yall think the !isDedicated makes the mission end only on the affected client that matches teh condition
just want to make sure i understand it right
It is nearly impossible to kick every such case I'd say. Maybe checking the function's code?
well im not trying to make a brick wall of a blacklist to stop everyone, i just want to stop players from using personal arsenal n shit
like the normal player who does not know how to code or anything to get around it
Yeah agreed
Not really sure what the isDedicated check is for. You're controlling what runs on the server anyway, right?
well documentation says that it checks if its a dedicated server, if it is (any server hosted by a provider i guess) it skips teh check entirely to avoid stopping the mission for everyone
Actually given what you wrote, I don't think you understand SQF locality.
if its not it a dedicated server, it checks on every client when they enter the mission and ends the mission for that client if they have either mod
thats what i understand
This works functionally as a blacklist and we used this method for years to avoid the most popular cheating mods. But ultimately my players started using dumb shit that affected server performance so I switched my script.
Now I use a whitelist method where I get all the cfgPatches on the server, all the cfgpatches of the player, the cfgpatches in a custom whitelisted mod file, and compare them.
If a player loads something not on the server or on the whitelist they get kicked.
I've had better luck with this method since keys constantly bring issues
Maybe this is better. Almost identical with verifySig way though
yeah, im not the owner of the server so i dont get to choose, but i would do whitelist more than blacklist
We blacklist for Antistasi to stop people trying to run it with known-broken mods.
well some mods like to be annoying and spawn shit in if you run it on a server thats not theirs so i blacklist those
known-mission-breaking, that is. Bloodlust is still allowed :P
yea
its just whitelist means checking all the clientside mods people use and adding them
or just saying fuck that and cutting in the middle
but yeah, so this code works for my purposes i think
It does, and it's annoying, but at some point when things get too wild you need to just cut the shit imo.
yea, the mission gotta run smooth
alrigth thx! ill test it a bit on an actual server and see if i got to change anything
Huh, you get kill attribution even if your damage did not actually increase the damage, only having your shot trigger the HandleDamage is enough
That's how people shooting a tank with a rifle get a kill credit after it explodes a bit later from HitHull damage, because their rifle damaged a headlight a bit and that's enough, even if reflector hit points were already destroyed
Thought it was at least a little bit more complex
Wish there was a scripting command to get/set this kill credit on a vehicle to correct this
How to observe this if somebody is curious:
player allowDamage false;
deleteVehicle o;
o = createVehicle ["B_MBT_01_cannon_F", vehicle player modelToWorld [0,15,0], [], 0, "CAN_COLLIDE"];
o setDir (getDir vehicle player + 180);
o setHitPointDamage ["HitHull", 1];
{
o setHitPointDamage [format["#%1", toLower getText(_x >> "hitpoint")], 1];
} forEach ("true" configClasses (configOf o >> "Reflectors"));
onEachFrame {
private _d = getAllHitPointsDamage o;
private _a = [format ["<t align='left'>Damage</t><t align='right'>= %1</t>", damage o]];
{_a pushBack format ["<t align='left'>%1</t><t align='right'>= %2</t>", _x, _d select 2 select _forEachIndex];} forEach (_d select 0);
hintSilent parseText format ["<t size='0.7'>%1</t>", (_a joinString "<br/>")];
};
```Execute this, shoot the headlight with a gun once, wait till tank blows up, check the scoreboard.
Wish you could empty hashmaps the same as you empty arrays with resize 0
private _array = player getVariable "array";
{
} forEach _array;
_array resize 0;
private _hashmap = player getVariable "hashmap";
{
} forEach _hashmap;
clearHashmap _hashmap;
```Something like this
muh microseconds moment again
is resize faster than = []?
Resize lets you keep the reference to same array though, no need to reassign it where it is used
does anyone know a way to make it so that players can access remote turrets without needing a uav terminal in their inventory? like a static object they can interact with that allows them to gain control of the turret and remote operate it?
remoteControl and switchCamera
how do i set that up? and is it an object they need to equip or i can set it to a static object?
"Equip"? Cannot write a snippet right now but petty much BIKI can explain
Best way to stop a dog from moving, apart from shooting it or disablingAI anim? Seems like move/fsm/target have no effect.
tried both createunit and agent
Hi i’ve been looking for a code to detect if a player is holding a specific weapon then runs a custom script. I tried currentweapon primaryweapon… etc, maybe someone got any clue
The idea is when holding/equipping an axe, u can cut trees 😄
currentWeapon player == "your_axe_class"
as for "runs a custom script", depends on what you mean, do you want an addAction or something else?
Makes a trigger=true, or execvm sqf file
Basically the script already adds action near trees, but should only be activated when player is holding axe
Does it support removing the action so you can remove it after you unequip the axe?
Nope
What the script does, adds action with addAction?
You can simply add this condition in addAction's condition check
Alright thnx let me try that
Run your script right away, but make its actions only be visible with axe in hands check
_cursorObject = cursorObject;
_weapontype = currentWeapon player == "WBK_axe";
if (!(['\tree',((getModelInfo _cursorObject && _weapontype) select 1),FALSE] call BIS_fnc_inString)) exitWith {
This is the whole addaction condi section, not sure how to add “_weapontype” as another condition here
Seems like a very old script
if ( !_weapontype || !(['\tree',((getModelInfo _cursorObject) select 1),FALSE] call BIS_fnc_inString)) exitWith {
Didn't notice you added _weapontype somewhere in the middle 
Actually, not very old considering getModelInfo
Did you write this condition yourself btw?
Weird, i can still chop trees without equipping the axe
Post full condition script here
No, i found this code in the web after 2 weeks of searching 😄
Also changed it again, give it a try
Didn't realize its a condition for exit, not for the action to appear
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Please format your code
You added your weapon check into action code, not condition code
tag_fnc_isTargetTree is the function that checks if its a tree
Check for the axe there
Createunits should work fine
With Units can get units to stop / override their move commands.
But with Agents you can't override the move command, best you can do is tell them to stop. But they will continue there movement when you allow them to
@sullen trellis please use pastebin for big code chunks, thanks
cheers! worked great how did i miss that 😮
Am using doMove doStop etc
So I’m creating essentially custom fortifications like a sandbag wall but with objects like the brown sack so they’re in pieces so they can be “built” up but due to there being like 10-30 objects per fortification I’m making them simple objects but also trying to detect when they take damage/shot. I was messing around with this last night and found that while the simple objects don’t detect being shot they still have bullet effects and block the bullet. I tested this by having an object behind them that detected when it was shot but the rounds fired at the simple objects were stopped by the simple objects. My question is, is there a way to detect when a simple object is shot as it seems to have collision or is there a way to fully remove the collision and just have something like a carpet that has had its texture removed so it’s “invisible” but still detects the shot from within the “wall” of the fortification?
Going to continue testing later but was wondering if any of you had some suggestions or knowledge on the matter
You can detect shots using projectile EHs (hit EH might work too)
But imo don't use simple objects for such cases
It doesn't make much difference in terms of performance anyway (sandbags use the house simulation which is pretty much just as fast as simple objects)
The hit EH never triggered and I’m using quite a few other objects as well
Like logs, h barriers, etc
Similar to Squad fortifications
Just worried about performance because just single fob would be like almost 1000 objects
1000?!
Well just one fortification like a sandbag wall like I’m doing is about 20 objects
I’m aware performance won’t be as great as if I’d just made my own models and such but trying to make it workable at least
Well in any case using simple objects won't make much difference here
Dont know is find faster thank BIS_fnc_inString.
What im using in my own cut trees setup is
#arma3_scripting message
I don't think you have can event handlers on simple objects.
HandleDamage doesn't execute on non-destructible objects, so your only choice is HitPart and Explosion event handlers
These won't tell you how much damage they did, but you can sort of estimate it
I figured so
Yeah been using hit part
Is there a way to just have a model using the p3d? Because the simple objects still has bullet collision
Fire geometry is a part of model, you can't disable it
https://community.bistudio.com/wiki/in can check if string contains string.
(['\tree',((getModelInfo _cursorObject) select 1),FALSE] call BIS_fnc_inString)
and
((((getModelInfo cursorObject) # 1) find "\tree\") != -1)
are just
"\tree\" in (getModelInfo _cursorObject select 1)
Awesome. Thanks.
Not a best idea to check in model file name
toLower(createHashMapFromArray namedProperties _object getOrDefault ["class", ""]) find "tree" >= 0
```Something like this could be better perhaps?
Thanks, i will test out.
Every day learning something new.
//params defined by user.
params ["_objectname", "_pictureName"];
//To test info inside variables.
hint str _objectname;
sleep 5;
hint str _pictureName;
//To apply script to _objectname and use path stored in _picturename.
[_objectname, ["Show Image" , {_objectname setObjectTextureGlobal [0, "_picturename"]}]] remoteExec ["addAction"];
Hey, I am having trouble figuring out how can I insert variable information into a string.
Specifically this part.
[0, "_picturename"]
How do I get the script to insert the string saved inside _picturename?
Just use _pictureName, no quotes. It already contains a string, no need to convert it, just provide the variable and its contents will be used.
You also don't need to do str _pictureName for your test hints - the variable already contains a string, so just hint _pictureName would work fine.
(I often find it easier to use systemChat for debug messages rather than hint, because it lets you have multiple messages in quick succession and they'll all be available in the chat log, rather than wiping each other out)
Appericiate all the useful advice, thank you!
So there's another issue, wondering if you might have an idea to fix this. The script inside the addAction script
["Show Image" , {_objectname setObjectTextureGlobal [0, _picturename]
cannot recognize the _objectname and _picturename, since addaction is called in game, so wondering if there's a work around for this.
https://community.bistudio.com/wiki/addAction
The action code has access to certain predefined variables, which you can access with params:
params ["_target", "_caller", "_actionId", "_arguments"];```
`_target` is the object the action is attached to, so you can use that instead of `_objectName`.
`_pictureName` is not inherently available on its own, but you can pass it into the action so it will be available in `_arguments`. Things to pass in as arguments can be specified after the action code when creating the action.
```sqf
[_objectName,[
"Show Image", {
params ["_target", "_caller", "_actionId", "_arguments"];
_target setObjectTextureGlobal [0,_arguments#0];
},
_pictureName
]] remoteExec ["addAction",0,true];```
(note addition of `true` JIP flag in the remoteExec parameters, so the action will be available for clients that join after this code runs)
I'd suggest using some of the other addAction parameters too, such as the radius restriction - might want people to have to get closer than 50 metres to interact with the object...
Hey, thanks alot for the help! it worked great!
Hey peeps.
Our community is in the process of making an event, we're about to test PT1 or two, but there's one kink we want to iron out before doing a full test run on it.
It relates to this script.
We're trying to destroy dragon teeth objects when an explosive well... explodes next to it, for a beach landing.
The following works in SP and local MP, but not dedicated MP.
Could someone advice?
Edit: added pastebin link
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Dang
please don't post a big chunk of code
pastebin.com plz
haha
doing that now
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
_cfg = loadConfig "mission.sqm";
_addons = getArray(_cfg >> "addons");
_cfgPatches = configFile >> "cfgPatches";
_addons insert [-1, configSourceAddonList(configFile >> "CfgWorlds" >> worldName), true];
_dep = _addons;
while {count _dep > 0} do
{
_newDep = [];
{
_newDep insert [-1, getArray (_cfgPatches >> _x >> "requiredAddons"), true];
} forEach _dep;
_dep = _newDep - _addons;
_addons append _dep;
};
_mods = _addons apply { configSourceMod (_cfgPatches >> _x) };
(_mods arrayIntersect _mods) - [""];
give that a try and let me know if it works
fixed some errors so copy again if you saw it before this message
right, so im currently trying to optimize a mod and turn a script into a function
since you can run it multiple times
will post code in a second
at first, it wasn't working. got an error. but after i tried to change the params of the call, my game just freezes and crashes
Are you doing this in an addon or a mission config?
addon
It doesent return anything in this case
there was a typo. try again
What does your cfgFunctions class look like in the config, and what does the call like look like
My cfgFunctions
class CfgFunctions
{
class TLX
{
class Cars
{
file = "\tlx_base\cars";
class uaz469
{
preInit = 0;
postInit = 0;
ext = ".sqf";
preStart = 0;
recompile = 0;
};
};
};
};
The call
[_this] call TLX_fnc_uaz469
The function start (which I imagine is the problem)
/*
Author credits here
*/
diag_log "LIGHTS WORKING";
private["_vcl", "_lights", "_lights0", "_lights1", "_lights2", "_lights3"];
_vcl = _this;
_lights = "forbidden_name\data\RKL_151_red_co.paa";
_lights0 = "forbidden_name\data\RKL_151_co.paa";
_lights1 = "forbidden_name\data\black_co.paa";
_lights2 = "forbidden_name\data\RKL_151_co.paa";
_lights3 = "forbidden_name\data\RKL_151_a.paa";
_lights4 = "forbidden_name\data\RKL_151_red_co.paa";
_lights5 = "forbidden_name\data\RKL_151_red_a.paa";
hint localize "STR_Veh_Lightbar_ON";
if ((_vcl getVariable "lights")) exitWith {
hint localize "STR_Veh_Lightbar_OFF";
[...]
It works like previous, returned same results, it still misses mod name of the map I used.
well it only checks mission dependencies, not terrain
at first, the call i was using was just
[] call TLX_fnc_uaz469
Can it somehow check and map name?
and it threw me an error for _vcl = _this, expected something got something else
so then i changed it to _this in the call and now my game crashes whenever it runs
hm odd, if it was getting into the function that it should be actually calling correctly
so how its being called, or rather the circumstance i should say
its an addAction for the driver pos of a vehicle
before the call was
this execVM "\some\path";
try the new one
try using params, replace your _vcl = _this to params["_vcl"];
ok, do i need to do change anything on the addaction side?
can I see the addactions code
perhaps addaction was the wrong word to use
class UserActions
{
class code2_3
{
displayName="$STR_Veh_LightBar";
position="drivewheel";
radius=1000;
condition="driver this == player";
statement="[_this] call TLX_fnc_uaz469";
onlyForplayer=0;
};
MACRO_TURN_LEFT_ALLUMAGE
MACRO_TURN_LEFT_ETEINT
MACRO_TURN_RIGHT_ALLUMAGE
MACRO_TURN_RIGHT_ETEINT
};
UserAction inside a config.cpp
CfgVehicles
The wiki says with useractions you should be using this and it refers to the object the action is attached to
is that the value you want to be getting?
i will try with "this" instead of "_this" and report back
i just read the description of "_this" in the magic variables wiki and was left dumbfounded
i think i cut off the code right before the problem
no
diag_log "LIGHTS WORKING";
private["_vcl", "_lights", "_lights0", "_lights1", "_lights2", "_lights3"];
_vcl = _this;
_lights = "forbidden_name\data\RKL_151_red_co.paa";
_lights0 = "forbidden_name\data\RKL_151_co.paa";
_lights1 = "forbidden_name\data\black_co.paa";
_lights2 = "forbidden_name\data\RKL_151_co.paa";
_lights3 = "forbidden_name\data\RKL_151_a.paa";
_lights4 = "forbidden_name\data\RKL_151_red_co.paa";
_lights5 = "forbidden_name\data\RKL_151_red_a.paa";
hint localize "STR_Veh_Lightbar_ON";
if ((_vcl getVariable "lights")) exitWith {
hint localize "STR_Veh_Lightbar_OFF";
_vcl setVariable["lights", FALSE, true]; //<---------------- This is the first defining of the variable
sleep 0.5;
_vcl setObjectTextureGlobal[3, ""];
_vcl setObjectTextureGlobal[4, ""];
_vcl setObjectTextureGlobal[5, ""];
_vcl setObjectTextureGlobal[6, ""];
_vcl setObjectTextureGlobal[7, ""];
_vcl setObjectTextureGlobal[8, ""];
_vcl setObjectTextureGlobal[9, ""];
};
_vcl setVariable["lights", TRUE, true];
while {
(alive _vcl) && (_vcl getVariable "lights")
}
do
[...]
change the statement to, "systemChat(format["%1",this])" and see what it says in chat
which statement? the one i pointed out? or the statement line in CfVehicles?
the one in cfgVehicles
ok
show me the line in the config
' not "
it shows my callsign/group (alpha 1-1) in game and my players username
Oh, well yes I should have expected that. If you're attaching it to you then it will show you as the object
What value are you trying to get out of this?
i'm not trying to return a value to the function. correct me if im wrong but execVM is deprecated now and since this script will be running more than once (its like on/off switch) a lot on a multiplayer server, im just trying to turn it into a function to save on performance
yes the function seems to work fine, its not the problem. the problem is that the variable you are passing into the function is wrong
so originally, the statement was just this:
statement="this execVM '\forbidden_name\scripts\code2_3.sqf';";
it didnt really pass a variable (afaik)
this is the variable its passing
It should have been passing the player object as the variable
What is _vcl supposed to be?
_vcl = _this;
to me it would make more sense that it would be vehicle player whats its passing
😂 No I mean like what is the actual value, like is it a car, a tree, whatever what do you WANT it to be>
this when used with UserActions passed the object that the action is attached to, in your case, the player object
if your player is in a car, then the car object will be returned instead of the player object. If you always just want the player object then use player
right so, if the original sqf works by using execVM
it passes "this"
how would i pass "this" with the function?
Your userActions is added to class car?
statement = "this call TLX_fnc_uaz469";
Ya give that a try
game crashes
whats the error
23:57:14 "B Alpha 1-1:1 (prisoner) (Tl_Shore)"
systemChat "LIGHTS WORKING";
private["_vcl", "_lights", "_lights0", "_lights1", "_lights2", "_lights3"];
_vcl = _this;
diag_log str _this;
class code2_3
{
displayName="Test";
position = "camera";
radius=10;
condition="true";
statement = "this call TLX_fnc_uaz469";
onlyForplayer=0;
};
if added to class car , to object, not class man
no error, just freezes and dies
_spawncrate = _this Select 0;
if (!isDedicated) then {
waitUntil{!(isNull player)};
///
_statment1 = {"ACE_medicalSupplyCrate_advanced" createVehicle getMarkerPos "spawnCrate"};
_medbox = ["medbox","Medical Supply Crate","",{_statement1}, {true},{},[], [0,0,0], 100] call ace_interact_menu_fnc_createAction;
[_spawncrate, 0, ["ACE_MainActions"], _medbox] call ace_interact_menu_fnc_addActionToObject;
};
So ace interact works, but the statement line won't work
you misspelt statement
thx
hmm still not working, crate won't spawn in
Works now
remove the brackets of Statement call in _medbox line
ah ok, nice
Q: on getOrDefaultCall, trying to prepare a _y with default arguments, but I wonder might be referring to an undocumented magic HASHMAP value, that is not there yet i.e. nil ... in keeping with apply etc.
private _spawnMarkerRoads = createHashMap;
private _mode_3d = false;
private _doNotSort = false;
private _y = ["", _roadTypes, _capRadius, _doNotSort, _mode_3d];
{ _spawnMarkerRoads getOrDefaultCall [_x, { _y set [0, _x]; nearestTerrainObjects _y }, true]; } forEach _spawn;
// SPAWN refers to some map marker candidates, CAP RADIUS what it sounds like, radious about which to consider
// _x, assumed to be a SPAWN marker, that, or also a magic var to the target key
The log:
23:35:25 Bad conversion: array
23:35:25 Error in expression <getOrDefaultCall [_x, { _y set [0, _x]; nearestTerrainObjects _y }, true]; } for>
23:35:25 Error position: <nearestTerrainObjects _y }, true]; } for>
23:35:25 Error 0 elements provided, 3 expected
can anyone on the SQF dev side verify, and maybe document, while we're there... thanks...
https://community.bistudio.com/wiki/getOrDefaultCall
Log looks like typical invalid position argument
When you provide non-position as argument for position, like:
createVehicle [typeOf player, nil]
```=>
11:54:29 Error in expression <createVehicle [typeOf player, nil]>
11:54:29 Error position: <createVehicle [typeOf player, nil]>
11:54:29 Error 0 elements provided, 3 expected
Seeing that you use _x as key, you probably have map marker names instead of position there, thus the error
I see it, was a marker _x, not markerPos _x
Q: 1e39 is infinity right... is -1e39 considered a number? getting not a number errors on, so I wonder:
_args params [
['_value', 0, [0]]
];
is there a way to receive that when it is so far invalid and "should" be that? i.e. infinity or -infinity
thanks...
IIRC getOrDefaultCall surprisingly lacks any magic variables. So _x and _y will be from the calling code.
appreciate in both responses. am beyond it at the moment. but thanks...
Since some version NaNs were separated from Numbers so you can no longer feed infinity into scripting commands
Use finite if you want to filter it out
Works:
_v = -1e39;
_v call {
params [["_w", 1e39, [1e39]]];
_w;
};
[typeName -1e39, typeName 1e39, typeName 100] => ["NaN","NaN","SCALAR"]
Yeah, I guess the issue is that you'd also permit real NaNs.
I feel like if you're passing infinities around you're asking for trouble.
the only infinity that exists in arma is my love for sqf
You can do
params [['_value', 0, [0,1e39]]];
```to accept both Number and Not a number and then figure out what to do with it later
ah okay I see... good to know, thanks...
actually in this case I have [[], [], -_inf] as the response, so I test on the first two bits.
then if the response is valid, i.e. "not", I scan for the number afterwards.
Anyone know if setVehicleTIPars affects the AI detecting vehicles with plane ir sensors?
It should AFAIK. It's undetectable 0 or detectable not 0 tho
So its max range detection right when it heats up?
I think I haven't tested if distance vs tiPars is somehow related
Hello good people, I was wondering if anyone knew of a good VS Studio Code extension that can remove comments on a folder/bulk level (not file level), in SQF? Unlikely, but I thought I'd check in with the experts 🙂
@tough abyss doStoped it, but still keeps on running off, gonna just disable anim
Ahh yeah forgot about the unit group system, will try to regoup etc... its annoying
you don't need an extension for that. a simple regex can do it
\/\/.*?$
and
\/\*.*?\*\/
replace with nothing
Using trigger to play 3d sound if a plane is near by, it bricks the server... I think this is due to the fact its checking every unit in a 5 sec period.
Is there anyway to optimize a trigger and or add event handler to play 3d sound from a specified object if a plane is detected within X meters of the device? Or an alternative method that is not so heavy?
Ive been putting off learning regex haha .. I’ll give it a go thanks @little raptor
- you have an issue
- you learn regex to fix it
- now you have two issues
onEachFrame {
private _from = player modelToWorld [0,0,1];
private _to = v modelToWorld [0,0,0];
private _intersect = [v, "GEOM"] intersect [_from, _to];
systemChat str _intersect;
if(count _intersect > 0) then {
drawLine3d [_from, _to, [0,1,0,1]];
{
drawIcon3D ["\A3\ui_f\data\map\markers\military\destroy_ca.paa", [1, 1, 0, 1], _from vectorAdd (_from vectorFromTo _to vectorMultiply (_x select 1)), 0.5, 0.5, 0, _x select 0, false, 0.04, "PuristaMedium"];
} forEach _intersect;
} else {
drawLine3d [_from, _to, [1,0,0,1]];
};
};
```What am I doing wrong? Why cant I get any `GEOM` intersects with a CH-67 Huron?
v is the helicopter
Tried with a tank, it only intersects with a turret, not the body 🤔
Is intersect broken?
What is it supposed to intersect with?
You're ignoring v
nvm this command works different 
It only returns named selections. Maybe what you're pointing at is not named
Use lineIntersectsSurfaces instead
What a shame
I guess, just wanted to check intersections with specific objects only, expecting this to be more efficient than casting a ray in a world with lots of objects
I once had an idea to expand the lineIntersectsSurfaces command to have include and exclude filters
Instead of just exclude obj1 obj2
At least an array of excludes rather than just 2 seems sensible
Sounds very useful.
Maybe turn first exclude into array of includes and second exclude into array of excludes
If these arguments are array, use new logic, if they're entity, use old single exclude
That's the idea yes
lineIntersectsSurfaces [pos1, pos2, [obj1, obj2, obj3, obj4], player]
lineIntersectsSurfaces [pos1, pos2, [obj1, obj2, obj3, obj4], units group player]
Anyway, my original intent for this was to try to find an object that's more likely collided with the player and damaged them
Sadly there is no EPEContactStart event even if EPE object damages the player
Not sure about mixing them like that, seems likely to lead to confusion
Well, it is fairly complicated command, better read the docs carefully
Is there a way to disable mortar cameras changing angle and elevation? (Don't know where else to ask this)
Anyone know if using setGroupOwner with large ai group sizes( > 50)adds additional strain on server processing?
It will probably take very slightly longer to complete the transfer because, well, more things to do, more/bigger network messages to send. But it's a one-time transfer, it won't have any effects after it's done, other than the receiving machine now having to handle 50+ more AI than before.
Transferring unit locality adds strain yes.
Thought as much, but I dont think it would be significantly more strain than a smaller group right?
Hi guys, im tryna make an action button for ACE interaction menu. Ive had buttons that work ok, but for some reason this button wont work:
_playerUID = "76561198040777688";
_playerAction = ["PlayerActionName","Get Equipment","\a3\ui_f\data\igui\cfg\simpletasks\types\rearm_ca.paa",{
// Action
_preset = ["myArrayPresetIsHere"];
player setUnitLoadout _preset;
hint "Action is complete";
},{
// Condition
getPlayerUID player isEqualTo _playerUID;
},{},[_unit],[0,0,0], 100] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _playerAction] call ace_interact_menu_fnc_addActionToObject;
I suspect the UID check condition to fail, although if i check the UID in debug using: getPlayerUID player == "76561198040777688"; or even strict comparison getPlayerUID player isEqualTo "76561198040777688"; it returns true, the action is created, but nothing happens, even the hint message.
I guess I have to pass the player variable as the parameter?
