#arma3_scripting
1 messages Β· Page 684 of 1
cool thx!
or do a for "_i" from expression
no
hey guys dumb question, is there a way to say "not in" for trigger conditions, I know ! is the not operator but would saying something like sqf player !in thislist work to check that the player is not in a trigger area?
becuase you want to spawn the vehicle and then find a new location
!(value in location)
oh i just realized hes changing the center each time
OH gotcha thanks
np
you've lost the plot, he wants to spawn everything around the same location without it all blowing up
still not good.
you must create the vehicle first before attempting to get a new position
what you wrote may always give the same position
Comments?
i just didnt write create vehicle stuff
Im pretty sure we are both saying the same thing
right I didn't see them
π
Anyone ever had a script cause a segfault?
and also, anyone ever had success debugging it? lol
or I guess the real question here is, has anyone used a limited arsenal script that actually works in multiplayer? The only one I've found makes my server segfault
which one did you use
there is a handful of ways still hanging around that will make the game crash if you pass it the right values
I guess it would also fire if the user tries to reload but actually has no spare mags too π€
Have you resolved this yet, may have a fix
Can someone tell me the difference between remoteExec and remoteExecCall? Is one "preferred "for MP? Can't get any smarter by reading the wiki.
I already told you in #general_chat_arma π
remoteExec = spawn (scheduled environment), remoteExecCall = call, (unscheduled environment)
Saw that, wanted to move it in the corresponding channel ^^
One more, at least for me, complicated question: How can I (in a MP scenario) get the player who called a trigger? There doesn't seem to be an easy "caller" function
thisList variable contains the units inside the trigger
Forgot that it doesn't have a range. Players can call trigger Alpha, Bravo (all rangeless) etc. via menu. Afterwards a crate spawns (short version) at the callers location
I think my 2 main problems are
getting the player who executed the "call" function
(("player" command itself does not work (that easy) on dedicated?))
player is the way to go; you can not activate a Radio Alpha trigger that is not on your machine.
Alternatively you can also use https://community.bistudio.com/wiki/Arma_3:_Communication_Menu
We will have multiple players around. Let's say 6-10. But the box should only be spawned for one player (the caller) and near the callers location
Triggers are strictly local. Every machine has its own local instance of a trigger.
Player A activating his Radio Alpha trigger has no influence on the Radio Alpha triggers of other players.
Likewise, if you have a server only Radio Alpha trigger, only the player on the server can see and activate that trigger.
Okay, so adding a trigger Alpha to every player, and player 1 activates it, the box should technically spawn at player 1's location?
Depends on what code you run on activation π€·ββοΈ
private _createChest = "B_supplyCrate_F" createVehicle (player getPos [10, getDir player]);
That's roughly the code. At least to create the chest
Running on MP it only gives me FPS drops but no box. Didn`t have time to double check with debugger mode yet
You mentioned
the box should only be spawned for one player (the caller)
so you should probably usecreateVehicleLocalinstead ofcreateVehicle.
Wouldn't that create the box only on the caller's machine?
Yes. That's what I assumed you meant by "the box should only be spawned for one player (the caller)" π
Sorry, then I was talking gibberish. The box should only spawn at one player's location, but globally for every player, so everyone has access to it.
remoteexec on server, give player loc as input param
also important: if you spawn a crate locally, a server-local heli bugs out trying to airlift it
he cant drop it
Then your code should be fine. The crate might just spawn somewhere else because the createVehicle syntax you're using treats the position argument like so:
position: Position - Desired placement position. If the exact position is occupied, nearest empty position is used.
Other than that I can't think of any reason why it shouldn't work right now.
Okay, thanks. As soon as I get out of work I'll drop it onto an airfield and try spawning the crate in debug mode again. Hopefully it works.
But one thing that's also suspicious: I added a hint to be executed at the end of the script. But I never saw that hint.
That's suspicious indeed 
Soo my guess is that I messed up some serverside lines, cause it's working properly in editor.
Will definetely check on that what you told me tho
as I said, didn't have time to properly debug yet. Will do that later on π
Hey, quick question
quick answer
Ha sick
So basically
I'm looking to get a console made in my mission on the server, that will basically launch another mission on the server when a holdaction is completed (condition is set to either is logged admin, or is 3den MP preview)
I'm doing this by using remoteExec with serverCommand
However, doesn't seem to be wanting to work
Do I need to change anything in mission CfgRemoteExec? Is servercommand restricted for remoteExec?
If serverCommand is executed on a client, it must be executed from UI context, such as onButtonDown or similar events (see User_Interface_Event_Handlers).
Yeah, just a big blue banner π
π
Is there any kind of workaround for it? Or do I just need to learn how to config a big red button to launch a mission?
And also, does that still apply if it's executed on server via remoteExec?
Hrm
And also, another question about remoteExec syntax
For commands like serverCommand's syntax 2 that have parameters before and after the actual command, such as password serverCommand command
no. you used all your questions for today, please come back in 23:58 π
What would proper syntax be for remoteExec?
Oh so it's for either side
Aaaaa sorry, too much coffee this morning
Reading comprehension skills are zero
Gotcha, thanks!
[left arg, right arg]
or
[right arg only]
or
[]
Ohhh okay
At a certain point it just increases heartrate and how fast you move you eyes lol
I once failed an exam bc i tried to study the night before it. Drank 3 cans of coffee and started having hallucinations
Hahaha
Been there before
It's the worst when you try to drink coffee thinking it'll help you focus
But then it's just jitters galore for 12 hours straight
Btw, anyone know if a bomb which i spawn automatically gets applied gravity?
Don't think so.
["passWord","#mission filename.chernarus"] remoteExec ["serverCommand",2] Would this be correct syntax?
I have a CAS script which spawns some on the ground bc i was to lazy for ballistics; but in theory i could just spawn it under the jet, give velocity of jet and then gravity will apply and make ballistic trajectory right?
yes
Hmmm, weird, it doesn't seem to be wanting to work
May look for a workaround with publicVariable and a server trigger
maybe it runs from mission namespace on the server
What do you mean?
nah nvm, got things mixed and was doing something else - please do not consider π¬
Oh oof no worries π
Going to retry the script on the server
Question, does it matter if the script is being executed from inside of a holdAction?
Shouldn't matter
Hmm okay
Okay, so basically
Script isn't wanting to execute
I changed the syntax to use call instead of serverCommand in the hopes it'd streamline it a bit
And I also added a little thing that would systemchat the output of serverCommandAvailable "#mission" via remoteexec
But it didn't output
And it didn't function as intended
So hrm
Does "password" serverCommand work if there's a logged admin?
Oh wait! Huh
So I'm in debug console right now, and for some reason
I'm executing servercommandavailable "#mission" on server via debug and it's returning false
I wonder why
Because you are not logged in as admin
I was logged in as admin to access debug console
And I'm executing this on the server, which is strange
Or well, server exec via debug console so idk
Argh, still can't get this to work
I tried a work around by having a trigger that would servercommand, which was triggered when a certain publicVariable was broadcast to true
But that still didn't do anything
It was set to server only as well
Any ideas...? Close to giving up on this for now
@digital vine I think I have, but what was your fix?
@willow hound this is how my trigger creation looks like (weirdly it did not show me Alpha radio on a dedicated today)
_createTriggerAlpha = createTrigger ["EmptyDetector", getPos player, true];
_createTriggerAlpha setTriggerActivation ["ALPHA", "PRESENT", true];
_createTriggerAlpha setTriggerStatements ["this", "execVM '_resupply\createChest.sqf'", ""];
Oh wait a dayum second, forgot the =
You should choose a more intuituve varname, not "createTriggerAlpha". Just a sidenote
_alphaTrigger could do π
Yep, but wasnt it like the first step is to make it functional? π
Well, after adding = it drops me a "missing ; on line 2 & 3" π€
Are you happy for a DM, as I don't want to block this channel?
sure, or put it on pastebin
Works fine here.
Just to make sure, you dropped that into init.sqf?
Question is, why even use triggers. You are scripting the whole stuff anyway. Might as well drop the triggers.
No why would I. Debug console
It's designed to be used by many people in my clan building missions. Easier implementation into their mission
Okay, even there it drops me the same error
In case you want the whole mission: https://drive.google.com/file/d/1tqo0ofVQ3Zhmb9y0jvIWQhj7jn-Ue8AE/view?usp=sharing
Does it work with an Editor-placed Radio Alpha trigger?
Yas, it's dropping an error for the trigger creation currently
Idea for hashmaps:
- Ability to add an event handler which is called when hashmap is deleted. Perhaps it might be not stackable.
I love it, but that'd be weird ish 
would need a new addeventhandler command oof
ah not stackable.. yeah.. yeah sounds nice
or... or... it checks a special entry inside itself π₯³
needs to explicitly be set via set tho, no createfromarray, because reasons
ok, so why I was thinking about it: I am planning to use a hash map as a wrapper to manipulate some UI controls, and it would be neat if the controls 'owned' by that hashmap wrapper could be auto deleted when the hash map is deleted
Q: if I am looking for buildings and I know the class name, can I use allSimpleObjects?
if they are created by createSimpleObjects then yes I guess?
buildings might be terrain objects, and might not even have a classname at all.
But yes, if they are simple objects (they usually aren't), you can use that
hmm, well, a better question is, can I query for buildings, knowing the specific class name, without necessarily needing a target object or position, and radius? i.e. nearestObjects or nearObjects
did you try entities command? if it does not work for terrain houses, you can use those commands which query objects at pos and within radius, just use worldSize/2 for pos and 1.41*worldSize/2 for radius π€
buildings can be selected with on of the proximity commadns
but it also includes a lot of crap like powerlines and hayballs as "buildings"
especially on modded map
Use house instead of building and nearestObjects
I actually do know the class, I do not need to guess building or house. I'm just trying to narrow the field a bit to identify those specific building objects.
will try that, thanks...
Right guys, me again.....
Trying to get the following working via a radio command Trigger
GroupC130 = CreateGroup West;
C130Crash = createVehicle ["CUP_B_C103J_GB", [(getMarkerPos "C130Spawn") select 0,(getMarkerPos "C130Spawn") select 1,100], [], 0, "FLY"];
C130Pilot = GroupC130 createUnit ["B_Pilot_F", [0,0,1], [], 0, "CAN_COLLIDE"];
C130Pilot moveInDriver C130Crash;
wp1 = GroupC130 addWaypoint [(getmarkerpos "C130Target"), 0];
wp1 setWaypointSpeed "NORMAL";
wp1 setWaypointType "MOVE";
However, nothing happens, but I cannot see why, can someone enlighten me?
checked .rpt for errors?
also there is a command to spawn a vehicle with crew included
_arr =
[
_spawnPos, //position
_dir, //direction
_planeClass, //type
civilian //side
] call BIS_fnc_spawnVehicle;
I'm going to sound incredibly simple right now (probably warranted), what is .rpt?
!rpt
Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.
To get to your RPT files press Windows+R and enter %localappdata%/Arma 3
Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files
To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.
.rpt is your best friend when scripting arma. i wish someone would have told me years ago. I used to debug with hint str _myValue. had to run code again and again bc sometimes the hint was gone to fast
I get the following :
18:27:47 Cannot create non-ai vehicle CUP_B_C103J_GB,
18:27:51 Cannot create non-ai vehicle CUP_B_C103J_GB,
I notice it states 'non-ai'?
huh that looks wierd
Definitely going to use it going forward, thanks for the suggestion π
I see the issue I think...............
Turns out I need to check what I type...... CUP_B_C130J_GB instead of CUP_B_C103J_GB
Thanks for the .rpt point though!
What does that show? π
it prints strings into the .rpt
makes it easier to debug stuff if you can print your values into rpt
sqf stepper when @ded_men
what is the difference between modes in BIS_fnc_EGSpectator? the two modes that it lists are "Initialize" and "Terminate". What do they do?
https://community.bistudio.com/wiki/BIS_fnc_EGSpectator
thanks
spawn returns the script handle of the spawned code, so the wiki page is wrong for stating that BIS_fnc_guiMessage should be used with spawn.
Instead, call must be used to get the boolean return value; but call is blocking, meaning your code stops at that call and waits for BIS_fnc_guiMessage to finish and return its result.
As such, your variable _message actually contains the script handle of the running instance of BIS_fnc_guiMessage, not the result of it. That's why the if-statements don't work.
Something like this should work better:
//Timeout:
[] spawn {
sleep 10;
uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];
};
//Call BIS_fnc_guiMessage and wait for result:
private _result = [...] call BIS_fnc_guiMessage;
//Use _result:
if (_result) then { ... } else { ... };
Does anyone know of a blindfolding script or mod?
many thanks
For some reason
(_vehicle isKindOf "Boat")
isnt returning anything
anyone know why or if I am using the wrong vehicle type?
I've also tried "Ship" to no avail.
Anyone know why when I execute serverCommand "#missions" on server, it does nothing?
I know it needs UI Context on client to execute
But I've got it tied to a server-only trigger and it still won't fire
so are you running it from an event handler of some UI?
I know it needs UI Context on client to execute
it means you must run it from event handler of some UI element, like on button click
I have it inside of a trigger
Trigger is set to only execute on server
It executes when a public variable is set to true
'inside trigger' is not UI context
I have explained what UI context is
Yes, I know that
If serverCommand is executed on a client, it must be executed from UI context, such as onButtonDown or similar events (see User_Interface_Event_Handlers).
I know if serverCommand is executed on client, it must be UI context
What I'm asking is
If it's executed on server
Does it have to be UI context as well?
Ok sorry I might have misunderstood you
Did you actually try if it works from ui context on client side?
just create a button. Use setButtonAction and use buttonActivate to fire it
takes 5mins and boom
You can even create that button off screen
I wonder if it might work if you create a control and delete it and put code into the 'deleted' event handler of the control π€
Anyway I actually don't remember if server command can be executed on server at all!
I've tried it via the trigger method I mentioned and so far no success
No success with remoteExec either
triggers = no bueno anyway
Very fair
Hey so im looking for a command i can put on the init of a helicopter to ensure that it will not be fired on (its a medical helicopter) nor will the people inside be fired on, any help is appreciated
see setCaptive
https://community.bistudio.com/wiki/setCaptive
should do the trick
Or put civilians in there
Is there a way to check if an EH was removed?
Question, is it possible to have remoteExec produce a return value?
no
Hmmm
not in the way you think it
how would that work π
Well, I want to have server query a variable from client profileNamespace
To be used in a subsequent remoteExec script (it's complicated)
It can be done but you need to write 3 functions
Send, receive, and redistribute
FN1 = Ask server for the variable
FN2 = Get variable on server
FN3 = Send result back to requester
If trying to ask server for a server-side variable with remoteExec & getVariable
it would cause your game freeze until it has result from the other machine, so no
however if you try really hard then you can somehow implement it in a spawned context
Hmm okay
so yeah as people said you should better execute something on client then send the response to server with the data

oh damn I've watched through the whole animation of your avatar π
hello, anyone know where i can find the list of all the arma 3 normal weapon's bullet type that i can use for createvehicle
ex: "R_PG7_F", "M_NLAW_AT_F", "R_PG32V_F", "R_TBG32V_F", "M_TITAN_AT", "M_TITAN_AP", "Bo_GBU12_LGB", "BombCluster_01_Ammo_F"
https://community.bistudio.com/wiki/Arma_3:_CfgMagazines
under ammo column
the engine will use the one it needs typically, automatically making it _F I believe. I think @little raptor made a post a while ago about how the engine changes to what it needs
at least I think it was leo... could be mistaken
How would I get a function that I created to be called/spawned within an object's init field?
whats the _f thing even for?
_f is like... deployed and usable. kind of like the parachute class has a normal class which is used for backpack but using _f lets you have the opened version
@smoky verge _f stands for futura, and _e stands for expansion
oh that makes more sense
because I see it in almost every arma Pbo name
where's your function defined?
cause you'd want it preInit then
it's packed in a pbo
are you running into an issue where the function doesn't exist by the time the object init field is called?
@fair drum should I add a param to enable a preInit
My function is called via the init.sqf, if on server then it'll be called from the initServer.sqf, then I have the following in an object init field [objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop;
well what exactly is your problem?
Well the sound doesn't play, and I don't know why, yet if I use the editor console and execute the command from there it works [objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop;
Function called inside the init.sqf or initServer.sqf: ```sqf
[] call SOG_fnc_Soundscape;
Then I spawn the following inside the object init: ```sqf
[objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop;
I've added this to the command, which seems to work: sqf [] spawn { waitUntil { !isNil "objName" }; [objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop; }; My next question would be how to implement that into the script itself instead of having to incorporate it when adding it to an object init field
CBA's event handlers have an "init" handler that doesn't require config entries
@fair drum Could you give me an example?
https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addEventHandlerArgs-sqf.html
and you'd use "init" as the handler
then you put in your code that you'd want in that init "box"
@fair drum I'm still not following, my mind has gone blank, lol
you wanted to not use object init fields right? or did I misunderstand?
I would like to use object init fields
oh then I completely missed the goal you are looking for
This channel is only for Arma scripting. The only channel that is (just barely) related to your question is #offtopic_software
My apology, will move this question
but better ask this question in stackoverflow/superuser or something
Thank you for kind suggestion
Is there a way possible to make side/faction specific stuff invisible ingame?
As example, lets say a house:
You got a user action and its called "Hide House"
BLUFOR is still able to see it ingame, while OPFOR cant see it ingame
Would be nice if there is any kind of ways to make this happen, but should be MP perfomance/server friendly π
hideObject, remoteExec, units, east, west. These are some of the commands you wanna use
Hey so uh, does anyone happen to know how i can mount say a cheetah turret on a hunter? I would post a picture to show it better but im lacking permissions. If anyone knows please ping me
you cant merge parts of vehicle a onto vehicle, only through modding
Anyone know stalkers anomalies? The stand alone mod that just adds them, so the teleporter module is it possible to script it so vics can get auto tp'd too?
Hi, I'm making a little script (I have pretty much no knowledge on SQF just started learning recently)
I'm making a mission for some friends and I want a single script, that when the blufor enters the trigger a squad will spawn on the map marker closet to the trigger that was triggered. This is what I got and it doesnt seem to be working.
_nearestMarker = [allMapMarkers, this] call BIS_fnc_nearestPosition;
group_1 = creategroup independent;
enemy1 = group_1 createunit ["I_Soldier_SL_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy2 = group_1 createunit ["I_medic_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy3 = group_1 createunit ["I_Soldier_AR_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy4 = group_1 createunit ["I_Soldier_AAR_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy5 = group_1 createunit ["I_Soldier_TL_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy6 = group_1 createunit ["I_Soldier_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy7 = group_1 createunit ["I_Soldier_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy8 = group_1 createunit ["I_Soldier_LAT_F",getmarkerpos "_nearestMarker",[],0,"form"];
_enemyArray = [enemy1,enemy2,enemy3,enemy4,enemy5,enemy6,enemy7,enemy8];
waitUntil { {player distance _x > 1200} forEach _enemyArray };
{deletevehicle _x} forEach (units group_1);
deleteGroup group_1;
Note if I replace the "_nearestMarker" in each of the enemy lines the script does spawn them but only at 1 marker
@lean heath Where does this code run from? The On Activation field of a trigger?
Its in a .sqf file that the trigger runs with this in the activation field: ``` 0 = ["_nearestMarker"] execVM "spawnUnits.sqf";
In my testing I only got it working by giving the marker and actual name in this case outpost_frini instead of _nearestMarker
that's because it will be searching for a marker named _nearestMarker
is there a marker named _nearestMarker?
_nearestMarker looks to be a variable, so remove the quotes when passing it to the script:
0 = [_nearestMarker] execVM "spawnUnits.sqf";
ah, okay.
otherwise it will be seeing _nearestMarker as text, and not take it as a variable
Understood, I'll try it out
Havoc is right, but there are more problems.
Yea I just tried it and it didnt spawn, I assume the errors are in my script?
I did replace "_nearestMarker" with [_nearestMarker]
this is undefined and also can't be used in the On Activation statement of triggers. As such we have to alter the beginning of the script:
params ["_trigger"];
private _nearestMarker = [allMapMarkers, _trigger] call BIS_fnc_nearestPosition;
```As well as the way we call it in the trigger:
```sqf
[thisTrigger] execVM "spawnUnits.sqf";
This script also can't be used with a dedicated server because you try to use player in the waitUntil-statement (while forcing the script to only run on the server in the first line).
so it works if I name the trigger _trigger, but what if I want multiple triggers to run the same script (Affecting the marker closet to the trigger that calls the script?)
I have a lovely optimisation for you as well π
private _group = createGroup independent;
private _enemyArray = [];
{
private _unit = _group createUnit [_x, getMarkerPos _nearestMarker, [], 0, "FORM"];
_enemyArray pushBack _unit;
} forEach ["I_Soldier_SL_F", "I_medic_F", "I_Soldier_AR_F", "I_Soldier_AAR_F", "I_Soldier_TL_F", "I_Soldier_F", "I_Soldier_F", "I_Soldier_LAT_F"];
Exactly this #arma3_scripting message
- nvm -
and what "doesn't work"?
I hope this could work that for one faction its invisible and for the other faction still visible, its important π
Thank you π»
Hey, question
What's the best method for generating a varname from script?
For example
I have a script that creates a unit on server every time a player joins (onPlayerConnected eventhandler)
And I want the variable name of that created unit to correspond to the machine ID of the player (e.g. unit_17, unit_19, etc.)
How would I go about doing that properly?
using owner?
Yes
missionNamespace setVariable [format ["unit_%1", owner _unit], _unit];
Hmm okay
what is wrong? is anything wrong?*
No no just going to try it to see if it works
Give me a sec
Okay, so would I then need to broadcast that missionNamespace variable to clients?
if you need it client-side
How would I go about doing that? Just publicvariable or?
missionNamespace setVariable [format ["unit_%1", owner _unit], _unit];
missionNamespace setVariable [format ["unit_%1", owner _unit], _unit, true];
you could also use clientOwner locally
Hey there. I'm desperately trying to make a recruitment script similar to hunter 6, meaning you get standing static AIs that you can recruit at a main base, you approach them you get either an addaction/hold action to recruit them, then you can dismiss them whenever you like and they'll stay where you dismissed them. I did not found any similar thing, and looking at hunter 6's files I can't even find a single line referring to how he scripted it. Anyone ever did something similar ? Cheers
Oh yeah I did found something tho
Do you think I'd be able to use this somehow? https://community.bistudio.com/wiki/BIS_fnc_objectVar
MMF_fnc_recruit=
{ params ["_caller"];
if (_caller== player) then {
MMF_recruitAction=[ player, "Join Group",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"player distance cursorTarget<5 && (cursorTarget getvariable ""MMF_isRecruit"") <1", "playerSide isEqualTo side cursorTarget", {}, {}, {
[cursorTarget] call MMF_fnc_recruit;
}, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd;
} else {
[_caller] join (group player);
systemChat "Joined group";
_caller setVariable ["MMF_isRecruit", 1];
dismissAction=_caller addAction ["Dismiss", "[_this select 0] join grpNull; (_this select 0) setVariable [""MMF_isRecruit"", 0]; (_this select 0) removeAction dismissAction;"];
_caller addEventHandler ["Killed", {
(_this select 0) removeAction dismissAction;
}];
};
};
Prolly can't get machineID with it, but oh well
why do you need that really?
I really don't tbh
then don't? Β―_(γ)_/Β―
Just figured it might be useful for troubleshooting down the line
And yeah fair
Might use this too
I mean one or the other
I'll see which works best
Okay so good news is that setVehicleVarName mostly worked
However instead of saying "unit_5", "unit_6" etc.
It says "unit_scalar" or "unit_any"
Think it has something to do with how I'm providing the string
_unit setVehicleVarName _unitString;
Thoughts?
yep, what is _owner?
It's a param for onPlayerConnected that provides Machine ID of the connecting client
is it executed server-side?
but you don't have the unit yet
No so basically, I created _unit a few lines earlier
That is executed on server
_unitString = format ["unit_%1",_owner];
_unit setVehicleVarName _unitString;
Ignore the whack group name
can you make the smallest repro?
Repro?
reproduction of the issue
remove all the code that is not linked to the issue, and provide the error-prone code
then _tempPos is undefined
The only problem is that the variable name doesn't update properly
Ah sorry, yeah that's just the spawn location for the unit
that's what I mean; remove everything but what you want to test
so basically
addMissionEventHandler ["PlayerConnected",
{
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
private _name = format ["unit_%1", _owner];
systemChat _name;
diag_log _name;
}];
```and check the results
Armagic
Ayy
I changed it to remoteexec globally instead of executing it on server since Biki says it needs to be executed on all machines
And then added in params
And I think that did it
Going to check on dedicated to see if my hopes are dashed
But thanks for the help!
Hey, one last question, does onPlayerConnected eventhandler execute for everyone including server?
well IDK, if you are the server I would say you cannot really "connect"?
anyway, server is always 2
Well I mean, does onPlayerConnected fire for server on mission load
that's what I say, IDK
I think initServer.sqf triggers after network creation
but you can try and tell us
https://forums.bohemia.net/forums/topic/175154-functions-unitcaptureunitplay-for-infantry-units-in-arma-3/
does anyone know if this works on a dedicated server?
does anyone know how to execute multiple lines of code remotely? (remoteExec)
yes, make a function and remoteExec it
my_fnc_toexec = {
//code
};
[] remoteExecCall ["my_fnc_toexec"];
??
https://community.bistudio.com/wiki/Function
isn't this how you define a function?
file location
missionDir.terrain\Functions\myCategory\fn_myFunction.sqf
declaration
class CfgFunctions
{
class myTag
{
class myCategory
{
class myFunction {};
};
};
};
usage
[] remoteExecCall ["myTag_fnc_myFunction"];
Yeah it will work if function/variable will be known to target client.
what you did with that is declare a piece of code. it would also not work due to locality (β)
it will work if he will define that on the client/target machine.
yep.
known?
in what way
defined.
if the code exists as a global variable there
I will be using a trigger with Server only
so don't use that
I will place it in description.ext, right?
yes
another simple question, how do I access this directory? ```sqf
"\A3\ui_f\data\map\mapcontrol\taskIconDone_ca.paa"
you can open the PBOs with Arma Tools
@drifting portal β
Bankrev?
I don't know, I use PBO Manager π
yes BankRev
funny, both don't work for me lol
you can open PBOs, you cannot open EBOs
Processing music_f_exp_music (53 MB)...
Fail to process music_f_exp_music after 00:00:02.2010672
Failed to convert 1 file(s)
yes I get error when installing pbo manager which can't be solved
lets stop speaking here, off-topic
thx
hello guys. I wanted to know if it is possible to have server and client times async to each other.
from what i saw, the daytime gets synced back to server time about 5 secs after a local change.
i want to stop that from happening so i can have clients on the server that have daytime, while others have nighttime
you can set in in eachframe, it will work but it's a bit hacky.
I'm working on kp lib so the following question will kindve revolve around that framework and yes I've already inquired on their discord: I'm trying to get players automatically assigned to a group based on the role they select when joining.
And might have some performance impact too.
well, but its a local script, so the server perf wont drop i guess
yea, client might but i've played an op that did caves being darker like this and it worked just fine.
i just need dark interiours for underground areas
ive played aroung with setAperture, but that literlaly just lowers the gamma, so light sources dont work
they do but they need to be really strong to be visible in daytime.
So kinda does not work if you can't change eg. flashlight power.
hmm. I think the each frame hack is way more smooth
since it literaly gives the client all the night time shader settings
I want to spawn something 500m away from a player, but I'm not figuring out how to get [x,y] that is 500m away from a player, I'm looking on the internet too, any idea?
https://community.bistudio.com/wiki/getPos#Alternative_Syntax_2
https://community.bistudio.com/wiki/getRelPos
Something like that perhaps?
greatly appreciated, skipped a long way searching lol
Hello. I have a little problem in Arma 2 OA 1.64 scripting. I have a custom ammo count which is 1 and the original size of the magazine is 4. However, when I use service point, it goes back to 4. I want to keep it at 1 at all the time. Is this possible? Is there any way?
while {true} do
{
_w = selectRandom [squadleader, themedic, theat];
_s = [0, 360] call BIS_fnc_randomInt;
_l = player getRelPos [500, _s];
_veh = selectRandom ["CUP_I_BTR40_TKG", "CUP_I_Hilux_unarmed_TK", "CUP_I_Hilux_armored_unarmed_TK"] createVehicle _l;
_crew = createVehicleCrew _veh;
systemChat format ["Spawned %1 at %2 to attack %3, driver is %4", [configFile >> "CfgVehicles" >> typeOf _veh] call BIS_fnc_displayName, _s, _w,driver _veh];
driver _veh disableAI "all";
driver _veh enableAI "MOVE"; driver _veh enableAI "ANIM"; driver _veh enableAI "PATH";
_crew setSpeedMode "FULL";
//placeholder
while {alive _veh} do {
driver _veh doMove (position _w); //here
// put (sleep 1;) here
if (_w distance _veh < 20) then {
"Bo_GBU12_LGB_MI10" createVehicle (getPos _veh);
};
};
sleep 70;
};
when I do this (notice //here comment) the vehicle driver (_veh driver) doesn't move to the desired entity location, the driver only moves to the desired entity location if I place the move order at //placeholder command, but that means if the desired entity moves the _veh driver won't drive to it, but will drive to its older position, I need the driver to follow the entity, anyone got an idea?
Update : I remembered that when you give AI a "MOVE" command, it will stop a bit and then execute it and since the original code had it execute for every single frame of the game (60 fps so 60 times a second) that made the bot just stand still getting new orders every frame, causing it to stand still trying to execute a command but is given another command anyway, by adding a delay (sleep 1;) it fixed everything, you can see a comment where I placed //sleep 1;
@hollow thistle yo dude. could you DM me up if you have time?
question about hashmaps:
what should I write in params if I am expecting a hashmap argument?
this: params [["_hashmap", createHashmap, [createHashmap]]] ?
would make sense if there was a hashmapNull π although technically it makes no sense because it's not an engine-owned object and it can't get nulled while it's still referenced somewhere
thats what ive been doing
imagine if we had to createVehicle for params π
I'm trying to understand how camSetDir work, but nobody on the internet mentions it, any idea?
have you read the examples on https://community.bistudio.com/wiki/camSetDir ?
I want to use [x,y,z] but I can't understand how to use it
if you use it with vectorFromTo its pretty straight forward. the first argument would be the camera position, the second would be where you want the camera to look
I thought I can control where it looks by degrees
you can use spherical coordinates to create the vector (if you want to use angles)
Good day, does anyone have experience in writing Expression block for SpawnAI module? It says that passed arguments are 'group', 'module' and 'groupData' but I can't get any of them not by 'this select 0' (undefined this) nor by 'params['group']' (local variable in global space)
this is only defined in object init
params['group']
local variable in global space
it already says what's wrong
Yeah, well, I understood the error message, just don't know what to do with it, a little hint maybe? π
params["_group"]
Thanks a lot! π
And another one - is there a way to prevent units from boarding the vehicle when using 'doMove' or 'commandMove'? π€
they don't board anything when you use doMove
Well, guess in my case they do π
The vehicle is a part of a group, maybe that's why
well obviously if it's part of the group then they'll use it
Guess I'll have to create a separate group then, okay, thanks.
hashmapNull == createHashmap
Different name, exact same thing.
Different name
is the confusing part I guess
ve vant a standart API, schnell! bitte :p
standard*
zat wos for ze pronuncee-ayshun
Better look #community_wiki and give some feedback. JETZT
like I can help on Arma servers π
still, going π
Hello, is possible to get maximum allowed count units for given side (defined in mission.sqm)?
yes, using getMissionConfigValue
https://community.bistudio.com/wiki/getMissionConfigValue
can someone help me creating custom side chat messages?
or at least something that looks like side chat?
according to the biki
https://community.bistudio.com/wiki/sideChat
in order to give it a custom name I need to create a cfgHQidentities
is that done from the from the description.ext?
thank you a lot! π
my pleasure sir 
what do you mean with "custom side chat messages", what do you expect?
trying to replicate a player chat message
basically as if a player had sent that message in side chat
but in order to do that I'd need the correct name to pop up
https://i.imgur.com/A3Ew9s1.png
basically like this
why not use that unit? or is it not existing
that was sent by a real player
is there a way to send messages as if a specific unit has sent them?
I can create an unit with that name if it helps
you can do that, it's the simplest way
how can I define said unit?
do I make an sqf like this?
_soldier = Lou Montana
_soldier sideChat "Learn scripting you animal";
Basically yes, it's a wrong code, tho
had no doubts
can I not place a unit in eden instead of createGroup+CreateUnit?
yes you can
and I guess the name should go in identity?
?
IDK, also maybe #arma3_gui may help too
the name that goes in _soldier = NAME in the sqf
the NAME should be defined in the unit identity attribute?
understood, thank you!
Sorry if switched wrong channel for this question
nah np
I thought you wanted to create it via editor
yeah, to clarify what I understood.
I need to place down a unit, then go in it attributes, scroll down to the identity tab and name it "john doe"
then I open the sqf and write something similar to
_soldier = john doe
_soldier sideChat "text";
I might have misunderstood something though
oh wait I need to use the variable name not the identity name right?
yeah variable
but only the groupName shows up not the person name
only for players though, right?
hmm true
so no way to have a name pop up?
I've tried putting the AI in its own group and then renaming the group thanks to CBA so that it includes the name
but it doesn't seem to work neither
rename the group in the editor maybe?
Change the group's callsign
yeah that worked
its not exactly 1:1, the text is more whiter and it has " at the beginning and the end
but it'll do
Hey, novice editor here. I'm trying to create my own little runway using the following code, but the objects tilt themselves relative to the ground they're standing on.
_Run1 = createVehicle ["Land_AirstripPlatform_01_F", [6808,2817,0], [], 0, "NONE"];
Is there any way of placing these objects so they're level?
hi, yes you can either setVectorUp it to [0,0,1] or use setDir 0
Why does setDir 0 change its up vector?
that's Arma to you π
it sets the object's direction in 2D only, thefore it resets the "vertical" dir
Ah okay
you can setVectorUp back to surfaceNormal if needed π
lovely, thanks. I'll give that a try.
sorry for posting images
class CfgFunctions
{
class camera
{
class controls
{
class setDir {
params ["_cameraname", "_degree","_elevation"];
_p = cos _degree;
_z = sin _degree;
_p = _p *5;
_z = _z * 5;
_cameraname setDir [_p,_z,_elevation];
};
};
};
};
``` it says (in the image) there is something wrong, what is it?
yes, you don't write functions in the config π
ouch
also no need to apologise for posting images, as long as it is related to what you say and it has a description π
I placed it in description.ext
yep
https://community.bistudio.com/wiki/Arma_3:_Functions_Library
this is how you do it
I may misunderstood this?
yes, you place the script file in the directory, and place the config in description.ext π
missionDir.terrain\Functions\myCategory\fn_myFunction.sqf
shouldn't it be fnc_myFunction.sqf ??
nope, fn_
I want to make an Addaction that kills the player when they do the action on the object
How would I do this?
is it a MP or a SP ?
with addAction and setDamage π
setDamage, thank you
And so what do I set the damage to?
99999?
Alright so
this addAction ["Kill", setDamage 1];?
I doubt it is but I really dont know how to script lol
This is just for a prank
no
in the script "slot" you must include the script between {}
so
this addAction ["Kill",{player setDamage 1;}];
you also forgot to add who is going to get damaged ^^ and the semicolon ;
btw in case this is a MP mission, this action is going to get added every time a new player join, so say 3 players join, its going to get duplicated 3 times
So what should I do for MP?
[this, ["Kill",{player setDamage 1;}]] remoteExec ["addAction"];
be sure to put this in init of the object
Yeah, I did that
Thanks!
Welcome lol
Final question, is this ACE compatible?
yes
you can't post images here, send dm
this is misinformation
I did ```sqf
file = "fn_setDirm.sqf";
you remote executed that to the server
the server doesn't have a player
and the server doesn't have a UI for an action anyways
no need to file = π
done
you are using an init box
just make the action normally
and it will fire on every client
which is what you want
no need to remote exec
addActions are local, they need to be fired on every client you want to see it.

@south gale
camera_fnc_setDirm will work on other sqf too?
sorry?
it does
if you name the function class setDirm {}; in Description.ext, it will look for fn_setDirm.sqf
the function will be declared globally yes, like any BIS function π
whats the display and control for the inventory opened menu?
602 i believe
check the findDisplay wiki page, it should list what you need
How come the server is crashing when this is in my initPlayerLocal.sqf
if (hasInterface && didJIP) then {
[player,"resupplyTest"] call BIS_fnc_addCommMenuItem;
hint "player action added";
};
don't think thats the reason for crashing
that's the only thing I've changed tho. Moved that line from init to initPlayerLocal
Oh okay, how come?
HC's used that to
not if you consider headless client π
mi
Is "resupplyTest" a valid subclass of CfgCommunicationMenu
Can't you give the subclass whatever name you like?
looking through the web and at other peoples Cfg's, they all have used (probably) user made classes
- the com menu does get added in SP
does onPlayerRespawn.sqf get executed when players first spawn, or after first "actual" respawn
What's the difference between killer and instigator?
killer might be the UAV, instigator the operator
what killed vs who killed π
I believe so, but maybe do some tests to be sure
It should be objNull in the case of a fall iirc
sorry to interrupt but does anyone know how i can fix my turret ammo being infinite?
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}] ;
this addWeaponTurret ["Rocket_03_AP_Plane_CAS_02_F",[0]];
this addMagazineTurret ["20Rnd_Rocket_03_AP_F",[0]];
when i change the 0 value on the magazine or turret itself it just breaks
remove the event handler
thats it?
oh yeah
cheers
now for my next question is there any way to add a object to the turret so say if i turn my turret the object turns with it
I am not sure, try attachTo
nah just seems to attach it to the vehicle itself
i shall continue
and then curse everyone with shitty technicals
You can attach to a selection
What's the best way to get an array of ALL the classnames of items in a specified box?
I've tried playing around with ItemCargo, everyContainer, magazineCargo, weaponCargo but they all only work for their specific type of item and some output as [[classname1,classname2][#itemsClassname1,#itemsClassname2]] while others output as [classname1,classname2], which makes writing a script that runs each of the above commands and returns them all to be difficult because of the slightly different output formats (still possible though, just want to make sure I'm not missing something obvious first before I work on that approach).
Overall purpose is to create faction-based ace arsenals by getting the classnames of all items in each supply box for that faction and then manually combining (and editing anything that wasnt in the boxes like ace medical) the outputted arrays of each box into one array to init the ace arsenal with
By the sounds of it ALiVE tools / faction creator might be your best bet here.
Atleast from experience with this sorta thing has shown ALiVE tools to be the simple way of doing it
Huh I wouldn't have expected ALiVE to care about specific items in boxes, interesting. I assume you're referring to the ORBAT tool?
I'm trying to script something that gives me points on killing enemies, but for some reason the units are claiming to be on the civilian side
any idea why this might be?
@tough abyss try different attachment points
there's a bunch of different ones
side of a captive or dead unit is civilian. Use side group _unit to get the underlying side (see Example 2)
https://community.bistudio.com/wiki/side
maybe this?
thats probably it
but they're not captive or dead
oh duh.
its firing after they're killed
so ofc it claims they're always civ
Yes, I believe that you can get it to export ammo boxes for the specific faction you are after.
Then you can just edit in notepad++ (or similar) to ensure the right stuff is inside it
Example 2:
_sideAlsoWorkingForDead = side group _deadUnit;
makes sense
Dont ask me about getting that acustom ammobox ingame though., as I could never do it with issues. :/
I think for ammo boxes like that I just made a script that filled it and called that script in a custom init function in description.ext w/ cba
i've never done ALiVE ORBAT, only alive mission making with premade factions, but I've heard that it is cursed.
Thankfully, I just need the classnames of the items so that I can call the Ace arsenal init with them, no custom boxes needed
Its not cursed, just takes knowledge and google to learn how to use it.
Long run, multi missions its great.
But one-offs arent worth it tbh
honestly i think the opposite once you know alive it makes making quick missions way easier
Was talking about orbat, not alive as a whole
Yeah man I love ALiVE and hang around the discord for it, just never felt the need to make a custom faction for it since a ton are already set up
anyways slightly off topic yeah
oh yeah for sure the ORBAT tool is super powerful but its also p tedious
if you can find what you need in CFP its probably good enough
CFP, CUP, ProjOP, 3cb Fac
Any of those tend to be enough tbh.
can you by any chance give a example? cant figure it out
1 sec
https://community.bistudio.com/wiki/attachTo so here they have the memPoint as one of the args right
that's what I'm talking about
each object you can attachTo has a bunch of memory points
Are you wanting a player used ammobox/arsenal or is it AI?
Cus player wise, just using ACE arsenal and then exporting it or saving it as a custom comp works. @foggy hedge
I've been thinking of making an addon that basically ports the gmod weld tool into arma
because that sounds incredibly funny to me
sounds like lots and lots of tedious scripting
well not necessarily
you can get offsets between two objects in modelspace and then it would "just" be a matter of doing attachTo with that offset
imagine welding one of those emplacement guns into an Mi-6 cargo bay and flying around with a little crappy AC-130
oh or putting the ZSU-23-4 turret on something
honestly on literally anything, that turret is always a barrel of laughs
Something that functions somewhat like this? https://steamcommunity.com/sharedfiles/filedetails/?id=2367876622&searchtext=custom+technicals
yes! just not limited to only the PLP materials stuff
just weld any 2 objects together
Used by players, I'm creating a limited ACE arsenal with only faction (and some misc. like medical supplies) gear. As far as I could tell there's no easy way to restrict the ACE arsenal to a specific faction or addon, so I'm creating a whitelisted arsenal.
I've tried getting the classnames of all the gear by placing down every AI from the faction and running a script snippet that copies all their gear, that worked but there's a number of gear not loaded onto the default units (but are in the boxes) that I want to include so here I am
Contact the Author, might be worth seeing if he would be interested helping you/ using his code
Are you using the built in ace whitelist? if so,m yeh thats the best bet for that.
oh hey, I forgot to send the link. Using the code from section 1.3
https://ace3mod.com/wiki/framework/arsenal-framework.html
The only other thing of use, is creating predetermined loadouts. and then having your whitelisted arsenal to allow players to edit the loadout within your faction parameters.
@frank mango Yes I plan on it but I have some other things I wanna work on first
I havent used the code, personally just using the ingame ace whitelisting is enough.
But I think that some of that code may be outdated, im not sure how much of ACE framework has actually been fully updated to current
I've done a test run using the example code for making one based on getting all items of units ingame and that one worked but like I said that one doesn't have all the items I want to include so I need to go deeper
and yeah this'll be what's happening, need to expand the arsenal to have everything I want though
also just a quick thing before I take this over to the ALiVE discord for further help but I don't think ORBAT has a crate tool? or at least I cant find it?
If I are remembering correctly, youve gotta have a faction created/ selected and it should be one of the export options (i think)
alright I'll keep trying at it, thanks for the help
lmk if you need a loadout template. Ive got a decent one lying around and the scripts to support it.
I can't find a way to get an array of editor placed walls (class name "Land_CncWall4_F") I have tried ```sqf
nearestTerrainObjects
nearestObjects
nearObjects
but as I expected they won't help, since their purpose is out of this scope, is there any way to do this? (reason being is I will apply a set of code to these walls using a trigger later on in the mission).
Q: not really sure what the purpose of publicVariable is. once you set it do you need to re-set it? or does it publish in a JIP manner with the most up to date variable value?
@dreamy kestrel
TAG_MyPublicVariable = 0;
TAG_MyPublicVariable = 1;
publicVariable "TAG_MyPublicVariable"; // other clients will receive the "TAG_MyPublicVariable" variable with a 1 value
TAG_MyPublicVariable = 2; // needs to be broadcast again - synchronisation is not automatic
ah ok I see thanks. so resync is necessary.
Yes
so the thing I am confused about, new players connecting will see the most recent synced value, forever and ever more, or until the next publish occurs, yes?
shifting gears a bit, Q: I have some "Land_ClutterCutter_small_F" objects in my mission file, using them as proxy objects of a sort. Is there a way to identify their values in the missionNamespace vis-a-vis the vehicles array? what I really need is that (vehicles), but I need each of their names, if possible. by the object itself, if possible.
got it, https://community.bistudio.com/wiki/vehicleVarName, perfect π
Hi, I'm somewhat new to scripting in arma, normally just use triggers but I want to loop an AI animation when players are in proximity to the AI units and it seems a init.sqf sorta job. Wondering if someone could help me understand what I've done wrong in this script and help correct it?
_animation = this select 1;
while {alive _unit} do
{
if ({_x distance _unit < 75} count allPlayers > 0) then
{
_unit playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
waituntil {animationState _unit !="AmovPercMstpSnonWnonDnon_exercisePushup"}
};
0 = [] execVM "Anim_AI.sqf";
- how do you execute this
_unit = this select 0;
_animation = this select 1;
completely wrong.
if ({_x distance _unit < 75} count allPlayers > 0) then
{
_unit playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
waituntil {animationState _unit !="AmovPercMstpSnonWnonDnon_exercisePushup"}
missing }
waituntil {animationState _unit !="AmovPercMstpSnonWnonDnon_exercisePushup"}
animStateChangedevent handler
0 = [] execVM "Anim_AI.sqf";
why?
As stated, very new to init files in arma.
- Thought I could call this script in the unit's init
- I see
- Will fix
- Much nicer
- Is this entirely unnecessary?
the most recent broadcast is persistent. yes
Anybody know a way to set a TFAR vehicle radio frequency by init? I had hoped something like TFAR_fnc_setChannelFrequency would work, but it doesn't seem to.
i like to execute some script, if there are no enemies in 1500km distance, the code should execute, otherwise say, enemies are too close.
i got this so far, i barely manage regex yet.
_enemies = [leader _group(1500)] call BIS_fnc_enemyTargets;
waituntil {!(_enemies isEqualTo ([leader _group(1500)] call BIS_fnc_enemyTargets))};
isn't 1500km a bit too big of a check?
_group(1500) what is this javascript?
i mean 1500 meters, my intention is to make a fast travel script. it should check if there is no enemy closer as 1500 meters and then execute a setpos.
ok so far i got
if (player neartargets < 1500)
then {
player setPos vspawn;
}else{
hint "enemies too close for fast travel";
};
i also got now: if(player distance findNearestEnemy < 1500)
findNearestEnemy only finds untis known to the unit searching. Either way: if((player distance (player findNearestEnemy player)) < 1500)
@rancid mulch thx.
i have somthing wrong:
if((player distance (player findNearestEnemey player)) < 1500)
then {
player setPos vspawn;
}else{
hint "enemies too close for fast travel";
};
Is there an error message? If so, share it. Also change < with >
syntax highlight should tell you
if((player distance (player findNearestEnemey player))
< 1500)
then {
player setPos vspawn;
}else{
hint "enemies too close for fast travel";
};
i am even not sure about that new line
New line is fine.
It's fine now
haha
Yeah, that error is pretty stupid/misleading.
the script works now, but at any distance i get the else.
You need to be careful
findNearestEnemy can return objNull if no enemy is nearby
and in that case your condition will return false
i have no clue how to fix that into the ifelse
_unit = player;
_enemySides = _unit call BIS_fnc_enemySides;
_enemies = (_unit neartargets 2000)
private _closestEnemy = player findNearestEnemy player; //Get nearest enemy
if (isNull _closestEnemy OR {player distance _closestEnemy < 1500}) then .... //If it's null, then proceed with true, if it's not null then also consider the distance
thx. but i still fail to apply it π
private _closestEnemy = player findNearestEnemey player;
if (isNull _closestEnemy OR {player distance _closestEnemy
< 1500})
then {
player setPos vspawn;
}else{
hint "enemies too close for fast travel";
};
oh boy
@cosmic lichen i have no error message now, but also no hint
and no setpos eighter π
ah my setpos code is not working
Gimme a sec.
findNearestEnemy works based on group's knowledge of enemy
private _closestEnemy = player findNearestEnemy player;
systemChat str _closestEnemy;
if (isNull _closestEnemy OR { player distance _closestEnemy > 1500 }) then
{
systemChat "Teleport";
player setPos vspawn;
}
else
{
systemChat "enemies too close for fast travel";
};
Works for me now
also I think you had < > mixed up
I am using systemChat so it works in Eden. You can switch back to hint if you like.
ok nice many thanks
you should get Visual studio code with the sqf extensions. they help a ton in finding syntax errors (which you seem to struggle with)
great! i will give that a try
@spark turret is there any alternative to visual studio?
atom, n++, Poseidon is a bit slow
poseidon freezes with .rpts π
VSC is probably the best, especially with all the nice extensions
this one?
You want Visual Studio Code, not Visual Studio
that sounds so microsoftish
Idc about the name really
It's also open source which is nice
Can anyone recommend examples of adding entries and pages to the commanding menu? BIS_fnc_createmenu
ok
its not done lol
this even works with enemy close:
private _closestEnemy = player findNearestEnemy player;
systemChat str _closestEnemy;
if (isNull _closestEnemy OR { player distance _closestEnemy > 1500 }) then
{
hint "fast travel";
fasttravpos = [getMarkerPos "vspawn", 2, 2, 2, 0, 33, 0] call BIS_fnc_findSafePos;
player setPos fasttravpos;
}
else
{
hint "enemies too close for fast travel";
};
https://community.bistudio.com/wiki/Category:Function_Group:_Communication_Menu is the list of all functions for that
I believe there are forums examples too (but no tutorials on the wiki)
Any mods that use it that you would recommend studying?
negative on my side
realizing BIS_fnc_sortBy is extremely powerful. you have an array of elements and want to screen them quickly, not only can you sort them with a callback, but you can also filter them.
yes, its just a little awkward but it does work well.
Does anyone know why this isn't wotking in the civilian presence module?
[_this, selectRandom ["C_man_p_beggar_F_afro","C_Man_casual_1_F_afro","C_Man_casual_5_v2_F_afro","C_man_polo_2_F_afro","C_man_sport_2_F_afro"]] remoteExec ["setIdentity", 0, _this];
i once again asking for your scripting support, i tried to wrap my head around im currently trying to attach a rocketpod to the turret of a offroad hmg and make it turn where the gun aims, does anyone know a solution? someone said something about memory points and i legit dont understand
not getting an error?
_this maybe (IDK how/where you call it)
Nope
Inside the unit created box, it's particular to that module
Here's what they do in the wiki
[_this, selectRandom ["TO_C03_Pilot","TO_C03_Medic","TO_C03_Collins","RC_B_HQ"]] remoteExec ["setIdentity", 0, _this];
@halcyon oar hover over that civilian presence module box you are putting the code in. what variables does it give you to work with?
Doesn't show any error
What do you mean?
let me start up arma...\
I'm sorry π
is it technical possible to add a addaction to a item that can be picked up into the inventory? i try to run a script from a smartphone placed in the editor. i like to make it takeable.
No
testing fix
@halcyon oar bro. you had be working on this and you didn't even use the right class names
what? really? I just copied them
you gave me vehicle class names.
are you just wanting their face and skin color changed?
I used the class name of the unit as they do in the wiki
But yes, I only want face and skin color
lets use setFace instead. to avoid BIS's randomization which I cannot disable before the unit is initialized within that module
which is messing things up
I'm just baffled because I just did it as the wiki instructs and it doesn't work xD.
With setFace it should be the same way but with the names of the heads right?
which wiki page were you looking at? setIdentities tells you it needs a cfgIdentities entry, not a vehicle class name
Look where it says code on unit created/deleted
On apply random identity
I tried with the names of the identities before btw
Before you say anything
It didin't work
I'm starting to think it's some issue on my part
you just want black faces?
yep
wait one
if (local _this) then {
private _faces = [
"AfricanHead_01",
"AfricanHead_02",
"AfricanHead_03"
];
[_this, selectRandom _faces] remoteExec ["setFace", 0, _this];
};
missionNamespace setVariable ["W_ART",0];```
`missionNamespace` not work in **initServer.sqf**?
Dedicated server
it does work
make that setVariable global
maybe your initServer.sqf doesn't run at all
Where does the "Killed" EH fire? Like, lets say a bunch of units aren't local to the server (run on HCs), would the killed EH still fire on those units when they're killed?
I think it's fired wherever you have added it
OK, odd
what's the problem you have?
I'm not sure honestly, this EH might not be firing is one thing
if it is then something is screwy. I'll add some prints and debug
Although, it has a 'LOCAL' locality icon on wiki.
hmm
so I might be wrong too
anyway, it will not fire on the machine on which you didn't add it
if you run that on the server, the variable will be updated on the server
as @fair drum said, use setVariable ["var", value, true] to make it broadcast over the network
Hello everyone, sorry I am really a noob at scripting but can someone tell me why :
ammo1 = getArtilleryAmmo [gun1] select 0;
tgt = getMarkerPos "target1";
gun1 doArtilleryFire[tgt ,ammo1, 10];
This don't work ? The artillery shot but not on the target. I use a old video for this : https://www.youtube.com/watch?v=g_hzGXt91Z4&t=299s
For explain I have in mind to made a scripted event for a phosphorus artilley shell with the new dlc ... And I also don't know what number to put for this type of shell
@sudden bear Where does it shoot instead?
I don't know but I can assure not on the target
@astral dawn the issue I'm running into is that when the EH fires, the unit, killer, and instigator all have the side 'UKNOWN'
sorry, the unit/killer/instigator's groups are all side unknown
does it even return a valid killer object? maybe it's a null object
if it's a null object then it has a null group, if it has a null group then its side is unknown
it might be that yeah
any clue why this wouldn't work? this is called on all units via an extended init handler in description.ext: https://sqfbin.com/jawaduhohisavavewuba
it works locally but not on a server
Use normal Killed event handler instead, it gets called only where killed entity is local though. is this actually true
Within the editor I know you can make slideshows and make them show on a screen or whiteboard add your own images, but is it possible to just link it to say a google PowerPoint ?
MP notes: "Killed" and "Hit" eventhandlers are executed where given unit is local.
Honestly ACE slideshows works best here, and no you cannot link to a powerpoint and then remote display it.
There might be a mod/ script that has some functionality like remote viewing webpages; but ive never heard of it
Looking for a way to have a bunch or portable double lights off then upon entering a trigger have them turn on. Anyone have any scripts that could help me
enableSimulation true/false should do
Ive used an addAction to turn AA defenses on/off.
then have it call upon a simple script stating (to deactivate)
AA_1 enableSimulation false;
AA_2 enableSimulation false;
AA_3 enableSimulation false;
Won't work for lights afaik
Havent tried it, so was just a guess tbh
Using the ingame hide feature linked to a trigger?
he wants to turn them on/off, not hide them I presume ^^
Wasnt sure if they were in players view, in which case. just do a swap using the same module
triggering the trigger, hides the off and replaces them with the on version?
if it can work like that with lights?
if not, then no idea at all
Hows this ?
β¦no π there is a switchLight command that does the job ^^
Bookmarked
ze wiki is gud 4 u
Despite looking for this a few months ago, and spending a good few hours looking on things like the wiki. I never came across any reference to this. wow
Are there any functions for respawnign vehicles that actually respawn abandoned vehicles? The built-in one does not work properly anymore. The code in this game is so outdated.
What do you regard as abandoned though?
and at what distance is something abandoned
No players within 500 meters.
This looks like the best, though I have no idea if the original script can be found anywhere.
^ that is from 2013
That crap script is outdated. It does not work.
write your own?
As stated "I have no idea if the original script can be found anywhere"
Wasnt suggesting to use it.
Hence the "I have no idea if the original script can be found anywhere"
okay so OBJECTNAME switchLight "off"; works but how would I have it do multiple items. Say i have 19 lights named A_1, A_2, all the way to 19, how would i have it tell every light to turn off/on
Trigger, get it to execute a short script?
So when BLUFOR present within set area,
this execVM "Lights.sqf";
@winter rose Would that work?
A_1, A_2, A_3, A_4, A_5, A_6 switchLight "off";
This is what i have except it only turns off the last one in the chain. I mostly need to know what to put so it calls on them all
If i remember correctly, you'll need to have them called seperatly within the same sqf.
using loops is better
@dapper cairn ```sqf
for "i" from 1 to 6 do {
(missionNamespace getVariable ["A" + str _i, objNull]) switchLight "off";
}
you can also use individual names:
{
_x switchLight "off";
} forEach [A_1, A_2, A_3, A_4, A_5, A_6]
And how would it then turn them on when players got within the distance he needs?
Also please note im brand new to scripting so I have no idea what I am doing and im just winging it as I go
That second one worked, so im guessing I do the same but on to turn them on
for that it has to be done individually with a loop
Ive never used a loop tbh so I have no idea either lol
while {true} do {
for "_i" from 1 to 19 do {
_x = missionNamespace getVariable ["A_" + str _i, objNull];
_x switchLight (["off","on"] select (player distance _x < 10));
}
sleep 1;
};
@little raptor That second one worked! Thank you very very much its exactly what i was looking for!
try the first one again
it'll work too
I updated the code
Pretty much, what I base my suggestions on; is just stuff ive winged into some kinda workable state
What am I doing wrong here, I can't get the GF_Earplugs to not throw some error
enableDebugConsole = 1;
class cfgMusic
{
tracks[]={};
class Track01
{
name = "";
sound[] = {"\sounds\Track01.ogg", db+20, 1.0};
};
};
Author="lilwillie";
loadScreen="pictures\image2.jpg";
class CfgFunctions {
#include "LVR\functions\functions.hpp"
};
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};
what error is being thrown though?
Desription.ext, line 16:'.':'{'encountered instead of '='
tried changing to = and things still get errors,
What do you use for writing your description.ext in?
Notepad++
Just changed it to this
enableDebugConsole = 1;
class cfgMusic
{
tracks[]={};
class Track01
{
name = "";
sound[] = {"\sounds\Track01.ogg", db+20, 1.0};
};
};
Author="lilwillie";
loadScreen="pictures\image2.jpg";
class CfgFunctions
{
#include "LVR\functions\functions.hpp"
#include GF_Earplugs\GF_Earplugs_HPP.hpp"
};
And it throws that GF earplugs can't be found
Okay, make sure foldernames are correct
This description worked until I removed a line for AIS and then it went fubar
Does, adding a parent bracket work?
class CfgFunctions
{
{
#include "LVR\functions\functions.hpp"
};
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};
};
No, I just tried and it keeps asking for '="
Okay what did you remove? (I bet you dont have a version of it with the removed item, not removed?)
I have a backup, give me a sec
perfect, paste that
enableDebugConsole = 1;
class cfgMusic
{
tracks[]={};
class Track01
{
name = "";
sound[] = {"\sounds\Track01.ogg", db+20, 1.0};
};
};
Author="lilwillie";
loadScreen="pictures\image2.jpg";
class CfgFunctions {
#include "AIS\cfgFunctions.hpp"
#include "LVR\functions\functions.hpp"
};
#include "AIS\Effects\BarDlg.hpp"
class RscTitles
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};
class RscTitles
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};
Okay π
Boom, perfect, thank you, I see my mistake once you showed the RscTitles
dont worry, done that loads of times myself
for the future
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
but you would use hpp instead
@fair drumThanks!
class RscTitles
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};
looks like this
ewww VS code > np++
For writing yes.
For needing to edit stuff on the fly. Much prefer np++
Though, I had no idea about vs having a git plugin
hey guys, question about ambient animations. I got them working using remoteExec, but in testing they show up in the wrong location when I host the mission in multiplayer and test it with a buddy - I have some wounded units on stretchers that end up a few feet off, just laying on the ground. I tried using setDir and setPos to fix this but it didn't seem to do anything. Any suggestions?
https://community.bistudio.com/wiki/BIS_fnc_ambientAnim You can try the snapTo parameter
and set the attachToLogic to false
Having some trouble with a bridge generation script and editing my terrain: https://www.reddit.com/r/armadev/comments/nigsid/reversing_the_creation_of_simple_objects_help/ if anyone can help me spawn in the bridge using the script and still be able to manipulate the bridge in Eden I would really appreciate it
the script uses model paths
you can't just change it to createVehicle
find which class names it uses
Yeah i tried that and the bridge deck was not there
you can't just change it to createVehicle
doesn't seem valid to me
ah let me check
I have a workshop mod that adds the tanoa bridges to eden, logging class of ramp gives me Tanoa_Bridge_Ramp_Up
Is there a way to replace the model path versions such as bridgesea_01_f with the eden workshop mod map object Tanoa_Bridge_Ramp_Up?
Because according to this there is no classname for bridges
I am very new to this sorry
if that's the classname and it's valid then yeah
but it's not defined in vanilla
hmmmmm I unpacked the pbo of the mod that makes the bridge pieces objects in Eden and I think I'm fucked lol it's beyond me what to do next
I may just have to place the bridge manually
Looks incredibly complicated to get the script to generate objects that aren't defined in Eden anyway
like splicing two methods together
Vsc has a plugin for everythibg.
Theres a "press ctrl+r shortcut to open arma .rpt" plugin
its 5 am and i havent slept yet lmao
Better do without even lmao'ing
ok but basically ive made this in 3den editor https://steamcommunity.com/sharedfiles/filedetails/?id=2494444375
but when i go into achilles and make an advanced composition, the praetors wanna sit on the ground like this
the praetors have been attached with the attachto command
Which plugin has that?
Oki I'm back on working on this again, and still dont have a clue why it doesnt work 
The code I've currently got is
laptop init
if (isServer) then {
[
_respawnlaptop,
"Move to Command Vic",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"(_this distance _target < 3) && (speed PI_CommanderVeh <= 10)",
"(_caller distance _target < 3) && (speed PI_CommanderVeh <= 10)",
{},
{},
{_caller setPos(PI_CommanderVeh getRelPos [5,180])},
{},
[],
20,
0,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _respawnlaptop];
};
and
vic init
if (isServer) then {
missionNamespace setVariable ["PI_CommanderVeh", _commandervic, true];
};
Error I'm getting is
https://prnt.sc/139kiss
(Error Type Any, Expected String, Bool,...) for the remoteExec
If anyone has an idea why it no worky please do tell me so I can get it working and then hopefully never have to touch it again 
_respawnlaptop nil?
Added
if (isServer) then {
missionNamespace setVariable ["PI_RespawnLaptop", _respawnlaptop, true];
};
(and replaced _respawnlaptop)
But still the same error
swap the attachTo.
to what? is there anything that I can attach to the plane that the praetors will float on?
Did you use init or Zeus attachTo
init in 3den editor
the plane just has a variable name for the attachto
So, what has the init with the attachTo 's?