#arma3_scripting
1 messages · Page 524 of 1
i mean i check the weapon of course ^^
[["rhs_weap_ak103_npz","rhs_acc_dtk","","",[],""]] is stored in my variable. So i choose _loop (in this case 0) followed by 4 (magazine array) and select 0 (magazine name). Every other weapon, but rhs, gives me back a empty string ("") but not the rhs weapon. It gives me [].
nvmd. I get a nil value on normal weapons too. But it doesnt throw me the undefined variable error
could use param instead of select @keen bough
Thanks for the hint Connor, but even wit the private array, the function won't set the loadout. I will try to use params and gave this values a default value
could you give me a if-example with param please @robust hollow ?
_arr param[4,""]
so i could write it if (_magName param[""]) then ? @robust hollow
AH!
lemme try.
_magNameArray = _wepAtt select _loop4 select 4; // always magazine name
_magName = _magNameArray param[0,""];
somehow like so? @robust hollow
yea
works! thaaaaaanks @robust hollow Now i learned something new ^^ BOYAH!
after changing the header to this
params [
["_unit", objNull],
["_unitLoadout", "rfl"],
["_unitRank", 0],
["_medLevel", 0],
["_engLevel", 0],
["_eodLevel", false],
"_uniform1",
"_uniform2",
"_headgear1",
"_headgear2",
"_headgear3",
"_vestLeader",
"_vestMedic",
"_vestRifleman",
"_vestGrenadier",
"_vestMarksmen",
"_vestMachineGunner",
"_backpack1",
"_backpack2",
"_backpack3",
"_backpack4"
];
It works, thanks for the hint.
Another Question, when i want to store this in a _var how should i write it to use it in a setUnitLoadout?
_myVar = ["BWA3_G36A2","","BWA3_acc_VarioRay_irlaser_black","BWA3_optic_RSAS",[],[],""];
or
_myVar = [["BWA3_G36A2","","BWA3_acc_VarioRay_irlaser_black","BWA3_optic_RSAS",[],[],""]];
uhh, either would do but the first makes sense. then you would be selecting the elements from the array instead of using variable names alone like in ur script paste from earlier
or now i look properly... thats just a weapon isnt it?
Yep, it's just the Array for the Mainweapon including Attachments
yea, still the first one and then the variable would be the first element of your loadout array
ok Thanks
How can i get array of all compatible magazines for primary weapon? Before magazineWells i used config's magazines[] value, but now it's not enough
What is not enough?
magazines[] is not complete list of compatible mags (like now CUP and RHS weapons share their magazines, but magazines[] array for CUP weapon contain only CUP mags, same for RHS).
But i want to get all compatible mags, from all mods (as player can have mixed loadout of CUP's and RHS's mags)
CBA has a func for it in cba common
Does arsenal show all compatible mags with mods?
ye
Not sure which is the right channel. I want to add a GUI on a object. Like a compass in a helicopter. But I have literally no idea how to start
Start by opening a notepad
such useless and dumb comments only showing that you shouldn't spread your opinion in the internet
Would it help if I add smiley face? Seriously though your question is a bit vague. If you could give an example of what your ultimate goal is I’m sure this would help
How about ask about more informations and not write such a useless sentence
Getting of on the right foot here
I want to have a object on the ground and there should displayed some given values...
You can not add GUI to objects
Yeah, no, you want help you should do leg work
compass in helicopter is special stuff
What kind of stuff are you looking for, you want it 3d in the cockpit or like a 2d overlay on the HUD?
I want to have a object on the ground and there should displayed some given values...
Unless I'm mistaken the only way for you to be able to do this, is make a model with hiddenSElections and use setObjectTexture to set separate letters to it
Which falls more in the reign of model makers
you can use config to edit things displayed on MFDs, but actual model changes will need whoever did the original model to change it
doesnt MFD only work for vehicles you're in anyway?
si
and the MFD system is a giant pain in the ass to work with unless you have config experience
and even then it's at best a medium pain in the ass
ah ok i will leave it there haha
it wouldnt work for what he wants anyway in that case
This will come in handy :D
https://s.sqf.ovh/arma3_x64_2019-04-06_14-43-55.png
Create the page "fileExists" on this wiki!
There were no results matching the query.
🤔
i doubt that fileExists actually is a useful command ... who cares if a file exists?
just to get rid of a single RTP message?
ACE/CBA uses it
RTP?
you mean RPT?
I need it.. Because otherwise I would literally throw thousands of RPT messages
@still forum thx, will check
I dont get it what this command do. https://community.bistudio.com/wiki/remoteExec
if I will cteate marker or smoke with this command - only 1 player will see it?
this command executes script stuff remotely
so. other players will also see stuff? ok
If you tell remoteExec to execute it on other players.. yes.
But I have no idea what you mean by marker or smoke
smoke is vehicles. and markers are also created globally unless you force it not to by using the local commands
@swift crane you don’t need remote exec 99% of the time
Whoever told you it makes any mission work is a liar
I have done it. I rewrite it now cleaner but i did a complete dump-script, that not only sorts items but also checks if they are suitable for an ace-arsenal entry. From weapons and their atachments, to containers, to vehicles.
How do I check what unit is the player using the remoteControl? especially for UAVs
Checking for rifles is this:
if (_var isKindOf "Rifle") then ?
what is _var?
Rifles are not objects, you cannot have them in a variable
so.... probably not?
_var = weaponname got with weaponsItemsCargo (select and stuff)
Wiki has example how to use isKindOf why not check it first?
I did it, but i dont understand the examples too good and wanted to know if i could do it that way. I already have another way ^^
The part where it says >> "bwa3_g36k". Is that predefined? Or is this the weapon the example was looking for? because then i could use >>_var
so the _iskindof give just the state of false/true (like stated)
There is no such thing on wiki, where did you get it from?
_isKindOf = "Rifle" in [(configFile >> "CfgWeapons" >> "BWA3_G36K"),true] call BIS_fnc_returnParents; // is true
"BWA3_G36K" is this, in this example, used as "I want to know, if this specific weapon is a rifle" or not? Because if it is, then i can use a variable instead of a fixed predefined name.
@tough abyss Could you hit me with a bat every now and then? 😄
so can i use this:
if (_weaponName isKindOf ["Rifle", configFile >> "Cfgweapons"]) then?
Yes
you can now hit me with a bat
(but also, i have now saved this information anyway in my head, and i wont loose this information ^^)
unless hit hard with a bat
but that would solve all scripting problems ^^
Can someone help me im trying to make a mission where 6 ospreys fly over an airport and drop a bunch of paratroopers, using the RHS paradrop way point. Problem is when they see enemies they fly crazy and dont end up dropping anyone.
Works fine with no enemies
How can i make the pilot ignore the enemies
set the pilot(s) to careless. Then they ignore enemies (afaik)
How do i do that
You create the weypoints via script i guess?
If not, and you do it via the eden editor/2d editor, you double click on the waypoint and set it to 'careless'. That would be also something for #arma3_scenario then currently
Oh i figured id need a script for it, thats why i posted in here
Well i got another question for you that im sure requires a script
Well, you could do it with script(s) or you could do it directly in the eden editor, or even within zeus ^^ Depends on how you wanna do it
The easist way lol
I want to make a mission, where a cruise missile hits an anti air site in the beginning, then some CAS bombs the airfield. After that paratroopers land and you gotta fend em off.
How do you script the VLS to shoot at a specifc target without a support or radio option since it will be on the enemy team
I think you work something out with https://community.bistudio.com/wiki/doTarget i guess. At least, that what i can imagine. But a more experience scripter probably can give you more directions. Like @still forum or @tough abyss
Too advanced scripts for a beginner
You're better off finding something if someone else already wrote it
Im sure someone has, i mean who wouldny want to call in their own cruise missiles, or have one hit a specific area
I despise A3 AI, please do not tag me into this clusterfuck @keen bough
I think I made 0 posts so far in #arma3_ai and would like to keep it this way
So i kind of figured out the scripts and commands or whatever for firing the cruise missile, i just dont kow how to put em into play
The commands is "HAFM_CRUISEFIRE"
Prior to calling the command i have to set the target location
Vehicle_name setVariable ["Cruise Waypoints", _TargetLoc, true];
Before that i gotta open the hatch doors
In order to force the hatches for cruise missile open animatedoor
Command is "hatch1L"
Vehicle_name animateDoor ["hatch1L", phase];
I just have no idea where to put these commands
Like do i put these into the object init, or composition init, or do i place a script waypoint down?
@keen bough can you enlighten me on where to put these commands?
Does anyone know the Display ID for the loading screen? The one after the map briefing screen while you are loading into the mission
or anyway to know once the loading screen has faded out
There might be multiple loading screens after briefing
so just one ending doesn't mean you are through all of them
#ignored
So is there no way to know when the player is loaded in, and ready to move around?
you can run around while in loading screen
And even 20 seconds after you were already running around, any mod might launch a new loading screen because that mod wasn't done initializing yet
CBA has a eventhandler that tries to catch the last loading screen
but it only does the best that it can do. Doesn't mean that there are no loading screens after that event, any mod could launch one
@twilit scarab I would need to look into it myself first to see what i would do before i could explain it, i am very sorry :3
i had over 8 hour session now to fix an arsenal problem with weapons that have a grenade launcher XD
I cant even get the Hatches to open
These are ships from HAFMs and theres a manual that shows you how to script the cruise missiles but its not very detailed
I named the ship im using "Destroyer" in the object init variable spot.
And i put the following line in the init spot
_Destroyer animateDoor ["hatch1L",phase,now];
But nothing happens:/ its supposed to force the silo hatches to open @keen bough
@tough abyss no its the Arleigh Burke Class Destroyer from HAFM ship mods
Im trying to post a screenshot of the guide but i dont have permissions
Oh fkin hell i finally got it
I needed to replace phase with 1
So the correct command is
Destroyer animateDoor["hatch1L",1];
Now for the hard part of actually getting it to fire on the correct target
Okay i got the cruise missile to fire but cant figure out how to get it to hit a specific target
It says:
Targetloc_: is an array with format positionAGLS
But i have no idea what that means
Vehicle_name setvariable["Cruise Waypoints"_targetloc,true]
My question is what do i replace targetloc with? A grid number?
Ya i can get the grid number
079107
How do i convert that to position for future reference?
Can someone optimize this script little more?https://www.reddit.com/r/arma/comments/babgp2/vehicle_antirollover_script/
So my syntax should look like this:
Destroyer setvariable["Cruise Waypoints"_realPosition = "079107" call BIS_fnc_gridToPos,true]
Does that look correct?
no
private _realPosition = "079107" call BIS_fnc_gridToPos;
Destroyer setvariable["Cruise Waypoints",_realPosition,true];```
or just use the call instead of a variable at all/
defines the variable in the current scope instead of checking parent scopes for an existing local variable of the same name to overwrite.
Fuck now it isnt even firing the cruise missile
Says error in expression
This shit is such a head ache
Im gonna try to XYZ method
Ill try it
Well you were right
It fired again
weird, i would have thought you can considering you can use symbols that can't be used in raw form.
using select with an index outside the range of the array or dividing something by 0
i dont really know what im doing wrong, heres my entire script for the destroyer:
Destroyer animateDoor["hatch1L",1]; _targetloc = "079107" call BIS_fnc_gridToPos; Destroyer setvariable["Cruise_Waypoints",_targetloc,true]; ["HAFM_CruiseFire",[Destroyer]]call CBA_fnc_serverEvent;
send the error log
Where do i find that
rpt file
yea, the script itself looks like it isnt where that error is coming from
not that snippet anyway. idk about the functions it uses
%LOCALAPPDATA%\Arma 3
i found the file but i cant just click and drag it in here
dont need the file, just the error log from inside it
scroll down to the bottom and then start scrolling back up until you find it.
think i got it
22:37:59 Error in expression <und ((_mapPos1 vectordistance _mapPos2) / ctrlmapscale _ctrlMap);
if (_stepY >>
22:37:59 Error position: </ ctrlmapscale _ctrlMap);
if (_stepY >>
22:37:59 Error Zero divisor
22:37:59 File A3\functions_f\Misc\fn_gridToPos.sqf [BIS_fnc_gridToPos], line 82
22:37:59 Error in expression <hicle [0,0,0];
_Target setpos (_WPArray select (count _WPArray - 1));
_TargetPos>
22:37:59 Error position: <select (count _WPArray - 1));
_TargetPos>
22:37:59 Error Zero divisor
22:37:59 File \HAFM_Navy_Core\scripts\CruiseMissile_Fire.sqf [HAFM_fnc_CruiseMissile_Fire], line 106
22:38:00 [1.07941e+006,24563,0,"XEH: PostInit started. MISSIONINIT: missionName=Red%20Star%3a%20EP1%20Invasion%20of%20Malta, missionVersion=53, worldName=Malden, isMultiplayer=false, isServer=true, isDedicated=false, CBA_isHeadlessClient=false, hasInterface=true, didJIP=false"]
22:38:00 [1.07941e+006,24563,0,"CBA_VERSIONING: cba=3.10.1.190316, "]
22:38:00 [1.07941e+006,24563,0,"XEH: PostInit finished."]
well there you go, line 106 of the file \HAFM_Navy_Core\scripts\CruiseMissile_Fire.sqf . im going to assume _WPArray is an empty array
so how do i fix it
idk... make sure the array isnt empty 🤷
im like really noobish to this if you cant tell lol
im going to go a step further and assume it happens when you do this
["HAFM_CruiseFire",[Destroyer]]call CBA_fnc_serverEvent;
scrolling up further you have an issue with BIS_fnc_gridToPos too so im going to assume ur position is wrong
its a grid number tho?
or ur map isnt defined? shit idk. good luck 😃
fuck my head hurts
im so close to getting this right i can taste it
plus its on malta so idk how the map wouldnt be defined
So if i have a big list of player Steam UID that i want to use in a code for member only area do i list them in square brackets ["blahblah", "blahblah"];? or in {} ??
Hey I'm trying to put UPK-23-250 BZT on Mi-24G's pylon 1 through 4 via spawning in script. Anyone know what classname it is? or what do I put in for
_Hind setPylonLoadOut ["pylon1", ""]; ```
please 😛
@slate gull []
Like this uidListA[] = {"blahblah"}; ??
i found that someone else did an array and it looked like that.
depends where your putting it. in a script you would do _array = [uids]; but in a config you would do as you have written above
Its a script that gets called upon by another
yea, so do it in []
ok
Is there a possible way to give the AH-9 a missile warning system (as a UI panel) via the init or a scipt? - Couldn't find results through Google search and the wiki isn't helping.
@golden thicket i havent seen this in action but i hear it works. you would need to write ur own for it to be a UI panel but this shows the gist of what one might do for a missile warning.
how to script dynamically Zeus?
_groupLogic = createGroup sideLogic;
TEST_Curator_0 = _groupLogic createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
TEST_Curator_0 setVariable ["text","TEST_Curator_0"];
TEST_Curator_0 setVariable ["Addons",3,true];//3: allow all addons with proper use of CfgPatches
TEST_Curator_0 setVariable ["owner",player];
TEST_Curator_0 setVariable ["vehicleInit","_this setVariable ['Addons',3,true]; _this setVariable ['owner',player];"];
unassignCurator TEST_Curator_0;
sleep 1;
player assignCurator TEST_Curator_0;```
try this gives me the interface, but can only place markers and no units or vehicles and such
You need to add addons you wanna use to curatoraddons
yep done this:
TEST_cfgPatchesConfigs = "true" configClasses (configFile >> "CfgPatches");
{
TEST_Curator_0 addCuratorAddons [configName _x];
} forEach TEST_cfgPatchesConfigs;
i think the problems comes from this being a mission with playScriptedMission
As silly as it sounds, how do I know if my Headless Client is actually working? I get the host identity created - how do I know if it's connected or does it not show up in the lobby (while logged as admin)
So when you are curator what hint str (curatoraddons assignedCuratorLogic player) shows? @velvet merlin
HC should be in allPlayers
getAssignedCuratorLogic
["a3_characters_f","a3_weapons_f_rifles_mx","a3_weapons_f_pistols_p07","a3_weapons_f","a3_modules_f_curator_curator"]
this should be just those entities already created
And you don’t have those available to you via UI?
Wait that’s all it shows after you pushed in every addon available in game?
so maybe the Zeus logic is confused by playScriptedMission
yes it doesnt get updated. but i see "TEST_Curator_0 setVariable ["Addons",3,true];"
maybe this plays into it. testing without
I don’t know what that variable does
didnt help
i suppose the red display of the unit kinda indicates i am not allowed to be Zeus/do stuff
the adding of the player entity is done by:
_curator addCuratorEditableObjects [vehicles,true];
_curator addCuratorEditableObjects [(allMissionObjects "Man"),false];
_curator addCuratorEditableObjects [(allMissionObjects "Air"),true];
_curator addCuratorEditableObjects [(allMissionObjects "Ammo"),false];```
also not sure if this is correct
TEST_Curator_0 setVariable ["Owner",player,true];
TEST_Curator_0 setVariable[ "CuratorUnitOwner",player];```
seen it with name player, owner player, player and "player"
damn was just me super stupid 😭
<- had scope=1 mod on for BI assets 😇
Why?
we dont care for modern stuff. WW2 all the way
in case someone wants to test
from terrain selection in main menu you can launch for any selected terrain a dynamic Zeus mission (to be polished but works)
Hello I'm trying to destroy the windows of these two buildings and then make them indestructible. For some reason this script doesn't work. Any help would be appreciated. ```
_newObject1 = createVehicle ['Land_i_House_Big_01_b_blue_F', [4340.48,3873.13,0.258911], [], 0, 'CAN_COLLIDE']; _newObject1 setPosWorld [4340.62,3873.32,237.545]; [_newObject1, [[0.00421824,-0.999991,0], [0,0,1]]] remoteExecCall ["setVectorDirAndUp", 0, _newObject1]; _newObject1 enableSimulationGlobal true;
_newObject2 = createVehicle ['Land_i_Shop_02_b_blue_F', [4340.7,3885.15,-0.0610352], [], 0, 'CAN_COLLIDE']; _newObject2 setPosWorld [4341.52,3885.8,237.338]; [_newObject2, [[0.0014389,0.999999,0], [0,0,1]]] remoteExecCall ["setVectorDirAndUp", 0, _newObject2]; _newObject2 enableSimulationGlobal true;
newObject = createVehicle ['ModuleExplosive_IEDUrbanSmall_F', [4351.61,3871.64,0], [], 0, 'CAN_COLLIDE']; _newObject setPosWorld [4351.61,3871.64,234.22]; [_newObject, [[0,1,0], [0,0,1]]] remoteExecCall ["setVectorDirAndUp", 0, _newObject]; _newObject enableSimulationGlobal true; _newObject setDamage 1;
_newObject = createVehicle ['ModuleExplosive_IEDUrbanSmall_F', [4352.87,3883.59,0], [], 0, 'CAN_COLLIDE']; _newObject setPosWorld [4352.87,3883.59,234.22]; [_newObject, [[0,1,0], [0,0,1]]] remoteExecCall ["setVectorDirAndUp", 0, _newObject]; _newObject enableSimulationGlobal true; _newObject setDamage 1;
[] spawn {sleep 5;
_newObject1 allowDamage false;
_newObject2 allowDamage false; };
this feels awfully complicated
oh it is
I dont know how to script. This is just taken from ares save composition module. I added some stuff hoping it would work.
Well I mean the issue here isnt the placement of the structures. I dont know how to make the structures indestructible after Ive destroyed their windows.
yeah but if I add that after I spawned them in, before the ieds, the windows wont break.
so is there a way to disable their damage after the IEDs have blown out the windows?
better yet, is there a command that simply destroy structures windows`?
setHit[Points] probably if the building is set up correctly
was just about to ask that
How do I check what unit is the player using the remoteControl? especially for UAVs
hello, i got problem - execVM command don't working on multiplayer, but on editor is working fine
can't find any blockers for this command
@dusky pier Are you executing the command locally or server-side ? and how ?
@astral tendon https://community.bistudio.com/wiki/remoteControl wiki is at it again! see example #3
How could I make playerPlaceTwo and playerPlaceThree stop bothering me if no player is listed in position 1 and 2 or my array _players ?
private _players = allPlayers apply {[getPlayerScores _x param [5, 0], _x]};
_players sort false;
_players = _players apply {_x select 1};
playerPlaceOne = _players select 0;
playerPlaceTwo = _players select 1;
playerPlaceThree = _players select 2;```
probably a super dumb question but I'm having troubles with logic right now ^^
use params [<index>, objNull] instead of select
i'll try that
Or rather param
🤦 yes ^ that
thx
EDIT : It's working thx
@winter rose Thanks but seems line getConnectedUAV will do it.
I still dont get what unit inside he is controlling but I can figure some work around.
That line won’t return controlling player if the unit is not in a vehicle
Hence the example workaround
Oh wait, you want remote controlled unit not who is remote controlling? Never mind then
@astral tendon depended on the kind of remote control, but yep: use getConnectedUAV for UAVs only (you could remoteControl a unit, for example)
Yeah, that is that feature as well.
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
_UAV = getConnectedUAV _unit;
if (isnull _UAV) exitwith {};
_unit connectTerminalToUAV objNull;
_unit switchCamera "internal";
{objNull remoteControl _x} forEach crew _UAV;
}];
I was doing this fix for the player that is connected to a UAV that disconnect wile remotecontroling a unit and allow other player to take control, connectTerminalToUAV objNull was not doing the full work and it was impossible to take control of the driver or gunner that the player disconnected.
@velvet merlin Thank you. Worked perfectly with SetHitPoints.
@quartz coyote local, on clientSide
i'm executing from client, on addon i have option: ```cs
class UserActions {
class Process {
displayNameDefault = "";
displayName = "Собрать соты";
position = "Door_1_trigger";
radius = 1.5;
onlyForPlayer = 0;
condition = "this animationPhase ""Door_1"" >= 0.5";
statement = "[] execVM ""code\MedoMed_dob.sqf"";";
};
};
but when i trying use action - nothing is working
script just not execute on multiplayer. But on local server, or editor is working fine
i don't want add that script to missionNamespace, because is use not all the time and just with that model
@still forum no, no errors
model work fine
when door opened - show action
but execVM don't working
i don't want define that code like function, because is don't use all time
hm...
what you think about that?
[] spawn compile preprocessFileLineNumbers "code\MedoMed_dob.sqf";
spawn compile preprocessFileLineNumbers might just aswell write execVM, they are the same thing
understand, thank you!
can i ask about how code optimization affects to fps?
hard to answer, has to do with how full the scheduler is
for define all functions i used that code: ```sqf
private ["_code", "_function", "_file"];
{
_code = "";
_function = _x select 0;
_file = _x select 1;
_code = compileFinal (preprocessFileLineNumbers _file);
missionNamespace setVariable [_function, _code];
} forEach
[
["func1", "code\func1.sqf"],
["func2", "code\func2.sqf"]
];
i think that way of using private is obsolete in a3
hard to answer, has to do with how full the scheduler is not really
scheduled code in general doesn't really effect fps, because it's limited to 3ms
but when mission is loaded - i got -30 fps
i was thinking about part of not often used functions - start with execVM, is make sense?
so as i understood - on fps affect functions, witch started from call command?
ah, so a lot questions, sorry 😃
on fps affect functions, witch started from call command? No. If you call from scheduled, it's still scheduled
i was thinking about part of not often used functions - start with execVM, is make sense?
functions laying around in a global variable doesn't cost fps, even if you never use them
scheduled code might not directly influence fps, but if the scheduler is full it will greatly effect gameplay
dont know how bad this effect is in arma 3, but in arma 2 it's very noticable
@proper sail How do you optimize your code? What to pay attention to?
can't really help you with that, i only do a2, a3 has much better methods
if you use unscheduled code a lot( which I think you dont) then you must optimize it a lot in order not to take too much time from eachFrame
if your scenario has low frames, most likely it's due to big amount of vehicles or units
@astral dawn i getting low fps without vehicleson map. When starting editor with my mission.sqm - pfs in kavala near 60, but when starting server, or local host - in ``kavalai getting only30` fps. Problem not in vehicles, or map objects. I think - problem in my scripts 😦
Well, if you disable your scripts, what happens then?
i have taskForce radio addon - is working with onEachFrame option. Have name tags - is working with onEachFrame too
you can use Dedmen's profiler to check performance impact of unscheduled scripts
as i understand - onEachFrame - unsheduled, but if i use```sqf
[] spawn {
code here...
sleep 0.5;
};
what does the code do?
if it asks engine to search for all trees in 10km radius it will stall engine too
if it's just some mix of different small operations then it won't cause FPS drops
that code check for units near (40 meters) and if needed - run another script
@astral dawn i think understand. Thank you!
that shouldn't be impactful I think
all scripts (scheduled and unscheduled) are in one thread anyway (the main arma thread), that's the point
i think - sleep will help, or no?
depending on what you need to achieve 🤷 I don't know
you can do sleep 9000; to make it almost never run 😄 it would help to reduce its impact for sure
but scheduled code can't take more than 3ms from frame anyway
understand
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player forceAddUniform "U_BG_Guerrilla_6_1";
cutText ["<t color='#009600' size='3'>Ausrüstung zurückgesetzt</t><br/>", "PLAIN DOWN", -1, false, true];``` Im trying to execute this in the player that walks through a trigger but when a player walks through that trigger it only gets executed on the host somehow... any suggestions ?
is it a serverside only trigger?
if !(player in thisList) exitWith {};
Make it global (not server only) and add this to the top
testing right now with some friends
groupID iirc
Hi All i'm looking for a script to put players in a parachute at the start of the mission, Here's what i tried in the init of each unit, but in MP each player sees each instance of the parachutes.
chute = "Steerable_Parachute_F" createVehicle [0,0,0];
chute setPos [getPos this select 0, getPos this select 1, 100];
this moveIndriver chute;
so if I have 3 players we all see 9 parachutes.
its hosted mission, not dedicated server.
try wrapping that with if (local this) then { (…) }
(still, it's usually bad practice to put anything in an init field)
groupID iirc
@high marsh groupID ? nah - it Returns group name.
@winter rose Thanks Lou will try that one later when I get someone to test with me. cheers
_delta_max = 0.1 + (0.3 * _k); //Max. change of vehicle angle in 0.05sec
@swift crane are you looking for https://community.bistudio.com/wiki/groupSelectUnit
@tough abyss Return Value: Nothing 😦
I need to get unit group number somehow
That is a setter
@tough abyss but if I'm not inside this group?)
Not 100% on it but maybe units command returns units in the same order, worth checking it out
yeah - the same order. example:
You've got 3 dudes in your squad: number 1, number 2, number 3.
In the group units array, number 1 is at index 0, number 2 is at index 1, number 3 is at index 2.
Everything's good, I can easily retrieve the actual number by doing array index + 1.
However, something bad happens to number 2, so now you've got 2 dudes in your squad: number 1, number 3.
In the group units array, number 1 is at index 0, number 3 is at index 1, so I can't retrieve the number based on the array indexes anymore.
but dont know how to make solution to work yet
https://community.bistudio.com/wiki/joinAs, example 2?
it's a hack, but it seems to be a working one
thx - it works
yay! I thought a getter existed, but well
😃
@still forum the script still only removes stuff from the host
then you have your trigger set up incorrectly
i think i got it... stupid mistake... had the condition still set to "this" instead of "thislist"
boom! The emptying script works awesome! And it takes nearly all things into account, except the stupidity of very few people ^^
@@dire star i was confused because the Changes i made in the "condition" field didnt saved, so it worked in SP as all settings where like before... Sorry for my stupidity.... What im trying to achieve is: any Player that walks through the trigger gets all his items removed, gets the Uniform and then the cuttext gets displayed
i have actually a script that would exactly do that, in some way ^^
Sounds good, but i Kind of only need to know what i have to replace this/player with in Order to achive that.... Taking a Look at it tomorrow night
if you use a trigger, the script would be executed locally, if i am correct and therefore you can use 'player' if you wanna do this. or units. groups. Basically anything that can have any form of items in it.
Anyone know if its possible to make static weapon tripods compatible with normal handheld rifles and optics? And yes I do know about the ACE3 SSWT kit
I don't know if this is good practice or even needed but let's say I want my own way to handle errors.
params[["_markerName", ObjNull], ["_position", ObjNull], ["_size", ObjNull], ["_shape", "ELLIPSE"], ["_alpha", 0]];
[_markerName, _position, _size] apply{
if(_x isEqualTo objNull) exitWith{
ERROR2("Required argument undefined, %1", _x);
};
};
In this function _markerName, _position and _size are actually required arguments. I just gave them a default value to check if they were not defined.
ERROR2 is a macro that display a message with systemChat.
Ok, so my problem here is that in the systemChat _x will be "objectNull" because that's the value of the variable but how, if I can, would go to get the variable name instead of the value?
You might wanna check isEqualTypeParams
brain broke, let me try to understand the command
(If ACE_Item_DAGR Distance (GetMarkerPos "mar1") > 1000)
how to activate trigger if player has ACE_Item_DAGR and it outside from mar1 1km?
@quasi sedge I would try something like
if("ACE_Item_DAGR" in items player && player distance (getMarkerPos "mar1") > 1000) then{
//code
}
@frigid raven already asked, answer is no
(kinda) related to SQF-VM and the no: https://youtu.be/vP4iY1TtS3s?t=133
@still forum can you tell how hard it would be to implement reading named properties ingame via sqf?
wut?
what u mean how hard?
if we had a command for it you could just call the command, but we don't
does the engine read it from p3ds in runtime anyway and its just not exposed, or does it handle them each on its own
it only reads the properties that it needs/uses
should be super easy for BI to expose them, no?
¯_(ツ)_/¯
@still forum are you sure it has been already asked? Are you really really sure?
Drugs are bad, mmmk?
[this] Called from helipad (invisible) init:
params [
"_obj"
];
if (_obj == "spawnA1") then {
"mkrA1" setMarkerPosLocal ASLToAGL getPosASL _obj;
};
Getting generic error on this if statement.
an object cannot be equal to a string?
I thought thats just a var?
a var is without quote
A var is not a string
if (_obj == spawnA1) then { (…) }```
if (_color == "blue") then
{
hint "What a nice color";
}
Yes.. A _color contains a string. You can compare string with string
that's string comparison, not variable comparison
you cannot compare object with string
What would you recommend then for converting it to a string so that I can use it in this if statement?
do not compare objects by str'ing them ^_^
also, only execute the script on the wanted object, first of all ;-)
else just do:sqf if (_obj == spawnA1) then { (…) }
Okay interesting
So what is spawnA1 in this example if not a string?
with pleasure! don't hesitate, you're welcome.
Hmmm thing is though, VS is telling me the variable spawnA1 is undefined.
VS is an idiot :p
your mission.sqm defines variables and is loaded before scripts, so you're good 😉
It cannot see variables that it can't see. So yes. It tells you it's undefined
And It cant see it since its in game, okay, makes sense.
Hey guys
I'd like to use the array set [index, value]
But the wiki has not examples for multidimensional arrays.
For the index, how would I select the index of an array in another array?
@real moat I imagine you would have to select the required sub array first
(array1 # 5 # 2) set [index, value]
or
_newarray set [0, 123];```
in other words, select your sub array first and input it directly into set
I see, giving that a go
One last question for the day XD!
How can I go about using a forEach to loop an addAction for the amount of elements within an array?
// This is the array I have
_myArray = [
"Alpha",
"Bravo",
"Charlie"
];
// This is what I want to loop
player addAction ["a useless action that does nothing", {}];
I have no code down yet so there is nothing specific to reference here. Just something I have been thinking of.
Ive been looking at this mhmm
But I just cant seem to wrap my head around it
Can I literally just:
_myArray = [
"Alpha",
"Bravo",
"Charlie"
];
{
player addAction [_x, {}];
} forEach _myArray;
Is there a way to have "player x was killed." Messages visible for zeus/admin while being disabled for everyone else
@real moat yep
https://community.bistudio.com/wiki/getMass
basically only works on physx vehicles, right?
else it returns 0 yes
Saw this on the ACE3 Wiki:
5.2 Indents
"Every new scope should be on a new indent. This will make the code easier to understand and read. Indentations consist of 4 spaces. Tabs are not allowed. Tabs or spaces are not allowed to trail on a line, last character needs to be non blank."
Was just wandering why this is the case? No reason is provided.
I always thought tabs were more efficient?
No reason is provided.
Read again..This will make the code easier to understand and read
Ah you meant only the second part?
Preference. spaces were chosen, and everything needs to conform to one standard, can't mix and match as it will look terrible.
tabs are very slightly more efficient when the script is parsed for compilation.
But tabs can also look widely different on different computers.
Some editors use 2 space indent to display a tab, some use 4, some use even 8.
So one some users the indent will be way too little to be readable. On other it will be so big that code goes ofscreen
whats the difference between using params and private?
params is for unpacking an array into multiple private variables
useful for unpacking function input parameters, but can also be used anywhere else where you want to unpack an array
also it has alt syntax that aids type checking
private is just... you declare a private (local) variable
I need to check if the player is inside any of the markers I have in an array.
right now the only thing that has worked for me is
for "_x" from 0 to (count _allMarkers - 1) do {
if(player inArea (_allMarkers select _x)) then {true} else {false}};
But since this is in a condition for an addAction, I don't know if my approach is too expensive?
Is there a more efficient way to achieve the same?
Would anyone be willing to take a look at some stuff and help me find why it's not working?
Just post it here and explain what you want to do, what doesn't fit your expectations, etc
So yeah this channel is for such cases: take a look at some stuff and help me find why it's not working 😄
Ok so my mod was originally built to run on Tanoa so all the buildable items are the green jungle variants. I'm trying to make them the arid versions for altis/malden. I edited the list of buildables to be variables instead of defined classnames, and the variables are defined in the missions initvar
so they went from
["walls",price,"classname","classname","classname"],
];```
and i changed it to
["walls",price,[OT_Wall1,OT_Wall2,OT_Wall3],"","description"]
];```
and then in the mission initvar i just added OT_Wall1 2 and 3 with the classnames
unfortunately when i changed them it broke everything and the mission no longer loads
https://drive.google.com/open?id=1OD7sd-fs_wl5rcrHAuoRulNy_KfNjpsR this is my RPT files with the errors and the 2 files i edited
https://github.com/Asaayu/Overthrow-Remastered this is the full codebase if you need it
I know i can just add the extra variants to the array but i'd really like them to change per mission
The original dev already did it so placeable maps change to the correct map
im super confused on the correct syntax for it too cause some of the original ones are in brackets and some arent
Does this script make sense to any of you? Im running into issues with it not executing {
dataType="Trigger";
position[]={20919.838,29.900393,7289.7822};
angle=0.77276194;
class Attributes
{
condition="call{((vehicle player) in thisList) and ((getPos (vehicle player) select 2) < 1);}";
onActivation="null = thisList execVM ""file\file\script.sqf"";";
sizeA=20;
sizeB=17;
sizeC=20;
repeatable=1;
activationBy="WEST";
isRectangle=1;
};
id=35653;
type="EmptyDetector";
atlOffset=1.3319225;
};
@slate gull to enhance readability please edit your last message and wrap it with
```sqf
yourCode
```
why is it my ad hoc function arguments are appearing as any? literally, private myFunc = { params ["a", "b"]; /* ... */ }; and when I log those, i.e. to globalChat , they appear as any for a value.
I should be able to call that, for instance, [123, 456] call myFunc;, should I not?
player globalChat format ["a '%1' b '%2'", a, b]; will report "a 'any' b 'any'".
however when I capture a parent scoped private variable, a and breport correctly.
Can anyone simplify what arguments are? Really struggling to understand them atm
super simple description: they are values you have in one script that you want to use in another
gotcha, cheers
underscore prefixed? I see, thank you for clarifying @astral dawn . I could not find this protocol documented anywhere.
@dreamy kestrel
Check private variables: https://community.bistudio.com/wiki/Variables
params makes private variables, so same rules apply to their naming. I think it should be said somewhere
although examples in that article are not great, currently the preferred way to make private variables is this: private variable = value; https://community.bistudio.com/wiki/private
@astral dawn Except that private variable naming conventions are "relaxed", underscore is not required. or at least my scripts are running as such.
so somewhere along the way someone "got the memo" for parameters, but let it go for private variables.
read: I would suggest is not an examples issue, but an engine/parser issue.
Except that private variable naming conventions are "relaxed", underscore is not required underscore is a requirement for private variables
@tough abyss exactly. try it.
try what?
you were quoting me?
yes, you said nonsense
literally I have a script private ["createBaseAsset", "asset_class_name", "asset_proxy_name_prefix", "asset_proxy_pos_atl"]; which works just fine. no underscores required. I get the expected results.
whereas the documentation calls for "_createBaseAsset" for example.
what errors? how?
check .rpt file or enable onscreen errors with -showScriptErrors https://community.bistudio.com/wiki/Arma_3_Startup_Parameters
I'm not sure I follow, @tough abyss . You have something specific to suggest? or intended as a troubleshooting for the ad hoc function?
okay, then how do you use private? again, we're driving at params inconsistencies with the documentation, ultimately, but I'm all ears.
Exactly like wiki says https://community.bistudio.com/wiki/private
I've seen it a couple of ways, declare a set of variables private, or ad hoc onesy twosy.
Please show the inconsistencies with documentation so if there are they could be corrected
I just did, above, underscores are not required for private variables.
it's working fine for me, I get the objects placed that I want. so apparently not required.
Cannot find where it says you don't need underscore
And I am telling you it is not working fine as it errors
The docs claim "The identifier of private variables in a script always has to started with an underscore.", however, mine are not, and it is working.
again, if you can be more specific, tell me how it is "errors".
You seem to have quite a misconseption what private is about
again tell me how that is @tough abyss .
"Local variable in global space" is the error private [] gives when you give it a variable name without an underscore prefix
reading it sounds like it should be reversed but the point is it doesnt work without _
private variable by default cannot be defined without underscore (with exception of one special case in for loop)
it just sets your variables as a global variable instead which is why it would appear to work
I see, so I could potentially evaluate those "private" variables in a debugger for instance?
which in fact I just did, I see...
then I can verify that further isNil "_asset_proxy_name_prefix" yields true, scope evaluated, private GC'ed.
_var = 123;
call {
private ["_var"];
hint str [_var];
}
the result is [any]
var = 123;
call {
private ["var"];
hint str [var];
}
the result is error and [123]
Now how is this working as expected?
My guess would be in the top example _var isn't being defined in the call
yea, the point is that the top one is working as expected and the bottom one doesnt work how mwpowellhtx thought it did.
I verified that in my debugger @robust hollow , thanks for clarifying that.
and to be clear it did "work" but also potentially smashes bits in the namespace.
is it possible to check if a unit has been given a move order?
or if a move order is in progress?
ah ok. I was looking for something like "currentwaypoint", currentmoveorder etc
thanks
one more thing. can I check who gave the move command? I want to differentiate between move commands given by a script and commands given by a player/zeus
no idea, set a variable when you give order by script
or even better add scripted event handler
ok
So, my shop script is evolving perfectly. But now i am thinking about taking it a notch up. Would it be a feature, players would like to have, or not?
I am talking about price-ranges of stuff (sometimes more expensive, sometimes more cheaper) and maybe like 'item of the day' thats half off and such things? I also could do a little stock market (later in the year, need my mission generator for that) that changes pricing accounting for things happening on altis.
Would that be nice or more or less uninteresting?
Would make it interesting, but it would also move the economy away from being player based. You're essentially faking supply and demand with your idea.
At least in a capitalist economy. I think it's an interesting idea.
is there a way to detect if an addAction script was called via the mouse wheel and click menu or via the keybind shortcut?
Doubt it. Could detect shortcut keyboard and wire it to a variable. Then you'd know if someone used the action and if they pressed the shortcut
Yeah, the player impact is probably not big enough to compete with the clash of west & east, their needs for weapons and such.
Like, when heavy war is going on, prices would shoot up very high, but when a no-attack-pact is made and everything comes to peace for a time, prices would go down again.
The war between east & west will be dynamically scripted (and only near players will be spawned in to have a living and breathing war-world)
How can i make this, inherent of a 'point' like "mercs > new action"?
[player, 1, ["ACE_SelfActions"], _action] call ace_interact_menu_fnc_addActionToObject;```
Currently i am simply not understanding what the ace interaction framework tries to tell me.
Ah, i finally understood how it works.
@round scroll try this:
player addAction ["This is a test", {
// true if mouse button activated
if (inputAction 'actionContext' > 0) then {
hintSilent "Mouse Button Activated";
} else {
hintSilent "Keypress Activated";
};
}];
this is exactly as I suggested...
@ocean veldt thanks, will give it a test after work, much appreciated!
@high marsh thanks as well 😃
@dreamy kestrel your SQF debugger? Tell me more about it. I didn't know there were any public debuggers besides mine
U jelly? @still forum
huh?
Are you jealous?
No. I just think he is using wrong words. Probably means some broken/incomplete linter and calls it a debugger.
Because if he had written a debugger, he would know that he's talking nonsense
Maybe he calls the debug console a "debugger"
I think you give him too much credit, probably calls debug console a debugger
Bingo!
I want that debugger, because the other one is... 🙄
Find someone who is able to write VS Code extensions and wants to continue what SkaceKamen started. Then you can have your debugger
what SkaceKamen started
you mean his linter?
you mean integration of your debugger into vs code, right?
yeah
oh that's interesting, I might know such a person
Existing stuff is open source. I once tried to get something going. But I couldn't get the basic dev env working at all.
Never tried to make a VS Code extension
https://github.com/SkaceKamen/vscode-sqflint/tree/feature-armadebug/debugger/src here's the code
Currently the whole codebase of that extension is a little bit messy. (if debugger uses sqflint as base it doesn't )
can you point me to the repo of his debugger plugin?
I can't see it at his page
https://github.com/SkaceKamen?tab=repositories
I just linked it above
Hi all
I'm struggling with this
{deleteVehicle _x} forEach allDeadMen;```
it's returning ``Invalid number in expression`` on mission load. It's located in my outro script executed locally ...
bad line ending
https://i.imgur.com/dxVa26D.png
what does that mean ?
the last character in the line is some weird character that the compiler is interpreting as a number, but not a valid one? 🤷
delete the last character on that line. after the semicolon
How did you find that 😮
vscode shows the bad character on the end.
its a char with no width to it, is why other editors dont see it i guess
I get the same in the error
Is the character also in the discord message? copying out of discord to notepad++ didn't show it to me
{deleteVehicle _x} forEach allDeadMen;#
Ah! notepad++ does indeed show it. Just as 0 width as you said.. Man.. Next level debugging here 😄
what's causing this ?
@quartz coyote delete everything from the semicolon till the next line. Then rewrite the semicolon
there is an invisible character after the semicolon as Connor said
what is a semicolon ?
;
what
What did you call that character before if not semicolon?
what's causing this ? copy pasting from forums
Hell that's true
Wasn’t always the case but it came back after last forum upgrade
wut
Can you maybe find me a post that has that issue?
Maybe web department can fix it
If I come across yeah, don’t really copy paste much
You think? I have never in my life seen so incompetent web team as the one BI has
Complained many times about the left hand side image on biki that covers half the page on mobile, the result - zero
Didn't complain to the right people then 😉
Don't get spaces in firefox, nor in chrome.
I checked the } forEach allDeadMen; line in jshock's first post
same for me ^^ 🤷
hello, does anyone know the best way to kick someone off your mission file? I've been thinking with endMission but maybe there's a better option
because at the current moment the best I can do against griefers and all is to freeze them
endMission is the easiest way I think
Hm, the issue is according to the wiki, I can't specify which object should get their mission ended
You can use serverCommand to kick player
I guess something like this
serverCommand format ["#kick %1",_name];
No the one with the password
my mission file is player hosted (in game hosting), not a dedi
so i doubt I get a password?
If you are the host you can just login as admin and kick players
Yeah, I can understand that, what I'd like to do is give others access to kick/ban others too
That only makes sense if you have dedicated server where there is no host to oversee it
Besides hosted servers are for smaller groups
ok im trying to use grad persistence and after following the instillation instructions as closely as possable, every time i try and load the save in the editor it crashes and gives me the error that it cant find the cfgFunctions.hpp despite having the appropriate code to call it and it is clearly there.
Yeah, that's true, but here's the situation: There are virtual spectator slots on my mission file. While spectating, I don't wanna disturb anyone and/or cannot open my admin menu. So, I'd like the ones that have access to my admin menu to be able to kick/ban if they see fit through the menu
So if you are spectating and see some cheater you call a friend to kick him?
Ah no, you don’t want to disturb anyone. So what you just watch the injustice helplessly?
well, yeah it sounds stupid, I just wanna learn how to give access to others to these commands, expand my experience 😃
Yeah, hosted servers are not my favourite subject so maybe someone else can tell you how to manage them
thats understandable, thanks anyways
Could use some help with onMapSingleClick. I am trying to turn off the functionality after the scripted event occurs so that the player can't just keep clicking on the map and invoking it. Have tried onMapSingleClick = ""; and it throws a "reserved variable in expression" error for that line. Any tips?
Hey everyone
Someone know how to create a player activated trigger ?
I need the user to make an action (whatever, flare shot in the air ? Support call ?), and this action activates a trigger
If i am not mistaken @fluid abyss there should be a "onFlareFired.sqf" within the server scripts on arma wiki. That could help you. Lemme quickly look it up
My Question:
Can you animate and/or use the arm on the back on a nemmera in arma? I want a script to unflip vehicles with the use of the nemmera.
I really new to Eden, how can you import a script, and link it to a trigger ?
I would suggest you a basic introduction to scripting and/or eden editor. Sadly i dont have a good link at hand for you. But there are plenty of very beginner friendly tutorials on youtube and in the www @fluid abyss I trie to find one i used and found pretty helpful. Gimme a minute
Sorry to bother you again, do you know why this script raise a Generic error ?
{_X in crew evac} count (units alpha) >= {alive _X} count (units alpha)
use more parenthesis
(alpha being my group and evac being the evacuation vehicle)
{_X in crew evac} count ((units alpha) >= {alive _X}) count (units alpha) isn't valid
({_X in crew evac} count (units alpha)) >= ({alive _X} count (units alpha)) is
what'd be the best way to make bullets deal lets say twice the damage?
addEventHandler and HandleDamage I suppose?
Is it correctly understood that onPlayerRespawn fires every time the player respawns even if they use the respawn button?
Could i use this to get the position of a squad leader and then teleport the player to him?
Yes, you can do something like that with 'onPlayerRespawn' but, afaik, vanilla has something like that already built in if i am remembering it correctly.
@keen bough Hmm i looked around but couldnt find anything
Ah, let me see, maybe i was mistaken.
Yeah, i actually think it was in mcc as we used this once barely half a year ago. You can write something yourself. Its actually not too hard as you just have to scan for alive players and get the group leader of the group and set your new spawned players position to that one/near that one eventually.
@fluid abyss Nothing is wrong with that expression, you probably caught non printable character from copy paste
@still forum >= is low precedence no need for parentheses
After some testing, found out that the group alpha was non existent, just had to fix the group
@fluid abyss no that was not the reason. If apha was nil the whole expression would have been quietly ignored in unscheduled or undefined var error thrown in scheduled. If you had generic error it was most likely bad copy paste, happened a few times lately
Does allGroups west create an array of existing groups on blufor?
That is what I'm looking at, but the way I'm reading it, it doesn't seem to take any args. Some forum posts seem to indicate it does. I'm not sure.
pretty sure forum posts are wrong
Thanks, seems that way
@devout brook sqf private _westGroups = (allGroups select { side of the _x == west; });
(minus the brackets maybe)
@winter rose I did this:
if (_countBlufor > 0) then
{
if (side _x == west) then
{
_getGroups = _getGroups + [_x]
forEach allGroups;
};
...
}
Think that'll work?
nope
bleh
@winter rose thank you!
side of the _x 🤔
I can't test it yet because it doesn't seem like the script is kicking off at all 😦
post the script
I have a call in init.sqf, and the entire script is in while {true} do ....
while {true} do
{
[east, "OPF"] sideChat "The script is running.";
if {playersNumber east > 0} then
{
[east, "OPF"] sideChat "There is a player on EAST.";
_countBlufor =
{alive _x and side _x == west} count allUnits;
_getGroups = [];
if (_countBlufor > 0) then
{
[east, "OPF"] sideChat "There are units on WEST.";
_getGroups =
(
allGroups select
{
side of the _x == west
};
);
_groupToLocate =
[_getGroups] call BIS_fnc_selectRandom;
_groupPosition =
mapGridPosition _groupToLocate;
[east, "OPF"] sideChat "Locals have reported enemy activity around " + _groupPosition;
}
else
{
[east, "OPF"] sideChat "There have not been any reports of enemy activity.";
};
[] spawn
{
sleep (10);
};
};
no closing bracket }
womp
you need to use syntax highlighter
Am using VScode
[] spawn
{
sleep (10);
};
that doesnt make your script sleep instead it spawns millions of spawn scripts
your scheduler will smappen 10 seconds worth of scripts
really bad
I'm intending to made the sleep be 5 minutes, but set it to 10s for testing
Also I'm not sure I understand the []spawn part of this; I was just following the sleep doc
side of the _x is not a valid expression
wrong as well [_getGroups] call BIS_fnc_selectRandom; https://community.bistudio.com/wiki/BIS_fnc_selectRandom
[east, "OPF"] sideChat "Locals have reported enemy activity around " + _groupPosition + _groupPosition will be just ignored
if {playersNumber east > 0} invalid syntax
If _getGroups is an array, why won't BIS_fnc_selectRandom work?
_getGroups = ( allGroups select { side of the _x == west }; ); invalid, you cannot have ; inside ()
it is array inside of array, BIS_fnc_selectRandom will take only outer array and return inner array
_getGroups call BIS_fnc_selectRandom is correct
[_getGroups] call BIS_fnc_selectRandom is not
Ahh okay
Described in detail on the page I linked with examples
Maybe start with something simple
one statement at a time
once a line is working as you expected add another one
Good idea
anyway good luck
Thanks for the help
@tough abyss Success! Thanks again.
HEY guys, Im making a sector control mission ...but the problem im having is that, whenever someone kills an enemy player is shows up for all players and also gives everyone the "XP" ... how can i set it that only the "KILLER " can see the message and also the only one who gets the XP ???
https://imgur.com/VS7IrO2
i have this in my ...
..............................................................................................................
initplayerlocal.sqf
............................................................................................................
xpcash = 0;
addMissionEventHandler ["entityKilled", {
params["_killed", "_killer"];
_killed = _this select 0;
_killedside = side _killed;
_killer = _this select 1;
_killerside = side _killer;
cid = owner _killer;
cid publicVariableClient "enkilled";
if (!( _killer == _killed ) && { isPlayer _killer && !( side _killer == side group _killed )} ) then {cid = owner _killer;
cid publicVariableClient "enkilled"; [control, _this select 0] execVM "xp.sqf"; playSound "FD_CP_Clear_F";}}];
"enkilled" addPublicVariableEventHandler
{
xpcash = xpcash + 100;
};
..................................................................................................................................................
initserver.sqf
........................................................................................................................................................
"enkilled" addPublicVariableEventHandler
{
private ["_data"];
_data = (_this select 1 );
_killed = (_data select 0 );
_killer =(_data select 1 );
_cid = owner _killer;
_cid publicVariableClient "enkilled";
};
Quick Question:
_action = ["Custom","Save Vehicles in Garage","",{[] remoteExec ["test2.sqf", 2]},{true}] call ace_interact_menu_fnc_createAction;
[merc_arsenal_box, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
Did i write this correctly with the remotexec in mind?
long time i didnt use that ^^ figured it out ["params", "scriptpath"] remoteExec ["execVM", 2];
Why isn't this channel displaying in Side Menu anymore ?
@quartz coyote did you open 'creative editing'?
you can collapse the 'creative editing'
yeah smart
thx
does this work and if not, is there an easy way of doing it ?
var1 != var2 != var3 // All Different from each other```
_vars = [var1, var2, var3];
(_vars arrayIntersect _vars) isEqualTo [];
(not tested but should work :3)
Thanks !
But don't try it with nested arrays as vars
arrayIntersect checks only 1st dimension of an array.
wait, won't it simply return _vars?
https://community.bistudio.com/wiki/arrayIntersect
Additionally, using the same array for array1 and array2 will simply return array of unique elements.
first intention, I would do (maybe there is a better way)
_array1;
_tmpArray = [];
{ _tmpArray pushBackUnique _x } forEach _array1;
count _tmpArray == count _array1;```
or _array1 findIf { (_tmpArray pushBackUnique _x) == -1 } == -1 , but it's harder to get 😄
@quartz coyote @hollow thistle
// one-liner:
count (_vars arrayIntersect _vars) == count _vars```
I'm gonna go with a simple check isEqualTo. Not like I had 200 vars to compare !
Let's stay simple.
Yeah my first example was wrong. my bad.
(_vars arrayIntersect _vars) isEqualto _vars; this will work too won't it?
Not sure if this or count variant is faster.
it should, but I don't know about items order (and I think this one would be faster)
not a sqf question: We want to convert a bunch of p3d to use sbsource = visualex as property of the geo lod and either remove or rename the shadow lods as edit lods. Anyone got a o2 script for this purpose already or has any clue how to write one?
not a sqf question → more luck in #arma3_model I guess
Hi! Is there a way to check if the entire area of a marker is not inside/touching the area of another marker? In other words, the boundaries of a marker are not intersecting another marker's boundaries.
playing with inArea, maybe
if they are round this can easily be done with getMarkerPos and distance
they are round indeed, would you mind explaining me how to use distance in this context? @winter rose
this is what we have now :
params ["_markerA", "_markerB"];
private _posA = getMarkerPos _markerA;
_posA inArea _markerB;```
problem is, this can still happen https://imgur.com/Jul1a2Y
(getMarkerPos _markerA distance getMarkerPos _markerB) < (getMarkerSize _markerA select 0) * 2```
^ here you are checking that both centers are distance from at least a diameter
genious
hehe
wait, only if they are the same size. I should write code while working at the same time e_e
with details:
private _distance = getMarkerPos _markerA distance getMarkerPos _markerB;
private _sizes = getMarkerSize _markerA + getMarkerSize _markerB;
private _biggestSize = selectMax _sizes;
private _result = _distance < _biggestSize;```
@next scaffold
ty!
@winter rose it doesn't seem to work. I have this:
params ["_markerA","_markerB"];
private _distance = getMarkerPos _markerA distance getMarkerPos _markerB;
private _sizes = getMarkerSize _markerA + getMarkerSize _markerB;
private _biggestSize = selectMax _sizes;
_distance < _biggestSize;
If the return of that is false then everything is fine. If the return is true, then the marker I was trying to create gets deleted and I get a hint to notify me that I was intersecting with a previous marker.
Markers get created at players position, if I am inside the old marker the function works as intended, marker gets deleted and I get the notification. But if I'm outside the old marker, new marker doesn't get deleted even when the new marker boundaries are obviously intersecting with the old marker ones.
See the picture to understand better the problem https://imgur.com/a/1jVpMab
this script only manages round marker distance; if it properly detects marker overlap then this code is not the issue (maybe its usage).
you have to check with all of your current markers if you overlap, and if so delete the unwanted one
maybe keep a reference to old markers in an array or something
the logic that deletes them is done and working, it is the overlapping detection is what I have problems with
if you take two markers, if they overlap, is the detection wrong?
I think so
let me try another test and show you I am not crazy
ok, had to do the test in video. I hope you don't mind:
https://www.youtube.com/watch?v=a9b05m581J0&feature=youtu.be
I made a while loop to keep updating the marker position and take the player position so you can see live how they overlap and the detection is failing
live debug on the up center is just the script you gave me returning true when the center of the marker is inside the other one
@winter rose
ah yes! I forgot the * 2 on _biggestSize
@next scaffold getMarkerSize returns radius(es? ii?), not diametre!
jeez I'm really stupid
I did it in the first code, not the latest ones, my bad!
working now, thank you very much!
getMarkerSize returns array
@tough abyss yes, of radius_es_ (or radii ^^)
Well if you want to be more precise, they are axes
true!
Should be sum of radii, no?
getMarkerSize returns [x-axis, y-axis]
x-axis is half the width, y-axis half the height
If you have a tiny marker (radius 1) next to but outside of a huge marker (radius 10), center-to-center distance 12, so not-overlapping by 1, it would be within 2*_biggestSize.
hmmmmmm I may have to rethink this one
(@work on some awful JAVA code…)
params ["_markerA","_markerB"];
private _distance = getMarkerPos _markerA distance getMarkerPos _markerB;
private _biggestA = selectMax getMarkerSize _markerA;
private _biggestB = selectMax getMarkerSize _markerB;
_distance < _biggestA + _biggestB;```
maybe something like this indeed
I believe so!
@digital hollow thank you for your remark 👍
@next scaffold , updated code above ☝ (again!)
awful oneline 😄 :
params ["_markerA","_markerB"];
private _overlapping = (getMarkerPos _markerA distance getMarkerPos _markerB) > (selectMax getMarkerSize _markerA + selectMax getMarkerSize _markerB);```
wow
beautiful oneline
ty again
No checks against non-circular markers? =p and the same marker being passed for both?
as you can see, NO
Hello everyone
I still have trouble to create a player activated trigger
I need my player to do an action in a certain zone (whatever the action, radio call, flare shot...)
Does anybody have an idea on how I can create that ?
is your area just a circle for a distance from an object/point?
I would prefer, but it's not mandatory
I was thinking something like "my players come into a zone, shoot a flare in the air, and the evac come to save them from horrible things"
because you could simply addAction and set a distance condition, the action will always be "attached" to the player but will only display when the condition is true
So, I can use my range trigger to do a addAction when the come in, removeAction when they come out
and link this action to another trigger, that unlock my evac ?
just addAction once, and in the condition argument, set something like "player distance zombie1 < 30"
does player inRange evac_trigger works ?
I have this addAction [ "Call for evac", {evac_called = true; publicVariable "evac_called";}, nil, 1.5, true, true, "player inArea evac_trigger_zone" ]
Present in the init of my squad leader
But I can still call it from everywhere
what is evac_trigger_zone ? Trigger? Location? Marker?
This blue trigger
https://i.imgur.com/2XZMyhb.png
(For now I have the same evac_called in the black hawk wreck, but it think it's feels better with the action menu)
Update just in case someone needs it:
I placed player_in_evaczone = true; publicVariable "player_in_evaczone"; in the server init
And placed a new zone trigger, which set player_in_evaczone = true when someone comes in
For the player init,
this addAction [
"Call for evac",
{evac_called = true; publicVariable "evac_called";},
nil,
1.5,
false,
true,
"",
"player_in_evaczone"
]```
private _mortars = spawner getVariable ["NATOmortars",[]];
{
_mapCtrl drawIcon [
"\A3\ui_f\data\map\markers\nato\b_mortar.paa",
[0,0.3,0.59,(2000 - (_x select 1)) / 2000],
_x select 2,
24,
24,
0,
""
];
}foreach _mortars;```
this is giving me a generic error
_mapCtrl isn’t defined?
You are also checking if their GPS isn’t visible, surely this should run if it is?
it's defined in the beginning of this script
Maybe show the whole thing?
yeah 1 sec
actually it might be fixed somebody pushed a pull request a few days ago
old RPTs
Thats fixed but now i see this Error in expression <lead = leader _x;
doesnt tell me where it is or what file its in
if((_lead distance _lospos) < _spotDistance) then {
if(>```
is there a way to search through every file?
Notepad++ can search text in files.
yeah but i'll have to search a boatload of files lol
Visual Studio Code can search in a directory
yeah but i'll have to search a boatload of files lol notepad++ can search all that x10
Notepad++ "find in files" in the search dialog
You thought I meant "open each file and Ctrl+F"? xD
well afaik you can drag&drop folders into n++ to open every file in there 😄
when you have like millions temp files and you accidentally press saveAll
and the fucking button is right next to save and you cannot disable it
well @digital hollow i thought you meant open them all and use search in current documents 😛
Why would anyone press the save button if you can just CTRL+S
yeah I do
Now you can LIVE!
ok so i found where the broken stuff is but im not sure why its broken
it's flooding all the RPT logs though
if((_lead distance _lospos) < _spotDistance) then {
if(>```
aside from updating the outdated syntax it looks the same as the old version
loop_IOP_details params [""_group"",""_lospos""]; really?
oh i see you pass it as a string
i didnt write any of this code, i'm pretty new to the whole thing. I took up the mod and the guy I had got hired to do official content so im stuck here trying to fix little things while i wait on somebody to replace him
private _lospos = ATLtoASL ([_pos,[0,0,5.5]] call BIS_fnc_vectorAdd);
private _post = (_pos nearObjects ["Land_Cargo_Patrol_V4_F",10]) select 0;
private _group = creategroup resistance;
private _dir = ((getdir _post)+180);
_group setFormDir _dir;```
_post isnt being defined
halp 
just means there is not any object of the type Land_Cargo_Patrol_V4_F, you have to account for this
private _pos = _this select 0;
private _lospos = ATLtoASL (_pos vectorAdd [0,0,5.5]);
private _group = creategroup [resistance, true];
private _post = (_pos nearObjects ["Land_Cargo_Patrol_V4_F",10]) select 0;
private _dir = 0;
if (isNil "_post") then {
_dir = random 360;
} else {
_dir = ((getdir _post)+180);
};
_group setFormDir _dir;
or make the search radius larger
hm
the script is for initializing a player built object, so i wonder if that would break things.
I'll have to test it out.
why is it even creating a group then??
adds the spawned AI to high command i think, if thats what that means
like i said im still learning all this lol
tbh they server no purpose in the high command bar though so i could remove that.
Just clutters things
I tried looking for this but couldnt find anything for it, but theres no way to get the helmet of a unit is there? like how unitBackpack returns the backpack object. Im trying to see if I could use scripts to change a helmet texture
you cant change the texture of helmets by script, no.
can you make hidden selections for helemets though?
Hello again
My mission almost works... Except my players can't spawn.
Exactly, I want them to just "appear" in game, without using the respawn menu
(But keeping it enabled when they indeed die)
Found some info about the Description.ext file, but it doesn't seems to work, I still have the respawn menu at the start of the mission
Well, nevermind, I found the root cause (I placed everything in class Header, including respawnOnStart)
@edgy dune You can get a units helmet with this command: https://community.bistudio.com/wiki/headgear
And if the helmet has variations, you could easily do a workaround to 'change' the helmets camo.
@keen bough ah okay thank u. I didnt check for the word headgear, I was searching like gethelmet or something. Thank you.
haha, i know exactly how you feel ^^
anybody have any advice for when shit aint working and there are no errors to be found
Count opening and closing curly brackets
would it be possible to include CEF into Arma 3 using mods?
"CEF" ?
install ABCCEF and uninstall CBA 😄
I want to set a velocity to my vehicle in the direction I pointed him in.
Is there a way to convert Direction into Verctor values to use as velocity ?
If you want to work with model directions there is setVelocityModelSpace
And if you need a world direction as a vector, use vectorDir
https://community.bistudio.com/wiki/for
just as i notice it is lacking (and i cannot remember wether or not it was), is for "..." from x to y the y inclusive or not?
what is happening on
for "_i" from 0 to 10 do
{
systemChat str _i;
_i = _i + 10;
};```
only 0
or when this is being done:
for "_i" from 0 to 10 do
{
systemChat str _i;
_i = true;
};```
just 0 again
no error or anything like that?
negative
kk
Hey everyone
I'm this close to finish my map.
Sad problem is, when all my tickets are depleted, and all my players are dead, the game end with a "Mission completed". How can I change this to "Mission failed" ?
hey i have a script that is spamming my RPT logs with an error because of a broken variable. How would I 0 out the broken variable to stop the error? It's not a priority to fix it right now i just want it to stop flooding the logs
give us the "an error"
if((_lead distance _lospos) < _spotDistance) then {
if(>
8:10:26 Error position: <_lospos) < _spotDistance) then {
if(>```
the one i was trying to fix yesterday 😛
a local variable?
yes
can't do much about that globally
Or rather.. nothing
Besides fixing the real origin of that error
as far as I remember it was a nearestObjects?
Make sure the object that it wants does exist
im pretty sure the object it wants does exist
my private var _post isnt being defined
could i do something like if _post = nil then[]
Ok so i have another probably dumb question lol
private _lospos = ATLtoASL ([_pos,[0,0,5.5]] call BIS_fnc_vectorAdd);
private _post = (_pos nearObjects ["Land_Cargo_Patrol_V4_F",10]) select 0;```
is _pos just doing nothing?
because _pos is just saying select the first element in the array correct?
and then in _lospos it's essentially saying _lospos = ATLtoASL ([_this select 0,[0,0,5.5]]
and thats just selecting 0 in that array
you pass it to nearObjects command, so it is not doing nothing
no it says select 1st element from returned array, obviously if return array contains no elements it cannot select it
yeah but nearObjects returns an array of all the land_cargo_patrol_v4_f doesnt it
is this what wiki says?
ah yeah i found it
thank you
❤
(_pos nearObjects ["Land_Cargo_Patrol_V4_F",10]) does the 10 mean only list 10 objects?
ah no found it, its the search radius
Hi all,
Is there a way to delete or at least list all surrounding objects of type WW2_BET_Bwire_4 from IFA3 mod ?
I've looked in their configs but lets be honest... it's rampage in there...
@quartz coyote https://community.bistudio.com/wiki/nearEntities ?
So I am scripting for the Arma 2 warfare module and I was trying to do some custom settings. I had this block BIS_WF_LimitedWarfare = true; BIS_WF_UrbanWarfare = true; BIS_WF_Classic = true; BIS_WF_EnableCivilians = false; BIS_WF_FIELDHOSPITALCHANCE = 60; paramsArray = [-1,-1,-1,12,0,0,0,0,false,-1,3,0,-2]; in a script that is initualized by the warfare module's init field. I started it up and I have starting funds a lot higher so I know that Limited warfare is working, but the max city part of paramsArray doesn't seem to be working. Am I using the array wrong in some way?
From the code of warfare if (!IsNil "paramsArray") then { if (Count paramsArray > 12) then { _victoryTime = paramsArray Select 0; _victoryScore = paramsArray Select 1; _victoryTowns = paramsArray Select 2; BIS_WF_MaxTowns = paramsArray Select 3; BIS_WF_FastTime = paramsArray Select 4; _minStartingDistance = paramsArray Select 5; _miscSettings = paramsArray Select 6; _neutralOpposition = paramsArray Select 7; BIS_WF_RelativeSideColors = ((paramsArray Select 8) == 1); _startTime = paramsArray Select 9; _support = paramsArray Select 10; _townRangeModifier = paramsArray Select 11; _townSpawnTimeModifier = paramsArray Select 12; };
I made a little RP prison. I have scripted it in a few times and it is super fun. I have been trying to fuck around with game logic and triggers to get the door to be locked/unlocked by blufor only. Basically, I would have to be able to script it in through debug with only blufor being able to lock/unlock it. Idk if that is even possible as I am too new to this. I will link the specific gate I am trying to use. Does anyone know how to make this happen?
Probably an if check when giving the action to lock or unlock to see if they are bluefor
@vast sand your script is correct
Guess I will try replacing the init script in its entirety
Unless you forgot a closing bracket in the bottom snippet
But you probably didn't copy that
what im not sure about is BIS_WF_RelativeSideColors = ((paramsArray Select 8) == 1);
because in your array you put false
not sure what happens if you compare false with == to a 1
Default value is false
You get a boolean 0 though
The bottom snippet is from the code within the module
@winter rose Ok so nearEntities ain't working.
I'm looking for the "Type" of object it could be.
ex: "Car", "Tank", "building"
The name of the object here is WW2_BET_Bwire_4 but I want it's type based on the Cfg file.
typeof "WW2_BET_Bwire_4" ?
returns Generic Error
typeOf will return the "Class Name" and not the "Class Type"
use the type instead of "Car"
Didn't we already tell you several times that it doesn't work like that?
Look up the classname in config viewer. And it will list you all it's parents on the bottom
choose one of them
there isn't one "type" of any object. Each object has multiple of what you call "class type"
i'm asking because it's a mess inside the bin file... I can't understand how they named them. Hold on let me copy/past what I found, you can help me from there...
class WW2_BET_Bwire_4: LIB_Objects_Wire_base
{
author="Beton";
scope=2;
scopeCurator=2;
displayName="$STR_LIB_DN_OBJECTS_BARBWIRE_4";
model="\WW2\Objects_m\Structures\WW2_BET_Militia_m\WW2_BET_Bwire_4.p3d";
icon="\WW2\Objects_t\Structures\WW2_BET_Militia_t\icons\map_barbwire_ca.paa";
};```
Config viewer. Ingame
manually walking over the inheritance in debinarized config files is a mess
What class type do you want?
How about that one right there LIB_Objects_Wire_base I'd assume all barbed wire inherits from that
I'd assume so too
i'll check in the cfg viewer
there is so much in there too, how would I find anything 😦
I don't even know what Cfg file to open ...
I think it's in CfgPatches
but only assuming that because it's the main class in the bin file I opened
Vehicle is CfgVehicles