#arma3_scripting
1 messages · Page 628 of 1
Scripting wise I have done something like this:
_controls = _someArray;
_angle = 360/ count _controls;
_Xc = (0.473 * safezoneW + safezoneX);
_Yc = (0.469 * safezoneH + safezoneY);
{
_x ctrlSetPosition [_Xc + 0.19 * cos (_angle), _Yc + 0.24 * sin (_angle)];
_line = _display ctrlCreate ["RscPicture", -1];
_line ctrlSetText "line.paa";
_line ctrlSetPosition [0.3145 * safezoneW + safezoneX, 0.207 * safezoneH + safezoneY, 0.35 * safezoneW, 0.572 * safezoneH];
_line ctrlCommit 0;
_line ctrlSetAngle [_angle - (_step / 2), 0.5, 0.512];
} forEach _controls;
syntax highlighting pls
How i do that?
see the pins
aight
@timid niche For lines, you can use "RscLine"
Is that a thing
yes
ohh
@timid niche For lines, w and h can also be negative
start is at [x,y]
end is at [x+w, y+h]
That pretty much solves your issue
lines dont seem to be the real issue though
what was it then?
@timid niche For lines, you can use "RscLine"
@little raptor "RscLine" ?!
@jade abyss You didn't know?!
Never seen it before oO
Text on the 4 controls one is alligned, 5 controls is fairly off.
Thought about the 4:3 + Aspect Ratio?
no, that I did not
Then, have fun there 😄
4:3 is how the stuff gets calculated
e.g.
pixelGridStuff
w = 1
h = 0.75
= proper square
anyway, thats for #arma3_gui
A2OA. Is it possible to get map objects (trees and bushes) that are intersecting an object (such as a building), and to remove or flatten them?
@drifting sky yes.
one of your options is to find if the two areas collide. (might be difficult if you're not good at math)
your other (easier) option is to use lineIntersectsWith. Set the beginning pos at the land contact of the object. The end pos is a few meters up in the [0,0,1] direction (also, ignore this object). If it intersects with any building, use hideObject to "flatten" the object.
both methods are not 100% accurate
If I were to do the areas intersect method, I would need to obtain a list of nearby trees/bushes
Yeah. The 2nd one is easier
is there a way to get a list of nearby trees?
I was gonna say: https://community.bistudio.com/wiki/nearestTerrainObjects
but it was introduced with A3.
So I don't think so
https://community.bistudio.com/wiki/nearestObjects maybe
maybe near(est)Objects
but what class to search for?
I'd prefer to narrow the list to things which are trees and bushes
Some trees do not have a class (or config)
so I guess I'll just have to try it a bunch to see what names are returned by nearobjects
I don't suppose there is a command to return the size of the bounding box around an object, or the radius from origin to farthest vertex.
boundingBox(Real), then get the difference
or sizeOf
Alright, I think that's all the information I need. Presuming boundingBox works on tree and bush objects as well as buildings.
Is there a way to find a string in a string in arma2?
toArray, but not easily
Ok, hideObject does not work on trees or bushes
however, setDamage does seem to work
Now, I cannot get a typeof for bushes or trees, it just returns ""
so What I'm doing is checking if the type is ""
hideObject should work with them
If you want something quick and dirty @drifting sky , try this:
private _collidingObjects = nearestTerrainObjects [
_position,
["TREE", "SMALL TREE", "BUSH", "FENCE", "WALL", "ROCK", "ROCKS"],
sizeOf _placedBuilding,
false,
true
];
{ _x hideObjectGlobal true } forEach _collidingObjects;
Downside is it uses sizeOf, which tends to bigger than the actual object.
So it's a little over zealous with its hiding, but you're unlikely to get collisions.
Thanks, but i'm in A2
Hello, I’m looking to make some repeating and hopefully randomized 155m artillary strikes and after hours of searching I can’t find a way to make this work. Anyone able to help me out?
@drifting sky can you use CBA for arma 2? It has string functions
Didn't know that. I'll look into it.
This is how to create a artillery strike on a position. [[14642.2,16752.9,0],"Sh_155mm_AMOS",300,6400,10,nil, 32,4900, 150] spawn BIS_fnc_fireSupportVirtual;
This part of it is the position. [14642.2,16752.9,0]
@drifting sky you can also use kk's function to find a string in a string
http://killzonekid.com/arma-scripting-tutorials-how-to-find-a-string-within-a-string/
@drifting sky Objects that do not have a type (or config) are not necessarily trees or bushes. Any simple terrain object may not have a type.
How does one remove an eventhandler added with addPublicVariableEventHandler?
you can't, as explained on the wiki page
I shouldn't be coding less than half an hour of waking up, I can't seem to read properly then 😄
my bad, it is actually not written there - will add soon\™
but also, "public variable" scripting is obsolete, you should do otherwise
@wispy cave ↑
I've got a holdaction that's sending doing a publicvarserver to tell the server that a mission has been completed, is there a better way?
yes, remoteExecCall
updated the addPVEH page.
There is no way to remove this EH
you can overwrite the event to do nothing. not technically removing but effectively the same.
does it replace the EH then? (then it should be named set and not add, but hey)
yea
worth changing then
@wispy cave if you want to take the ugly shortcut ↑
I already made an uglier shortcut with a //todo to replace it by something better soon^tm
ooooooo
ive often thought of requesting this because I'd use it a lot, but feared I'd get ostracised by those better than me
It was mine
yeah 😒
not the answer i have on my card tbh
but nevertheless, its going to get used bigtime
thank you
thank Dedmen!
do i have to? 😄
No but he's the one who implemented it
Also ⤴️
closed (but #arma3_feedback_tracker 👀 😄)
Hey guys wondering if anyone can point me in the right direction.
I'm making a training playground for my group and it will have multiple areas where we can do different training I.e. halo, firing range, shoothouse etc etc we also want to place a number of live fire mini missions down.
Is there a way to reset the AI that are patrolling and garrisoned at these mini missions so we don't have to restart the mission if others are doing something else? Like an addaction command like start and reset
yes, you could list all the opfor units, grab their classname/direction/position, and on reset, delete all then recreate them
anyone good at fixing a script wouls you lease dm me?
nope to dm support, but you can post your script snippet here or on sqfbin.com
line 16, you didn't remove the last comma
thanks
yes, you could list all the opfor units, grab their classname/direction/position, and on reset, delete all then recreate them
@winter rose
Do you know of any example code
are you asking me to write it? 🙃
// _unitsList; ← define that
private _unitsData = _unitsList apply { [typeOf _x, getDir _x /* or vectorDirAndUp*/, getPosATL _x] };
```example to grab info
wouls you lease dm me
What language is that?! 🙃
UwU
c'm'ooon no bulli
follow up to what Lou wrote:
private _unitsData = _allGroups apply {[units _x apply {[typeOf _x, getDir _x, getPosATL _x]}, side _x]};
{
_x params ["_units", "_side"];
_g = createGroup _side;
{
_x params ["_type", "_dir", "_pos"];
_u = _g createUnit [_type, _pos, [], 0, "NONE"];
_u setPosATL _pos;
_u setDir _dir
} forEach _units;
} forEach _unitsData;
you can include the vehicle of the unit too
whats the least resource intensive way to spawn a ungrouped soldiers? I have a working script using arrays and a temp array for random selection of spawn points, but isn't there another way to do this? the arrays are for variables assigned to game logics.
Is there something on the wiki explaining how to organize my mission scripts into separate files? Currently, I have everything into init.sqf but I want to move all of my scripts into seperate sqf files and "inherit" them from init.sqf instead.
hmm not really
there are
https://community.bistudio.com/wiki/Event_Scripts for the various files,
https://community.bistudio.com/wiki/Arma_3_Functions_Library to define functions
I have been looking at other scripts and they sometimes say to include [] execVM others use [] spawn into the init.sqf to inherit the custom script into the mission. However, I do not know the difference between the two and I am not sure if there are more ways to inherit scripts into the mission.
"inherit" is an improper term for this, but I get the idea.
if the code is to be used only once, you can use execVM (it will load the file from the disk, parse it then use it)
if the code is to be used many times, either make a function or spawn it
So, from my understanding, there is:
execVM for single executions
call <fnc> for multiple executions, though it requires the function to be defined
spawn for multiple executions within its own thread
but then I have seen the #include used as well! What is the point of that argument? 
https://community.bistudio.com/wiki/PreProcessor_Commands#.23include
E.g. defining macros
#define DODIS(VARA,VARB) VARA-VARB
_math = DODIS(2,2); // = 0
very very simple example
nothing!
😄
Okay, I'm still having trouble migrating units to headless clients. I've given up on spawning them with the headless clients, fuck all the remote exec stuff, I'll get to that later, I guess.
There is a group leader with variable name A11AA.
This is in a trigger:
Null = [A11AA, HC1] execvm "Functions\Headless\FN_Migrate.sqf";
This is in the mission file:
If (!isserver) exitwith {};
If (!ismultiplayer) exitwith {};
Waituntil {time > 2};
_unit = _this select 0;
_HC = _this select 1;
If (isnull _HC) exitwith {};
_HCid = owner _HC;
_unitgroup = group _unit;
_unitgroup setgroupowner _HCid;
I launch a dedicated server, I launch a headless client, the HC joins and loads up profile HC1, I join afterward, I fire my script, had some errors, but now now errors, but regardless, the group owner ID is always 0.
That makes sense, but I thought that's who I was asking to set the group owner.
I'll look through my logic. Thanks!
well, it seems correct actually
I never know why scripts work or don't. I just shuffle things around until I get what I want or give up, whichever happens first.
first thing first, why do you think one server won't be enough for your system? HC coding is quite advanced
Nearly eight hundred combat AI, nearly eighty vehicles, nearly seventy players, over thirty control sectors, eight high commanders, civilian traffic and population, etc.
I just want the most seemless experience for what I'm asking Arma to do.
I don't understand why the headless clients have to be so advanced. I wish I could just put them on headless clients and be done, but nothing seems to work, and other people's AI scripts ruin the high command stuff I've got.
let's start from scratch if you don't mind?
so, according to https://community.bistudio.com/wiki/Arma_3_Headless_Client
- did you declare allowed HCs in the server's config
- did you read Monsoon's tutorial? https://www.dropbox.com/s/1n5a8entg3hvj5z/A3_hc_tutorial.pdf
- how do you (want to) spawn your AIs?
I don't mind at all! When someone helps me, I try to give them as much as I can to ease that burden.
I did declare HCs in the server config. They are confirmed as joining the server and loading a profile, so I think that means I did it right.
I did read Monsoon's tutorial, but it's been a while (years ago, for a different project). I actually have it open this morning, though. It may have already been helpful.
I want to have a headless client spawn my AI, if it is practical.
My previous attempt was to define a function and try to have it remoteexec'd by the HC, but it kept firing on server, HC, and me.
how was this function triggered?
Via a trigger in editor, for testing purposes.
if the trigger is global, then… yes
why not use the init_HC.sqf example?
as a starting point
The trigger was editor placed, but server only checked, the trigger activation was;
RemoteExec ["ASG_FNC_GIP1"];
while the function was;
If (isServer or hasInterface) exitWith {};
_RP = (getmarkerpos "Origin");
_Vic1 = "I_E_Truck_02_F" createVehicle _RP;
Sleep 1;
[
_Vic1,
["EAF",1],
true
] call BIS_fnc_initVehicle;
clearItemCargoGlobal _Vic1;
clearMagazineCargoGlobal _Vic1;
clearWeaponCargoGlobal _Vic1;
clearBackpackCargoGlobal _Vic1;
Sleep 1;
_LIS1 = [_RP, INDEPENDENT, [
"B_G_Soldier_SL_F",
"B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
"B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
"B_G_Soldier_TL_F","B_G_Soldier_LAT_F","B_G_Soldier_LAT2_F","B_G_Soldier_lite_F"],
[],[],[],[],[],0] call BIS_fnc_spawnGroup;
_LIS1 setGroupIDGlobal ["A 1 1"]; //Hint groupID group cursorTarget;
_LIS1 addVehicle _Vic1;
{
{
_equip = _x execvm "Functions\Gear\IFGear.sqf";
waituntil {scriptDone _equip};
} foreach units _x;
GM hcsetgroup [_x,""];
} foreach [_LIS1];
I'm about to try to use Monsoon's example right now. It looks like a good start.
yep
what you are doing "hey, everyone on the network! run this"
then filter
you could remoteExec ["theFunction", theHC] to target HC's owner
OH! Beautiful! I'm going to try that right now.
Haha, it looks like the script I was attempting to use this morning (lifted from an old mission of mine, where it DID work) is straight from Monsoon's guide.
Anyone able to answer me, whats best for performance?
- Setting a variable and then making it public.
- Setting a public missionNamespace variable.
Is there even a difference?
It's way out of my depth, but I can say that for whatever reason, I know that the developers in my old community, who were VERY good, tended to use missionNameSpace variables.
So do I, but was looking into if its worth changing older scripts where it might be used to missionNamespace.
@winter rose, when using a trigger with
RemoteExec ["ASG_FNC_LIS", HC1];
to execute
If (isServer or hasInterface) exitWith {}; //Dediclient
_RP = (getmarkerpos "Origin");
_Vic1 = "I_E_Truck_02_F" createVehicle _RP;
Sleep 1;
[
_Vic1,
["EAF",1],
true
] call BIS_fnc_initVehicle;
clearItemCargoGlobal _Vic1;
clearMagazineCargoGlobal _Vic1;
clearWeaponCargoGlobal _Vic1;
clearBackpackCargoGlobal _Vic1;
Sleep 1;
_LIS1 = [_RP, INDEPENDENT, [
"B_G_Soldier_SL_F",
"B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
"B_G_Soldier_TL_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_AR_F",
"B_G_Soldier_TL_F","B_G_Soldier_LAT_F","B_G_Soldier_LAT2_F","B_G_Soldier_lite_F"],
[],[],[],[],[],0] call BIS_fnc_spawnGroup;
_LIS1 setGroupIDGlobal ["A 1 1"]; //Hint groupID group cursorTarget;
_LIS1 addVehicle _Vic1;
{
{
_equip = _x execvm "Functions\Gear\IFGear.sqf";
waituntil {scriptDone _equip};
} foreach units _x;
GM hcsetgroup [_x,""];
} foreach [_LIS1];
It's still running three times. What's more surprising is that ever single one of them is owned by the server, not one by the HC.
@timid niche, radical. I doubt it would be worth it, unless it's a major savings for relatively little work. Even if it IS faster, you'd have to have so many to change to make it noticeable, I'd think.
@timid niche not worth changing, just best practice from now on yes
@shadow sapphire I simply believe there is another issue, other than that.
maybe your script gets called at other places
start from scratch an empty mission, just place the very basics, and practice
Will do.
Hi,
I need some help with the dynamic group code, I would like to have people automatically be a part of a dynamic group when they join with a specific insignia.
I understand the private _data stuff being the image, name and weather it should be private or not, but what do I change so that when those people join the groups will be created?
if (isServer) then
{
private _group = group player;
private _leader = leader _group;
private _data = [nil, "Awesome Group", false]; // [<Insignia>, <Group Name>, <Private>]
["RegisterGroup", [_group, _leader, _data]] call BIS_fnc_dynamicGroups;
};
note: I only need the leaders of the groups to be automatically added, the rest can just do it manually.
I've read your question 5 times over and it makes no sense to me. Can you explain what you want in more detail?
I want the server to automatically create a specific group when a specific player joins with a specific insignia.
Can you server side push an addaction to a vehicle?
@winter rose, I built a new mission from scratch. The remotely executed script is still running multiple times.
yes, remote exec
What do I change within that example that the wiki has, so that I can make that so?
I want the server to automatically create a specific group when a specific player joins with a specific insignia.
Not that part. These parts:
what do I change so that when those people join the groups will be created?
note: I only need the leaders of the groups to be automatically added, the rest can just do it manually.
The code I posted is the example that the wiki has, within it is private _group = group player; and private _leader = leader _group; I understand that I have to change something about those but I have no clue as to what I would need to change, what is group, what is player, and what is leader?
I understand that I have to change something about those but I have no clue as to what I would need to change,
What you ask has nothing to do with that code.
@shadow sapphire what is your code?
Then what code would I need, because that seemed to be the one I needed
@winter rose I simplified it quite a bit. May I send you the whole (small) mission file?
negative, on mobile rn ^^
Hokay. Wait one.
_RP = (getmarkerpos "Origin");
_LIS1 = [
_RP, INDEPENDENT,[
"B_G_Soldier_F"
],
[],[],[],[],[],0
] call BIS_FNC_SpawnGroup;
Had to start Arma again. I was about to hang it up for the day.
ah well, maybe you want to rest? it's no good working on something "hot brained"
This is the entire setup:
Scenario Setup:
Editor:
Trigger.
Radio Alpha.
RemoteExec ["ASG_FNC_LIS", HC1];
HeadlessClient (HC1)
Rifleman (Player)
Marker (Origin)
Scenario Folder:
Mission.sqm
Description.ext
EnableDebugConsole = 2;
SkipLobby = 1;
Class CfgFunctions {
#include “Functions\CfgFunctions.hpp”
};
class CfgRemoteExec {
class Functions {
class ASG_FNC_LIS {
allowedTargets = 0;
jip = 0;
};
};
};
Functions Folder
Headless Folder
FN_LIS.sqf
_RP = (getMarkerPos “Origin”);
_LIS1 = [_RP, INDEPENDENT, [
"B_G_Soldier_SL_F"],
[],[],[],[],[],0] call BIS_fnc_spawnGroup;
CfgFunctions.hpp
class ASG
{
tag = "ASG";
class Headless
{
file = "Functions\Headless";
class LIS {};
};
};
I think.
If you have input, I can just put that to use tomorrow. If you don't feel like it, it's all good.
I do need to step away, though.
Roger that
If you want, please dm me the zip so I can check that tomorrow
Thanks so much!
Does anyone happen to know if you can pull text from a hint, or if there is an IDC for it?
hmm yes, see findDisplay's page maybe, there should be a list @dusk gust
I did a loop looking through all displays and all controls to each display while a hint was active and it still doesn't grab text. I found some supposed IDC's for the hints, but they always return "" even if I hint something specific.
Was curious if there was a special way to do it
not that I specifically know - but if I may ask, why?
personally, ive never seen anything for getting text from a hint
Just to detect some things
assumed it was on the same level as chat (until the handlechatmessage event) where you cant access it after it is sent
That sounds about right
https://community.bistudio.com/wiki/Arma_3_IDD_List idd hint 301
Thank you
now, to see if it works…
well the hint is not a display so findDisplay wont work
findControl on 46 then?
**cough** https://feedback.bistudio.com/T153878 **cough**
oooh, a ticket I can forcefully close 😋
Lmao
damn the hint display is part of RscInGameUI which is a very mysterious config
sadly it does not set a variable to the uiNamespace
hrngh i am trying to copy the config but it won't let me send
What's the path to it?
P:\a3\ui_f\config.cpp if you have the data unpacked
That'll work, thank you :)
config: configFile >> "RscIngameUI" >> "RscHint"
https://sqfbin.com/ijeyixihecuxazimevex here it is anyway. i wont let myself get beaten by some bot
**cough** https://feedback.bistudio.com/T153878 **cough**
**cough** **cough** **cough** **cough**
thats a nasty cough
if you want soldiers,
createUnit
if you want agents,createAgent
?
@winter rose ```sqf
private["_arr","_randomElement","_tempArray"]; // private var
_arr = [g1_0,g1_1,g1_2,g1_3]; //virual entities used as place holders
_tempArray = [] + _arr;
for "_i" from 1 to 2 step 1 do // 1 to what ever number of soldiers you want to spawn provided it be smaller than the _arr size (number of elements , in this case 4 elements)
{
_group = createGroup east; //set group side
_randomElement = selectRandom
_tempArray ;
_tempArray set [_tempArray find
_randomElement ,objNull];
_tempArray = _tempArray - [objNull];
_unit = _group createUnit
["CUP_O_TK_INS_Soldier", _randomElement
, [], 0, "FORM"];
// in the " " the name of the unit is given (the coding name , hover over a unit in 3den editor and the name under the display name is what you use)
};```
I have this , was just wondering if there was a better way to go about spawning soldiers in random defined places
scramble your array with BIS_fnc_arrayShuffle, then pick one then the other element
no need to selectRandom/find/replace/remove at all
How could one use a custom .paa image on drawIcon for a mission?
with getMissionPath to get the full path to the image
(assuming the image is in the mission file)
Understood, will return with results.
I want to add an array of items to a container, could be 1-100000, and I want to check if all of those items can fit in the container, and only if everything can fit will they be put into the container. Problem is im not sure how I can do that because canAdd checks one item at a time and wont account for things that were previously checked but arent yet in the container.
You can get the mass value of each item and compare the sum with the container size
ah multiple item types. hm.
Ah is that how storage is calculated for cargo? mass?
Yes, at least that seems to work for me
Awesome, i'll give it a shot. Thanks
I wish it was possible to use a rest api instead of the extdb3 system 😄
You could use something like the URL fetch extension, dunno how it handle json and whatnot but that can be a good start
Yep I could, something native would be awesome tho
Guys, ist there a way to manually change the Command Bar Health Condition of a unit? I am referring to
https://community.bistudio.com/wiki/Arma_3_Field_Manual_-_Commanding
and the point 'Health Condition'
I mean, how can I change the color? From red to the default white for example
I'm getting an error when using the Clear mines way point, I have mines set on the ground through a module and the mines are OPFOR mines, they will approach the way point, and the error will pop up telling me something is wrong on line 37 of the https://community.bistudio.com/wiki/BIS_fnc_wpDemine script. I have explosive specialists, and engineers in the squad, as they approach they are mounted (They are a QRF), and I want them to approach (obviously the crew spots the mines from the APC) and disarm the mines, mind they may be ambushed part way through.
Since Im heading to bed if someone can answer this, please pm me the answer, so far this is the only issue I've run into in setting up what I've got so far.
trying to parse URLs in SQF
but struggling with cases where legal domain suffixes are part of the name itself. ie
- XXX**.irXXX.ir**
- XXX**.comXXX.com**
with splitString [:./] i have the issue of:
- two part suffix .co.uk
- to detect the right part of the splitString array return i can think of only a domain suffix check again (aka infinite recursion)
first split with / , then split with .
- starts with http:// or https://
- remove first x characters (7 or 8)
- split with /
- first element: split the .
@velvet merlin ↑ ?
https://www.mywebsite.co.uk/all/the/rest?of=Url#path
you have
http
https
without either
subdomain.XXX
so to handle the standard case is simple, yet my system should handle all valid cases 😐
well, technically, in a web.co.uk , co is the domain's name
you have to make one exception about the UK, that's it
if (website == "co") then { website = lastSubdomain };
You could just strip all the symbols and read the words.
I'm not sure what you are trying to do, so maybe my answer is irrelevant
parsing server names for website, discord, ts, etc
so gotta deal with very diverse definition types 🙂
1/ if http or https, remove that
2/ split on /
3/ split on . the first element
4.1/ 1 element: take that one
4.2/ 2 elements: take these ones
4.3/ 3+ elements: take the last two
4.3.1/ if last two are co uk, take the one before
5/ parse the parts after the first /
this should cover all the cases @velvet merlin
also note that websites can have the same name but different extensions, so the only good identifier is name+extension (e.g whitehouse.gov vs whitehouse.com… for those who knew)
1/ if http or https, remove that
2/ split on /
well:
_dirs = _string splitString "/";
if (toLower(_dirs#0) in ["https:", "http:", "ftp:"]) then {_dirs deleteAt 0};
_dirs joinString "/"
there might be special cases too:
- ports (http://google.com:8080/)
- IPs (http://127.0.0.1/)
@velvet merlin u good? 🙂
(and if there are ftp, there might also be users in the URL - e.g ftp://Lou@domain.com/ 😄)
I was the one who reacted! 😜
I saw that, don't worry 😁 but he might be already running away, idk
4.1/ 1 element: take that one
what should this reflect - can there be a domain without a dot?
need to leave for lunch, but i think yours dont cover these properly yet, do they?
XX.CO
TS.XX.CO
XX.CO.UK
TS.XX.CO.UK
Isn't it possible to go in reverse:
_domains = ["co", "com",...,"us","uk",...];
_mainSite = _reveredSplit findIf {!(_x in _domains)};
4.1/ https://localhost/ 😬 that's the only one I can think of.
mine covers all of these - it will just take the XX.co or XX.co.uk, nothing before the domain's name like ts or www
4.3.1/ if last two are co uk, take the one before
the only case where you want an exception I believe
current combo prefixes:
".co.uk", ".co.za", ".com.au",
for the reverse i would need to know the end of the (main) domain - can be done with splitString "/"
so far, you're good then?
inb4 IPv4 and IPv6 support 🤣
like; I can think of a bunch of other cases which are a pain to get...
- different protocols (basically anything between 3 and 9 characters)
- username@password
- IP address (v4 and v6)
- port
Even with regexes it's almost impossible to get all cases, and even there I have never seen a proper separation of subdomain/domain/tld because it's impossible...
quick poll. Who does search in big strings.
like find/in on big strings, and what do you do that for?
How big is the string you are searching for usually?
regex support? 
I do a fair amount of searching in my function viewer for syntax highlighting. Usually only searching for a couple of chars or so to start/end a segment. I made it use an extension implementation by default because its faster though.
Also do a lot of string manipulation in my chat mod where the biggest searches are possibly 20/30 chars, maybe. I split messages into smaller segments though so maybe not what you’re asking for 🤷
@cosmic lichen ↑ tool makers are most welcome to say something I believe! 🙂
In my functions viewer I have an option to search for specific key words. String size can vary from very short to long (See BIS_fnc_arsenal code)
regex unlikely. I looked into that already
@robust hollow what does your extension use for string searching?
Yeah R3vo that would probably a case that would benefit alot.
I implemented Boyer-Moore-Horspool (yes... Arma didn't have it yet...) and thinking if I should use it in SQF string searching
a lot of indexof iirc. it is a direct port of the sqf so there is nothing fancy going on.
indexof or find() ? c++ std::string has no indexof 🙃
C# IndexOf, Contains and Substring. i really dont have any idea what im doing outside of sqf so its just whatever comes with .net 4.5.2
Parallel.forEach
@still forum I also do a lot of search for syntax highlighting in my mod.
And there's also a different type of search I use a lot (if you're interested in that too):
https://feedback.bistudio.com/T154274
basically "findAny" isnt it?
yeah
thats a pretty specific usecase thing, not sure about that, we'll see i put it on my list
spawnForEach @winter rose is probably what you mean 🤪
{
systemChat format ["this %1 idea serves no purpose but to clutter the scheduler", _x];
} spawnForEach ["fancy", "stupid", "ideas"]```
this ideas idea? 😁
yes
@tribal flower that's not #arma3_scripting, and that's not Arma 3
DayZ (SA) has its own Discord server, if you want
does createGroup creates the group on the machine that called it, or only the server?
@winter rose, how can I get a string to output as a number?
_HC = netID HC1;
_LIS1 setGroupOwner _HC;
Error type string, expected number.
@winter rose Solved the problem, thanks
@shadow sapphire netId is not the command to use
owner is
Oh? HC1 owns itself? I guess that makes sense! Didn't think of it that way.
well, yes
it's a "player" slot, and a player is local to its machine
_LIS1 setGroupOwner owner _HC;
Ah, makes sense. Well. Owner is still 0. I thought 0 was server, but the wiki says 0 is everyone. Am I understanding that appropriately?
yes
in single player, it is always 0
Ayo
Hmm... Well, I'm not in single player. But the server, my headless, and my actual client are all on the same machine.
Guess I need to upload the mission for testing. What a bother!!
Oh god such a bother yes
some1 want to help me on scripting? am in kinda learning fase. (early one) if someone care to PM me if wish to learn me, please be my guest. Right now I am doing it on BI Forums but maybe being on discord could give me answer's a bit faster.. 🙂
What do you need done? I don't know of a better way than to generically learn scripting other than just copy tutorials on YouTube, but if you have a specific task, then you can get a more focused approach.
@shadow sapphire I have a mission to finish that prob. will take me ages since I am not really good at scripting at all. (this mission is gona be mostly done by scripts) So what I kinda need help on would be when to use what and maybe something what to do this guide.
But I want to learn scripting so I beleave I will succeed at the end. (hopfully) 🙂
Those guides are all on the wiki. As far as I know, learning to script is literally just learning to use the community wiki. The better you are at the wiki, the better you'll be at scripting. Even syntax, if it's not clicking, spend more time on the wiki, or look up a general programming tutorial.
thats the thing. I am kinda past this point.
I have just learned to use the wiki. 🙂
If you know how to use the wiki, and if you understand syntax, the next step is just specific questions, as far as I know.
But for now I am trying to get the understandings of it. Cuz as far I have read there by now. It is not much telling me why use that or when use it.
may be syntax I am still trying to learn maybe.
Sounds like syntax, yeah.
see https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting for starters, and the links in it 😉
SQF syntax wiki I found. Got right to the place I needed to be. Thank you! 😄
now a year more and I might complete the mission. 🥳
What is your mission concept?
Radical stuff.
prob. the hardest mission for a guy that barley know it. 😛
I've been there. Was honestly very close, due mostly to the work of others better than me, but feature creep and perfectionism eventually got over on us.
you mean that you couldnt deal with it anymore? was to much? (I am not english so just trying to understand correctly. 🙂 )
Not exactly that we couldn't deal with it anymore, but just got busy with life, and were no longer as interested.
xD... okay... well thats what I could be afraid for. But I beleave with effort I do wish to complete this I may succeed since I am a no-lifer (for now ofc.) have 1 week every 3 weeks with hollyday so I thought I could give it a shoot.
That's great! Good luck!
I just hope I will complete it before (if it comes) Arma 4. 😛
Roger that!
simple question. (I could only find a ESC script on Armaholic for this. But wonder if there is a easier way to this.
Make a trigger (var name: sec1) to be a sector. without the sector module synced to it. just by scripting.
I actually have a very similar question, so if someone has the answer, it'd be helping me as well.
answer: yes
you can script everything, even without a trigger
just that… well, it's not using modules
What would be the advantage of the module over a scripted one, other than work?
I have heard that with more modules in a mission the more fps drop or more on the mission engine is being used. as for scripted one the less? (this might be since modules are in the mission.sqf . And that bigger the mission.sqf file gets. the more engine needs to focus on it and for that it gets slower maybe?. But more .sqf files the better is running. ? I might be way out of my league here. just a thought.
I have personally noticed that at least sector modules do SEEM to negatively impact the server, but I can't say for sure.
My goal for the scripted sectors is more about getting less HUD on the screen and so forth. I don't like lots of magic mission markers in my elite operator games, haha.
I have personally noticed that at least sector modules do SEEM to negatively impact the server, but I can't say for sure.
@shadow sapphire
This is why I want to learn scripting. because I do know how to use the modules... and one mission I made it was much fps drop on it and the other mission edit guys sayd that I had too much for the mission. We throw in HC as-well since they said HC help the server to run more smoothly. dont know if this is true doe.
Headless clients are very good at improving performance, but they are also pretty tough.
What would be the advantage of the module over a scripted one, other than work?
the principle of modules is to have easy-to-use systems; but everything behind is scripting
so scripting is more flexible, while modules are easy to use
module is in mission.sqm but executes a module function that runs sqf like a file would. One advantage is that it has a different initialization order and you can set the priority
modules would be powerful if people made 3den controls for them and implemented them better, that's what I tried to do with my mod but making a whole integration with these modules is difficult. Most of the modules are ad hoc and lots of mod modules are simply ways to activate functions that could otherwise be activated via a cba setting
Modules are meant more for designers than for scripters. Also with module you get a free transform (position, scale, rotation) and a free logic object.
is there a way to detect via sqf if a textureSource has been applied from VirtualGarage when spawning the vehicle? In Unsung we have these random texture selections scripts and now I would like to add some vehicle textures via virtual garage. But they fight each other. I guess only different subclasses are a way out, or is there some sqf magic to detect if a textureSource has been used?
self answer: getObjectTextures may help (https://community.bistudio.com/wiki/getObjectTextures)
Question; I'm currently working with extDB3 to retrieve data from a database, but for some reason I get empty results.
_return = [];
_check = 1;
_query = "extDB3" callExtension format["0:FETCHDATA:SELECT col1, col2, col3 FROM table WHERE 1 = %1", _check];
_result = parseSimpleArray (_query);
if (_result select 0 == 1) then {
_return = _result select 1;
};
_return // should contain [val1, val2, val3]
The query is correct and gives the correct data when running directly on the DB, but the above script only returns an empty array.
Is there something weird happening with parseSimpleArray, or is there some setting I need to set to make this work?
what does the return set to _query look like?
Unfortunately do I not have access to the server to test that :/
Although we use the same query in some old code which uses ```sqf
_query = "extDB3" callExtension format["0:FETCHDATA:SELECT col1, col2, col3 FROM table WHERE 1 = %1", _check];
_result = _query splitString "[,]";
_value1 = call compile (_result select 1);
But for obvious reasons I try to make the code a bit more cleaner than this...
as far as I can tell is the result from the DB correct, but seems to break when parsing it
ehh, without the return it is hard to say for sure.
trust me I know, but since both scripts use the same DB and query, and one returns a value and the other not; the only difference is how to parse the result.
Which is my question about, unless there is some setting I need to set in the extDB3 settings to make it work correctly (although since there are no errors I doubt anything is technically wrong)
nah you should be able to make it work without changing any settings. what data type is _value1 in the second snippet?
a string
integers are being used directly without call compile
scratch that, the code also does that for all other return values
all values from the database (MariaDB) are either strings or integers, and all currently all handled the same way.
The only thing I can image is that the extension is not properly putting double quotes around the strings, which than break parseSimpleArray. Which I can't test on the server, but will need to test on my local server.
yea, without the query return i can only theorize possible solutions. how are you able to test it if you don't have access to the server?
Have the server admin setup the server with my mod, start the server, get in the server, test if it works, make changes, pack and upload to the workshop, and repeat...
although for testing the rest of the features I simply made a simple if/else statement which checks if the DB exists, and if not, use dummy data
using a simple attach smoke to a plane but I need it to respawn or repeat any help appreciated
_smoke1 = "SmokeShellOrange" createVehicle position Orange; _smoke1 attachTo [Orange, [0, -2, .1] ];
a smoke lifetime is 30s
yeah it runs out but I need the smoke endless
So, google gives me a dozen different answers, and they all seem to be wrong.
this switchAction "HandSignalRadio"; and this switchAction "Salute"; come up as answers when I look for ways to put two AI into permanent animations via their init, but it doesn't work. I've also tried playAction with no results. What should I be using to force these guys into the respective animations and stay there?
What's your goal?
Want an AI to stand there and salute, and another to stand there on the radio. Permanently. I'm just decorating a base.
BIS_fnc_ambientAnim works, but doesn't include either of those animations.
@vernal venture unitplay/unitcapture?
Then switchAction is not a thing for you. switchMove is, and look for your moves in the article: https://community.bistudio.com/wiki/Arma_3_Moves
BIS_fnc_UnitPlay/BIS_fnc_UnitCapture don't do anything with it
he could record himself saluting/standing whatever for 20 min and repeat the play action, no?
im still learning so ignore me as needed, just chiming in
He technically could, but what about radio? Player can't do
[this, "Acts_Kore_TalkingOverRadio_actions"] remoteExec ["switchMove", 0]; doesn't work, nor does
this switchMove"Acts_Kore_TalkingOverRadio_actions";
Any ideas?
Put a small suspension there IIRCsqf this spawn {sleep 0.01; _this switchMove brabra};or something like that
That works for the salute. Not for the radio, which means I probably have to go down the list and try all the radio looking ones on that page.
Thanks for the assist.
keep me posted if anyone can help a noob make a smoke grenade smoke continuously/or repeatedly, thanks
_smoke1 = "SmokeShellOrange" createVehicle position Orange; _smoke1 attachTo [Orange, [0, -2, .1] ];
is what I have attached to a vehicle (named Orange)
I only know of test_emptyObjectForSmoke which can be attached to an object to have infinite smoke.
Or replace the grenade before it runs out of juice (timings can be found in configs)
Thanks for the reply Grez... time for me to learn how to change config settings I guess
I have the smoke create/attach in an sqf ... if I add more smokes with a 30sec delay then 60 then 90 etc wouldn't that work? also how do I write that?
I’m trying to make a script for just an initial, basically the ai disables PATH, waits 15 seconds and then renables PATH but uh I just get error codes cause I have no idea what I’m doing
Dedmen if you are still taking script suggestions you should add in += -= *= /= syntax, it's small but would be nice 😛
And else if would be nice to have too
He said elseif won't happen at this stage
@inland valve You don't want to change the smoke config, you could do something like this (the next smoke wait until the old one epires):
spawn {
while {true} do {
_smoke1 = "SmokeShellOrange" createVehicle position Orange;
_smoke1 attachTo [Orange, [0, -2, .1] ];
waitUntil {isNull _smoke1};
};
};
or continuous smoke...
spawn {
while {true} do {
_smoke1 = "SmokeShellOrange" createVehicle position Orange;
_smoke1 attachTo [Orange, [0, -2, .1] ];
sleep 30; //adjust it, depends on the smoke duration
};
};
while { }* but yes
these damn other languages, they make you make mistakes in SQF — why can't they comply!! 😋
lol! thanks! damn other languages or damn sqf?
Following code snippet counts default magazines and default rounds of a mk6 mortar.
private _weapArray = [];
{
private _cfgTurret = _x;
{
_weapArray pushBack [getArray (_cfgTurret >> "magazines")]
} forEach (getArray (_cfgTurret >> "weapons"));
} forEach ([_mortarMK6] call BIS_fnc_getTurrets);
_weapArray = _weapArray select 1 select 0;
private _defaultHEmags = {_x == "8Rnd_82mm_Mo_shells"} count _weapArray;
private _defaultIllumMags = {_x == "8Rnd_82mm_Mo_Flare_white"} count _weapArray;
private _defaultSmokeMags = {_x == "8Rnd_82mm_Mo_Smoke_white"} count _weapArray;
private _defaultHEammo = _defaultHEmags * 8;
private _defaultIllumAmmo = _defaultIllumMags * 8;
private _defaultSmokeAmmo = _defaultSmokeMags * 8;
Works well, except one thing bothering me. I am not able to obtain the default number of rounds of one magazine. I have to place an '8' for calculation. I would rather have a more elegant solution. Anyone?
Have you check the config entries of those magazines? They should have the default count.
@cosmic lichen can you point me to a command on how to read out those values?
configFile >> "CfgMagazines" >> "11Rnd_45ACP_Mag" >> "count"
getNumber might be your friend
config related commands
perfect. Many thanks.
Is there a way to make an event handler occur when respawning, ideally global argument/effect.
yes, see the EHs page on the wiki
there are unit EHs, or mission EHs
Ahh EntityRespawned, thanks! Didn't see the mission EHs!
Ah, Mission EHs are local effect only, similar to the onPlayerRespawn.sqf or Respawn Event handler that are local effect only.
Not sure if you know of any others, or a link to a way to create an event handler?
you can make the EH happen on the server only, but broadcast its effects through remoteExec 🙂
Ooh cheers!
I tried getting the player Insignia to load via respawn/onPlayerRespawn but didn't work.
Works via close inventory. I'll try the remoteExec approach
And else if would be nice to have too
you should add in += -= *= /= syntax
I'd much rather have a command that can do something new than a new way of doing something that's already possible.
Hi , one question . How would it be so that when it is 20:00 on Arma 3 a script is executed?
https://community.bistudio.com/wiki/date @candid cape
See
if (date select 3 >= 19) then { // 7pm
hintSilent "ah, Arma sunset"; {{|...cue bad guys}}
};
But yeah need a loop
have a loop which runs every n seconds/minutes, check the current time and if time is correct, run script
waitUntil { sleep 1; date select 3 > 19 } yep
maybe gathering info from a church ringing its bell is a teeeny tiny bit too far-fetched 🤣
so how would that work in the middle east? 😉
what the other guys said is kind of correct, but if you want it to be exactly at 20:00
date select [3,2] isEqualTo [20,0]
is what you want
floor daytime == 20 is easier
while {true} do {
sleep 1;
if (date select 3 >= 19) then { // 7pm
hintSilent "ah, Arma sunset"; {{|...cue bad guys}};
};
};
?
you might want to break the loop after that (and you didn't say if you want it to be exactly at 20:00 or not)
Yes, but I have copied the example that they told me before xd
what that loop does is trigger every second after 7pm
It was an example. Don't take it too literally
Basically, what I want to do, is that every time it is 20:00 a script is executed
Exactly 20:00?
yep
then use what I said:
while {true} do {
if (date select [3,2] isEqualTo [20,0]) then { //20:00 sharp
hintSilent "ah, Arma sunset"; {{|...cue bad guys}};
sleep (23.9*60*60); //sleep 23.9 hours! :D
} else {
sleep 1;
};
};
Not sure about the sleep value...
It also depends on time simulation in the game (how fast time passes)
You can just use a sleep value of 1, and use a condition to avoid running the code multiple times during that 1 minute
it's safer this way than sleep 59
@compact maple Thank you!
What’s the best way just to add a delay between 2 lines of script
this disableAI "PATH";
((Need Some Sort of Delay Here))
this enabaleAI "PATH";
@inland valve de nada! dont hesitate if you need anything else
@fierce drift sleep
I see, so I could just implement it like
sleep 15;
in between those 2, Im completely new to arma scripting
Yes, but only if you're doing this in an external sqf script. I suspect you're trying to do it in a unit's editor init field, which won't work.
Yeah I'm trying to do it in init
You will need to write your script in a separate sqf file, then use something like remoteExec or execVM to run it
Hm ok then so I'd have to execute the sqf from the init field?
hold on a sec, I'll write something
// unit init field
if isServer then {[[this],"yourScript.sqf"] remoteExec ["execVM",this]};
// yourScript.sqf
params ["_unit"];
_unit disableAI "PATH";
sleep 15;
_unit enableAI "PATH";
if you have a list of units you want to do this for (for example, every unit has a variable name, or they're all in specific groups) there are also ways to optimise it so you don't have to use the init field at all
i see thanks for showing me this
yep, init field should ideally not be used, most of the time
spawn?
as it is run for each and every client, in the case of an MP mission
as it is run for each and every client, in the case of an MP mission
can be avoided using a variable
@little raptor what do you mean, isServer/local?
that too, but:
if (missionNamespace getVariable ["codeExecuted", false]) exitWith {};
missionNamespace setVariable ["codeExecuted", true,true];
this spawn {
_this disableAI "PATH";
sleep 15;
_this enableAI "PATH";
};
huuuh… no
Not saying it's a good thing to do, but possible
please no 😂
alternate implementation for initServer.sqf
// Use if every unit has a specific variable name (remove if second applies)
_unitsArray = [unit1,unit2,unit3];
// Use to apply to entire groups (remove if first applies)
_unitsArray = (units group1) + (unitsGroup2);
{[_x,"PATH"] remoteExec ["disableAI",_x]} forEach _unitsArray;
sleep 15;
{[_x,"PATH"] remoteExec ["enableAI",_x]} forEach _unitsArray;```
please no 😂
just saying this can be avoided like that, but it's not an ideal solution
as it is run for each and every client, in the case of an MP mission
yeah, but by the time it synchronises on the network, did some non-JIP players run it too
evening fellas.... group question... moving AI to another group if an AI is a member of an existing group, do I have to have him join grpNull before joining him to the new group?
No
k, thanks
do I have to have him join grpNull
if you did that, the engine would create a new group for that unit (because it can't not have a group)
yes, good point
join grpNull makes him leave current group, according to biki
but as yoiu say, he must be in a group
join grpNull makes him leave current group, according to biki
Yes, and it joins a new group created automatically
right, good, thanks
BIKI down? cant enter.
this website is not available it says xD
Might it be due to me having prob. 20 sites open at once on B.forums? xD
yep, wiki up
I ment the forums sorry
ah, yep
Might I be banned for 10 min or something since I was on with so many pages? + maybe refreshed them at same time?
no, confirmed on my side
?? that I am not banned for 10 min?
you cannot be banned from the forums for just browsing it
tells me ottherwise
I was posting a PM to a person who helping me and. it ended up saving for some mins and than this camed up
I am telling you the forums are down for everyone, not just you
no, confirmed on my side
@winter rose you ment the forum was down here?
yep, it's down
Well dang it. wrote like 1000 words maybe more and now all is gone... And I dont recall what I wrote. so ty allot Bohemia 😫
if I do a addRemainsToCollector on an alive unit, will the garbage collector run on that unit or does it have to be dead
it adds to the list of managed objects yes - it will not delete it while alive ^^
How do I make this work?
BA42 select 11 moveInGunner BA42MB;
BA42 is a group, BA42MB is a mortar.
And what is the 11th item the BA42 group?
like that… with units in front of BA42
B_G_Soldier_F
also, better naming plz
Better naming?
by reading, you cannot understand what are BA42 / BA42MB
It's a unit designation. Blufor Alpha company fourth platoon, second squad. MB is mortar bravo.
IDK how else to do it.
Just for clarification, there is no caching for the config commands right?
so making a caching system for the purposes of repeatedly getting config info would make sense, right?
What was the max length for integers again, before they transform to that 1.fersgubnfsigdfignx01#lol stuff?
I am having ~2.3mill in my head, but not sure atm 🤔
@jade abyss The largest positive number that can be archived is 3.4028235e38 and the largest negative is -3.4028235e38.
@jade abyss From https://community.bistudio.com/wiki/Number
max length for integers again
In Arma numbers are always floats.
Anyway: https://en.wikipedia.org/wiki/2,147,483,647
nvm, i was looking for that 1e+006 stuff. All fine 👍
Since BI forums are down, I give Discord a try. I got a simple question that I need to be certan too.
In init.sqf I got this:
['Flag1', 'Flag2', 'Flag3', 'Sector1'] execVM "xxx\init_xxx.sqf";
than in init_xxx.sqf; we have
[] call _initclients; // this means _initclients; gona run all thats in [] from init.sqf right?
@hollow fable not necessarily, if you do [this] it'll pass those arguments from init through. this will contain an array of arguments passed through to the current script. That said if you with to have them passed as separate arguments, same as they were called in init, you will need to swite them like[this select 0, this select 1, ... and so on for all the ones you want to pass through.
but in this case its correct?
additional note for alternative syntax: https://community.bistudio.com/wiki/params
in the written case nothing will be passed to _initclients
as [] means no arguments
I assume you have _initclients declared at least as well?
in the written case nothing will be passed to _initclients
@potent depot
sorry next time I fill it all :
_initclients = compile preprocessFile "xxx\init_clients.sqf";
now correct ^^^^ this in the init_xxx.sqf
ofc
ofc
@potent depot
ok thank you 🙂
keep in mind if it confuses you, why not just test it with dummy values?
its simple once you get the feel for it but you just gotta try it
cuz I am not in arma nor do I have this in any mission folder.. I am just recalling stuff and tryin to understand. get answer here is faster. Since I am now on BI Wiki to studdy more 🙂
fair enough, its something youll get a feel for once you try it
itll make more sense then
btw. I found something in BI wiki that I think may be wrong in the line here:
Associativity is (then) done from left to right (e.g 3 + 5 + 8 will be processed as ((3 + 5) + 8))
Should it not be one more "(" in the last here? I count 3 ")" and only 2 "(" there.
yeah extra ) on the right side
that said I think thats the closing for the whole excerpt
(e.g being the opening
not a syntax thing
true I see it now. lol thanks.
to late to studdy or reading stuff maybe at 05:20 in the morning. xD
can someone help me with a small amount of scripting in a campaign im making for some friends?
I want to set up a form of "multiplayer checkpoints" for me and a few friends in a relatively linear campaign im making. I wish I could say it was for a clan of 30+ players, but there is only 4 of us, and we are all kind of bad.
so as a result I decided to try and set up a checkpoint system to respawn dead players, heal living ones and save the game in case we get wiped. I set up a trigger waypoint to activate when a player enters the designated area (all set up in areas that we have to enter to progress) with saveGame; and allPlayers setDamage 0; set for activation, but I cant seem to find a way to respawn dead players, any help would be appreciated!
Is there any way to add custom colors to assignTeam?
anyone have their VSC automatically parse their code for errors? I downloaded a few extensions but I can't seem to get it to work
depends on what kinds of errors
such stuff can barely parse run-time errors (wrong argument type and such)
I use SQF VM to parse syntax errors
like I have SQF Language and SQFLint right now. I can't remember what I had on my desktop (it got borked) but it used to highlight undefined variables, missing brackets etc.
let me try out sqf vm
use the task to compile file with sqf-vm
it might fail to do so because I didn't implement some proper path resolution somewhere, but should work on simpler files
also X39 is making a proper language-server implementation for his SQFVM which should replace that
one of these extensions used to find the errors as you typed them
@wild prairie negative
found the parser sqf-vm.sqf-vm-language-server
Shame. Thanks.
@woeful mantle You can't save in MP.
You can find information on the respawn system around here: https://community.bistudio.com/wiki/Arma_3_Respawn.
mp saving is not really implemented for this game even for official missions
I guess you need to enable respawn as said above, then when these triggers are triggered, you can create a marker like respawn_west
I named an AI unit Bob. He shall take the nearest position of the nearest building of the player:
_nearestBuilding = nearestBuilding player;
_allpositions = _nearestBuilding buildingPos -1;
_allpositions = _allpositions apply {[_x distance player, _x]};
_allpositions sort true;
Bob doMove (_allpositions select 0 select 1);
Problem: Bob walks through doors. I want him to open, and, if possible, to close the doors he passes. Is this possible somehow without a trigger on each door?
btw. I found something in BI wiki that I think may be wrong in the line here:
Associativity is (then) done from left to right (e.g 3 + 5 + 8 will be processed as ((3 + 5) + 8))
Should it not be one more "(" in the last here? I count 3 ")" and only 2 "(" there.
@hollow fable still confusing. I adjusted it and removed the outer brackets
if I had an array such as:
_array = [[apple,pear,orange],[peanut,almond]]
how would I go about deleting the inner arrays and making it one combined array?
@jade abyss depends on what "toFixed" is set to, you can just outright disable it if you want
The largest representable integer is 16,777,216
simple question.
isPlayer are for dedicated server or local hosted server as-well?
both
corpseLimit (<=) 10; //does not work. have allso tried
corpseLimit (<= 10); // what I done wrong?
not sure I understood you if u meant what file (Description.ext) I have it in. or
if I have added something more to it than this. I just look at BI-wiki :
corpseLimit = 1; // Default: 15 works allso with (<=) it says.
no, it doesn't work that way - use only = in description.ext
the <= states about "before or equal to corpseRemovalMaxTime" only 😉
@astral dawn while that is correct, it is kinda on halt right now due to University stuff
@queen cargo waiting eagerly 🙂
i accept volunteer developers btw 🤫
I'd be well out of my depth unless you need a bunch of mismatch brackets and missing semi colons
I'll defer to someone better qualfied 🙂
hehe
how come I still respawn on my death position when using this:
mobileRespawnDE setVehicleLock "LOCKED";
[west, mobileRespawnDE] call BIS_fnc_addRespawnPosition;
respawn is set to custom position in MP options
because I believe this is only compatible with the respawn menu @fervent kettle
@jade abyss depends on what "toFixed" is set to, you can just outright disable it if you want
The largest representable integer is 16,777,216
@still forum AH! toFixed, right! Thx man 👍
Why isn't this working?
SR_Module = "SupportRequester" createVehicle _RP1;
SP_Module = "SupportProvider" createVehicle _RP2;
SR_Module SynchronizeObjectsAdd [MortarMan];
[HQ, SR_Module, SP_Module] call BIS_fnc_addSupportLink;
is HQ defined?
It's the variable name of an 3den placed playable character.
I see two issues here:
- modules should be created w/
createUnitI believe BIS_fnc_initModules_disableAutoActivationmodule variable should be set to false viasetVariable
I may also need to createGroup sideLogic.
Thanks!
I need to set that variable on both modules?
I would do so yes
iirc, logics need a createCenter too
The wiki says you're correct, but I think I have it covered in 3den. I may do so anyway.
How do I do this without creating a new group for each module?
createCenter still useful in A3?
for logics, yes
oh okay 🙂
(only if there are no logics in the sqm I assume)
@shadow sapphire that's what you already do when placing a module, so you can either create a group for each module, or create one group and use it for all of your modules
i create logics in script, lots of them, last time i removed the createCenter for logics, if broke the mission bad
got a problem with holdaction function. its removed not for all players if executed even if i use remoteExec
https://pastebin.com/BbpNcruA
any idea?
You need to remove the action with remoteExec when the action is done.
codeCompleted: Code - code executed on completion. Passed arguments are:
remoteExec here in combination with removeAction @next kraken
And the action ID is different on each client.
isnt there a 'remove after use' flag in the function?
No, there isnt. How odd
Oh wait..yes there is
Is there a way to alter a units init field using the primary syntax of createUnit or must I use the alternate syntax? https://community.bistudio.com/wiki/createUnit
why would you need to edit the unit's init field if you have a reference to it with the main syntax?
To set the variable.
setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];```
private _myModule = ...
_myModule setVariable ?
Killzone Kid's note says that the alternative syntax is safer. Should this be a consideration?
Interesting. I don't know or understand the syntax for setvariable.
The main syntax returns a reference, you can use that to set a variable
I'll look it up.
_module = _group createUnit ["SomeModule", [0,0,0], [], 0, "NONE"];
_module setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];
and done
Killzone Kid's note says that the alternative syntax is safer. Should this be a consideration?
no as the logics group will remain local to the server 😉
Ah! Thanks!
Tips on giving a custom HQ to these modules?
Hmmm... this isn't throwing any errors that I see, but it's not adding anything to the support menu.
_RPBA42 = (getmarkerpos "RPBA42");
_LogicSide = createGroup sideLogic;
BA42R = _LogicSide createUnit ["SupportProvider",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA42,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA42R SynchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;
Edit: Corrected one provider to requester.
[ player, BIS_requesterMod, BIS_providerMod ] call BIS_fnc_addSupportLink;
at the moment you're adding 2 Provider modules to the unit
Mother. Goose. That'll do it.
That didn't do it. Dang. Apparently there are more problems.
What is _rpba2? Doesn't seem to be defined. It has to be a position.
And why do you create 2 support providers? You need only 1
I fixed the support provider. One is now a requester.
_RPBA2 is a rally point defined elsewhere in the script.
Edited for corrections and clarity.
I think I know what it is.
BA42MA is a mortar, not a mortar gunner.
Well there's no support provider unit. Why do you expect something to appear?
Also, I'm not 100% sure, but shouldn't you use createVehicle?
Anyway, I'll give you a solution when I'm home (currently on mobile)
CreateVehicle is what I originally had. It was incorrect.
There is a support provider unit. They are spawned earlier in the script.
Thanks for the help! Hopefully I'll have it solved before you get home, though!
Okay, So. I want to script a simple syntax. Were the point is to give all players at the end 10000$ cash. Starting with
cash = "5000$";
// than something like
cash = _this select 0;
if (isPlayer) then {
cash + "5000$";
};
how to make this syntax correct?
This makes absolutely no sense
Make a script with a cash parameter and remotexec it on the server so each client is given his the amount entered in the parameter.
So like:
Params [[“_add”,0,[0]]];
Cash = Cash + _add;
to give all players at the end 10000$ cash
what is "cash"? A variable defined in each unit's variable space?
“
what's this?
@shadow sapphire I think you should use this:
_RPBA42 = (getmarkerpos "RPBA42");
_LogicSide = createGroup sideLogic;
BA42R = _LogicSide createUnit ["SupportProvider_Artillery",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA42,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
GM SynchronizeObjectsAdd [BA6R];
BA42R SynchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;
I'm assuming BA42MA is the artillery unit?
And hopefully GM is a player unit?
Yes, BA42MA is the mortar and GM is the player.
Oh! I was using the wrong support provider module!? Dang...
Yes. And you hadn't synced the requester module to the player
And the action ID is different on each client.
@little raptor well thats stupid. do you have a workaround for that?
I tried synching the module to the player earlier and it didn't fix anything, I'm going to try it with and without.
Thanks ton!
Save the actionID into a variable when you add it
thats over my knowledge=)^^ could you post an example
or put a condition?
@next kraken Example:
//better to use a function for remoteExec
[[], {
_id = [costas,....] call BIS_fnc_holdActionAdd;
costas setVariable ["ActionID", _id];//local variable saved into the target's var space
}] remoteExec ["call",....];
or put a condition?
or that. Also hold actions can be removed automatically when they're completed
yea i put a true on this parameter, and its removed, but not for the other client in multiplayer
So you want it to be removed for everyone when it's completed by one user right?
yea true
Then you should put something like this into the action completion code:
//again, better to define a function for this
[0, {
[costas, costas getVariable ["ActionID", -1]] call BIS_fnc_holdActionRemove
}] remoteExec ["call", ...]; //exec for anyone you want
You should use the previous code too (to save the actionID)
well thx, but i dont undersatnd the code fully. is there a way to just remove all holdactions for him
I don't think the game has such function
This code:
BA42R = _LogicSide createUnit ["SupportProvider_Artillery",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA41,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
GM synchronizeObjectsAdd [BA6R];
BA6R synchronizeObjectsAdd [BA42R];
BA42R synchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;
I get this in the log when I check for supports. It's probably irrelevant.
10:09:18 User menu description 'BIS_fnc_addCommMenuItem_menu' not defined.
10:09:21 User menu description 'BIS_MENU_GroupCommunication' not defined.
I'm not getting the things added.
i dont undersatnd the code fully
It sends a code to each client, asking them to remove the specific actionID from costas
And the first code saves the actionID into a variable ("actionID") when it's added
@shadow sapphire Are you executing it on a "headless" client?
Or dedi server?
I'm executing on client server right now. Plan is to execute on dedicated server later.
I think what the log is saying is that those two communication menus are not defined (they're used for calling support)
Did you see the menus?
Yeah, I figured it was that, but thought maybe it would be helpful.
I saw blank menus.
Well, then the game cannot find those menus
Either a bug or undefined because !hasInterface
That's because the module is failing to fire.
It's the same thing that happens if you place the modules incorrectly in the editor, if I remember correctly.
The module syncs and setup is correct. Not sure if there's somthing wrong with the units tho
Yeah, IDK if I'm supposed to call the gunner, rather than the mortar or something.
I use the gunner in my mods
Oh? Hokay!
Just tested. Works for me
Interesting, is it still what you have pasted above?
Something like that
OH!! Interesting! Good find.
Hold on that wasn't it!
Uh-oh.
There's an error in some code for me. Not sure what it is
Hold on, it was 🙃
@shadow sapphire ```sqf
_LogicSide = createCenter sideLogic;
_LogicSide = createGroup _LogicSide;
_RPBA41 = [0,0,0];
_RPBA42 = [0,0,0];
BA42R = _LogicSide createUnit ["SupportProvider_Artillery",_RPBA42,[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",_RPBA41,[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
type = "Artillery";
BA6R setVariable [(format ["BIS_SUPP_limit%1", _type]), 10];
GM synchronizeObjectsAdd [BA6R];
BA6R synchronizeObjectsAdd [BA42R];
BA42R synchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;
what I tested
Still gives me the error
But works
@little raptor https://pastebin.com/4wtSZGD8 this does not throw errors but action is not removed also for the other client
@next kraken costas setVariable ["ActionID", 1];
Did I say this?!
costas setVariable ["ActionID", _id];
That's what I said
Crazy. Still not working for me.
Can I send you this mission file?
urgh sorry, working well thx !
@shadow sapphire What I did:
create a player named "GM";
created an MK6 mortar named "BA42MA";
executed that code in debug console
Ah, I see.
These are all in a function.
I got it working by calling the same exact chunk later in the function. No idea.
Well, look in the rpt, see what you were doing wrong (possibly an undefined var)
Also, positions do not matter for the modules.
So just use [0,0,0]
It wasn't throwing any errors in the RPT.
How do I export a module into a readable file?
The important part of a module is its function.
Place a module in editor, right click on it, go to config, look at its "function"
Thank ya!
How do I deconstruct or inspect the function?
BIS_fnc_moduleSupportsInitProvider
function viewer
or extract the pbo file and find it there
or just type the function name in debug console (the result is preprocessed, so no comments or anything in it)
Those are hot tips!
I found the sqf file names.
Drats. I don't think this is helpful on its own.
I found the sqf file names
The first "folder" is the mod folder (almost always the same as pbo name)
Drats. I don't think this is helpful on its own.
why not?
My Arma isn't unpacked.
Just unpack that one pbo
@shadow sapphire
_logic = _this param [0,objNull,[objNull]];
_this execVM "A3\modules_f\supports\init_provider.sqf";
extract it from modules_f.pbo
I used to have a script that exported modules into readable code. It was beautiful.
How do I depbo? I got mikero's depbo and deogg, but I don't remember how to work it.
Why not use the arma 3 tools?
If I do a action surrender, how do I reverse it?
They are easier to use IIRC
I didn't see the depbo in the Arma 3 tools.
i just use pbo manager
It's called BankRev
Got it! Thanks!
@shadow sapphire I recommend PBO Manager v1.4 because of its context menu options (you can find it on Armaholic)
Hot tip!
I've got these things open in SQF now, though. Trying to identify the problem.
@fair drum Surrendering == Surrender animation + setCaptive
So just do another animation and setCaptive false
I'm getting this error, and can't identify the problem.
My code:
BA42R = _LogicSide createUnit ["SupportProvider_Artillery",[0,0,0],[],0,"NONE"];
BA42R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R = _LogicSide createUnit ["SupportRequester",[0,0,0],[],0,"NONE"];
BA6R setVariable ['BIS_fnc_initModules_disableAutoActivation', false];
BA6R setVariable [(format ["BIS_SUPP_limit_%1", "ARTY_8Rnd_81mmHE_M252"]), -1];
GM synchronizeObjectsAdd [BA6R];
BA6R synchronizeObjectsAdd [BA42R];
BA42R synchronizeObjectsAdd [BA42MA];
[GM, BA6R, BA42R] call BIS_fnc_addSupportLink;
Error:
Error in expression <mat ["BIS_SUPP_limit_%1_total", _type], _total]
} forEach [
"Artillery",
"CAS_He>
12:31:45 Error position: <_total]
} forEach [
"Artillery",
"CAS_He>
BIS function:
{createCenter _x;
_HQGrp = createGroup _x;
(["B_Soldier_F", "O_Soldier_F", "I_soldier_F"]
select _forEachIndex) createUnit [[10,10,10], _HQGrp, format ["this setUnitRank ""MAJOR""; BIS_SUPP_HQ_%1 = this; this setVehicleVarName ""BIS_SUPP_HQ_%1""; publicVariable ""BIS_SUPP_HQ_%1""", _x]];
} forEach [WEST, EAST, RESISTANCE];
BA6R setVariable [(format ["BIS_SUPP_limit_%1", "ARTY_8Rnd_81mmHE_M252"]), -1]; what's this?
I don't recall telling you to do this
You didn't, but things have to adapt. It was throwing the same error even when I used your exact code, but that was before I moved the code block.
but things have to adapt
This thing doesnt
For artillery you MUST use:
BA6R setVariable ["BIS_SUPP_limit_Artillery", _number]
You can even see it in the function
You sent me this:
BA6R setVariable [(format ["BIS_SUPP_limit_%1", _type]), 10];
Yes I used format to help you understand that it's different for each support type
Interesting.
"Artillery",
"CAS_Heli",
"CAS_Bombing",
"UAV",
"Drop",
"Transport"
That's what it says in the function
Now it's sorta working, but it's still throwing the same error. _total is undefined.I don't understand that.
What do you mean set the rest to zero?
{
BA6R setVariable [format ["BIS_SUPP_limit_%1", _x], 0];
} forEach [
"CAS_Heli",
"CAS_Bombing",
"UAV",
"Drop",
"Transport"
];
Everything except artillery is zero now
if you need those too, just remove them from the code
Interesting! Okay, now I've got it.
How do I set this thing to default or unlimited uses, rather than just a set number of times it can be called?
@shadow sapphire unlimited calls for BIS support systems is -1
I tried that, but it treats it as zero.
unlimited calls for BIS support systems is -1
It shouldn't be (afaik)
anyway, just set a large value (e.g. 1e9)
There is a queue u need to follow when you setup BIS support system
I think you didnt do it properly and system doesnt work as it should
I almost certainly didn't do it properly.
@shadow sapphire Where is the LimitSupport function in ur code, I couldnt see it?
I don't have it.
well :)
I don't see that referenced in init_provider or init_requester.
Could you post a relevant template?
That's tough.
There was a bug in mp scenario though so it wasnt that correct but it was only causing an issue when it had to finish.
I looked up that function. It was easy to make it work.
Thanks a ton!
yeah, just put it before addSupportLink
iirc, putting it after wasnt applying that function.
Roger!
What is the easiest way to be able to setAmmoCargo etc., on a non-standard support vehicle?
Like if I want an unarmed prowler to be able to reload my mortar magazines.
Nevermind. Will just attach objects and hide them for now, see how that goes.
Will just attach objects and hide them for now
won't work (actions don't work on hidden objects)
Drats.
Tips for how to give ammo, fuel, and repair roles to vehicles that don't have them by default?
Mod.
Dang.
(Hold) Action + script will also work if you can figure it out.
hiho all, i am looking for a way to determin (via script) if a backpack classname contains mags/items/weapons by default. i know how to pull information from the config, such ass "count", "scope",.... but the information (TransportWeapons, TransportMagazines, TransportItems) seems to be specified within a sub class in the backpacks config and i dont get how to access that info. Or alternatively, check if I am looking at the classname of a base version of a backpack "family". I want to ensure that a loot spawner feature will not spawn backpacks that have ammo/items by default. appreciate any hint in the right direction:)!
@scarlet rain you could still empty that backpack by script?
if a mod is properly made, backpacks with contents won't have scope=2 😉
hi both, thanks! scope is a good hint thanks grezvany, i didnt know that. yes lou in some scenarious i could indeed clear cargo. in some specific scenarios, my application of the Inidb2 persistency system would load such backpacks (that where stored empty) into the storage box with their default content after a server restart.
someone just sent me this: https://community.bistudio.com/wiki/BIS_fnc_basicBackpack
... was looking for that as well
shame i didnt find this in my great googling adventure on the subject today🤪
which is basically doing the same; it simply check if it has a parent class and what the scopes are 😉
i should really browse the bis_functions more often😂
oh ok so scope is really the key info then! that would be great as with this i could avoid pulling all backpacks from config and then filtering out the bad apples with above bis_fnc
cheers guys:)
BIS_fnc_basicBackpack will first filter out known backpacks (all vanilla ones), check if they have cargo and if they have scope 2 (all in one script).
of course, if you already can filter out scope most likely got 90% already done
ok cool, i ll pull scope 2 ones only and let it run trough the bis fnc for a final check👍
that should do the trick; never had any issues with it
remoteExec ["addAction",0,_stand];
Can you add multiple addactions this way on an ingame object?
Seems to ignore the first one and put the 2nd only on the object
But _stand is my object:
_stand = createVehicle ["Land_InfoStand_V2_F", [12468.372,15202.081,0], [], 0, "NONE"];
yes, but you can only have one identical JIP id
if you don't plan to delete _stand, remove the param 🙂
Oh ye, I call the object in the PARAM part
But now it doesn't add either of them
yikes
what's your code now?
_stand = createVehicle ["Land_InfoStand_V2_F", [12468.372,15202.081,0], [], 0, "NONE"];
_stand enableSimulationGlobal true;
_stand setObjectTextureGlobal [0, "images\atm.jpg"];
_stand setDir 298.9;
[_stand, ["Test1",life_fnc_menu1,"dd",0,false,false,"",' vehicle player == player && player distance _target < 5 && playerSide == civilian '] ] remoteExec ["addAction",0];
[_stand, ["Test2",life_fnc_menu2,"",0,false,false,"",' vehicle player == player && player distance _target < 5 && playerSide == west && !life_action_inUse '] ] remoteExec ["addAction",0];
mmm but it has to do that héhé
then set true as the 3rd parameter
Hi, question:
offset[] = { 0, 10, 0 }; // --- custom offset (optional)
will this mean its 10 meters in the air? or 10 meters from the one calling this ?
it depends on what you are talking about, but it looks like #arma3_config
no its for Warlord mission. in the class Defences..
Well will this say it will be 10 from the one doing this call in-game or will the object be 10m above his head?
I don't know 🙃
@scarlet rain @exotic flax - One thing to be aware of with BIS_fnc_backpack is some mods don't contain empty variants of some backpacks (IFA has this issue, for example). If this happens, BIS_fnc_backpack returns "", which can sometimes cause issues - like if you're expecting basicBackpack to always return a valid backpack. Not necessarily a problem, but worth remembering
thanks!
Hello fellow scripters !
I'm having a strange behaviour :
I have a dialog that I am displaying on the player's screen through a spawn function with createDialog "ctf_dialogChooseSide";
I know it is working because it works fine in singleplayer but when I switch to local multiplayer, the dialog closes instantly after having been opened. I know it's being opened because I added a if (!_ok) then {hint "Dialog couldn't be opened!"}; to make sure :D
Anyone know what I might have missed ?
Did you develop the dialog?
Else it could be that some function running after dialog creation checks isServer and closes the dialog.
I found the answer ...
I had forgotten waitUntil { !isNull findDisplay 46 };
Now it works ...
@willow hound thanks for taking the time
searching for the possibility to delete dead players gear AND corpses. guess onplayerdead.sqf would need a code but didnt find anything
Try the Event Handle "Killed"
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed
Uh, as I tried asking a few minutes ago.
I'm planning on using a custom scroll menu script for my scenario(s), which should only be active for certain people. Would it be easier to just add a variable and set it to be true on those certain peoples' init fields or to make a script that detects whether the person has a certain vest, for example, on them for the script to activate.
Would it be easier to just add a variable and set it to be true on those certain peoples' init fields or to make a script that detects whether the person has a certain vest, for example, on them for the script to activate.
Doesn't make much difference in terms of "being easy".
If they MUST have that vest you speak of, then use the latter condition. If they simply are not supposed to use it at all, use the former
Meant to say quicker/better instead of easier, but alright.
Hello, please explain why addaction is tripled with remoteExec? Calling from initserver. The essence of the script is to change into the enemy's uniform
CODE:
{
_x addEventHandler['Killed', {
params["_unit", "_killer"];
_unit setVariable ['killedLoadOut',getUnitLoadout _unit,true];
_killer setVariable ['killerLoadOut',getUnitLoadout _killer,true];
_westUnits = allUnits select { side _x == WEST };
_westUnits = _westUnits - [CIA_1,CIA_2, SF_3, SF_4];
[_unit, ["<t color='#37db16' size='1.3'>Переодеться</t>", {
params["_target", "_caller", "", "_westUnits"];
if (count _westUnits <= 3) then {
_target setVariable ['unitKilled',true,true];
_arr = missionNamespace getVariable ['killedArray',[]];
_arr pushBack _target;
missionNamespace setVariable ['killedArray',_arr,true];
if (count _westUnits == count _arr) then {
missionNamespace setVariable ['task3_completed',true,true];
};
};
private _loadOut = _target getVariable "killedLoadOut";
[_caller, "Acts_JetsCrewaidRCrouch_in"] remoteExec["switchMove"];
sleep 2.5;
_caller setUnitLoadout _loadOut;
[_caller, true] remoteExec['setCaptive'];
_target remoteExec["removeAllActions", 0, true];
[_target] remoteExec["hideBody"];
[_caller] spawn {
params ['_caller'];
private _u = uniform _caller;
waitUntil { uniform _caller != _u };
["end1",false] remoteExecCall ['BIS_fnc_endMission',0];
};
},
[_westUnits], 1, true, true, "", "_this distance _target <= 3"]] remoteExec["addAction", _westUnits, true];
}];
}forEach [I1,I2,I3,I4];
is there a way to distinguish a vanilla config from one added in by a mod?
Maybe get the vanilla CfgPatches from an unmodded game and then use configSourceAddonList ?
might be the way. for now I'll just run the script in unmodded version but when I release it it would ideally be safe to use under any circumstance
@bronze jetty Probably because the event handler is being triggered on 3 machines.
If you had 3 machines connected to the server at the time, it is almost certainly because of that
How do i get all vehicle hitpoint names which are associated with engine?
There's no way to do this (with absolute certainty), because the hit point names (and their order in the list) are chosen by the mod authors
@robust brook So how do i know which are associated with the engine?
Is there a way to fully damage engine of any vehicle?
hitEngine
hitEngine2 is only for planes and helicopters which might have 2 engines
Lets say i wanted to execute a server command using an SQF such as loading up a new mission on a local host. with uiNamespace do { ctrl = findDisplay 12 ctrlCreate ["RscButton", -1]; ctrl ctrlSetPosition [0,0,0.5,0.1]; ctrl ctrlSetText "new mission"; ctrl ctrlCommit 0; ctrl ctrlAddEventHandler ["ButtonDown", { serverCommand "#mission HATAK.VR"; }]; };
How would i get this to work and find the mission in the picture? I have the script in an SQF. but it seems to not find the mission. The mission in my C:\Users\Shadow\Documents\Arma 3 - Other Profiles\Jack%20Oniell\missions. Help
@sudden yacht ```sqf to color-format your code 😉
@cosmic lichen Well, i'm trying to make script that can fully damage engine of any vehicle
It won't work in case of xian, which has 4 engine hitpoints
I wonder why is there no simple way to just damage the engine
vehicle player setHit ["HitEngine3", 1];vehicle player setHit ["HitEngine4", 1];``` @fair pilot try something like that
@sudden yacht I want to make it work for vehicles that are added with mods, so there can be any number of engine hitpoints
setHitpointDamage ?
_veh = cursorObject;
getAllHitPointsDamage _veh params ["_names", "_damage"];
{//fully heal
_veh setHitIndex [_forEachIndex, 0];
} forEach _damage;
_hits = [];
{
_veh setHitIndex [_forEachIndex, 1];
if (!canMove _veh) then {
_hits pushBack [_forEachIndex, _names#_forEachIndex];
};
_veh setHitIndex [_forEachIndex, 0];
} forEach _damage;
{//restore damage
_veh setHitIndex [_forEachIndex, _x];
} forEach _damage;
_hits
Won't work in case of xian which has 4 engine hitpoints
Do that
use getAllHitPointsDamage and damage the ones you want
How do i know which are associated with the engine?
also, if you're going to use my code, call it unscheduled
How do i know which are associated with the engine?
my code does that
It damages all hitpoints till it finds the one(s) which prevents the vehicle from moving (typically the engine)
The hull is also included, but you can remove that
How do i know which are associated with the engine?
they are usually named*engine*something
Not always
usually
if mods are wrong, they don't deserve scripter's attention :p
xian which has 4 engine hitpoints
My method gives only 2 (plus the hull)
Yea your code also returns hitpoints of other parts
That's your best bet. There's nothing else that can give the engine hit points (because as I said, hit point names are arbitrarily chosen by the authors)
End up writing this
`_hitPointName = getText(_config >> "HitPoints" >> "HitEngine" >> "name");
_vehicle setHit[_hitPointName, 1];
_i = 1;
while { true } do {
_cfgName = _config >> "HitPoints" >> ("HitEngine" + str _i) >> "name";
if (not isText _cfgName) exitWith {};
_hitPointName = getText _cfgName;
_vehicle setHit[_hitPointName, 1];
_i = _i + 1;
};`
Hi Im using a little script to make smoke trails, but under any real stress the smoke grenades hang outside the hull of the vehicle, is there a way to use smoke module with this instead of spawning grenades?
[] spawn {
while {true} do {
_smoke1 = "SmokeShellYellow" createVehicle position Disco; _smoke1 attachTo [Disco, [5, 0, -1.2] ];
_smoke2 = "SmokeShellBlue" createVehicle position Disco; _smoke2 attachTo [Disco, [0, 0, -1.2] ];
_smoke3 = "SmokeShellGreen" createVehicle position Disco; _smoke3 attachTo [Disco, [-5, 0, -1.2] ];
sleep 58;
};
};
@inland valve Just hide the grenades with hideObject command?
cool! how does one do that?
with ... hideObject command....? If you will script stuff, get yourself used to look for the links :P
https://community.bistudio.com/wiki/hideObjectGlobal for starters then :)
Im here because I dont really understand that, not because I couldnt find it
so I posted my example
Ok so it is not that hard contrary to belief... To use this command, you should check out the Syntax section, see it says:
Syntax:
hideObjectGlobal <object>
<object>: Type is Object
You do not know what an Object type is , since you just started.
So you again go to same link and search for Object:
You find this link:
https://community.bistudio.com/wiki/Object
You understand what an object is. Okay it may not be understandable from this page but a grenade shell is an object, if it hadnt been so, you would not be able to use createVehicle this "object".
So you take this Syntax written above, what are your smoke objects? They are returned from createVehicle commands and are named as _smoke1, _smoke2, _smoke3. So in order not to confuse you more, you would simply need to hide these 1 by 1.
So as a result, you would write a code like this:
hideObjectGlobal _smoke1;
hideObjectGlobal _smoke2;
hideObjectGlobal _smoke3;
Not the best way but it will work and you be happy for it. If you understood, then you learned something, possibly you are more curious, most likely you will just take the code part but I hope you wont and actually give a try to understand. Now yes there is this code, where will you put it ?
You will put it before
sleep 58;
Why? Because it creates 3 smokes every 58 seconds and every 58 seconds you gotta hide the new ones.
So as a result you will have something like this:
[] spawn {
while {true} do {
_smoke1 = "SmokeShellYellow" createVehicle position Disco; _smoke1 attachTo [Disco, [5, 0, -1.2] ];
_smoke2 = "SmokeShellBlue" createVehicle position Disco; _smoke2 attachTo [Disco, [0, 0, -1.2] ];
_smoke3 = "SmokeShellGreen" createVehicle position Disco; _smoke3 attachTo [Disco, [-5, 0, -1.2] ];
hideObjectGlobal _smoke1;
hideObjectGlobal _smoke2;
hideObjectGlobal _smoke3;
sleep 58;
};
};
Thank me by trying to understand it. 
I am,(slowly) the "why?" was great because the subtleties of scripting get lost on me, wonderful little detail that didnt go unnoticed
I believe people who asks "why?"s instead of "codes" are always welcomed by me and many others in here.
again thanks... on behalf of SOME of the "codes request" type people - I really learn from seeing it, and seeing it work made me want to learn more. I could see how that might come across as lazy, but I assure you from my POV it is the motivator.
What is the easiest way to check if a variable exists, or a player is in a slot with a specific variable name in this context?
If ((player == BHD66) && (!"present" BHA66)) then {};
isNil
Oh... duh! Thanks so much!
Double thanks!
🙂
Is there a clean alternative to !isNil or is that the only way to do that? Not for the same problem, that one is solved, this is a new one.
How do I get this to use lazy evaluation?
If ((!isNil "BHA66") and (player == BHA66)) then {};
you can also
if (condition) then {
if (anothercondition) then {
instead
stylepoints--;
readability--;
Thanks a ton to both of you!
@unique sundial, I thought you retired from Arma? Honor to have interacted with you.
retired from Arma
He's one of the devs.
Arma 4 this decade?
Kidding. I'm actually in no real hurry for a new Arma. Arma 3 has so many issues, but we know them at this point, and can work with them, haha.
Can't even tell the issues anymore... Since I'm used to them since OFP 🤣🤣🤣
Wanted to see if i can put in a runge kutta integrator to reduce performance cost of ballistic calculation with air friction, but found out that theres actually an analytical solution...
https://abload.de/img/geoa7jo8.jpg
hello. i was away a while and have installed the 2.0 update recently. now my script init isn't working anymore. its a folder in arma 3 root level: execVM _mjk_scripts\mjk\init.sqf"; has the update changed anything at how to reach scripts outside pbo's?
how does it not work?
you may need to put it in your mission folder instead
or perhaps you run it wrong way
a folder in arma 3 root level:
It never worked this way. (maybe you could run it with filepatching)
@austere hawk
Also, what about the rest of the parameters (e.g. drag coeff)?
Need advice... I have this MP mission on server where we play as Vietcong and i want to have asian faces for all playable units, i do managed to set them, however on players respawn, the face is reseted to player default non asian face... So i need command to stick that asian face tru death
maybe something like this on mission init 🤷
player addEventhandler ["Respawn",{
params ["_unit","_corpse"];
[_unit,face _corpse] remoteExec ["setFace",0,_unit];
}];
Thanks will try
@austere hawk
Source?
@little raptor physics ...
force equilibrium on the projectile in x and y. This leads to 2nd order non linear differential equation of motion in x and y. x''(t) = - airfriction * x'(t)^2 ; y''(t)=-airfriction * y'(t)^2 - gravity
gravity & airfriction as positive values.
Solve the differential equation to get x(t) and y(t), then caclulate the 4 integration constants from boundary conditions.
https://www.wolframalpha.com/input/?i=y(t)"%3D+-a*y(t)'^2+-g
(note - in wolfram alpha log = ln , not log10)
That's where you're wrong.
The drag is acting along the path (Fd = -cd*V^2). In other words:
Fy/Fx = tan (theta)
What you write doesn't (Fy/Fx = tan^2(theta))
That's why I was shocked by that equation
I wanted to say your source is incorrect
🤔 <sound of brain gears grinding>
what you wrote:
airfriction * y'(t)^2/airfriction * x'(t)^2 = (y'/x')^2 = tan^2(theta)
theta is the slope of the trajectory @(x,y)
what you wrote would be correct for linear drag
but not for quadratic drag
is drag actually calculated quadratic ingame?
drag? womens clothes are in game?
yes. but not sure if Arma devs are using the correct equation like mine
But all I know is that their equations are wrong somewhere (due to weird ballistics behavior)
vanilla artillery have no air friction at all, if thats what you mean
i think the use is correct in game, i just checked the standard "euler step" algorithm i use for my calculator, which is accurate in predicting the impact, and that has _ax = _airfriction * _v * _vx
ah, you mean rockets/missiles. I'm not touching those with a long pole... i'm just after normal bullets
How can i check if a player is next to a building position? Within a couple of meters through a if then statement?
nearestBuilding I assume
But nearest building feels a bit to general?
that or nearestTerrainObjects then
if ((player distance _mybuildingposition) < 3) then { code goes here }
another quick question what is a "Hide"
ah, the million dollar question lol
many things are hides according to the nearestterrainobjects command
I've always assumed that hides are things the AI can hide behind when in combat
ty ill investigate more
Hide are usually rocks and stuff
rocks are usually rocks in the nearestterrainobjects command
not small ones? 🤔
checking now, to be sure
runwayedgelights are hides
almost all runway lights are, in fact
land_bench_f
land_watertank_02_f
almost all sidewalk, kerb objects
all roadsigns, all garbagebin type objects
you get the idea, there's no real method behind what is a hide other than 'it doesn't fit neatly into another type'
ty
np
on the otherhand, nearestterrainobjects is good at finding tree, house, fuelstation, railway, transmitter, powerwave
and others
oh, and road, main-road track and trail since 1.99
nearestterrainobjects is the dynamic mission makers best freind
@winter rose , some rocks, big and small are hide, some are rock
rocks isnt used
you get the idea, there's no real method behind what is a hide other than 'it doesn't fit neatly into another type'
I had that feeling, but didn't dig further, thank you for doing so
weird question , but whats the chances you can assign a unit a variable when it enters a trigger?
…please rephrase?
COND: this && random 1 < 0.25
ACT: OneVariable = thislist select 0
```?
like you have a unit with variable null
upon entering trigger area he gets assigned variable BIS_FD_Competitor
bottom can wait :P
/upon entering a different trigger he gets assigned a random variable so the next player can be assigned variable BIS_FD_Competitor/
…Y u work with BIS prefixed vars
…because Firing Drill.
BIS_FD_Competitor = thislist select 0; publicVariable "BIS_FD_Competitor";
@gilded rover ↑
Hello, sorry for my English, I'm French;)
So here I have a little problem, I would like to execute a function that only server knows from the client, suddenly, as seen on the bohemia wiki, so I use the CfgRemote and the remoteExec function in order to execute from client to server the function, but nothing works: / can someone explain to me how I can go about running a server function from the client? Thank you
class CfgRemoteExec
{
class Functions
{
mode = 1;
jip = 0;
class life_fnc_get_player
{
allowedTargets=2;
jip = 0;
};
class life_fnc_set_player
{
allowedTargets=2;
jip = 0;
};
};
};
``` and remoteExec
```sqf
[serveur_id_sauvegarde,_uid,"pos"] remoteExec ["life_fnc_get_player",2];
but this does not work, it does not run from the server
tried without CfgRemoteExec?
okay I will try
Hello, is it possible to check the array in the array?
I'm Trying to make a condition for the distance of the first player who comes closer than 5 meters to any unit from the array.
Did:
{
_enemyArray = _x;
allPlayers findIf {_x distance _enemyArray <= 5};
}forEach [
security_1,
security_2,
security_bpost_1
];
But this method doesn't work
…because Firing Drill.
@winter rose exactly , trying to push this to its limits xD in terms of MP , thanks I will try that!
@winter rose it doesn't work either
@tough abyss Your code looks good to me, you're just not doing anything with the value returned by findIf, so the code just runs and the result is discarded.
@willow hound I just run it in the console and see the result
Ok, I'll do my research, thank you very much
The result is what forEach returns - probably nil, is it not?
@willow hound The result is -1 always, ForEach result is the last element in the array for commands that return nothing
Yes, but I do not know what to replace it with
That's what the last loop iteration checks.
if ((allPlayers findIf {_x distance _enemyArray <= 5}) != -1) exitWith {true};
Try that
Hello guys, I have a question: I want to have a message written to the log file when someone enters Zeus but I can't seem to make it work. I tried it with the following for a test to make it work but I feel like I'm missing something
player addEventHandler ["CuratorObjectRegistered", {
[format ["%1 entered Zeus", name player]] remoteExec ["diag_log",2];
}];
Can you confirm the EH fires?
No thats the issue
triedit with hint and systemchat but whenI enter Zeus nothing happens
other EHs do fire the (e.g. fired)
It might be expecting a curator game logic (Zeus Module) instead of a player, have you tried adding the EH to that?
Yep, says so here:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Curator
mhhh didn't check that message up there. That explains a lot. Thanks
Funny, I can get CuratorObjectPlaced working but not CuratorObjectRegistered I feel like I understand this one wrong
I hoped it would fire whenever the player entered the Zeus interface
I only wanted to create a function that would make a check between deleteVehicle/deleteVehicleCrew…
what happened, I ended up with a 64 lines script 😵
That's radical.
moar efficienter!```sqf
while { true } do // just to be sure
{
deleteVehicle _this;
if (random 1 > 0.999) exitWith {};
};
No kidding!
That's one of my weakest attributes is efficient code. Like... I can finally understand what's going on well enough to make it work, but not well enough to crush anything down to do the same job with fewer lines or better run time.
@shadow sapphire https://community.bistudio.com/wiki/Code_Optimisation
Best Practices too
Well, I've more or less got step one, step two I have, depending on who you ask, but step three is still wayyy down the line for me.
No kidding!
but just to say, I ended up making a function to delete about everything - group, array elements, objects, markers…
couldn't help it 😄
What's the use case?