#arma3_scripting
1 messages ยท Page 552 of 1
TBH I am more inclined with automated layout in favor of any of these existing available tools which export configs.
Even with ADC, unfortunately, as it doesn't support many things, I can't just export whole config and replace an existing one, so I have to copy coordinates manually
plus the need to manage multiple include files and other tiny things which add up and make maintaining any of the UIs a horrible experience, when lots of time is spent on nothing
well ... if arma-ui-editor would work flawless, you could do it with it
as it just renders a config
onto some screen
Condition:
Trigger_Con;
Init:
this addaction ["Triger",{Trigger_Con = true; publicVariable "Trigger_Con";}];
Any reason this doesnt work?
I'm trying to open the strategic map through AddAction but got no results
To what is the addAction set? The player, or the module?
please note that a lot of people have tried to use addAction to open the StrategicMap without much luck... unless you build the map up with BIS_fnc_StrategicMapOpen "within" the addAction I'm afraid there won't be an easy solution
depending on what you want to do with it it might be easier to take a look at the Respawn templates, which will allow you to spawn/respawn at different locations on the map
@queen cargo I just tested BIS_fnc_dbImportXML with your example XML, and after removing the leading tabs this is the result:
["#DIALOG",["#PANEL",["#GRID",["#COLUMN",["&LABEL","Enter ID:"],"#COLUMN%2",["#TEXTBOX",[]]]]]]
Very very very neat
currently trying to modify the script to accept leading tabs, and also include classses (like width="*")
blame BIS ๐คฃ
BI. BIS is the other one
it's BIS_fnc_, so I blame BIS ๐
๐ ๐
And BIN?
I haven't thought of it ๐ค
"The .bin file extension is most commonly associated with compressed binary files."
@exotic flax
I almost managed to make it work with fnc_strategicMapOpen but I couldnt place "missions"
I'm trying to create a SP mission where the player spawns in downed and needs to be revived by and AI, how could I do this?
this setDammage 0.7;
this setUnconscious true;
No idea if/how AI reacts to it though
and I think it's a bad idea to have the success of a mission depend on Arma AI, because their behaviour isn't predictable at all
How do I add chat interactions with AI?
well, you could use addAction on the AI unit which triggers a scripted dialog
What do you mean addAction?
thank you
so I want to add a action to every building on the island how would i go about to do this
on the forums is an example script which adds an action to all trees in a mission, which could be modified to other objects: https://forums.bohemia.net/forums/topic/198834-release-add-action-to-trees/
although I'm sure you would prefer it on doors, and not the building itself ๐
is it normal for teamswitch to complete your current waypoint?
because it's completing it for me
Hey guys, i am trying to write a script that would kill all enemy unit and vehicle. So i tried a code it ended up killing every enemy but the vehicle is left empty. So i decide to use trigger instead to delete the vehicle but it seems that the vehicle doesnt get deleted. Not sure where i went wrong, it doesn't show any error either when i execute the script
stoptrig = createTrigger ["EmptyDetector", [14267,12509], true];
stoptrig setTriggerArea [1500, 1500, 0, false];
stoptrig setTriggerActivation ["EAST", "PRESENT", true];
stoptrig setTriggerStatements ["thisList", "{deleteVehicle _x} forEach thisList;",""];
[East, -5000] call BIS_fnc_respawnTickets;
{if ((side _x == east) && (_x != player)) then
{
_x setDamage 1;
};
} forEach allUnits;
deleteVehicle stoptrig;
the trigger is only checking for units as i see it
it doesnt check vehicles too? oh my
let me check but if i'm correct is either that or the vehicle doesn't have a side defined (and that's if you can assign a side to the vehicle to begin with i never tried that)
yep that doesn't count the empty vehicles
because i found this solution by googling and the person who asked the question actually thanked him
the car is actually CIV when in run a test on it
thats why i wanted it to delete the vehicle before killing all the units
weird
maybe i can try CIV instead of EAST
if the car was occupied by a csat it turns into east
maybe you should try deleting the vehicle first?
isnt that what i wrote already? the code is to delete the vehicle fist then units
maybe the trigger doesnt check for vehicles as you suspected
yep the car turns into CIV when i kill the opfor occupant
so pretty much if the vehicle was empty to begin with it should be CIV
i tried it using CIV instead of East, even when empty, it doesnt delete the vehicle
but if it was or is occupied by opfor it is EAST
so i think its the trigger not checking for vehicle
or the vehicle is not inside the trigger
use hint str(thislist)
to know if the vehicle is in the list or not
ill try it, tho as 1500x1500 i doubt that the vehicle is not inside the trigger, the vehicle spawn around 300/400m from the trigger location
nope its not showing any hint..
stoptrig setTriggerStatements ["this", "{deleteVehicle _x} forEach thisList;",""];
you put thislist in the statements instead of this
i actually used this before thisList and nothing happened. that why i try using thisList
thisList is a list, not a bool
haha that is what happens when i got stuck. i play aroud
when you use "this" in a trigger it takes the statement to determine that bool result
changed it back to this but still the vehicle doesnt get deleted
it does for me
stoptrig = createTrigger ["EmptyDetector", (position player), true];
stoptrig setTriggerArea [1500, 1500, 0, false];
stoptrig setTriggerActivation ["CIV", "PRESENT", true];
stoptrig setTriggerStatements ["this", "hint 'henlo';{deleteVehicle _x} forEach thisList;",""]
only if the vehicle is empty
let my try with east
and the unit inside
still working for me when i change it to east and the is a unit inside the vehicle
stoptrig = createTrigger ["EmptyDetector", (position player), true];
stoptrig setTriggerArea [1500, 1500, 0, false];
stoptrig setTriggerActivation ["EAST", "PRESENT", true];
stoptrig setTriggerStatements ["this", "hint 'henlo';{deleteVehicle _x} forEach thisList;",""]
so when i check, the vehicle turn to purple for a bit then turns yellow
yellow in empty means civ too?
yep
hmm its not working for me gahhh
if you run side _x
on an empty vehicle it returns civ
weird
do you get the hint?
stoptrig setTriggerStatements ["this", "hint this tigger has been activated'';{deleteVehicle _x} forEach thisList;",""]
im gonna try turning it around to let it kill uynits first then delete the vehicle.
stoptrig setTriggerStatements ["this", "hint 'trigger activated';{deleteVehicle _x} forEach thisList;",""]
stoptrig = createTrigger ["EmptyDetector", [14267,12509], true];
stoptrig setTriggerArea [1500, 1500, 0, false];
stoptrig setTriggerActivation ["CIV", "PRESENT", true];
stoptrig setTriggerStatements ["this", "hint 'trigger activated';{deleteVehicle _x} forEach thisList;",""]
deleteVehicle stoptrig;
i got an error missing ; at the last line.. what the fish
at the last line
weird
missing a ;
my take on it without using triggers
{if (str(side _x) == "EAST") then {deleteVehicle _x;};} forEach ([996,4527] nearEntities["Land",1500])
that way you don't need the trigger to be activated first
just goes straight to the point
{if (str(side _x) == "EAST") then {deleteVehicle _x;};} forEach ([996,4527] nearEntities["Land",1500])
i have no idea how to do this myself that why i go for the trigger approach, easier to understand
str(side _x == โEASTโ) ๐ค
i am just about to ask about that too, why there is str in front of the bracker
hmm.. it still didnt delete the vehicle
ah i didnt change the nearEntities position ๐คฆ
it works now
thanks @tough abyss
i got an error missing ; at the last line.. what the fish
It is because you have missing ; at the end of setTriggerStatements line, duh
@tough abyss yeah i noticed that already, but the error said it was mission on the line under that triggerstatements
Because you havenโt ended previous statement it looked like you are passing left argument to deleteVehicle
oh i see.
It stands for BI Scripted function compiled ...
It doesn't @astral dawn
Bohemia Interactive Studios (BIS)
Bohemia Interactive Netherlands (BIN)
is there a way to find the nearest free space inside of a building? findEmptyPosition doesn't work, it seems to just consider buildings as solid boxes or something
@errant patio The link shows you a function from CBA which returns your wanted positions, maybe it'll help you out.
https://github.com/CBATeam/CBA_A3/blob/master/addons/ai/fnc_buildingPositions.sqf
thanks, i'm actually trying to place the units on any walkable surface rather than just buildings that have positions in them.
setVehiclePosition works to some degree but it's prone to spawning them on the roof :/ and I'd like to be able to use the 2nd floor of buildings etc. too.
If you're using CBA you could just call the function ๐คท
If you're not using CBA you could just copy the function
all that function does is provide a fancy wrapper and the capability to use a special editor object to define your own.
I could write a script of some kind to place the objects used to define the custom positions but then if I achieved that... why not just use it to place the units in the first place and avoid the overhead?
all properly defined buildings have positions for AI in them, and CBA simply adds a method to use custom positions
in short you can use
_allpositions = nearestBuilding player buildingPos -1;
the problem is that building positions are typically near windows, and often buildings don't have many - there's one in my map that only has one defined, in the dead centre - not exactly useful.
I'm trying to avoid using the predefined positions so that there can be more variety in CQB
i may, so far my own efforts towards solving this problem are going pretty well though
That may cause issues like ai being unable to move.
AI needs path lod paths to navigate inside buildings/objects and the "pos" position points are part of that system.
I am currently trying to find the position of a specific p3d, and a specific memory point on the p3d.
The model is spawned through an assembly script, so the object doesnt have a unique classname. Assembly script just uses a placeholder object, and moves the p3d's into position.
Anyone know if a way to do this?
So it is weapon assembly?
Apologies, this is a static structure
Can you show the assembly script?
Ill have to ask permission from owner on that one
but the summary is that the scripts grabs an array of class names, and looks at the p3d position and assembles it in eden
So after digging, it does have a classname that is grabbed by the array, but the positioned with the holder object.
So I may be able to just have a init in the cfg to just force a variable
or one of the other model to world commands
You want position of an object inside a holder in relation to the world? Like backpack inside weaponholder? If you have reference to the object you can get parent with objectParent command
someone could help me understand this? It is not really an error for me to fix, but i am interested what the hell it means.
_vectorCase_X = random [_vectorCase_X, (((_vectorCaseDir>
17:54:25 Error position: <random [_vectorCase_X, (((_vectorCaseDir>
17:54:25 Error Type Number,Not a Number, expected Number
17:54:25 File \WW2\Core_f\WW2_System_Infantry_f\caseEjection\fn_caseEjection.s..., line 13
Something ended up with a NaN instead of a number due to an error most likely, which then threw this one.
Doesnt have to be error
random [2 ^ 213213213123213, 2, 2]
Output of backpackMagazines looks like
[
"9 mm 16Rnd Mag(16/16)[id/cr:10005771/0](4x)",
"Smoke Round (Green)(1/1)[id/cr:10009582/0](1x)",
"40 mm HE Grenade Round(1/1)[id/cr:10009574/0](1x)"
]
What do these things in the square brackets mean?
id and cr says right there
They should, because the moment you use rounds from a magazine (eg. half), you don't magically get a full magazine again ;)
So the moment it changes, it gets a new ID
would be great actually to have access to this system in mods (as an unique identifier), especially for mods like ACRE and TFAR ๐ hint hint
TFAR currently solves this in a different way
(a thousand of unique class names)
So yeah would be useful...
I know, that's why this would make more sense.... no limits and build in core
but I'm sure there are things which should remain hidden for peasants like us ๐
is it unique ID per item or ID per item with X amount of ammo
since you have 4x full mags there
it seems to be an ID per unique item
if you have 2x 4 rounds mags are both listed or is it 2x of mag(4/16)
I believe it would look like this:
[
"9 mm 16Rnd Mag(16/16)[id/cr:10005771/0](2x)",
"9 mm 16Rnd Mag(4/16)[id/cr:10001337/0](2x)",
"Smoke Round (Green)(1/1)[id/cr:10009582/0](1x)",
"40 mm HE Grenade Round(1/1)[id/cr:10009574/0](1x)"
]
ID per unique item ๐
before:
[
".45 ACP 11Rnd Mag(11/11)[id/cr:10000024/0](4x)",
"6.5 mm 30Rnd Sand Mag(30/30)[id/cr:10000028/0](4x)"
]
// +1 in each weapon
after:
[
".45 ACP 11Rnd Mag(11/11)[id/cr:10000026/0](2x)",
".45 ACP 11Rnd Mag(5/11)[id/cr:10000009/0](1x)",
".45 ACP 11Rnd Mag(6/11)[id/cr:10000024/0](1x)",
"6.5 mm 30Rnd Sand Mag(30/30)[id/cr:10000029/0](3x)",
"6.5 mm 30Rnd Sand Mag(20/30)[id/cr:10000007/0](1x)"
]
// +1 in each weapon
cr - creator, owner id of creator
although it also seems to change the original ID, or reuse it for another item
After what?
after shooting a few rounds
and then reloading (and therefor putting it back in the inventory)
how do you get more mags in inventory after shooting???
magic
6.5 mm 30Rnd Sand Mag(30/30)[id/cr:10000029/0](3x)
name_or_mag(cur_rounds/max_round)unique_id
https://community.bistudio.com/wiki/magazinesDetail should have the same info, wiki probably outdated
Hey random question, Does anyone know the function through either CBA/ACE/ZEN or default that adds objects to zeus?
I used to use [[_basetank]] call Ares_fnc_addUnitsToCurator;
But I don't use Ares anymore
well, you could just copy the code from that function and either create a custom function, or run the script as a whole.
https://github.com/ArmaAchilles/Achilles/blob/master/%40AresModAchillesExpansion/addons/functions_f_ares/features/fn_AddUnitsToCurator.sqf
That doesn't feel right, but that's probably the easiest way
so I'll take it
Thanks!
or use the Achilles mod ๐
My Unit's decision was to switch to Zen. I'm just trying to keep up with all the scripts that used to work
Honestly adding the function back in saved me like 2 hours of work from remaking a bunch of stuff
can anyone here help me with this script, it should open the strategic map with addAction but its all in german and for some reason it tells me only the squad leader can select missions, even when I'm the squad leader
@pseudo shadow ``` {
_x addCuratorEditableObjects [allUnits,true];
_x addCuratorEditableObjects [vehicles,true];
_x addCuratorEditableObjects [allMissionObjects "All",true];
} forEach allCurators;
Oh gosh, I just needed specific objects in certain scripts. Re-adding the function worked perfectly
Does anyone have any experience with making units move after using cba_fnc_taskDefend?
Using _unit enableAI "PATH" and _unit doFollow leader _unit doesn't seem to be enough
Or maybe it does, and I was doing it in the wrong order
Yeah seems like order matters, if anyone ever needs to do that
Also it's a good idea to clear their waypoints as well
Howdy- hoping someone could help me figure out the nature of the conversation system in ARMA3. Currently, I'm trying to figure out when and when isn't the radio is used when delivering dialogue.
https://i.imgur.com/Fh1tCLN.jpg
I have a simple thing currently set up- player approaches desk, and a bit of script is called up-
["ambientBriefing", "MissionName"] call BIS_fnc_kbTell;
here's the curious thing though-
in the ambientBriefing.bikb, I have class briefing 1 to 6, for each line of dialogue.
there are three characters involved, the player, the captain, and one named willis
if I structure the .bikb like this, the radio-when-distant thing will work from the get go.
but when structured like this: https://pastebin.com/a4fVQjj4
It does not- if the player wanders away from the conversation, the radio will not turn on.
https://pastebin.com/fXKp9B4H
But when structured like this, the radio will only turn on once the player character speaks in line 5.
link 1- Player speaks in line 1 and 5, and can hear the conversation on the radio from the very beginning
link 2- Player Speak in line 1, but cannot hear the rest of conversation on radio
link 3- Player speak in line 5, and can hear on the radio after that
as it is, my knowledge on scripting is tiny, but I would very much like to one day make some narrative driven scenarios, hence why I'm trying to understand this system
Any help towards figuring it out would be immensely appreciated ^^
what's the difference between a button action defined in an .hpp file and wiring up ctrlSetEventHandler? When I try to do the latter, I cannot seem to effect the same sort of change that an action does. Control does not resume, for instance, in the manager loop that is watching the currently open dialog.
That being the case, I would like to get away from embedding actions in the .hpp quite as much because I find that is brittle to change, would rather it be in the SQF, personally.
now i remember why i despised arma and scripting... ripping my hair out for idk a good 30 minutes and the rpt log wasn't being helpful.. then finally i noticed i had an extra / which was causing the error.. ๐
I thought you quit.
I came back to give the community more wonderful life stuff hehexd
Curses.
@ruby galleon https://community.bistudio.com/wiki/Conversations may help? If not, ping me so I can update
sikeuthot
working with this shit makes me want to quit again tho all cause the rpt wasn't helpful in pinpointing the issue.
That's what I've been referencing, mainly, @winter rose
that and decompiling ARMA's showcase missions to see if I can pick apart how they do things
as it is, they're a bit hard to parse for someone that's still a novice at scripting
the official missions, that is
Also, I am on mobile (and it's early to me) but what is the difference between "it works" and "it doesn't"?
mainly, whether or not the units speaking will broadcast on the radio
in one instance, the player will not receive any radio broadcast. In another, they will only receive radio broadcast after they appear again in the conversation. In the last, the conversation will happen all throughout radio
on that note though, I just noticed the "forceRadio" parameter.
File* difference
The channel will be chosen on sentence beginning, so if the sentence is too big and the player runs away, it won't change mid-sentence (afaik)
mmhmm- that's no problem. The main problem is whether or not the radio will be used in the first place, which it seems BIS_fnc_kbTell does something to automatically determine, but it's not perfect. But I just found a radioMode parameter under BIS_fnc_kbTell, which may solve my problem
And what is the file difference that makes the difference
I couldn't find any discrepancies in your links (but again, I am on mobile and brain isn't fully functional @ruby galleon)
But yeah forceRadio is a thing ^_^
the main differences was the order in which the player unit gets involved with the conversation. If the player isn't involved at all, then the radio doesn't broadcast the conversation. If the player is involved in the beginning but not later, the radio also doesn't broadcast. If the player is involved part way, but not the beginning, then the radio will only broadcast after the player unit speaks
it's all very strange.
Oh.
Indeed
I would have thought the function would parse and get through all the conversation units to broadcast to them all
As it is, I'll test with RadioMode set to true and see how it plays out
...tomorrow.
is late for me.
(I assume playerInf is the player unit variable set in the editor)
Well, good night to you, good morning to me! Taking the shift ๐
it's also pretty weird and silly hearing myself "voice act" to myself
I appreciate the help!
IS there really no way to hide markers created by addRespawnPos?
sure there is, you just have to know what they're named
or in what convention they're namede
might be like BIS_respawn_blah
I am trying to get respawn markers via
[west, false] call BIS_fnc_getRespawnMarkers apply { systemChat _x };```
But when I put that in the debug console
im getting no output
or.
_westMarkers = [west,false] call BIS_fnc_getRespawnMarkers;
systemChat str _westMarkers;
I guess apply would work, but it doesn't really make any sense to use it.
Make sure your markers were created before you call that function
I am getting nothing back from this
Really weird
So, using trhe RespawnModule
to get a player the ability to respawn on a veh
I want to hide the respawn modules marker
on the map
@astral dawn
What is a CR?
Creator. OwnerID where mag was created
Interesting, so every item in the inventory has a unique ID?
no
@exotic flax
So the moment it changes, it gets a new ID
no.
Magazines have uid's because they need to be tracked, as each magazine has properties assigned to it (amount of ammo left). Normal "items" don't have that.
@smoky verge
for some reason it tells me only the squad leader can select missions, even when I'm the squad leader
Well that has nothing to do with the strings in there being german
//check if a mission is already selected
if !(player isKindOf "rhs_msv_sergeant") exitWith {hint "Nur der Gruppenfรผhrer kann Missionen anfordern!"};
If you are not that specific rhs unit, you can't request missions.
Funnily enough that comment is wrong.
@sullen pulsar what issue did you ran into exactly? Just some logic error?
So, i've got a trigger than when activated calls
[2] call BIS_fnc_earthquake;
now, the trigger and the effect work, but i get this error
Sleep ( _duration - _compensation );
|#|Sleep 3;
BIS_fnc_earthquake_inprogress =...'
File \A3\Functions_F_EPC\Misc\fn_earthquake.sqf [BIS_fnc_earthquake]..., line 83
Error Generic error in expression
Error Generic error in expression```
Does anyone know what causes this? The earthquake happens and whatnot, but i'd like to not have a giant black box show up every time...
use spawn instead of call
[2] spawn BIS_fnc_earthquake;?
though if it works without sleep maybe you should remove sleep?
Thanks laddies, worked like a charm
I came back to tell you how shit this shit was hehexd
๐ค
@still forum ah just the generic generic error in expression pointing to the wrong thing causing the error. Good ol' helpful rpt log
Just glad that arma error reporting is as useful as it was 5 years ago when i dipped
Thought maybe debugger would produce more helpful errors. But in that case probably not
the RPT usually points exactly where it should, but you need to know how to intrepret it
well I had it compiled as final via an addon so that made it even harder to track down with CBA on so it was saying error at line 99999999999 even when 9999999 didn't exist and other fun things totally not related to it or near the line
Don't create bugs - it's that simple!
would be nice but my keyboard double taps keys
kinda why i didn't see the mistake in the first place, plus i'm using visual code editor on dark mode so even harder LOL
j/k of course, but regarding VS Code I am pretty sure there are some good dark themes out there
Having #include after block comments /**/ breaks line numbers. put your includes above
i only have 1 include at the tippy top
I learned to compensate for arma, i just go back to notepad++ and write the code out in debug console before I slap it in addon 
gotta say tho I am using your intercept-database, actually freaking brilliant. Love it. Really could of used it 5 years ago.
Intercept entirely is just all around nicer but the database plugin makes SQL management very nice
Maybe vsCode with sqf extension. But there are no good SQF linters for VSCode... :/
Atleast the one i use doesn't detect "_x = 5 / / 7"
Uh i'm using the vscode sqf extension, it just doesn't catch certain things and the excessive / was one of them. Made it blend with the background.
@still forum there is technically the task @ebon ridge created with sqf-vm
And... Sqf-vm should catch theese things
Yup, it does as expected
@sullen pulsar depending on what you need to use in regards to sqf, sqf-vm May be your friend
but can you dump any code in it to check for compile errors?
even the code with script commands that are not in sqf-vm?
yes
As long as there is a dummy implementation for the command in the vm
The VM has to know what commands exist, but doesn't need to have them implemented
And if not, you can provide on with cli args ๐
https://discord.gg/eP4QgTr Alternative as discord bot Btw
123//123 - pass
I guess you need to specify if you want it preprocessed @still forum
is not
yes it is
123 followed by a comment
that's valid
123 / / 123
would not be
Pretty print SQF doesn't do preprocessing
which..is a bug.. but.. maybe its a feature
I guess you need to specify if you want it preprocessed
Pretty print SQF doesn't do preprocessing
But / / is wrong regardless of preprocessing
you can do with a tick option on that page
@still forum technically, not a Bug
The cli Option was added before the preprocessor
We already talked about that
well I found a bug
private "lol";
runtime error in A3, local var in global space
same for private ARRAY
@queen cargo fix it fix it fix it
Same error in vm
Wait no?
We already talked about that bug and I thought we fixed it?
I am quite sure it was fixed ๐ค
Though... It is a quite simple fix
More interesting, there aint no test case for this
Found another bug
missionNamespace setVariable ["player", 123]
you cant do this in A3
reserved names
Should probably have test for that here https://github.com/SQFvm/vm/blob/fff4759ba0a5265f911a2e99f939cd56f609671d/tests/sqf/namespace.sqf
https://github.com/SQFvm/vm/blob/fff4759ba0a5265f911a2e99f939cd56f609671d/src/varscope.h#L21 yeah there aren't any checks for that
oh dear
set = 2; apply = 3;
all good?
ye
should error
yeeeep.
I guess @queen cargo is writing A2 SQF ๐
Doesn't break anything. command names take precedence over variable names like they should
Just a missing warning/error
error (from some A2 patch)
I remember doing a true = false in A2, it broke everything ๐
isn't
missionNamespace setVariable ["some_var", "some_val"];
equal to
with missionNamespace do {
some_var = "some_val";
};
???
and therefor can't contain reserved names?
which would make sense ๐
WHOA!
toLower toString [75,76,74,72,75,76,74]
result [WORK] <STRING> KLJHKLJ ๐ค
@tough abyss that makes sense, because it's transforming unicode to strings
Bit hostile
same as
toArray "KLJHKLJ"
gives [75,76,74,72,75,76,74]
obviously
except the toLower part... that doesn't make sense...
@queen cargo toLower/toUpper dont work when the argument is the result from operation
toLower call {"YO"}
[WORK] <STRING> YO
They are not talking about SQF in ARMA 3
obviously
Well, can't argue with Boguu ๐ค
Schnellfeuer: Seriously what are you on about?
Schnellfeuer: Open Arma, put it in debug console and execute
Yeah, execute what though?
well... since you didn't specify, I referred it to the last comment I wrote before your comment...
so to you it makes sense that the result is all CAPITAL letters even after it was toLower-ed?
โ #arma3_tools or SQF-VM Discord please ๐
what @winter rose said (the discord is the best place for that https://discord.gg/vpdwJtG) plus there ain't nothing to fix, but the version you entered that code into @tough abyss
does anybody know of a good way to resize an RscStructredText box to the size of the text within it? I have a textbox in a vehicle select dialog that gives a description of the currently selected vehicle and would like to avoid a long trailing box since they all have different sized descriptions
@tame lion maybe more luck in #arma3_gui (unless you want to do it by script, which I am not sure how to)
Yeah I'm looking for a scripted way since the text will be changing with vehicle selection anyway, meaning it'll have to change while the games running
I'm far from an UI expert, but I guess the only way to make it dynamic is to have a scrollbar (instead of making the box bigger/smaller)
you can resize based on text height but not text width
I think there is a way to get the whole text width, I recall someone asking the same
But I don't remember which program does that
@exotic flax i like that scroll bar idea. Guess i gotta find out if a structured text boxcan be scrolled now
And i know you canmake something auto scroll too.
@tame lion on the forums there's some steps (and script) to do that, but no idea if it still works: https://forums.bohemia.net/forums/topic/164661-rscstructuredtext-with-scrollbar/
Is there a command to make a building door open or close?
https://community.bistudio.com/wiki/animateSource
e.g.:
_obj animateSource ["Door_1_sound_source", 1];
1/0
local
thanks
Is there a simple way to count available (whether filled or not) cargo index spots in a vehicle? e.g. count cargoIndex _someVeh
perfect, thanks
Another question: is there a way to return a value out of a scheduled function to the calling script before the function is finished running?
Nope
Beside global variable or setVariable on an object or something, I don't see any
figured :\
Idk if thats a wanted feature but if you switch a weapon from the ground for one in your inventory it doesnt fire the Put EventHandler, just the take one. Any ideas ?
anyone with more experience using calculatePath?
https://forums.bohemia.net/forums/topic/225750-calculatepath-testing-and-considerations/
To let know out of dev branch discussions and for various insights about usage of this command. Please, share with own observations, if any. Tried new calculatePath command. Finds a path from Kavala to Pyrgos in 5-6 seconds. Then tested by putting BIKI example into some terra...
depends on what you want to know... I have tested this function to see if I could build a mod around it and it works exactly as it says it does.
well performance is one consideration, calculation time for various situations, scaling with more units, "issues" like described in there
I only used it as a GPS system for vehicles with real-time updating of routes (in case you drive on a different route), and it seems to work decently.
Yes, I also noticed the delay, although it seems that it's way less for vehicles than for "man", not to mention the used behaviour (CARELESS is the fastest).
However, just like described in that topic, when terrain is difficult (non-roads, water, etc.) the execution time seems to explode.
It seems that the function prefers roads over terrain
and if no road can be used, it will simply draw a straight line (although AFTER it tried all road possibilities)
hmm wasn't there a function that returns the degree of where the player is looking at ?
direction is easy, but i need the up/down
cameraViewDirection
that is just for cameras, no?
eyeDirection (?)
ok, getCameraViewDirection works. fancy.
@jade abyss thanks!
How do I make my mission ACE-compatible? I know they add some event handlers, and I also add some event handlers. Is there some page where all these things are listed?
Depends what do you mean by "ACE-compatible"
Think about what systems are in ace and what are in your mission and which one have overlapping functionalities.
Most likely:
- Medical
- Arsenal
- Logistics (Rearm refuel)
If you have any medical system in your mission you should disable it when ACE medical is detected.
From what I recall only event handler that can cause troubles is https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
it's added by medical.
๐ค
I use handleDamage a lot to prevent AIs from being killed by their friendly driving AIs
there's also just getDir no?
What?
BTW guys, is it possible to invert color of a marker?
Or do I need to supply a different .paa?
Is there a way to disable "Autospotting"? In my mission file, when any player spots an enemy, they are marked on the map. Is there a way to disable that? Thanks in advance
Does anyone know of a way through script to remove an action that was added in userActions class?
actionIDs doesn't reveal any ids on the vehicle im testing this on
You can't remove config added actions without editing the config.
dang... aite then
@tough abyss Difficulty settings. https://community.bistudio.com/wiki/Arma_3_Difficulty_Menu
See autoReport
@finite dirge where do I change it? description.ext?
The profile of the server or the difficulty menu of the host. https://community.bistudio.com/wiki/server.armaprofile#Arma_3
I appreciate it a lot, thank you
(allPlayers select {alive _x})
How much time does it take for the Alive to return that a player is dead?
Not a lot, why
Because I was using EntityKilled event handler in a Dedicated server and checking how many players are alive, if they all died the mission should fail but there was a situation were the missions did not failed with all players dead.
It did worked some times but its unreliable.
Hello, I am running the Ama3 group in Korea and now I am trying to learn a script.
hello
the BI wiki contains quite a bit of info on that. especially the scripting commands page is very useful reference
I have to start with the basics...
There are also few pages for that. It might take some time to learn more advanced stuff.
@lavish ocean should ๐ be pinned on this channel?
people should not be able to ask questions here without spending time on the wiki for at least 30 minutes ๐คฃ
What's the correct procedure for checking the current value of a bis_fnc_countdown? I'm trying missionNamespace getVariable "bis_fnc_countdown_time" but it's just returning the initial value.
i dont have any code available on this laptop, but 99% likely you can't get it, judging from overal usefulness of BIS functions
Then what's the function for? What's the purpose of having a countdown if you can't tell when it ends?
have you read the description of the function?
Triggers a countdown. Countdown can be accessed via missionNamespace variable bis_fnc_countdown_time
Yes, otherwise it would not be returning the initial value
Currently testing in SP but will be MP (and I have set the countdown function to be global)
Test code deployed in init.sqf:
if isServer then {[45,true] call BIS_fnc_countdown;};
while {true} do {
systemChat format ["%1",(missionNamespace getVariable "bis_fnc_countdown_time")];
sleep 2;};```
the resulting systemChat message is always 45.
(I know while true loops are bad, this is just for test purposes)
I'm confident it isn't just a problem with the systemChat report loop; I have another check (in the actual mission functionality I'm doing this for) that's supposed to respond when the timer is 0, and isn't doing anything
you sure isServer runs on SP?
a) if it wasn't running, I wouldn't get 45 because that wouldn't be being set at all
b) I tried it without isServer and got the same result
could you try the following:
if isServer then {
[45,true] call BIS_fnc_countdown;
};
while {true} do {
_value = [] call BIS_fnc_countdown;
systemChat format ["%1", _value];
sleep 2;
};
actually, BIS_fnc_countdown uses bis_fnc_countdown_time to keep track of the current timing, so it should be available
in that case I don't really understand why my original script wasn't working
is it possible to change vehicle appearance via script?
Make the appearance changes you want in the Virtual Garage, then click Export at the bottom. Open your text editor of choice and press CTRL+V. You can use that output in a script. (specifically the part involving BIS_fnc_initVehicle)
@hallow mortar okay. thanks a lot
BIS_fnc_initVehicle is the same as putting code in init box in eden right?
or is it like this?
_veh allowDamage false;
@hallow mortar someone made a mess when he first filled the page. bis_fnc_countdown_time doesnt change because it just keeps initial value.
So...bis_fnc_countdown_time is just there to mislead people, then?
It is internal param and should not be exposed. You check it like this:
_timeLeft = [] call bis_fnc_countdown;
_isCountdownInProgress = [true] call bis_fnc_countdown;
@grave stratus
BIS_fnc_initVehicle is the same as putting code in init box in eden right?
No. It's a separate command. You could put that command in a vehicle's init box, though. I recommend looking it up if you're unsure.
@tough abyss I've been told it's bad practice to use them because there's no end state.
it's a bad practice if you don't know what you do yes
Also, put the sleep in the while code (if possible) so you are sure you don't while {true} without delay
while { sleep 2; true } do {
private _value = [] call BIS_fnc_countdown;
systemChat format ["%1", _value];
};```โ of course with this you have a 2s start delay
@hallow mortar noted. as i want to spawn it via script, i cant put it in init box can i? ๐
One of the parameters for BIS_fnc_initVehicle is the target vehicle. In an exported example, it's probably _this or something like that. Simply replace that with whatever variable name you gave the vehicle when you spawned it - for example, if you used _veh = createVehicle ..., plug _veh into BIS_fnc_initVehicle.
@hallow mortar got it. thanks
does
endLoadingScreen makes loading mission faster? someone told me that, i've read the biki, nothing much has been said.
It appears that's designed for use with custom loading screens. I wouldn't recommend trying to use it on the native A3 loading screens, because even if it does work, you might end the loading screen before the mission's finished loading. Loading screens are typically the length they are for a reason.
endLoadingScreen is only removing the loading screen, it doesn't magically load scripts fasters...
actually scripts load faster while the loading screen is open
just wanted to say that ๐
Ahh okay
Hello,
i got a combo list, i add some items, but when i added pictures, and they suddenly turned black
I have a few players that have tried it when entering my server. they said that they load faster using it
The visual/UI loading screen may be gone, but that doesn't mean the mission has actually finished loading
anyone able to help?
i see
i got a combo list, i add some items, but when i added pictures, and they suddenly turned black please any idea why?
what is this combo list? ๐ค
@dim kernel probably more luck at #arma3_gui
New problem. I'm spawning a bomb and setting it to point straight down. I'm then attempting to give it a few hundred m/s of velocity, straight down. I've got it pointing down okay, but I can't figure out what the correct settings for setVelocity are to create straight-down velocity.
I assumed it was the z value (last in the array) but increasing that makes the bomb go further off target
try decreasing it (so it goes down)
Sorry, I meant to say that changing it at all makes it further off target. I've tried negative values too.
do you also use setVectorDirAndUp to rotate the object?
I use the function in the last comment here: https://community.bistudio.com/wiki/setVectorDirAndUp, which does use setVectorDirAndUp
in case the setVectorDirAndUp is changing where the z axis points, I've been playing with modifying the other values in the setVelocity array, but I just can't find the one that makes it go straight down
I'm not 100% sure, but if you rotate an object, the xyz for setVelocity also changes.
So if the object is rotated to point down, setVelocity should use the x value to go forward (or in this case down).
But I could be wrong about that
Apparently the problem is actually a crippling lack of consistency
sometimes the bombs are set to point the right way, and come down mostly on target
other times they come in backwards and a mile away
you know what, I'm just gonna spawn them and let gravity do the rest. I can't deal with this.
Maybe try with setVelocityModelSpace ๐คท
@hallow mortar try this:
// create explosive
_bomb = "M_Mo_82mm_AT_LG" createVehicle [0,0,0];
// place explosive 100m above player
_bomb setPos [getPos player select 0, getPos player select 1, 100];
// set the pitch to -90 degrees (downwards)
_y = 0; _p = -90; _r = 0;
_bomb setVectorDirAndUp [
[ sin _y * cos _p,cos _y * cos _p,sin _p],
[ [ sin _r,-sin _p,cos _r * cos _p],-_y] call BIS_fnc_rotateVector2D
];
// set the velocity to 100 m/s
_bomb setVelocity [0, 0, 100];
The rotateVector2D thing works fine, but as soon as I throw in setVelocity things start going off course
the above script does work (spawns explosive, rotate it and blast downwards on top of the player) while testing it locally
I also noticed some issues with manually setting setVectorDirAndUp where it didn't moved the correct direction, since the rocket (in my example) would just go its own way
Well, I don't know what to tell you. I did it without the setVelocity part at first (by accident) and the bombs were being created correctly and falling straight down on target. I added the setVelocity part, did the thing, and the bomb landed 400 metres away.
Can you somehow detect if the player is on a main road (Orange on the map)
yes
isOnRoad and this script made by @astral dawn at the bottom of the page:
https://forums.bohemia.net/forums/topic/175210-get-road-type/
Yes
I also found that the problem is that the main road (http://prntscr.com/pc9903) has the same getSurface as this type has (http://prntscr.com/pc99ab)
hey does anyone know how i can make it so aircraaft can have a set colored smoke trail behiond em?
you can either use the drop command (not really nice), or particle emitters @merry arrow
k im not super good with that, i found the emitter 3ditor mod so that should help, thx
Am I right to assume that ARMA 3's revive system is entirely scripted?
yes
Alright, was looking into it and seeing if I can customize it but there's a lot to dig into and wanted to make sure I wasn't wasting my time.
Yeah I was digging through the a3 pbo's and found it in functions_f_mp_mark
just.. a lot to dig through cause of their macro and stuff x d
Fastest way would be to copy paste reviveInit and replace handlers with your handler functions where you need customizations I think.
@winter rose so how would i go about this, im doing it but its not achieving the result im going for. im trying to make it kinda like an airshow
what are you doing?
does position support float up to 3 decimal points?
@grave stratus it is about overall precision, so depends on the whole part as well, you can have even more digits after decimal point if the whole part is small.
for some reason i'm unable to overwrite defaultAction via KeyDown event handler.. am i doing something wrong?
i don't want the player to be able to raise and fire his weapon
cant override mouse buttons
can i disable it?
best you can do for that sort of thing is an addaction
using the shortcut defaultaction
and the addaction will always take priority
its hacky tho
is there a way to get element position within array ?
there can be more same elements in array ["a", "b", "a", "a", "c"] ...
Then foreach and pushback the _foreachindex for elements which match your criteria
would be good if findIf had _forEachIndex so that you could say && _forEachIndex > n
or apply, count, ... anything doing something with array
got around that anyway, as usual in case of Arma
Any "smart" way to check if character is lower or upper case? check if "u" or "U". I am checking it by comparing to alphabet array at the moment.
could do it by comparing the char code
_charCodeA = toArray "a" select 0;
if (toArray _letterToCheck < _charCodeA) then {hint "IsUpper"} else {hint "IsLower"};
@Schnellfeuer thanks
@west grove set no, get yes.
thanks god there isnt
Well, for SP immersive moments there could be, such as the camera looking at an event then transferring the controls back to the player, but regarding abuse, heck yes
that's what i wanted to do, yes
could use a custom animation, but that would rob the player from being able to move
also i never made an animation before, so...
use gesture
no idea about any of that
actually gesture doesnt change camera dir only pos
Yup
how i find classname of objects inside of a box?
i noticed that items in equipment storage has some extra items than arsenal
AmmoBox?
yes, ammo box, equipment, uniform, whichever it is
getXXXCargo commands
@tough abyss thank ill look it up
_box_type = _this select 0;
_amount = _this select 1;
_amount2 = _this select 2;
clearWeaponCargo _this;
clearMagazineCargo _this;
clearItemCargo _this;
clearBackpackCargo _this;
switch (_box_type) do {
case "equip": {
_this addItemCargo ["ACE_adenosine", _amount2];
_this addItemCargo ["ACE_fieldDressing", _amount];
};
case "reset": {
if (_this == "equip") do case "equip";
};
};
I am trying to figure out a command that can switch to another case from
another case but i am not sure how, i've read biki, but doesnt seems to
have the example for it. In the script above, i wonder how can make it on the
if (_this == "equip") do case "equip"; so that it goes to another case.
oh
clearWeaponCargo _this; thats a syntax error
_this is an array as you show in the first 3 lines. the clear commands don't take arrays
yeah i've thought that much that it would return error
You could so smth like this
private _fnc_equip = {
_this addItemCargo ["ACE_adenosine", _amount2];
_this addItemCargo ["ACE_fieldDressing", _amount];
};
switch (_box_type) do {
case "equip": _fnc_equip;
case "reset": {
if (_this == "equip") then _fnc_equip;
};
};
Oh.. just noticed that you check _this == "equip"
so you expect _this to simultanously be array,object and string ๐ค
๐
im a bit confused
if i put ["equip",100] execVM "Custom\suppliesInit.sqf";
would _this point to the object or the array?
i understand that to use the array i need to use _this select 0;
array
you aren't passing any object. You are passing an array with a string and a number. no object anywhere to be seen
i understand that to use the array i need to use _this select 0;
no. As I said use params
so i need to give a name to the object first
not necessarily. You just need to pass it somehow
anyone has any idea of how to determine if a weapon config entry is a weapon with attachment?
Hello, probably dumb question.Is there any way how to increase backpack inventory?
only via config
like those weapons with attacments in crates
is it possible to cancel a kbtell sentence?
i tried to overwrite it with something empty, but no chance
also deleting the topic mid-sentence doesnt seem to stop it
You can kill the peep
Hey guys I'm having some real trouble coding a cfgvoices class anyone know them?
Try in #arma3_config maybe
ty
hmm anyone know a way to overide normal voices in any way? I've got the voice to work but sometimes the original is heard too
Does anyone know- if I use player enableStamina false does that still respect weight? Or should I use enableFatigue?
I'm looking to slow someone down if they're overburdened, while still removing the stamina bar.
Nope, it disables the whole system completely
I'm sure there's a way to respect weight but disable stamina, apparently I just don't know it. Is it a player attribute maybe?
what makes you so sure?
Used to play on a vanilla Invade and Annex server that did it.
Try the commands in Eden then.
Else it was a loop that sets endurance to 1 every second
A loop seems horribly inefficient. I suppose just dropping the various commands into my init to test is the way to go, yeah.
Hi guys,
Im having some issues regarding some of the ACE functions hoping you can help me out once again =)
So the issue is that I need to delete the specific object the ACE action is attached on.
I found one solution by doing it vanilla with the following:
["Land_BottlePlastic_V2_F",
"initPost",
{
param[0] addaction ["randomaction",
{
deleteVehicle param[0];
},
[],6,true,true,"","_this distance _target < 2"];
}, false, [], true] call CBA_fnc_addClassEventHandler;
So this works perfectly, the object spawns with the attached action and is being deleted when im doing the action.
Now I wanna do the same thing with ACE.
What Iยดve got so far...
removeobjectAction = ["removeObject","Remove Object","",
{[2, [], {
deleteVehicle param[0]; //<----This is the issue...
}, {hint "Action aborted";}, "Removing"] call ace_common_fnc_progressBar;},{true}] call ace_interact_menu_fnc_createAction;
[
"Land_BottlePlastic_V2_F"
,"initPost",{
[param[0],0,["ACE_MainActions"],removeobjectAction] call ace_interact_menu_fnc_addActionToObject;}, false, [], true] call CBA_fnc_addClassEventHandler;
I know that the deleteVehicle param[0]; does not work because the param 0 is not the object in this case, but is there any good way to get it?
found a solution, itยดs not beautiful but it works ^^
deleteVehicle nearestObject [player, "Land_BottlePlastic_V2_F"];
actually... in ace_interact_menu_fnc_createAction the statement has access to params ["_target", "_player", "_params"];, so _this select 0 should return the object you put the action on.
Does anyone know how to apply custom voices to be able to be picked when making a profile?
class CfgIdentities
{
class Combine
{
name = "Combine";
face = "whiteHead_01"; // doesnt have to be this one, you can use any head you want. Just look up the class names
glasses = "None";
speaker = "CivilProtectionENG"; // your voice class defined below
pitch = 1;
nameSound = "Kelly"; // I believe this ties to the sound file for Kerry, I'm guessing you can change this but I havent bothered
};
};
Ive got this cfgidentity but i dont know if it works or what face its tied too
missionNamespace has lifespan of the current mission, what is the 3DEN editor then? Is it also a mission because it also has a mission namespace?
Yes
MissionNamespace in Eden editor is cleared once the mission is previewed
@astral dawn
Thanks!
this addACtion ["Reset Box","Custom\suppliesInit2.sqf",["reset",200,50,"supply"],2,false,true,"",""];
_caller = (_this select 1);
_box_reset = (_this select 3) select 3;
If ((_caller == CO1) || (_caller == CO2) || (_caller == CO3)) then {
if (_box_reset == "supply") then _fnc_supply;
if (_box_reset == "helmet") then _fnc_helmet;
if (_box_reset == "equip") then _fnc_equip;
if (_box_reset == "medic") then _fnc_medic;
}
else {
hint "You are not authorised to use this function.";
};
i am having problem for the script to check wether or not caller of the addAction is named CO1,CO2 (variable name) to proceed on the script, but it seems that CO1 doesnt return anything although i have named then on the unit's variable name. What do i need to use to check if the caller is the named unit?
if (_box_reset == "supply") then _fnc_supply;
that and the others should be ...
if (_box_reset == "supply") then {_fnc_supply;};
but also how do you call the function?
call your_fnc_supply; ?
@frozen knoll i deliberately removed the function in the example script since it is working fine. my problem is only the check for player with variable name CO1,CO2...
here is the full script https://pastebin.com/40GJxPDw
i wanted to restrict the usage to a certain playable slot only
player addACtion ["Reset Box",{params ["_target", "_caller", "_actionId", "_arguments"]; hint format["%1",_caller]},["reset",200,50,"supply"],2,false,true,"",""];
strange as it should return the caller
100% if you place a unit CO1 and add the action to the init and run
this addACtion ["Reset Box",{params ["_target", "_caller", "_actionId", "_arguments"]; if (_caller == CO1) then {hint format["Caller is %1",_caller]};},["reset",200,50,"supply"],2,false,true,"",""];
it returns C01
the check is fine btw ๐
hmm
if (_box_reset == "supply") then _fnc_supply;
if (_box_reset == "helmet") then _fnc_helmet;
if (_box_reset == "equip") then _fnc_equip;
if (_box_reset == "medic") then _fnc_medic;
thats what you need to fix ๐
you could test by removing that and putting hint "test"; in there to see if its firing
if i remove the check line it works fine, it also mean that anyone can use the addaction
so your playing as C01 right?
in my original script it show Error Undefined variable in expression : co1
im playing as co2
and you havnt mixed up number 0 with letter O ?
hmm yeh its unusual as my test above definately returns the caller your playing as
the check is good like i said but u could try a alternative way
_units = [CO1,CO2,CO3];
If (_caller in _units) then {
using your code directly into the box init shows the same error too
have you tried to see what _caller is returning in your case?
_caller = (_this select 1);
_box_reset = (_this select 3) select 3;
hint format[Caller - %1",_caller];
i am trying it now
roger
this addACtion ["<t color='#FF0000'>Reset Box</t>","Custom\suppliesReset.sqf",["reset",200,50,"supply"],2,false,true,"",""];
supppliesReset.sqf :
_caller = (_this select 1);
hint format[Caller - %1",_caller];
Error invalid number in expression
i think my addaction is wrong somewhere
oh
sorry man ha
so it is returning the caller as expected
using if (_caller in _units) shows error invalid number in expression
i did a test and it works
CO1 = "meow";
C02 = "meowmeow";
CO3 = "meow3";
_caller = CO1;
_units = [CO1,CO2,CO3];
if (_caller in _units) then {hintSilent "yes";};
i supposed that works, since you have declared all the COs in the script
but even for me, when i test _caller returns CO2
brain explodes!
๐
maybe because there is no player playing the other CO slot?
because the error returns invalid expression on CO1, while im using CO2
yup i guess thats the problem
it shows up CO2 as an error while im playing as CO1
so how do i go around this issue, i cant expect every CO to go online everytime ๐ฉ
check if objnull
reading objNull
yeh man
Read it. i have no idea how to integrate this into the script ๐
i need to somehow remove the CO in _units array if the CO isNull correct?
_units = [];
{
if !(isNull _x) then
{
_units pushBack _x;
};
} forEach [CO1,C02,C03];
should work
ah pushBack is used to put an element into an array
ill try it
does not work. undefines variable : CO1 and _x
@grave stratus use strings, isNil and missionNamespace getVariable
Is it possible in SQF to remove action which appear from CfgActions of vehicle?
I don't think so, why? what usage @wanton swallow
@winter rose then its like this?
_units = [];
{
if !(isNil _x) then
{
_units pushBack _x;
};
} forEach [missionNamespace getVariable CO1,missionNamespace getVariable C02,missionNamespace getVariable C03];
have you checked the wiki for these commands?
private _units = [];
{
if !(isNil _x) then
{
_units pushBack (missionNamespace getVariable _x);
};
} forEach ["CO1", "C02", "C03"];```
also I just noticed, but you are using mixed CO and C0
C zero and C o
if ((isNil missionNamespace getVariable C01) || (isNil missionNamespace getVariable C02) || (isNil missionNamespace getVariable C02)) then { code; };
like this? i have read it, but couldnt figure out how to use it yet
in my script it is CO
use my code โ
Usage is to remove special action on plane
@wanton swallow which one?
From external mod
if you don't give precise info, I can't give precise answer ยฏ_(ใ)_/ยฏ
What do you want to know? Mod name and plane class?
i dont think you can remove it tho, removeAllActions is for player added action right?
Yes
scripted actions
if it's a model action, I don't think you can
This command dont work with actions from cfg
@winter rose thanks a lot. It works!. i've been stuck here for 3 days. Thanks to @frozen knoll too
@winter rose how do i point to the object if the object has not been named? for execVM
[this,"supply",200,50] execVM "Custom\suppliesInit.sqf";
in an init field yes, but init fields are executed everytime a player connects
_myCrate addWeaponCargo/addMagazineCargo/addItemCargo stuff
yes supposed to be
then? name your crate
but it does not adding item
because there is a lot of crate
i didnt name all the crate
no, because of this:
_boxtarget = _this select 0;
_box_type = _this select 0;
_amount = _this select 1;
_amount2 = _this select 2;```
use params
ive been reading params
params [
"_boxTarget",
"_boxType",
"_amount1",
"_amount2"
];```
i was testing it i forgot to change it back again
so i need to use this at the crate init?
or in the script?
so it would return the same thing?
I renamed boxType and amount1
what i dont understand is the difference between using this select and params
params doesn't make the kind of mistakes you did, it's more legible, and it can also filter argument types
ah
so in the init of the crate this is fine?
[this,"supply",200,50] execVM "Custom\suppliesInit.sqf";
check with if isServer
you don't want the crate to add more mags everytime a player connects
error clearWeaponCargo. type string expected object
it should be
params [_boxTarget,"_boxType","_amount1","_amount2"];
is it?
after changing it, it return error undefined variable
or am i doint it wrong?
I said I did rename your param variables, if you didn't rename them in the script then it won't work obviously
yes i have renamed all of the variables.
stil shows up error, type string, expected object
the error is on _boxTarget
yes, because sqf params [_boxTarget,"_boxType","_amount1","_amount2"];is wrong
[this,"supply",200,50] call {
params [_boxTarget,"_boxType","_amount1","_amount2"];
//everything else here?
};
like this?
or
[] call {
params [_boxTarget,"_boxType","_amount1","_amount2"];
//everything else here?
};
You're missing quotes
I have tried it with quotes, same thing. It return as string, not object before the 2 codes above
And how do you call it?
using execVM
[this,"supply", 200, 50] call {
params ["_boxTarget", "_boxType", "_amount1", "_amount2"];
// everything else here?
};``` works, period
if (isServer) then {
[this,"supply",200,50] execVM "Custom\suppliesInit.sqf";
};
in the crate init
yes?
[this,"supply", 200, 50] call {
params ["_boxTarget", "_boxType", "_amount1", "_amount2"];
// everything else here?
};
and this in the script?
i havent tested this since i went outside for abit and just got back,
no.
params ["_boxTarget", "_boxType", "_amount1", "_amount2"];```that's it
why would you double your arguments.
Hmm i've tried putting in just that. _boxTarget returned string, not object
k
the init is good, don't touch itsqf if (isServer) then { [this, "supply", 200, 50] execVM "Custom\suppliesInit.sqf"; };
switch (_boxType) do {
case "supply": {
{_fnc_supply};
};
it should be like this? Dedmen was the one who teach me this code
it is working fine in my script reset the crate using addAction
switch (_boxType) do {
case "supply": _fnc_supply;
};```
ah misread your text
missed the word no there
my bad
fixed the switch-do, still _boxTarget returns string, not object
how do you know? what is the error message?
Hi im trying to make it so players can abuse ACE cargo with my liberation server, according to ACE API this code should be used sqf [item, -1] call ace_cargo_fnc_setSize; to make item unloadable but i have no idea how to implement it in my mission, any suggestion?
@grave stratus well somewhere you are calling it with string
maybe not this init especially
the script is fine.
|#|clearWeaponCargo _boxTarget;
error clearweaponcargo: Type String, expected object
the init is also fine right?
hmm
it should return this right?
isnt it supposed to be local to the object?
is the crate the only place you call this script though
yes
but there is another code in the crate
to reset the items inside using addaction
if (isServer) then {
[this,"supply",200,50] execVM "Custom\suppliesInit.sqf";
};
this addACtion ["<t color='#FF0000'>Reset Box</t>","Custom\suppliesReset.sqf",["reset",200,50,"supply"],2,false,true,"",""];
the other script also use similar _variable name
shouldnt it works with multiple crates calling it tho?
ok i found the problem
there is 1 more crate that calls it without proper arguments in [] of execVM
now it works fine
thanks @winter rose
what a ride, but hey, we got it working!
Hey all, just a random one. I am trying to use the fire script for an AI unit "topgunner" it is on a MWMIH 50 cal gunner. But I cant seem to get him to fire.
thanks a lot @winter rose . i have learn a lot by writing this script
In case you are looking for multiplayer compatible civilian population and ambient traffic:
https://forums.bohemia.net/forums/topic/225821-l_ambicivs-civil-population-performant-and-mp-compatible
https://forums.bohemia.net/forums/topic/225723-l_ambidrive-civil-traffic-performant-and-mp-compatible/
L_ambiCivs by LAxemann (For AI traffic, check out L_ambiDrive) A lightweight script suite that allows multiplayer-compatible civil population. Civilians will walk around urban areas after spawning into their house. Features a script hook for running a function on every spawne...
L_ambiDrive by LAxemann (Formerly L_Civs. For AI Civilian population, check out L_ambiCivs) A lightweight script suite that allows multiplayer-compatible civil traffic. Civilians will drive around on the map and de-spawn again if the closest player exceeds a specified distanc...
A quick search on the repos, it looks like it only uses CBA_fnc_addPerFrameHandler and CBA_fnc_waitAndExecute so you could just define those functions without using all of CBA.
And looking at the code, you don't need the per-frame quality that CBA offers for those functions, so the substitute implementation can be quite simple
on the other end, 99% of the mods use CBA nowadays, so the moment it's not 100% vanilla this should work perfectly fine
hmm question. i have a box with uav backpacks. i want to give each uav a unique name
is that possible?
i dont even know how to "get" the uav object.. inside the uav backpack... inside the box
i know that i can get the backpacks via backpackCargo
until you assembled the drone once there is no "uav" object.
You can use an Event handler to get the assembled object (Drone)
hm ok. so i guess i will have to count them this way then
Does anyone know if it is known that addWeaponWithAttachmentsCargo and global are not working properly? By that i mean that if you add one weapon with 50% magazine full, and then same kind of weapon with different amount it will stack those 2 with same amount of bullets left.
Not sure if it will do the same with attachments
Maybe someone can report it if its not done yet. But myself I wasn't able to find it
I'm trying to get the zombie double-tap to the head mechanic working. I looked at this guide
https://forums.bohemia.net/forums/topic/108931-handledamage-eh-explained-poor-mans-gethit/
but I can't seem to make it work. in fact the handleDamage eventhandler doesn't seem to work at all..
I'm trying to make sure that A) headshots don't kill(I count hits and do stuff with that)
B) I can detect if a shot was a headshot, reliably
I tried using allowdamage false, but that confuses the MPHit eventhandler.
any tips?
theres probably no damage to handle if allowDamage is false
@steady terrace this guide is from 2011 (ArmA 1), ditch it
see https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage for more information
thank you @winter rose ! I ended up using the hitPart event handler, which does what I want!
Just in case somebody is bored:
<Grid xmlns="https://schema.x39.io/arma/uxf">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="123"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="123"/>
</Grid.RowDefinitions>
<TextBlock Text="Example" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
</Grid>```
need this parsed into
[
[["https://schema.x39.io/arma/uxf", "Grid"], [], [
["https://schema.x39.io/arma/uxf", "Grid.ColumnDefinitions", [], [
[["https://schema.x39.io/arma/uxf", "ColumnDefinition"], [[["https://schema.x39.io/arma/uxf", "Width"], "Auto"]], []],
[["https://schema.x39.io/arma/uxf", "ColumnDefinition"], [[["https://schema.x39.io/arma/uxf", "Width"], "*"]], []],
[["https://schema.x39.io/arma/uxf", "ColumnDefinition"], [[["https://schema.x39.io/arma/uxf", "Width"], "2*"]], []],
[["https://schema.x39.io/arma/uxf", "ColumnDefinition"], [[["https://schema.x39.io/arma/uxf", "Width"], "123"]], []],
]],
[["https://schema.x39.io/arma/uxf", "Grid.RowDefinitions"], [], [
[["https://schema.x39.io/arma/uxf", "RowDefinition"], [[["https://schema.x39.io/arma/uxf", "Height"], "Auto"]], []],
[["https://schema.x39.io/arma/uxf", "RowDefinition"], [[["https://schema.x39.io/arma/uxf", "Height"], "*"]], []],
[["https://schema.x39.io/arma/uxf", "RowDefinition"], [[["https://schema.x39.io/arma/uxf", "Height"], "2*"]], []],
[["https://schema.x39.io/arma/uxf", "RowDefinition"], [[["https://schema.x39.io/arma/uxf", "Height"], "123"]], []],
]],
[["https://schema.x39.io/arma/uxf", "TextBlock "], [
[["https://schema.x39.io/arma/uxf", "Text", "Example"],
[["https://schema.x39.io/arma/uxf", "Grid.Row"], "1"],
[["https://schema.x39.io/arma/uxf", "Grid.Column"], "2"],
[["https://schema.x39.io/arma/uxf", "Grid.ColumnSpan"], "2"],
[["https://schema.x39.io/arma/uxf", "Grid.RowSpan"], "2"]
], []]
]]
]``` into this
that array looks more complicated than the XML ๐ฎ
and why the schema definitions? Wouldn't it make more sense to have that separated (and only once)?
Theoretically, yes
Practically however, the XML parser is supposed to be generic
And having the namespaces in there is more practical then providing a full lookup table for each node just to allow proper Support for xmlns
(as you can xmlns on every node you want theoretically)
Plus the array is fairly simple ๐
NAME = ["namespaces", "Name"]
NODES = [NAME, [ATTRIBUTES], [NODES]]
ATTRIBUTES = [NAME, "Value"]```
Is the basic idea behind it
but if you want to namespace an element it has to be in the XML anyway, so it would show up as an attribute anyway ๐
just my 2 cents though
not sure what you mean by that
it should be like this? Dedmen was the one who teach me this code
@grave stratus
No not at all. Don't take my idea, then mangle and break it to unusability and then say it came from me dude.
@grim coyote
Does anyone know if it is known that addWeaponWithAttachmentsCargo and global are not working properly?
I made that command. Can you reproduce that? can you send me script to reproduce it?
It's mooooost likely engine bug that "cannot" be fixed anymore, the command implementation itself is fairly error safe.
No wonder the command is broken if you can't write a simple switch-case ๐
I cant reproduce it because I dont have arma installed. But maybe someone else can?
Lol wtf. Who edited the aWWACG wiki page.
cursorObject addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "", "acc_flashlight", "", ["30Rnd_65x39_caseless_mag", $DEAD], ["3Rnd_HE_Grenade_shell", $DEAD], ""], 5]
$DEAD?? wat
KK? ยฏ_(ใ)_/ยฏ
you two are the only one that have edited it, and here are his changes
https://community.bistudio.com/wiki?title=addWeaponWithAttachmentsCargo&type=revision&diff=125157&oldid=124178
So @grim coyote you mean something like this:
//add mx with half full mag
cursorObject addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "", "", "", ["30Rnd_65x39_caseless_mag", 15], [], ""]];
//add mx with 2 bullets in mag
cursorObject addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "", "", "", ["30Rnd_65x39_caseless_mag", 2], [], ""]];
will end up with 2 MXs with half full mag each?
@still forum error 1 element provided, 2 expected
I thought count was optional
ah yep good call
ugh its not. It was designed to be. Darn you KK and your changes
there is no reason to have to always provide "1" as count
actually, the command stacks the two guns on top of each other, but you will take the one with the more ammo first I think
Even in the example
{ cursorObject addWeaponWithAttachmentsCargoGlobal [_x, 1] } forEach weaponsItems player;
look at that crap, so bad
I saw this when the patch came
If ammocount is not a number, it should skip the setAmmo and leave the magazine at default, meaning full.
I somehow tried to put $DEAD and it didn't work, unfancy
Quite sure $ would cause syntax error
yeah I think so too ๐
ah bummer, I can't test. Mouse control via Teamviewer doesn't work that well
ah, the famous "look down" stuff!
I somehow tried to put $DEAD and it didn't work, unfancy
Why not? It is legit hexadecimal notation
If you state ammo exceeding mag capacity it will fill it to full capacity
It is legit hexadecimal notation
wat
https://community.bistudio.com/wiki/Number apparently yes
I have never ever seen that anywhere
thus I don't think its a good idea to use such a obscure thing in a example
$DEAD == 57005 which will exceed any current mag capacity thus filling any mag in full.
Which brings me to the question, why it didnโt work for you, did you get error or example didnโt do what it said? @winter rose
I didn't try it, obviously
Says you fixed it
wat
if you didn't get it from
you can use $AA as hexa in sqf?
I wasn't aware of this $ hexa syntax in SQF.
Now as Dedmen stated,
I don't think its a good idea to use such a obscure thing in a example
so let's not use $DEAD that is both obscure and not adapted to an easily legible example.
0x000 notation is the standard in most languages.
So why use $ ever?
Also just a uncommented use DEAD and itll give you a full magazine is a total "wtf"
We don't need a "look I can write HEX numbers in a obscure syntax to make this command do a thing that you don't understand" on the wiki.
We need a "if you use a number higher than the maximum capacity of the magazine, you will get a full magazine"
ditto.
You just mad you canโt write Dedmen in hex
Comment says a full 30 round magazine
If you tell users that providing $DEAD as ammo count will give you a 30 round magazine they'll be confused as heck. And maybe copy paste that stuff and wonder "wtf? why is this not giving me 30"
0xCAFE works for ๐ซ๐ท โ
Half will be confused, the other half will take it as granted assuming it's some magic number for arma engine, because it can
80085 when all you have is a calculator
8008135!
@still forum you did not knew that? iirc we talked about this once 
think it was something related to the regex
chances are thus that you just cannot remember
know*
still
SQF-VM has supported that too for "ages" now
IIRC, the C variant also already had support for those hexadigits
well who cares if noone uses it ๐ค
good way to confuse the hell out of someone trying to RE your script
unless ... you use SQF-VM anyways ๐
as you then just can pretty-print everything ๐
Need so help on how to implement ACE features on dynamically spawned items, im trying to get [ItemName, -1] call ace_cargo_fnc_setSize; to be applied to dynamically spawn resources so players are cant load resources into ACE cargo.
Any suggestions, ACE wiki does not detail how to apply codes only what they are (as far as i can see)
what is your problem with that?
just execute that function on the object that you want
Yes you already said that
what's the problem with that?
https://github.com/acemod/ACE3/blob/master/addons/cargo/functions/fnc_setSize.sqf
Here is the documentation, just provide your object as the object parameter
so how can i apply the code as soon as the item is spawned or do i have it backwards ?
ill have a look
you can't do it before the object is spawned
you can do it any time after it was spawned
i assumed as much...item is spawned, detected then code i applied. Im looking at the link you send
https://discord.gg/muAExrj in case somebody wants to help developing the XML parser for SQF
@tame stream just use CBA XEH
https://github.com/CBATeam/CBA_A3/wiki/Adding-Event-Handlers-to-Classes-of-Objects
["TargetClassName", "InitPost", {
params ["_object"];
[_object, -1] call ace_cargo_fnc_setSize;
},
true, // allow inheritance
[], // excluded classes
true // apply retroactively
] call CBA_fnc_addClassEventHandler;
```\
oo ill have a look thx
or smth like that, can't verify right now.
edit: changed to InitPost should be safer for that usecase.
@queen cargo XML? Is there an actual use case? I wrote a JSON parser long time ago. And performance wise, on a blank server you can read 10,000 chars per second, but only half that on an "embattled" server... Even with improved structure and newer commands , given the complexities of XML it seems like one of those things that really need an extension DLL instead?
there is no need for CDATA support generally
full-validation also is not supposed to be available for the parser
generally speaking, i need it for simple formatting reasons
aka: no serialization format but rather some application format
with XML being just the basic app layer, and after parsing it, magic then happening
yeah, if you stick to only the real basic I can see it working out
YAML ๐ถ
ini file!
HTML3!
That's XML tho (basically)
tdv! That's what we really need.
I mean, if you can choose the input format then the answer is obviously stringified sqf arrays.
XML to JSON then arma's JSON parsing, I think you would lose less time maybe
CSV \o/
Arma has JSON parsing?
that is the plan, full XML support is overkill for pretty much any usecase ...
However, using XML also allows to utilize schema-validation in eg. editors
the end-application then expects a valid XML file and ... thats it
@still forum The following code [this, -1] call ace_cargo_fnc_setSize is obviously what i need to make it not be a loadable item, easily applying via eden if item is placed via editor. My problem is i dont know how to apply that code to this item CargoNet_01_barrels_F, for instance, when its not placed in editor say via zeus or game mechanic in existing game mode.
How do i get [CargoNet_01_barrels_F, -1] call ace_cargo_fnc_setSize to be applied as soon as game mode spawns the item or zeus places the item.
The answer is the CBA XEH handler that someone already linked you above
you cannot pass a classname to that function, only specific objects
@hollow thistle linked me that...ok ill give it a go
@tame stream as mentioned in the KP discord, you could just use the liberation functions for that instead of some XEH
yes i can but id like to know how for future missions thats not liberation
How do i get [CargoNet_01_barrels_F, -1] call ace_cargo_fnc_setSize to be applied as soon as game mode spawns the item or zeus places the item.
I've litteraly told you that... ["TargetClassName", "InitPost", {
thx im checking your method now
Arma has JSON parsing
Yes, but not available to the end user
i have a question how to add ace interaction on all wrecks this is my try but it adds ace interaction on all exept wrecks _action = ["LoadInTo", "Load Wreck", "", {hint "test"}, {true}] call ace_interact_menu_fnc_createAction; ["All", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
I want to mass create markers, I have a list of positions, what is the easiest way to do it?
Createmarker?
Is there a way to log the line number when reporting to diag_log?
@dreamy kestrel
https://community.bistudio.com/wiki/PreProcessor_Commands#LINE
__LINE__ is what your looking for
perfect thank you
as macro expansions go, if I have a macro wrapping a function call and one parameter is the line number, I can do this, FNC_MYFUNC(_x, _a, _b), where that expands into [_x, __LINE__, _a, _b] call _fnc_myFunc ? how does the macro expansion respond to complex macro inputs?
in our case, such as callback functions, etc
can anyone tell me why my script wont read my private function?
https://pastebin.com/KjHdz48A
it wont read execute _fnc_coreCargo;. it just goes through it without an error
i have solved it by directly execute it below the params line instead of using _fnc_coreCargo. But i still wanted to know why it fails tho
It doesn't execute it. Because you never ever tell it to execute
if you don't call it, it won't be called.
ahh ๐คฆ
switch (_boxType) do {
case "supply": _fnc_supply;
case "helmet": _fnc_helmet;
case "equip": _fnc_equip;
case "medic": _fnc_medic;
};
how come the code you gave to me does not need call?
I gave you
It is because of the switch structure that does it by itself @grave stratus
read the wiki, it's here for you ๐ ๐
@winter rose you and both @still forum gave me, the one with {} is the one that he gave me.
and what i am trying to is in switch too
okay i've read the wiki, understood
would it read the next code?
case "supply": _fnc_supply; _fnc_helmet;
case "equip": _fnc_equip;
like this?
or a block
case "something" :
โ๏ธ This takes a code block. Not two, not one in another, just one.
So if you have two code blocks, use ```sqf
case "blah" : {
call _code1;
call _code2;
} ;
ah thanks, i've thought of that after Dedmen tell me to call it
@thanks again @still forum and @winter rose
the one with {} is the one that he gave me.
we already were at this yesterday, not that was not what I gave you.
really? i remembered wrong then
The : operator in your switch/case, takes CODE type as right argument, the code which it will execute
it doesn't matter if you specify the code directly there using {}, or whether you just use the code that you previously stored in a variable
my bad
it will execute the code it's given.
But if you give it the code {_myvariable} instead, it will execute "_myvariable" as script, not the contents of your variable.
call is a command that takes CODE type as argument, and will execute the code you give it.
Exactly like the : operator in switch/case
ahh
okay now that clears things up
my understanding of variable is wrong
i thought, variable would return code even without call
hopefully not ;-)
i thought, variable would return code even without call
Well.. that's correct
the game doesn't "compile" it in the way that "wherever this variable is written, I will text-replace it with code"
a variable containing code, returns the code when you reference that variable
it returns the code, but doesn't run it
call {
_code1;
} ;
This will end up like
call {
{ code contents }
}
The call will return the code contents as a return value
Code is a variable type in itself
its just a value.
yes, thats what i meant
its like you'd write a script like
1;
2;
"string";
it is like defining _var = 5, then just typing _var: it does nothing
as the variable (except the last value which will be returned from the script) is never used or stored, it just gets thrown away again
