#arma3_scripting
1 messages ยท Page 97 of 1
This function only works in Eden Editor?
Attributes are available only within the Eden Editor workspace. You cannot access them in scenario preview or exported scenario!
im having a problem with my script atm...
I want to make a zone with ai spawning that hunts a player, i got the ai spawning etc set up and it works fine. player enters area, ai spawns, ai runs towards player.. i also made a max ai value so it doesnt infinitely spawns ai till the game/server crashes.
The only problem i have is.. im too stupid to make it so that if i kill enemies it removes the killed unit from the array (that array contains all the enemy units) so another one can spawn...
hopefully i explained it good enough bcs my english sucks xD Can any1 help me?
heres my script
deleteAt and find can achieve to remove a certain value from an array
can u give me an example?
so
(missionNamespace getVariable "activeAI") - [this select 0]];
doesnt even work?
(in the "killed" event)
Haven't looked your script yet, but this partially work. The issue is you didn't save it
or "saveMissionProfileNamespace;"
What u mean?
i did this now:
_x addEventHandler ["Killed", {
_tempGrp = (missionNamespace getVariable "activeAI");
_tempGrp deleteAt (_tempGrp find (this select 0));
missionNamespace setVariable ["activeAI", _tempGrp];
saveMissionProfileNamespace;
hint "AI Unit died! Removed from activeAI";
}];```
But it doesnt work. i tried to fix it for like 2 hours now ._.
missionNamespacealready is the default namespaceprofileNamespaceor any other namespaces shares nothing with itsaveMissionProfileNamespacedoesn't exist
so how do i fix my code? can u give me an example? the problem is just about removing the unit from the array when it dies
activeAI = activeAI deleteAt (activeAI find (_this#0))```
uhh can u explain the "this#0" to me?^^
# is almost equivalent of select
that was almost rude xD
?
kk ty, im new to arma scripting so i might ask many stupid questions xD
but doesnt it select the first value in the array with "0"? How should i know where the unit is in the array?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed
As you can see the first element is the unit
You've already said you're rude or stupid or new to this, they are all don't matter as long as you can/want to learn and thank anyone who helps you
i will thank everyone who helps me, but since i was trying to find a solution for more than 2 1/2 hours by now and tried like 20 different approaches, im kinda tired of spamming the google/biki search bar. at this point i just want a result, because even if i didnt found it myself, i still learn from it. for me its not about learning to code, its just about learning how to get something done in arma since its a whole lot different to java and other languages that i know.
SQF actually is not really a good language to learn programming 101, since this is about 20 years old and never updated the syntax or somewhat
yea thats what im realising ^^
But you know what, this is the only language I can handle
sqf just seems so confusing to me
_tempGrp = _tempGrp - [_unit];
missionNamespace setVariable ["activeAI", _tempGrp];
works...
Again missionNamespace is the default namespace unless in a special case
So this is enough
what does this mean?
sleep (1 + random 4); sleep between 1-4 or sleep 1 + random from 1-4?
i need it the sleep between 1-4 but guess its the latter one right?
1 + random 4 is 1 to 5
thank you
Hey there, can I spawn a "zeus" via script.
I got the game master module in the mission with #adminLogged as the owner, but let's say I need a second one for someone not logged in as admin, but he will have access to console.
Is there a way, to spawn a zeus for him, so when he presses "z" he will be transported into him, similary like the "admin's" one works? 
Run as local to assign yourself as zeus
[player, allCurators#0] remoteExec ["assignCurator", 2]
Copy that, will test it, thank you!
Wait, this would "reassign" the one the admin has, no? 
Hey, I'm pretty new to Arma scripting and got a few questions, anyone able to give me some help? (In PM or here if that's the norm I guess)
why does this throw an error msg?
drone1 flyInHeight [100, true];
error msg:
error flyInHeight: type array, expected number
the drone is an "C_IDAP_UAV_06_antimine_F"
That's why
not released yet
haha my bad 
@gusty flame you're probably better off just asking your question(s) here and waiting for a reply.
I found a nice way to generate a module and it parameters by script, you just need to set the module on Eden Editor the way you want, and then use the Convert to SQF option! Amazing!
๐
I made a line around
@oblique spoke Alright. Here goes: Is it possible to have a function-call as the condition in addAction? Something like this: http://pastebin.com/vv9scbEQ
I can't get it to work, if it's possible: What am I doing wrong?
Perfect
my scriptfu is weak, but you have asked in the appropriate place. one of these goons will straighten you out i'm sure.
scripting wise yes there are many new commands
engine wise, kinda. the thermal imaging has changed. there were some mod-related stuff too
content wise no (apart from CDLCs)
back then i made a similar "find a hidden item by triangulating its location" mission for A3, but you were followed by invincible zombies rather than semi-friendly/helpful villagers
that sounds like dayz
it's like a very lightweight dayz
just no survival mechanics, and ALL of it was pasted into 'init' field in a gameLogic object placed in editor
(i wrote the code in external file and pasted it back every time)
i'm having difficulty getting over A3 being 10 years old, for me it still came out yesterday
How to check, if player is prone? This does not work addUserActionEventHandler ["Prone", "Activate", { hint "Action!"; }];
Thanks, but how can I incporporate that in an event handler? I don't want to use some while-do cylce or something.
This should work (assuming you're not only running it on the server or something)
I am just in the editor. It is in the player's init.
Oh, try one for moveDown as well.
The prone (Prone Toggle) action is not bound in any of the default presets and it's likely you'll be using moveDown (Prone / Stand Up) instead
Note that this action is likely to trigger if the user presses the same action again to stop being prone, and won't trigger if they stop being prone because of a different action (i.e. crouching), so you'll probably need multiple handlers and some additional checks to cover every possible case
....and you'll want to monitor adjustUp and adjustDown as well, in case they get prone by cycling through all the intermediate stances
animStateChanged is another EH you can use
I tried using
vehicle1 disableCollisionWith vehicle2;
to disabel collisions but it keeps telling me "Int: Missing ;" WHAT AM I DOING WRONG??? I typed it in correctly
Can you show more of the actual code?
Can't really tell where the problem might be happening without it
helicopter attachTo [destroyer, 0,0,0]
helicopter disableCollisionsWith destroyer;
Im trying to make a goofy lil compisition
No semicolon after [0, 0, 0]
but arma 3 doesnt want me to make it goofy
Also I assume you're wanting helicopter attachTo [destroyer, [0, 0, 0]];?
Yeah
They attached just fine but the helicopter keeps exploding so I assume it was because the two are inside each other
Try disabling the collision first, and then attaching
How do I disable collisions without scripts?
Is this not a script here?
Just swap the lines:
helicopter disableCollisionWith destroyer;
helicopter attachTo [destroyer]; // offset defaults to [0, 0, 0]
Make sure the helicopter isn't inside the destroyer when it's created.
attachTo will handle the position it ends up in, so the helicopter can be created anywhere...ideally somewhere with plenty of free space.
Im trying to find the screenshot but I can only steam screenshot in arma 3 gimmie a second
Doesnt work
collision not collisions
Im going to chuck my computer out a fucking window it worked
Now I cant fly the chopper anywhere
Well, no, because it's attached to the destroyer
Are you wanting the other way around?
Im trying to make it where the helcopter flies the destroyer around
Swap helicopter and destroyer
destroyer attachTo [helicopter];
The codes in there
Something to keep in mind is that destroyers aren't actually one object. They're made up of multiple sections in order to keep within the engine size limits. The object you see in the Editor is a dummy. So there is more complexity here if you want to do it this way around.
Ah yeah, I forget it's multipart, only messed with them once for a retexture
Odd question, but has someone written a quicksort (or any algorithm really) for sqf?
Need to sort an array of units based on the length of a variable in the unit. I tried modifying a quicksort algorithm I found on this website, but I was doing something wrong since it kept returning the array out of order.
Alright, great :) Thanks
Thanks all, it works now. Can I use this code, when I have more players in MP game, which can respawn or switch units, disconnect and reconnect?
{addUserActionEventHandler [...]; } forEach allPlayers; Or do I have to make onPlayerConnects event. I think I have answered my question. ๐
You'd need an onPlayerConnects
@tulip ridge You can use the engine sort to do it by making arrays with the target number as the first element, or BIS_fnc_sortBy will do the same thing for you.
sort is weirdly slow for an engine command but it's still going to be faster than anything you can do in SQF.
malow that's incorrect code afaik
Not sure I understand what you mean by "making arrays with the target number as the first element"
What "target number"?
The one you want to sort by.
is there like a CfgEmotes section somewhere? so that i can just get a huge array with emotes instead of adding one by one emotes to an array
I wanted to sort them by array length:
_units = [...]; // something like player, unit1, unit2, etc. etc.
{
_arrayVar = _x getVariable ["someArray", []];
} forEach _units;
// Unit with the longest `someArray` would be _units#0, second longest would be _units#1, etc. etc.
_units2 = _units apply { [count (_x getVariable ["someArray", []]), _x] };
_units2 sort true;
_units = _units2 apply { _x#1 };
I think looking BIS_fnc_sortBy again helped a lot
Appreciate it ๐
why can't you just use the
'ACE_microDAGR' in (items _unit + assignedItems _unit)
bit from the function instead? tidy it up and have it as the condition
Because I'm planning on making the conditions more complex, checking if players has the DAGR, and if they're close enough to certain areas etc. It might be possible to add it all as one long line of conditions in the addAction call, but it would be so much better and easier if I could use a function for it I feel.
"Oh nice, select already has a syntax for what I nee-"
if the command itself was since 2.14 you'd see the game version next to the syntax itself
Gotcha
Makes sense looking back at it now, since the the syntax following it was 1.56
And also the big blue notice right under it...
be careful, the condition is checked every frame if it's attached to the player
why does _unit lookAt getPos player make the AI turn itself to face that position but _unit lookAt player makes them either to not react, turn only a bit or just face a completely opposite way?
is it a bug or intentional? If they count glancing at player as looking at him then why looking at position doesn't do the same?
Is running script-code every frame on the client going to have any negative effects to performance? I come from using stuff like Unity etc. and there you could probably calculate PI in a script every frame without any affect on the performance for the client. I've read that in Arma you do need to be careful with executing too much script code, but will just a few extra conditions that are checked every frame actually make a noticeable performance impact even?
nope, nothing touched
also _unit lookAt getPos player is completely wrong
well use time acc to see if they eventually look at player
the idea was to have the AI immediately turn facewards to player for a conversation and the 2nd script did that. But I hoped that with lookAt player AI would turn to face the player and keep looking at him, otherwise I have to loop that
well like I said the first one is just wrong
it should be _unit lookAt unitAimPosition player
the getpos one worked so I guess it's not wrong at all? If I understand you the difference is that getpos returns a point at unit's feet while unitAimPosition is some memory point near the head
i'm not schooled enough in programming to give you a good answer, but i know c# is way way way faster than sqf, and unfortunately sqf generally starts to look pretty ugly once you start doing complex stuff
hey folks, how can I get an array of all classes in CfgVehicles>>UAV for use in scripts?
Specifically, I need this array so i can add a variable to each class, not necessarily with same value.
i'm probably over stating the performance impact - i'm sure someone more clever than me will give you a good answer soon
nvm seems like what I want is BIS_fnc_getCfgSubClasses
hey guys
any way to get objects on a dead unit, like the result of getUnitLoadout, but objects, I want the damn objects... ๐
I feel like you have some very flawed assumptions here.
It doesn't create a load of objects just because a unit dies. Just one (or two?) for the dropped weapons.
you are definitely right. what about assigned items?
Fair question. Not sure.
"dropped weapons", didn't these exist already ?
I'd guess that they're still assigned to the body.
so "any way to get objects on a dead unit"
No, because weapons aren't objects. What it does is create a simulated weapon holder object and transfers the weapon item to that.
dummyobject
If you want to find the weapon holder with script then you'll either have to search for it or add a Put event handler to the unit before it dies.
There's no script-accessible link from corpse to weapon holder but there is one in the other direction: https://community.bistudio.com/wiki/getCorpse
this is were I'm at, https://pastebin.com/B7CT2my4
following from
if (_x isKindOf "Man" && ! alive _x) then {
diag_log format ["TGF_fnc_addTransferAction | _nearObjects: %1 is a dead man", _x];
[_x, _target] call TGF_fnc_transferLoadoutToContainer;
}
the idea is to create all items on dead unit and respective contents/configuration in a target container
_unitLoadout params [
"_primary", "_secondary", "_handgun", "_uniform", "_vest",
"_backpack", "_headgear", "_goggles", "_binoculars", "_assignedItems"
];
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.
Alright, thanks for the info nonetheless :) It is however not possible then to use a function-call in the conditions-parameter of addAction? I'll just have to slam all the conditions in there in the parameter?
Hello! Hopefully a quick question
I have a few .sqf files not being ran when on a dedicated server. They run fine on hosting, but nothing happens while uploaded to the server.
I'm new to scripting, so I think there's something I need to do, probably basic, to make scripts run on a server. Anyone have an idea?
incase it's relevant, code
which sqf files, called from where? ๐
It's three to teleport to three different birds, I'm new enough to scripting that I didn't know that I needed to call them, I thought having them in the mpmissions folder would be enough
well you say it works in SP
I technically ran it as MP, just for clarification
but yeah it works fine on hosting. when uploaded to the server, it's like they're not being used at all
Script files don't run themselves, apart from engine-recognised event scripts like init.sqf. You must be doing something (execVM, for example) to activate the scripts, even in self-hosting.
What is the exact code you're using to call them?
pulling it up now
basically a 'this addAction ["text", "code.sqf"]
each RGteleport is the same with the exception of changing which helo name they're using
Have you checked that these sqf files are actually in the mission PBO?
I have not, I'm not sure how to go about that.
My troubleshooting steps were ensuring it worked through Eden>host MP, and then uploading the entire mission file to my server's mpmission
I haven't attempted to get .sqf files working on a dedicated server before, so this is new to me
There's nothing different about how .sqf files work on a server. There are differences in how some commands work, but that's not really important here.
- When you say uploaded the whole mission file, did you upload the unpacked mission folder, or did you export it as a PBO first and then upload that?
- When you say the scripts are "being ignored", do you mean the actions are missing or the actions don't do anything?
-unpacked mission folder
-Actions are there, do not work though
what I suspect is that you created the mission in the Missions directory
then saved in MP missions (which copied the sqm only)
then exported as MP mission
that, or you need to restart the server to refresh the pbo
They said they uploaded the unpacked folder, not a PBO
No, Unless I'm misunderstanding you, I can see through my FTP I have all .sqf's with the mission
I would recommend exporting it as a PBO and uploading that
Is this the contents of the mission folder inside MPMissions, or the contents of MPMissions itself? The first one would be correct, the second one would explain everything.
LA/GE, so not the problem here (the calling player is local)
I don't see Pbo as an option, I have export to MP, Terrain Builder, to SQF
Export to MP
mpmissions>RC001>.sqfs
Exported PBOs are located in your Arma 3 install folder in the MPMissions folder
So I have been exporting to MP, my understanding is they came back as files and not .PBOs
Maybe I've been messed up this entire time, but wouldn't I find my exported mp missions through Docs>Arma3>mpmissions?
welp
I think your problem is how you execute the script with addaction. becouse You use addaction ["text","Script.sqf"]; That Scrit.sqf is executed with ExecVM witch is GA/LE and that is why it dosent work on server.
I see the .PBOs, I'll give that a shot
I'm now puzzled what mission you've been testing :P
No, that's not it.
The LE in execVM means the script file is only executed locally on the machine where execVM was run. That's exactly the same as any addAction code, and completely normal.
Literally what I put up above lol, the server accepted the mission.sqm and went with it
I didn't think there was any way to get a dedicated server to load an unpacked mission.
Is "RC001" the exact name of the mission folder? Does it have a map suffix (e.g. .Altis)? If not, the server may be interpreting it as a free-floating mission.sqm that simply happens to be in a subfolder, not as a mission folder.
Wait so is "script.sqf" the same as {execvm "script.sqf"} for the addaction input?
It had map suffix, I removed it for sake of convenience
yes, addAction special case
TIL.
Maybe you're not passing arguments correctly then. If the action shows up but it doesn't work
It works, just not on a server. Waiting for my server to boot up to test .pbo
This was my issue.
I was going through Docs instead of arma source, didn't know it was .PBOs I had to load in
Thank you so much for the help!
Also another question: Is there any way to access inventory-items by id? I'm making a missions where the players are going to use a limited amount of datapads (ACE microDAGR), and going close to a location lets you download data to the datapad, and going close to another location lets you upload this data to base. I would like for the data to actually be attached to the actual item in the inventory, meaning you can drop it, give it to other players, or enemies can kill you and take it. So I need to track each of the ACE_microDAGR's specifically to know which one has what data on it. Googling a bit I haven't been able to find a good solution to solve this. Does anyone know how this could be accomplished?
Hi, i have a question ? I put some units in a truck and everytime the mission start, they are starting to get out so is there a way to prevent that ? I tried to addVehicle but it's not working ๐ฆ
vanilla?
no, i'm using some mods with the new dlc spearhead
try to repro in vanilla
A quick fix is usually to lock the vehicle
Or disabled AI pathing
I tried but sadly it's not working.
{
_grole = assignedVehicleRole _x;
if ((count _grole) <= 1) then
{
private _gindex = (this getCargoIndex _x);
_x assignAsCargoIndex [this, _gindex];
}
else
{
_x assignAsTurret [this, (_grole # 1)];
};
}forEach (units mygrp);
that solved the problem but i think there is a bug with the truck because there is 2 ffv turrets and only one is detected as a turret, the other one is detected as a cargo with a turret index but it still need to be assigned as a turret.
Is it possible to overwrite certain mod/BIS functions with functions declared in Description.ext to test changes?
there is any 3den enventhandler that is executed when a object is placed?
i cant fin any ๐
Is there a way to access a model's RVMAT's properties ingame?
https://community.bistudio.com/wiki/getObjectMaterials this is the closest ( and setObjectMaterialGlobal)
I'm aware of that. What I'm interested in is accessing the properties of the RVMAT itself (if I understand correctly it may not necessarily be available under configFile).
what properties you want? maybe there is some other way
this work on 3den?
3den, I thought you said Zeus ๐
bulletPenetrability/bulletPenetrabilityWithThickness specifically. I'm not happy with using armor directly. Working on an armor penetration system for infantry that takes ammo caliber property into account more reliably.
actually, nvm, on 3den i'm not sure.
hmm where is this information stored?
CuratorObjectPlaced works?
addMissionEventHandler ["EntityCreated",
ah nice
i mean its not in the rvmat afaik
Wiki says it's part of a .bisurf file: https://community.bistudio.com/wiki/Config_Properties_Megalist#BISURF_properties
I guess I can use loadConfig, but that'll hurt.
yea, you will need to know what bisurf you are hiting, and then search the surface data in the config
using HitPart Eh you get the surface you hit, and should be easy to search the bisurf in the config
Issues when running on dedicated server
Good afternoon/morning/night
On my server I have a vehicle clean up script that deletes dead vehicles after x amount of minutes, however lately it appears to be deleting the bodies of any dead players that were inside of it. This means their friends can't revive them (people that arrive after the vehicle has cleaned up).
Does anybody have a decent way to eject dead bodies from a vehicle? I've tried setting the unit's pos to the pos of the vehicle before cleaning it up but this hasn't worked
You have a revive system that uses corpses? Unusual.
moveOut works fine on corpses but you might need to catch them early. There are various vague hints on the wiki about some sort of corpse state change after a time.
i think he is saying that the code deletes vehicles that are destroyed and has now started deleting deleting people still "inside" that vehicle ace and a few other medical mods / scripts sometimes keep a player in a fully destroyed vehicle
Yeah but you still can't delete uncon players in ace
You can delete the bodies once someone actually dies, but not while uncon
yeah idk how this works im guessing hes using deletevehicle on the destroyed car which im guessing it either moves players to debug corner or something or just bad wording
ACE should (may not be remembering 100% correctly) either just prevent the vehicle from being deleted altogether or eject the uncon players and then delete the vehicle
just tried it while uncon and conscious you're right it ejects
inventory items are just strings afaik
dayz took it a step further - like you can write on pieces of paper - but it's not possible in arma 3
what variables hold the UI colors clients have selected?
A function can get them, forgot which was but GUIColor or smth
all I needed to point me right direction. found it.
oh i forgot im using a config lol
Yep that's what I meant
cant use that
Then you can try a macro, ui_f has such macro
oh it looks like you can use code in the array:
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",1};
loadConfig
or loadFile if you want it raw
what's the script counterpart of player squad leader giving MOVE orders to individual group members?
can't find anything in waypoint or group commands
there is no exact counterpart
commandMove is without the waypoint + units go back to formation iirc
"units go back to formation" like they immediately go back from the point i have given them?
that's what doMove says
ah I see that now
doStop should counter it so I guess it's worth trying. I'd rather avoid making separate groups
Hi there, I'm trying to make a mod out of the two functions I've created in a test mission. This is a screenshot from my mod folder and Config.cpp:
I packed the pbo and copied it into the addon folder of a mod folder. I can load the mod with the launcher but the script "addVehicleDamageEventHandler", which is supposed to be run pre init, does not trigger. I think I messed up the script paths somehow.
Can anybody let me know how to set up the folder structure to make them work with the config file I created?
The function couldn't find which file it is
More like you forgot to specify it is
I read that, but I didn't understand it apparently. I thought if I set up the functions the way I did, they would automaticalle look for the files inside the "Vehicles" folder
Re-read please, Category part of it
In my mind, this here would mean <my mod folder>/Vehicles/fnc_handleVehicleDamage.sqf would relate to the class in my config:
it's config.cpp, though? So ROOT>\Category\fn_functionName.sqf should apply?
I see. Is there no way for it to work without specifying the file path? Like in the first example above your red circle?
That's what I thought would happen, but for some reason it doesn't
I have never heard that without file = would work
i assume it's PBO prefix shenanigans 
...Maybe that too
class Arrays
{
file="A3\functions_f\Arrays";``` from vanilla functions_f's config
so yeah, correct prefix + path to folder in file= property of prefix sounds like a solution 
Okay, thank you guys for the help. I'm going to give that a go and let you guys know how it went after I had lunch.
doc to be amended then
edit: done
I still can't get it to work, clearly I'm doing something wrong. This is my folder structure and Config.cpp now:
You forgot your pboprefix
Click the gear icon
Does the path need to be "NPC_Avoid_Vehicle_Eplosions\Functions\Vehicles"?
Eplosions btw
If there is no pboprefix
yes?
I've fixed the name and added the PBO prefix, but the functions still don't show up in the function viewer ๐ต
It's weird, I feel like I should at least get an error that my function location isn't found when I start the game, but I don't even get that
click the gear button in PBO Manager and check what PBO prefix is listed there 
Wait a minute, do you even have CfgPatches?
Ah dang
Also... which software you use to pack it into pbo?
At the bare minimum, the config.cpp file requires a CfgPatches class.
Arma 3 Addon Builder
Ah, at least not PBOManager
I think the missing CfgPatches was my problem all along
And since is a config topic, let's move on #arma3_config if you still have questions
please try again without file = and report back, so I can revert or not the doc change!
Sorry, will do.
Okay, I'll let you know. Sorry for the inconvenience. ๐
We're all here to be the inconvenience ๐
Thanks to you guys I managed to get it working now ๐
I removed the attribute again, it looks like this now:
When launching, I'm getting the following error:
Seems like it's not looking for the script inside the pbo, but rather in the root folder
I assume you need the file attribute after all, or maybe there's still something that's not right
"inside the pbo" isn't a thing. Like, at all
Inside the mod folder then
You need the file attribute if your PBO has a prefix. Which it should.
you're skipping one whole level of class hierarchy 
category is mandatory?
yes
Why dont I see the chat? systemChat "Hello world!"; Could the UI be hidden when in Eden mission playtest?
add small sleep before that, the GUI might not be ready
sleep 0.1
I am calling it from command line in game
messed up gui positions?
default
hmmm
HitPart doesn't fire for vests/backpacks, only the unit itself
.
So, don't know what it was, but it works now. But how can I add a variable in the chat? systemChat ("EnemyDetected" + str _newTarget)
or format
Maybe the problem is that I call it from the eventHandler. And that might not be considered as client. 
which eventHandler?
I placed it out of the eventHandler. ๐
Probably a locality issue then. Wherever the EH was firing wasnโt local to the client.
player setUnitTrait ["Engineer", true, false];
How come if i exec this locally i cant repair damaged vehicles?
You still need a toolkit
(and there's still a limit on how much you can repair, you can get things working but not 100% fixed)
i have a toolkit
i set the vehicle damage to 0.7, is 0.7 not damaged enough maybe?
ah shit it wasnt enough
0.9 works, my bad
This depends on your settings.
Are you looking at the individual broken parts?
what do you mean?
Oh nevermind you're taking about vanilla probably
I'm having trouble with my mission
despite having briefing explicitly enabled in my description.ext the dedicated server seems to always skip it
Does the DS have briefingTimeOut set to a low number in its config file?
hmmm
900
also sorry
I meant debriefing
but that is also >900
like the mission ends and it goes straight back to mission select
There's no missions cycling setup
For setMarkerTypeLocal do I use classname? or the name in https://community.bistudio.com/wiki/Arma_3:_CfgMarkers?
I've tried setting up both "UAV" or the class name "b_uav" and I get missing file errors both types.
createMarkerLocal [_markerName, _controller, 1];
_markerName setMarkerTextLocal "Drone Operator's Position";
switch (side _caller) do
{
case west: {_markerName setMarkerType "b_uav"};
Wiki says "String" so you have to use the Name of the marker, not the classname.
That's what I initially thought, but it wouldn't accept "UAV" as the icon type, which according to the CfgMarkers wiki, is the name of an icon.
I think because you need to define more stuff. Bottom of this page says you need to define Marker Shape and Marker Type like
_markerstr = createMarkerLocal ["markername",[_Xpos,_Ypos]];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
Source: https://community.bistudio.com/wiki/createMarkerLocal
Turns out you don't need setMarkerShape; I've got only createmarker/settype/settext.
And it also turns out it is classnames, but I had a small typo on the classname.
i hate it when its small mistakes like that lol
I'm not sure why, but the "fortify" task is not completing. It seems to be only firing on one of the scriptedeventhandlers when it should fire on both. It's worth nothing, there are 3 current subscribers to the "US_Reinf" event handler (one creates a destroy task, which is working correctly, 2/3 subscribers are working).
first picture, comparison between fortify and defend task files, bottom is where the us_reinf handler is called
when called in the scripted event handler externally again in debug after, it does update the fortify task, so the code is working, just not firing both subscribers
it looks like scripted event handlers give an ID that is different than _thisScriptedEventHandler
16:47:32 "DEFEND SUBSCRIPTION ID: 0"
16:47:32 "FORTIFY SUBSCRIPTION ID: 1"
16:48:07 "DEFEND Task Completed"
16:48:07 "TaskCompleted Event Handler Called"
16:48:07 "Removing Scripted Handler | US_Reinf | ID: 1"
when the subscription id should actually be 0 from above
hmmm more interesting...
// Using _thisScriptedEventHandler for the ID
16:54:25 "DEFEND SUBSCRIPTION ID: 0"
16:54:25 "FORTIFY SUBSCRIPTION ID: 1"
16:55:03 "DESTROY SUBSCRIPTION ID: 2"
16:55:04 "DEFEND Task Completed"
16:55:04 "Removing Scripted Handler | US_Reinf | ID: 1"
16:55:04 "DESTROY Task Created"
16:55:04 "Removing Scripted Handler | US_Reinf | ID: 2"
// Using a stored variable ID from the return of the addScriptedEventHandler function
16:59:46 "DEFEND SUBSCRIPTION ID: 0"
16:59:46 "FORTIFY SUBSCRIPTION ID: 1"
17:00:20 "DESTROY SUBSCRIPTION ID: 2"
17:00:21 "DEFEND Task Completed"
17:00:21 "Removing Scripted Handler | US_Reinf | ID: 0"
17:00:21 "FORTIFY Task Completed"
17:00:21 "Removing Scripted Handler | US_Reinf | ID: 1"
17:00:21 "DESTROY Task Created"
17:00:21 "Removing Scripted Handler | US_Reinf | ID: 2"
There is any event handler for player footsteps sounds?
I want to add some sound along with the player default footstep sounds by script.
I can think on some trick ways to do it, but, i hope there is a simple way.
I forgot if it does return footsteps but there is an EH to detect an unit's sound
Sadlly, no foot steps sound id for SoundPlayed event handler.
Then maaaaybe use EntityCreated for footstep objects? I dunno, wild thought
Yes it's a life server, the dead players inside the vehicles are a corpse - no mods running
When my cleanup script checks for dead vehicles, I try to eject the dead bodies before deleting the vehicle, they do however not eject. This means players that die in vehicle crashes can not be revived, I do remember in the past the bodies falling out once the vehicle cleans up, not now however.
Test the vanilla behaviour maybe.
If they are being deleted on vehicle deletion then you probably can't fight that, and you'd need to move them out earlier.
Hello Everyone quick question. Im not the best coder and im a bit stuck. I have a few units with prefixes. I want to have a script only effect certain units that have said prefix. What would be the most efficient way to do that?
You mean like their editor variable name?
Yes sir
How would I go about moving them out since the moveout command doesn't seem to have an effect on dead bodies
without knowing much else than what you've asked, for editor objects
private _units = allUnits select {"prefixCaseSensitive" in vehicleVarName _x};
[_units] execVM _myScript;
moveOut definitely works on corpses shortly after death.
Oh only shortly after? Ok thanks for that ๐
Thank you! I will try that
@gentle zenith Well, I know it works shortly after. I don't know that it doesn't work later.
if you need an alternative to force out of a vehicle, check my note
https://community.bistudio.com/wiki/setPosASL
Am I missing something here? Units aren't turning on their lasers but the hint is going (and I had previously tried an init EH).
Statement works fine in units init-line.
class EventHandlers: EventHandlers{
class B47_WZ_LaserOn_EH{
suppressed = "(_this select 0) enableIRLasers true;hint 'ir turue'";
};
};```
if you want units to turn their lasers on when they spawn, use enableGunLights with the init EH BUT, you need to add a slight delay after the objects inits. Do like, 2 seconds, the command is finicky.
// unit's class
class EventHandlers: EventHandlers
{
class init = "(_this select 0) spawn {sleep 2; _this enableGunLights 'ForceOn'}";
};
I've tried that init line, but it didn't work either. I'm wanting to use the IR Lasers one since then the AI should turn them on/off with the combat mode.
Current iteration
class EventHandlers: EventHandlers{
class B47_WZ_LaserOn_EH{
init = "(_this select 0) spawn {sleep 2; _this enableIRLasers true;};";
};
};```
hey folks,
What might be the easiest way to get an array of all the drone classes? I'm looking for a generalized method so I can then (in a mod) assign a specific variable to each class.
--There's AFAIK no specific "Drone"/"UAV" class within CfgVehicles, but there must be a way to do it, I think, given that we do have commands such as allUnitsUAV, which selects all currently-existing UAVs in a mission. Unless it just checks all objects for "isUAV=1"
-- Is there any way to get all classes for whom the "isUAV" property has value of 1?
"getNumber (_x >> 'isUAV') == 1" configClasses (configFile >> "CfgVehicles");
Well, if you want classnames then append apply { configName _x }
So, if I'd want to define the array, I would just:
_dronetypes = "getNumber (_x >> 'isUAV') == 1" configClasses (configFile >> "CfgVehicles") apply { configName _x }
?
and then work with that array? I've nevevr worked with configClasses before.
I'd do a scope check too
whatdya mean?
Depends what you're doing with the information but if you only care about classnames that can actually be spawned then you'd exclude scope 0.
basically, for my mod, I have 3 CBA_Settings for people to put in classnames of drones to divide them into three categories (RUF_Commercial/RUF_HighEnd/RUF_LowEnd). However, if they don't specify a category for a certain class, I want to automatically add it to a category, as a default.
Then, for my scripts, I'll check for a specific drone, what category it's in, to then apply a certain variable value and run my script.
RUF_DroneClasses = "getNumber (_x >> 'isUAV') == 1" configClasses (configFile >> "CfgVehicles") apply { configName _x };
{
if (_x in RUF_Commercial or _x in RUF_HighEnd or _x in RUF_LowEnd) then {continue} else {_x pushback RUF_Commercial}
}
forEach RUF_DroneClasses;
Does that make sense, though?
And cool, yeah, I'll add a scope check. Should just be 2, I think, as it's drones actually spawnable in editor/mission.
for some reason this is not triggering when i would expect it to be:
ctrlAddEventHandler ["Draw",
on a RscMap control created via
cutRsc ["AAS_HudDisplay","PLAIN",0];
class MiniMap: RscMapControl
{
idc = AAS_IDC_HUDMINIMAP;
x = MINIMAP_X;
y = MINIMAP_Y;
w = "(20/100) * SafeZoneW";
h = "(20/100) * SafeZoneH";
colorBackground[] = {0.7,0.7,0.7,1};
sizeExLabel = MAPTXTSIZE;
sizeExGrid = MAPTXTSIZE;
sizeExUnits = MAPTXTSIZE;
sizeExNames = 0.05;//MAPTXTSIZE;
sizeExInfo = MAPTXTSIZE;
sizeExLevel = MAPTXTSIZE;
};```
is this due to cutRsc use?
Is the map visible? Both fade and show
yep (bottom right)
it does refresh, work, etc
just the draw control EH does not fire
it does initially when i am in respawn dialog but then stops when i get to player control
_x spawn
{
_resource = _this select 0;
_displayIdc = _this select 1;
diag_log ["AAS_MapResources",_this];
while {true} do
{
waitUntil
{
sleep 0.1;
(!(isNull ((uiNamespace getVariable _resource) displayCtrl _displayIdc)))
};
diag_log ["AAS_MapResources - ctrlAddEventHandler",uiNamespace getVariable _resource,(uiNamespace getVariable _resource) displayCtrl _displayIdc];
((uiNamespace getVariable _resource) displayCtrl _displayIdc) ctrlAddEventHandler ["Draw",
{
diag_log ["AAS_MapResources - Draw",_this];
[_this] call AAS_fnc_createMapMarker;
}];
waitUntil
{
sleep 0.1;
(isNull ((uiNamespace getVariable _resource) displayCtrl _displayIdc))
};
diag_log ["AAS_MapResources - isNull",(isNull ((uiNamespace getVariable _resource) displayCtrl _displayIdc)),uiNamespace getVariable _resource,(uiNamespace getVariable _resource) displayCtrl _displayIdc];
};
};
} forEach AAS_MapResources;```
the system even has a re-add mechanic in case the control gets destroyed - but it doesnt
just draw doesnt get triggered any longer
on 2d map it all works
it does work on the hud element initially
7:36:37 ["AAS_MapResources",["AAS_CurrentDisplay",55001]]
7:36:37 ["AAS_MapResources - ctrlAddEventHandler",Display #1119006,Control #55001]
7:36:37 ["AAS_MapResources - Draw",[Control #55001]]
7:36:37 ["AAS_fnc_createMapMarker",[[Control #55001]],Control #55001]
...
7:36:43 ["AAS_MapResources - Draw",[Control #55001]]
7:36:43 ["AAS_fnc_createMapMarker",[[Control #55001]],Control #55001]
7:36:43 ["AAS_fnc_createMapMarker - drawIcon",Control #55001,"\a3\ui_f\data\Map\VehicleIcons\iconManLeader_ca.paa","\a3\ui_f\data\Map\VehicleIcons\iconManLeader_ca.paa","\a3\ui_f\data\Map\VehicleIcons\iconManLeader_ca.paa",[4421.26,6476.64,56.5718],180.878,"AS (CM:5R,B:3A,SM:3F,UP:3M)"]
the only thing that would make sense to make the control/display/resources gets destroyed and recreated without the draw EH - but then above isNull should get logged ๐
every step creates a footprint texture on the ground, since they are terrain decals maybe you can detect someone walking through checking for these decals
- 11:36:49 Error Foreign error: Unknown enum value: "IncomingMissile"
removeAllEventHandlers does not recognize IncomingMissle..?
What is the left side argument to it?
A unit or a group
attached laptops to radio tower platforms and added some actions to them. if i order a unit to use the action, he climbs up, does the thing, climbs down, no problem, and it's in A2. suddenly AI doesnt jump off the edges!
(the towers are generated by script)
the point being? they jump in A2, in A3?
usually
which is it, both?
i can confirm for A2 and someone just recently confirmed it here for A3
we were talking about helicopter boarding from roof
how is that even remotely related?
boarding involves pathfinding around the vehicle, action requires "move โ trigger action โ done"
even when the door is facing in their direction and not on the opposite side?
like, when there's no need to actually go around
yes
so, if that laptop was attached to the helicopter, and the helicopter was hovering near the edge of the roof, and i ordered the unit to use the action on that laptop, the unit would NOT jump off and do everything correctly?
because he's not path-planning around the vehicle (i guess)
try and compare what is comparable
i mean, entering the vehicle is asking the unit to perform a "get in" action, the difference is that the action is on a moving vehicle object, and here it's on an unmovable laptop (that was placed where it is during the game, so it's not "static" like a house)
don't try to use logic
use empirical evidence
Units have specific entry points for vehicles and they will path (in quite rigid ways) to get to them.
User actions on objects don't have this and the unit will probably accept "close enough".
hence the "let me walk 10m away from the car before boarding it"
does it mean that if i attach an invisible object to the helicopter, addAction a "board" action to it, that does moveInCargo to the unit who used it, it'll make them reliably board the helicopter and avoid jumping off the roof?
if they don't have to move to trigger it, like this laptop addAction, yes
but you then cannot order AI to "board", you will have to order them to do an action
yeah and call it "get in (safely)"
You can skip the action part. Order them to move to the helo's position, waitUntil they're close enough, then move them into it.
i'm doing that already with agents. they can't be ordered to get in
so im using this line to make sure that allUsers turn into players i.e meaning that they all fully loaded the scenario:
waitUntil {count allUsers isEqualTo count allPlayers};
but this takes alot of time, is there any faster way?
i found out that it is the "only really reliable"(for me atleast) way to make sure that all players fully loaded the scenario
but this takes alot of time, is there any faster way?
What do you mean by that? It would take as long as the slowest client needs to load in
yes i tried this but never managed to get it to work with getClientState
Trying to make a scouting mission, where the map marker for the enemy target (just a default OPFOR unit marker) doesn't show up on the player's map until the player lases the target. I made a trigger that fires when the player lases the target, but how can I sync that to the map icon appearing?
I'm not trying to spawn a custom map marker or anything, just hide the unit map marker until the laser designator hits the target, and then show the unit map marker.
A quick way would be to have the marker start with its opacity set to 0, then use setMarkerAlpha to reveal it with the trigger
Starting with no marker and creating it from the trigger would also be pretty easy, but not as easy
Ooh, okay. That would work too. But how can I remove the default map marker that appears when the player knows about the AI unit being there? Like the red circle with the small red triangle? (I only want to remove the default map marker for that specific unit, not all of the OPFOR guys.)
I'm not sure that you can
Those markers are generated automatically as part of the difficulty settings. You can turn off that difficulty setting, but that will affect everything.
*and I'm not sure if you can control that difficulty setting per-mission (https://feedback.bistudio.com/T170976 :U )
Take a look at my MPSync mod. It's still a work in progress but its pretty solid for menu position respawn templates
I think those markers work from group knowledge, so forgetTarget spam might work to block the map marker for specific units.
Not tried it though.
vehicles/objects
Actually just vehicles
Had to double check
I'd probably get that if it was a static object, but it's only vehicles. I'll see if I can find exactly the vehicle causing it, spotted this one in a couple RPT files.
hello, im still new to arma 3 scripting and im trying to make units get in vehicle in order, i dont know if this is the right place to ask for support, this is the code im using i placed a move waypoint with the script attached to it once they reach the way point i get error order ordergetin: type object, excepted array
`_vehicle = v1
_units = [s1, s2, s3, s4];
{
_unit = _x;
_unit orderGetIn true;
sleep 1;
_unit assignAsCargo _vehicle;
} forEach _units;`
https://community.bistudio.com/wiki/orderGetIn
orderGetIn takes an array as input. _units orderGetIn true; And place it below the forEach. You probably want to assign the vehicle first, and then order to get in.
_units = [s1, s2, s3, s4];
{
_x assignAsCargo _vehicle;
} forEach _units;
s1 assignAsDriver _vehicle;
_units orderGetIn true;```
well as i said im still new and this is my first try at scripting in the game, so if you mean by assign the vehicle the vehicle is named v1
No problem, I am new too. ๐ _vehicle = v1 is assigning a v1 object to a variable _vehicle.
_x assignAsCargo _vehicle means to give an order to a unit _x to take the vehicle in _vehicle as his mean of transport.
And orderGetIn means to make them all get in the vehicle they have assigned.
ohh thx for the help but i think the order did not work as no one got into the driver seat
that is because you tell them AsCargo
oh
sure
Thank you again! i was able to make it work with the assignAsDriver
_vehicle = v1;
_units = [s1, s2, s3, s4];{
s1 assignAsDriver _vehicle;
_x assignAsCargo _vehicle;
} forEach _units;_units orderGetIn true;
private _vehicle = v1;
private _units = [s1,s2,s3,s4];
{
_unit = _x
if (_unit = s1) then {
_unit assignAsDriver _vehicle;
} else {
_unit assignAsCargo _vehicle;
};
} forEach _units;
Currently you are assigning s1 four times to the driver.
(and once as cargo :D)
also assing
private _vehicle = v1;
private _units = [s1,s2,s3,s4];
for "_i" from 0 to (count _units - 1) do {
private _unit = _units select _i;
if (_i == 0) then {
_unit assignAsDriver _vehicle;
continue;
};
_unit assignAsCargo _vehicle;
};
Thanks everyone for the help!!
Can you get the name of a script that called a given function?
// someCode.sqf
call fn_whatsMyName;
// fn_whatsMyName.sqf
systemChat "Your name is: " + <someCode.sqf>
When you spawn a script via spawn or execVM, you get a handle as a return. That handle contains the script "name" which can also be assigned internally using scriptName. Are you wanting just that? Or the whole file path?
myScriptName = [] spawn {
scriptName "Awooogahhhh";
systemChat str myScriptName; // System: Awooogahhhh
};
Just the filename itself, but does that work "out of the box" or do I have to specify a scriptName at the top of every single one of my functions?
Basically what I'm wanting is to pass the name of the file calling fn_whatsMyName, without having to specifically pass it every time
If the use-case seems a little odd, I wanted to make a logging function so I'm not just using systemChat everywhere, and I wanted to include what code is calling it.
// fn_someCode.sqf
"doing X" call TAG_fnc_devLog;
...
"doing Y" call TAG_fnc_devLog;
...
// etc.
Output (systemChat and diagLog):
[HH:MM:SS] [TAG_fnc_someCode] doing X
[HH:MM:SS] [TAG_fnc_someCode] doing Y
...
The full TAG_fnc_someCode is optional, it could just be someCode
There doesn't seem to be anything that does this automatically. There's allegedly this magic variable: https://community.bistudio.com/wiki/Magic_Variables#fnc_scriptNameParent but it doesn't appear to be autogenerated.
You can try to use scriptName to do it, or you can write it in your message string manually every time, or you can do something like this for a set-once-per-file thing:
// at top of file
private _functionName = "TAG_fnc_someCode";
// log call
[_functionName, "doing X"] call TAG_fnc_devLog;
// in devlog
params ["_functionName","_string"];
private _text = format ["[%1] [%2] [%3]", _time, _functionName, _string];```
well if you use CfgFunctions it is (which is what anyone should use anyway)
Yep _fnc_scriptNameParent did exactly what I wanted ๐
I will add this event handler to every AI unit upon initialization. How can I create more variables of isRunning, so every AI has its own and at the same time it would be accessible in the eventHandler? I need it for the code to not be launched in less than 0.8 sec intervals. Should I make an array for it? Also can I pass additional arguments to the eventHandler?
isRunning = false;
group _unit addEventHandler ["KnowsAboutChanged", {
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
if ((_targetUnit == player) && (isRunning == false)) then {
isRunning = true;
systemChat (str _targetUnit + " detected by " + str _group + " at " + str time);
[_group] spawn {
params ["_group"];
sleep 0.8;
_group forgetTarget player;
isRunning = false;
};
};
}];```
Set a variable on the group?
like private _isRunning in the group init for example?
No, like _group setVariable ["isRunning", false]
Also usually you wanna toggle between true & nil to save having to initialize the vars.
In this case you're adding an EH to the group anyway so it doesn't make much difference.
Like this? setVariable and getVariable?
group _unit setVariable ["isRunning", false];
group _unit addEventHandler ["KnowsAboutChanged", {
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
if ((_targetUnit isKindOf "Man") && ((_group getVariable "isRunning") == false)) then {
_group setVariable ["isRunning",true];
systemChat (str _targetUnit + " detected by " + str _group + " at " + str time);
[_group] spawn {
params ["_group"];
sleep 0.8;
_group forgetTarget player;
_group setVariable ["isRunning",false];
};
};
}];```
looks correct, yes
Either that or use the getVariable version with the default
isNil { _group getVariable "isRunning" } or _group getVariable ["isRunning", false]
When I use the parameter true for making the var. public. That means that the name would not be usable anywhere else out of the group namespace?
You definitely shouldn't do that here, because you're using it strictly locally.
If you use the public parameter then that var on the group will just be published to every client.
It's still a var on the group though.
Hmm, if I made this multiplayer, would it be necessary to publish it or not? Event handler should happen on the server, so private I suppose.
Normally event handlers run on the machine they're installed on.
Note that this stuff gets tricky if you want to support headless clients, especially mods that auto-balance.
but otherwise you're probably creating the units on the server, that's where they stay, and that's where their event handlers run.
I have a question. Why does Arma 3 freezes for few seconds when you use an call a DLL which takes times to execute in RemoteExec environment ? Is it specific to the editor or will it do the same on a dedicated server ? I mean RemoteExec is supposed to be asynchronous, so why does the game freezes like i was calling the DLL in synchronous environment ?
the dll call is synchronous process-wise
remoteExec may be scheduled, but it will not be parallel
This needs to be changed. We need the possibility to decide to execute a DLL synchronously or not. Executing a DLL asynchronously when you're connecting to a distant server is mandatory.
If i execute the code asynchronously on the extension sie, the dll execution will finish before my asynchronous process is finished. How will the game read the answer ?
I guess it'd have to ask for it.
My DLL is meant fo dedicated servers, i'll gve it a try a server i'll create and i'll test the DLL. If the server doesn't lag it will be fine
can a display be used to generate video feed from a camera?
I understand the concept of procedural texture for pojection on surfaces, but its not clear to me whenever i can actually project to a display control.
maybe using a picture type control, and passing it the render value of your camera
how would that even be?
_Picturecontrol ctrlSetText (_Picturecontrol setObjectTexture[_data]);
```?
that's it, for example:
_control setText #(argb,512,512,1)r2t(rtt,1.0)
I don't remember where, but there is a page on the wiki that tell you how to get the rtt of a camera
it's exactly the sme as if you wanted to display the camera video feed on the texture of an object, you need to get the rtt of the feed
Render To Texture
so the text can actually be fed directly?
That where I had doubts, i assumed it needed to "be set" as a texture too
you can display the r2t (Render To Texture) on any object texture. The picture control is working exactly as an object texture so you should be able to pass the r2t of the camera to the picturebox using ctrlSetText
thanks, i shall test then
Just found a solution. The game freezes because my DLL loops until an answer is received. I can loop with the game scripts instead of the DLL but an asynchonous DLL call would really be welcomed. Not all probems can be fixed that way
In this mission we look at Projecting A Camera Feed during a mission in game briefing area, to provide players with drone footage without giving them all UAV terminals as they would instantly take over the drone and crash it into the ground. Or without having to try and work with the nightmare that is getting the live feed models to work in mult...
Is there a simple respawn script useful for one-life operations where I want a backup way to respawn people who occasionally die to glitches, disconnect, etc?
so while playing a mission with dbo_horses I noticed that sometimes it can bug out in a way that camera is stuck to one entity while you still have control over the other. I tried different UAV-related functions and camCreate stuff but couldn't achieve this, any ideas how to replicate this bug? Ngl this opens a way for some Resident Evil-like stuff lol ๐
Super Miller Land does not use that while effect is pretty much the same but that would involve much more scripting than I would love to do.
When controlling the horse and going into Zeus I got stuck when going back to my player. Could only shoot.
Also when you get shot (and unconscious) while riding you get bugged (only tried with ACE).
does "search and destroy" waypoint ever reach a finished state by itself or it requires skipping from script
Vehicle/Unit works fine for me.
It would be different if you run it on a projectile, in which case that would remove Ammo events.
Hello guys maybe someone can show me how to run a scirpt for a few seconds and then stop it.
I want to execute a script for a certain time and then I want it to stop again. I have already tried a bit with the terminate function but somehow the script still runs. How do I get the script to terminate after a few seconds?
This is in my trigger:
null = [] spawn {myHandle = [] execVM "script1.sqf"; sleep 4; terminate myHandle;};
and this is the sqf file:
playMusic ["RadioAmbient5", 1];
When i found out how to edit a small script i want to insert a bigger script instead of the playMusic. In the Arma wiki I have already seen that you can end the music simply with playMusic ""; but I want that really the script is ended.
I hope this is somewhat understandable what I mean ^^
Why stopping the music doesn't work? What do you mean by end the script?
On it's own. It's just very thorough.
Depends on your setup. Is it one life, no respawn point? Is it respawn points but no respawn tickets? Etc
it says in biki that if the group is in a chopper, its search area will be bigger. but what if at the moment the waypoint became current, the group was in a chopper, but since then was unloaded from it, while the waypoint remained current
Like the group is separate from the choppers pilots' group? Lands and gets out?
yes
It should function as normal.
as if they were on foot?
Had exact scenario multiple times last night. Yep as on foot.
What you are doing right now doesn't make sense. Using sleep and terminate like that would only make sense if script1.sqf contained code that can run for (more than) four seconds (e.g. waitUntil, another sleep or an endless loop).
As it stands, script1.sqf only contains playMusic, and that command is non-blocking: It instantly completes once it has started the music, it does not wait for the music to finish. Scripts terminate automatically once their last command has been executed, so by the time you reach terminate myHandle, the script that myHandle refers to has long been terminated automatically.
A proper solution would be running [] execVM "script1.sqf" in the trigger and moving sleep into the script:
playMusic ["RadioAmbient5", 1];
sleep 4;
playMusic "";
```That way, the music stops after four seconds. As explained above, the script terminates automatically once the last line has been executed.
my big goal is to build a script that marks players for a certain time on the map. For this I have thought that the script is executed for a certain Zwit and then terminated again. The music is just to test how I can start and stop the "script".
One thing you misunderstood is, end of a script is when the script executes the last line of it
Okay that makes sense why the music doesn't stop when I exit the script. I found a script that marks players on the map. But this should only happen for a few seconds.
So I thought about terminating the script after par seconds. Is terminate the right command for this?
Actually, that would more and more knowledge and time to explain what to start
is there no easy way to stop and restart a script that runs in the background?
To mark the players I would have used the
Dynamic Player Markers Script
https://forums.bohemia.net/forums/topic/147033-dynamic-player-markers/
If you are looking for better and updated player markers use this Soldier Tracker ( Map and GPS Icons / Markers ).Sorry folk, this has been discontinued.Summary / infoA script to mark players on mapAll markers are created locallyDesigned to be dynamic, small and fastShows driver/pilot, vehicle n...
using waitUntil you can halt a script, but what you want has to be a bit more complex as POLPOX mentioned.
The stop will only prevent script progression/looping, you need a framework (function chain) that starts and shows whatever you want to do during your time period, and then halts/terminate and hide whatever you want to until required again.
You just have to make sure that there is an actual way to "turn on and turn off" what ever you are doing.
okay thanks for the help, I will try my best
Yeah, it has a timeout if no targets are spotted.
I have a custom "Pick Up" action to remove an object and put an item into a player's inventory, but I put in a check to make sure the player actually has space.
This is all working as intended, but when the player tries to pick up the object from the ground holder, the item is completely deleted.
If the player open the inventory of the ground holder and tries to move it to their inventory, the item seems to have completely different properties.
- The item does not stack with other items of the same type
- The item has a seemingly completely different mass
- It can be fit into the inventory even though
canAddreturns false and does not seem to increase the inventory slot's bar for "how full" it is
- The custom action I have tied to the item does not appear if the glitched item is present
- When doing
backpackItems player, it returns an array of the four items, with the same class name
if (_unit canAdd _itemClass) then
{
_unit addItem _itemClass;
}
else
{
cutText ["Not enough space to pick up.", "PLAIN DOWN"];
private _holder = "groundWeaponHolder" createVehicle [0, 0, 0];
_holder setPosASL getPosASL _object;
_holder setDir floor (random 360);
_holder addWeaponCargoGlobal [_itemClass, 1];
};
deleteVehicle _object;
Is this item actually a weapon then?
It's a CBA_MiscItem
^ some items are locked to where they can actually go into your inventory, canAdd returns false if by config they cannot be put in specific inventories even if they can be fit in mass standards
It's set to go any of the "normal" inventories
(Uniform, vest, backpack)
I did just see that there's an item cargo command, it might be because of that
regarding point 4, its a bit inconsistent in between commands and what type of classname you are trying to check if it returns the items as separated indeces in inventory arrays or if they stack in a subarray, this can be commonly see with mags and mags with count of 1, like granades
I might be wrong about this one, but canAdd check in numerical order of the inventory type and evaluates if you can add the item to the first found inventory when you use a unit as the object to check the space within. You might want to specify the containers in the player to which you are trying to check,
alternatively, you also have the canAdd version of the command for each inventory type in a unit
Thought experiment.
I'm tinkering with gathering data on the fuel economy of the vanilla vehicles, and have a script that handles it pretty satisfactorily. However, it's just in straight lines. As long as I'm going to be going down the entire list of every vehicle, I may as well collect all the useful information I can.
Is there a practical way of measuring a vehicles turning radius? Assuming a perfectly flat plane (the VR terrain).
My thought so far is a triggered script; you start the vehicle and get it into a consistent turn at the speed you want, no eccentricity. Then when you start the script, it places markers along your trail at regular intervals until you have a complete circle, then check their distance against each other sorting for the longest distance, and half that for the radius.
Hrn... easier still to just waitUntil direction is 90 and 180 from starting direction.
...yes
Yeah but that still doesn't explain why the item seems to be "in limbo". Arma doesn't seem to fully recognize it (or at least ACE doesn't, since that's how I'm doing my action / checking if the player has the item), since I don't get the action I have tied to it
How do you open / what program do you need to open a .mdmp file?
bi only tool
As in like BI employees?
Seems odd because my game crashed when I was testing something and was going to loop at the rpt to see what happened, all it said was that it made a minidump
yeah normal
You need the symbols to get much out of it, and only BI have those. Dedmen does like checking the minidumps sometimes.
yes game crashes produce mdmp which bi use to diagnose the crash reason
Yeah but I mean, why not have it in the tools?
Uh, the tool is just windbg.
Commercial software never gives you the symbol files because it makes it too easy to reverse-engineer.
At minimum it tells you when each function starts and ends, and what they're called.
Gotcha
You can throw it at windbg yourself, but if the crash happened in Arma rather than a windows DLL it won't tell you much more than that.
Did you try addItemCargoGlobal btw?
Yeah I was trying to test that now
Only other change I've made is putting my script into a cba progress bar
Realized I had a variable called _time, which I thought might have been causing the issue, but the crash still happens
The script works if I test it in the console, but not when running it normally (i.e. actually using the action)
You have a replicable crash?
That was the issue, works fine withaddItemCargoGlobal
Yep, every time I try to use the ace action on the object to pick it up, I CTD; however, using the exact same script in the debug console works fine
how long is it?
The progess bar or what?
The minimum crash code :P
Nah, I mean the minimum SQF required to cause the crash.
Not sure, I'd have to do some testing and removing bits at a time
This is the whole script though (minus some documentation I put at the top)
// Rough length of the "PutDown" animation
#define PUT_DOWN_ANIM_TIME 0.925
#define PROP(PATH, DEFVALUE, DATATYPE) [PATH, DEFVALUE, DATATYPE] call BNAKC_fnc_getConfigProperty
params ["_unit", "_object"];
if !(isText (configFile >> "CfgVehicles" >> typeOf _object >> "BNA_KC_Deployable_item")) exitWith
{
format ["%1 is not set up properly for BNAKC deployables", _object] call BNAKC_fnc_devLog;
};
private _objectClass = typeOf _object;
private _name = PROP((configFile >> "CfgVehicles" >> _objectClass >> "displayName"), "item", "text");
private _itemClass = PROP((configFile >> "CfgVehicles" >> _objectClass >> "BNA_KC_Deployable_item"), "", "text");
private _pickupTime = PROP((configFile >> "CfgVehicles" >> _objectClass >> "BNA_KC_Deployable_placeTime"), PUT_DOWN_ANIM_TIME, "number");
[
format ["Picking up %1...", _name],
_pickupTime,
{
// Condition
_this#0 params ["_unit", "_object", "_itemClass"];
lifeState _unit != "INCAPACITATED" and // True if unit is uncon
alive _unit and // True if unit is alive
[_unit] call ace_common_fnc_isAwake // True if unit is not dead and not unconcious
},
{
// On Success
_this#0 params ["_unit", "_object", "_itemClass"];
_unit playAction "PutDown";
// Check if the player has enough space to store the item, if not, drop it on the ground
if (_unit canAdd _itemClass) then
{
_unit addItem _itemClass;
}
else
{
cutText ["Not enough space to pick up.", "PLAIN DOWN"];
private _holder = "groundWeaponHolder" createVehicle [0, 0, 0];
_holder setPosASL getPosASL _object;
_holder setDir floor (random 360);
_holder addItemCargoGlobal [_itemClass, 1];
};
deleteVehicle _object;
},
{
// On Failure
},
[_unit, _object, _itemClass]
] call CBA_fnc_progressBar;
And this is the ACE Action on the object:
class PickUp
{
displayName = "Pick up FX-7";
icon = "\swlb_core\data\insignia\medical.paa";
selection = "interaction_point";
distance = 5;
condition = "true";
statement = "[_player, _target] call BNAKC_fnc_deployablePickup;";
};
Does it crash when the progress bar starts or when it ends?
Starts, as soon I let go of windows key to use the action, I CTD
Reverted my changes, redid the Weapon to Item change, and removed an extra deleteVehicle, both of those worked fine.
Any cba progress bar
[
"Picking up",
5,
{
// Condition
true
},
{
hint "completed"
},
{
hint "aborted"
},
[_unit, _object]
] call CBA_fnc_progressBar;
This is an example from the CBA Wiki (other than the comment and title change), and causes me to CTD
Yep
Just tried removing the arguments part from the progess bar as well, still CTD
It's just the params and progress bar
params ["_unit", "_object"];
[
"Picking up",
5,
{
// Condition
true
},
{
hint "completed"
},
{
hint "aborted"
}
] call CBA_fnc_progressBar;
An ACE progress bar works perfectly fine, no issue whatsoever
[5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar
Asked about it in the #976228110078992456 message channel in the ACE server, Dedmen took a look at it.
Apparently CBA's KeyUp crashed
CBA progress bar has a lot of horrible stuff intended for input blocking. Probably related.
Does it crash if you use a key other than the Windows key? I'm pretty sure Windows doesn't like it when you try to block or otherwise hijack Winkey input
is fn a required prefix for sqf files if you already state their file in the cfgfunctions declaration?
trying to make the vscode header extension i use autocomplete the function name in the example but fn vs fnc is causing me problems
Nah, fn_ is just the prefix it adds if you don't specify a file path for that function.
that is truly epic
now i just need to figure out how to make my macro extension work in .sqf files
doesnt help that i dont actually know which extension is doing macros
Only ever got a crash when using an ACE interact, tried using other keys with a normal addAction (including the windows key) but no crash.
Windows doesn't care
is anyone aware of a method of letting players that are not part of a unit's group to hear its voice lines over radio (without just adding the player to their group)
e.g if theres an opfor squad i want to be able to listen to that squads radio transmissions while still being blufor
With vanilla radio channels like direct group side i dont think there is a way to do that.
Myb if you scripted a custom radio channel myb.
Your best bet would be to use TFAR or ACER and just find the frequency of the radio channel.
are you talking about the direction call outs that AI make or player voip?
if players, are you talking vanilla radio channels or acre/tfar?
here is how you add a voip radio channel in vanilla arma. The AI side chat callouts are a mystery to me. I always have that disabled in my missions
https://community.bistudio.com/wiki/radioChannelAdd
the ones ai make
shouldve clarified ai in my message mb
No respawn point version.
how would I got about getting all item class names from a single mod?
Im making a limited arsenal and I need a list of of kat medical items
unfortunately, you are looking at creating a debug respawn and deleting it. you can assign the respawn to a single player if needed
what is KAT's tag?
"KAT_someitemhere"?
Okay. Good to know. Thank you
Iโll just try to work out something else
KAT_...
grab the unit, create the respawn, save the return, create a respawn event handler, delete the respawn in that handler, all locally
@oak island
private _items = toString {
"KAT" in configName _x
&&
{(getNumber (_x >> "scope")) >= 2}
} configClasses (configFile >> "CfgWeapons");
_items = _items apply {configName _x};
something like this
may need additional filtering depending on other mods
Heads up.
There is at least one kat_ classname that is in CfgMagazines; kat_painkiller(s).
There is a classname list on their GitHub but it's not an exhaustive list.
https://github.com/KAT-Advanced-Medical/KAM/wiki/Classnames
so all items are stored in CfgWeapons?
I got it working for the most part. Threw in a toLower for configName. Had to do some manual filtering, but it got me what I want.
thank you!
No. Not all items.
kat_Painkiller is configured as a magazine so it can contain 10 pills in the box.
excepts exist then....
Change CfgWeapons to CfgMagazines to return the magazine in KAT.
Edit: Should work... I don't want to start Arma this late in the day. ๐
Thanks! dont worry about it.
Anyone make any ChatGPT hooks yet?
chat gpt is poo poo for sqf. its too obscure
or did you mean an extension for use inside of arma 3 lol
One of the largest systems in ACRE is getting around this limitation.
It ain't easy.
also SQF is fine for large projects if you know how to organize and manager your code.
as far as code execution goes
ACRE and ACE almost entirely run inbetween frames
again it just depends on what you are doing and how often you are doing things
is there a getter or any function to check if squad that has reached a waypoint is there in a formation? By default waypoint will continue once the squad leader is near it and he will not wait for any of his team members. I set a timed delay but this is either too long or too short depending on how AI decides to navigate during their movement. I thought of delaying the waypoint completion until whole squad is standing in a formation but I'm a bit stuck rn
perhaps check unitReady on every unit in group?
Is there an easier way of detecting if Shift or Ctrl are being held down, other than setting up an OnKeyDown EH?
afaik, no
Blast. I can probably get it to work as planned, but just feels messy xD
Can I use breakOut like here to jump out of a function?
fn_myFunc.sqf:
scopeName "fnc";
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
_group setVariable ["isForgetRunning",true];
if (_newKnowsAbout < _oldKnowsAbout) then {breakOut "fnc"};
...```
https://community.bistudio.com/wiki/exitWith this might be better for your use
if (_newKnowsAbout < _oldKnowsAbout) exitWith {};
What is the correct way of storing some info about players (their in-game characters) in an array in MP? Should I use the player object as an index or some other identificator?
So I can find the corresponding value, whenever I have to deal with a player. And once the player dies or something, the corresponding value would loose its relevance. So then I would probably need to erase that specific column.
yes
Would I need to be using http://intercept.github.io ? or something similar?
Intercept.GitHub.io : Github Pages
you can do:
player setVariable ["testVar", "Value"];
and then in onPlayerRespawn where it should have _oldUnit as param iirc:
_oldUnit setVariable ["testVar", nil];
and if you want to now give the player a new starting value just put under the last line in onPlayerRespawn:
_newUnit setVariable ["testVar", "Value"];
You can, but it's only sensible if you're more than 1 scope deep
If you're still in the main scope use exitWith as MrThomasM said
I think I need to use an array for this, because I need every AI unit to have its own "sheet" of existing players and those values. But I am not sure how to identify those players.
In general they care more about their code than your end-user performance/FPS.
lol... well caring about the code getting what needs to be done done is kind of important
but most, i'd say 99% of SQF coders are fucking idiots.
and i say that in the most caring way possible
you can change "Value" to [] and then you have an array value
seriously, the amount of times ive seen simple things like code being copied and pasted line after line instead of using a loop
or other incredibly simple inefficiences
I have set up this code to test it out. It works, but I am not sure what to use instead of the "player" keyword for MP. The array will be stored on the AI's side, not the player's though.
...
private _findTargetUnit = (_group getVariable "myArray") findIf {(_x select 0) == _targetUnit};
systemChat (str _findTargetUnit);
...```
Maybe some network ID.
what i like to use to reference player units across clients etc is store there uid and then retrieve the player by using the getUnitByUID function.
https://community.bistudio.com/wiki/BIS_fnc_getUnitByUID and https://community.bistudio.com/wiki/getPlayerUID
so get uid and store with getPlayerUID and retrieve from the array with getUnitByUID
Thanks will try it out.
is there any way of getting all holster proxies present on the player's model? 
purpose is using attachto to put pistol in holster proxy
Does player selectionNames "memory" select {"proxy:" in _x} give them to you?
i do believe so, thanks ๐ ["proxy:\a3\characters_f\proxies\binoculars.001","proxy:\a3\characters_f\proxies\pistol.001","proxy:\a3\characters_f\proxies\launcher.001","proxy:\a3\characters_f\proxies\weapon.001"]
No those are weapon proxies
though, speaking of -- would i be able to attach with the same rotation as well? i cant think of any commands that'd let you get that rotation
holster proxy is on vest
inb4 holster proxies on the facewear
It probably does work if it's defined in the memory LOD of player model (which seems it's not) but it could be off visually
searching through vestcontainer doesnt help either
It's a dummy container afaik
Not the actual "vest"
ya
What does "getModelInfo" return on it?
on the vestcontainer?
Yes
["dummyweapon.p3d","a3\weapons_f\dummyweapon.p3d",false,[0,0,-0.661233]]
so yeah just dummy
Try creating the actual model
invisible and no collisions
And then
_vest selectionNames "memory" select {"proxies\pistol_holstered" in _x}
the dummy one
I said create the actual model
getmodelinfo vest player doesn't work 
oh ofc
private _info = getText (configFile >> "CfgWeapons" >> vest player >> "model");
private _vest = createSimpleObject [_info, getPosASL player, false];
_vest selectionNames "memory" select {"proxies\pistol_holsteredโ in _x}```right? 
I guess
does nothing
Does it create the vest?
nope
Then check the config manually
Is _vest null?
removing last line makes it create
private _info = getText (configFile >> "CfgWeapons" >> vest player >> "model");
private _vest = createSimpleObject [_info, getPosASL player, false];
(_vest selectionNames "memory") select {"proxies\pistol_holsteredโin _x}
ffs
that quote mark
returns empty array btw
its creating the model just fine now
Guys im just downloaded 2035 russia mod now but i cant see anything in editor
just returning empty array
HELP ME PLEASE
Help me pls
This isn't troubleshooting channel. Ask in #arma3_troubleshooting
Idk im new
Can you help
Ask there
Ok
(i still cant get used to the order of precedence being the way it is and put everything in braces just in case)
What about just selectionNames?
Nular > unary > binary
"proxy:\a3\characters_f\proxies\pistol_holstered.001", could be it?
Binaries have different ones
Yes
what if there's more than one proxy? 
does it just increase in .002, .003 etc
There can only be 1
ive seen vests with multiple pistols when holstered tho
in part of the model cfg -- not scripted
but last time i've seen that - all the proxies showed copies of a single sidearm 
ya they did
i just want to add support for multiple for the sake of it
and/or not having it randomly break
In that case yes
epic thx
next question, how would i make it have the correct rotation when attached? 
So what you could do is first find the offset of the proxy in vest model
Then apply the offset to the left leg bone of the player model maybe or right leg? Dunno
operation "rewrite parts of engine in SQF"
I could just have the pistols swap so the one just "not in use" would go to the small of the back/wherever is configured rather than try bodge together a holster part
Feels like it'd probably be best (and look least shit, can just check holster scale for if it should appear or not)
render 1x1 px rectangles on screen to fully cover it and write your own render in sqf
to update the graphics in ofp
run a "thread" for each pixel in scheduled
and call it "scheiders"
now i need to find where on earth webknight does his definitions for melee holsters so i can use those for melee weapons except he doesnt use cfgfunctions
lord have mercy
Did somebody say SQF-VM?
I feel like I have been summoned
If somebody's written an intercept plugin with VS Code before, could you send me a DM, I'm getting a lot of declaration has no storage class or type specifier errors
what'd you emulate in it
Emulate? You mean running sqf outside of the game? ๐
inb4 SQF-VM-as-an-extension
SQF-VM is an existing project to run sqf outside of arma
does it replicate how the engine works or just sqf for sqf in isolation from the actual game
or arma's engine has an api that can be used externally
How do you make the code colorful? ๐
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
like that
```sqf
code
```
hint "Thank you!";
Can I pass additional arguments to an evenHandler?
missioneventhandler, yes. regular eventhandler, no
regular eventhandler yes via detours
What is that?
basically just setting variables in the namespace
e.g
private _mydata = [1,2,3,4,5,6,7,69];
_myUnit setVariable ["RC_EH_Data", _mydata, true];
//later on, inside EH
_unit getVariable ["RC_EH_Data",[]];```
How can I get to deeper levels of an array with set command, when the array has more dimensions?
_myArray set [[0,1], myValue]; //Like this?
(_myArray select 0) set [1, myValue]
OK, thanks.
This gonna be more tricky I think, how to do that when I need t o use get and setVariable? ๐
_group setVariable ["targetArray", value] //at [indexVariable,1] index
_myArray = _group getVariable "targetArray";
(_myArray select 0) set [1, myValue]
OK, thats easy, I thought that getVariable gets you only the value not the variable itself.
Thanks.
That's correct
It gets you the value, not the variable itself
and values are by reference.
The variable points to the value, and you can edit the value in-place with the set command
private _mydata = [[1,2], [3,4], [5,6], [7,69]];
_myUnit setVariable ["RC_EH_Data", _mydata, true];
//later on, inside EH
private _thedata = _unit getVariable ["RC_EH_Data",[]]; //returns [[1,2], [3,4], [5,6], [7,69]]
_thedata#0; //[1,2]
_thedata#1; //[3,4]
going by my example from earlier
That doesn't work as intended (probably) because you're publishing the variable.
oh wait
never mind
using select instead of # should be a crime
So yeah, if you need to publish the variable over the network for some reason then you need to use setVariable. Otherwise modifying the array is sufficient.
Like this?
(_targetArray#_targetUnitIndex) set [1, true];
But what if I needed to do that over the network like u said?
Then you have to use setVariable.
private _array = _myUnit getVariable "myArray";
_array set [1, true];
// array is now updated on this machine
_myUnit setVariable ["myArray", _array, true];
// array is now updated everywhere
Aha, I need to overwrite the whole variable, now I get it.
Since my script is going to happen in the event hanler of an AI unit, I probably don't need to worry about distributing those vars, but I probably would if those, AIs were headless clients, I suppose.
Nah, you have a lot more to worry about if you want to support headless clients.
spamming arrays over the network in case it might help for poorly-understood reasons is not the correct approach :P
Is there any material on headless clients? Not that I need them now, but I would like to learn something about it.
From an SQF perspective they are nearly the same as a client without a player or UI.
select is much more readable in most cases
so no, select should be used over # where possible
more letters
more readable
more better
I think that select is much more self-explanatory for newbies.
_arr#0 is much quicker to write than _arr select 0
you write code once, you read it many times
leaving this here
a benefit now is not worth as a benefit long-term
sure, now you save a second here not writing select
tomorrow, when reading that code tho, you will have a harder time
extra 5 seconds spent understanding a written code are unlikely to be covered by 5 microsecond performance benefit unless the code is run more than a million times before getting changes once 
imo in terms of reading there's no difference between # and select, if you use syntax highlighting
so code maintenance is irrelevant
in fact I'd argue # makes things more readable in cases where you should chain stuff:
_arr#0#0
vs
_arr select 0 select 0
unless you want to be weird/inefficient and delcare a variable for each select
you already can see the issue in this very comparison
_arr#0123#41515#155#15151
how many selects do i have in here
vs
syntax highlighting makes it readable
_arr select 0123 select 41515 select 155 select 15151
you have "your data organization is kinda stupid" many selects ๐
_arr#0123#41515#155#15151
_arr select 0123 select 41515 select 155 select 15151
one takes up more horizontal space ๐คท
and nothing really prevents you from going _arr # 0123 # 41515 # 155 # 15151
your brain still has to cope for it
we are not made to read text like that
wchi is the rseoan you can raed tihs txet wohitut any pobrelms
yaay, holywar of a styling kind
try read this ๐
i love indentation
i love macros
and i love incorrect linters

worst part is that using it like this has meant ive written one mod in 10 hours most of which was spent trying to make it compatible with webknights stuff
as opposed to it taking me like 5 days
so you are more of a masochist? yeah, go use # then ๐
wtf is that minecraft font heresy
it makes it easier to read for me for medical reasons
change that # to cobblestone textured square for better visibility 
shit u right
its so much better than trying to read all this
trying to read that is just awful
too much nesting
i use exitWitha lot to prevent nesting at if s
i need to use else for all of those ifs
honestly, SQF is at fault for that
adding new functions (or navigating them) is no easy task in the language
adding a ton of sqf _fnc_fancy = {}; inbetween actual code is not really doing the trick, as visually everything looks the same
in some cases i do if(true) then {if(conditionA) exitWith{}; if(conditionB) exitWith{}; someCode;}; lol
_secondSecondaryEquipped sounds dangerously close to breaking the 4th wall, tbh
that only works if youre just eliminating one condition rather than having something run if one condition is true and other
it was that or _secondarySecondaryEquipped
here's for questionable editor (and life) choices:
and i'm done shitposting for today
i spawn every "logic" object as a suitcase at [0,0,0] to make that corner weird looking, those suitcases "keep the matrix in them" (breaking the 4th wall)
it's pretty surreal
like e.g a citizen is just a doll, his brain and identity are in the suitcase and the doll can respawn or change its form
suitcases as logic objects but just being used as a namespace??
okay, you're actively tempting me. Make those Land_PortableLight_02_quad_base_Fs and store the data as animation phases. Let those lamps dance
they store vars and functions in them, yeah they're basically namespaces
sometimes i arbitrarily flip primary secondary weapon and second secondary weapon because its funny
(i dont actually its only for saving cba loadouts)
i store the function body separately in module and then add it to objects i construct
e.g
function global(scalar val = 0) {
if (val > 10)
return true;
else if (val > 12) {
return val < 50 ? false : true;
}
}
final function fnc_myFunc(string msg) {
diag_log(msg);
}``` we all do things to improve readability
return commands are silly and sqf does it better
that's the only thing that's global in my code. the ABC framework. everything else is stored in objects like in namespaces
that's not sqf
or is it
hey guys
sector control doesnt work after save/load
sector capturing process just broken after reloading
whats worng?
it seems like i need to reinit sector control module
but idk how
How do I call addUserActtionEventHandler from server in onPlayerConnected?
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
addUserActionEventHandler ["KeyName", "Activate", {params ["_activated"];}];
}];```
you do not need to call it
its event handler
just place it in init.sqf
you should add it to new player
But how? ๐
just try while cycle
and add condition with count of players
like if count of players chanhed it will reput this handler on them all
do you know why sector control doesnt work afer reload saves in sp?
Can I use remoteExec to distribute that handler to other clients?
You can but it's not necessarily a good idea.
onPlayerConnects gives me the exact player, so I would probably targeted his machine only.
I don't think PlayerConnected would work as a trigger because it's fired before the player object is created.
OnUserSelectedPlayer would probably work.
OK, but how I deliver addUserActionEventHandler ["KeyName", "Activate", { params ["_activated"]; to the client?
This is locally executed so I have to somehow send a message to the client with this code.
is there a good reason not to put this in initPlayerLocal or a postInit function?
I am not sure, probably not. ๐
When this code is executed on the client from an UserActionEventHandler, will it have the global effect, like that the AI's on the server would use the new value when spotting players? Or should I use remoteExec?
if (stance player == "STAND") then {
hint "Stand";
player setUnitTrait ["camouflageCoef", (stanceCamouflageCoef select 0) * baseCamouflageCoef];
};```
What would you do to make it trustworthy then? ๐
I'd check it.
Trouble is it's a rare usage. The common traits are medic and engineer, and those are primarily used locally.
I have launched two instances of Arma, and made a local server, and it shows the "debug" hint on both. Maybe I should check the real values. LOL ๐
Is there any way how to run debug console in MP ? Non-dedicated.
Just make a DS with a batch file. Don't need many mods for this sort of testing.
in 3den at the top, there is options (name may be different) and multiplayer where you can make that available to nobody, everybody or logged in admin
could also be in another dialog in those
I didn't have much luck getting two clients to connect to each other recently. It used to work.
So, it works, but its slow as hell to be any useful. There is like 5-10 secs delay between it gets executed and when I register the change in the value with the server player. I need to do it differently.
That would be a risk.
Like we (and ACE) have to remoteExec spam setMass because it's too slow to avoid players murdering each other with carried crates.
You might find setUnitTrait is similar and works locally on non-local units.
Apparently remoteExecCall has much higher network priority than some of these commands.
So I would need if statement to check whether I am in SP or MP, and if MP then remote call
shrugs
remoteExec works in SP too. It's just not necessary.
Only a theory anyway. setUnitTrait on non-local units might just do nothing.

What would I use then. ๐
Documentation says Local and Global execution
nothing about server
There is not necessarily a solution.
setMass is also marked as local argument, global effect but it does change remote objects too until the network catches up. I suspect a lot of local-argument commands work like this.
Should I use schedule or unscheduled vesrion of remote?
unscheduled
It works now. SP and MP as well, on local loopback.
what, it fixed the delay issue?
Yes.
gross :P
Thanks alot.
It's kinda dumb because it's probably sending 10x as much data over the network as a result, but Arma makes us do dumb things.
๐ I dont actually care at this moment, after like 50 hours of twisting and bending the AI to do what I need, this is the smallest problem.
(SQF is horribly inefficient on network data)
One last question, if you allow me, for this day. I am checking the stance when the onUserAction event is fired. But I am not sure, how to check the players stance correctly, because when I switch them quickly, it sometimes returns wrong stance, because standing up takes longer then going prone and so on. So I placed the artifical delay 1.3 secs, so I am sure he finished the change when I start to if his stance.
[] spawn {
sleep 1.3;
if (stance player == "STAND") then {
hint "Stand";
//player setUnitTrait ["camouflageCoef", (stanceCamouflageCoef select 0) * baseCamouflageCoef];
[player, ["camouflageCoef", (stanceCamouflageCoef select 0) * baseCamouflageCoef]] remoteExec ["setUnitTrait"];
};
if (stance player == "CROUCH") then {
hint "Crouch";
[player, ["camouflageCoef", (stanceCamouflageCoef select 1) * baseCamouflageCoef]] remoteExec ["setUnitTrait"];
};
if (stance player == "PRONE") then {
hint "Prone";
[player, ["camouflageCoef", (stanceCamouflageCoef select 2) * baseCamouflageCoef]] remoteExec ["setUnitTrait"];
};
};```
You were hoping there was a better solution?
You sure?
This seems to be a really dumb way how to check it. ๐ Too slow for an action game.
