#arma3_scripting
1 messages Β· Page 762 of 1
player is always the player object itself
interesting, than i must be wrong
Now vehicle player is the player object on foot and the vehicle if in a vehicle.
probably got that idea from doing player and vehicle player and getting Alpha 1-1: bla
but that's wrong ofc
Vehicle names are inherited from commander group or something, so typeof vehicle player is more illuminating.
i think now i understand, i was using fired instead of firedMan eventhandler lol
because when using fired it triggers for the whole vehicle
including the whole crew inside
Hi, is it possible to change server parameters dynamically? For example, can i change revive mode from basic to advanced without server restart?
these can be made mission setting yes
you would still need to restart the mission
yeah, i mean i want to change mission parameters without mission restart
You can't
i tried missionNamespace setVariable ["paramsArray", _newParams] but looks like it doesn't work
There's always going to have to be a restart
got it, thanks
Some settings are always going to be initialized upon mission loading
Some are applied immediately. Others need restart. Usually you'll get a prompt when it might require restart
so i guess everything related to revive system you can not change without restart?
i know that viewdistance could be changed without restart, but what else?
Don't know. Assume everything requires a restart
Just prevents issues in the short term
thank you
How would I go about making a trigger activate a respawn point?
I looking for the opposite of addItemCargoGlobal, I basically want to remove an item from the vehicle's cargo, how would I go about that?
||and no I will not use clearItemCargoGlobal because that will remove every item not the item I'm trying to specify||
Hey @little raptor , i'm trying to export a config using your Advanced Tools.
I'm using the Print Config utility and for example this configFile >> "CfgVehicles" >> "B_RangeMaster_F", I want to print the properties on the right. The properties extracted halt halfway. Only using Include Inherited I can get all properties, but I don't want all the inherited.
that utility is part of vanilla, not my mod
and if you are reading this leopard, I would like to also add that It would be very nice if you fix the issue with your debug console not being able to execute code with lines past 600
Didn't know that, thought it was. Ok then, i'll find another way. Thanks.
switch to the SQF (built-in) preprocessor
instead of SQF-VM
how is that if I may know
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
thanks
As far as I know, the only way to delete items from a container with SQF is to save the contents, clear, and re-add.
If you want an AI to take stuff then there's _unit action ["TakeWeapon", ..., although it's probably not reliable knowing AI.
Yep that what I did
thanks
How to I set relative direction? I have an array of relative directions acquired from getRelDir but I would like to apply these directions relative to an object. Using setDir does apply the directions relatively but they are not facing the correct directions.
set relative direction
relative to what?
I would like to apply these directions relative to an object
I see I was being vague, I will write more specific
you can just add the object dir to the relative dir
_absDir = getDir _obj + _relativeDir
that's what I expected but I think the issue lies in the way I acquired the directions. Here is how I did it:
testTent is the object, a tent
testBed_* is a bed within the tent
_bedDirections = [];
_testBeds = [testBed_0,testBed_1,testBed_2,testBed_3,testBed_4,testBed_5,testBed_6,testBed_7];
{
_relativeDir = testTent getRelDir _x;
_bedDirections pushBack _relativeDir;
} forEach _testBeds;
_bedDirections
This returns:
[246.072,220.497,148.742,115.078,299.725,325.008,17.6768,52.5782];
The idea is, I am trying to fill every tent with 8 beds each. Each beds position and direction should be added to arrays that will be used to create more beds in every tent. The position, I have figured out with the help of modelToWorld. However, the direction is not the same as my original testBeds.
well first of all you should use modelToWorldWorld, not modelToWorld
you must always use abs positions. modelToWorld is not abs
second of all, I recommend storing the vectorDir and up instead of just a dir
third of all, in your case you can just do:
_bedDirections = _testBeds apply {testTent getRelDir _x};
to set them:
{
_x setDir (getDir testTent + _bedDirections#_forEachIndex)
} forEach _testBeds;
this looks kinda ugly tho
well first of all you should use modelToWorldWorld, not modelToWorld
actually in this case it won't matter
Performance is not important for this script as it runs once at init
I never said anything about perf 
I assume thats why you recommend abs and vectorDir
also be sure to set the testTent's dir first
understood, I'll get back to you if it doesn't work. Thanks
Hello guys pls help me
never! π
How to create missile lancher based on Titan MPRL Compact that would with a radar
Player would switch ground target in the radar and missile would fly from launcher to 50m above, than find the ground target and destroy it
if you are looking to create a mod, see #arma3_config π
Not a mod i would make it for myself
that doesn't make any difference, you can make a private mod
just that "scripting" won't be enough here
Ok thx
Hi guys quick question how do i get the name of a weapon. Not the class name but the actual name ?
hiyo, get its config entry in CfgWeapons >> className >> displayName π
Ty very mutch
Hello. Is it possible to link the identifier (nickname) of Team Speak to Arma 3, I want people to have the same nicknames in the game and in Team Speak
Does TFAR/ACRE not already do that?
I don't know, so I want to know from someone.
I think it's possible, but I don't know where to look.
I'm trying to learn more about RscListNBox but the only dialog I know that has it is the virtual arsenal, so I exported it with utils 2...but it has like a billion controls...
that's not a question, I just want to share my misery
A player name can't be changed as far as I know, probably for the best, but you can get the players name with https://community.bistudio.com/wiki/name or https://community.bistudio.com/wiki/profileName and you can even get their steam name with https://community.bistudio.com/wiki/profileNameSteam
Good day! Ahh, so these go onto the init?
Anyone have a better way to randomly reduce an array?
_list = _list select {selectRandom [true,false]}
If you want the chance per element to be independent then that's about as good as you're going to get. random 1 < 0.5 will do the same thing at about the same speed.
private _sides = [west, east];
private _southOwner = _sides deleteAt random 1;
private _northOwner = _sides select 0;
I did this at one point and it was pretty fast if you need to store them each in a variable as well
i like that, pretty clean
i can actually apply a weight to this as well. this actually works better than i initially gave it credit for
Hey all π
I'm trying to get an array of classnames of all playable units in CfgVehicles.
Is there a way I can sort entries that are specifically a playable unit?
hmm. There's an isMan variable for CfgVehicles but I'm not sure if that strictly equates to playable units.
hmm... anyway to setdamage 1 to a building without playing the animation/sounds before it turns into a ruin?
guess i can just delete the building and use createsimpleobject
_object setDamage [1, false];
have you tried this
TFAR I know has the ability to set your Teamspeak 3 name to your ArmA 3 name, but i don't think the other way round is possible
thank you. i think this is exactly what i needed.
is it recommended/good practice to remove HandleDamage from dead units?
See #arma3_config
that would be super duper uber cleanup, but not really mandatory/game-breaking
I don't think so
dead infantry take a few seconds to be no longer simulated i think. havent check yet if HD still triggers or has its internal alive check anyway
Why does setFeatureType allow only 200 dynamic objects? I'd like to see all the objects from an aircraft
within object view distance
it is to prevent such saturation, so a performance safe-ceiling
yeah I understand that
I tested the command but it didn't seem to do anything.....
units are visible just the same
you cant use it on units
try it
can't see any difference when applied to a tank
How are you doing it?
What is your object render distance?
2300
How far is the tank?
1 for that command stands for object render. If you want it to render based on terrain render, then use 2
Otherwise the render distance is capped by the object setting
200 first then I go farther..
And when does it disappear from view?
when its just a pixel size
So what's the problem then?

If you want to see it from further than stabdard object view distakce, use fetaure type 2
I used this command before and it behaved differently. maybe I have too great draw distance now
I givr up
Make sure the command returns true when you execute it
There is a engine limit and it also counts map objects etc. So perhaps the command never worked for you.
Also, the effect is local. So make sure it's executed on all machines
its true
i would think the object would be visible by object view distance by default, i guess not then
so IDK what that command is really supposed to do
It does exactly what it reads on the tin
Youre just not reading
"1 - Object is always visible within object view distance" ?
Read the full doc
"Enable/disable object as a feature/landmark." -- guess I dont know what that means
Stop trying to be a smartbuttocks and read it
not really
bruteforcing knowledge
umm what does "feature/landmark" really mean?
Continue reading past the first sentence
lol
how would I detect if a parachute is open
It exists
Parachutes are vehicles
The player is placed into the vehicle
You can also get the animation stage of the chute, i think
But it's open pretty much as soon as you use it
I'm trying to create a script that opens a parachute at 100m on my server for fresh spawns
is that possible?
Yes
Spawn a parachute vehicle and place the player in it
There are 2 variants in vanilla arma. The steerable and non steerable
Both found in cfgVehicles
awesome, got it working. thank you
π
Hello, i've been trying for a while now to animate a train with a couple cargo wagons (nothing complex tho, it's just supposed to go in a straight line on flat terrain) through several ways, but none of them worked out for me. (here's the setup: https://cdn.discordapp.com/attachments/735132698603159562/969193592780365894/unknown.png) I've tried using setVelocity on each of the moving objects but the wagon just goes through the rails at some point. I've also tried incrementing the vector on the axis it's sliding, but it just despawns for some reasons, here the relevant code snippets : ```
// first attempt
hint "Activated";
onEachFrame {
wagon1 setVelocityModelSpace [0, -5, 0];
wagon2 setVelocityModelSpace [0, -5, 0];
};
// second attempt
hint "Activated";
onEachFrame {
wagon1 setPos ([
(getPos wagon1) select 0,
((getPos wagon1) select 1) - 0.01,
(getPosASL wagon1) select 2
]);
};
isn't there a train mod?
there is, it's called Advanced Train Simulator but it doesn't work on other maps than Tanoa
ok
and i don't need something too complex
Also i saw in other server like a countdown to mission, mean everyone form every time zone will see HIS current hour but i dk how to do it. How can i make one. For my server. Help
Yes
Hi, is anyone aware of a "custom formation script"? You would basically position you squad AI somewhere around the player -> execute the script to store their location relative to the play -> and when you ask them to return to formation they would keep the relative position to the player while moving
@still forum i posted my request here
Its a amaing beret even with the wrong RVMAT π
Didn't you already make a FT ticket for that weeks ago?
@fair drum hey dude. Americana1108 from the Armadevs Reddit. Thanks again for all your help so far.
So continuing the discussion from there. I think I'm going to simplify it as much as I can and use the uniform check just to complete the initial mission and then once that mission is done I'm going to have the players respawn in the AAF uniform. Can I use the isTriggerActivated check in onPlayerRespawn.sqf so I can have them respawn in the AAF uniform if that trigger is active, and have them respawn in the NATO uniform if it's not?
that is one way you can do it, sure. have you made sure you can actually pick up the uniforms in your mission anyways? Many faction's uniforms are not able to be picked up off the ground and have to be force equipped through script
Yeah I spawned in a box and once you pick it up and put on the uniform it fires the trigger and completes the task perfectly.
then yeah you can do it with a trigger activation check, or a variable you make, or by checking the status of the task itself, etc
Perfect. I haven't had the chance to try it out cause I'm at work but I didn't know if the respawn SQF was able to call triggers in game or not.
it functions as a standard sqf file that just so happens to be fired when someone respawns
you can also use the "Respawn" event handler too/instead
Is one better than the other, you think? I also have a mechanic in the mission where when players respawn it skips time forward one hour. I had to get creative with some area triggers for that because the sqf only does stuff locally and wouldn't do the timeSkip at the server level.
there is a better way, but that will come with time and you'll figure that out on your journey, just get something working for you now.
Yeah that's my main concern right now. Just get it up and running and refine it as time goes by.
Right now I'm just Zeusing the mission for players so I can manually correct anything that messes up.
but as far as skipping time, where are you putting the time skip?
I set up a medical cargo house for players to respawn into that is locked by default. I put an area trigger that spans the floor of the "hospital" and when people spawn in it fires the timeSkip trigger and unlocks the door, then I have another area trigger on the outside of the door that closes the door when players walk out so no one can walk into the area by accident. There' a failure state on the mission once the in game clock passes 04:00.
so you want a time skip when some people are playing and some are respawning? you don't think that will be immersion breaking?
It is a little, but I don't mind the surreal effect of it. I'm planning on doing a time acceleration for a period of time that would advance one hour very rapidly to make the transition smoother, but for now it gets the job done. It's jarring for players but I kind of like that because it evokes an "Oh shit" reaction even if you're not the one that died.
The players have seven in game hours to complete the mission. So the idea was to have respawns as a punishment so they think more carefully.
well to answer your question about time skipping on server, you can remoteExec the command to the server itself
Ah okay. Yeah I figured there was somewhere I could write that into I just couldn't figure out where, and I was having trouble finding commands than interact with the player respawning outside of the respawn sqf.
If I wanted the punishment to be less immersion breaking I suppose I could increase the time acceleration by 1x every time someone respawned, but I feel like that's more forgiving.
Or maybe too hard. I'd have to test it out.
Anyone know of a good guide for capturing a infantry movement data and firing data ect
Been trying to use that. But can't get it to even record
Not to mention the movement data and stuff has already been filled in π
user error then, it worked fine for me last week
His download has all the Movedata and stuff filled out already
thats an example mission. use the functions themselves
when using CBA_fnc_addPerFrameHandler, whats the best way to share data that gets updated every execution. I am trying to get the last position of a projectile when ever it impacts something and currently I just save the position using getVariable and setVariable
inside the _args array
but isnt that always the same value everytime?
yes, it passes the same array everytime
which is why you can just put it there and it'll stay there
currently I just save the position using getVariable and setVariable
that's not supported in 2.08
whats the best way to share data that gets updated every execution
an array
onEachFrame {
{
_x params ["_projectile", "_lastPos"];
// blabla
} forEach my_projectiles;
};
my_projectiles pushBack [_projectile, getPosWorld _projectile];
Okay I think I understand
oh I didnt mean get/set var on an ammo if that is what you mean
I meant the player, should have mentioned that
does that mean in the future arma will allow?
how does that even work? 
a player can have many projectiles in the air
yes. 2.10 update
you can also just reuse the PFH's _args array, instead of making a new one
yeah that works too
Okay I will take a stab at that
dang must have missed that, I know 2.10 has the freefall command to change that
2.10 gonna be wild
Okay cool that worked, lowkey didnt know the values inside the _args array could change, assumed they where always the same from when the pfh started
can someone maybe look at my code and see if they see any error in it.....
[] spawn {
_spawnPos = [player, 300, (RANDOM 360)] call BIS_fnc_relPos;
_spawnPos = [_spawnPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
isNil {
_spawnedVehicleArray = [_spawnPoS, 180, "CFP_O_TBAN_Offroad_Armed_01", EAST] call bis_fnc_spawnvehicle;
_veh = _spawnedVehicleArray select 0;
_veh setDir (_veh getDir vehicle PLAYER);
_vehCrewsGroup = _spawnedVehicleArray select 2;
_wp = _vehCrewsGroup addWaypoint [getmarkerPos "Alta", 180];
_wp setWaypointType "DESTROY";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
};
};
```sqf for highlighting
why isNil?
reused code from prev.. i am not great at code... should i take that out
to make it unschd
wat?
can you edit your block with ```sqf highlighting
if you don't know what something is don't touch it
DESTROY waypoint with position is maybe not a good idea.
is there a script that saves vehicles that spawn? I'm using exile mod and trying to have persistent vehicles
is there a reason to do this rather than [] spawn if you don't need the return?
Otherwise some other script might start messing with the vehicle before you finished the setup.
I'm not sure if it prevents engine interruption or not.
I'm not sure if it prevents engine interruption or not.
that's the idea
Ideally you do the spawn and setDir before a simulation step.
preventing engine interaction (no simulation)
I don't understand what you mean
Oh, I guess that's why unscheduled loops are capped to 10k iterations :P
isNil makes it unschd
spawn makes it schd
mixed up scheduled and unscheduled, disregard
only while
hmmm very interesting. gonna think of some ways I could impliment that
forgive me if i'm wrong here but can't you use profileNameSpace to save an array of vehicles to file and retrieve it on init
yeah, saves to [profilename].vars.arma3profile.
(with some caveats)
If you're dumping data in there then you should be a bit careful about it though.
e.g. [_classname, _position, _direction,_damage,_ammo] as subarrays
Make sure your var names are properly unique and ideally don't get orphaned.
I'm not the best at scripts so is there a script that already exsist?
Usually the trouble there is that you don't want to save every vehicle.
probably somewhere but I've found some horrifying sqf code through google searches
my exile server already spawns vehicles but they disappear on restart, and players lose all their items that were in it.
Also saving container contents is pretty complex.
I could've sworn i saw something last night.. but can't find it again
you could do something like add a "GetIn" event handler to players to assemble an array of vehicles that are actually used
then run a fat script before shutdown to get position and inventory data and such for vehicles that are still alive
inventories would probably be the most annoying to deal with as john said but i don't see why this can't all be saved and loaded from one big old array
Hi guys a quick question how can i recursive call a fnc if i have a fnc that is in folder Fnc. named fn_name.sqf and in description.ext is defined ? do i call it TAG_fn_name anyways or is that not a right thing to do ?
TAG_fnc_name*
Hi guys a question i have a question how can i make a fnc that adds time to timer script that i have code:
params ["_time"];
while{_time > 0} do {
_time = _time -1;
hintSilent parseText format ["Safe start:<t color='#FFFFFF'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
if(_time <= 20) then {
hintSilent parseText format ["Safe start: <t color='#f0b411'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
};
if(_time <= 10) then {
hintSilent parseText format ["Safe start: <t color='#821919'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
};
sleep 1;
};
hintSilent parseText "<t color='#299c14'> Mission is a GO!</t>";
Wondering if anyone knows where I can see my mod's custom functions using Splendid Config viewer in-game... I'm trying to test and see if my custom mod's custom code was pre-loaded. I see the mod's icon in the game main screen. Nothing in cfgFuncitons.
but my mod includes a cfgFunctions.hpp which defines a class called cfgFunctions and the specific names of the functions i've created.
not sure if that's enough detail
i cant even get this thing to start recording, and ive watched a video on it
rec = [player1, 120, 35, true, 2] spawn HLF_fnc_infUnitcapture;
did you define the function?
should be under configFile >> "CfgFunctions" >> "TAG"
alternatively use the Splendid Functions Viewer, it should be listed there too
do you mean you want to modify the _time variable from outside the while loop?
put isNil "HLF_fnc_infUnitcapture" in the console and if it returns true then you did not define it correctly
hum
how does one define things again
I got all the stuff on the mission folder that he had in the video
Yea so i want ability so i can add or sub time
then you need to make the variable acceisble from outside the while loop. the most used way would be to make it a global variable
//[getWeaponCargo,getMagazineCargo,getItemCargo,getBackpackCargo]
//[[classes],[counts]]
{
_x params ["_classes","_counts"];
private _idx = _forEachIndex;
{
private _cargoInput = [_x,(_counts # _forEachIndex)];
switch _idx do {
case 0: { _veh addWeaponCargoGlobal _cargoInput };
case 1: { _veh addMagazineCargoGlobal _cargoInput };
case 2: { _veh addItemCargoGlobal _cargoInput };
case 3: { _veh addBackpackCargoGlobal _cargoInput };
};
} forEach _classes;
} forEach _cargoData;
``` let's say hypothetically I'm attempting to create a persistent inventory. I notice that this does not account for things like items within backpacks within the inventory. How would I go about retrieving these?
Super helpful. I notice that my TAG is missing from the list.
myName = "CarpetShark";
class CarpetShark {
class adminMenu {
class isAdmin {};
class openMenu {};
class playerToggleArsenalMenu {};
};
};
};```
what about Description.ext?
that's what I'm dealing with.. but it doesn't show the tag (I'm anticipating it would be "CarpetShark") under cfgFunctions.
It's a mod, not a mission/scenario - does that change your question? I'm pretty new to this.
referring to skullblits's issue
ya that did it. but he didnt fire π¦
do you have a CfgPatches?
Maybe it doesn't work with rpgs
that complicates things
No I donβt .. is it required?
If nearestObjects doesn't find anything matching its parameters, does it return an empty array?
yes, what else?
That's what I assumed, but I wanted to check just in case. Sometimes things return nothing or other strange things.
@open fractal thank you
That being the case, how does this cause an undefined variable: _overrideTarget?
_overrideTarget = objNull;
_overrideTarget = ((nearestObjects [_x,["C_Hatchback_01_Sport_F"],400]) select 0);
if (!isNull _overrideTarget) then {```
that code could throw a zero divisor error when the nearestObjects array is empty
According to the nearestObjects page, it's supposed to be fine if the select index is equal to or less than the size of the array
(well, returns nil, but not zero divisor)
((nearestObjects [_x,["C_Hatchback_01_Sport_F"],400]) params [["_overrideTarget", objNull]];
``` is how i would do it
yes but is there a guarentee that a hatchback is within 400 m?
No. In fact, at the time that I'm getting the error, there definitely is not a hatchback within 400m, so nearestObjects will return an empty array. But select (this is what I meant to say before) is supposed to just return nil if you use an index equal to the size of the array (i.e. index 0 for array size 0) rather than zero divisor.
_overrideTarget = ((nearestObjects [_x,["C_Hatchback_01_Sport_F"],400]) select 0);
if (!isNil "_overrideTarget") then {
wouldn't you want to check for nil rather than null ?
I did originally check for nil and it still gave an undefined variable error. The null stuff was meant to make sure the variable is definitely defined first.
no select should throw an error when accessing elements that are not there
If it gave an undefined variable error, then you probably did !isNil _overrideTarget instead of "_overrideTarget"
Then someone (KK π€) was not telling the truth on the select wiki page:
Usually when select tries to pick up element out of range, Arma throws "division by zero" error. However there are exceptions. Basically as long as index of element you are selecting is less then or equal to array size, you will get no error.
[] select 0; // ok, result is nil
[1,2,3] select 3; // ok, result is nil
[1,2,3] select 4; // division by zero```
...That is probably the case, yes.
i swear to god KK, I am firing up arma now
regardless isNull won't work with an undefined variable right?
that too
You cant pass a variable if it is an undefined variable sooo..
This was the problem
huh KK is right. what a weird behaviour
You ll do that forever. Im still doing it too :P
You wont get used to it 
That's the best link. Thank you. It spells the whole process out rather nicely. @distant oyster
also thank @little raptor for writing that tutorial π
Is there a way that I can put in the debug console in the editor iterate over a particular classname and replace it with something else? KAT Medical updated and added their new stuff to the Advanced ACE Medical and I need to replace the ones already in my mission with the new versions. I would usually just hand place them again but there are, like 80 of them, set in buildings spread through-out a city.
there is all3DENEntities
You can multi-select the relevant objects in the left panel, rightclick > attributes and at the top change what type of object it is (or change the inventory for all of them)
or open the mission.sqm in a text editor and find & replace the classnames :U
has anyone ever managed to automatically run tests on PRs for arma sqf?
Hey Guys i need help how can i make the script that says the timezone of each member in server and time goes?
i think i've asked this before but I don't remember if I did
time zone is simply the difference between systemTime and systemTimeUTC
see:
Hi question how can i remoteExecute this line of code ?
hintSilent parseText format ["Safe start:<t color='#FFFFFF'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
you should make a function and remoteExec that function
Any ideas on why my custom addon is not finding a script? It's definitely inside the PBO file. I suspect the issue is Addon Name? ..
when I browse for the function in the function browser of Eden, I notice that there is no Addon Base
but I know that the PBO manager is including a PBOPREFIX of "CarpetShark", because of this:
yea, I am probably missing something stupid and fundamental.
what is your CfgFunctions?
myName = "CarpetShark";
class CarpetShark {
class scripts {
class toggleArsenalPlayerMenu {};
};
};
};```
then your function should be in CarpetShark\functions\scripts\fn_toggleArsenalPlayerMenu.sqf
if you want to keep what you have, you should change your cfgFunctions
trying to match file structure with function definitions is hurting my brain
class cfgFunctions {
myName = "CarpetShark"; //<- what is that?!
class CarpetShark {
class scripts {
file = "CarpetShark\scripts";
class toggleArsenalPlayerMenu {};
};
};
};
^ that works with your current structure
I have no idea what myName is, I picked that up from another tutorial and populated it with my nickname
I'm getting an invalid number in expression error in my respawn script that tries to have the unit respawn in a certain uniform. Can anyone help me out and see what is causing the error?
Says the error is on line 5 where the addUniform is but I can't figure out the problem.
waitUntil {!isNull player}; unit = player; removeUniform unit; sleep 1; unit addUniform βU_I_CombatUniformβ; if(true) exitWith{};
how are you calling the script? are you running the script scheduled?
it's in onPlayerRespawn.sqf
And it fires off up until the add uniform line. It removes the uniform but then errors out
remove the last line if(true) exitWith{}; You have no reason to exit unless you are nesting
hmm from my test sleep should not be a problem, the respawn event script is scheduled
Took it out. Still not working.
I think the problem is pretty definitively on the addUniform line.
I even tried forceAddUniform. Got the same thing.
try commenting it out then
hold on, are those your actual quotes? they should be: "
this has the potential to end careers
Hi folks. I have a helicopter with two door guns. I send AI to take both spots. One side is the βgunnerβ spot, and they engage targets at will. The other side is a βturretβ spot, and they do not engage any targets. Is there a way to make a turret spot another gunner spot using code? Or is there a way to make a turret unit act like a gunner unit?
Yeah
Correct
I am using SOG helis if that makes any diff
Get in the turret slot yourself and check that you can shoot.
I can shoot from the positions in question
Should say .. AI is not in my own group
I can't say I've noticed AIs being hesitant about shooting from turret positions, although I suppose they might be waiting for the squad leader to assign them a target or something.
Ah right maybe .. thatβs a good lead .. I will explore that
Can a vehicle have more than one gunner do you know? Or is it always just one?
Gunner as in βgunnerβ
Strictly one gunner, I think.
Ah I thought so .. thanks
What combat behaviour and mode are you using? Default aware + yellow?
I have not set that .. but another good call
In my tests I used a Loach .. the door gunner spot is not the gunner (gunner is co pilot). So if I point the nose at opfor, the CP gunner shoots away (with lethal accuracy). But if I turn so the door gunner can get a shot, they just donβt engage at all. Both door gunner and CP are in the same group.
But maybe the group leader is the CP and had not given the order to engage β¦ as I think you are suggesting
I'm expecting busted config and/or Arma bugs really :P
Another test was the UH1D .. right side lights up the enemy, left side does not
but you'd have to try different behaviours and helis to be sure.
Vanilla ghost hawk has a door gunner on each side, might be an interesting test.
Yes!
I will do that tomorrow
I know that the PF guys are updating the heli configs .. so maybe this is a PF issue, I was only testing with those assets. Should have thrown a vanilla in there too .. good shout
Thank you for taking the time to consider my little problem π
I'm still struggling to get my simple, single script to load from my scratch-built add-on. Anyone have experience with this error message:
This is what's in myConfig.cpp / CfgFunctions:
class CarpetShark {
class scripts {
file = "CarpetShark\addons\scripts";
class toggleArsenalPlayerMenu {};
};
};
};```
I'm trying to zero in, and I think I have not properly configured the addon's path.
if in config, <ROOT> means the game's root directory. The addon path needs to be set manually.
Does anyone know how to manually set the addon path? Is that something done during game startup?
also .. I have removed the \addons substring
You usually use a $PBOPREFIX$ file
yea.. I've got that setup now...
what does your folder structure look like?
yikes
I would recommend using mikero's tools or hemtt or even Addon Builder
mikero's tools has the added benefit of checking for errors
yes, that's good advice for sure. I was really hoping to get this from first principles so I truly understand how it works.
I feel like I'm really close too! the namespace shows up in the function browser, as does the TAG, the sub class and the function itself, just the SFQ can't be found
so it's got to be a path resolution issue I'm thinking
check out this repo: https://github.com/arma3/Biki-Mod
nice is that a working example?
this is an example which uses hemtt but should work with mikero's
You will find the following $PBOPREFIX$:
x\biki\addons\functions
``` this means that the function from this folder can be loaded with
```sqf
loadFile "\x\biki\addons\functions\Strings\fn_regexFirstMatch.sqf"
``` for example
that's super helpful
and to spare you macros:
class CfgFunctions
{
class BIKI
{
class Config
{
file = "\x\biki\addons\functions\Config";
class configDifficultySettings;
};
``` from https://github.com/arma3/Biki-Mod/blob/main/addons/functions/CfgFunctions.hpp
right.. do you understand the "\x" prefix?
I think I'm setting the PBO prefix incorrectly
I have an object I want to throw at a point. I need to get the vector from the object to the point. How would I do that?
This is as far as I have gone:
{
_closestDropPoint = nearestObject [(getPosATL _x),"Logic"]; // point object will be thrown at
_relativeVector = (vectorDir _closestDropPoint) - (vectorDir _x); // relative vector between object and point ?
_x setVelocity (_relativeVector vectorMultiply 5); // throw object at point
} forEach _objects;
I hear you - use MikeRo or other tools .. that's a good last resort
honestly I have no idea what the original intention was. I just used it because CBA and ACE do the same and I copied their file structure. I didn't link their repos because they are more complex. I now use it to quickly switch between testing and release builds
gotcha
@distant oyster I'm going to model my folder structure of Biki and I'll report back
glhf
Do you know what the QPATHOF function does?
yeah its short for "Quoted path to file", it takes some predefined macros and assembled them into a string that points to the folder in the addon. i.e. it just expands to \x\name\addons\category\PARAMETER
you dont really need it
funny story, now I'm getting "Script QPATHOF(Functions)\fn_toggleArsenalPlayerMenu.sqf not found"..
vectorFromTo or vectorDiff depending on whether you want the unit vector.
its QPATHTOF and you'd need the Biki-Mod/addons/main/script_macros_common.hpp file too. but you can just write your path explicitly
now I understand your previous comment
is there any situation in while the file attribute can be left blank?
thats mission exclusive afaik
understood
which vectors do I input? vectorDir of both the point and object?
here I was trying to remember my high school trig
I'm not sure what PBOPREFIX files are supposed to do. As far as I can tell, Arma ignores them entirely and just uses the prefix you set on the PBO.
If you don't set a prefix, it just doesn't work :P
Possibly various addon builders are supposed to use it to set the PBO prefix, but Addon Builder seemed to ignore it.
Thanks a ton, John. I didnt realize I could just put two points.
thanks John .. I'm about to read / re-read this: https://forums.bohemia.net/forums/topic/194414-script-not-found/
I'd like to avoid the use of the PBO prefix for this first go around if it's optional. I'm obviously missing something pretty major
no matter what I do, I am getting the script not found error. will update when I know more
It's not optional
If you're using PBO Manager, don't
Use Addon Builder
ah .. i see
took me a minute to parse your text
I'll try addon builder next
I was thinking I could do this with Sublime and text files
and the vanilla PBO manager
Why did you add an addons path?
What you showed here didn't have an addons folder
and when I tried to add the mod locally, I was told that there were no PBO files in the addons directory
hmm one sec
Does setUnitRecoilCoefficient affect AI? Ai machine gunners tend to fire 99% of their shots uselessly into the sky because of excessive recoil.
@little raptor and @distant oyster here's the repo for the simple 1 function mod/addon..
I'm getting something wrong. I think it's either the $PBOPREFIX$ or the "file = ..." on line 30 of config.cpp
I don't see anything wrong
Like I said use Addon Builder
Also it doesn't use pbo prefix file
You have to set it yourself in options
How does one go about adding a reticle to a helicopter that doesn't have one by default? Or just adding a reticle to your screen while in said helicopter, either would work I'm sure
a mod
Do you know of one that's out there? Or would I need to try making one
I have no idea, maybe #arma3_config may know more about this π
Good call! I'll ask there, thanks
Thatβs where Iβm headed next thanks bud!
Just double checking...
"#particlesource" createVehicle _x;
will NOT spawn a particle system on client machines right?
nvm, for some reason i missed the big blue box on the wiki that says the particle commands are local
When I use addon builder, do I choose the ROOT addon folder? or do I choose sub-folders and repeat for each of the mini-addons contained within?
man .. "script not found"
my life is a disaster right now.
are you referencing a script from another addon?
try using -packonly (uncheck binarize)
no I'm not actually referencing it .. it's more planning for the future. I suppose I could collapse it all into a single set of monolothic folder contents under addons.. just to see
somehow this: "file = "\x\CarpetShark\addons\functions\Functions";" is not translating
from within CFGFunctions..
maybe I should follow a tutorial. Any advice or good youtube videos?
and then there is this guy that brought order to my life...
https://www.reddit.com/r/armadev/comments/hzcnb3/tutorial_creating_a_simple_mod_following_the_cba/
i personally dont, but im using arma dev tools in vscode. i'm sure there is a good reason and i will learn a lesson someday
just re-read the CBA tutorial. it explains why the P drive is needed
You dont need it, you want it
how do I use this?
it seems to have a lot of undefined variables?
btw this is my 5th time asking here without getting an answer strangely, would really be appreciated if you reply
You need to post your code
got it one second
I'm using
BIS_scriptedMoveEnabled = true;
[this, [getpos this, [0,0,0]]] call BIS_fnc_scriptedMove; // in the init of the unit
this is the source code for BIS_fnc_scriptedMove if you are wondering https://sqfbin.com/siyuxumavocacaferovu
What is the error?
its in the source code
It says rPlaymove is undefined
Then RE is undefined
Which line?
Both line 64
rPlayMove and RE are Arma 2 MP Framework things
a note shalt be applied for A3
And I shall live in sorrow trying to find a way to make units walk normally
No
In you repo build the functions folder that is inside the addons folder
You always build the folder that has config.cpp
hey guys, me again, i have been trying to set up ACE medical, however despite having fatal injuries set to never im still being instantly murdered
note added
RE is remoteExec for arma 2 then?
checked it out, just wanted to make sure if there is any important differences between RE and RemoteExec (yes there is but I thought there might be more notes) thanks
now back to work!
Hi again folks, I am trying to get my door gunner to open fire using code, and am using 'forceWeaponFire' as the method. Even though I set the mode to "FullAuto" (and I have checked, this is part of the heli config), the gunner only fires one single shot. Has anyone come across this before?
_pilot = currentPilot vehicle player;
if (player == _pilot) then {
hint "Open Fire";
_heli = vehicle player;
_crew = fullCrew _heli;
_turrets = [];
{
if (_x select 1 == "turret") then {
_turrets pushBack _x;
};
} forEach _crew;
{
_unit = _x select 0;
systemChat format ["_unit: %1", _unit];
_muzzle = currentMuzzle _unit;
systemChat format ["_muzzle: %1", _muzzle];
_unit selectWeapon _muzzle;
_unit forceWeaponFire [_muzzle, "FullAuto"];
} forEach _turrets;
} else {
hint "you are not the pilot and have no authority here!";
};
(triggered from a CBA keybind)
you need to put it in a loop
gotcha
oneachframe {forceweaponfire etc}
I did wonder .. but I assumed as the mode was fullauto, it would just .. do full auto X)
thanks man
Wilco, thank you
is there an equal command to cancel the fire order?
like, in this context
when using the fire commands no, you just have to stop executing the command
in script
kind of both
I have a door gunner, which is not the designated gunner, but a turret
they will aim at the enemy but rarely fire (this AI is not in my group)
ah
so I am trying to use a keybind to force the gunner to fire .. if they are pointing at enemy, then good hits on target, but if there is no target, they will just shoot, which might be nice for ambient effects (shooting treelines while SOG scrambles for EXFIL etc)
Ai do not appear to detect or shoot at invisible targets such as "B_TargetSoldier". Can anybody explain this?
is your AI also BLUFOR?
how do you expect them to go blue-on-blue?
no, invisible target has opposite side
(Which the prefix B_ suggested)
I'm sure I'm using the correct side.
Which is the actual soldier?
when the "real" target is bluefor, I'm creating a "dummy" invisible target on bluefor side.
opfor are meant to shoot at it
but they neither detect nor shoot at it
because it's empty
okay?
create crew for it
so, uh can I create an invisible object that requires no crew?
In arma 2 I could create an invisible target which ai would shoot at. It was of type man i believe.
class zeu_Dummy : CAManBase {
lifted it from zeu ai
However, just putting it in arma 2 and switching out for another model does not seem to work
This_ai disableAI "ALL";can increase server FPS?
tried giving it the same models used in arma 3's invisible targets
depends where the AI are
on the server? yes
clients? not really
well a bit
I would like to execute some code while a key is pressed (left click) and then released, I thought BIS_fnc_holdActionAdd would work but I think thats hard coded to use space bar (well whatever action space bar is defaulted to). Tried CBA_fnc_addKeybind but apparently mouse buttons dont work when held. Any suggestions other then trying out https://community.bistudio.com/wiki/inputMouse
not creating anything in the first place will get you more FPS π
you can use modded keybinding
or MouseButtonDown and MouseButtonUp event handlers
A3 models are not always backward compatible
would MouseButtonDown be called while the button is held?
no
oh wait I see onMouseHolding
no
can I use a model directly from a2 in a3?
there's no EH for doing something "while mouse is held"
dang
AI are on the server. I will make some tests on the editor.
add an Activate and Deactivate events
when activated, initiate an each frame loop (e.g. CBA_waitUntilAndExecute)
when deactivated, stop the loop
@little raptor but it AI is already with simulation off, disableAI can help to make it consume less CPU power?
Okay I think I understand
afaik no
I can tell if something has been held if the activated ran, but the deactivated hasnt ran
or rather is being held
do you know the action for getting the invisible target crew to get into it?
driver?
gunner?
do you still use Arma 2?
createVehicleCrew
_stuff = ["stuff","stuff1"];
["speaker", "text" selectRandom _stuff] call BIS_fnc_showSubtitle;
``` i need random texts combined with predefined text. would this work?
Almost
what should i change
You need either "text" + selectRandom _stuff to combine "text" and a random string, or just selectRandom _stuff to only use a randomly selected string
ah it's no use using those built-in invisible targets anyway. They block bullets as well as unit movement.
there must be a way of making a proper invisible target though.
I see
on my way to find how i could do a per player ticket system, somebody passed me this
unit setVariable ["tickets", 3]
I'm having issues with getting a trigger that is placed in the editor to only fire once when a player enters the trigger. I know this has been covered before, but I've tried everything that I could find and still have had no luck. My trigger has Activation: BLUFOR, Present and for the condition I have sqf player inArea thisTrigger; Then inside the activation I have this: ```sqf
["spawn_0", "site_0", 3, EAST, "East", "OPF_F", "Infantry", ["OIA_InfSquad", "OIA_InfTeam", "OIA_InfAssault", "OIA_InfSquad_Weapons", "OIA_MechInf_Support"]] remoteExec ["jas92_fnc_spawnWave"]; deleteVehicle thisTrigger;
This is what I have for my function: ```sqf
params ["_spawn", "_attack", "_waves", "_side", "_cfgSide", "_cfgFaction", "_cfgUnitType", ["_units", []]];
SpawnEnemies = true;
_wave = 0;
while {SpawnEnemies} do {
_rdmSquad = _units call BIS_fnc_selectRandom;
_grp = [getMarkerPos _spawn, _side, (configFile >> "CfgGroups" >> _cfgSide >> _cfgFaction >> _cfgUnitType >> _rdmSquad)] call BIS_fnc_spawnGroup;
null = [_grp, (getMarkerPos _attack)] call BIS_fnc_taskAttack;
waitUntil {{alive _x} count (units _grp) == 0};
_wave = _wave + 1;
if (_wave < _waves) then { SpawnEnemies = true } else { SpawnEnemies = false };
};
If anyone could help that would be greatly appreciated, thanks.
and⦠what's the issue?
The issue I'm having is that everytime a new player enters the trigger area, another group of ai spawn
well, yes
- you did not make the trigger server-only
- you set the trigger to spawn someone everytime a player enters it
So if I was to do this where would I put the command? Would it still be in the onPlayerRespawn or somewhere else?
solution:
- make the trigger server-only
- make the trigger condition "a player in list"
(isn't there a "ANY PLAYER" option?)
There is an option for any player, and is it really that easy, just set trigger to server only, then in the condition a player in list ?
not literally that π but yes
isn't there a "ANY PLAYER" trigger option instead of BLUFOR?
Yep there is an a dropdown in the trigger Activation: "ANY PLAYER"
if all your players are BLUFOR, just use this
(and the default trigger condition, ofc)
The player script command refers specifically to the player of the local client. Since the trigger was not server only, a copy existed on every client, and that copy would activate when that client's player entered the area. All the other copies would remain ready to activate when their client's player arrived.
Setting the trigger to server only, any player, means there's only one copy of the trigger, and that copy will activate when any of the players enters it.
Note: although you just need ANY PLAYER and this as your conditions here, in many cases you can use in thisList instead of inArea thisTrigger for a similar effect.
Local triggers with local conditions can be useful when you have commands with local effect (for example, displaying a hint when the local player enters an area) but you have to be careful.
So from what I'm gathering I need to set trigger to "ANY PLAYER", condition to "this", serverOnly, and then in the activation field put my remoteExec in?
hey, how would i know which texture was set for the image?
_randomColor = selectRandom ["images\Blue.paa","images\Brown.paa","images\Green.paa","images\Red.paa","images\Yellow.paa"];
image1 setObjectTextureGlobal [0,_randomColor];
i mean if i want something like this:
if (image1 == blue.paa) then {hint "image1 has blue color"}
ye
just, why would you remoteExec it to all clients
it would run it as many times as there are clients
but that gives me the path to the whole folder like:
c:\users\xxx\documents\arma 3...
how can i use that in an if then code?
So I can just use [] spawn jas92_fnc_spawnWave; in the activation field?
what about your arguments?
So it would be? ["spawn_0", "site_0", 3, EAST, "East", "OPF_F", "Infantry", ["OIA_InfSquad", "OIA_InfTeam", "OIA_InfAssault", "OIA_InfSquad_Weapons", "OIA_MechInf_Support"] spawn jas92_fnc_spawnWave; deleteVehicle thisTrigger;
I gueeess
I'm not quite understanding the question. So if I just need a trigger that is activated when a player enters the area and then spawns my function wouldn't the trigger must need to be setup with activation: "ANY PLAYER" conditon: this and then activated: [] spawn jas92_fnc_spawnWave;this would have the params needed for my function.
in activated, you put what you want
and regarding your function, that would be it
okay got it working like this:
if (image1 == getMissionPath "images\Blue.paa") then {hint "image1 has blue color"};
(with an additional ] btw)
that doesn't work, atleast if image1 is an object like in your previous post
Thanks for all the help, I'll definitely give it a try once I get home from work today. If it all works then I was overthinking everything way to much, lol
here you do:
- the server (is the authority, the "arbiter" of the situation) detects a player in the area
- the server runs the script locally and creates the unit
- the game engine synchronises all created units to connected clients
- ????
- profit
edit, you're right it does not work.
but it's recommended not to use string path to compare
you could e.g setVariable on the object
took me a while but i think i got it working like this:
getObjectTextures image1 select 0 == getMissionPath "images\Blue.paa";```
yep
still not recommended π
how likely is it for hashValue to return the same value for the same type of vehicle in 2 different scenarios?
1 in 10e999 something?
their hash being based on their netId
https://community.bistudio.com/wiki/hashValue
it has nothing to do with type
as Lou pointed out, it depends on netID
both vehicles having been created with createVehicle
yep
so i just did hashValue _vehicle + hashValue systemTimeUTC to keep track of individuality
just to generate a token that is saved for later use
this should make sure that it is highly unlikely for 2 vehicles to end up with the same hash value
Using double double quotes incorrectly probably.
ohhh thanks gonna try fixing
Just posting my question from yesterday again to see if anyone is aware of a "custom formation script"? What I am aiming for is to have a script which allows me to position my AI squad somewhere around the player -> execute the script to store their location relative to the player -> and when I ask them to return to formation they would keep the relative position to the player while moving. For example I could position the AI just in front of me, the script stores the formation and would keep the AI in that formation while the player is moving.
is there a way to tell if a script is running in an object init context or a zeus placed objects?
this vs _this sort of issue
actual question: is it safe / correct to use the object init section in a composition, and how can I ensure it functions for my zeus operators?
is it safe / correct to use the object init section in a composition
Safe? Yes, so long as you know what the script does.
Correct? Depends.
- Object inits are executed globally and for JIP. Whether this is what you want to do depends on the script.
- If you are repeatedly calling the same code you may want to define a function in CfgFunctions and call that instead.
how can I ensure it functions for my zeus operators?
diag_log? diag_activeScripts? systemChat? same way you debug any script
if I place the composition in the editor while making the mission, it works.
If I place the composition via zeus in a running mission, it does not work
not sure, i'll have to go check
no instance of it in the mission, so the default
which prevents init, ok, that makes much more sense now
Can comeone help me change this code so that it spawns a random qty of up to 5 of the planes
[] spawn {
_spawnPos = [player, 1500, (RANDOM 360)] call BIS_fnc_relPos;
isNil {
_spawnedVehicleArray = [_spawnPoS, 180, "sab_fl_bf109e", EAST] call bis_fnc_spawnvehicle;
_veh = _spawnedVehicleArray select 0;
_veh setPosATL (_spawnPos vectorAdd [0,0,180]);
_veh setDir (_veh getDir vehicle PLAYER);
_veh setVelocityModelSpace [0,150,0];
_vehCrewsGroup = _spawnedVehicleArray select 2;
_wp = _vehCrewsGroup addWaypoint [player, 180];
_wp setWaypointType "DESTROY";
_wp setWaypointLoiterType "CIRCLE_L";
_wp setWaypointLoiterRadius 250;
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
};
};
you can put it there.
[5] remoteExec ["skipTime", 2];
you need to be more specific
the code calls for spawning an enemy plane... i would like it to have an option to spawn between 1-5 planes randomly choosing a qty
why are we spawning this then making it back into unscheduled?
in the same location? doing the same thing? random locations?
i was asked that yesterday... it was code that i pulled from another mission a friend of mine made
there is not a script for that afaik. you'd have to create one yourself. and honestly, it looks more applicable for a FSM
does anyone know why it is returning this error ? I've done everything according to the setVelocityTransformation wiki page. The code : ```hint "Activated";
pos1 = getPosASL wagon1;
pos2 = (getPosASL wagon1) vectorAdd [0, 75, 0];
bob switchMove "ladderCivilUpLoop";
onEachFrame {
wagon1 setVelocityTransformation [pos1, pos2, [0, 0, 0], [0, 0, 0], [0, 1, 0], [0, 1, 0], [0, 0, 1], [0, 0, 1], moveTime bob];
};
bob is the player and wagon1 is the object i'm trying to move
can you translate that error for me? π
i thought it would be quite obvious, hold on
basically it means error type any, expected array
I mean what could go wrong with a simple getPosASL
what I just realized is that I'm retrieving the position of the trigger instead of the object
i just gotta swap it
but i'm not sure it will fix the issue
[] spawn {
for "_i" from 0 to (floor random 5) do {
private _spawnPos = player getRelPos [1500, random 360];
private _spawnedVehicleArray = [_spawnPoS, 180, "sab_fl_bf109e", EAST] call bis_fnc_spawnvehicle;
private _veh = _spawnedVehicleArray select 0;
_veh setPosATL (_spawnPos vectorAdd [0,0,180]);
_veh setDir (_veh getDir vehicle PLAYER);
_veh setVelocityModelSpace [0,150,0];
private _vehCrewsGroup = _spawnedVehicleArray select 2;
private _wp = _vehCrewsGroup addWaypoint [player, 180];
_wp setWaypointType "DESTROY";
_wp setWaypointLoiterType "CIRCLE_L";
_wp setWaypointLoiterRadius 250;
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
};
};
``` if you need help
I guess it could also be moveTime
if there is no RTM animation playing, will it return something?
yes
update: surprisingly enough the issue was indeed the position
most likely wagon1 is not defined
or it's not an object
well it is, since it works now
can triggers return positions?
yes
if it doesn't it would probably explain the problem
then I have no idea why it didn't work
he mentioned his error was expected array got any though
yes. when wagon1 is not defined pos1 and pos2 fail
and become nil
well it used to be this until he changed it
yeah
sorry for making it confusing lol @little raptor
well if it was also being used in the onEachFrame it wasn't defined there
well if it was in a trigger, it would have to be thisTrigger anyways
yeah
instead of this, so this was still undefined, so yeah I see what you're getting at
thisTrigger?
so that's how you access the trigger?
interesting
I see. Will have a look at FSMs. Thank you
thanks for the help i will give that a try
worked like a charm @open fractal thanks
yw
["Primary", [5], "", -5, [["expression", "[units player - [player], execVM ""Primary.sqf"""]], "1", ""]
Getting an error saying Primary.sqf missing when executing the command from the menu. Does anyone know why?
is the path correct? and does the file exist?
yes
why do you have multiple "" inside each other?
you need to use ' instead if you are quoting inside a string
or whatever the opposite is that you have, in your case '
The quotespam is a valid if unreadable alternative.
very well lol
hm i see
well the problem if it says its missing is either a path issue or an existence issue
so make sure you are loaded into your mission and not just a unsaved mission
tested with a different file
same error
the file is definitely there
i guess it is something wrong with the code above
try just executing the file by itself first
What's the context of this code?
i thought that was what you were already doing?
so its someone elses code then?
your brackets are wrong
Leopard was helping me
just count them
let me check again
yeah there's one missing, but I'm not sure where exactly without the context :P
if you simply put your cursor on a bracket Notepad++ will tell you if a bracket has a match
and where it is
or use VSCode with bracket pair colorization turned on
I thought I fixed it now but still getting an error
["Primary", [5], "", -5, [["expression", "units player - [player], execVM ""Primary.sqf"""]], "1", ""]
This is what I have
Thought the brackets are correct now
But that doesn't seem to be the case
If that's a commanding menu entry then the last element should be "0" or "1" for a start.
The expression part should actually be an expression, and I'm not sure what you're trying to do in the execVM bit but it isn't valid code.
maybe "[units player - [player]] execVM ""Primary.sqf""" if the first parameter to Primary.sqf is supposed to be an array of units.
hmm, maybe the "expression" part really is supposed to be just that. Documentation lacking.
no
this is wrong
should be like this
this is the full code
mymod_fnc_showGameHint = {
MENU_COMMS_2 =
[
["Submenu", true],
["Move", [2], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""CircleStand.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
["Sneak", [3], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""Circle.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
["Waypoint", [4], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5]] execVM ""Waypoint.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
["Primary", [5], "", -5, "[units player - [player]] execVM ""Primary.sqf"""
];
showCommandingMenu "#USER:MENU_COMMS_2"
};
["Special Move","move_key", "Move Key", {_this call mymod_fnc_showGameHint}, "", [DIK_U, [false, false, false]]] call CBA_fnc_addKeybind;```
but now producing an error and i cant open the menu
this is script Primary:
if (primaryweapon _x != "") then {_x selectweapon primaryWeapon _x}ο»Ώ};
forEach units group player;
hint "Switching to primary weapon!";```
Not sure if it works as intended because the menu does not open to execute.
Basically want to make the AI switch to their primary weapon via the menu
because it's all broken
I suggest you start over
everything is already in front of you 
sorry, i am lost. i thought i followed the suggestions
What's the first number for? I assume the second is hours.
[_timeToSkipAsANumber] remoteExec ["skipTime", 2];
//2 indicates send the command to the server (server is 2)
Perfect. Thanks.
So I have a variable that I am setting/unsetting with missionNamespace setVariable [foo, true, true];, which (AIUI) shoudl broadcast it everywhere eventually. But even minutes later, one of the locations where I'm using it (via missionNamespace getVariable [foo, false];, it stays false. Any idea why that might be? This is in MP, DS and two HCs present.
foo vs "foo"
my bad. I am using strings
specifically,
missionNamespace setVariable ["SERHAT_active", true, true];
and
private _serhat_active = missionNamespace getVariable ["SERHAT_active", false];
These are straight c&p from the mission
Are you only setting it from one location?
Yes.
The code in the first paste is running in an ACE addaction which is associated with one in-game object.
basically a SERHAT object with that action added and nothing else.
An addAction specific to one client?
The addition is running in the object's init, but I suspect the actual action-when-triggered might run on a client
Are you ever setting the variable to anything other than true?
in the remoteExec entry on the wiki it say 2 will send it just to the server, should I use 0 instead, as that will send it to the person who executed it AND the server?
The object is placed editor-side, so I would suspect it to be local to the server.
@deep loom Nah, skiptime is global effect when executed on the server.
skipTime should be only server executed
It's basically a toggle, true for "turn on SERHAT" and false for "Turn off SERHAT"
Roger.
I am the only player during testing, so it's not racy with multiple people interacting with it
If I wanted to do a hint message to go with that and I want everyone to see should I still use 2 for that as well?
[0,-2] select isDedicated
just use remoteExec without arguments
@mellow scaffold No idea then. Should work.
I had to stop testing for now since others are using the server. The code worked locally, so I am pretty sure it's some sort of locality issue.
I'll do more testing tomorrow and report back
start two game clients at once
Intriguing idea.
just hit the play button again
With two clients, the var (as seen in the debug console) seems to sync within <1s
I -suspect_ the HC is the linchpin here, so I'll dive into that tomorrow.
I have not. I always just wrote my own intro thingys
scratch
but for that, like all things UI, I'd probably do that all locally
Hey, important question
Are backpack objects, objects?
Want to use a trigger that detects when a certain backpack is/is not inside of its area
Is this possible?
yes they are and yes you can
so im doing an op where the players start off in a c-130 and they parachute out the back, like in immersive halo mod. i got the part where the plane remains stationary until players jump out and then the plane flies off. but, i want the players to basically be flung out the back with some inertia, but i cant figure that part out
anyone got any ideas?
are they being kicked out, or are they leaving themselves?
theyβre leaving themselves
theyβre standing in the plane which is being attached to an object on the ground
theyβre not sitting in it
oh... so like you're teleporting them into the air?
leopard it actually works because i got it from a mod
and so the engines are on, plane remains stationary, and simulation is also turned on
they start in the cargo bay
yes but how are you getting them into the air
?
wdym
so the plane is already in the air, suspended in motion if thats what you mean
and when they're ready to jump out, they just walk off the ramp
i thought you said they were on the ground lol
np its like 4 am so my english is pee pee poo poo
so basically speaking heres a timeline of events
- players start in the air inside the c-130
- ramp opens and they jump off
2.5 when they jump off, the plane detaches from static object, allowing it to fly away - the players are flung away from the aircraft due to inertia
- players land
3 is where i need help
because, when players jump off the ramp, they just drop like they're in a hot air balloon
Hence my 
i have seen it done
Not because it doesn't work
basically the uhhh idea, came from immersive halo mod, but you need to set everything up before hand on the ground
Don't the players wonder why the plane doesn't move?! 
but i want the set up already done, and players start in the air
they cant really see, they're 2000 meters in the air, with clouds
and when they jump off, plane starts moving
You can simply use an event handler or loop to check the player animation
an Arrowhead mission was like that iirc
Once they're in halo pose, do a setVelocity which throws then in a vector towards the back of the plane
you can use velocity to get the velocity of the plane itself
The plane is stationary
Attached
so i put a trigger inside the cargo bay, when all players left, plane is detached and begins flying
do you want the player to have the velocity of the plane or be thrown out the back
the players to have...well hard to explain
Out the back
basically, when you paradrop in game the actual way you get some inheritted(?) inertia from jumping out said plane, i want to do that
you could set the velocity of the players to that of the plane as soon as the plane starts moving
i think this is probably what i wanna do, but i dont know event handlers
so rip me :p
it'd be hard to do in an immersive way since you want to have the players jump out with inertia like the plane is moving but it's not
not necessarily jump out with inertia, but just get the feeling of being flung out is good enough
i played in a mission where this is the case
and i think leopards method is whats used
cuz the moment i walked off the ramp i immediately got flung out the cargo bay
it is likely, thats what happened
Like I said you can do it with a loop too
For the velocity, you can do
player setVelocity (plane vectorModelToWorld [0, -10, -2])
The loop can be:
waitUntil {"halo" in animationState player}
God I hate mobile discord
they really need to make discord ti-84 honestly
anyways
so where about do i put this in?
The event handler:
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_this#0 setVelocity (plane vectorModelToWorld [0, -10, -2]);
_this#0 removeEventHandler ["animStateChanged", _thisEventHandler]
}
}]
I'm tired from typing all that on mobile π€£
im sorry to hear π
Just put this in initPlayerLocal.sqf
Then test
Be sure to change plane
it'll most likely be plane1
@limber crypt thats going to depend on who is doing the talking, and what theyre going to say, and to whom.
I mean, not really, but its good to keep those things in mind.
If youre using the basic chat system, then itll be something along the radioChat lines: https://community.bistudio.com/wiki/sideChat
If you want to do something more subtitle-y or longwinded, Id suggest https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_playSubtitles .
The former will display once, but getting another dialog to trigger after it will require a little configuring in your trigger. The latter has a built in delay mechanic, but requires a bit more setting up itself.
yep, its works! hey just to be sure, this does work in mp correct?
also, is there i possibility i can beef up the velocity a little bit? still a little weak but it works
Mess with the values
i assume its these 3 numbers? [0, -10, -2]
is there which one i need to specifically do?
Yes
-10 is speed out back
-2 is downward
the 0?
Guess
Right
If you wanted upward you just put a positive number
ah
well i tried :p
hey i just realized
the eventhandlers actually not working...funny thing is, when it starts out the player already starts in halo for about a second, thus, basically completing the event handler before i could get started
okay so a fair bit of searching has not gotten me anywhere; I'm trying to run a mission and make my players have super-speed and no fall damage;
I found a couple of scripts that work when I execute them locally through Zeus, but putting them in the unit inits doesn't work, executing them in-game removes them on respawn.
I found another thing to use onPlayerRespawn, but I made a file, put the contents in there, still nothing
I'm going to be honest, I know basically nothing about scripts, the extent of my knowledge is just copy-paste scripts from examples and help from other people
is there any easy way to get this set up?
Will you drop your code in here?
sure, should I use like a notepad file or just right in a message here?
I don't think this server will let you drop notepad. I'll show you how to format here.
awesome
allPlayers setAnimSpeedCoef 1.5;
[] spawn {
waitUntil {time > 5};
{
_x removeAllEventHandlers "HandleDamage";
} forEach allUnits;
if (hasInterface) then {
waitUntil {player == player};
waitUntil {alive player};
player addEventHandler ["HandleDamage", {
diag_log text format ["HD: %1", _this];
_type = _this select 4;
if (_type == "") then {
0
} else {
_this call ACE_medical_fnc_handleDamage
};
}];
};
};
so that's the full code so far; first part sets speed to 1.5x, seems to work on AI, and works when I apply it directly to a player in multiplayer
second, larger part is removing ACE fall damage, same thing
if I do a global execute through the debug window or through one of the Zeus execute code modules, both scripts work fine
it's just a matter of applying them where they need to be
Fudge. I can't test this for you, as I don't use ACE. I will have to drop at least that part.
What I meant about showing you how to format here is this:
First, type three of these marks by your tilda key (`). Then type SQF, then hold shift and tap enter. Drop in your code, then do shift and enter again, then do three more of the marks from earlier. If done correctly, your code will look like this...
allPlayers setAnimSpeedCoef 1.5;
[] spawn {
waitUntil {time > 5};
{
_x removeAllEventHandlers "HandleDamage";
} forEach allUnits;
if (hasInterface) then {
waitUntil {player == player};
waitUntil {alive player};
player addEventHandler ["HandleDamage", {
diag_log text format ["HD: %1", _this];
_type = _this select 4;
if (_type == "") then {
0
} else {
_this call ACE_medical_fnc_handleDamage
};
}];
};
};```
allPlayers setAnimSpeedCoef 1.5;
[] spawn {
waitUntil {time > 5};
{
_x removeAllEventHandlers "HandleDamage";
} forEach allUnits;
if (hasInterface) then {
waitUntil {player == player};
waitUntil {alive player};
player addEventHandler ["HandleDamage", {
diag_log text format ["HD: %1", _this];
_type = _this select 4;
if (_type == "") then {
0
} else {
_this call ACE_medical_fnc_handleDamage
};
}];
};
};
Okay, I'm going to look at what I can from this that you gave me.
there it is, sorry about that
Don't apologize, it's hard to know something you haven't been taught.
like I said, both scripts work fine when I can apply them properly, I just need to figure out how the best way to do that is, since like I said, it doesn't seem to work through the onPlayerRespawn.sqf, though I may be missing something from that, I'm not really sure
wow that's a hell of a run-on
I'm checking it out now, but the chances I'll be able to help are pretty low, so don't hold your breath or wait on me.
that's fine, thank you for trying at the very least
How are you phrasing all of this when you put it in the player init or onrespawn file?
the same way I sent it here in chat, directly copied over from it
Your problem is that this isn't working at all when called in those ways or that its effects are gone upon respawn?
well it doesn't work at all, unless I manually apply it to each entity when I'm actually in multiplayer
it doesn't work in the unit init because, presumably, using the respawn method I do it automatically kills and then respawns the character, which stops the scripts
but the onPlayerRespawn is supposed to apply the scripts each time someone respawns and it.. doesn't
Okay, so my simplified version is working when testing on local multiplayer, and survives respawn.
In my onPlayerRespawn.sqf:
WaitUntil {!isNull player};
Player setAnimSpeedCoef 3;
Player removeAllEventHandlers "HandleDamage";
Will a virtual Zeus affect an allPlayers trigger?
I don't know anything about ACE medical, and I'm unsure of the rest of your code. If you explain what it does, then I may be able to actually help.
Oh, shit, I just realized something. I get what I did wrong.
going to be totally honest; I have no idea how that code works, I found it online on a github post, it seems like it may only work for the local player, but I honestly don't know how to (if it's possible) fix it to work for everyone
I forgot the goal was invulnerability. The super speed is firing just fine, and the rest of your code would be most likely to actually create the invulnerability state.
Okay, gimme a moment to test that.
but I want to do a cool thing with the players jumping out of a VTOL without parachutes
so I'm trying to remove just fall damage
Spartan style. I gotcha.
Yeah
I plan on using the Halo mod if I can convince my unit to let me run a dedicated modlist for this campaign, but I need to prove it'd be interesting by running with what we have first
hence trying to script it all manually
that's what that code is supposed to do, since ACE has its own fall damage system, and that code works to remove it
but trying to get it to work, for each player, and stay around after respawn, that's the tricky part
How often are the players expected to do the jumps?
You could potentially get by with a script that just made simple invulnerability for the first X seconds of a new spawn and that would save them from fall damage.
The biggest issue here for me is that I don't know anything about ACE Medical scripting, so anything I do may not apply.
I don't think that'd work, unfortunately, not without getting them to respawn before the mission; the players usually log in like an hour or two before the op to hang out
also, just because I think I'm being dumb; do I need a special kind of file for an .sqf to work?
..I think that may be the problem
You don't need a special kind of file, but what you do need is to make sure the file is file.sqf and NOT file.txt.sqf, so you need to ensure you can see file extensions.
yeah, I just remembered that, it's been a while since I've messed around in the mission file
let me see if that fixes the issues
er, folder
OKAY so the super-speed works, and I'm assuming that should work for multiple people, that code?
This is working for adding super speed and nullifying fall (all) damage temporarily.
WaitUntil {!isNull player};
Player setAnimSpeedCoef 3;
Player removeAllEventHandlers "HandleDamage";
Player allowDamage false;
Sleep 30;
Player allowDamage true;
We may be able to add a catch that temporarily mutes damage while falling or something like that, but this has the unintended consequence of stopping bullet damage during any fall as well. Also, it may not work with ACE Medical.
Yeah, it should. The allPlayer thing works. The stuff I gave you is simplified and maybe irrelevant if your old block is now working.
well the allPlayers didn't actually work, so I tested your version instead and that got working
Oh, okay.