#arma3_scripting
1 messages · Page 672 of 1
Ah, my apologies 😄
I think there is a script that returns all missiles with locking variables
I might run that, see if any work
cfgCount = count (configfile >> "CfgAmmo");
pasteStr = "";
for "_x" from 0 to (cfgCount - 1) do {
_cfg = (configfile >> "CfgAmmo") select _x;
_ammoClassName = configName _cfg;
manCtrl = getNumber (configfile >> "CfgAmmo" >> _ammoClassName >> "manualControl");
if (manCtrl > 0) then {
pasteStr = pasteStr + _ammoClassName + endl;
};
};
copyToClipboard pasteStr;```
this^
ammo_Missile_CannonLaunchedBase
Laserbeam
M_PG_AT
M_Scalpel_AT
M_Scalpel_AT_hidden
Bo_Air_LGB
Bo_Air_LGB_hidden
M_Titan_AT
M_Titan_AP
M_Titan_AT_static
M_Titan_AT_long
M_Air_AT
M_Vorona_HE
UK3CB_Blowpipe_missile
M_Jian_AT
M_125mm_cannon_ATGM
M_120mm_cannon_ATGM
M_Vorona_HEAT
``` returns this, so the missile i was using didnt have locking capabilities 😄
Okay, i found a lot of explosion marks on the floor, so im assuming whats happening is the missiles are spawning on the floor and getting destroyed instantly
so now i need to find how to spawn a missile in mid air
for air: _disM set [2, 1000];
Im not sure if its actually possible the way im doing it
_disM = [2, 10, 30];
_missile = createVehicle["Missile_AGM_01_F",_disM,[],0,"CAN_COLLIDE"];
_tgt = h1;
[_missile,_tgt] spawn {
params ["_missile","_tgt"];
sleep 0.1;
_missile setMissileTarget _tgt;
}; ```
Try giving it a launch velocity
I might need to start from scratch because i copied a rough script and edited it
the script i copied fires an unguided missile 😦
I got it
its working
hell yes
i just started again and it instantly clicked 😄
hi guys, I was wondering if anyone knew of a way to remove an amount of blood, say 500mL, from a unit (using ACE Advanced Medical)? I am thoroughly confused by ACEs magic. Many Thanks!
I dont believe you can REMOVE an amount of blood from someone, but you can injure them using ACE and a little code
Try adding this to a trigger on Radio Alpha
[VARIABLENAMEOFUNIT, 0.5, "body", "bullet"] call ace_medical_fnc_addDamageToUnit;
In this, the first part is the variable name you give to the unit you want to injure.
the second is the amount of damage to do, minimum 0 and maximum 1
the third is the limb, "body","head","hand_r","hand_l","leg_r","leg_l", are all the selections
the fourth and final variable is the type of damage, "backblast", "bite", "bullet", "explosive", "falling", "grenade", "punch", "ropeburn", "shell", "stab", "unknown", "vehiclecrash", are all of the available options
how to make the player look either down or up?
Is there a way using scripts to remove the GPS from a player?
EDIT:
Ive tried
player removeItem "ItemGPS";
player removeWeapon "ItemGPS";
player removeItems "ItemGPS";
and it hasnt worked
In trigger On Activation. What I want is to make alphateam stand up (that works) and than spawn red smokes on object bedna, bednaa and bednaaa. However, all I am getting is General error. Can somebody help me?
units alphateam apply {_x setUnitPos "UP";};
"SmokeShellRed" createVehicle bedna;
"SmokeShellRed" createVehicle bednaa;
"SmokeShellRed" createVehicle bednaaa;
edit: working code
units alphateam apply {_x setUnitPos "UP";};
"SmokeShellRed" createVehicle position bedna;
"SmokeShellRed" createVehicle position bednaa;
"SmokeShellRed" createVehicle position bednaaa;
createVehicle takes a position, not an object
try 'createVehicle (getPos bedna);'
@winter rose youre some kind of genius, any idea how to solve my problem? 😅
As a matter of fact, yes!
You're welcome :sunglasses:
😄
it should be removeWeapon iirc (can confirm in 20 minutes)
See? genius 😛
So player removeWeapon "ItemGPS";?
What do ya know, it worked.
Absolute legend 😄
Heh
But apparently you already tried?
Hehehe - ok @true frigate
odd fellow
!issueWarning @tough abyss spam (don't say your name everywhere when not asked, thanks)
Done.
nice burn 😎
Does anyone know of a way to have a door open by trigger for a building? I have a little rustic cottage that has four doors. I want to open the front door on the front porch, but I have a feeling its going to be a bit more complicated than using the same script for the bargate
there is a "open door" module for this if you want 🙂
Oh? And I'm guessing I can sync a trigger to this module and have it open the door when the trigger fires?
does ARMA3 expose the interia tensor of an object by chance?
I am not sure about what you are talking, but see
https://community.bistudio.com/wiki/Category:Command_Group:_Object_Manipulation
and velocity, addForce etc
oh they don't expose the "skeleton" (if that's what it is)
hmm...bummer
what was the idea?
well, i've written a helicopter flight dynamics model from scratch
so far the addForce function is working as advertised, but addTorque is not
https://community.bistudio.com/wiki/addTorque
This command doesn't follow convention for torque direction, which obeys right-hand rule. To comply, negate all values in the vector.
i suppose I should mess with masses in object builder
I've done that
but it's only applying accurately in a single axis
the roll axis
pitch and yaw don't respond at all
oh, weird then.
so... I know that the hd_warning map marker is this: \A3\ui_f\data\map\markers\handdrawn\warning_CA.paa.
how do I know what the OPFOR o_support image path is?
or for markers in general, how might I go about identifying their corresponding images?
a dive in config I believe
I am ignorant; where is this please?
In the map, I right click, Find in Config Viewer but it does not tell me anything about the marker, never mind possibly an image path
Hello i have question with extension extdb 3. I want to select all data in table, i want write this sqf private _query = "SELECT nom.uid FROM belge_identiter "; private _queryResult = [_query,2] call DB_fnc_asyncCall; would that work ?
This helps me find stuff in my p-drive https://github.com/stefankueng/grepWin
Yes, I am aware of grep, or tools like it. That's not the question. Like actually WHERE do I look to begin mining for these sorts of details?
I need to dive into the A3 PBOs? for instance?
do you have a p-drive ?
with arma 3 unpacked ?
I just would use grepwin and search for o_support in A3 under P-drive and checkout the results. I'm assuming you are using mikero tools correct ?
again I know how to search content, etc. the question is WHERE, WHAT to unpack, if you please, if one is interested in the map marker image paths.
Have you ran arma3P ?
okay, well, let me know when you know what to unpack, where to look. THAT is what I need to know. thank you...
Yeah, I get great response in roll, and looking at the model config all the weight values around the model are the same, so I would expect pitch and yaw response to be the same as roll
But it’s definitely not
I get zero to no response in both pitch and yaw...I may just have to go with add force vs add torque, and then just set the force points far enough from center to get the desired response
Having a P drive extracts (almost) everything ; try it?
I'm trying to help you but you condensing attitude is not going to help, you are asking about a pretty basic thing to find. set up your dev environment correctly and you would not to ask questions about paths.... follow the guide
if you need help with that, Im more than willing to give you a hand.
anyone have any pointers on either an existing snow script that works well in vehicles at speed or ideas on how to make this existing one work? I'm using IMW snow, it creates particles and then uses attachTo to attach those particles to the player. The problem is that I can't seem to make this change offset with speed changing.
hmm okay. so where is the guide? IIRC the last time I tried the guide, it did not work properly.
Could I get help with a really basic thing, could someone direct me (or even happy to chat) how to create and store SQF scripts for use within the Editor and Dedicated Server.
Been recommended Notepad++ but it does not seem to be able to create SQFs, just SQL as nearest. Can someone point in the right direction. 🙂
Think I now have the basic concept of what I want to do, I just want to tidy it up/make it easier to edit specific components.
Thanks in Advance 🙂
I have a youtube video if you prefer attached to my discord account. Here is he guide https://pmc.editing.wiki/doku.php?id=arma3:tools:setup-p-drive mikero has an all in one installer now that makes it simple
Many thanks both, checking it all out now
thanks @spring vigil I think I've crossed at least one hurdle, extracting A3 bits to a project folder to start with
No worries, it’s stupid little things like that that take up time.
I've got the mikero tools also, but I think the default is poseidon
If you go to pm and screenshare I can walk you through it.
takes awhile to extract A3, I suppose, time to grab a cup of ☕
hahah
Just confirming there’s no way to get or set angular velocity?
Amazing. Thanks so much! I see I have a lot of formatting issues as well as some basic programming ones.
In terms of data types spec'd in params, I could find no documentation online about how to spec an array (i.e. in the 3rd data point for that entity) - the biki page just says they're Data Types, and eventually led me to a page that made me try 'ARRAY', 'SCALAR', 'POSITION', or similar ... which of course, didn't work. Is there a page (or a search term I can use) that shows what data types are indicated, and in what way? or are you just using the wrappers ("", {}, etc) to spec?
I had converted pos to ModeltoWorldWorld because I was looking at their two positions w/ debug using getPos and while the x and y seemed correct w getPos, the z for the attached vic was waaaay off after the vic was first positioned. Using ModeltoWorldWorld was my uninformed way of establishing a "pure" measurement.
This worked better! As written, it popped the VIC a couple hundred meters above its attach point - similar to the discrepancy in z coords I mention above. I resorted to a mixed methods:
private _offset = (_VicName modelToWorldWorld [0,0,0]) vectorDiff (plane01 modelToWorldWorld [0,0,0]); Everything is working. Thanks so much for all your help!
@sweet salmon by angular velocity you mean velocity in a directional vector?
for defining permitted data types you write an operator/command that returns it. so if you want to permit a bool, you write true or false or 1==1 if you want to be weird about it. anything that returns the data type you want to permit, but generally you would just write the data type directly, so true,0,[],{},configNull,displayNull etc etc for all the other types
literally just _target setVelocity _velocity assuming you have a directional vector.
if you are talking about rotational velocity, that I do not know.
Rotational velocity of an object in rad/s
@spring vigil Thanks for the help, looks like the extract is going to take quite a while, is it ok if I ping you sometime tomorrow?
beautiful @spring vigil that's just what I needed, thank you. i.e. https://pasteimg.com/image/image.clQJ9
welcome to you both, feel free to ping anytime.
I repost my question : Hello i have question with extension extdb 3. I want to select all data in table, i want write this sqf private _query = "SELECT nom.uid FROM belge_identiter "; private _queryResult = [_query,2] call DB_fnc_asyncCall; would that work ?
Anyone who knows how to enable active radar in a vehicle?
I do not get https://community.bistudio.com/wiki/Arma_3:_Sensors_config_reference to work.
class MyVehicle_F : MyBaseVehicle_F
{
class Components : Components
{
class SensorsManagerComponent : SensorTemplateActiveRadar
{
};
};
};
hmm, so not all the PBOs were extracted, missing some key cartography location bits, i.e. loc_Fuelstation, loc_Transmitter, and such.
is there a way to get the model origin coordinates?
right now i'm using getCenterOfMass, but everytime it moves, so do all the points relative to it
getPos kind of works...
Try getPosASL
Oh. Then modelToWorld
forceWeaponFire doesnt work
no matter what i do
_unit as the vehicle, or the gunner... no matter what
it will not work
going into gunner seat of the vehicle and left clicking still fires the gun
same for bis_fnc_fire
but i need the ability to set the mode
the action "SWITCHMAGAZINE" also doesnt work
for vehicles you're supposed to use fire
fire doesnt work either
if that works just modify the function to take mode
well, it does but not when the player is the gunner
ok
where can i find bis functions under a3?
are they named smart?
fn_fire.sqf
you can also find it in function viewer
@dusty whale functions_f\Misc\fn_fire.sqf
That’s because its in arma 👍
There are other function viewers. 🙂
Hey folks, I want to make a script that activates when an AI changes stance from standing to prone or visa versa. What's better for performance: Using a waitUntil or an event handler like AnimDone (and then checking the stance) - or something else entirely ? This would be built in to an addon, so there's the possibility a bunch of units in a mission might have this applied to them
hard to say
a single waitUntil doing something as simple as stance check won't have any effect on performance
but it may not work "fast enough" for what you want
activation speed isn't a primary concern - thanks!
ok
just make sure to use a SINGLE waitUntil
not multiple
ah is there a big performance cost if they compound?
not performance cost
you'll "hog" the scheduler
so scripts won't run properly
just use a single thread
and loop through the units there:
while {true} do {
{
//...
} forEach some_list_of_units;
sleep 1;
}
of course if what you're doing is fast enough you can still use event handlers.
again a simple check like stance _unit == "prone" won't have any effect even if triggered by hundreds of units at once
you can check the performance of your code
if it's fast go with event handlers
@dreamy kestrel you don't need a p-drive, I find that way too much hassle for most things.
Google "Arma 3 AiO config" and see the BIForums thread and just download the latest one. Thats the whole Arma config in a single text file, just search for any classname and you'll find it in there with its properties, including markers and their image paths
Dedmen, are you using Vscode to open it? If you are how to you get the collapse to work. It always seems like it’s too large and breaks collapse on mine .
yeah the file is too big for collapse
even notepad++ (which is much lighter) can't handle it
Ok thanks ,
just making sure I didn’t have a setting wrong or making another JV mistake. Collapse works for VS2019.
collapse doesn't work for me.
I use notepad++ mostly, but I basically never need collapse
Good point, only reason I suggested Pdrive with unpacking and using grepwin is I like to read Bi’s sqf and configs, basically any references to what im looking for. But that’s more to do with me not understanding sqf. I’m only 1st year into my CS degree and have a lot to learn.
I prefer DokanPbo, unpacking everything is just too much of a space and time waste
Hey, is there any way to minimize or remove the doppler effect with playSound3D?
Anyone knows how to make the AI use the searchlight of the BRDM (GM)?
…playSound?
I thought playSound isn't directional?
Basically I want to play something from an object, but at close range it has this annoying doppler effect which is disproportionate to the object itself
To be more precise, I'd like the commander in the BRDM-2 (GM) to use the searchlight which is accessed from the commander turret. But the searchlight action itself seems to be an "addAction". Anyonce know how to retrieve the name of such function?
Try say3D? (with isSpeech true?)
some one mind to solve this for me: sethcgroups allgroups side west to player
Hmm okay, I'll try that
Would anyone be willing to assist me in setting up loadouts? When spawning I get the spawn selection screen but no options are listed, just loads with default for that role. Here's what I have:
[west, "Alpha1"] call BIS_fnc_addRespawnInventory;
//description.ext
class CfgRoles
{
class Alpha
{
displayName = "Heavy Weapons";
icon = "a3\Ui_f\data\GUI\Cfg\RespawnRoles\assault_ca.paa";
};
};
class CfgRespawnInventory
{
class Alpha1
{
displayName = "Light Machine Gun";
icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa";
role = "Heavy Weapons";
// Exported from Arsenal by Ben, while in virtual arsenal press CONTROL + SHIFT + C
uniformClass = "U_B_CombatUniform_mcam_tshirt";
backpack = "B_AssaultPack_rgr_Medic";
weapons[] = {"hgun_P07_F","arifle_MX_SW_Black_F","Binocular","Throw","Put"};
magazines[] = {"16Rnd_9x21_Mag","100Rnd_65x39_caseless_black_mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","SmokeShell","SmokeShellGreen","SmokeShellBlue","SmokeShellOrange","Chemlight_green","Chemlight_green","100Rnd_65x39_caseless_black_mag"};
items[] = {"FirstAidKit","Medikit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit"};
linkedItems[] = {"V_PlateCarrierSpec_rgr","H_HelmetB_light_desert","ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","NVGogglesB_blk_F"};
};
};
Question- is it possible to delete simple objects once they're made?
yes
use deleteVehicle
Would anyone have an idea as to why a hideGlobal object command with remoteExec isn't working?
[_gift1, true] remoteExec ["hideObjectGlobal", 2]; is what I got here. I tested in debug and put it in an init.sqf and still got nothing.
_gift1 doesn't exist in the debug console
Oh so it's quite literally the object name and not a variable name?
Nevermind! Apparently the underscore was the issue
thanks for the help mate o/
you're supposed to put the classname of the role in role = "Heavy Weapons"; not the display name
So I've tried role="Alpha" Is that what you meant? I get a default loadout, but not the custom one.
does it still not work with the classname?
No dice just yet.
Would anyone be able to help me make a script that only allows a S-750/R-750 to fire when a target is within a certain range?
Cool, thanks for testing it. Not sure what's different on mine.
Okay, I'm getting closer to the issue, initServer.sqf is not being run for some reason. Is there a toggle to prevent its execution? I'm running in multiplayer.
it'll always run
once, on mission start, on the server
unless your file is incorrect
e.g initServer.sqf.txt 👀
e.g bad name, missing }, etc.
It's acting like that (I keep windows showing extensions all the time because I've screwed up the .txt.txt thing so many times).
then check the contents
@severe ravine any news? 🙂
I toggled the multiplayer settings for respawn position and select loadout and it started working flawlessly.
Anyone who know how to edit the config of a vehicle?
that's #arma3_config then 😉
Thanks.
I just think that if an error was able to generate that view, maybe it can be replicated
@green solar for the last time, wrong channel.
do I erase? Sorry, sorry if I offended you, did I use google translator?
for terrain creation issues, use the #arma3_terrain channel - terrain experts are there to help
what is it about then? I don't get it
you want to remove the grass?
you cannot by #arma3_scripting.
I don't think it's possible, but I remembered that terrain error, and I'm thinking about how to replicate it ... I know it's rare and surely impossible
ok, thanks
hello everybody! Can someone confirm that moveTo no longer works with agents? Using code:
(agents #0) moveTo [0,0,0]
will throw error: Generic error in expression.
Using moveTo with units works as expected though...
Complete snippet for reproduction:
_unit = createAgent ["O_Soldier_VR_F", [0,0,0], [], 0, "NONE"]; _unit moveTo [0,0,0];
command setDestination is not working aswell
same error
how would i do this
Remove the GPS and cTab items (i have code for this) for all players
I think it would use
removeWeapon "ItemGPS";
};```
But i dont want to use variable names for everyone
Just tried out all other commands movement related - none of the commands work!
is GPS a weapon? dont think so
No but it works with removeWeapon
does doMove work?
And if they are in a group, you can try
_group1 setSpeedMode "FULL";
_group1 setBehaviourStrong "COMBAT";
_wp1grp1 = _group1 addWaypoint [0,0];
_wp1grp1 setWaypointType "MOVE";```
where would i put this?
{ _x removeweapon "itemGPS"} foreach allplayers
Thank you 🙂
omg, agents are group-less... 😄
create the agents like this
_group1 createUnit ["NameOfUnit", Pos, [], 25, "NONE"];
_group1 createUnit ["NameOfUnit", Pos, [], 25, "NONE"];
_group1 createUnit ["NameOfUnit", Pos, [], 25, "NONE"];
@full swan
ah my bad, i assumed you meant units called agents
nope 😄 actual agents using createAgent
An agent does not have a group or leader
hmm, thats odd
mind if i ask why youre using agents instead of units? they dont react when fired at
it's arcadeish horde survival - agents are not so resource-hungry as units when there is a lot of them. And I don't need them to shoot back 🙂
Alright 🙂
I was able to spawn 300 agents with approx. 20 fps drop - the same amount of units made the game unplayable
the commands just stopped working
even examples from BIKI are not working anymore (regarding agents)
_agent spawn {
_this moveTo getPosATL player;
};
try running this
see if moveTo works
have you tried running any through sqf files?
just play around with velocity
i beg to differ
because it's an unscheduled environment
if you want to use sleep command in debug console, you need to use it in scheduled environment using [] spawn {sleep 1;};
sorry then, not sure how i can help you out :/
15+ years of scripting in arma engine will teach you a lot of things (even the hard way) 😄 😄
yeah I think someone f* something up in the engine since the last update
I found a reddit thread where someone had it working using this
while {true}do {
_randomPos = position player;
{agent _x doMove _randomPos; sleep 1;} forEach agents;
}};```
but if youve already found it
then im just repeating information youve already seen 😄
the issue is that the command itself doesn't like the agent object
it consumes regular units just fine
but give it an agent and it complains
yeah, I just tested an old mission I made two years ago - which uses agents. It's not working there aswell now
thats a shame 😦
yup, confirmed
22:19:12 Error in expression <(agents #0) setDestination [ [4000,4000,0], 'L> 22:19:12 Error position: <setDestination [ [4000,4000,0], 'L> 22:19:12 Error setdestination: Type Team member, expected Object
RPT logs
nothing is confirmed
agents // returns Team Members
so use```sqf
agent (agents select 0) setDestination [4000, 4000, 0];
@full swan better?
(and, I know, it's illogical that agents actually returns Team Members)
it returns the same thing??
okay it doesn't
let me try using the agent command then 🤔
I'll be damned...... It works using the agent command...
You just got arma'd
But they had to change it somehow recently, because I always used agents without "the" agent command
my guess is that you used agent direct references
yeah, as I said before ... 15+ years of experience and I am still baffled many times
well I was using it now aswell - directly the output of createAgent command and it still didn't work
AFAIK, that command was introduced in A2, the whole Team/TeamMember/Agent thing was never implemented as they wanted, and all commands are as they were introduced
and my old work which worked alright when finished long time ago stopped working just now
so they HAD to change something
I will pray tonight for a new engine in the next title 😦 this is just pure trolling now
or you are exhausted beyond recognition and mixed up all your test results 🙃 don't drink and code, sleep then code 🙂
dont drink and code... crazy talk
With a doWatch command for a tank to fire at a target, do i put the doWatch on the tank object or the gunner inside the vehicle?
while {_rounds>0} do {
tankG doWatch (getPos target);
sleep 1;
tank fire ((weapons tank) select 0);
_rounds = _rounds - 1;
sleep 5;
};``` im using this script, which tank is the tank (duh) and tankG is the gunner of the vehicle
idek where its aiming
_objective = 'rhsgref_ins_gaz66_ammo' createVehicle getPos _rndLocation;
_group = createVehicleCrew _objective;
Does anyone know how i can fill vehicle slots with AI 🤔 ?
Yes.
Oke..
How 😄 ?
_unit = "CUP_O_INS_Soldier_AK74" createUnit [getPos _objective, _group];
_unit assignAsCargo _objective;
This adds the unit right next to the created vehicle. but the vehicles start driving and ai not doing shit.
BIS_fnc_spawnVehicle?
Ah wait, you want to fill it with cargo right?
use fullCrew(?) to get empty seats and create units for them
Well with the createVehicleCrew i get the driver, but there is still a spot left next to him.
You got an example?
Not now, I am under the blankets 😄
i see
soo..
Actually, i just need 1 unit in the passenger.
[screenToWorld [0.5,0.5], east, ['CUP_O_Datsun_PK', 'CUP_O_Hilux_DSHKM_CHDKZ'], [], [], [], 0, false] call BIS_fnc_spawnGroup
is there a way to not spawn 2 vehicles right on top of eachother lol
Ill try again tomorrow ,everyone sleeping 😄
Anyone know of a way to dynamically change time? My idea is that I want to have the player to pass through a trigger while riding a helo, and have it change the time after going through a black screen so they don't see the sky freak out and freeze for a moment before it changes.
fadeout for everyone, show some title, skipTime, fadeIn ?
so like titleFadeOut?
wdym?
BIS_fnc_setDate is what you are looking for
Will it work the same way like it does in Zeus where it'll go black and say "whatever hours later" and whatnot?
Worked marvelously, much appreciated mate.
yw 🙂
Out of curiosity, when you use the following:
0 setOvercast 1;
0 setRain 1;
Does it allow for the weather to slowly change and start raining?
Read the doc 🙂
Does anyone know how to eliminate the voting screen for the mission as soon as you load into say a dedicated server I want to pretty much as soon as I load into the server be already loaded into a default mission only to use to select the actual mission file via in the default map useing #missions command
use a class Missions in your server.cfg and -autoinit (or something like that) in the start parameters
https://community.bistudio.com/wiki/server.cfg#Mission_rotation
Hey everyone, got a question about an approach to a problem.
I wish to detect when a player is swimming in a fashion similar to a EH. I know this is possible to be able to do so via the animation EH but it seems that that would be something that would be firing too often as it will continually be firing anytime a player moves (not too sure about any potential performance issue for users as a result). Alternative could be to use a waitUntil with a delay but that is something I would like to avoid if possible.
So the question stands, anyone know if there is an alternative viable method aside from these two that is viable? If not the alternate question would be which of the two would be better potentially better from a performance side?
apart from the animation eventhandler the only alternatives would be a loop i believe, using like surfaceIswater / underwater etc
If I'm using a keydown EH will that only run when the unit that it is attached to hits the specific key in a MP scenario? Especially if that unit is AI being remoted by zeus?
keydown is a ui event, it doesnt have any connection to specific units
I'll prob just use an addAction then
Is there any command to check if a player is leaning left or right?
Thanks
Using this instead
(abs (player worldToModel eyePos player select 0) > 0.16)
im not sure if different player models will break it or not
is there a method to convert world pos ton 8-grid coordinates?
mapGridPosition only does 6-grid
could anyone give me a basic rundown of the major differences between single and multiplayer scripting?
for example would this work player playAction
the important thing is the animation/skeleton, not the model
I only really care if the person is standing or crouching so it shouldnt be an issue
just get the normal position
then get log of worldSize to see how many digits there are
for each component (except Z), if they have equal number of digits, round it
otherwise pad with zeros (on the left)
different animations have different leaning angles
you have to also consider things from a different perspective
"if I do X will it also affect other computers? if so how? do I want them to be affected?"
you have to refer to each command and check their locality
for example, let's consider the command player that you mentioned
who is the player? in a multiplayer game there are multiple players of course.
@little raptor thank you, how do i specifiy in sqf the player that is doing the tihng
like I said you have to read the wiki page for every command to learn their behavior in MP. Some you can learn simply by looking at the Effect and Argument icons at the top of the page. For some you'll have to read the wiki page more carefully:
https://community.bistudio.com/wiki/player
In MP player is different on each computer and on dedicated server it is objNull by default
simply put, whichever computer you execute the command on gives you the player unit on that computer
ok
(and the way you execute a command remotely is remoteExec)
ah ty
@little raptor i guess i should ask then, how am i supposed to check WHO uses an addAction command in mulitplayer
this is my script so far
removeAllActions gen1; player playMove "Acts_carFixingWheel"; sleep 15; scoreSurvivor = (scoreSurvivor + 1); hintSilent str scoreSurvivor; if (scoreSurvivor >= 5) then {survivorsWin = true;};
the addAction code passes the _caller as a variable (which you can get using params)
check the wiki
anyone aware of a way to make AI drag their wounded rather than just ignoring them.
I've seen it once while playing Antistasi, but haven't been able to replicate it since using ace3.
they can't do it by themselves. it has to be scripted
Fair enough. I'll pull my build of antistasi apart and see if I can find the script used to initiate it.
Cheers Leopard
Good day. How to include the defines that are located in another (not sub) folder? 🤔
#include "adminMenuDefines.h" //<= Located in the same folder
#include "userInfoDefines.h" //<= Located in another folder of the same mission
Thank you very much, somehow missed that page 🤓
Hello, needed to set unit animation, but can't understand - which command needed for given unit's animation.
switchMove, playAction, playMove etc... Is possible to somehow check (i mean with script) - which command needed for given animation?
depends
playAction allows you to play a certain move without paying attention to the unit state
for example, you can just use playAction "stop", without caring, e.g what weapon the unit has.
the downside is that some animations don't have any linked actions and can't be played like that
playMove allows you to play an exact animation.
switchXXX variants jump to the first frame in that animation, whereas play variants follow the animation connection/interpolation rules.
if the animation you want to play cannot be connected from the current animation, playMove won't work and you'll have to use switchMove first.
and to check animation use animationState
understood, thank you!
is inRangeOfArtillery supposed to return false if target pos is too close?
yes
hmmm, it doesnt do that for me..
then no 
right
Is that a very small mortar?
it's probably the smallest mortar from unsung mod
I suppose you can calculate the min range yourself from max range
because artillery rounds have no drag. the equation is linear
Maybe so. Try a big one
@little raptor not sure how
I will test a bigger mortar
ok I tested with the vanilla B_Mortar_01_F mortar and it gives false on too close range
its just the unsung mortar that gives true on too close range
and doesn't fire
thank you again, all works now 🙂
used simple script for switch command
the_animDo = {
params [
["_anim","",[""]]
];
player switchMove "";
if (_anim isEqualTo "") exitWith {};
_prevState = animationState player;
player switchMove _anim;
player playMove _anim;
if !((animationState player) isEqualTo _prevState) exitWith {true};
player switchAction _anim;
player playAction _anim;
if !((animationState player) isEqualTo _prevState) exitWith {true};
false
};
["Acts_Ambient_Cleaning_Nose"] call the_animDo;
_position = screenToWorld[0.5,0.5];
_direction = 180;
_logic = "Logic" createVehicleLocal _position;
_logic setDir _direction;
_logic setVariable ["vehicle",'RHS_A10'];
_logic setVariable ["type",3];
[_logic,nil,true] call BIS_fnc_moduleCAS;
deleteVehicle _logic;
Found this custom CAS support but getting generic error 🤔
screenToWorld means you have to aim at some ground, not the sky
ah, you are doing that from the console, right?
cannot sleep in a console, use a spawn around all this 🙂
the |#| tells you where the issue is encountered
yep
this is wrong
therefore, wrap all this in a spawn
aah.
but why?
because of the initial switchMove
and this part makes no sense:
player switchMove _anim;
player playMove _anim;if !((animationState player) isEqualTo _prevState) exitWith {true}; player switchAction _anim; player playAction _anim; if !((animationState player) isEqualTo _prevState) exitWith {true};
i used initial switchMove - to disable animations with ```sqf
[""] call the_animDo;
about:
```sqf
player switchMove _anim;
player playMove _anim;
i though - i need to switch first and after - play, cuz with that - all animations is play's for me
that's not what I mean
is enough - switch (no needed to play)?
no that part is correct, as I already said before (it should be playMoveNow tho)
... playMove won't work and you'll have to use switchMove first.
what I mean is theif !((animationState player) isEqualTo _prevState) exitWith {true};part
and why is it duplicated
actually now that I looked more closely you're using switchAction
little bit changed
the_animDo = {
params [
["_anim","",[""]]
];
player switchMove "";
if (_anim isEqualTo "") exitWith {};
_prevState = animationState player;
player playActionNow _anim;
if !((animationState player) isEqualTo _prevState) exitWith {true};
player playMoveNow _anim;
if !((animationState player) isEqualTo _prevState) exitWith {true};
player switchMove _anim;
false
};
["AmovPercMstpSnonWnonDnon_Salute"] call the_animDo;
switchMove was ok
just change playXXX to playXXXNow
in your older script
understood, thank you a lot!
_missile = createVehicle ["M_Vorona_HE",(player modelToWorld [0,0,100]),[],0,"CAN_COLLIDE"];
_missile setMissileTargetPos getPos cursorObject;
How can i change the direction of the missile 🤔
its only going where i want it to go when im looking at the direction from where he is heading
setVectorDirAndUp
setVectorDIr alone can work too
if up is [0,0,1]
🤔
FNC_casMissile = {
_sendPos = getPos cursorObject;
if(_sendPos isEqualTo [0,0,0]) then {
m_sendPos = screenToWorld[0.5,0.5];
}
_missile = createVehicle ["M_Jian_AT",(player modelToWorld [200,0,200]),[],0,"CAN_COLLIDE"];
_missile setMissileTargetPos getPos cursorObject;
};
How can i make it that when i call the missile it comes from behind me to the object or pos im looking at 🤔
vectorDir you said but not sure how 
why prefix your code with BIS_… this is not your tag
Hey guys, I am a pretty large noob at scripting. I have am looking at having a specific loadout force everytime a player connects to the mission, or dies/respawns. I think I found the correct "script" https://community.bistudio.com/wiki/setUnitLoadout but I am unsure where to put it exactly.
Like I would love just for a specific uniform and headgear, nothing else.
Oh hi Lou 🙂
i copied it woops
it comes from behind me
not a good idea
how far behind?
Approx 300 meters.
definitely not a good idea
Why :D?
there's no guarantee about abstacles
what if it hits a mountain?
or some other object?
except it doesn't come from behind you
IF (idiot == me) THEN {have smart person tell me something that I could figure out if I didn't look to literal into things and actually developed real skills on the computer instead of just playing oldschool runescape for like 10 years};
Did I do that right?

well yeah you can use setUnitLoadout
you can put it in onPlayerRespawn and initPlayerLocal
Nothing wrong with ORS.
wat?
ORS: Oldschool Runescape
_missile = createVehicle ["M_Jian_AT",(player modelToWorld [0,-100,150]),[],0,"CAN_COLLIDE"]; btw this seems to work.
FNC_casMissile = {
_sendPos = if (isNull cursorObject) then {AGLtoASL screenToWorld [0.5,0.5]} else {aimPos cursorObject};
_spawnPos = player modelToWorldWorld [0,-200,200];
_missile = createVehicle ["M_Jian_AT", ASLtoAGL _spawnPos, [], 0,"CAN_COLLIDE"];
_missile setMissileTargetPos _sendPos;
_missile setVectorDir (_spawnPos vectorFromTo _sendPos);
};
😮
wtf xDDD at the last split second it acts like magnet and shoots the other way.
(at impact)
wat?
Mmm weird, works now.
Can it be because im using a AT missile?
trying to correct itself or something
I have no idea what you're talking about 
I know, ill show you. 1 sec
probably because I'm using ASL
try AGL
FNC_casMissile = {
_sendPos = if (isNull cursorObject) then {AGLtoASL screenToWorld [0.5,0.5]} else {aimPos cursorObject};
_spawnPos = player modelToWorldWorld [0,-200,200];
_missile = createVehicle ["M_Jian_AT", ASLtoAGL _spawnPos, [], 0,"CAN_COLLIDE"];
_missile setMissileTargetPos ASLtoAGL _sendPos;
_missile setVectorDir (_spawnPos vectorFromTo _sendPos);
};
maybe?
Yea that seems to do it.
That was funny tho
Thanks 😄
is there also a way of limiting the speed of the missile?
it's a self propelled missile
so no
altho missiles are always self propelled 
[_vehicle, player] spawn {
while{true} do {
params['_vehicle', 'player'];
sleep 5;
systemChat 'Checking distance..';
systemChat format['%1', _vehicle distance player];
if(_vehicle distance player < 1500) then {
systemChat 'Jet is closer then 1500';
_vehicle limitSpeed 1500;
_vehicle move [12274.5,29203.9,0]; // Move jet outside map
false;
};
};
};
why is this while not working 🤔
nvm
params['_vehicle', 'player'];
because of this. dont pass player as param since you can get it from the command in the loop already. params only takes _local variables
ah oke ty
So I got to the point where I was able to create a loadout upon loading into the mission, but struggling with having it apply it upon respawn.
I know that the simplest would be to set the loadout as a unit variable (with setVariable) then calling that loadout on respawn. I honestly can not figure out how to do it. I know I have to place something in the onPlayerRespawn.sqf, and if I am reading this right I have to set something in the init of the playable slot.
no
first of all how do you decide which unit gets a certain loadout?
Arsenal is utilized for the specifics. I am just aiming at having a unit load in & respawn wearing a standard uniform, and a standard headpiece.
covers it nicely
I was pretty sure I asked the same question and got a full and comprehensive answer from Larrow, but can't find it right now
[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory; wouldn't this just save the loadout in its current state the player has when he dies?
and this [player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory; would force the loadout that was saved?
the trick is to save the loadout as he closes the arsenal
Not what I am aiming for unfortunately :/
Regardless what the player has at death, my goal is to have him respawn with JUST a uniform and JUST a headger.
OH, I see
Because ACE arsenal is utilized for gearing up.
Thank you. Attempting it now.
EXACTLY what I needed. Thank you so much.
@finite sail This is what I needed.
In initPlayerLocal.sqf put
player setVariable ["TAG_LoadoutStart", getUnitLoadout player];
In onPlayerRespawn.sqf put
player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]);
using a predefined loadout, yes
[[getPos _objective, 16, 29, 3, 0, 20, 0] call BIS_fnc_findSafePos, 180, "CUP_O_Hilux_DSHKM_CHDKZ", _group] call BIS_fnc_spawnVehicle;
how do i get the vehicle from this so i can empty it 🤔
@heady quiver Read the doc
Thanks, assumed as much. Was just wondering if there was a method I hadn't seen yet.
[missionNamespace, "arsenalClosed", {
profileNamespace setVariable ["Saved_Loadout",getUnitLoadout player];
hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{
0 = [_this select 0] spawn {
params [["_player",objNull,[objNull]]];
waitUntil {sleep .2; alive _player};
_player setUnitLoadout (profileNamespace getVariable ["Saved_Loadout",[]]);
};
}];```
how to rewrite it to save loadout in profile, so everytime player join this mission he doesn't have to use arsenal again?
doesnt that work?
@wind hedge see https://forums.bohemia.net/forums/topic/205515-handledamage-event-handler-explained/ for adapted HandleDamage usage
I am using that, but I need a way to identify when a headshot is a true headshot or just a collateral...
because I do a "headshot multiplier" and the multiplier is firing even for chest shots...
@spark sun Yeah I am doing something a lot simpler because I can't afford to do a custom UI around it.
The handleDamage EH is very tricky to use since it triggers multiple time. Here is some code for a basic dmg script I did https://github.com/R3voA3/3den-Enhanced/blob/master/3denEnhanced/attributesMission/SPR.hpp @wind hedge
This is how I detect head shots
@cosmic lichen Thank you R3vo! A life saver as always
params ['_unit', '_selection', '_damage', '', '', '_hitIndex'];\
if (_handleDamage < 0.1 || {!alive _unit || {lifeState _unit isEqualTo 'INCAPACITATED'}}) exitWith {0};
where is _handleDamage defined? @cosmic lichen
uhhh I think this is meant to be called "_damage" 
Always good to have another set of eyes going over the code.
But it has never thrown an error 
doesnt unscheduled throw an error on undefined variable?
unsched env doesn't throw errors for stuff like that 
Yep, right.
ah, good ol' OFP.
It's fixed now anyway
A single run of the damagedEH can only have one _selection right? It just fires several times for each "colateral"
yes
hi, does anyone know if it is possible to know the current "flight phase" of the missile? (initial, seeking, locked, lost)
Script in the init of vehicle. Sound still won't stop.
Music = {
car_1 addAction ["Play 'Rule the World'", {
removeAllActions car_1;
soundSource = "HeliHEmpty" createVehicle getPosATL car_1;
soundSource attachTo [car_1, [0, 0, 1]];
car_1 say3D ["everybodywantstoruletheworld",50,1];
car_1 addAction ["Stop Music", {
soundSource setDamage 1;
removeAllActions car_1;
call Music;}];
}];
car_1 addAction ["Play 'Buck Rogers'", {
removeAllActions car_1;
soundSource = "HeliHEmpty" createVehicle getPosATL car_1;
soundSource attachTo [car_1, [0, 0, 1]];
car_1 say3D ["buckrogers",50,1];
car_1 addAction ["Stop Music", {
deleteVehicle soundSource;
removeAllActions car_1;
call Music;}];
}];
car_1 addAction ["Play 'Blurry'", {
removeAllActions car_1;
soundSource = "HeliHEmpty" createVehicle getPosATL car_1;
soundSource attachTo [car_1, [0, 0, 1]];
car_1 say3D ["Blurry",50,1];
car_1 addAction ["Stop Music", {
deleteVehicle soundSource;
removeAllActions car_1;
call Music;}];
}];
};
call Music;
you are delting the vehicle but not the sound source. the sound source is returned by the say3D command https://community.bistudio.com/wiki/say3D
quick question: i've noticed that my object is saying it's 0.25m below ground level....what in object builder would be driving that?
would anyone happen to know why triggers will only sometimes fire? I keep testing my mission file in SP and half the time the triggers work and half the time they don't do jack
code issue or saturated CPU
Given that my PC sounds like an angry beehive, I'm gonna go with CPU. If it's crapping out on my PC but the code is still right, it should be fine for others when I publish the mission, right?
if there is no other issue I am going to go out on a limb and say "yes"
Cool, thanks!
unless the code itself takes ages, of course
also, is 'addForce' disabled when AFM is enabled?
Not possible
Does anyone know if it is possible to allow an eventhandler for when a player goes down. I'm trying to make it so that as soon as one player does enough damage to the player to die, they instead turn invincible and go into a downed state, instead of just dying
Run an EH when player is shot. You then check the health of the player, if they are below the threshold make them invincible/civilian/downed animation.
Prob an addAction to get them back up too
can maybe try something with https://community.bistudio.com/wiki/missileTarget and each frame eh?
OK, thx
Yes, it is what I'm using now. But the target is set from the beginning so I can't use it to know the phase.
for certain ammos yeah(e.g heatseekers), works fine for missiles LOAL for example
Ok I will check it then, thx.
Was toying with the idea of making a mod for switching between Helicopter weapons through ACE Self Interact, instead of cycling through 17 rocket salvos ..
Is such a mod possible, seeing as it has not been done already?
yes it is possible
but it's not convenient
you're better off using the 12345 keys 
@little raptor No clue how it never even occurred to me - to try the numbered keys while flying 🤯
well ACE overrides a couple of them (1 and 2 become the engine on/off)
but after you remove those it should be good
is there a way to post and get json data from a rest api?
not with #arma3_scripting without a extension, no
alright, i don't mind using an extension, if one exists for this purpose, or do i have to code one myself?
I think I saw a REST extension somewhere
actually, anyone have experience with compiling extensions in c++ with gcc? example on the bohemia wiki does not load out of the box...
yeah:
//--- Get a remote player as an example
_remotePlayer = (allPlayers select {_x != player}) param [0, objNull];
//--- Set a global variable for the remote player
[missionNamespace, ["testvar", 1234]] remoteExec ["setVariable", _remotePlayer];
So instead of doing:
remoteExec ["MyScript.sqf", _myTarget];
that's not even valid
and I'm just pointing it out so that no one thinks it's valid
some people might be new to scripting and they might "learn" things based on what we discuss here, so...
Right, quick question for you all here, when using setUnitLoadout in a script, is there any way to have a randomised choice of more than asset.
For example the uniform slot currently reads:
player setUnitLoadout [ //Set Player Loadout Using ACE Arsenal Export Function
["CUP_arifle_M4A3_CCO_Laser", //Primary Weapon
"", //Primary Weapon Barrel Attachement
"CUP_acc_ANPEQ_2_Black_top", //Weapon Attachment
"CUP_optic_CompM2_low", //Primary Weapon Optic
["CUP_30Rnd_556x45_Stanag", 30], //Primary Weapon Magazine, Ammo Count
[], //Primary Weapon GL Magazine, Ammo Count
""], //Primary Weapon Bipod Attachment
["", //Launcher Weapon
"", //Launcher Weapon Barrel Attachement
"", //Launcher Attachment
"", //Launcher Weapon Optic
[""], //Launcher Weapon Magazine, Ammo Count
[],
""], //Launcher Weapon Bipod Attachment
["", //Secondary Weapon
"", //Secondary Weapon Barrel Attachement
"", //Secondary Attachment
"", //Secondary Weapon Optic
[""], //Secondary Weapon Magazine, Ammo Count
[],
""], //Secondary Weapon Bipod Attachment
//Inventory -->
//Syntax (Items = ["Item Name", No. of Items]), (Magazines = ["Mag Name", No. of Mags, No. Rounds in Mags])
["CUP_U_B_USArmy_ACU_Gloves_UCP", //Uniform ID
[["FirstAidKit", 1], ["CUP_30Rnd_556x45_Stanag", 3, 30], ["SmokeShell", 1, 1]]], //Uniform Contents
ETC.......................
Is there a possibility to have several uniforms it will randomly select, whilst leaving the rest of the Loadout unchanged?
selectRandom
Many thank yous
are there any ways to keep track of groups even if some get deleted? storing info in the group variable doesn't work since if a group is deleted then the variable becomes null and all info is lost
what do you mean keep track of?
bad wording, let me try again
i meant i want to augment groups with additional data, but storing that data in each of the group variables doesn't work, since i want to keep the augmented data even for deleted groups
create some unique id for each group and use a hashmap with desired data
is serverTime a good choice for id's?

i usually use a variable, and increment it everytime
right thats simpler
I'm making some weather parameters for a mission but I'm a little stuck on one part. I have a switch case that looks like this:
case 1: {
setwind [0,0,true];
};
case 2: {
setwind [1,1,true];
};
And it works but the first two values in the array determine the wind direction and it does that by switching to negative values. Within each switch case I'd like to have multiple arrays it can switch between so something like this:
case 1: {
setwind [0,0,true];
};
case 2: {
setwind [1,1,true]; OR setwind [-1,-1,true]; OR setwind [0,1,true];
};
However I know that doesn't work, but I'm not sure how to achieve the effect I'm going for. For my purposes adding more switch cases won't work since each case corresponds to a parameter in the lobby and I only want exactly how many I need.
@torpid pewter ```sqf
setwind selectRandom [[1,1,true], [-1,-1,true], [0,1,true]];
ah perfect i knew there was a simple solution to this, thank you.
Question- can you use setVariable on markers?
no
Sweet, thanks
markers are not objects 😉
Sounds good 😉 Thanks for the help
now what are you baking…
Oh, me?
no, the guy behind! 😄
oof, was gonna say 😂
Is there any way to make a marker (or other map entity) that executes code when you click it?
onMapSingleClick eventhandler, check where player clicked, see if theres a marker under the click
Sweet, thanks, I'll try that
What's the command to get an array item's index?
E.g. if I have an array of
[marker1,marker2,marker3]
And know I want the index that marker3 is in, how would I get that?
select or #
confused with your question - if you know the index use what Leopard20 said, if not, use https://community.bistudio.com/wiki/find
Yep that was what I was looking for, thanks @copper raven!
Next question, is it possible to apply a texture to an area marker?
find
Yep, got it, thanks!
How can I get this to work properly? I am trying to get this to exclude players. Thanks.
(allMissionObjects "") - entities [player];
allPlayers
(player is not a classname
)
Thank you.
can you remote exec a function creation on a client? or would you just make the function variable public?
why remoteExec?
just use cfgFunctions
Is it possible for me to get item information like item0 position from a composition class before spawning it? I preinit the class. if so can some one point me in the direction of some links to do so.
nvm found it
a version of this:
{deleteVehicle _x} forEach nearestObjects [player, ["all"], 200]
But that only deletes editor placed objects?
yeah, what about it?

allMissionObjects
yeah but he sounds like hes complaining about it NOT deleting map objects which would be terrain objects right?
is there a cba support discord somewhere?
or any support forum for CBA?
or anywhere where you can report bugs
oh, the bug is listed under known issues
fair enough

does this mean that keybinds needs to be initialized pre-mission init?
because the parameters, such as replace default function, are not working
i bound a key to F, and set the override to True, but it still registers the F for switching firemode
oh, i ahve to use this
If _downCode returns true, block all further actions bound to this key, including base game actions
that solves it
why not?
So I have getreldir, the heading between my player and a target.
What I need is to transform that number such that I have a percentage that goes up to 100% (or 1.00 or whatever) when that getreldir is at 90.
I had this script a long time ago, but I've lost it since :c
relDir/90?
Yes, that would bring it to 100% when at a 90 degree angle... but 200% when it's directly behind me :/
There was some clever twist that I was clued into, those years ago, and I can't for the life of me remember it T_T
... holy poop this discord has messages from 2016
Ugh, I'm talking about the problem but not posting the problem
Past me, as ever, disappoints.
well, you only mentiioned 90° :p
sign of progress then 😉
Wishful thinking.
But I'm still trying to solve the same problem; recreating Take On Helicopter's BIS_fnc_WPAngle
Hrn... may be able to use the parabolic arc that Cptnnick clued me into five years ago
What a time to be alive
Cripes, I was trying to build this mission when Apex first launched as a 'showboat around Tanoa' thing T_T
can anyone please tell me how to detect any player for unit on a given side, i was using p1 but that doesn't work for multiple units and then I used player but that doesn't work well in multiplayer...?
removeAllActions gen1; p1 playMove "Acts_carFixingWheel"; sleep 15; scoreSurvivor = (scoreSurvivor + 1); hintSilent str scoreSurvivor && "generators repaired"; if (scoreSurvivor >= 5) then {survivorsWin = true;};
If you're doing what I think you are, you may want to look into https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
i don't think thats what im trying to do :/
i already have an animation that plays when the player does the addAction
I just need to know how to reference any given play (on blufor) but at the same time not reference every player, because then the animation would play and all players would enter the animation
as far as im aware
Huh, I forgot that addAction also does _caller
The lines you provided above is the script portion of the addAction, correct?
yea
You should be able to replace 'p1' with '_caller'
Ah, finally got it T_T I don't think it's what I did before, but it's working.
vector = -(5/2500)*((vehicle player getreldir target)-90)^2+5; //makes a decent arc towards the right
vector = (vector/5)*100; //converts to percentile
vector = vector max 0; // trims negatives
vector = ceil vector; //rounds up
hintsilent format ["Dir: %1",vector]
ope
Sorry, talking about my thing :p
You could also try replacing p1 with _this select 1
Supposed to be the same thing... I'm thinking _caller is for if you're passing the caller to a .sqf file, but I'm not exactly a master at this >n>;;
Or it may always need to be in the context of an external .sqf
removeAllActions gen1; _caller playMove "Acts_carFixingWheel"; sleep 15; scoreSurvivor = (scoreSurvivor + 1); titleText ["scoreSurvivor && "generators repaired."], "PLAIN DOWN", 2]; if (scoreSurvivor >= 5) then {survivorsWin = true;};
this worked, however when I introduced title text instead of a str silentHint, I get the error Type text epected array?
cant remember the first may've been string
@manic sigil
titleText ["scoreSurvivor && "generators repaired."], "PLAIN DOWN", 2];
You have some copied icons in there, it's getting bugged. Are you trying to have it project the score and number of generators repaired?
correct
Alright, that's going to take some format work.
I'm being braindead, you have some execess "'s and ]'s
titleText ["scoreSurvivor && generators repaired.", "PLAIN DOWN", 2];
will get you "scoreSurvivor && generators repaired" to show at the bottom of the screen... which while pretty, isn't informative.
ah
titleText [scoreSurvivor && "generators repaired."], "PLAIN DOWN", 2];
is this fixed?
wait
Not quite :p
In order to inject a variable into text, you need to format it
https://community.bistudio.com/wiki/format
format ["words %1",variableToAppearAt%1]
titleText [format ["Score: %1",scoreSurvivor],"PLAIN DOWN", 2];
😮
would this work? its not using scoreSurvivor...
I was assuming scoreSurvivor was the variable you wanted to project, you can replace that with whatever variable you want to have in the title text line
Yeah, that's the anchor for where the variable gets placed and turned into a string.
%1, %2, %n onwards.
ah
format ["Score: %1 Players Remaining: %2",scoreSurvivor,count allUnits]
hmmm
could you help me a tiny bit more, im not quite understanding your example code 100%
titleText [format ["Score: %1",scoreSurvivor],"PLAIN DOWN", 2];
can i replace Score with scoreSurvivor
what do you want the text to say?
and can i do && "generators repaired". after
"X number of generators repaired"
with x being amount, but in title text at bottom of spring
screen
https://community.bistudio.com/wiki/format Read this and if you dont understand lmk
Do you have the number of generators repaired stored as a variable?
yes. that is scoreSurvivor
each time they repair a geneator a script runs thats scoreSurvivor + 1
ill try now tysm
Yeah, the section in quotes in just text, the %n gets replaced with a variable.
removeAllActions gen1;
player playMove "Acts_carFixingWheel";
sleep 15;
scoreSurvivor = scoreSurvivor + 1;
titleText [format ["%1 generators repaired",scoreSurvivor],"PLAIN DOWN", 1];
if (scoreSurvivor >= 5) then {survivorsWin = true;};
dbd?
oop also uhh @manic sigil _caller doesnt do anything :/
My only problem with that setup is that, once you run the action, it's a done deal - even if you get shot, the generator is repaired.
@final storm something small im making to try to get into scripting, i dont want to be a noob scripter anymoer :/
@manic sigil dbd
_this select 1 playMove "Acts_carFixingWheel";
also @final storm got a missing bracket error
removeAllActions gen1;
_this playMove "Acts_carFixingWheel";
sleep 15;
scoreSurvivor = (scoreSurvivor + 1);
titleText [format ["scoreSurvivor,"%1 generators repaired"],"PLAIN DOWN", 2];
if (scoreSurvivor >= 5) then {survivorsWin = true;};
current code
from what i sent theres nothing wrong with it
_this would return an array of objects, specifically [gen1, playerActivatingAction, theActionID, additionalArguments]
select 1 would direct it to the second item in the array, the unit activating the action.
ty for explanation!
[format ["scoreSurvivor,"%1 generators repaired"],"PLAIN DOWN", 2];
is the [ before format supposed to be there
hmm
Ah, you %1 is leaking
huh?
[format ["%1 generators repaired",scoreSurvivor],"PLAIN DOWN", 2];
Format["string",variable]
so i cant have x generators repaired instead? :p
%1 generators repaired would give you the scoreSurvivor in %1 position.
could you format it with the code for example?
As above
ohhhhh
format ["your name is %1", name player] // possible output: "your name is John"
format ["%1", 123] // always "123"
hope it makes sense
Yup. Format doesn't care where %1 ends up, that's where it'll put the variable you call after the string.
i seee
"PLAIN DOWN", 2]; is 2 the size of the font?
sorry to ask again, but would this work
titleText [format ["<t color='#ff0000' size='5'>"%1 generators repaired",scoreSurvivor </t><br/>", "PLAIN DOWN" , -2, true, true];
Only one way to find out.
facts
it says a bracket is missing again
right by the generator and the 1% again...?
"<t color='#ff0000' size='5'>%1
Remove the quote before %1, it's reading the start of the string from <t, but processing that all as how-to-color-and-size code.
The additional " makes it think the string stops there, and it's throwing a fit
titleText [format ["<t color='#ff0000' size='5'>%1 generators repaired",scoreSurvivor </t><br/>", "PLAIN DOWN" , -2, true, true];
ill try tat
oop now invalid number
at </t><br/>
generators repaired </t><br/>",scoreSurvivor
what does </t><br/> do
/t ends the color and size formatting
can i just delete it then?
/br breaks the line; in the example page, it adds a line of asterisks, in your case, it's doing nothing.
how do i do: _mygroup = group _this; <- _this is in a init of a unit field
I'd keep the /t for neatness sake/can't recall if it'll work otherwise.
But the /br you can remove.
so just </t>
You're trying to make a private variable in a global space, the init field. remove the _'s and it'll work, but won't be private.
Correct
titleText [format ["<t color='#ff0000' size='5'>%1 generators repaired </t>",scoreSurvivor, "PLAIN DOWN" , -2, true, true];
I made it "easier" on the eyes a bit if you wanna use it that is 😛
perc = (1 - abs(((abs((vehicle player getRelDir target)-180))-90)/90)) max 0
Remove the second abs if you want it to return 0 when target is on your right.
Substitute the second abs with a minus if you want it to return 0 when targets in on your left.
what did you do?
nvm
Thank you, I'll give it a try 😄
durr
titleText [format ["<t color='#ff0000' size='5'>%1 generators repaired </t>",scoreSurvivor], "PLAIN DOWN" , -2, true, true];
after scoreSurvivor
thx
IT WORKSSSS thanks so much for your help bro @manic sigil
ill make sure to credit you
Works beautifully, though id still have to fidget with it... realized I did want a curve afterall, so its not trickling in as soon as it passes the nose/tail, but in an arc around 70-110 degrees
Well, 'optimally' in that arc... you get what I mean
@manic sigil if i have a like BLACK IN script, should I put it in each charracters init file, or the mission init file...?
That one you may need another person to chime in on, multiplayer scripting isnt my strong suit x_x
Is it possible to have BIS_fnc_holdActionAdd as a repeatable turn on\turn off action for e.g. a switch?
yes
are you coding for MP or SP?
@little raptor how would I accomplish that?
Is for an MP mission
you need a function that removes the old action and adds a new one: (let's call it my_fnc_addAction)
params ["_target", ["_turnOn", true]];
[_target, missionNamespace getVariable ["my_switch_action_id", -1]] call BIS_fnc_holdActionRemove;
if (_turnOn) then {
my_switch_action_id = [_target, "Switch On"..., { //completion code
params ["_target"];
[_target, false] remoteExec ["my_fnc_addAction", 0];
},...] call BIS_fnc_holdActionAdd;
} else {
my_switch_action_id = [_target, "Switch Off" ..., {//completion code
params ["_target"];
[_target, true] remoteExec ["my_fnc_addAction", 0];
},...] call BIS_fnc_holdActionAdd;
}
this has to be remoteExeced for everyone
or you can just call it in initPlayerLocal.sqf (if it has to be there at startup, but note that the switch state is not synced and you have to add it yourself if that's what you want to use)
@little raptor Cheers big ears!
Unfortunately I'm not that savvy with the sqf coding. Where would I put the code above? I have this in the init field of the object acting as a switch box.
[
switch_box,
"Turn off the Lighthouse's beacon",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{private _lighthouse = nearestObjects [player, ["Land_LightHouse_F"], 50];
{ [_x, false] remoteExecCall ["BIS_fnc_switchLamp",0,true]; } forEach _lighthouse;
playSound3D ["a3\sounds_f\sfx\special_sfx\sparkles_wreck_3.wss", player];
_target animateSource ["switchposition",1];
_target animateSource ["switchlight",0];
LightHouseVar = true;
publicVariable "LightHouseVar";},
{},
[],
1,
0,
true,
false
] call BIS_fnc_holdActionAdd;
you have to create a new function
in that code I've named the function my_fnc_addAction but you can change it to whatever you want
add or replace the completion code as I showed you in that code
and don't forget to save the action id (my_switch_action_id =)
@little raptor Will try it out, thanks for the help!
and don't use the init field
Because it's not JIP-compatible?
no because it gets executed for every connecting client
you'll get duplicate actions
Ah ok. Will avoid it then!
So initplayerlocal wouldnt be executed by every connecting client? O.o
wat
init fields are executed by every connecting PC
initplayerlocal.sqf details are here:
https://community.bistudio.com/wiki/Event_Scripts#initPlayerLocal.sqf
Executed locally when player joins mission (includes both mission start and JIP).
I dont think I can stress enough how little I understand MP architecture >_<
Okay, so Init is global, each connecting PC would run it again for every PC connected, leading to multiplying effects.
But initplayerlocal is local, it is still run by every PC but wont affect other PCs, right?
ok:
1/ reset your knowledge
2/ listen 😄
init fields are executed for every connecting client for everyone
when someone connects, the following is executed:
https://community.bistudio.com/wiki/Initialization_Order
init fields are executed, initPlayerLocal.sqf is executed
if the code inside any of them has a global effect, then it happens to everyone
p1 connects -> init for p1
p2 connects -> init for p1 and p2
p3 connects -> init for p1 and p2 and p3
wat? no
wat?
if you place [] spawn { sleep 2; hint "Hello there"; };, only the connecting player will have it
not everyone again
if you use setDamage however, since it has a global effect, everyone will see the damage done
@manic sigil when a player connects, his computer will run init fields code, and initPlayerLocal.sqf . if there is code with global effect in it, others will see its effect of course
Ahh, okay. So as Leopard said, the cascading effect, but only if you put something global in the init field?
well I'm sure that's what you said when I first asked
link plox o_o
yes, so AFAIK addAction is fine since it is local
and nobody complained about my missions yet 😄
then what's the big deal you make about init fields?
they're perfectly fine
people putting this setDamage 0.5 in it for example
so?
you start, oh you are injured! then heal yourself
then someone connects, and oh you are injured again
I know that
but I mean I'm pretty sure you said that
#arma3_scripting message
or I understood you wrong
I vote for the second option? 😅
so init field == initPLayerLocal
yup, nothing more about its evilness
were it like
p3 connects -> init for p1 and p2 and p3
it would be a joyful and awful mess 😄
So in that scenario, where would be the best place to execute set dammage to have it be a one-off?
initServer
Wait, initPlayerlocal is getting started when every new player connected? ( i mean - for everyone )?
no
just for the connecting client
but if what you execute has global effect then yeah for everyone
Ah, understand
@winter rose or maybe this confused me?
Object initialisation fields are called Applies To All
I don't know what it was tbh
I thought - init ( object ) script - run only on host ( client / server where is created )
true, it is confusing
I believe it is "All" because it applies to the server, the connected clients, and the JIP clients to come
negative, on every connecting machine ^
you can filter with if (isServer) then {} but it's a pinch ugly (but safe)
Understand
Hey guys, how would I do to delete all units except the player inside of a trigger ?
{
if !(isPlayer _x) then {
deleteVehicle _x
};
} forEach thisList;
condition box keep as this
the above goes in on activation box
set trigger activation to anybody and repeatable if you wish. (truly deletes all things except player, even vehicles/objects so be careful)
Thanks a ton man
can i use params in foreach?
why not. _x params ["_a", "_b"]
How to optimize arsenal menu loading with huge amount of inventory it has ?
it takes 3-5 seconds sometimes to finish loading...
No, unless you rewrite it
try ACE arsenal
where can I find it ?
it's part of ACE 
any other options instead of ACE arsenal usage ?
You can make a new one like POLPOX said
I am re-writing it but can't find logic that is responcible for loading of items in gear groups
you can preload it
["Preload"] call BIS_fnc_arsenal;
shall it be run each time a player loads arsenal ?
you run it once on mission init, it should be enough
let me try it out, thanks
it only makes the first time you open it faster
the real problem is that it rereads everything every time you open it 
you can just cache most of those info.
anyone know what the radius in addAction does at https://community.bistudio.com/wiki/addAction?
@warm swallow It is written in the doc you linked 
im confused as to what it means. Does it mean like the distance at which the addAction appears on the object?? @cosmic lichen
so if i want the player to be right next to the object, I should set the radius to something like 15?
It depends on the object
this addAction [ "Repair Generator", { ["gen\gen1.sqf"]; }, nil, 1.5, true, true, "", "true", // _target, _this, _originalTarget 15, false, "", "" ];
is this the correct format. I copied an example from the biki and tried to convert my code to this
{
["gen\gen1.sqf"];
}
→
"gen\gen1.sqf"
no {} and no []
[ "Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", "" ];
@cosmic lichen also how do i post my code with syntax highliting like some people do?
check the pinned messages
'''[
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
];'''
''' [
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
]; '''
' ' '[
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
]; ' ' '
@cosmic lichen ?
?
what character is it
`
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
]; ```
😮
missing the sqf
[
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
]; ```
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
];```
(3times)sqf [ "Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", "" ]; (3times)
[
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
];
ayyy
rty
also im getting error expected array type code
on ^
array [ ]
code { }
(I'm not sure what that is tho)
the error is his code line
hey again fellows, i was wondering has anyone ever been able to delay the startup time of a helicopter or car while also playing a sound in the interim between engine being turned on and the actual startup of the vehicle occuring?
nvm I didn't know you could just do a path to a file instead of execVM or compiling that file
not possible with scripting
ah i see 😦 any idea where i could start looking on how to do it through modding? or is it just not possible at all. perhaps something with thrustdelay in the vehicle config 🤔
Do you just want to skip the speed up time on mission start?
are you asking me?
yeah trying to figure out a work around for what you want. maybe didn't quite understant what you were looking for
@little raptor can you help me format this? it says encountered a isntead of = idk what that means
oh sorry 😆 yeah say for example a helicopter when you press your elevate button (mine is L-shift) the heli will play a sound like a turbine engine starting up then after maybe 10 seconds the usual animations for the heli startup would play. And then for a normal car the same thing except for 2 or 3 seconds a turning over sound would play before the normal vehicle startup.
this addAction
[
["Repair Generator", "gen\gen1.sqf"], nil, 1.5, true, true, "", "true", 15, false, "", ""
];
[ ?
ask in #arma3_model or #arma3_config
you'll have to mod it
wha
why did you put that extra [ ] in there?
ah i understand, ill ask over there thank you
im not sure sorry, it said it was missing a ]
if you have a custom sound, maybe do a "engine" event handler that when you turn it on, it immediately turns it off, plays the turbine sound, then restarts the engine after x amount of time? You'll have to do some setVariable and if then manipulation so it only fires when the key is pressed.
would it be {} instead?
no
this addAction
[
"Repair Generator", "gen\gen1.sqf", nil, 1.5, true, true, "", "true", 15, false, "", ""
];
ill try that
hmmm if this was to be used on a server with about 60 people would it not cause some performance drops with so many people "activating" it 🤔
the "engine" event handler is a global argument so it doesn't have to be local. just evaluate it on the server, then remoteExec a sound push to all the clients and the engineOn command to the owner of the vehicle.
let me see if i can figure out something. it will be goofy but it might work haha
oooo im excited to see how you do it😉
so... here's my rough draft for you. I might get a facepalm from leo...
//Run whole file on every machine
tag_engineCycle_heli = {
params ["_vehicle"];
if (!canSuspend) exitWith {_this spawn tag_engineCycle_heli};
_vehicle engineOn false;
playSound3D [getMissionPath "turbineSound.ogg", _vehicle, false, [0,0,0], 5, 1, 300, 0]; //Global Arguement and Effect
sleep 5; //However long the turbine sound is when you want rotors to spin
_vehicle engineOn true;
};
vehicleNameHere addEventHandler [
"Engine",
{
if !(isServer) exitWith {};
params ["_vehicle", "_engineState"];
private _count = _vehicle getVariable ["count", 0];
if (_count % 2 == 0) then {
[_vehicle] remoteExec ["tag_engineCycle_heli", _vehicle];
};
_count = _count + 1;
_vehicle setVariable ["count", _count];
}
];
the event handler might not execute on the server at all
it only executes where you add it
yeah but if its in a init, it should add it to the server too right?
oh i see
derppppppp
back to the drawing board
and your event handler has the potential to loop forver
yeah i was trying to be cheeky with a modulo. is it a definite loop or potential if someone spam clicks engine controls?
not because of that
because of engineOn
plus why modulo? just toggle a bool
just so i can learn a lil bit, is the potential to loop forever because the if is never given something to stop it?
because the delayed engineOn has no way to differentiate from the user engine on action
ooo okay i understand
in other words let's say the sequence starts
1 2 3 4 5 engine on
woops turned off again 
that wasn't a loop 
it was
sure!
yeah I think thats what I was trying to do with the modulo and count. since the count would tick up on the engine turning on the first time, it would fire the function which would cause it to tick the second time, but wouldn't fire the function cause its an odd number, but I forgot to take into account the third engine firing during the function which would cause it to cycle again.
i think i can work around it by having a bool variable when the turbine sound is going on that can prevent the event handler from doing anything until its done with some additional conditions