#arma3_scripting
1 messages Β· Page 585 of 1
@finite sail ok makes sense ! And is there a way to choose in which order the different records / subjects are shown ?
iirc, you have to create them in reverse order π
im in mission now, i make screenshot that will make it clearer
ok, so heres the code
ill make a screenshot as soon as i can batter shadowplay into submission
No problems I'll try to run tests on this, thanks and enjoy your mission
And thanks again ! You 're awesome mate !
np
Are values like
#define QRF_SEARCH_TIMEOUT 8
In minutes? I find it hard to believe those are seconds
Yes probably minutes, but you can do a project-wide search for that and see how it's used
I'm having an issue with a pop-up target script; it's meant to keep pop-up targets down once they are shot until they are 'reset' by a player
Situation: the player has the option to 'activate/reset' a firing range so that when he shoots a pop-up target, the target stays down until he interacts with an available action on a laptop and 'resets' the range, causing all targets to pop back up
Problem: only the session host is successfully able to 'reset' ranges in this fashion. If any other player in the session triggers the action and shoots a target, that target pops back up, even if the player shoots a target when the range has been activated by the session host
Action Trigger Entry on the Laptop:
this addAction ["Range 1: Activate/Reset", "Scripts\AC1.sqf", nil,0,true,true,"","",2,false];
Script (truncated):
AC1RangeTargets = [AC100];
{_x animate ["Terc",0];} forEach AC1RangeTargets;
{_x addMPEventHandler ["MPHit", {(_this select 0) animate ["Terc",1];
(_this select 0) RemoveMPEventHandler ["MPHit",0];}]}forEach AC1RangeTargets;
systemChat "Assault Course Range 1 ready";```
I even tried having this execute with a trigger at the beginning of the mission:
remoteExec ["Scripts\MasterRangeArm.sqf", 0, false];```
Now, the scenario does contain this file as an initPlayerLocal.sqf so the briefing can be read in a diary file:
{
waitUntil {player == player};
};
_null = [] execVM "diary.sqf";```
Don't know if that's doing anything to contribute to this problem
Any ideas? I've been beating my head against a wall and seeing how other people do firing ranges and pop-up target scripts, but I haven't found anything definitive. I know it's a locality problem, but I'm not sure how to define this to allow ALL players to hit targets, keep them down, and then reset them
my original attempt focused on this: https://www.youtube.com/watch?v=ehIzXg2Ttqw
remoteExec ["Scripts\MasterRangeArm.sqf", 0, false]; remoteExec doesn't take a file path
waitUntil {player == player}; thats nonsense in initPlayerLocal. The player unit is even passed as argument to the file
_null = that useless
nul= thats useless
at the beginning of the mission
If you want it to run at the beginning, why not run in init/initServer/initPlayerLocal?
because i didnt know about those
Now, the scenario does contain this file as an initPlayerLocal.sqf
But you have a file that you don't know about?
i knew about initplayerlocal; i didnt know about any other init files...
https://community.bistudio.com/wiki/animate The animate page says pretty clearly that using animateSource should be preferred
_x animate ["Terc",0] this is supposed to keep the target down? or up? or.. what?
do you now execute your script at mission start? to keep them down?
essentially yes, lemme look
animate 1 drops the target
animate 0 has them pop back up to their default position
and definitely dont want to use nopopup = true because that drops ALL targets globally and causes them to not pop back up XD
hmm, interesting...ok, lets see what happens
Sorry, this seems obvious but can anyone know where the error is?
markers = ["intro_1","intro_2","intro_3","intro_4","intro_5","intro_6","intro_7"];
for "_i" from 0 to 6 do {
_markador = markers select _i;
_posMarker = getMarkerpos "_markador";
cocheintro doMove (_posMarker);
waitUntil {if ((player distance _posMarker) < 10) exitWith {true}};
};
for "_i" from 0 to 6 do
why not forEach?
waitUntil {if ((player distance _posMarker) < 10) exitWith {true}}; wtf is that? waitUntil takes a bool, and no exitWith. you'll pass nil which will throw errors
"_markador" is _markador a marker name?
and why do a loop if you always use the same marker?
markers = ALWAYS use a tag for global variables
Also I cannot see why you would need that to be a global variable?
Noo!! I wanna use different markers.
waitUntil {if ((player distance _posMarker) < 10) exitWith {true}};wtf is that? waitUntil takes a bool, and no exitWith. you'll pass nil which will throw errors
@still forum Never used it before, I have read on the web that it always returns boolean so I have decided to try that syntax, it seems that it is not adequate.
Also I cannot see why you would need that to be a global variable?
@still forum I was just testing.
My goal for that code is to go to one marker and when it gets closer, go to the next.
that it always returns boolean so I have decided to try that syntax
Yes you always need to return boolean, your code doesn't do that though
I guess something like this is what you wanted then?
private _markers = ["intro_1","intro_2","intro_3","intro_4","intro_5","intro_6","intro_7"];
{
private _posMarker = getMarkerPos _x;
cocheintro doMove (_posMarker);
waitUntil {(player distance _posMarker) < 10};
} forEach _markers;
why don't you use waypoints then?
I guess something like this is what you wanted then?
private _markers = ["intro_1","intro_2","intro_3","intro_4","intro_5","intro_6","intro_7"]; { private _posMarker = getMarkerPos _x; cocheintro doMove (_posMarker); waitUntil {(player distance _posMarker) < 10}; } forEach _markers;
@still forum Could work, let me test it, thanks!
So, I'm back, this time I'm trying to make a very bone simple script. I want to do an addAction on a flagpole. Players walk up to it, scroll to it, and get teleported into a vehicle. I've looked around the interwebs extensively, but all that I really find is moving people into the vehicle's proximity, and I'm not sure I trust my scripting skills to go that far, and I'd prefer it if they tele'd into the vehicle.
So I'd like to start with a syntax error. I'm just starting out, so it's probably something stupid.
this addaction ["Teleport to MHQ", moveInCargo] gets accepted by the init box of a flagpole, but obviously does nothing. But when I add the expected vehicle MHQ, to get this:
this addaction ["Teleport to MHQ", moveInCargo MHQ]
It throws "Error Missing ]"
I guess something like this is what you wanted then?
private _markers = ["intro_1","intro_2","intro_3","intro_4","intro_5","intro_6","intro_7"]; { private _posMarker = getMarkerPos _x; cocheintro doMove (_posMarker); waitUntil {(player distance _posMarker) < 10}; } forEach _markers;
@still forum It says error on waitUntil, thats why i tried the other syntax, it just takes the car to "intro_7"
It says error on waitUntil
what error
I have perused this and tried working through it. I've even tried adding a _this to tell it to perform the action on the unit calling it, but it rejects that. with the same syntax error, so I'm trying to boil it down.
it just takes the car to "intro_7" well yes thats the last marker your script is supposed to go to, it won't go further
@quaint oracle look at the examples
it just takes the car to "intro_7"well yes thats the last marker your script is supposed to go to, it won't go further
@still forum Yep, but I say that it takes you directly, without going through the other markers.
what error
@still forum I have the game in my native language, in English it should be something like "Generic expression error"
run your code in scheduled
I've seen the examples, and tried them a few ways>
This, for example, gets accepted by the init box on the flagpole, but does nothing.
this addaction ["Teleport to MHQ", {_this moveInCargo MHQ}];
@quaint oracle that fixed the syntax error. But _this is not an object
but moveInCargo takes an object
I gathered, in that it tells me I'm passing an Array, when it wants an object.
run your code in scheduled
@copper raven What do you mean π© ? On code?
To my understanding, _this would grab the caller as an object.
addAction wiki page, parameters, script
To my understanding, _this would grab the caller as an object.
But it doesn't. see wiki
@high horizon https://community.bistudio.com/wiki/spawn
anyway, where are you even running that?
So, I'm looking at the wiki. How I'd pull in the player as an object calling the addaction is not jumping out at me. Any clues here?
Working!! thx @still forum @copper raven
How I'd pull in the player as an object calling the addaction is not jumping out at me.
The wiki tells you how
even lists you two possible ways
both in the parameter descriptions and the examples
I've seen this, and have been trying to work through it. I'm struggling here on how to add the params into the addaction call. I need it to pull the player calling it back out of params and pas it into the move in cargo function with _this select 1. Most everything I try comes out as gobbledygook with syntax errors. I distinctly remember, once upon a time, having a MHQ script that I've lost, that was extremely simplistic and functional.
I need it to pull the player calling it back out of params
Thats exactly what theparamscommand already does for you
Most everything I try comes out as gobbledygook with syntax errors.
Then figure out what the correct syntax is
most likely parenthesis
Can I, inside the addaction script, define an obj id = params[_this select 1], then pass that on to moveincargo?
read what params does, the examples are legit there, you just need to read them
you are overthinking it.
Reading stuff on the wiki, skipping the important parts, and then trying to adapt what was written on the wiki to you own needs and thereby breaking it without even first reading the wiki pages about the stuff you are trying to adapt.
You cannot adapt something while you have no idea how it works, you should read first.
All you really need is to literally copy-paste, all your attempts to adapt something you've seen is overcomplicating it
You're right, I was overcomplicating things. I went and routed around for how I solved this problem the first time from a backup file I had externally, on a hunch.
this addaction["Teleport to MHQ",{[player moveInCargo MHQ];}]
Is what I wanted, and it works.
Would it work if I had 30 people trying to run into the same vehicle? Maybe not.
But, small ops
if I had 30 people trying to run into the same vehicle? Maybe not.
No, but more because Arma bug and not because ofy our script
So, the vehicle in question is a CUP Vodnik, with 12 seats. If I had a mass cas, and 13 people attempted to teleport in, what would happen, do we think?
@still forum unfortunately im still having problems with pop-up targets not staying down when someone other than the session host shoots then X( even after changing animate to animatesource X(
Hi, I have a problem with hidden objects becoming unhidden during high load. Anybody has a clue?
@tough abyss little more context/ information? How are you hiding the object, when you say high load is that due to the mission spawning in more stuff or more players joining? Do you have any code anywhere which unhides objects
I run a script at preinit that gets the objects by model name and hides them with hideobjectglobal. When starting the mission everything is fine but when many groups start spawning some of the hidden objects become unhidden
no code that unhides them anywhere
Is there any way to script a ai to pick up a weapon? I want it so when you enter the room the guy runs for a gun
ah and i'm talking about single player
Something to do with unloading terrain when not in use?
Maybe you're not really hiding them and having groups spawn makes terrain nearby stream&load thus objects appear for the first time?
Not sure about exact mechanics of that
@meager granite what do you mean with unloading? It does seem related to spawning but happens with objects very far from spawned groups, and not all objects unhide, it seems random
How do you hide them anyway? What's the script?
Pretty sure you're just not hiding them due to objects not being loaded into the terrain yet.
I get objects with nearestTerrainObjects. I filter the resulting array to match the models I want and then do {hideobjectglobal _x; _x allowdamage false;} foreach _array
I'm guessing that nearestTerrainObjects doesn't trigger terrain loading.
As experiment, add a marker on the map for each hidden object and see the picture
we're talking thousands of objects here. and they are remain hidden if just a few groups spawn
Pretty sure you'll have markers only around playable content and where your camera was
Give it a try with the markers
ok, i'll try it, just a moment
has anyone tried messing with QRF in Old Man? Changing QRF_defines did not seem to do anything
Even commented huge functions (in other files ofc) to just see if it's doing anything, but still seems like nothing happened, not even error messages
I'm editing missions_f_oldman.pbo btw, which is in Expansion/Addons folder
Basically all I want to do is set a bigger timer for when QRF shows up, default it seems like 2 minutes, which gives you no time to loot or whatever (I guess it's intended, but still), so something like 15 mins would be ok, but haven't really been able to find what to modify in order to achieve this
@meager granite so I only got one marker right at the middle of the map. but would it even be possible to create 50000 markers?
Did you use same name for each marker or something?
Yes its possible to have as many markers as you want
sorry. I did so. let me check againπ€¦
wait I actually didn't
I put (str _x) in the name
_x being the object
wait I'll try again i know what i did
Just have something like str random 1e6 + str random 1e6
any way to create composition groups via script?
@waxen tendon see BIS_fnc_spawnGroup for config groups, besides that, no I don't think so
that'll do, thanks!
@meager granite it gets stuck loading the mission, i'm still waiting for it to start
meanwhile tell me: if the problem is that the objects were not loaded yet, why do they appear hidden at start? and setting the script to run at postinit would solve it?
Iβve used addWeapon and addMagazine, to a trigger that is activated OpFor Present, but as soon as I spawn in the character has it. I want him to get the weapon when he walks into the trigger
Anyone help?
@fluid cairn link the trigger to that unit
Oh okay thanks
@meager granite hey I changed it to postinit and it seems fine for now. Thanks for your help
it seems i've spoke too soon
hey uh, I have an idea for a pylon-mounted weapon, where do I start?
How can I turn on the Sentinel UAV engine? The engineOn command doesn't work.
@tough abyss How did that marker picture look?
Is it safe to add publicVariable and setVariable to CfgDisabledCommands?
Well your PC won't catch fire, but you'll probably break plenty of default Arma stuff and limit yourself quite a bit.
@meager granite I'm just trying to make my scenario more secure. I decided to allow clients only remoteexec specific functions, but looks like any broadcasted command (such as createVehicle) can be executed on client without any restriction. Is there any way to fix this?
Battleye's createvehicle.txt filter
@meager granite Is it differs from CfgDisabledCommands? Do I need to limit every broadcasted function? There is a lot of them: https://community.bistudio.com/wiki/Category:Commands_with_global_effects
Yes it differs a lot from it, battleye filters broadcasted data through some functions so you can specify what kind of data is allowed and what isn't
Still, even disabling every command under the sun wont make you 100% safe, proper cheats form network messages themselves without using any scripting commands.
Its a balance of your effort being worth it
I know there are also some kind of "map hacks" (which one are really just game process memory reading and parsing) and they allow to get more information, that player had to get usually. But I just want to not let hackers ruin game for other players (I mean giving everyone dozens of in-game money and spawning of blowing up helicopters everywhere). Is there any de-facto way of that for public server like KOTH and AltisLife?
So, there are no way of forcing game being multiplayer with authoritative server?
How do I put in a animation script where a Marine team is looking everywhere while moving tactically to clear a building or hallway for any hostiles or hostages
I'm making a spectator script, like this:
while {true} do
{
_camera setPosASL _pos;
[_camera, _angles] call BIS_fnc_SetObjectRotation;
};
it works nice, but. In multiplayer it has issues with sound. Literally when you try to watch a fast-moving plane in MP, plane`s sounds are breaking-up with high frequency.
In singleplayer there are no sound issues.
How can I solve this?
@karmic swift There is no 100% solution. To change your money\other values you don't even need scripting if you're cheater, you just edit the memory.
@quartz pebble Per frame execution
@meager granite you mean instead of while {true} use onEachFrame ?
Doing stuff like this in scheduled thread is a bad idea because camera will not update perfectly, lag behind in some frames thus these sound issues due to variable distance to the object
TX
@meager granite If you change your local memory then you are gonna be kicked due to 'out of sync', isn't it? Or you mean case when 'money' and other important things owned and calculated by clients itself?
Depends on how mission works of course, sure you can make everything server-side and but proper cheats still can generate network messages to mess stuff up and you can't catch any of that
moveOut message for example, to randomly kick players out of vehicles, no BE filter for that, blocking scripting command won't do anything as cheaters don't address scripting.
There must be a balance of scripting and BE filter restrictions, good mission architecture with critical info being server-side and proper constant admin attention.
How to get all the controls for a control group
Item names wont appear, using ravage mod
@summer pelican please use sqf formatting (shown in pinned messages)
Is there any info about the Tank & Car class names for setting damage?
rvg_Medical_custom = ["Medicine (Hank)",
[
["ACE_fieldDressing", 3,"ACE_ItemCore", 50],
["ACE_elasticBandage", 5,"ACE_ItemCore", 50],
["ACE_quikclot", 6,"ACE_ItemCore", 50],
["ACE_packingBandage", 8,"ACE_ItemCore", 50],
["ACE_tourniquet", 30,"ACE_ItemCore", 50],
["ACE_morphine", 20,"ACE_ItemCore", 50],
["ACE_epinephrine", 25,"ACE_ItemCore", 25],
["ACE_atropine", 30,"ACE_ItemCore", 10],
["ACE_bloodIV_250", 200,"ACE_ItemCore", 50],
["ACE_plasmaIV_250", 175,"ACE_ItemCore", 50],
["ACE_salineIV_250", 150,"ACE_ItemCore", 50],
["ACE_bloodIV_500", 350,"ACE_ItemCore", 25],
["ACE_plasmaIV_500", 325,"ACE_ItemCore", 25],
["ACE_salineIV_500", 300,"ACE_ItemCore", 25],
["ACE_bloodIV", 650,"ACE_ItemCore", 10],
["ACE_plasmaIV", 600,"ACE_ItemCore", 10],
["ACE_salineIV", 625,"ACE_ItemCore", 10],
["ACE_surgicalKit", 1000,"ACE_ItemCore", 10]
]
];this setVariable ["istrader", "rvg_Medical_custom", true];};```
uhh
Yeah, idk what im doing, not an avid scripter
@fervent kettle classnames, or selection names?
on the Wiki it says hitPointName
Yea, but there was also a list for helicopter damage parts and i was wondering if there`s the same but for tanks & cars
Take a car and use the command ^^
aah right, i see
@summer pelican Not sure what your mission expects from istrader, but you're broadcasting the string, not array with its contents.
NC_fnc_repair = {
params [
["_vehicle", objNull]
];
if (isNull _vehicle) exitWith {};
_vehicle engineOn false;
sleep 1;
_vehicle setDamage 0;
_vehicle setFuel 1;
_vehicle setVehicleAmmo 1;
_vehicle setVectorUp [0,0,1];
};
this function has AL and AG commands, how should I execute it so it works on dedicated server? and use minimum bandwidth?
I still have troubles understanding the locality stuff in Arma...
setVehicleAmmo 1 has to be executed everywhere (in case different turrets will be owned by different clients)
Coming from C# I'm suprised i have difficulties understanding arma scripting.
Mighr be some subconscious thinf they have tweaked that I don't recognize.
setDamage 0 has to be executed anywhere but preferably on server
setFuel and engineOn only where vehicle is local
To make it easier, execute setFuel,engineOn,setVehicleAmmo everywhere (server and all clients), and setDamage 0 on server.
You can do setDamage 0 from anywhere but do it only from one source, up to you where
Having it no non-local client will trigger BE's setdamage.txt filter
Having it on server or where vehicle is local won't.
so inside this function I have to execute each command in separate remoteExec?
Who calls this function in the first place? Anyone?
@meager granite I think I got it. In Arma3 server don't perform any client behaviour validation checks (or does perform but a very few), but it just transport of commands between synced clients. So, to prevent clients from doing nasty things they (people who creating engine of A3) decided to add traffic-level filtration of 'bad commands' from client (BattleEye's createVehicle.txt as you said). Even special tool that should prevent sending 'bad commands' from clients (CfgDisabledCommands) don't add server's special reaction to these commands, but just forces original client to not execute it.
I don't want to blame anyone, but if it's true then it is.... sad?
Y'all talking about servers and headless clients when 75% of my hours are singleplayer πππ
I dont even know π I added it to player init it didnt worked right, now I added it to both idk
CfgDisabledCommands doesn't prevent anything from sending, it simply cuts off these commands from being executed in scripts. Command may be local, may send network stuff.
Arma is very client-side oriented game and relatively easy to cheat in, unfortunately
@tough abyss Check this out if SQF confuses you. https://foxhound.international/arma-3-sqf-cheat-sheet.html
A cheat sheet for ARMA 3 SQF language elements and commands.
well thabk you
(Might confuse even more at first but give it thorough read and it will become clear)
try reading github docs
@spiral fractal player init as in initPlayerLocal.sqf ?
or editor Init field of the player unit?
C# and SQF has nothing in common, SQF is just madness
it is madness only if you haven't learned it before C#
SQF is alright. Mess with scripting commands is the issue, as they've evolved over 20 years from OFP times.
yes you probably right winse, but I think anyone who know programming understands that SQF is not right
getPosWorldVisualWorld, boundingBox/realBoundingBox, viewDistance/getObjectViewDistance, etc ^^
Namely BI introducing commands to solve their missions needs only, usually without much flexibility or future-proofing
@spiral fractal keep in mind it has been developed before year 2000. In that times there was no all that best practices we have now
WFSideText the real gem of scripting commands π
WF prefix was for WarFare?
Yep, a command to turn side into string for Arma 2 Warfare
I dont understand... because I dont have to deal with lazy devs who port stuff 4 times
indeed, pretty much self-oriented
@meager granite by the way, I checked the spectator with eachFrame camera. Can't say there are much difference comparing to the while {true}.
Thankfully it all changed for better in Arma 3 but remnants of old mess will forever stay in SQF
@quartz pebble Oh I remember now, there are different each frame handlers that execute at different times in frame
You need specific one to have smooth spectator camera experience on fast moving objects
Trying to remember which one
my current approach is addMissionEventHandler ["eachFrame", ...]
Yeah, you need another per frame handler. Had this issue years ago, trying to remember what I did.
Maybe it was Draw3d
why BI cant change those commands? to make them execute right, without the need for remoteExec etc? or prevent vehicles from changing locality?
Locality change is fundamental concept in networked games.
In your case you need to call setDamage 0 ONCE from whoever initializes the repair and then boardcast call for another function that does other commands everywhere on all clients and server (no JIP of course)
Nope. draw3d makes it worse.
what if I just remoteExec this function with 0?
@spiral fractal func will exec on server and every connected client
@quartz pebble try to target visual position?
Oh yeah, I assumed you already had visual position commands used
@spiral fractal It should work but you'll do setDamage 0 needless amount of times
Each client will do setDamage 0 sending the message to each other client
as command is global
where should I put that function? I have server and client init, if I add it to client, when I call remoteExec what will happen?
- RemoteExec
engineOn falseglobally sleep 1setDamage 0- RemoteExec other 3
set*commands (remote exec call function which has them or something)
But I know that PUBG and DayZ was initially created in ArmA. For such kind of gameplay cheating is terrifying.
I heard that Arma 4 will use DayZ:SA engine. I believe that it should have better cheat-protection (and maybe totally different engine architecture). So, will cheating became harder sometime?
And, to not let this message being totally offtopic, I want to ask:
How could I change Player UID? I'm using it in scripts for persistent player differintiation, but when I testing mission localy (one PC, two ArmA windows) looks like it getting mess. Maybe there is some 'testing mode' when I can temporarily change UID to random one.
@winter rose I use visual pos atm. Draw3d makes camera jump
@karmic swift there is none.
@winter rose Is it possible to change the default loadout of dynamic loadout vehicles in a warlords mission?
I don't know and don't think so
@quartz pebble Remember it now, check how BI spectator camera works
EGSpectator in functions_f_exp_a.pbo
@meager granite checked yesterday - was looking for some magic but there wasn't
It does make smooth camera follow though, there is magic on a way its done but I can't recall exact details now.
The only thing seemed unusual - it tries to do some FPS based calculations
@winter rose Ok, I have seen that there is a CfgVehicles which can be put into a Config.cpp but I am not sure how to use it nor if it will actually solve my problem...
Β―_(γ)_/Β―
Β―_(γ)_/Β―
Hey I'm trying to add ace-Actions which will also be added to players which join later in game. This is what I got, it works on players that are on the server but not the one that do jip.
["eh_setupACEComputer",
[_computer,_antenna],FORMAT["%1_setupACEComputer",_computer]] call CBA_fnc_globalEventJIP;```
Thats what I use. The other side looks like that.(Only that there are more actions) sqf // ACE-Actions ["eh_setupACEComputer", { _code = { // DO THIS }; _condition = { // WHEN THIS }; _action = ["JAM_SwitchOn","Computer Anschalten","",_code,_condition,{},_antenna] call ace_interact_menu_fnc_createAction; [_computer, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject; }] call CBA_fnc_addEventHandler;
I think if you just add the ACE interaction to player init and the object name set in mission.sqm it will work without the CBA_fnc_addEventHandler
The problem is that because the way the mission is setup/the scripts are linked I cant just put it in the initPlayerlocal.sqf because that will cause the variables to be defined more then one time and similar stuff.
any way i can delete mines created with the createMine command?
The problem is that because the way the mission is setup/the scripts are linked I cant just put it in the initPlayerlocal.sqf because that will cause the variables to be defined more then one time and similar stuff.
@mortal crypt I get the feeling that I setup something wrong. Even the remoteExec jip is not working
any way i can delete mines created with the
createMinecommand?
@fervent kettle withdeleteVehicle
so, why...
veh1 = "LIB_SdKfz124" createVehicle ([1731,50,0]);
_grp = createVehicleCrew veh1;
veh2 = "LIB_OpelBlitz_Tent_Y_Camo" createVehicle ([1731,40,0]);
_grp = createVehicleCrew veh2;
veh3 = "LIB_OpelBlitz_Fuel" createVehicle ([1731,30,0]);
_grp = createVehicleCrew veh3;
veh4 = "LIB_OpelBlitz_Ammo" createVehicle ([1731,20,0]);
_grp = createVehicleCrew veh4;
veh5 = "LIB_OpelBlitz_Ambulance" createVehicle ([1731,10,0]);
_grp = createVehicleCrew veh5;
veh6 = "LIB_SdKfz251" createVehicle ([1731,0,0]);
_grp = createVehicleCrew veh6;
grp = createGroup west;
[veh1, veh2, veh3, veh4, veh5, veh6] joinSilent grp;
grp selectLeader (units grp select 0);
systemChat str(units grp);
(Creates and prints "B Charlie 1-6:1, B Charlie 1-6:2...B Charlie 1-6:6")
Creates adicional Bravo 1-5 and Bravo 2-5 groups. (?)
https://paste.pics/87e90fc61102b812a98e238dc663688c
@fervent kettle with
deleteVehicle
@mortal crypt how exactly? IΒ΄ve used that only once to delete infantry, but not for mines
@mighty vector Check docs for joinSilent https://community.bistudio.com/wiki/joinSilent
@mortal crypt how exactly? IΒ΄ve used that only once to delete infantry, but not for mines
@fervent kettle What and where do you want to delete?
So, i have a script that places mines createMine and i want to add another script to delete the spawned mines
simply all mines?
@mighty vector joinSilent takes units, not vehicles. I just checked, providing unit only uses first unit in the vehicle to move groups, not entire vehicle crew.
(crew veh1 + crew veh2 + crew veh3 + crew veh4 + crew veh5 + crew veh6) joinSilent grp;
Try this, might work
@meager granite ill try. However, trying to avoid that error I tried:
grp = [[1731,50,0], WEST, ["LIB_SdKfz124", "LIB_OpelBlitz_Tent_Y_Camo", "LIB_OpelBlitz_Fuel", "LIB_OpelBlitz_Ammo", "LIB_OpelBlitz_Ambulance", "LIB_SdKfz251"],[[0,0,0],[0,-10,0],[0,-20,0],[0,-30,0],[0,-40,0],[0,-50,0]]] call BIS_fnc_spawnGroup;
grp setFormation "FILE";
grp selectLeader (units grp select 0);
the first vehicle of the convoy is not the LIB_SdKfz124, but the 2nd, then the 3rd and so on...until the LIB_SdKfz124 (the first in the array)
perhaps is better to use this approach? (better code, less error-prone...)
{if(_x dist _pos < _maxDist)then{deleteVehicle _x};}foreach allMines;
@mortal crypt like that?{if(_x distance "removemines1" < 25)then{deleteVehicle _x};}foreach allMines;
@mighty vector Just change order or vehicles in that joinSilent above?
@mortal crypt like that?
{if(_x distance "removemines1" < 25)then{deleteVehicle _x};}foreach allMines;
@fervent kettle lets take this to private will be faster to help. you can post something when its finished
@meager granite u mean 6th,1st,2nd,3rd,4th,5th ?
...a kitty just died for that
could this be based on how the "insert node in list" is implemented, hence shall be corrected or at least reflected in docs?
I am really wondering what I do wrong. Or if I understand something wrong.
["Text"]remoteExec["systemChat",0,true];```
This should send the message to all players including the ones that are going to jip in the future right?
"Text", not ["Test"]
You need string argument, not array containing a string
@mortal crypt
Okay thanks, that actually works. Now I have to translate that to my script.
Found my problem. The eventhandler is created after the jip code is executed. now to delay the jip code..
*think I found my problem
In a multiplayer mission on a dedicated server, what's the correct waitUntil statement before opening a camera that the player need to watch?
waitUntil { not isNull player };
```?
is player null during the briefing screen?
i think its null until it has a unit
JIP, player is null before being a unit
thanks, will try. Thought it was way more complicated
Query on available spectate scripts. I used CSSA3 back in 2015 and now am back into mission development etc.
What i am after is a more up to date and light spectate script if there is one that I can add to a mission template/framework. (Main usage 1st person spectate mode while in a "waiting for revive" state, which i need to control dynamically)
Failing that is it possible to interact and dynamically control the BIS system using mission based scripts.
(I really don't want to attempt to extract the BIS system into a local version, there systems always seem to be a tangle of function calls to other pbo's and its a pain to try and trace extract them)
So if i were to use the BI internal system, I would need to control the following within the mission code
- Enable and disable dynamically
- Set to 1st person only
- Define the spectatable objects
UPDATE:
nm found it BIS_fnc_EGSpectator
I am trying to find a var renaming function similar to the editor auto naming of varnames when copy pasting: var and then var_1 , var_2 etc. It's pretty simple but a search didnt yield any results and someone must have made it in sqf already, does anyone know of anything like this? thanks
not sure what you mean, other than mass rename of all "strings" that equal "ABC" to "XYZ" across multiple files but thats done in most code editors
there is a unique varname system in the editor, you cannot have two unique varnames. When you copy paste something with a varname, it automatically renames it. I think it is very likely that someone has replicated that already in sqf.
I didnt know that existed, most mission devs use a tag for their global vars, mine is Txu to avoid this happening
I am talking about object varnames not general global variables
well the editor doesn't allow you to define 2 objects with the same varname, it warms you and doesnt acceot the second version of the value... so am failing to see how you manage to achieve that
if you spawn objects and you want to set varnames
if object has already been spawned I want next iteration to have _1, _2 suffix etc
if your creating say 1000 markers then typically you will have your first marker called something like MyMarker and then copy and pasting creates newer versions with a _(+1) incremental name
if you want to do that in a script then you create a loop with an incremental counter to change the varname
yes in a var loop sure which gives you the naming scheme
I just dont want to rewrite a function that checks missionNamespace for the existence of a varname, and then renames it akin to how the editor does it. I would assume someone has already written it
Here is an example used to dynamically increase the varname by adding a tag _(+1) to every iteration of the loop, if this is what you are after.
This is used to create a series of group indivdual tracking markers
thank you but this is not what I am after
then you havent explained it in a way that makes sense to me... or it isnt required
you want something like
If exists ABC_1 then create ABC_2 ??
yes, as simple as can be
just checking missionnamespace and renaming like the editor
and where do you grab ABC from
from a user input
its a passed var
renaming function would only be called if passed var is supplied
ok so you need to check isnil for the string version and then compile the string version and check is isnul
it may also depoend on the type of var that is being passed
I am just asking if someone has already done that since it seems like it would have been done before
not really, it is just a suffix on an already valid var
it seems doubtful to me that this would be the case, because anyone writing a system that increments in that way would be using a unique varname that they create and incrementing the varname in their own script. For example someone creating a scripted composition if they needed to keep track on say an object within that composition and there were 5 or 6 versions of that composition created within a mission. They wouldnt even need to do that for the objects because they would just store all the objects in an array allowing them to later delete the composition..... Can you give me a real world example of why you see this an necessary... What objects within a mission are you working with that you cannot control or know the varname for ?
...
user input names of spawned objects
if they spawn compositions of objects more than once, I would like a predictable varname for the duplicated which have been renamed
as the editor does it
aha so you have a gui that players can create objects with and you need a dynamic naming system for them ?
not a gui but an init function but yes user inputted string for a varname which gets set
I guess you can find last "_" in existing string, parse number after it, increment it, etc... I'd do it like that π€
@slim oyster
_marker = createMarker [format ["marker_%1_%2", player, time], _position];
I'm using an existing inputted string as the base varname I just want the suffix to change
not just a unique name
"player + time" should be enough unique, I don't think that player will spawn multiple compositions in less that 1 second
you can use position as a part of name π€
but yes I understand your idea
I want a predictable varname to point to and access not just a unique name, a predictable name akin to the editor
player + time is predictable π
no it isnt lol
you can't guarantee that time won't ever be absurdly large...
@astral dawn yeah, guess i'm writing that then
then do player + counter (player setVariable ["composition_counter", 0])
wheel reinvention... inevitable π¦
INIT.sqf:
Txu_MyCounter = 1;
//ok so maybe use the players name as the unique varname
//SCRIPT
ObjectID = format ["%1%2",name player, Txu_MyCounter];
Txu_Mycounter = Txu_Mycounter +1;
(call compile _ObjectID) = createvehicle ............;
then you can add the object to an array with all the other objects PV it if you need to remotely interact with the objects or an array of objects for say the admin
seems when you add code in here it removes some underscores
or use the first X letters of a players name if you want to maintain a shorther varname, add some "X's" if you wanted a 4 letter tag and the players name was Ted π
maybe you could also incorporate NetID into the varname, thats unique to each client
or this..... BIS_fnc_objectVar (Fits your requirements perfectly)
if you want reproducable identifications, you could always hash the persons name
[object, varNameRoot] call BIS_fnc_objectVar automatically adds an increment so its exactly what you wanted. Am assuming this is networked and not local but you would have to test or look at the function code to see if it pv's or remote calls the varname
private _return = if !(isNil _varName) then {
for "_i" from 1 to 100 step 1 do {
private _testName = format ["%1_%2",_varName,_i];
if (isNil _testName) exitwith {
_testName
};
};
} else {
_varName
};
_return```
is variable name for setVariable getVariable case sensitive ? E.g. _object setVariable ["MyVariable", 0] vs _object setVariable ["myvariable", 0]
@real tartan No. But be careful, as it could became case sensitive when you try to operate the lists/arrays, like "myVariable" in (allvariables _object), but it is rare case, and allvariables returns all in lower case.
Is there any event handler for helicopters, as analogue for LandedTouchDown for planes?
as far as I understood, sqf if check will not exit if the first value is false, it will check all the rest unless I add { }, it is true?
if doesn't check anything
then gets a boolean, if the boolean is true it executes its code
Not sure how I should explain SQF basics to you,
But basically.
(A && B && C) then
is what you write down, what SQF executes is
A
B
C
&&
&&
then
it doesn't even get to the if/then before it finished executing ABC and the &&'s
wow
But!
&& and || have a special syntax
A && {B}
will be executed like
A
{B}
&&
as you can see, B never gets executed, its just a CODE type value thats being passed on, its content wasn't executed yet.
&& checks if A is true, if yes it will execute the CODE that was passed, if not, it'll skip it and return false, never executing B itself.
// game will check both conditions
if (alive player && damage player == 0) then { ... };
// game will not check player's damage if he is dead
if (alive player && { damage player == 0 }) then { ... };
another nice feature of the language, I still forget to add thethen and now I have to add brackets π
@still forum Is there any difference between A && {B} && {C} and A && {B && {C}}?
Yes
in the first one the {B} and {C} will be pushed onto the stack, and the second && will always evaluate
in the second one.. not
Thanks
Thank you for the explanation! but if you work on Arma 4 please use normal language such as C#, and dont worry about the code base, I am pretty sure it will be much better to rewrite stuff anyway
it has to be done at some point...
@spiral fractal not that he takes the decision anyway.
Also, it has been mentioned times and times again that Arma 4, if it happens, should use the Enfusion engine - Enfusion engine using the Enforce Script Syntax
https://community.bistudio.com/wiki/DayZ:Enforce_Script_Syntax
I read somewhere that BI want to keep "backwards compatibility" for all the sqf content so I am not very optimistic about the next Arma game / engine...
that's on the "wishes" list. Main syntax is EnScript.
Sqf is consistent in itself
Just to Note
Imagine I had to create a few thousands of shapeless objects for the purpose of helper snap points, what's my best choice? createUnit logic? createVehicleLocal with some light shape like helper arrow then hide it? Or the CBA namespace location?
nevah createUnit - it brings AI to the issue
I usually createVehicle(Local) an invisible helipad @astral dawn
createUnit is not needed if AI is not needed ^^
even better with createSimpleObject and the arrow stuff to make sure the position is correct - then hiding it
yes I'm just not sure if shape still is being processed somehow even though it's hidden
no, or at least I am not aware of it
okay cool, proceeds to generate thousands of arrows
note that createSimpleObject takes a world position
Hello people, Im having issues with the setAmmo so if anyone has hints that would be great. I am creating a script that forces AI vehicles to deploy smoke screen. To be on the safe side I would want to make sure the vehicle in question has ammo for the smoke launcher. I am currently working on the vanilla APCs and _unit setAmmo ["SmokeLauncher", 2]; seems to work only for the CSAT Marid. I have no idea why since I have checked the configs for all vehicles and the weapon is the same (with same magazine size). I've also douple checked locality as that is relevant for setAmmo command.
Its done earlier in the script params
Defining the unit in question works for other functions its so not the issue
then possibly you need to also find the correct turret the smoke launchers are on
The syntax from the wiki has nothing on the turret path so I am not sure where in the array to put it. Also it is noteworthy the example I gave does workd for the marid, just not for the other apcs (haven't even tried other vehicles)
there are other commands to manipulate ammo for vehicles/turrets
Magazines for the turrets are a real pain once I get into modded vehicle territory, setAmmo has so far worked for mods wihtout an issue. Also assuming the vehicle is out of ammo it would have to reload the new magazine if I went doen that path, setAmmo would allow instant firing. So besided stuffing new magazines in any other avenues you had in mind?
off the top of my head I dont have any other ideas. I think your approach may just be incomplete as it is now
π© Thx anyway
Doesnt mean Im right, just cant think of how you should do it
setVehicleAmmo Works but is obviously not ideal
why not?
Because it loads all weapons
So it would be filling all the cannons etc which is not desired
grp = [[1731,50,0], WEST, ["LIB_SdKfz124", "LIB_OpelBlitz_Tent_Y_Camo", "LIB_OpelBlitz_Fuel", "LIB_OpelBlitz_Ammo", "LIB_OpelBlitz_Ambulance", "LIB_SdKfz251"],[[0,0,0],[0,-10,0],[0,-20,0],[0,-30,0],[0,-40,0],[0,-50,0]]] call BIS_fnc_spawnGroup;
grp setFormation "FILE";
grp selectLeader (units grp select 0);
the first vehicle of the convoy is not the LIB_SdKfz124, but the 2nd, then the 3rd and so on...until the LIB_SdKfz124 (the first in the array)
could this be based on how the "insert node in list" is implemented, hence shall be corrected or at least reflected in docs?
@mighty vector if you mean that vehicles are not driving in the same order, this must have to do with rank/vehicle leader, not the function itself.
in a group, the first to walk is not the leader but the highest rank?
yep. 3 can be the leader
did i missunderstood the meaning of lead?
also, there is a difference between vehicle (and therefore formation) leader and group leader
so, let me check if i got it...to make the first vehicle go first, i should set him the highest rank
then, whats the use for setleader?
force the leader?
and than means...?
actually, maybe the first spawned unit (in-game!) is the group leader, that I don't know
but if you have e.g a car driven by a soldier with Private rank, and he is the group leader, and he is followed by a tank with full crew, the tank commander is higher-ranked in term of vehicle formation (as "leader" of a vehicle) so he will take the lead, iirc
to be honest...this doesnt make much sense for me.
I'm probably wrong, but AFAIK, lead shall be the "first" to walk. no matter who "commands"/give orders.
to you Β―_(γ)_/Β―
so, if the above code doesnt make first vehicle move first, i think it's suitable to be filed as a bug
place two soldiers with "private" rank in Eden, the place a third one with "sergeant" rank, and see which one links all the others
also, IDK if BIS_fnc_spawnGroup gives ranks to units
Hello,
Back again with a sqf scripting question.
I've managed to script in an action that lets me teleport my vehicle
onMapSingleClick "vehicle player setPos _pos; onMapSingleClick ' '; true;";
However, I would also like it to teleport at a high altitude alongside teleporting to the position. I've tried a while now but I can't seem to change the altitude of the vehicle alongside teleporting it to the map click location (the altitude change always happens before i click on the map). Any suggestions?
@spice vigil ```sqf
onMapSingleClick {
_pos set [2, 2000]; // 2000m altitude
vehicle player setPos _pos;
onMapSingleClick "";
true;
};
That makes sense. Thank you so much Lou, I ask so many question you should be the one credited for making this script, haha.
I demand 50%!
Is there any way to reload in dev_branch SQF scripts?
@winter rose just tested, it seems is not a rank issue, although I could set ranks in BIS_fnc_spawnGroup. I'll dare to ask in general chat, to see if dedmen consider it a bug (and hence file it)
@mighty vector have you tried one-crewMember vehicles?
on my way!
seems to work 
hmmm
setleader receives unit...perhaps is not working 'cause is not "a single unit" vehicle?
ie: instead of
grp selectLeader (units grp select 0);
grp selectLeader (crew (units grp select 0) select 0);
units returns units, not vehicles
@mighty vector try maybe```sqf
private _firstUnit = units _group select 0;
private _firstVehicle = vehicle _firstUnit;
_group setLeader effectiveCommander _firstVehicle;
that last line seems buggy (Generic in expression)
and now the first vehicle is moving just after spawn..."breaking" the "FILE" formation to do a wedge
...
nevermind...ill try tomorrow (i need to sleep!!!)
thanks Lou!
Do you think it is possible through a script to lock a vehicle (like a plane class) X and Z axis movement so it can only go up or down in a straight line?
yup
with setVectorDir/AndUp I suppose
I'll try something like setVectorDirAndUp [[1,0,0],[0,0,1]];
Hmmm, is there any way to make _x setVectorUp surfaceNormal position _x constantly be in effect?
a loop
How do I give a variable name to a person I spawn in with script? Say I wanna have a Rifleman spawn with script, and give him a variable H1
I might be going about this the wrong way, or just overlooking something simple; I am trying to use BIS_fnc_showMarker to show markers, in this case changing Marker_5's alpha to 75 over 2 seconds with: ["Marker_5",2,0.75] call BIS_fnc_showMarker;.
I can get it to work when including as part of a timeline and spawn BIS_fnc_AnimatedBriefing however I am trying to call the function without the use of the animated briefing. Am I going about this the completely wrong way or is there something I'm missing? Any assistance would be greatly appreciated.
@fluid cairn H1 = createUnit (β¦)
So I see how to find a task's children/parents, but how do I make a task a child/parent?
if u are using the task framework, i believe you do it with the first parameter of
https://community.bistudio.com/wiki/BIS_fnc_setTask
the wiki says it can be the task id as a string, or an array [task ID, parent task ID] , however the setTask function appears to support children as a third element
_ids = _this param [0,"",["",[]]]; if (typeName _ids == typeName "") then {_ids = [_ids]};
...
_parent = _ids param [1,GET_DATA(_taskVar,PARENT),[""]];
_children = _ids param [2,GET_DATA(_taskVar,CHILDREN),[[]]];
SET_DATA(_taskVar,ID,_id);
SET_DATA(_taskVar,PARENT,_parent);
SET_DATA(_taskVar,CHILDREN,_children);
That did the trick π
sorry if this is the wrong place but i was wondering if there is a way to make an addaction scroll wheel thingy a one time use?
yes there is, remove the action in the script it executes
this addAction ["Hello World",{
params ["_target", "_caller", "_actionId", "_arguments"];
_target removeAction _actionId;
// ur stuff
}];
thank you
@glacial lagoon look into filepatching. Will need stuf fin Arma dir and stuff. Not sure if there is a wiki page explaining the setup, I think there should be one
I'm trying to play with some CBRN stuff and ran into a small issue. For some reason Say3D does not play custom sounds defined in description.ext:
class CfgSounds
{
sounds[] = {};
class P0Choke03 {
name="P0Choke03";
sound[] = { "A3\Sounds_f\characters\human-sfx\Person0\P0_choke_03.wss", 1, 1 };
titles[] = {0, ""};
};
};
player say3d "P0Choke03" does nothing
playSound3d ["A3\Sounds_f\characters\human-sfx\Person0\P0_choke_03.wss", player, false]; plays the sound (so I know the sound file name is correct), but the sound is not attached to player when he moves. Besides, Say3d has the advantage of interrupting unit speech (I think)
Does anyone know what might be the issue?
you might need an @ at the start of the filepath.
i cant seem to find an example of it in use on the wiki, but iirc in the mission file CfgSounds you use @ to indicate the sound is not in the mission file or something
That worked, thank you!
great! I found the example I was looking for too, the last note in this section
https://community.bistudio.com/wiki/Description.ext#CfgSounds
I've read it too, but I was confused by what AddOn meant there, I thought it meant unofficial addons
Since Arma 3 v1.49.131710 it is possible to define AddOn sounds in mission config. In order to make engine look for the sound in AddOn, the sound path must start with @ (instead of ) for example:
Although the example shows @a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode so yeah, should have guessed
arma pbos technically count as addons too i guess, they load from addons folders just like mods do.
also, you could simply use say π¬
is it possible to setup push to talk to also put what your saying over direct? if so could you point me in the right direction so i can research it.
no setup needed, the game does that I believe
and if not, there are no scripting commands regarding VOIP @exotic tinsel
so if im in group i can have it also push to direct?
thats a modded only thing i believe. like tfar
you said "also" push to direct; you can chat in direct channel by switching them, and if you want to speak e.g in side channel and be heard closeby, either the game does that by itself or there is no way to do so (without mods)
Arma does not allow you to speak in two channels at the same time natively. im in the scripting channel looking for a way to script this/create mod. If someone has any "direction" to do this please reply.
none in scripting I'm afraid
the game does it for pre-recorded voices (you can hear AI talk over the radio when close)
how can i triger a trigger if a player is in the trigger and a object is null
im pretty new to scripint in arma
intelNull = false;
intelNull = if (mission_2_intel_tablet isNil) then {true} else {false};
ive been tring that and putting
you can link the trigger to units you want to be able to trigger it
wrong syntax for isNil
surely you mean intelNull = isNull mission_2_intel_tablet;
^
let me see iff that works
that better be good @robust hollow π π
π€ π
didnt do anything
do you return intelNull somewhere?
wait one i may of done something stupid
i'd believe it π
so i have a intel item called mission_2_intel_tablet
and the triggers set to be active when anyplayer is present
may have, please π°
There a function that grabs all factions on a side, for example all faction on West?
and i want the conditional of is the obj mission_2_intel_tablet exist to triger the trigger when all critera is met its 5 am and ive been pulling my hair out past three hours so i may need a dumb down explnation
@brave jungle BIS_fnc_getFactions xD
Anyone can help me? I've got a little trouble activating my scripts. I have three BLUFOR units, each having the INIT to execVM "RandomLoadout.sqf" inside RandomLoadout.sqf i've got "_unit = _this select 0;
_RandomLoadout = ["Loadout1.sqf","Loadout2.sqf","Loadout3.sqf"]; selectrandom _RandomLoadout;" Each loadout.sqf has a different hint (to confirm that script has been activated, and which). Though it does not work. The purpose is to have each unit select a random loadout from loadout1, loadout2 or loadout3. If i execute the "_unit = _this select 0;
_RandomLoadout = ["Loadout1.sqf","Loadout2.sqf","Loadout3.sqf"]; selectrandom _RandomLoadout;" inside the console when inside a mission it works just fine.
oh wait, this does not search by side @brave jungle
Oh it doesn't?
@clever radish use ```sqf please (see pinned message)
Then I stand by my question π
so if i put intelNull isEqualTo true; in conditions on trigger and intelNull = isNull mission_2_intel_tablet; in init.sqf would that work?
i'll look a little more, otherwise i'll just make myt own function
@brave jungle a list is available @ https://community.bistudio.com/wiki/faction
@winter rose I do not understand. I'm pretty new to Discord
But thats just for objs
I'll let you help him first I'll come back when it's quieter π
@winter rose Oh, i got it. Sorry.
oh
will try
it still isnt functioning
["intel","FAILED"] call BIS_fnc_taskSetState;
this is correct right
task id is intel
Anyone can help me? I've got a little trouble activating my scripts. I have three BLUFOR units, each having the INIT to execVM "RandomLoadout.sqf" inside RandomLoadout.sqf i've got "_unit = _this select 0;
_RandomLoadout = ["Loadout1.sqf","Loadout2.sqf","Loadout3.sqf"]; selectrandom _RandomLoadout;" Each loadout.sqf has a different hint (to confirm that script has been activated, and which). Though it does not work. The purpose is to have each unit select a random loadout from loadout1, loadout2 or loadout3. If i execute the "_unit = _this select 0;
_RandomLoadout = ["Loadout1.sqf","Loadout2.sqf","Loadout3.sqf"]; selectrandom _RandomLoadout;" inside the console when inside a mission it works just fine.
@clever radish If you adjust your comment to add code formatting someone will help you better, its hard to read like that
as lou said, see the pinned messages
F12 is always your friend, mate
:p steam likes to hide the screen shots from me
@clever radish
_unit = _this select 0;
_RandomLoadout = ["Loadout1.sqf","Loadout2.sqf","Loadout3.sqf"];
selectrandom _RandomLoadout;
_unit = _this select 0;
_RandomLoadout = ["Loadout1.sqf","Loadout2.sqf","Loadout3.sqf"];
selectrandom _RandomLoadout;```
that's what I mean
Anyhow
the reason it works in the debug is because you have _this select 0 at the start
I have tried 1000 times now, and it keeps bugging the message i wanna send. The ´´ suddenly stops working.
XD Thanks
[player] execVM "RandomLoadout.sqf";
in the init then it will work.
or just remove the _unit = _this select 0 to _this; and then you can just do player execVM "RandomLoadout.sqf";
I will try it out. Thank you
you have to have your argument in an array format because you are using select 0. _this is a "magic variable", can read about that on the wiki, but it means that _this takes the place of argument(s), so in this case player
so with isNull mission_2_intel_tablet as the condition and any player present set as well as on activation ["intel","FAILED"] call BIS_fnc_taskSetState; it dosent do anything and im not exactly sure if its triggering and not calling the setTaskState or what
no, restarting arma
Cool
did know that was a thing
Very handy π
where does it show the errors at?
An error pops out, saying it got a script, but excepted nothing
should paste the error
Oh course it's execVM
nul = [player] execVM "RandomLoadout.sqf";
If I remember right
Yeah, that works
Perfect
I dont know, but it should, as all of my other execVM has the "nul =" in front
Yeah it's weird I forget why but it always has it
Apprently this makes my ARMA go to windowed mode.. weird
so do the acript errors show in rpt or?
okay
if it encounters one
well with it off i got those every know and again lol
haha
Yeah well you'll get them more now
so when a player enters a trigger, you want it to see if an object is destroyed then set the task to failed?
It does not work. It's the same as before, the hint message does not show
but it still exists?
in the object attributes the probability of presence is what im using to determine if its there or not
@clever radish see your DMs
also does it log the black box errors anywhere
your rpt always logs unless you turn it off
mk
If i were you, always have the object there, but then a chance of it being "hidden", so maybe move it to [0,0,0] if its cahnce of being seen is false
avoid it erroring out
and i gues you check if its at that cords?
If its in the trigger area
else you would have to check```sqf
if (isNil "mission_2_intel_tablet" || { isNull mission_2_intel_tablet }) then
{
...
};
do i put thin in conditions?
or do i put in in init and use that to set a variable true or false?
if (isNil "mission_2_intel_tablet" || { isNull mission_2_intel_tablet }) then
{
aTestVar isEqualTo true;
};
activation
the bit inbetween { ... } is whatever you want to happen if it's not present or is destroyed
Has anybody found/documented how to place sick civilians from Old Man in a mission? I've found the CfgIdentities with _sick suffix, but they only seem to show it on face, not on hands/legs
not documented yet, but you can read functions in the Functions viewer @verbal rivet
Do you have a hint on what they're called?
IDK there's something but it must has OM_ prefix
Yeah, I know there's sicky arms and legs material in the pbo but I've never seen in-game
Ah, right, prefix + there's "addon" filter in functions viewer, and "Old Man" is selectable
Does anyone know a easy way to make a shed, which has some crated inside, randomly spawn on helipad1, helipad2 or helipad3?
a combination of createVehicle, selectRandom and getPosATL should do
If you know how to spawn a shed, you can select a random position by using getPos selectRandom [helipad1, helipad2, helipad3]
If you know how to spawn a shed, you can select a random position by using
getPos selectRandom [helipad1, helipad2, helipad3]
@verbal rivet yes, but the crates inside should not be centered inside the shed
For example; I've got a shed, it has some crates below a window and some crates at the door, which is on the other side. I want the crates to stay like that, no matter on which helipad it spawns. I have tried a few methods, but it makes the crates and shed center in XY of the helipad
if you setPos them at the same position, of course yes
now you can use modelToWorld to set the crate from the shed's position
Or, place your shed/things in editor, calculate difference between current shed position and helipad position using vectorDiff, and then use vectorAdd to add that diff to every object's position (but that supports translation only, not rotation)
okay, thank you. I will try
another one π
use getPos' alternative syntax:
_shed setPosATL _randomPos;
private _shedDir = random 360;
_shed setDir _shedDir;
_crate setPosATL (_shed getPos [2, _shedDir + 90]); // 2m, relative 90Β°
_crate setDir _shedDir + 15; // if you want a relative 15Β° dir
if i remb right, switch do default doesn't require any code right
can just do default: {};
modelToWorld... set of commands is my favourite and it deserves a meme :D
https://cdn.discordapp.com/attachments/665869822181113886/707190885850415165/unknown.png
@brave jungle no : after default
also, you don't have to remember anything: the wiki is here for that π
@astral dawn ab - so - lutely!! π
Ah ty π and yeah true
Not getting a return, needs to return an array.
_selectedSide is a number, 0 to 3 depending on the ID of the side. this gets run through a faction splitter which works perfectly and sorts it all out into sep arrays, but _selectedFaction isn't taking the value of the _sideFactions, side being a side.
_eastFactions is returning the list correctly so I don't get why the simple reassignment isn't working?
_fnc_sideGetFaction = {
_selectedSide = param [0, [1], [0, 1, 2, 3]];
_westFactions = [];
_eastFactions = [];
_indeFactions = [];
_civiFactions = [];
//format each faction into its side
_fullfac = [] call BIS_fnc_getFactions;
{
_value = getNumber (configfile >> "CfgFactionClasses" >> _x >> "side");
switch (_value) do {
case (0): {
_eastFactions pushBack _x;
};
case (1): {
_westFactions pushBack _x;
};
case (2): {
_indeFactions pushBack _x;
};
case (3): {
_civiFactions pushBack _x;
};
default {};
};
} forEach _fullfac;
switch (_selectedSide) do {
case (0): {
_selectedFaction = _eastFactions;
};
case (1): {
_selectedFaction = _westFactions;
};
case (2): {
_selectedFaction = _indeFactions;
};
case (3): {
_selectedFaction = _civiFactions;
};
};
_selectedFaction
};
_selectedFaction is only defined in the cases. You need to define it outside, or make it private I think
(I honestly don't understand how private is important π )
private declares the variable in the scope you use it. if you don't use it, you create the variable in the switch scope, and this scope disappears later
see https://community.bistudio.com/wiki/private#Examples Example 4
It's so you can reference the same variable name in seperate scopes right?
yep
That's why I don't get when is the time to use it honestly
@brave jungle that's also why you have undefined variable too π
hehe
default behaviour: use private whenever you use a new private variable
private _var = 1; // boom - problem solved
it's even explained in https://community.bistudio.com/wiki/Code_Best_Practices#Variable_format π
oof
@robust lichen are you sure you wanted isNull and not isNil?
an object has probablity of not being there
You want isNil.
isNil "mission_2_intel_tablet"
null checks for null type, nil checks for existance. If the object doesn't exist, the variable will not exist.
Also
if (x) then true else false
is nonsense and always the same as just
x
Same as
x isEqualTo true
is just as much nonsense.
Also sorry for being a few hours late :U
way too late - now gib PiP settings
I can give you pip settings 1.99 build if you want 
oh, youβ¦! β€οΈ
But only because i have my whole unit on 1.99 internal dev builds and thus already have it laying around 
n-not for my beautiful eyes? hurt in my meow meow π’
There is a condition field for objects in editor. I'm using persistent save/load system, and I need to track if some objects, placed in editor, were destroyed.
Of course, the mission file loads every time on each savegame load, so the placed objects.
Is there any way to store some variables for objects status checking on the mission load, in that condition field?
I.e., instead of true - server getvariable ["KennyAlive",true] in a object init field. In this case, server initialized after mission load, so for all of the objects placed in editor, it would be true by default.
if your server is persistent (set in server.cfg) you should be able to use
_someVar = "test";
missionNamespace setVariable ["some_var", _someVar , true];
// restart server
_someVar = missionNamespace getVariable ["some_var", "some_val"];
alternatively, when you want to share data between missions(!) you should even be able to use profileNamespace instead, as long as it's ran on the server
@exotic flax Thanks
What does it mean, when a Unit cannot be null?
That the unit cannot not exist (I guess?)
hello guys, I'm looking to count the number of players in a given radius. May this nearestObjects [_position, ["player"], _radius];nearestObjects [_position, ["player"], _radius]; work ? (i cant test it rn)
I don't think player is a valid type
@runic edge allPlayers count {_x distance _position < _radius}
thanks @meager granite you're probably the man for counting players ^^
count (allPlayers inAreaArray [_position, _radiusm _radius])
allPlayers count {_x distance _position < _radius}
Wrong sytax in this example, btw.
Should be {_x distance _position < _radius} count allPlayers
Hello ! Anyone know how to start a direct connection to a server just with a button? I made a script which launches the server browser and which automatically launches the connection but does not work, someone have an idea?
@eternal steeple not really scriptable per se, but doable if you look at http://killzonekid.com/farewell-my-arma-friends/ that does it by clicking on the interfaces for you
I use grad_spotlight I think, its probably on github
Humm i see, i test with : https://forums.bohemia.net/forums/topic/218185-server-spotlight/ but i delete the spotlight
ugh so ugly. Somewhat similar to mine
Ah, just as ugly as mine just never scrolled down that far
yaeah that spotlight probably what I'm using
I'm trying to open the map mid mission and zoom to a certain area but am having no luck please can someone point out where I'm going wrong unless I'm well off ```openMap [true, false];
this = [markerSize ["Marker_0"] "BIS_areaMarker", markerPos [5206.29,5004.85] "BIS_areaMarker", 1] call BIS_fnc_zoomOnArea; //zoom on the area given by the marker in 1 second.``` thanks
Thanks i go test it
@agile anchor Check examples https://community.bistudio.com/wiki/BIS_fnc_zoomOnArea
β¦and code with show script errors enabled
What did i have to write in the trigger condition, when the "demoCharge_F" was placed in an vehicle?
"demoCharge_F" in magazinesCargo _x
count thisList
Smth like that, just not typed on phone with wrong syntax and without reading the biki pages for the used commands
findIf would be better but I don't wanna type that on phone
Time for my daily question asking:
while {(speed _pod) > 1} do ( _pod setVectorUp surfaceNormal position _pod );
Am I doing something wrong here?
Haha, thanks, it's hard to tell when reading the wiki.
honestly, the whole { and ( explains why I kept getting errors for something else i tried, haha.
do you use show script errors though? it should tell you I believe
Here i go again. Why:
grp = [[1731,50,0], WEST, ["LIB_SdKfz124", "LIB_OpelBlitz_Tent_Y_Camo", "LIB_OpelBlitz_Fuel", "LIB_OpelBlitz_Ammo", "LIB_OpelBlitz_Ambulance", "LIB_SdKfz251"],[[0,0,0],[0,-10,0],[0,-20,0],[0,-30,0],[0,-40,0],[0,-50,0]]] call BIS_fnc_spawnGroup;
sets the formationLeader to second unit? (when the first unit is +1 unit vehicle)
Is doFollow the correct command to make 1st unit to LEAD the group?
Yes, I just couldn't understand it because I thought I was putting { but I was accidently putting ( XD
are "selectLeader" and "setLeader" the same?
same may apply to "formLeader" and "formationLeader"
@mighty vector does the second vehicle have a gunner/commander, and not the first one?
nope.
first is a tank(3), second is a truck(1)
idk then, maybe because tank driver < truck driver
try in editor to see if the behaviour is the same
no, its not.
i think its an issue with BIS_fnc_spawnGroup
going to create a few issues.
Bros, can someone help me out with spectator? I want to disable the free cam mode. In my mission on Multiplayer screen I have Respawn set to "Disabled" with "Mission fail when everyone dead" and in my onPlayerKilled.sqf I have this:
diag_log "onPlayerKilled.sqf called";
sleep 2;
// Terminate the default spectator
["Terminate"] call BIS_fnc_EGSpectator;
sleep 2;
// Run spectator without free cam
[
"Initialize",
[
player,
[east],
true,
false
]
] call BIS_fnc_EGSpectator;
Thing is, in MP when player is killed he's thrown into a spectator with default settings, including free cam. Somehow onPlayerKilled.sqf doesn't get called at all as the "onPlayerKilled.sqf called" doesn't appear in neither server nor client logs.
Aside from wasting my life on Czech games, what am I doing wrong?
oooookay I thing I got it
Respawn = Disabled on Multiplayer screen does not translate into Respawn = "NONE" in the description.ext
It seems that it's equivalent to Respawn = "BIRD"
And BIRD respawn doesn't call for onPlayerKilled.sqf
gonna check it, brb
yes
but
before you run the spectator in onPlayerKIlled.sqf you need to manually disable death blur
like this:
BIS_DeathBlur ppEffectAdjust [0.0];
BIS_DeathBlur ppEffectCommit 0.0;
I hope one day BI will be held responsible for all the time people wasted battling Arma lmao.
@still forum thank you ill test it here in a moment and see if it works
runs away
am i alright to @ you ?
it hasnt worked
its still not doing anything
how would i got about moving the object randomly and checking if its in the trigger
instead of using the presence rng
it hasnt worked
what did you actually try?
i put isNil "mission_2_intel_tablet" into conditional for the trigger
but you want to check if its not nil right?
so !isNil "..."
how would i got about moving the object randomly and checking if its in the trigger
if (local this) {this setPos (selectRandom [pos1,pos2,pos3])}
where each pos is a position array
randomly as in a probablity the object wont be there at that location, so a % chance its there and a percent change its at 0,0,0
and check if its no longer in the trigger
instead of completly removing the object on the probablity
think that goes beyond what I can quickly type down in a minute
didn't we cover that already π€ @robust lichen
if (selectRandom > 75) {intelObj setPos [0,0,0]} somethng like this? except limit the rng to 100
what you told me didnt function still trying to get something that works
so do i need to make an array with every value the RNG chooses from?
https://community.bistudio.com/wiki/random you may like this more
_ranNum = seed random 100;
if (_ranNum > 75) {intelObj setPos [0,0,0]};
im going to try this but knowing me it might not work lol
make sure you check what Dedmen has posted and fix your syntax issues as well.
ranNum doesn't have to be global there, also^
ill make it local
and seed will be a undefined variable
yeah noticed lol
so i put ```
_ranNum = random [0,50,100];
if (_ranNum > 75) {intelObj setPos [0,0,0]};
and make sure to wrap it in the local check I posted above
_local = if (condition) then {code];?

yes, you dont need _local part for this scenario though as you don't do any assignment to it.
thats not what I meant with the local check
the local check is this right ```(local this)````
yes
if you don't do that, every player that joins your mission in multiplayer will execute your script and randomly set the position, meaning your thing will be teleported around maybe a dozen times
what do i do to add both of those as conditional seperations via comas? or does it have to be in like a array
oh and it
But don't do that in a single condition, just have two nested if statements
okay
_ranNum = random [0,50,100];
if (local this) then
{
if (_ranNum > 75) then
{
intelObj setPos [0,0,0];
}
else
{
intelObj setPos [2753.08,4460.58,0.440994];
};
};
``` solike this?
ye, can't see any errors
and to check if the obj is in the trigger do i do thisList intelObj;
no
thats a syntax error
you need a command between variables
you want to check if your intelObj is in thisList
intelObj getPos [0,0,0];
would it be batter to check if its at a position?
better
thats not how getPos works
and no it wouldn't
you'd get floating point accuracy issues
lmao i was sitting here thinking that thisList is the things in the trigger and that saying if the object is alive inside of the trigger it would be true?
intelObj in thislist;
does this work for objects or only units\
i was sitting here thinking that thisList is the things in the trigger
it is
and that saying if the object is alive inside of the trigger it would be true
Yes that would be, but thats not what you wrote
does this work for objects or only units
units are objects
and if you check the in wiki page, you'll read that it works for Anything
_ranNum = random [0,50,100];
if (local this) then
{
if (_ranNum > 75) then
{
intelObj setPos [0,0,0];
}
else
{
intelObj setPos [2753.08,4460.58,0.440994];
};
};
``` undefined variable this
where do you put it?
init
Yeah, init box of the object
this will definitely be defined there
its the object that belongs to the init script
Actually your "init" wasn't too precise, could be init box, or init script, or init.sqf
init.sqf
Yeah no, the init script, on your object that you want to setPos
okay
so this isnt a defined variable in init.sqf
and putting it init box of the obj this is the object correct
ye
should i leave _ranNum = random [0,50,100]; in init.sqf or also move it to init box
_ranNum is a local variable
thats right it wouldnt be seen by it
mk
well hasnt given me an error thats a start
https://i.imgur.com/NmVAyr1.jpg
See the fisheye effect on the screenshot?
How can I get rid of it?
It appeared itself after I was watching a soldier failing from high altitude through the BIS spectator. I closed the spectator but the effect has left.
!intelObj in thislist; the not operator or do i have to wrap it in ()
@quartz pebble, i believe that's radial blur. Go to your video settings to turn it off.
@hazy trail I'll try next time I face that bug
Hi, I have a problem where hidden objects become unhidden after a while. I solved it but I can't belive in the solution because it makes no sense. Can someone help me before I start to disbelieve in mathematics?
no need for maths here
theObject hideObject true; // hides the object
theObject hideObject false; // unhides the object
see also hideObjectGlobal
This is probably a longshot, but is it possible to add a custom variable to the profile variables from outside the game. Want to add a custom variable to a headless client so it can be read from profilenamespace
Nvm actually i can just store it in the hc mod config
I did {hideobjectglobal _x} forEach _array
everything I need is hidden upon mission start
after a while, under load, things start to unhide
same script but then in the end I do test = count (_array select {!(ishidden _x)});
nothing gets unhidden
I call armagic then
you bet. its driving me nuts cause it makes no sense
Welcome to scripting in Arma π
every other time I had issues I finally found some stupid thing I was doing or some piece of information that was missing. In this case I've been wondering for weeks
so magic exists in Arma, I'll have to live with that
well, when you talk about "heavy load" of your missionβ¦ I can't be but afraid to ask how and why π
hehe, some group spawning and shitty computer
it happens even if just start the mission as zeus and add about 30 groups
Okay, I've been trying with setting my vectors all day but I can't get my plane to drop while it's nose still faces the horizon the whole way (rather than being dragged down). Any more scripting suggestions or is this something that might have to be fixed by the model maker?
Any eventhandler that detects when the unit wants to get out of a vehicle? Getout and Getoutman do not work because it is activated when it has already exited.
didnt work for me. wiki says
ctrlSetChecked is for CT_CHECKBOXES type 7
while cbSetChecked (which does work), is for CT_CHECKBOX type 77
so i guess its a different command for different types
...
tested both, both didn't worked, checked code, duplicate IDC i missed before... π
π¦
so ive been trying to get a trigger to set a var true jammerEnabled = true; publicVariable "jammerEnabled";
and it seems to not work
im trying this instead commsDevice setVariable [jammerEnabled, false];
what var space should i use? its a script.sqf
the script its runs when the var is set to true and spits info out in chat
so im running it and its functioning but when i set it to false by default and try to set it to true through the trigger it dosentspit info out hince its not starting
on activation of the trigger it sets the var to true, and an if statment in the script runs the code when the var is true
the script runs every 5 seconds
trigger condition !alive radio_commsDevice;
mhmm i didnt write it http://www.armaholic.com/page.php?id=32660
ah
onActivation commsDevice setVariable [jammerEnabled, true];
is the varspace the issue?
oh i know one sec
can i dm you it?
too big
SQFBin also works
okay
thank you
yeah
so
im trying to make it start off and turn it on after the triger triggers
Thank you dino im testing as we speak
@robust lichen ```sqf
commsDevice setVariable [jammerEnabled, true]; // WRONG
commsDevice setVariable ["jammerEnabled", true]; // CORRECT
Where I can get in touch with one maintainer at the CBA (If it's not here) ? I'm having some troubles adding the CBA Disposable Framework to some launchers
//--- Add Large FOBs if available.
if (CTI_BASE_LARGE_FOB_MAX > 0) then {
_large_fobs = CTI_P_SideLogic getVariable ["cti_large_fobs", []];
_upl=if (!( count ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) isEqualTo 0)) then {((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) select CTI_UPGRADE_REST} else {0};
_respawnrangelargefob=CTI_RESPAWN_LARGE_FOB_RANGE+500*_upl;
_cti_entities = _x nearEntities[["Man","Car","Motorcycle","Tank","Air","Ship"], CTI_RESPAWN_FOB_SAFE_RANGE];
if ({_x countSide _cti_entities > 0} count ([west, east, resistance] - [CTI_P_SideJoined]) < 1) then {_list pushBack _x};
{if (alive _x && _x distance CTI_DeathPosition <= _respawnrangelargefob) then {_list pushBack _x}} forEach _large_fobs;
};
can i put 2 if statments beside like that?
@glass zinc all this code for one if question?
i dont know how to explain it any better
can you simplify and tidy it up please π
if (condA && condB) then { if (condC && condD) then { "ABCD" } else { "AB!C!D" };
it's barely readable⦠and throws me off :3
if ({_x countSide _cti_entities > 0} count ([west, east, resistance] - [CTI_P_SideJoined]) < 1) That's a big condition, too big, move that in variables and compare those variables ^^
thats cool i can barely read it either, but thats allways the case when i try and code π
1/ make it work
2/ make it readable
3/ optimise after
π
making temp variables for readability is OK
code is destined to humans, not machines
4/ remake the entire again after years
5/ ask yourself what idiot would make it that way in the first place?
always code as if the reader of your code has a loaded 12 gauge shotgun⦠and your address
well no one taught me to code, im a home build manufacture of private parts grooming products. its very use at own risk
is there a guide on how to clean up code somewhere?
ill be honest the linter does most of the work
so, properly indented:```sqf
if (CTI_BASE_LARGE_FOB_MAX > 0) then
{
private _large_fobs = CTI_P_SideLogic getVariable ["cti_large_fobs", []];
private _upl = 0;
if (!( count ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) isEqualTo 0)) then
{
private _sides = (CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades;
_upl = _sides select CTI_UPGRADE_REST;
};
private _respawnrangelargefob = CTI_RESPAWN_LARGE_FOB_RANGE + 500 * _upl;
private _cti_entities = _x nearEntities[["Man","Car","Motorcycle","Tank","Air","Ship"], CTI_RESPAWN_FOB_SAFE_RANGE];
if ({_x countSide _cti_entities > 0} count ([west, east, resistance] - [CTI_P_SideJoined]) < 1) then
{
_list pushBack _x;
};
{
if (alive _x && _x distance CTI_DeathPosition <= _respawnrangelargefob) then
{
_list pushBack _x;
}
} forEach _large_fobs;
};
how does proper indenting work?
is there a guide on how to clean up code somewhere?
Gladly, yes - https://community.bistudio.com/wiki/Code_Best_Practices @glass zinc π
kk ill give it a read
again, note that these are recommendations - the most important thing for your code is that you can read (and understand) it, and that you remain consistent through your indent / code / variable naming
Hi there..
I have an injure/revive script:
_unit setUnconscious true;
_unit switchAction "Default";
....
_unit setUnconscious false;
_unit switchMove "UnconsciousOutProne";
But sometimes (1 times of 50 approximately) AI units stuck to get back to normal functioning. Soldiers lay on the ground and refuse moving.
Any ways to deal with that?
maybe add a sleep timer?
do you mean they will just stay down?
or that they will get stuck during the revive animation?
maybe add a sleep timer?
The revive animation completes, a unit lays down with his hands forward and weapon on the back. It can rotate to a side you point, can open its inventory, but refuses to stand up and/or move.
Also ignores scripted commands like move/doMove/commandMove; if you change his animation with switchMove/playMove, the unit accepts the animation but still refuses moving.
if you try UnconsciousOutProne in google there seem to be a couple theads dealing with similar issues, dont know if any will help though
@bold timber ACE Slack.
I would like to use the USS Freedom as an airfield in my warlords mission but there are a few things I need help with:
- How do I make it so that you can only call in planes when you only own the carrier sector that can actually land on the carrier?
- Can I somehow make the AA ship turrets work fully autometic and can I make them have unlimited ammunition (not unlimited magazine sizes but unlimited magazines)?
- I don't want to have a just a normal, "dead" airfield but I living carrier (with deck crew etc.) so is it possible and if so how is it possible to have deck crews man the carrier, repairing, rearming and refueling planes when they come in as well as clear the runway when a plane if about to take off long story short how can I make a fully functional aircraft carrier?
I know that's a lot but thanks in advance for your time and help.
sounds like a year long project to me
@round scroll That's my fear...
feel free to take a look at the ttt_nimitzfunctions for the Nimitz to get an idea how to use switchMove and so forth to get a deck crew launching a plane
- there might be functions to populate the USS with crew already
- you can make the magazines unlimited with event handlers
- call in plane, that's on you and your conditions - you could also enableSimulation false + hideObject to everything until the conditions are met
@winter rose There are definitely functions concerning the Aircraft Carrier (https://community.bistudio.com/wiki/Category:Function_Group:_AircraftCarrier) but I don't know which and how to use them since there is exactly zero information in the wiki (at least as far as I have found). Also how do I make the turrets work fully autometic?
maybe BIS_fnc_Carrier01CrewPlayAnim
you can check what the code does in the Functions Viewer in-game
for the turrets⦠just place them (not empty of course)
they are drones, they will fire on approaching enemies
Question Hi all, I am trying to fix the issue with Swivel Targets not working in Multiplayer. I have found that the script _target setVariable ["BIS_exitScript", false]; should work but that the advice is to execute this on the client side? How do I do this? Do I simply add this to the Init on each target? Do I need to add the command on the player.init? Advice welcome and thanks in advance!
@winter rose I don't know how I could place them empty... Do you mean with empty out of ammunition? Also does the USS Freedom have a radar by default or if now (how) could I give it one?
just place the turrets
they will be automated
the USS Freedom is one big building, not a vehicle; therefore, no radar
you can share radar detection between UAV turrets though
@winter rose thx btw
@vague geode have you tried the USS Nimitz mod? That is a working carrier.
@winter rose So I can't add a radar to it appart from placing one on it? Also do the turrents share that information autometically?
exactly - same as "placing a radar to a house", no sense in it
there is a tickbox in their attributes, they should be enabled by default
@winter rose I meant placing a AN/MPQ-105 Radar station on deck...
why do you want the radar?
turrets should have one already iirc
You can just use the defence turrets they have their own.
is there a way i can hide/show smoke from the smoke module per script?
the smoke particles should be a vehicle if the module which I think you are talking about is fn_moduleEffectsEmitterCreator.sqf so if you execute a nearestObjects command by where you are placing the smoke object, you should be able to hide this
@fervent kettle
Its the ModuleEffectsSmoke_F so the one you can place in editor
oh and i have tried to do this smoke1_3 hideObjectGlobal true;
The module itself is invisible; the spawned smokeshell might be accessible by script though
ikr, the question is how can i acces that shell, oh and it is not the smoke grenade module, just the smoke one
try using getVariable on some "emitter" variable;
see allVariables to get all variables on an object
private _allVariables = allVariables smoke1_3; // find the emitter value here
// then either set its drop to 0, or delete it, or anything you want to do
My morning question about stuck AI animations.
I could reproduce it.
AI stucks if it got unconscious while it was healing itself (default arma healing animations were playing). And it unstucks if after reivive you injure it again and order to heal itself.
Think it is not about animations, but about AI state machine. It can't do anything if it didn't finish healing.
aaand what is the question? π¬
Question Hi all, I am trying to fix the issue with Swivel Targets not working in Multiplayer. I have found that the script _target setVariable ["BIS_exitScript", false]; should work but that the advice is to execute this on the client side? How do I do this? Do I simply add this to the Init on each target? Do I need to add the command on the player.init? Advice welcome and thanks in advance! Posting again as may have got lost with all the Aircraft carrier chat.
@primal marten where did you see that, and what do you want to do
context plz
https://steamcommunity.com/sharedfiles/filedetails/?id=1294610498
Execute above on each target for clients.
It will force the client-side scripts to exit and thus only the server will manage them.
I have a MP training area for my unit. The swivel targets dont move as server and client are trying to do that. Indeed that is where I found the solution. Thanks Lou!
put this in the init field (I can't believe I just wrote that!)```sqf
if (!isServer) then { this setVariable ["BIS_exitScript", false]; };
what no pretty central script.... sad times π
thanks dude thought so but i got all confused
np, the explanation is not crystal clear either
@primal marten it should work, but don't hesitate to come back and say if it doesn't (or if it does, too!)
will do will try it shortly
if (CTI_BASE_LARGE_FOB_MAX > 0) then
{
private _large_fobs = CTI_P_SideLogic getVariable ["cti_large_fobs", []];
private _upl = 0;
if (!( count ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) isEqualTo 0)) then
{
((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) select CTI_UPGRADE_REST
};
private _respawnrangelargefob = CTI_RESPAWN_LARGE_FOB_RANGE + 500 * _upl;
private _cti_entities = _x nearEntities[["Man","Car","Motorcycle","Tank","Air","Ship"], CTI_RESPAWN_FOB_SAFE_RANGE];
if ({_x countSide _cti_entities > 0} count ([west, east, resistance] - [CTI_P_SideJoined]) < 1) then
{
_list pushBack _x;
};
{
if (alive _x && _x distance CTI_DeathPosition <= _respawnrangelargefob) then
{
_list pushBack _x;
}
} forEach _large_fobs;
};
I keep getting the error private _cti_entities = _x nearEntities[["Man","Car","Motorcycle","Tank","Air","Ship"], CTI_RESPAWN_FOB_SAFE_RANGE];
undefined variable in expression _x
what am i not seeing, its also saying _cti_entities is unused, but its used right below it
hmm ok ill try to figure that out
also @glass zinc I updated the code I posted earlier:```sqf
private _upl = 0;
if (!( count ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) isEqualTo 0)) then
{
((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) select CTI_UPGRADE_REST
};
// becomes
private _upl = 0;
if (!( count ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) isEqualTo 0)) then
{
_upl = ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) select CTI_UPGRADE_REST
};```
ok thank you
//--- Add FOBs if available.
if (CTI_BASE_FOB_MAX > 0) then {
_fobs = CTI_P_SideLogic getVariable ["cti_fobs", []];
_up=if (!( count ((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) isEqualTo 0)) then {((CTI_P_SideJoined) call CTI_CO_FNC_GetSideUpgrades) select CTI_UPGRADE_REST} else {0};
_respawnrangefob=CTI_RESPAWN_FOB_RANGE+500*_up;
{if (alive _x && _x distance CTI_DeathPosition <= _respawnrangefob) then {_list pushBack _x}} forEach _fobs;
};
``` how come this one works? I have never worked with a magic variable before, and im trying to copy how it was used in the original code
i cant seem to see why _x works in this and not in the other
I asume this one is "the other"?
private _cti_entities = _x nearEntities[["Man","Car","Motorcycle","Tank","Air","Ship"], CTI_RESPAWN_FOB_SAFE_RANGE];
if ({_x countSide _cti_entities > 0} count ([west, east, resistance] - [CTI_P_SideJoined]) < 1) then
{
_list pushBack _x;
};
{
if (alive _x && _x distance CTI_DeathPosition <= _respawnrangelargefob) then
{
_list pushBack _x;
}
} forEach _large_fobs;
(It seems it is)
The _x doesn't work here because it's outside of the scope:
systemChat str _x; // Error
{
systemChat str _x; // Works because we are in a code-block that added a magic variable
call {
systemChat str _x; // Works, because ONE of the code block above the call has "injected" the magic variable
}
} forEach [0,1,2];
systemChat str _x; // Doesn't work, because we are not in a block with a magic variable
ok, so getting an error when running this execVM'ing this code:
_caller = _this select 0;
_target = _this select 1;
if ([_caller, 2] call ace_repair_fnc_isEngineer) then
{
[15,
[_target],
{
{
_x setDamage 0;
systemChat format ["%1 repaired",_x];
} forEach nearestObjects [_this select 0, ["Air"], 25]
},
{},
"Repairing aircraft..."]
call ace_common_fnc_progressBar;
}
else
{
systemChat "Only logistics crew can repair vehicles";
};
error:
16:26:07 Error in expression <at format ["%1 repaired",_x];
} forEach nearestObjects [_this select 0, ["Air"],>
16:26:07 Error position: <nearestObjects [_this select 0, ["Air"],>
16:26:07 Error 1 elements provided, 3 expected
16:26:07 File C:\Users\User\Documents\Arma 3 - Other Profiles\BenFromTTG\mpmissions\CARRIER%20SIM%20ALTIS.Altis\repair.sqf..., line 11
why would you use _this select 0 though
used _target and got 0 elements provided
you are giving Code to ace_common_fnc_progressBar. use its arguments
are you sure that [_target] is a proper second argument for it, too?
its from an addAction, so yes
β¦sorry what?
_target is one of the params from the addAction, i pass it through the execVM to the script
β¦
I just read https://github.com/acemod/ACE3/blob/master/addons/common/functions/fnc_progressBar.sqf , and indeed the second argument is an array.
params ["_caller", "_target"];
if ([_caller, 2] call ace_repair_fnc_isEngineer) then
{
[
15,
[_target],
{
params ["_target"];
private _objects = nearestObjects [_target, ["Air"], 25];
{
_x setDamage 0;
systemChat format ["%1 repaired", _x];
} forEach _objects;
},
{},
"Repairing aircraft..."
] call ace_common_fnc_progressBar;
}
else
{
systemChat "Only logistics crew can repair vehicles";
};
```try this maybe?
same error, on the _objects line
then output _target, because it is wrong
it might be thatsqf params ["_target"]; should be replaced by```sqf
params ["", "", "", "_target"]; // caller, target, id, arguments
if target is in the ACE code params, then you don't need to pass it in the arguments
fixed it, just gave the object a variable name and made sure it wasn't called anywhere else
ah well
If call _vehicle setDammage 0.9 it will most likely explode itself within a minute (checked for tanks). Why?
*magic*
Well above a certain threshold things explode
A tank with such high damage will just have its ammo go off and self destruct
What`s the safe max damage?
Try (no sarcasm) 0.89?
Checking right now.. It seems the setDammage itself is not the single critical part. setDammage 0; setHitPointDamage ["HitHull", 1] -> boom
While setDammage 0.95; setHitpointDamage ["HitHull", 0.85] -> no boom
odd question. Trying to set task (task1) to Succeeded
task1 setTaskState "Succeeded";
however, it tells me that it was expecting a task
some background, i created the variable task1 via the eden editor, I did not script it
figured it out
im just stupid lol
What was the problem?
no quotes im assuming. i did change it
["task1", "SUCCEEDED"] call BIS_fnc_taskSetState;
so this may be an odd question, but im learning still
if in the eden editor, i name a squad "squad1"
would i call it as a variable like _squad1
example _marker1 = createMarker ["Marker1", position _squad1];
don't need to say odd question everytime π
No you gave it a variable name squad1 so just reference it the same.
using " " implies its a string (to your task question)
When using commands, see the wiki to find out what data types the command requires.
lol my bad. bad habbit saying that.
great, I will try it out as _marker1 = createMarker ["Marker1", position squad1];
hah np π
That'll work yes.
Hi guys. I really need your help.
I've been trying it endlessly and it's probably something I couldn't figure out.
I'm trying to run a dedicated server which has a server mod, which will be the server side scripting of everything, and a client mod, which will be the mission and the client scripts.
Does this design even work ?
or do I have to do if(server) all around the "client" mod
cause I've been trying to add the servermod with the commandline, it shows loaded, but the initServer and init SQF does not even run
I am trying to set up a cycle wich will basicly heal a unit every "x" seconds
h1 = (_this select 0);
wh = [h1]spawn
{
while {true} do
{
[objNull, h1] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
sleep 2.0;
};
};
but guess what, it doenst work
how would i remove the addaction from this so i can have it play on start up
while {true} do
{
_object = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_object removeaction _id;
[_object,3] call BIS_fnc_dataTerminalAnimate;
sleep 2;
with uiNamespace do {
disableserialization; //thank you so much tankbuster
_object setObjectTexture [0,"images\ee6.ogv"];
1100 cutRsc ["RscMissionScreen","PLAIN"];
_scr = BIS_RscMissionScreen displayCtrl 1100;
_scr ctrlSetPosition [-10,-10,0,0];
_scr ctrlSetText "images\ee6.ogv";
_scr ctrlCommit 0;
};
};
autoplay = 1;
loops = 1;
_closeaction = [[_object,["Close","DataTerminal\CloseTerminal.sqf"]],"addAction",true] call BIS_fnc_MP;
so its just open and playing at the start without having to be opened
or how would i tell a near by ai to perform the action with a scripted waypoint
```sqf please (see pinned messages)
so is a squad not considered an "object" is it a group? is there a way I can make it be considered a group?
_marker1 = ["enemyPos1", position squad1]; _marker1 setMarkerType "mil_objective"; _marker1 setMarkerColor "ColorRed"; _marker1 setMarkerText "Large OPFOR unit";
i have pictures of the error if needed
i dont know how to put it in the box lol sorry
@faint kraken
see pinned messages
oh yeah sorry
so if the waypoint is placed on the terminal would i just put the script in the on activation part ?
help me please π¦
I really need a beginners help with making a mod start the init.sqf of him
@tough abyss no bump rush please π
as for your server-side "init.sqf", init.sqf is a mission thing only
use CfgFunctions and post-init attribute in your mod
Well, I don't want the server "backend" to be exposed to the user
so my design is ok right?
I just need to know how to initialize it properly and communicate with the client
if you want a server-side execution of a script in any mission, use CfgFunctions, that's it
Ok. Is there an example or somewhere I can read about how to integrate it properly?
@fervent kettle I believe the issue is with the ace medical function, I know that one works with the old medical system, but perhaps not with the new one?
@eager pier we`re using a reverted one: https://steamcommunity.com/sharedfiles/filedetails/?id=1523636544&searchtext=ace+

