#arma3_scripting
1 messages · Page 650 of 1
Typing "dbug" in one of the edit fields should work.
hehe i did that too
felt like such a noob
in fact, you can type dbug in a chat window but if you do, you wont get a cursor
ive been meaning to mention that to Leo, but forgot
brb exercising
//Survivor dies then turns into nato script below
if (hasInterface) then
{
G_SAS_Respawn =
{
waituntil {alive player}; //Just make sure the player is alive first
//Lets create the vessel they will be spawning into
private _BGroup = creategroup west; //You will want to keep this part, the player can be forced into another group AFTER they are initalized
private _SpawnPos = SAS_SpawnFlag getpos [10,(random 360)]; //This will place the unit 10 meters from the "SAS_SpawnFlag" in a random 360 degrees.
private _Newunit = _BGroup createUnit ["O_G_Survivor_F", _SpawnPos, [], 0, "None"]; //Lets create the unit here.
[_Newunit] joinSilent _BGroup; //Fix AI shooting at you after respawn
//Let the unit initalize before we swap...Maybe 2 seconds is enough?
sleep 2;
selectPlayer _Newunit;
};
G_RespawnEH = player addEventHandler ["Respawn", {_this spawn G_SAS_Respawn;}];
};```
can someone help me?
whenever i die i do swap sides but the AI also swaps sides rather than spawning on the respawn_resistance marker
he spawns on the place i swap sides to
ohhh okay it bugs out if you force respawn got it, if you are killed it works
oh, so forceRespawn does not trigger the Respawn EH?
i think so, if im killed by AI it works however if force respawning it works but brings the unit i died with, with me
do I add this sqf G_RespawnEH = player addEventHandler ["forceRespawn", {_this spawn G_SAS_Respawn;}];
When does code called from onEachFrame run during mission init (using the latest version of Arma 2 a.k.a. v1.64)?
Let's assume that it's called in unscheduled environment
any advice on how to encourage AI to fire RPGs at infantry?
They are all provided with thermobaric/HE shells
cheap hack: attach invisible target to their forehead with high threat value and cost
its probably a simple matter of cost value (in config) - ammo cost is too high and target cost is too low -> AI wont use it for the target
but its a tricky matter - because if you set it so low that they willingly shoot, then they probably will dump HE onto the first soldier they come across
AI have no concept of indirect fire / when HE rockets would actually be usefull (like firing into a building to kill a target in that room). So either you help them by attaching targets to wherever you want them to fire to entice them, or you directly force them to aim at something and fire
has anyone experienced weird stuff with attachto and setowner? Objects that I am attaching to a client vehicle and then moving their locality to the owner of that vehicle... the attached objects despawn
same thing happens if the setowner is done before or after the attachto... the moment the attachto happens... poof, the attached object disappears
is there a way to block the engine from turning on in a vehicle unless the vehicle has a certain var set
tried using the engine evh, but it jsut causes other players to see the engine as turned off
Are you sure they "despawn"?
They probably get moved to some "unknown" position. Did you check that too?
remove the fuel?! 🤣
lol guess thats an idea
No, I didn't check tbh
its still weird behaviour regardless of what happens to the object
Are you sure the attached object is not "local only"? (e.g. createVehicleLocal)
probably not, it was a destroyed vehicle, a truck or a car usually
maybe you can't transfer the ownership of dead entities (probably just owned by the server)
mmmm, good theory
you can indeed remove the fuel, or set the engine hitpoint damage to 1
Does the evh have to be remoteexecuted on everyone?
which one?
the engine one
just setHitpointDamage, it's not an EH
Well it's supposed to happen if someone turns on the engine and a certain var is not set
you won't be able to set the engine on if the engine is destroyed
yeah but for the check to happen the engine must be turned on first
or could do it in the getinman evh
stop stop stop.
what is the end goal
enter the vehicle, if a certain var isn't set, you cannot turn on the engine
but I need to check for this var somehow
or
when you set the var, repair the engine?
yeah but you need to do a getVariable at some point throughout entering the vehicle or turning it on or something
otherwise how will you know to destroy/repair the engine
1/ destroy the engine
2/ when you want it repaired, repair it
you don't need to check if someone is trying to start it to fix it
I don't think you understand what I am trying to do lol
Basically a hotwire script
Ill figure it out myself
Hello, I need some help. I want to add functionality to a mission where any AI shares target information with all units on it's side. How would that be possible?
see targets and reveal 😉
how would I get 2 ai units to drop two parts of an mg/mortar and build it? _dropweapon [X] each and then what?
there is an undocumented "Assemble" action:
https://community.bistudio.com/wiki/Arma_3:_Actions#Assemble
See also TakeBag below with an example for it
thanks
a handddd baaaaaaaaaaaag??
can a campaign description file use all the normal description file classes and apply them to every mission?
no, but you can include a file in every mission's description.ext
and double declares cause crashing right? so i have to write it in a way that won't double declare if say I have mission specific stuff too in that class?
I huh, maybe?
maybe I didn't say that well. say i have...
// campaign cfgsounds.hpp
class CfgSounds
{
//sound config here
};
//mission cfgsounds.hpp
class CfgSounds
{
//mission specific sounds configs
};
#include "\campaign\cfgsounds.hpp"
this will error right because of two cfgsounds declares?
it doesn't cause a crash afaik. but it throws an error
that's confusing. I'm not sure what you mean (what is defined where?)
but campaign and mission configs are separate
class CfgSounds
{
#include "\campaign\campaignCfgSounds.hpp"
class missionSound1
{
// ...
};
};
yeah and that campaignCfgSounds.hpp should NOT have a cfgSounds declare in it then. just the sound classes
campaign and mission configs are separate
correct, only the class CampaignSound1 etc
gotcha
what script do i need to tell a squad "stop advancing, run back the squad leader and into formation and hold your position"?
So I'm trying to get an ai unit to spawn on one of 3 locations. I'm currently getting an error from the _unit line and can't figure out what's wrong. I also have this running in the activation of a trigger. Anyone able to help?
_pos = ["pos_1","pos_2","pos_3"];
_unit = "CUP_O_TK_INS_Soldier" createUnit [getPosATL (selectRandom _pos),_group];```
this syntax doesn't return a unit
use the first syntax instead, @hushed tendon
So I need to add this?_unit = this;
…better use the other syntax
I'm not sure I understand
see the link Leopard20 provided; the command has two syntaxes, use the other one
so example 1
yeah it's using the first syntax
Ok I understand now
depends, that sounds more like an AI modification. Currently, the AI will not move back into formation until either there is no more threat or it is in careless behavior. it won't give up its cover until its safe.
maybe doFollow then doStop
doFollow doesn't reset the formation like the vanilla "return to formation"
yep, I think there is nothing alike command-wise
I have this for him but even with the waypoint to the player the squad doesn't move
{deleteWaypoint((waypoints Group1)select 0);}forEach waypoints Group1;};
{doStop _x} forEach units Group1;
_wp = Group1 addWaypoint [getPos Bob, 0];
Group1 setFormation "WEDGE";
_wp setWaypointType "MOVE";```
not an exact one, but there is one way:
[unit] joinSilent group unit
ah, interesting
a fully working variant is more complicated than that (e.g. if a unit is alone in group, or is the leader)
don't use doStop
what do you recommend then?
nothing
so leave that line out?
since you're using waypoints
there we go. Thanks
- use ```sqf (see the pinned messages)
- you didn't remove doStop
- that's not what he's asking (he wanted a "return to formation"; plus removing all the waypoints is a bad idea)
Welp
I'll try these out guys thanks!
I think I'm doing this syntax wrong.
_group = createGroup east;
_pos = ["pos_1","pos_2","pos_3"];
_unit = _group createUnit ["CUP_O_TK_INS_Soldier", getPosATL (selectRandom _pos), [], 0, "FORM"];
use getMarkerPos, not getPosATL
well I also need unit height as well. Unless there is a way to add height to getMarkerPos
why do you need it?
Not unit height. I mean set the height at which the ai will spawn at. Like on the second floor of a building
getMarkerPos [marker, true]
would it be possible to use the position of an object rather than a marker in the syntax?
yes
you can even type the position "manually"
is it just the getPosATL that's wrong in the syntax?
what's wrong is that you're getting the position of a "string" (which are typically markers)
I don’t understand. What part is taking the position of a string?
Oh. Is it the ["pos_1","pos_2","pos_3"]? And if so how should I change it?
_pos = ["pos_1","pos_2","pos_3"];
getPosATL (selectRandom _pos)
what are they?
so remove the ""
Generic error in expression
post the code
Nvm I had en extra bit that was not needed
It works now
And would there be any way to change they way they face upon spawning in?
$50 per hour
if only 😔
🙂
@winter rose so when doing an include pointing to the campaign folder...
//mission01 description.ext which is located at "TiberiumOrigins\missions\mission_01.altis\"
class CfgSounds
{
#include "\TiberiumOrigins\cfgclasses\sounds.hpp" //error can't find
};
class CfgMusic
{
#include "\TiberiumOrigins\cfgclasses\music.hpp" //error can't find
};
when I load up the mission in the editor, it says that the file cannot be found. it also throws an error in VSC saying it can't find it either.
so I'm guessing that the farthest back a mission can look is its own root folder, not one behind.
nope still can't find
it seems its always going to pull like this...
Failed to find 'c:\Users\Anthony\Documents\Arma 3\missions\TiberiumOrigins\missions\mission_01.Altis\TiberiumOrigins\cfgclasses\sounds.hpp' -- VSC error
which I see what it is doing... its still referring itself as the root folder, then adding on what I'm telling it to point to
because includes start from the current path
is there a way to include from outside of the mission file? like i'm just trying to figure out how to share resources for different missions so I don't have MBs of data being repeated in each mission folder
..\
if you make a campaign, just put it in your campaign structure.
for standalone missions; it doesn't work unless you make a mod with assets
so it looks like "..\..\cfgclasses\sounds.hpp" is the one that works then
but root it mission root... not "random folder on HD"
and you can't go outside of mission root (or game root)
I was looking at making a mission for this and wanted to ask, is there any trick from old scripters to convert PBO addons with its config to the .sqm & .ext file? Or is it just too much work usually to do this especially for larger mods?
um wat?
If you have a mission pbo you can extract it and it will give you all mission files.
If you want to move addon stuff into a mission; you're out of luck, a lot of stuff won't work
I'm following the campaign description wiki page for the structure, which says I can keep things in the root campaign folder to share between missions, but it doesn't explicitly say how to reference them which I think @little raptor just revealed the way.
e.g. you can baiscally make all DayZ or zombies into one mission file and people 'did' do this before, but its just like huge work it seems to back convert
well it seems in .ext you can define the classes and stuff
with massive limitations
but the format of having all different pbos and 'big mess' like in CBA
doesnt really translate well to that
and not #arma3_scripting 🤷♂️
ok, well its 'better' but seems harder
cuz u can get vanilla players to join with all mods but
i guess no one here knows, ohwell
we just have no idea what you want 🤔
🤷♂️
I think he just wants to take say 12 mods and put them in a single mission folder which he can distribute to friends.
and plug and play after he makes it
sounds like more work than making a workshop collection everyone downloads
- theft
sounds more like impossible to do...
because it simply won't work, since most config stuff can't be done from description.ext
breaking point did it a while ago, and then the community found out they were using other mod's assets in theirs
@exotic flax have you made a campaign? if you have one with shared assets between missions, can I view it so I can get the idea of doing it correctly?
I don't have any; although the core campaigns should give an idea on how they do it (eg. Old Man is sharing stuff all over)
maybe i'll look there then. i've been looking through east wind and there is some out dated stuff in there that just confused me more
i dont have a "\a3\Missions_F_Oldman\Systems\commonDescription.inc" hmmmmm
no pbos that look like it either in the addons folder
nvm, its under expansions not the addons folder
not sure what a .inc file is or how its different from .hpp
but that sounds like a #arma3_config or #arma3_scenario things
It's just a file format (.inc is short for include obviously, which is another format for header files). You can include a file with any format (as long it's actually text with utf-8 encoding)
Is it possible to list all currently running unscheduled code?
This seems to return scheduled one.
uhm ...
the fun part about unscheduled code is ..
there only ever can be once active instance running
Yeah, but how to tell "what exactly "?
i am not sure if i understand the question correct
unscheduled code is ran until it is done, nothing else may run inbetween
including game simulation
Suppose you want to find a mod doing resource intensive operations and lowering FPS.
then you probably want to either use diagnostic tools (eg. https://forums.bohemia.net/forums/topic/211626-arma-script-profiler/), printing out performance stats
or disable the mods one by one
Thx.
is it possible to exclude dead units from the spectator? I currently move them to a temporary civilian group and only allow spectating of west units.
is this valid use of "switch"? switch (true) do { case (a == 0 && b != 0): { do_something; }; case (a == 1 && b != 1): { do_something; }; };
yes, perfectly fine
not very performance friendly when called a lot, but will do the job
does it stop after the first true case, or does it do every true case?
generally speaking, the thing you did is kinda wrong but as of now sadly the arma way of doing an else if so it is kinda fine again
the switch will evaluate the conditions top to bottom and only ever execute the first one which was true
if you want all true conditions to be executed, use multiple if EXPRESSION then CODE
does arma 2 evalualte 0 == -0?
it should, although I'm not sure if -0 is a valid Number
0 - 0 == -0
hey all, Making a stress meter script. got this one error.
if(_stress <= _maxstress) then
{
if(_chang>
21:01:07 Error position: <_stress <= _maxstress) then
{
if(_chang>
21:01:07 Error Undefined variable in expression: _stress```
Parameters.sqf
https://pastebin.com/8RDiuVRS
shotdetection.sqf
https://pastebin.com/HhqdCpw3
stress.sqf
https://pastebin.com/rx2VUHqF
problem is in 'shotdection.sqf', which returns _changer but isn't set
I thought it was a stress variable i was passing then _changer gets created from shotdetection
but the file doesn't have params and is doing nothing with it
something like this?
Shotdetection.sqf
//To elevate stress levels if you are being shot at.
params ["_changer", "_stress"];
player addEventHandler
["firedNear",
{
_unit = _this select 0;
if ((_unit getVariable ["_stress", 0]) < 100) then
{
_unit setVariable ["_stress", (_unit getVariable ["_stress", 0]) + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["_stress", 100];
}
];
_changer```
how do i go about this since _changer basically is a variable that changes all the time?
for starters: you should not add an endless amount of event handlers to the player
you are also not modifying _changer anywhere and _stress is never set on the player
add those event handlers once to the player and then modify eg. the stress value everytime
to get the current stress value, you then just do the player getVariable ["stress", 0]
eventhandlers themself are not sitting in the same "scope" as your code
they are added to a list of events and get executed as they happen (hence: event handler)
your "Shotdetection.sqf" thus is pretty much just:
params ["_changer", "_stress"];
player addEventHandler ["firedNear", myFiredNearMethod];
player addEventHandler ["hit", myHitCallbackMethod];
_changer```
and now it should be kinda obvious too, why the approach you chose is not working 😉
Well crap, I guess I got to rethink this again
Just in theory, if the return value is set to _changer, doesn’t that technically create the value changer without doing something like _changer = 0 to make a predefined variable? Then when it gets passed down to stress.sqf have _stress = [_lowerstress, _stress, _maxstress, _changer] call _stressCheck
I bet I’m just spit balling at this point
Guys i experienced several times the issue where using setPos, the effects show up immediately for the server, but delayed for the client
Anyone know if this is a bug
A2OA: is it possible to have a marker have only a text label, and no icon?
"MarkerOne" setMarkerType "Empty";
maybe
i found this thread describing similar issue as mine https://forums.bohemia.net/forums/topic/220178-syncing-object-position-on-dedicated-solved/
it can probably be fixed by having 2 objects of the same type at the respective positions and just hiding/unhiding them accordingly instead of using setPos, just curious if anyones got this problem, as sometimes this solution might not be possible. If someone can confirm this i will make a ticket to feedback tracker
I solved my problem by setting the marker size to zero.
however, now I wish there were a way to change the marker text size
Not a bug. It's a synchronization issue
You can try other setPos variants as well
not sure if it makes a difference in terms of sync, but they're way more reliable than that godawful command (getPos too)
i see, was thinking that too, looking at the wiki tho seems very small difference
setPosWorld // 0.0060 ms
setPosASL // 0.0060 ms
setPosATL // 0.0060 ms
setPos // 0.0063 ms
setPosASLW // 0.0068 ms
setVehiclePosition // 0.0077 ms with "CAN_COLLIDE"
// 0.0390 ms with "NONE"
plus that has nothing to do with mp sync
yea there was a playSound remoteexec'ed right before the setPos in my test script and the sound played just fine for everyone
just the setpos was delayed quite a while
gonna test other commands and see if they work better
Nailed this down to be related to simulation. If you disable simulation on objects, the network updates are delayed.
is this true? https://feedback.bistudio.com/T84042
Did you disable simulation too?
in the current case yes it was disabled
hmm ok will try both using setPosATL and enabling sim
why do you disable simulation tho?
you can use createSimpleObject for "props" for example
it is tied to an addAction so no go
also enabling simulation probably won't immediately "resync" the object
can u setpos simple objects tho?
yes
hmmm, what do you suggest then
i can probably delete the original object, then create simple object on new pos?
how long do you think it will take to resync it?
that's a bad idea
dunno
I'm not sure what you mean
One cannot attach actions to a simple object via addAction.
this? https://community.bistudio.com/wiki/createSimpleObject
disabling an object also disables the action
you mean disable sim? no it works
oh right it's "hiding an object" that disables it
this idea in theory would work better and more reliable than setpos right?
using hideobjectglobal
or is that delayed too
that's a really bad idea
If there are only a few objects you want to do this with then I suppose it's alright
only 1
but i guess cant use this method if u absolutely need to move the exact object (ex. player or objects with a variable name)
Units that have been previously subjected to enableSimulation false; or enableSimulationGlobal false; may stay unrecognised for a long time even after simulation was re-enabled, returning objNull as cursorTarget. Force revealing units with reveal command usually solves the problem.
maybe revealing to all clients would fix the sync issue?
¯_(ツ)_/¯

what might be a good way to create a dialog after a player has joined a server?
my first instinct is to have a small script that creates the dialog, and then execVM that script in initPlayerLocal
tag the function to call the dialog as postInit?
Example:
class MyFncToOpenTheDialog {postInit = 1;};```
or just add it to the init.sqf of the mission, etc.. There are many approaches on how you can do this.
Never considered tagging the function as postinit
Well, I made a function that is literally just createDialog "introDialog"; and tagged it as postInit, and it works fine in SP
it brings up the intro dialog as soon as you load in
but testing it on a dedicated server it does not work, and does not bring up the dialog, but the function to do so seems to work fine
like if I call the function locally in the debug console the intro dialog appears
you should wait that player is not null for JIP players I think
or until display 46 exists for mp in general? because you dont necessarily need a player object to use a ui
What was it again?
waitUntil{!isNull player};
YourCode
Or that, yeah
Hi, i wanted to remove texture from model selection with script
(vehicle player) setObjectTextureGlobal [3,""];
This thing worked before, but now - this thing is not works
Is possible to do it somehow (another way)?
it will be "fixed" on next patch
meanwhile, you can remoteExec setObjectTexture
understood, ty @winter rose
eventhandlers are always unscheduled.
If you want to write code to check what code is running currently the answer is simple.
Your code trying to check what code is currently running is currently running, and nothing else.
Anyone know code/script put modded cars in car shop for life server dm me I need help
Soz I didn’t where to put it so put in channels where I thought I went @winter rose
I would like to reterive the name of cfgWeapons, and I managed to store them into an array. The thing is I would like to save the array values into a readable text tile so I could read it. I tried storing with profileNamespace but it seems it can't let me do so, any other ways I can do this?
the name of weapons? only that?
yeah
to be more percise, their class names
I managed to stored them into an array class
It seems that BI don't provide a way for us to export files other than profileNamespace
@ripe sapphire is toString works?
got it
why not just print directly with diag_log in your log file
good idea
lemme try that
@exotic flax Just asking, will I retrive those content immediately after I save into the rpt file?
Or I have to wait until the game closes?
it will be there the moment you write it
Got it
btw if you just need the vanilla cfgweapons you can find it on the wiki https://community.bistudio.com/wiki/Arma_3:_CfgWeapons_Weapons
For massive exports of (ALL) items you can take a look at https://gist.github.com/Wolfenswan/82eb0019f2f3b0319ead
and combine it with http://killzonekid.com/arma-extension-make_file-dll-v1-0/
to write it directly in a CSV file
great wiki, really 👌 😂
Oh I see. At the beginning I simply write the vars into the config, until I find out it will cause too many unnecessary results
@ripe sapphire btw cya in space.
Hi, is there a command for getting the weapon caliber?
Question: i want to build a persistent scenario for my unit , thats saves player loadout and location after disconnect. Does anybody have an idea how i can do that ? Is that possible with a script ?
guess: its in the config, which you can read with script commands
afaik do weapons not have the caliber in their config, but you have to get the magazine or even ammo used
weapons do have a config entry with "used magazines"
would be good to know. always wanted to make a compat mod that worksdynamcially for all caliblers
the CSAT Viper has 6.5 + .50 😉
technically you can add any magazine or ammo in a weapon (even when IRL not possible)
and looking in the configs I don't see any reference to the caliber (CfgWeapons, CfgMagazines or CfgAmmo), except for the caliber variable in CfgAmmo which is just a number to calculate penetration.
yeah we have some broken compat mod in our clan. HK G3 takes anything between 9mm and 7.62 lol
oh no, correction incoming
Considering usable magazines are defined in config, you cannot detect whats available at runtime so you cannot really do such a mod
The only caliber entry I know is CfgAmmo, maybe he means that tho?
Weird, I pasted the make_file.dll into arma3's root folder, but arma3 can't find the extenision
It just be like:
23:13:13 CallExtension 'make_file' could not be found
Update: It's a 32bit/64 bit issue.
http://killzonekid.com/arma-64-bit-extensions/
really should get my file io extension build for all OSs
@queen cargo Do you have any links?
https://github.com/X39/extFileIO you would need to build from sources as of now as i was too lazy to build in CI yet
plus the documentation is slighly outdated (new commands are there, old have changed in their args slightly)
@queen cargo Are there example usages?
not sure what you mean with example usages
you pretty much just call an SQF wrapper method (https://github.com/X39/extFileIO/blob/master/extFileIO_fnc_call.sqf) like: ["write", [_filePath, _appendToExisting, _contents]] extFileIO_fnc_call and ... youre golden
_filePath is the string to your file
_appendToExisting is a boolean, determining wether you want to append to an existing file or the existing file shall be cleared prior
_contents is either a string or an array of scalar values
but as said
no CI, so you would need to build the library yourself
@queen cargo I've compiled the dll, as I am running the code from debug console (Since i would only like to dump the config), so I was looking for a solution to write the csv output from a config export script to a file
Is there a way to delete any unnamed (spawned) vehicles that are in a radius of a map marker or if they are present inside a trigger?
If anyone could point me in the right direction it would be a big help.
→
inArea, deleteVehicle, vehicles 🙂
Ty
guys does ppeffectcreate, adjust, enable, commit etc. persist through respawn?
ok nice so for MP, to make sure all players including JIP ones get the desired PPeffect for the entire mission, i should put the ppeffects code inside initPlayerLocal.sqf right?
yes
thanks lou 
Yeah I can’t figure out how to implement this.
what did you try?
if (“” inArea cp1) then {delete Vehicle _x};
Is there a way script something like:
IF 60% of WholeGroup IS DEAD;
THEN ORDER WholeGroup to MOVE to WAYPOINT;```
basically to automate retreat if AI casualties get too high
sure
whats the function to check for death?
alive (command)
thanks
Is there a way to delete a specific type of vehicle?
forEach vehicle; ?
no
my example was quite simplified
you will need to use the scripting wikipage to figure out the proper syntax
Even with the wiki page I still can’t figure it out...
Ok so I did some experimentation with AI targets knowledge and found that between singleplayer and multiplayer there is a grave difference...
In singleplayer AI shares target information with it's side after a couple seconds, but in multiplayer it never does.
Has anyone experienced this kind of issue?
I tested that with knowsAbout btw
mods involved?
knowsAbout has a local effect, btw
I think ASR AI yeah, but shouldn't inhibit such information flow should it
if the AI is calculated on the server, you would not know everything on your side
Ah okay
But the final effect is the same. I tested by setting up an unarmed enemy survivor and on a hill next to it a IFV.
Locally, it shares the info after like 20 seconds when I step infront of the unarmed men, leading to the IFV to engage.
On the server however, nothing such happens.
Same mods on both
same difficulty? Same skill levels?
in groups?
thaaat's the thing
vanilla AI does not share info between groups (except for vehicle sensors)
so the mod fails (maybe because the server does not run the mod or it just isn't MP-compatible)
No it isn't - after the unit knowsAbout a target for some seconds it shares it with it's side, so east knowsAbout <player> is set to > 0 too, then the IFV knowsAbout also raises.
so yeah, that's ASR AI at work here
Okay I see
pure vanilla test is always recommended when checking if there is a problem
I don't have control over the server unfortunately
you might see different behavior in your SP test too without ASR
running client-side mods on the server, the server won't run the mod 🤷♂️
https://community.bistudio.com/wiki/Side_relations
how can I use setFriend to make civilian enemies with other civilians?
I also found that page
civilian setFriend [civilian, 0]
and if that doesn't work, use addRating
wait
@winter rose @young current Yeah server settings of ASR AI were the culprit thanks
the page already explains what it does
oh
i see
any value smaller than 0.6 makes them enemies
got it
and does that go in init.sqf or serverInit.sqf?
i dont really know the difference between the sqf files yet, is there a wiki page I can read about those?
ok
thanks
Need some support- so I'm looking to make a whitelisted arsenal, for which I know I'd usually use the scripts listed on https://community.bistudio.com/wiki/Arma_3:_Arsenal#Modding, however I want the whitelisted arsenal to be able to be opened via a holdAction and I'm having trouble getting the object set up
Anyone able to advise?
I'm able to get it worked by setting "true" for the BIS_fnc_addVirtualItemCargo functions, but I don't know how to open a whitelisted arsenal from an existing virtual inventory via script
Think it may have something to do with JIP? But I'm fairly lost
Or a better way of putting it: Anyone know how to open the Virtual Arsenal (not just create an ammocrate object) with a specific whitelist of classnames?
BIKI only shows how to open it with either nothing or everything, unless I'm missing something
you can add custom items to an arsenal with the following:
// init arsenal, empty, with addAction
["AmmoboxInit", [_container, false, true]] spawn BIS_fnc_arsenal;
// add custom items to container, globally
[_container, ["arifle_MX_F", "arifle_MX_SW_F", "arifle_MXC_F"], true, false] call BIS_fnc_addVirtualWeaponCargo;
[_container, [], true, false] call BIS_fnc_addVirtualMagazineCargo;
[_container, [], true, false] call BIS_fnc_addVirtualBackpackCargo;
[_container, [], true, false] call BIS_fnc_addVirtualItemCargo;
However you can not use holdAction with a limited arsenal (afaik).
PS. above code has NOT been tested, so may need changes
However you can not use holdAction with a limited arsenal (afaik).
Ahhh, damn
BIS_fnc_arsenal will automatically add an addAction to it.
Yeah, we were just hoping to have a holdaction for a specific thing with our armory
Vs. the normal addAction
You could try ["Open", false] call BIS_fnc_arsenal in a holdAction, and change the 3rd param of "AmmoboxInit" to false
never tried it though... I only use ACE Arsenal
Yeah, sadly we've tried but it doesn't want to cooperate, it just has it so that only player items are available in the arsenal
We'll try it again with this though
Yeah, tried that, sadly didn't work
And where should I put the above script?
OHH I GOT IT
Just need to add it to missionnamespace instead of an actual physicalized object
Sweeeeet
Got it working, thanks anyhow!
I'm trying to call a function through the arsenalClosed scripted event handler. The event handler itself doesn't seem to call the function fn_createCam but when I local execute the function after the arsenal is closed manually, it works fine.
arsenalClosed_ScreenTime = [missionNamespace, "arsenalClosed", {
call fn_createCam;
hint str "closed";
}] call BIS_fnc_addScriptedEventHandler;
``````sqf
fn_createCam = {
/* create camera and stream to render surface */
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
/* attach cam to gunner cam position */
screentime_cam attachTo [uav, [0,0,0], "PiP0_pos"];
/* make it zoom in a little */
screentime_cam camSetFov 0.1;
/* switch cam to NVG */
"uavrtt" setPiPEffect [2];
/* adjust cam orientation */
Draw3D_ScreenTime = addMissionEventHandler ["Draw3D", {
_dir = (uav selectionPosition "laserstart") vectorFromTo (uav selectionPosition "commanderview");
screentime_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]];
}];
tv setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
};```
Just trying to get a simple stress meter working but I can't seem to get it to register. hint value just says 0 still when firing. any advice on what I might be screwing up.
_stress = 0;
player addEventHandler
["firedNear",
{
_unit = _this select 0;
if ((_unit getVariable ["_stress", 0]) < 100) then
{
_unit setVariable ["_stress", (_unit getVariable ["_stress", 0]) + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["_stress", 100];
}
];
while {true} do {
hint ("Stress = " + (str _stress));
sleep 0.2;
};
because it's always 0
_stress = 0
and you never change it
I don't see a point in assigning _stress and using "_stress" as a variable?
player addEventHandler
["firedNear",
{
_unit = _this select 0;
if ((_unit getVariable ["stress", 0]) < 100) then
{
_unit setVariable ["stress", (_unit getVariable ["stress", 0]) + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 100];
}
];
while {true} do {
hint ("Stress = " + (player getVariable ["stress", 0]));
sleep 0.2;
};
you do realize that you're adding hundreds of draw3D ehs with that right?
@little raptor removeMissionEventHandler ["Draw3D", Draw3D_ScreenTime];`` runs in another event before the camera is created again
and my scripted event handlers are removed on object death as well
idk why, would it still be string instead of player getvariable ```21:08:40 Error in expression <;
while {true} do {
hint ("Stress = " + (player getVariable ["stress", 0]));
s>
21:08:40 Error position: <+ (player getVariable ["stress", 0]));
s>
21:08:40 Error Generic error in expression```
missing str
oh yeah, sorry
I'm used to using hint format
hint format ["Stress = %1", player getVariable ["stress", 0]]
YES. thanks man. Running on 4 hrs of sleep
@little raptor do you think the issue has something to do about time scheduling? (called too soon?)
its executed in an sqf via execVM through the UAV's init, and it is called at the start of the mission successfully
and I'm local executing (successfully) like this:
fn_createCam = {
/* create camera and stream to render surface */
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
/* attach cam to gunner cam position */
screentime_cam attachTo [uav, [0,0,0], "PiP0_pos"];
/* make it zoom in a little */
screentime_cam camSetFov 0.1;
/* switch cam to NVG */
"uavrtt" setPiPEffect [2];
/* adjust cam orientation */
Draw3D_ScreenTime = addMissionEventHandler ["Draw3D", {
_dir = (uav selectionPosition "laserstart") vectorFromTo (uav selectionPosition "commanderview");
screentime_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]];
}];
tv setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
};
screen_texture = (getObjectTextures tv) select 0;
call fn_createCam;```
its verbatim copy/paste from the sqf
so I'm really not sure what the issue could be at this point
that's the wrong way to check. did you actually check if the variable exists?
do you do this in MP or SP?
trying to get this thing to subtract and not entirely sure what I need to do
lowerstress = -0.10;
player addEventHandler
["firedNear",
{
_unit = _this select 0;
if ((_unit getVariable ["stress", 0]) < 60) then
{
_unit setVariable ["stress", (_unit getVariable ["stress", 0]) + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
while {true} do {
//If (stress <= maxstress) then
If ("stress" > 0) then
{
"stress" + "lowerstress" = "stress"
};
hint format ["Stress = %1", player getVariable ["stress", 0]];
sleep 0.2;
};```
@void rover I just tried hint str fn_createCam; in both locations and it worked each time. Testing in eden editor
If ("stress" > 0) then
{
"stress" + "lowerstress" = "stress"
};
``` isn't this a proof of concept or?
at this point I guess proof of concept
There isn't really a point in defininglowerstress
In your while true block (should be while alive player)
if (player getVariable ["stress", 0] > 0) then {
player setVariable ["stress", player getVariable ["stress", 0] - 0.10]; //lower stress over time
};```
and then I would make a respawned event handler to reset the stress variable back to 0
does _vehicle unit work on a corpse in the killed event handler?
some string missing?
};
hint format ["Stress = %1">
21:59:04 Error position: <- 0.10];
};
hint format ["Stress = %1">
21:59:04 Error Generic error in expression
I'm not sure
but I put some more code together
//Max stress is 60
//stress is set to 60 (max) when shot
//stress is increased by 1 when another unit fires nearby
//stress should reset on player respawn
player addEventHandler
["firedNear",
{
_unit = _this select 0;
_stress = _unit getVariable ["stress", 0];
if (_stress < 60) then
{
_unit setVariable ["stress", _stress + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
while {alive player} do {
_stress = _unit getVariable ["stress", 0];
if (_stress > 0) then {
player setVariable ["stress", _stress - 0.10]; //lower stress each second
};
hint format ["Stress = %1", _stress];
sleep 1;
};
still error?
while {alive player} do {
_stress = _unit getVariable ["stress", 0];
if (_st>
22:05:39 Error position: <_unit getVariable ["stress", 0];
if (_st>```
is that the entire error?
oh sorry
that _unit needs to be player
//Max stress is 60
//stress is set to 60 (max) when shot
//stress is increased by 1 when another unit fires nearby
//stress should reset on player respawn
player addEventHandler
["firedNear",
{
_unit = _this select 0;
_stress = _unit getVariable ["stress", 0];
if (_stress < 60) then
{
_unit setVariable ["stress", _stress + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
while {alive player} do {
_stress = player getVariable ["stress", 0];
if (_stress > 0) then {
player setVariable ["stress", _stress - 0.10]; //lower stress each second
};
hint format ["Stress = %1", _stress];
sleep 1;
};
Crap i should of saw that
I wish my problematic code gave me errors
that works now
instead it just doesn't work
thanks man. I think I am able to get the rest of this thing working now
yea I need to set it so it doesn't give an overflow error when it goes down. Apparently I need to set it so it don't go below zero
that's what if (_stress > 0) then { should be preventing
actually you have to do some math there
that if statement has to expect the reduction
it was supposed to -0.10 a second
if ((_stress - 0.10) > 0) then otherwise it WILL go below 0 at some point
sorry wait -0.10 every 0.2 seconds
i figured that loop would be unnecessarily tasking but adjust it as you need
actually wait that works. Thanks for ur time man
If anyone has a chance to look over my code and find the issue, send me a DM, I may forget to check back tomorrow
don't forget to write that respawned event handler
Rewriting a script that had worse optimization. old habits
more like a bandaided script
I'm gonna heard to bed, good luck with the rest of your script
Thanks, thanks for the help
Excuse me there good sir
How does one use the scripting tool to spawn the VR Entity suits
U_O_Soldier_VR < those
another quick question, I saw nvgs that had same capabilities as viper helmet although they had default model, are those seperate items or normal NVGs that got fucked around with a bit
- Language please
- Define capabilities you mean
How do I reference a specific location/city? I know nearestLocation exists, but what if I just wanna point to like the village of "Koroni" on Altis halfway across the map, not close to anything?
It had both thermal and night vis full screen same as viper, and hid head from thermal, But looked the same as the normal NVGs, and fit in the NVG slot
That's something on #arma3_config not scripts
oh
Then, what's the question though? You saw an ENVG-II NVG but... what?
if you get those the same way
It's available in-game without do anything
Via Debug Console or sqf files or whatever -> https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Alright thanks
well r.i.p dev console doesnt actually do anything with it
apparently I gotta do some wack stuff and put it in a folder somewhere
it was a good run
nearestLocation [getArray (configFile >> "CfgWorlds" >> worldName >> "Names" >> "Agia_Marina" >> "position"),""];```This will return Agia Marina in Stratis if the mission is running on Stratis. Change the part `"Agia_Marina"` so you can do anything with it?
Thanks, I try it out!
Good day, i'm trying to get a npc to speak to the specific player that entered the trigger, in a trigger chat. And need a little help
C1 sideChat "It's great to see you again "insert player entering the trigger". Now what can I do for you?"
Don't use " inside a "
player forceAddUniform "U_O_Soldier_VR"```
Yeah, it was just to mark where is was thinking the player was going to be named, my mistake to show it of that way
Oo thx
Ah I got what you mean. You want to replace it dynamically?
yeah
format, thisList#0 maybe?
so if you and me are in a mission, it names whoever goes in the trigger first
C1 sideChat format ["It's great to see you again %1. Now what can I do for you?",name (thisList#0)]```
Its gives a generic error
How?
It says "error generic error in expression" when I enter the trigger
I tested on player so it's player but besides that it's working properly here
Got it to work on player, but not when I want a npc to say it
Im probbaly doing something wrong there then
It was me messing up the variable, thx for the help
How to get the array of sound names for the CFG sounds?
getArray?
Does not work, it does not return names.
configClasses
_sounds = [];
_array = "true" configClasses (configFile >> "CfgSounds");
{_sounds append [configName _x]} forEach _array;
_sounds
it worked
but is very slow
apply
_sounds = ("true" configClasses (configFile >> "CfgSounds")) apply {configName _x};
A still slow but faster
thanks
config reading is slow
If you're doing it multiple times cache it into global var.
it will be faster on #perf_prof_branch 👀
hey guys, I understand that when you have a continuous loop going, it doesn't continue on down the page. Is there a way to get a return value for stress for me to pass along? ```sqf
while {alive player} do {
_stress = player getVariable ["stress", 0];
if ((_stress - 0.10) > 0) then{
player setVariable ["stress", _stress - 0.10]; //lower stress each second
};
//hint format ["Stress = %1", _stress];
sleep 0.2;
};
want to pass this on to a switch command in a different script.
end your script with _stress 😉
wait, to a different script? use a global var
while {alive player} do {
_stress = player getVariable ["stress", 0];
if ((_stress - 0.10) > 0) then{
player setVariable ["stress", _stress - 0.10]; //lower stress each second
};
//hint format ["Stress = %1", _stress];
sleep 0.2;
_stress
};```
↑
u mean set something like
_Stress = value
no, TAG_myGlobalVar = _stress;
Am i understanding u correctly?
Parameters.sqf
--
//preprocessFileLineNumbers
_stressCheck = compileFinal preprocessFileLineNumbers "test.sqf";
//Stress
ADT_Stress = _stress;
//Is it day? (other tracks at night)
isDay = 1;
Call _stresscheck;
While {true} do{
hint format ["Stress = %1", _stress];
sleep 0.2;
};
--
test.sqf
--
player addEventHandler
["firedNear",
{
_unit = _this select 0;
_stress = _unit getVariable ["stress", 0];
if (_stress < 60) then
{
_unit setVariable ["stress", _stress + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
while {alive player} do {
_stress = player getVariable ["stress", 0];
if ((_stress - 0.10) > 0) then{
player setVariable ["stress", _stress - 0.10]; //lower stress each second
};
sleep 0.2;
};
--```
but then that is just undefined _stress?
that's one WOT
I don't know what I am looking at, but let's simplify the question:
// script1
private _stress1 = 0;
// ...
_stress1 = 0.5;
My_Global_Var = _stress1;
``````sqf
// script2
waitUntil { sleep 1; not isNil "My_Global_Var"; };
private _stress2 = My_Global_Var;
while {alive player} do {
_stress = player getVariable ["stress", 0];
if (_stress > 0) then{
player setVariable ["stress", (_stress - 0.10) max 0]; //lower stress each second
};
//hint format ["Stress = %1", _stress];
sleep 0.2;
};
- Stress is a variable in player's namespace. So you can always access it anywhere
//lower stress each second
...
sleep 0.2
old habbits
It was because this is running on a continous loop and it will not allow me to execute any further commands back on either Init or further calls on the previous sqf
spawn
?
I would use unit setVariable ["CHEIF_stress", 1];
always put tags in your "global" variables
but the only thing is, If i use spawn, it would just rerun it over and over again?
um, wat?
spawn creates a new "thread"
so you can "detach" a code execution from the current one
Parameters.sqf
--
//preprocessFileLineNumbers
_stressCheck = compileFinal preprocessFileLineNumbers "test.sqf";
//Stress
ADT_Stress = _stress;
//Is it day? (other tracks at night)
isDay = 1;
Call _stresscheck;
While {true} do{
hint format ["Stress = %1", _stress];
sleep 0.2;
};
--
test.sqf
--
player addEventHandler
["firedNear",
{
_unit = _this select 0;
_stress = _unit getVariable ["stress", 0];
if (_stress < 60) then
{
_unit setVariable ["stress", _stress + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
[] spawn {
while {alive player} do {
_stress = player getVariable ["stress", 0];
if (_stress > 0) then{
player setVariable ["stress", (_stress - 0.10) max 0]; //lower stress each second
};
//hint format ["Stress = %1", _stress];
sleep 0.2;
};
};
//do other stuff here
If i wanted a return value ```sqf
test.sqf
player addEventHandler
["firedNear",
{
_unit = _this select 0;
_stress = _unit getVariable ["stress", 0];
if (_stress < 60) then
{
_unit setVariable ["stress", _stress + 1];
};
}
];
player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
[] spawn {
while {alive player} do {
_stress = player getVariable ["stress", 0];
if (_stress > 0) then{
player setVariable ["stress", (_stress - 0.10) max 0]; //lower stress each second
};
//hint format ["Stress = %1", _stress];
sleep 0.2;
};
};
_stress
- _stress is not even defined
- why do you need a return value?
this code simply adds event handlers
you can't get return values from it
(at least not what you have in mind)
I'm pretty sure you don't understand the concept of event handlers and threads
these codes are being executed "somewhere else"
need a return value or some sort of variable that gets passed to a switch that reacts to whether _stress is over a certain threshold
well then you have to define that switch in the event handler code (that's the only place where your "stress" goes up)
trying not to make the same mistake of having 100 if then statements
define that switch in the event handler code
preferably in a new function
because event handlers have a bug
they always recompile their code (it's stored as a string)
well at this point I am just trying to get this to allow the stress value get to the actual controller that will actually define what is going on
I already told you how to do it
in case you still don't get it, this is how the EH code will be:
- get the stress value
- increase it
- pass the value to the switch
if you need the value in a loop (e.g for suppression effects), you can use the "cooldown" loop (what I defined in the spawn) instead
Can some kind soul point me to the script in Arma 3 PBO files that handles the nametags that appear over every unit when in DEV spectator mode?
expectator?!
I assume Spectator*
what's the difference between dev and stable spectators?
@wind hedge ↑
I'm assuming they're all implemented in the same PBO that contains the spectator functions (e.g BIS_fnc_EGSpectator)
you can find that function in function viewer
then use its path to find the PBO
Ok got it 😉
I figured it out and made a switch.
trying to make sure the _mode gets detected but says it is missing a ). when I // all the If (_mode = "truce) then or combat statements, error goes away. when I do the hints in the switch loop it detects the right values for stress.
16:42:36 Error in expression < {
while {alive player} do
{
if (_mode = "truce") then
{
Hint format ["no"];
};>
16:42:36 Error position: <= "truce") then
{
Hint format ["no"];
};>
16:42:36 Error Missing )
_mode = " "
while {alive player} do
{
_stress = player getVariable ["stress", 0];
//define combat mode
Switch true do
{
case (_stress <= 50):
{
_mode = "truce";
};
case (_stress > 50):
{
_mode = "combat";
};
};
};
sleep 1;
};
[] spawn
{
while {alive player} do
{
if (_mode = "truce") then
{
Hint format ["no"];
};
if (_mode = "combat") then
{
Hint format ["yes"];
};
Sleep 1.0;
};
};
if (_mode == "truce")
really
the command isEqualTo also works like == but is slightly faster.
also why do you use two loops?
one loop was enough
it's case sensitive
and not much faster (if anything, it's the same)
it was a test to make sure variables were passing
= is for variable assignment (returns nothing)
== is for comparison (returns bool)
how is the programming language supposed to understand what you mean then?
_a = _b
_a == _b
do you mean to compare them? or store one into the other?
I guess my background on this particular subject is quite limited. I don't have a response
id say compare
can someone please explain this error
(I have s screenshot of the error, just can't put it up here)
_unit = _this select o;
error select: type object, expected array,string,config entry
pastebin of the complete code
https://pastebin.com/bgcmArhA
you're passing an object to your code
for example:
player call {
_unit = _this select 0; //Error: _this is an object (player)
}
(a reason among others to use params)
params still cannot fix this
it can
it expects array
player spawn {
params ["_unit"]; // works
};
not call
player call {
params ["_unit"]; // does it work?
_this params ["_unit"]; // does it work?
};```
why shouldn't it?
if it works with spawn, it also works with call (what matters is what you pass to it)
can confirm, params takes array or single value
which is sometimes a pain to debug, when you should pass an array and provide _array params instead of [_array] params
yeah, I'd say it was a bad call
ok so
1: i wrote this with very basic understanding of scripting
2: the above script (pastebin link) has worked perfectly before on both ai and player
3: code snippet of what i am trying to do
// dead driver setup
removeBackpack _driver;
removeVest _driver;
[_driver] execVM "scripts\rvg_frith_eos_random.sqf";
[_driver] call RVG_fnc_AddLoot;
_driver moveindriver _veh; // move driver to driver seat of above spawned vehicle
_driver action ["Eject", vehicle _driver]; // eject driver from driving seat (... its a placement thing)
sleep 0.2;
_driver setdamage 1; // kill driver
4: last run of the code worked for the above code snippet but did not work for the player later in the script
player execVM "scripts\rvg_frith_eos_random.sqf";
player moveincargo [_veh, 2]; // seat pos 2 for player
you can already see the problem then
player execVM "scripts\rvg_frith_eos_random.sqf";
but anyway, you can use params instead of fixing that
as we discussed
I'm trying to use these two events to call functons for my camera script, but there's a long delay with the open event for some reason
arsenalOpened_ScreenTime = [missionNamespace, "arsenalOpened", {
call fn_destroyCam;
}] call BIS_fnc_addScriptedEventHandler;
arsenalClosed_ScreenTime = [missionNamespace, "arsenalClosed", {
call fn_createCam;
}] call BIS_fnc_addScriptedEventHandler;
so its possible for the closed event to fire before the opened event
Did you try it in a perfectly clean mission? You've probably spawned way too many scheduled scripts and the scheduler is busy
Also, what's the question again?
@little raptor I actually did get an undefined variable in expression error for fn_destroyCam during one of my last tests
you asked me to check that variable last night
I'm looking for a faster way to call fn_destroyCam on arsenal init, and have the camera be created properly when the aresenal closes. At this time it does not get recreated properly
unless I call fn_createCam manually
I haven't tested it in a perfectly clean mission
@little raptor just tried it with a blank mission, same issue
Arsenal requires a big delay in the first launch in the mission, is that you mean?
I mean the event doesn't trigger when the interface is open right away
I decided to call execVM "screentime.sqf"; in initplayerlocal.sqf instead of the uav's init box
The script has too many characters to include here so here's screentime.sqf: https://pastebin.com/1yN5Xcfd
fn_destroyCam is an undefined variable in ScriptedEventHandler_arsenalOpened = [missionNamespace, "arsenalOpened", {call fn_destroyCam}] call BIS_fnc_addScriptedEventHandler; This error appears to only happen once. At which point I'm no sure.
23:10:18 Error position: <fn_destroyCam}] call BIS_fnc_addScripted>
23:10:18 Error Undefined variable in expression: fn_destroycam
23:10:18 File C:\Users\eagle\Documents\Arma 3 - Other Profiles\J%2e%20Hachey\missions\uavscreentest.VR\screentime.sqf..., line 36```
I tried just putting the content of the function there instead but the general issue (camera not being recreated) still occurs
that's not "calling". that's "spawning"
since your script doesn't contain any scheduled code, use call (call compile preprocessFileLineNumbers "file.sqf").
also, if you use that frequently, define it as a function.
I have a heal trigger that is meant to heal everybody in the trigger area (with ace fullHeal) once every 5 seconds. Unfortunately it is healing everybody on the map. Do I just need to replace player with (thisList select 0) in the activation field?
_Condition_
this and ((getPos (thisList select 0)) select 2 < 1);
_Activiation_
_handle= [] spawn {
_sleep = 5;
_trigger = healZone;
waitUntil {
player setDamage 0;
player setFuel 1;
[player, player] call ace_medical_treatment_fnc_fullHeal;
sleep _sleep;
not ((getPos player) inArea _trigger);
};
};
I'm using the civilian presence module on which any civilian that spawns will have a hold-down-button-action which gives you a reply after you question him. Everything works fine when I test it on my client through the 3Den Editor. However, when I'm on dedicated server the functions disableAi, enableAI and lookAT won't trigger at all, and the say3Dis just local to the plt_interpreter.
[_this,
"Interrogate civilian",
"\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa",
"\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa",
"_this == plt_interpreter && _this distance _target < 4 && (alive _target) && !(_target getVariable ['ACE_isUnconscious', false]);",
"_caller distance _target < 4",
{
_target disableAI "PATH";
_target lookAt _caller;
_question = selectRandom [1,2,3];
switch (_question) do {
case 1: {hint parseText "<t size='1.5'>Question 1</t>"; };
case 2: {hint parseText "<t size='1.5'>Question 2</t>";};
case 3: {hint parseText "<t size='1.5'>Question 3</t>";};};
},
{
_target disableAI "PATH";
_target lookAt _caller;
},
{
_target enableAI "PATH";
_target say3D "sound";
_reply = selectRandom [1,2,3,];
switch (_reply) do {
case 1: {hint parseText format ["<t size='1.5'>%1: Reply 1!</t>", name _target];};
case 2: {hint parseText format ["<t size='1.5'>%1: Reply 2</t>", name _target];};
case 3: {hint parseText format ["<t size='1.5'>%1: Reply 5</t>", name _target];};};
},
{
_target enableAI "PATH";
},
[],
10,
0,
true,
false
] remoteExecCall ["BIS_fnc_holdActionAdd", plt_interpreter, true];
So I'm thinking that I need to remoteExecCall the aforementioned functions for them to work on a dedicated server. Any idea on how to properly remoteExecCall these functions? Thanks in advance for the help!
Good day. I am new to coding and Arma 3 modding. I have created a faction using the Alive Orbat Tool. Now I'm digging into autogen.hpp and the files to implement a code for random face wear randomisation in every unit of my faction. I have already defined which facewear ["xxxx,","xxxx"] they are able to randomly wear and so on. I only need guidance to what and where to write the randomisation code. I would be really thankful If someone could help me. Cheers!
I am about to write some rearm mod for heavy weapons like artillerys and alike. If manned with AI units, and those units are in a player squad, the player should be able to command them to rearm those vehicles.
I thought of adding a getIn event handler to all those vehicles.
Now, there are plenty of vehicles without weapons, like trucks etc.
Is there a smart way to add the event handler only to vehicles with a weapon? Or do I have to manualy add their names one by one?
you can check from their config if their weapons are something different than "horn something"
@winter rose Hm, will give it a try. Thank you.
I've got a solution for this, so help is no longer needed. Thanks anyway!
anyone mind? Cheers
Use https://community.bistudio.com/wiki/selectRandom and it will choose one of the items in the array. Doesn't need to be any more complicated than that
As I said I have read it but It doesn't tell me which section and which hpp. to put the line of code in. Hope you understand.
Is there also a function to apply this to all units or do I need to do it invidually?
Ah I don't know about what the alive orbit tool produces, can't help with that. Ultimately it needs calling on unit initialisation
would it be too much for you to do if I upload the file and take a look lol
guys any one know script to open arsenal/ace arsenal based on items in container , I mean that the arsenal available items will be limited based on container content and their counts , and also by removing items from the the arsenal it should be moved to the container
@little raptor I thought spawning was when you execute a code block or a function in a scheduled environment?
And calling was when you execute a code block or a function in unscheduled
Is a code block defined as a variable never a function if it isn't compiled? Is it the compiling that makes it a function?
compile takes a string
so```sqf
private _str = "hint 'OK';";
private _code = compile _str; // returns { hint 'OK'; }
//
private _code = { hint "OK" };
// the above is a callable "function", just not defined in CfgFunctions
how to append two object arrays? I want to combine the results of multiple nearestObjects together into one array so I can forEach it. Do I just do it as
_results = nearestObjects[ stuff ]; _tempresults = nearestObjects[ more stuff but different params ]; _results append _tempresults; _tempresults = nearestObjects [ even more stuff but different params ]; _results append _tempresults; { processing stuff } forEach _results;
yes, append is the thing
Thanks, the examples just show single bracketed values being added, wasn't sure if it worked with objects. Getting there slowly.. 🙂
sure - don't hesitate to ask here if something is unclear to you
execVM is scheduled
Oh yeah, you right
I think I'll just try defining destriyCam and createCam in cfgFunctions. But it's strange that only fn_destroyCam isn't recognized
post your code again
iirc it should've been
Hey guys, not sure if this is the correct channel to ask for help with a script ?Forgive me if its not
yes it is
Thanks @little raptor
Im looking for a script that once a player joins the mission the screen stays black for 10secs till a sound file have done playing.
Would titlecut work for that ?
Hey guys, this may not be entirely script related but i feel as if this still is the right channel to ask. I am looking for a list of objects that emit sound by default (Such as the wind turbine) Would anyone know where to find such a list?
yes, for example:
_layerName = "myLayerName" call BIS_fnc_rscLayer;
_layerName cutText ["text", "BLACK"];
sleep 10;
_layerName cutFadeOut 1;
if it's a mission, you can put that in initPlayerLocal.sqf
Legend! thank you so much @little raptor appreciate your help 😀
@little raptor I haven't updated the code yet. Using the script in a clean mission resolved the ArdenalOpen event being delayed though
Well, as I told you, you're spawning too many scripts and the scheduler can't keep up.
Especially if you use indefinite while loops without sleep.
That's no longer the case
I'm strictly using event handlers, no while loops.
Aldo I'd like to note, that as far as I am aware, just because an eventhandler inside an sqf is executed via execVM,doesn't mean that the code in the event handler is spawned.
[] execVM "file.sqf" = [] spawn compile preprocessFileLineNumbers "file.sqf"
Never spawn code inside event handlers (unless you have a good reason to do so)
Is the code inside event handlers scheduled by default?
huh, why not?
no, its the opposite. Eventhandlers are unscheduled
unless you have a good reason to do so

Well that's true for spawning any code
I would say, if you don't know code, always spawn
that way you cannot cause bad lag spikes in your eventhandling
meh
Anyways, I'm fairly certain that code in an event handler is unscheduled by default regardless if you include it in an execVM executed sqf, and thus not spawned like you said.
execVM is spawn
execVM'ed code is spawned and thus scheduled
engine eventhandler code is always unscheduled
So if I put an event handler in an sqf that's ran with exexVM, the content of the event handler is scheduled?
"just because an eventhandler inside an sqf is executed via execVM, that the code in the event handler is spawned."
no. The eventhandler code doesn't know how it was added
execVM/spawn creates a new "thread"
in other words, it executes "somewhere else"
it doesn't know if the eventhandler was added in scheduled or unscheduled code.
Lets repeat what I said
"engine eventhandler code is always unscheduled"
That's what I've been trying to say.
if you execVM code, the execVM'ed code is ran scheduled
if you use execVM inside a eventhandler, the execVM'ed code is still scheduled
"if you use execVM inside a eventhandler, the execVM'ed code is still scheduled" okay I see the confusion now
I was referring to earlier when I noted that I was calling code ("call fn_destroyCam") in my event handler, and was told that it was actually being spawned
because you execVMed
so you were spawning the code
...AddEventHandler [..., { //<- this code is unscheduled
[] execVM "..." //<- but what this executes is scheduled
}]
I was only ever referring to the event handler.
I understand that the content of my sqf is scheduled because its executed with ezecVM. Let's please move on to the content of the eventhandlers
I don't want to waste anyone's time and patience talking in circles
There's the code again
The main scope is scheduled
When I get home I'm going to include those two "functions" in a cfgFunctions to make them actually compiled functions
your functions are also "compiled" 😄
A "compiled" function is a variable that contains type CODE.
Which is what CfgFunctions does for you, or what you already have there
MissionEventHandler_Draw3D/screentime_cam
Its good practice to prefix global variables with your own unique prefix.
Like Hac_Draw3DHandler
so you cannot possible conflict with other mods or other peoples code
Leopard was right in what he was referring to. I misspoke when I said '''I decided to call execVM" I thought he was referring to the evenhandler I was having trouble with
We were talking about two different things, apologies for confusion.
I also said the opposite of what I meant to I n a previous reply which I have since edited
"Aldo I'd like to note, that as far as I am aware, just because an eventhandler inside an sqf is executed via execVM,doesn't mean that the code in the event handler is spawned."
Sorry work is stressful and I'm not thinking clearly
I'm also adjusting to new contact lenses and having difficulty reading my small phone screen
Is this channel appropriate for help with config.cpp?
Does anyone know where I would find the scripts for High Command? The modules have function = "";
Or is it engine driven?
hey hey, i booted up 2 game instances and joined local server, and i used setPosWorld on the client server, result is the object is moved immediately on the server instance, but around 10-15 seconds late on client server
any ways around this?
i tried all of the setpos commands not much diff, results just like above
do you still disable simulation?
no sim enabled
with sim disabled it takes around 50 seconds even

and i dont think its ping since its literally my own pc running 2 instances? lol
no lag either
try this (it's bad but let's just test it):
[object, pos] remoteExec ["setPosWorld"]
getting varying results with this... 5-10 seconds on client
server is always instant
should i make support ticket?
it's probably just your computer
since you're running two instances of the game, the result is probably not the same in actual MP
not sure if it's a bug (otherwise someone else might've reported it)
you can still try tho
i first found out about it when we were playing online actually
but it was with sim disabled on the object
i see
did you get answer for how long after simulation enabled does the network updates return to normal?
no, I didn't ask that
but if you have simply one object, it doesn't hurt to have sim enabled
i guess yes, but what if its a floating in the air object
also i tried using remoteexec hideobject and it synced instantly for client and server, so using 2 objects and hiding and showing each of them accordingly can be a workaround too
hideObject also has a global variant
ye but its triggered after an action from a client (via addaction)
better to remoteexec hideobject to everyone or remoteexec hideobjectGlobal to server?
hideObjectGlobal on Server
ok got it
well why did you delete the whole message?
I didn't mean to, having difficulties here lol
Let me try again, do you think its possible the issue has to do with using Draw3D for the mission event handler that sets the vector for the camera in fn_createCam? And that's what is conflicting with the arsenal display?
I don't know. I have to see the script
I was thinking of trying on each frame instead
I'm not at home so I can't change anything yet
To describe the problem, the render surface becomes black after opening the arsenal, and stays that way after closing it
did you even try what I said?
@agile pumice
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["Terminate", "Back", "uavrtt"];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
that's how you "recreate" the effect
ok i was testing the setpos thingy again and uncovered a dark truth
so apparently the sync problem was tied to a certain kind of object
at first i was using object "shoot house panels" (vanilla) for the setPosWorld, result is delayed 5-10 secs, longer if disabled sim
just now i used a ammo box for the setposworld, result = instant sync between client and server, even with disabled sim!
i ran this code
box setPosWorld [5268.46,529.234,5.00144];
dor setPosWorld [5268.46,549.234,5.00144]
with box being ammo box and dor being the shoot house panels, confirmed the result was instant move for disabled sim box, and delayed for shoot house panels
@little raptor I did try it, had no effect
But as I said, without terminate Included, if I manually execute the createcam code, it works
Just not when the arsenalclosed eventhandler calls the code
What does the terminate effect do that deleting the cam doesn't?
I couldnt find an explanation on the wiki for what the effects actually do
terminate leaves the camera
Why would I want to do that right after creating it?
maybe it resets a camera state, idk
Q: what is the namespace for function params ["...", "...", "...", ...] in a function? i.e. I can test isNil "..." right, but is it localNamespace getVariable "...", for instance? seemingly not, though I wonder if/what it might be. or do I have to set one up?
its a local variable
you cannot access their "namespace"
their namespace is the current scope
scopeNamespace soon\™
ah I see. soon but not yet. meanwhile it's a bit ugly, but CBA_fnc_createNamespace and CMB_fnc_deleteNamespace...
scopeNamespace was just me kidding about it, it is not going (?) to be a thing (afaik)
hello,i have try to spawn fire and after get fire for delte but the problem is if i cursorObject... is return nil
_feu = "#particlesource" createVehicle (getPos player);
_feu setParticleClass "BigDestructionFire";
_name = "feu_" + (str (round (random 1000)));
_feu setVariable [_name, [50, 70], false];
_feu setVehicleVarName _name;
_pos = getpos _feu;
if (isnil "john_feu") then {john_feu = [];};
john_feu pushBack [_name, _pos];```
i have try to detect with postion player but the problem is for delete
CBA namespace is something very different to local variables
What do you need it for
see above ^^ that is my use case
The "namespace" of params is current scope, nothing more nothing less. It's simply extracting an array (by default _this) into private variables.
If you need to test if a variable exists after using params... you did something wrong
Well I fixed my problem
waitUntil {isnull (uinamespace getvariable "RSCDisplayArsenal")};
sleep 0.2;
needed to sleep before recreating the camera for some reason
@exotic flax I can promise you I did nothing wrong. and I have a case where I need to test elements in the params.
A lifer just DM'ed me for help with his script.
Here have a PSA for everyone on how to do key-value store and how not to do it.
This is inefficient
[["id",2023],["name","Jean Maurice"],["aliases",["Jean Maurice"]],["steam_id","_SP_PLAYER_"],["cash","5671475"],["bank","161716002"]]
you need to iterate over every array in script and check if the first value is what you want. And as I said, looping in engine is faster than looping in script.
basically doing
_cashIndex = _array findIf {_x select 0 == "cash"}; // loop in script
_cashValue = _array select _cashIndex select 1;
compare it with this
[["id","name","aliases","steam_id","cash","bank"], [2023,"Jean Maurice",["Jean Maurice"],"_SP_PLAYER_","5671475","161716002"]]
_cashIndex = (_array select 0) find "cash"; // loop in engine
_cashValue = (_array select 1) select _cashIndex;
Lets compare performance in debug console trying to get the cash value.
Your format:
_array = [["id",2023],["name","Jean Maurice"],["aliases",["Jean Maurice"]],["steam_id","_SP_PLAYER_"],["cash","5671475"],["bank","161716002"]];
_cashIndex = _array findIf {_x select 0 == "cash"};
_array select _cashIndex select 1;
Result: 0.0154 ms
My format:
_array = [["id","name","aliases","steam_id","cash","bank"], [2023,"Jean Maurice",["Jean Maurice"],"_SP_PLAYER_","5671475","161716002"]];
_cashIndex = (_array select 0) find "cash";
(_array select 1) select _cashIndex;
Result: 0.0068 ms
HashMap:
_hashMap = createHashMapFromArray [["id",2023],["name","Jean Maurice"],["aliases",["Jean Maurice"]],["steam_id","_SP_PLAYER_"],["cash","5671475"],["bank","161716002"]];
_hashMap get "cash";
Result: 0.0098 ms
But you are not usually creating the arrays, mostly reading them.
So if we compare the reading performance of the 3 variants with arrays that are already present
Your current array format:
_cashIndex = GVAR_array findIf {_x select 0 == "cash"};
GVAR_array select _cashIndex select 1;
Result: 0.0116 ms
My array format:
_cashIndex = (GVAR_array select 0) find "cash";
(GVAR_array select 1) select _cashIndex;
Result: 0.0038 ms
HashMap:
GVAR_hashMap get "cash";
Result: 0.0018 ms
If you want to check if parameters are given, it's good practice to set default values or even expected values.
This way they are always set, and all you have to do is check if they're not the default one.
so checking if params are nil? I don't see how CBA namespaces will help with that?
creating a cba namespace isn't really that cheap
hrm, well, yes, taking a step or two backwards from it, coming up with better default values is the better approach I think.
Null, ObjNull (or any of the *Null values), [], false, ""
good ways to ensure it's the correct type, but easy to check if usable
So, I don't know anything about scripting, but recently I found a script that fixed a problem that I had for a long time, it allows other squads to help squads of the same faction. The issue is that ALL units of the same faction react. I want to edit this to only have ONE squad that is the closest distance to react. Not sure how to do this. Sorry for the dumb question. Also here is the script in question:
{
_x addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
// https://forums.bohemia.net/forums/topic/192831-detection-script/?page=2&tab=comments#comment-3068816
_all = [];
_side = side _unit;
_groups = allGroups select{
side _x isEqualTo _side
&& alive leader _x
};
_groups apply {_all append units _x};
// copyToClipboard str _all;
{
If(!isPlayer _x)then{
If(isNull _x)exitWith{};
if(isNil {_x getVariable "Var_GF_doMove"})then{_x setVariable ["Var_GF_doMove",false];};
if(_x getVariable ["Var_GF_doMove",true])exitWith{};
_x setVariable ["Var_GF_doMove",true];
_x allowFleeing 0;
_x stop false;
_x doMove (position _unit);
};
}foreach _all;
}];
}forEach units group _group;```
if I understand the script correct the following happens now:
- you give a single group
- all members on that group will get a "FiredMan" EH (aka when that person shoots a weapon)
- when he does, it will find all groups of the same side
- for each other group it will check each unit if it's not a player
- each unit in the other group(s) will move to the person who fired a weapon
To only have 1 group react; get all the groups, and get the distance between the group leader and the person who fired the weapon
Yes, it originally printed a message each time a unit fired, but I removed that.
and only append the units of the closest group
Yeah, I'm not exactly sure how to do that though.
private _closest = gprNull;
private _closestDist = -1;
{
if (_closest == grpNull) then {
_closest = _x;
_closestDist = leader _x distance _unit;
} else {
if (_closestDist < (leader _x distance _unit)) then {
_closest = _x;
_closestDist = leader _x distance _unit;
};
};
} forEach _groups;
_all append units _closest;
``` something like this
Alright, that makes some sense. How would I single that down to maybe two squads or one squad though?
the above will only give you a single group
distance doesn't support groups
not? crap...
How do you add vehicle or deployable weapon ammo to a crate?
fixed by taking the distance to the leader 😉
You mean this doesn't work? https://community.bistudio.com/wiki/addMagazineCargoGlobal
No, that has no effect
what about this? https://community.bistudio.com/wiki/addItemCargoGlobal
oh wait you still want A2 variants?
A2OA
than addMagazineCargoGlobal should work if the magazines are available (and correct classnames used)
I tried this: _this addMagazineCargoGlobal ["100Rnd_127x99_M2", 100];
it had no effect and gave no errors
_this was an ammo crate
it works in A3
but not 100
just 1
It adds 100 mags
not 100 ammo
I can't get it to add any mags
It seems like there's just no way to bring extra ammo for vehicles or emplaced weapons
Is there any way of forcing a waypoint placed by zeus to be a guard waypoint?
Of course there is
could you pin this? 
How to get the player original voice from CFG? I need to do that because ACE just nukes the speaker.
Any chance that can get pinned?
no
why not?
maybe better in Code_Optimisation 😉 ?
the wiki page of course!!1!
Most people should know that stuff already :U
no u!
How do I find out the current number of rounds in a vehicle magazine, for the commander weapon. Commands like magazinesAmmoFull and magazinesAmmo only reveal the counts of the [0] turret. While driver or commander weapons are not covered.
Solved. The command magazinesAllTurrets did the trick.
can I use resources (sounds) from DLC in mission when others don't own it?
dumb question: so when I use sound from Apex DLC, will users without apex playing my mission hear it ?
jo
For vehicle turret weapons use addMagazineTurret
So I'm trying to give a hint to only the players getting into a specific area, read earlier that it could be done with initplayer, but was wondering if it could be done through Initfeild of a object. Getting a error on this, so if anyone have any pointers.
if (isServer) then
{
_trigger = createTrigger ["EmptyDetector", getPosWorld this, false];
_trigger setTriggerArea [12, 14, 0, true];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerStatements ["this", "hint format 'T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.",name player'", ""];
};
It only says Init: when I try to click OK.
And I'm to new to scripting to real pick to much out of it.
remove the single and double quotes right after name player and it should be fine
Also tried (thisList#0) in stead of name player, but that did not do much
Got to apply it to a object now, but the hint don't trigger
Your format is wrong too:
hint format 'T.Y.R. De...
since the trigger is local, it won't matter
but that's not the issue
So in my head according to https://community.bistudio.com/wiki/hint:
hint format ["T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.", name player]
That would with https://community.bistudio.com/wiki/setTriggerStatements give:
_trigger setTriggerStatements ["this", "hint format ["T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.", name player], ""];
But this is as far as i get, the last gives the Init: error
can't you tell that something is wrong simply by looking at the colors?!
it should be all green
(note, colors do not appear on mobile)
I can tell that something is wrong since it's not switching, but since I only work with code when I trying to make some missions in Arma. I don't have much experience to go with. This is the third line of code a make for it.
But will look closer at the hint with single quote 🙂
Got it to work, after tinkering with the single quote. Thanks for telling me that you could not use quotes in quotes.
if (isServer) then
{
_trigger = createTrigger ["EmptyDetector", getPosWorld this, false];
_trigger setTriggerArea [12, 14, 0, true];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerStatements ["this", "hint format ['T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.', name player]", ""];
};
technically you can, but you then have to double them
"this is "a" string" → wrong, "this is " is one string, " string" being another, a being an unexpected variable name
"this is ""a"" string" → correct
'this is "a" string' → correct
I only need the first and the 3. value of a bunch of nested arrays. I am currently solving this by:
private _currentLoadout = magazinesAllTurrets _unit;
{
_x deleteAt 1;
_x deleteAt 2;
_x deleteAt 2;
} forEach _currentLoadout;
there GOT to be a more elegant way?
🤦♂️ than you, Lou
or 'params' if you need them as variable
Hello,
I was wondering if there is a "clean" way to make some kind of OnChange listener on a RscEdit control.
So in my dialog, when i'm typing some text in this control, it would automatically update other controls within the same dialog ?
I could make a loop which check the current value each X ms but that doesn't seem very optimal.
Thanks
you can try the keyDown and char event handlers as well
hi confused, I'm dad!
can i get an example?
There are examples on the page
I have a question for you all. I am adding a "killed" eventhandler to a plane in a mission that calls a script to check if the player flying it ejected before it was destroyed. Is there a good way of checking if there is a corpse inside a wreck?
I tried:
if ((count (crew _vehicle)) == 0)
it doesn't seem to see the wreck as a vehicle any longer?
try maaaybe allDead select { _x in _vehicle } ?
!isNull driver _plane
to get all crew/corpses, you can try the fullCrew command (not sure if it works)
Thanks! That seems to have done the trick.
I'd love if someone here could help with this, but I'm making a mission with a respawning UGV for my players to use. The issue is that when respawning it via script or via module, it only respawns the empty UGV. I can put AI in it again, but they're not "UAV AI" from my understanding, so is there a better way of doing this or is there a way to just change that AI to UAV AI?
Another solution would be if someone could just tell me what the Hack UAV interaction uses, since I can always just call that to handle everything.
typeOf driver MyUGV;
after respawning, I use CreateVehicleCrew to put the AI into the drone, so both drivers are "O_UAV_AI".
The respawned vehicle won't accept commands or let the player manually drive it though.
Which I guess does change my initial post from "Making them UAV AI" to "Making them listen like a normal UAV AI"
https://community.bistudio.com/wiki/enableUAVConnectability
Might need a dose of this
Didn't seem to help. I tried disabling then enabling to see if toggling it would work, but nope.
A few more details though, I can connect to it, and I can operate the turret on it perfectly fine. It's the driver that doesn't seem to move. Engine stays off even after manually turning it on, can't manually drive it. But, the turret will move and fire, as well as return to the front facing position when exited. It seems like it's just the driver who isn't obeying commands.

https://community.bistudio.com/wiki/createVehicleCrew
This command does not addVehicle to the created crew in the same way this normally happens when crewed vehicle created in the editor.
That might have to do with it. Try something withaddVehicleand possibly withassignAsDriver/assignAsGunner. MaybeBIS_fnc_spawnVehicleworks better for UAVs.
BIS_fnc_spawnVehicle yeah?
I might just go back to BIS_fnc_spawnVehicle for this then. It was working great with it, but I was trying to fit it into my unit's respawn vehicle script.
I'll see if I can just make my own respawn script using the function instead.
Thanks for the help though.
minor trigger thing, how do i detect if the bluefor units are in a vehicle and only make the trigger fire if that condition is satisfied (bluefor units within a vehicle)
Set activation to BLUFOR present and add this Activation Condition:
this && ({vehicle _x == _x} count thisList) == 0
```Then the trigger should only fire when there is BLUFOR present and when all those BLUFOR units are also inside a vehicle.
Unless I messed up, that should be the case.
count counts all elements _x in thisList (which contains all units fulfilling the BLUFOR present condition) where vehicle _x == _x is true.
vehicle _x == _x should only be true when _x is not in a vehicle (could also use isNull objectParent _x, might be faster).
rog, do I need to change vehicle or something as it's not working lol
my close animation isn't either but that's bar gate shit which is an easy fix
Does it activate at all?
didnt think to check on foot, one moment
Ugh there's always something with these
this && ({systemChat str _x; vehicle _x == _x} count thisList) == 0
```Let's see what we see then 
Maybe the vehicle is part of thisList too
giving out vehicle_0 output, no trigger fire though
i.e animation on the bar gate is not playing
Well, vehicle _x == _x is true for the vehicle.
this && ({_x isKindOf "Man" && vehicle _x == _x} count thisList) == 0
So, i have been trying to add multiplayer compatible custom markers on the map ( Custom as in custom icons ) and i am having trouble finding on what's the best method to do this. Could anyone tell me what they know works in multiplayer and think is the best approach ?
hello, this code puts a dynamic text at the center of my screen (1080p) however, will it correctly display it at the center of screen on different resolutions ?
["<t font='PuristaBold' align='center' size='3'>Exocet</t><br /><t size='2' align='center'>Presents<\t>",safeZoneX + safeZoneW * 0.18, safeZoneY + safeZoneH * 0.4,6,0.2,0,739] spawn BIS_fnc_dynamicText;
that worked, thanks man
Pretty sure the only way to define custom markers is through modding.
That's not a scripting question, but #arma3_config
https://community.bistudio.com/wiki/CfgMarkers is what you need, and should work in missions as well
CfgMarkers is not listed on the description.ext page
Was afraid this was the case, was trying to avoid having to make it an addon but thanks for the answer.
Thats part of config.cpp
Just because it's not listed, doesn't mean it doesn't work 😉 The wiki is not holy (and even then it may contain mistakes)
There's a guy who made some documentation on doing that and he got it to work. Ill go and head over to config_makers ( No clue how that works, I've only been scripting till now ) but ill leave a tag if it works or not if you would like to
Yes please
Nope you are going from the left edge of the screen (safeZoneX) 18% of the screen width to the right (+ 0.18 * safeZoneW). Same applies to your vertical centering. You will have to set the middle of the screen as your origin. For this you'd need to know the width of the text control and go half of it to the left from the center and half the height to the top.


no more channels