#arma3_scripting
1 messages ยท Page 71 of 1
i think this might just be my schizophrenia again though
ah, knew it -- thx
Normally prefer the vector stuff but that one is sometimes a shortcut.
vector stuff probably more reliable isn't it?
oh probably faster too according to wiki
etc, selectionPosition [wheel_1_1_axis, "Memory"]
well, fewer commands is faster in general.
Why use many command, when few command do trick.
sorry, missed the quotes around the name
Hey I need some advice how we could achieve something. So you know how there is kill/score tracking in ArmA? The problem is, at the end of the mission it shows you all your kills, and if you look at someone via Steam, it shows you their score. This happens even if the scoreboard button in-game is disabled.
I am wondering if there is some way to disable this for co-op? We got an issue in our group where some people just end up basically kill-chasing for that score.
what? where does it say that?
@smoky ospreyhttps://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleScore
getPos is slower than those commands
it has nothing to do with vector
also that's for the getPos obj variant
never use getPos and setPos for that
tho getPos is fine if you actually need the AGLS
i know
origin getPos [distance, direction] form is fine though.
It doesn't do anything with Z. IIRC it just sets it to zero.
yeah
ya
(even if input z is non-zero)
Trying to move my AI team via map click but they are not moving.
openMap [true,false];
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
{_x moveTo _pos} forEach units group player -[player];
openMap [false,false]; // Close map
removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
}];
What am I doing wrong?
moveTo only works with doStop
try this myb:
addMissionEventHandler ['Map',{
params ["_mapIsOpened", "_mapIsForced"];
if(_mapIsOpened) then {
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
{_x domove _pos} forEach units group player -[player];
}];
};
}];
Then should i just remove it after closing the map ?
well do you even want to always have the click option available when you open the map?
e.g what if you want to click on the map to place a marker?
What about removing it after the action something like:
addMissionEventHandler ['Map',{
params ["_mapIsOpened", "_mapIsForced"];
if(_mapIsOpened) then {
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
{_x domove _pos} forEach units group player -[player];
removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
}];
};
}];```
My script removes the EH after use, no?
Oh I see. Low level command. Thank you
if the user opens the map, then closes it, then opens it again, the EH is still there and gets duplicated
same issue with this
addMissionEventHandler ['Map',{
params ["_mapIsOpened", "_mapIsForced"];
if(_mapIsOpened) then {
if(!isNil _eh) exitWith {};
private _eh = addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
{_x domove _pos} forEach units group player -[player];
removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
}];
};
}];
``` ?
if (missionNamespace getVariable ["my_map_EH", -1] >= 0) exitWith {};
my_map_EH = addMissionEventHandler ['Map',{
params ["_mapIsOpened", "_mapIsForced"];
if(_mapIsOpened && {missionNamespace getVariable ["my_mapClick_EH", -1] < 0}) then {
my_mapClick_EH = addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
{_x domove _pos} forEach units group player -[player];
removeMissionEventHandler ["MapSingleClick", _thisEventHandler];
}];
};
}];
doesn't work like that
you could also do it with isNil but with global var
So in my example is it possible to just put _eh in Global would it work that way then ?
yes but you should also make sure Map EH is not duplicated either
i got it. nvm
^ rhs uses different mem points for wheels
r.e HitPart eh:
The event will not fire if the shooter is not local, even if the target itself is local.
does this mean that the eh needs to be added on all player machines? i.e if you have object local to server, you would need to use addeventhandler on all players?
what a stupid question addeventhandler is local effect
i suppose i need to find a different method of registering damage to an object that cant take any ๐ค
Take a look at the HandleDamage event handler which is global.
It is not.
It's global-argument but only triggers when the attached object is local.
Now dammaged is actually global-argument for some reason.
so long as anyone can shoot it locality-wise and have it fire it should be good ๐ค
But as it's a static object dammaged may not work 
likely, yeah
wait all players aren't local to server are they
and only local to themselves right
i feel like thats something i shouldve checked prior
After a few frames, yes :P
yes to which ๐
Player objects are created on the server initially and then locality-switched to the client.
ah
Is it possible to stop propagation of vanilla keypress events without making their keys not bindable for other actions? For example, if you used:
private _display = findDisplay 46;
_display displayAddEventHandler ["KeyDown", {
params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
if (_key in (actionKeys "personView")) exitWith { true; };
}];
Then if you had any other actions bound to the same keys as toggle person view (personView) they would also stop being propagated. Is there an equivalent to the above for addUserActionEventHandler since that's tied to a specific action and not just a keybind that could potentially be shared with other actions? Something along the lines of:
addUserActionEventHandler ["personView", "Activate", { true; }];
The goal here is to completely eliminate the command menu so other alternative methods of that are also welcome!
I forget what happens on a respawn. I seem to remember it was unexpected.
Either way not consistent enough for simulation of hp system :p
"simulation of hp system" number go down more with larger ammo caliber
HandleDamage is a good candidate if you want to record the damage amount, because you can save the damage and then immediately nullify it. Using an allowDamage false object and a hit/hitPart EH would not let you do that because it would never take any theoretical damage to record.
actionKeysEx could be used in some cases I guess
inputAction too but not sure about that one
Try a hitPart EH on the projectile :U
BECAUSE STANDARDLIATION WHY
add a hitpart eh through a fired eh? 
I'm not saying it's a great idea, but the alternative seems to be finding a different object that has the simulation you need
Ello, sorry for interjecting. I am using onMapSingleClick to add a waypoint for a unit but when I don't want to add a waypoint and wanna click on the map it will still do the waypoint code. How do I disable it? I want to enable onMapSingleClick when I want and disable it after use.
_target param returns the projectile 
Projectile hitPart EH has a different params layout
I'd suggest using the mapSingleClick EH, rather than the old onMapSingleClick thing. It's easier to remove when you don't need it any more
forgot theres two
It's linked from the onMapSingleClick page with a note saying to use it instead :U
Ah
Uh, can you tell me how I would disable this event? I haven't worked with eventHandler for quite a lot of time
thanks
How can I select a squad unit via script in a way that it gets highlighted in the units bar?
groupSelectUnit
tyvm
Quick Question guys how would you move Object up and down with SetVelocityTransform. Better Question how to make it when object reaches pos 2 to invert direction of travel but keep rotation ?
can someone check my code?
curatorName addEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
};
/*if (isNull _mainMarker) then {
deleteMarker _mainMarker
};*/
_marker = createMarker ["transportMarker", _pos];
_mainMarker = _marker setMarkerType 'hd_dot_noshadow';
openMap false;
];```
MapSingleClick is a mission EH, which means you use https://community.bistudio.com/wiki/addMissionEventHandler to add it, and the player it belongs to is determined by what machine it runs on, not object assignment
Well, it won't do anything in that configuration, because addMissionEventHandler doesn't have a left argument
uhh

curatorName addEventHandler ["MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull _mainMarker) then {
deleteMarker _mainMarker;
};
_marker = createMarker ["transportMarker", _pos];
_mainMarker = _marker setMarkerType 'hd_dot_noshadow';
openMap false;
}];
what about this?
MapSingleClick is a mission EH, which means you use addMissionEventHandler to add it, not addEventHandler
If it's the memory lod, then there is a mask for it.
Like wheel_X_Y_axis , which is a config entry
OH
and addMissionEventHandler doesn't have a left argument
EH = EventHandler lmao
curatorName addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
//_wp setWaypointCombatMode "YELLOW";
};
/*if (isNull _mainMarker) then {
deleteMarker _mainMarker
};*/
_marker = createMarker ["transportMarker", _pos];
_mainMarker = _marker setMarkerType 'hd_dot_noshadow';
openMap false;
];```
11:43pm coding session
addMissionEventHandler doesn't have a left argument
what's a 'left argument'?
But the numbers can still start at 0 or 1.
Arguments are the instructions you pass to the command. The whole array of event handler name, code etc. is one argument. It's the right argument, because it goes on the right side of the command. You are trying to pass curatorName as the left argument, as if the command was a binary (two-argument) command, but it isn't, it's unary (one argument) which means it only listens to the instructions on the right side. As per its documented syntax.
uh
so if I do fancyLeftArgument = curatorName addMissionEventHandler... is it gonna work? :D

No, that's not how it works
;-;
fancyLeftArgument = ... is just saving the output (if it had any) as a variable called fancyLeftArgument. It doesn't make any difference to how the command works.
- Read this: https://community.bistudio.com/wiki/addMissionEventHandler
- Don't try to pass
curatorNameto the command by putting it on the left side of the command.
_id = ... is saving the output, what the command returns, to a variable called _id. As the page mentions, the return value is the numerical ID of the EH that was just created. This is for use later if you want to remove it.
yeah
so just a quick question
removeEventHandler ["MapSingleClick", {hint "Removed!"; removeMissionEventHandler ["MapSingleClick", _id];}];```
this will work right (_id)
Like the Puma , which uses 0 for the Umlenkrolle (eng?)
Maybe, depending on scope. _id is a local variable, meaning it's saved in the current script scope and isn't available in other scopes. So if you save it as a local variable in this script, then try to do the removal in a different scope...you can't, you need to use a global variable, or pass the ID as an argument if the new scope is spawned/called from the first.
Also that code doesn't actually make any sense.
ye ik i wont use _id but yk this syntax is correct right?
You can't use removeEventHandler to remove mission EHs, and the second parameter for removeEventHandler is.....not code
Yes, but look at the code you posted. From the beginning.
ohhhh
oopsie
removeMissionEventHandler ["MapSingleClick", _id];```
what about this?
That appears correct
yay
now about adding it
_id = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
//_wp setWaypointCombatMode "YELLOW";
/*if (isNull _mainMarker) then {
deleteMarker _mainMarker
};*/
_marker = createMarker ["transportMarker", _pos];
_mainMarker = _marker setMarkerType 'hd_dot_noshadow';
openMap false;
};
];```
You don't want a ; after the last }. ; means "end of instruction" but that's not, it's still inside the parameter array
oh okay
that's all?
_id = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
//_wp setWaypointCombatMode "YELLOW";
/*if (isNull _mainMarker) then {
deleteMarker _mainMarker
};*/
_marker = createMarker ["transportMarker", _pos];
_mainMarker = _marker setMarkerType 'hd_dot_noshadow';
openMap false;
}
];```
setMarkerType doesn't return anything, so trying to save its return value as _mainMarker doesn't do anything
The EH syntax looks right though.
dw about those I will use it later
_id = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull _marker) then {
deleteMarker _marker
};
_marker = createMarker ["transportMarker", _pos];
_marker setMarkerType 'hd_dot_noshadow';
openMap false;
}
];
removeMissionEventHandler ["MapSingleClick", _id];```
I assume there will be other code between the addition and removal, and you're not planning to add it and then instantly remove it
uhh I might put a 1 second sleep
That's...a pretty short window for the player to click
// Add your custom action code here
leader convoyGroup sideChat moveReply;
openMap true;
sleep 0.1;
if (count waypoints convoyGroup > 0) then {
{
deleteWaypoint((waypoints convoyGroup) select 0);
}
forEach waypoints convoyGroup;
};
sleep 0.1;
_id = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull _marker) then {
deleteMarker _marker
};
_marker = createMarker ["transportMarker", _pos];
_marker setMarkerType 'hd_dot_noshadow';
openMap false;
}
];
sleep 0.4;
removeMissionEventHandler ["MapSingleClick", _id];```
this
if (isNull _marker) then {
deleteMarker _marker
};```
This doesn't make any sense. If `_marker` is null, you can't delete it because it already doesn't exist.
Oh ye this was a bit of confusion, should I use !isNull or isNull?
I want to check if _marker is available and if it is then delete it and carry on if not then carry on.
In theory !isNull, but on closer inspection, _marker is not defined in this scope, so that won't really work anyway
_marker is a local variable which only relates to the current scope (in this case, the current instance of the EH code). It is a separate and unique instance of _marker with no connection to any other local variables in other scopes with the same name.
so shall I make it notlocal object?
// Add your custom action code here
leader convoyGroup sideChat moveReply;
openMap true;
sleep 0.1;
if (count waypoints convoyGroup > 0) then {
{
deleteWaypoint((waypoints convoyGroup) select 0);
}
forEach waypoints convoyGroup;
};
sleep 0.1;
mapSingleClickEvent = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull marker) then {
deleteMarker marker
};
marker = createMarker ["transportMarker", _pos];
marker setMarkerType 'hd_dot_noshadow';
openMap false;
}];
sleep 0.4;
removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];
Kind of, but like that it won't work the first time it runs, because marker has never been defined at all, and isNull still needs to refer to a defined variable even if it contains null. Actually, a marker variable would never contain null anyway because markers are referred to by their string names, not as objects. Even if the marker was deleted, variables used to refer to it would still contain its string name, since that's...just a string.
In other words, use isNil instead
Probably use a more unique name than just marker though, lord knows what other mods or scripts might also try to use a global var called marker. Put your name on it.
So, the other issue I was getting at before is that you're adding the mapclick EH, and then removing it 0.4 seconds later
ye
Why?
uh cuz its work is done
I mean, assuming the player actually clicked on anything in that 0.4 seconds, sure
Okay I wanna clear this one as well, I don't want player to click on map and waypoint of convoy to flipoff
I can set 1 second tbh
// Add your custom action code here
leader convoyGroup sideChat moveReply;
openMap true;
sleep 0.1;
if (count waypoints convoyGroup > 0) then {
{
deleteWaypoint((waypoints convoyGroup) select 0);
}
forEach waypoints convoyGroup;
};
sleep 0.1;
mapSingleClickEvent = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull tMarker) then {
deleteMarker tMarker
};
tMarker = createMarker ["transportMarker", _pos];
tMarker setMarkerType 'hd_dot_noshadow';
openMap false;
}];
sleep 1;
removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];```
What this code does is open the map, and then for 1 second, the player has the ability to click on the map and cause that waypoint/marker stuff to happen. Once that 1 second has passed (say, if the player took longer than 1 second to figure out where to click) the opportunity goes away forever.
Are you thinking that the sleep happens after the player has clicked and activated the EH? Because it doesn't. It happens as soon as the EH is added.
can I use waitUntil they put the waypoint and then remove it :)
You don't need to, just put it inside the EH
put what may I ask?
removeMissionEventHandler
Then you can also use the _thisEventHandler magic variable and not need to save the ID as a global var
It's not that complicated :|
at 12:18 am it is very complicated
You are going to make the EH remove itself when it activates
yeah
The EH code, with the waypoints and markers and stuff, is executed when the EH activates
yeah
So we are going to put the removal code inside that code
1 second isnt enough time fr
So that it happens when the EH activates as well
:0
BRAIN WORKS
// Add your custom action code here
leader convoyGroup sideChat moveReply;
openMap true;
sleep 0.1;
if (count waypoints convoyGroup > 0) then {
{
deleteWaypoint((waypoints convoyGroup) select 0);
}
forEach waypoints convoyGroup;
};
sleep 0.1;
mapSingleClickEvent = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull tMarker) then {
deleteMarker tMarker
};
tMarker = createMarker ["transportMarker", _pos];
tMarker setMarkerType 'hd_dot_noshadow';
openMap false;
removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];
}];```
You don't need to save or reference mapSingleClickEvent, just use _thisEventHandler in the removal
ah ok
.......well, actually, probably do save it. You probably want to remove the EH if they close the map without doing anything, so you'll need to refer to it elsewhere.
hmm okay
You can also not remove it if they close the map, but then this EH will just be sitting there waiting to fire the next time they open the map
You want to detect when the player clicks on the map. There is literally no way for you to detect if this was a misclick or not. Where they click is what they get.
ya that's why Im happy removing EH lol
Oh, you can use the alt syntax of openMap to prevent them from closing the map until they've done something
oh..
You're pretty much there and it's late, so I'm going to bed. Good luck.
okay
// Add your custom action code here
leader convoyGroup sideChat moveReply;
openMap true;
sleep 0.1;
if (count waypoints convoyGroup > 0) then {
{
deleteWaypoint((waypoints convoyGroup) select 0);
}
forEach waypoints convoyGroup;
};
sleep 0.1;
mapSingleClickEvent = addMissionEventHandler [
"MapSingleClick", {
_pos = _this select 0;
_wp = convoyGroup addWaypoint [_pos, 0];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointCombatMode "YELLOW";
if (isNull tMarker) then {
deleteMarker tMarker
};
tMarker = createMarker ["transportMarker", _pos];
tMarker setMarkerType 'hd_dot_noshadow';
openMap false;
removeMissionEventHandler ["MapSingleClick", mapSingleClickEvent];
}];```
You're still using isNull when you should be using isNil
Remember that isNil requires the variable name to be given as a string, since it's trying to check a variable that may not exist
openMap [true,true] will open the map and prevent the player from closing it until you close it with openMap false. Useful if you want to make sure they have definitely done something before you close it.
I'm actually going now.
๐ถ position is not the 0th item in _this for a mapSingleClick EH. Use select 1 instead.
oof
Lmao when u get up please explain this select 0 and select 1 thing. I read the documentation but my wee brain cant understand lol
shit addwp will be 0 nvm
In this context, _this contains an array of the information the EH gives you about its event. select is being used to get an element from this array, by its numerical index. Arrays are 0-indexed; the first element is index 0, the second is index 1.
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#MapSingleClick
This lists the returns from the EH in question, in order. You want position, which is the second element so select 1.
You can also use params as shown there to automatically parse the contents of _this into a set of named variables. (You don't need to do that here since you're only using one of them)
:0
ah...
Omg, tysm
This means a lot
So no ๐ข
{
switch (_x) do
{
case 0: {_x = "We've connected with the southern AAF roadblock and tracked a group of rebels who had fled the valley."};
case 1: {_x = "An insurgent logistics vehicle was secured, and documents pertaining to Ignite's mission were recovered"};
case 2: {_x = "We cleared an FIA staging camp west of Kore and recovered some coded plans."};
case 3: {_x = "That POW we captured in Topalia must be giving away some prime intel by now."};
};
} foreach [_selection1,_selection2];
_selection1 and _selection2 are defined, in my test case as 0 and 1. However, they are not being over-written with the strings when I run this code - but no errors are thrown, either.
... I figured a far simpler solution, but I'm keeping this up because I'm curious if it could have worked.
I have been wanting to do something really dumb.
So today I learnt all the basics of SQF programming and how the arma engine works. I did a few things like a guy that sells bananas to the player or a car that explodes upon entering it... used CBA and all the funny things.
I was wondering, how does the fire support BI function work? I cant seem to figure out the position.
I tried setting the position param to getPos car_bomb but it did nothing. I also tried car_bomb itself. But once again nothing happened.
Asides that, does the BI method track the vehicle position or only the logged position at the time of execution? (Say the vehicle is moving and artillery is falling behind it, following it)
Additional note, my code was literally the example code in the fire support BI method in the wiki. Only thing changed was the pos parameter.
Howdy all, is there a way to check if a player is in the ESC menu in multiplayer?
isGamePaused works great for single player, but i need an equivalent for multiplayer
In your case, magic variable _x is overwritten. Nothing touches the array it comes from.
Ah, so it works, but just immediately screws itself ๐
I know there is a method or event handler related to this, saw it earlier today.
Makes sense.
Check the wiki builtin methods, maybe you see it there.
i think findDisplay 49 or like:
isNull findDisplay 49
might be the trick
Does battleeye run on dedicated servers? E.g can I run a non-whitelisted extension on a dedicated server
What typeName should I use for numbers?
https://community.bistudio.com/wiki/typeName
Hoe safe is it to use profiles as data storage? Im looking to have persistent storage across server and client of things like money, but im unsure where i can store this. Do i need an external db?
safe-ish. Some people's server management sucks and they break their profiles.
Not entirely sure how they do it but starting two copies of the server accidentally might be a factor.
@acoustic yew "SCALAR", but _x isEqualType 0 is usually better.
could do a find "wheel_"
So the profile data is not stored in the clientside where it can be modified?
Each machine has its own profile namespace.
Are the profiles verified by the server though?
Not sure what you mean.
and then use a split function to get all the numbers
Essentially, as i said before, i want to check how safe it is to store important data persistently (or semi persistently)
Data like how much money a player has
And i was wondering if profile storage was a safe method, since it had been recommended when i was checking the BI db section
With most mission designs you'd only store and manage that data from the server. Client profile wouldn't be used.
Yeah thats the idea
But i have no idea what to use since everything seems to rely on the client
Clients can't write to server profile namespace without remoteExec.
Uhh
// ย Attribute values are saved in module's object space under their class names (Convoy Speed).
_convoySpeedString = _logic getVariable["SDR_ConvoySpeed", -1]; // loads information from module to script.
convoySpeed = [0] apply compile _convoySpeedString param[0, objNull, [objNull]]; // This converts string to usable function!```
like here
instead of objNull
just put any number in there.
like in objNull?
Could i have an example in code? Just making sure we are in the same line.
https://community.bistudio.com/wiki/Arma_3:_Scripted_Database
I don't know that thing.
Writing data to profilenamespace is just profilenamespace setVariable ["TAG_myDataName", _mydata]
Wouldnt that store it for the client though?
Depends where you ran it.
I see
initServer.sqf would work as a 'global' / serverside execution?
I guess i can always throw it with remoteExec
If you want something relatively secure then you should restrict client remoteExecs to calling specialised functions on the server.
And design your system around that.
IF the vehicle uses that mask. Mask could be "XY"
and you should start with doing that from the get go cause its is annoying af to go back and convert it
Can someone help me with getting the number typeName?
// ย Attribute values are saved in module's object space under their class names (Convoy Speed).
_convoySpeedString = _logic getVariable["SDR_ConvoySpeed", -1]; // loads information from module to script.
convoySpeed = [0] apply compile _convoySpeedString; param[1, [], [[]]]; // This converts string to usable function!```

Is it ChatGPT again?
no no

yes really
Even your question feels like ChatGPT at this point. Are you an AI trained on contents of this channel?
Seriously though, no personal offence, neither your question nor your code make any sense.
I will explain
Im bad at explaining tbh
// ย Attribute values are saved in module's object space under their class names (Convoy Speed).
_convoySpeedString = _logic getVariable["SDR_ConvoySpeed", -1]; // loads information from module to script.
convoySpeed = [0] apply compile _convoySpeedString; param[0, objNull, [objNull]]; // This converts string to usable function!```
Focus on objNull
That is typeName for getting an object name
I want to take Scalar value
idk how to
uhhh

get a number value from my module
What's with apply compile?
it compiles a string to a code
But why, if its a value (number)? Why compile it?
Are you trying to turn string number into a number?
If yes, then you need https://community.bistudio.com/wiki/parseNumber
because module returns a string value
I think I tried parsing...
can I shove value from _x to x?
using parse
_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1];
if(_convoySpeed isEqualType "") then {_convoySpeed = parseNumber _convoySpeed};
what will be the reference to parsed value? (will it be _convoySpeed?)
_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1];
// Say _convoySpeed is "123" (String)
if(_convoySpeed isEqualType "") then {_convoySpeed = parseNumber _convoySpeed};
// _convoySpeed will be 123 (Number) here
You can later do
whateverGlobalVariableYouWant = _convoySpeed;
```or anything else you want to do with it
I get that but I dont want _convoySpeed in local variable, so can I do...
_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1]; if(_convoySpeed isEqualType "") then {convoySpeed = parseNumber _convoySpeed};```
Assign it into global variable later after you're done preparing it
when its parsed isn't it prepared?
I cant plug it in to use it?
Never used parsing 
After this code your _convoySpeed will be Number if it was Number or String before, you can use it however you want next, set its value to a global variable, feed it into another function, anything you want.
like _convoySpeed = convoySpeed ?
The other way around
ye
Like this
what would be the best way to achieve a light house (light beam rotates around the Z axis) effect to a prop? I'm thinking of using createSimpleObject with one of the volumelights in a3_data_f but i'm not sure how I would keep it rotating all the time
Not sure about light itself, didn't play around with it too much, but rotation can be done by bounding an angle to serverTime in each frame handler
coding for 18 hours yay
I'd suggest having each client creating their own local light object and rotating it themselves
But you can locally change transformation of global objects through an attachTo hack
yea I was about to ask how performance intensive it would be in a mp scenario
Shouldn't be that big of a deal if done right
great, I don't need the rotation to be synchronized just the on/off behaviour
It can be synced for everyone if bound to serverTime
Since engine already ensures it is synchronised between all clients
createNewLightCone = {
if(isNil"myLightCones") then {myLightCones = []};
myLightCones pushBack createSimpleObject ["...model...", _this, true];
if(isNil"myLightConesEachFrameEH") then {myLightConesEachFrameEH = addMissionEventHandler ["EachFrame", {
{
_x setDir (serverTime % 10 * 360);
} forEach myLightCones;
}]};
};
This is all it takes really
Can be structured better though, but you should get an idea
oh that helps a lot, many thanks
serverTime % 10 * 360 turns server time into 0-360 angle through 10 seconds
_this should be ASL position that simple objects use
Welcome to the world of Arma pain
haha
btw did not work :/
idk why it wont work
I guess I need a code? idk tbh
post code
one sec
// ย Attribute values are saved in module's object space under their class names (Convoy Speed).
_convoySpeed = _logic getVariable["SDR_ConvoySpeed", -1];
if(_convoySpeed isEqualType "") then {_convoySpeed = parseNumber _convoySpeed};```
looks proper
yeah
Your error is with hint which you didn't post
standby
Uh wait
You need to feed string into hint
Just do hint str anyVariableHere to turn it into a string
What GUI elements where?
If something break thats a bug that should be reported as a bug and fixed
Yes, Yes.
Not that I know of. I was gonna see if I can suggest a different approach for your problem
Here to ask about multiplayer scripting now...... I decided to make the script server side as it seems easier to not handle server and client interaction. Also, It allows me to zeus in new anomaly and still run the scripts. Therefroe, this is what I come up with. The key condition added is the if statement followed by while{alive _self} do. This allows the detection if the player is turned around.
//this should be the object that follow this movement scheme
params [
["_self",objNull,[objNull]]
];
//Get position of the anomaly
private _pos = getPos _self;
private _posAGL = ASLToAGL _pos;
private _seen = false;
while {alive _self} do {
//When it is not dead
{
if (
_x == player
&& {_x distance _posAGL <= 2000}
&& {
private _dir = _x getRelDir _pos;
_dir <= 90 || {_dir >= 270}
}
) then {
//The player is looking at the general direction of the anomaly
//Return the visibility between player and the anomaly
_canSee = [objNull, "VIEW"] checkVisibility [eyePos player,eyePos _self];
if (_canSee > 0) then {
//Disable AI movement when it is seen by player
_self disableAI "MOVE";
_seen = true;
systemChat "Disable AI MOVE";
} else {
//Enable AI movement when it is not seen by player
if (_seen == false) then {
_self enableAI "MOVE";
};
systemChat "enableAI MOVE";
};
} else {
//The player is not looking at the general direction of the anomaly
//Enable AI movement when it is not seen by player
if (_seen == false) then {
_self enableAI "MOVE";
};
systemChat "enableAI MOVE";
};
if (_forEachIndex == 0) then {
_seen = false;
};
systemChat format ["_forEachIndex: %1", _forEachIndex];
//Repeat this for every player in the server
} forEach units player;
}
However, this script doesn't work on multiplayer for some reason. The
systemChat format ["_forEachIndex: %1", _forEachIndex];
would return 0 every time indicating that it is only looping for a single player but the server had two in the game. Extending the script to multiplayer seems troublesome now.......
units player returns units in the player group
In fact you're lucky it even runs once

If you ran it on dedicated server it wouldn't run
Well...... it runs on dedicated server
only problem is it only check my eyes not others
Dedi has no player
Wait.... wha
(also getPos is not getPosASL)
W.... would forEach allPlayers work? or that's a client side and not for server side
Well it's clearly chatGPT generated ๐
involuntary slam ๐คฃ
I did get this partly from the Zeus Enhanced mod as it includes a function to show if a player is visible to a location
If you fixed that and fixed using player maybe
It would work even players joined or disconnects? Like it would updates it self or I had to do the work.
This is why getpos to translate to AGL then be processed to get the distance between two objects
yeah I do realize it when the server loads a lot slower than normally would
what position format does getPos return?
Wait....... 
o.... oh right I don't translation 
well That's one less function to run for optimization
You didn't answer the question tho
It's positionAGL which can be used as parameters for distance
Yes because arma 3 wiki is on my left monitor
Then how come you didn't see it returns positionAGLS? 
:angery:
Hello gang - anyone know of a method to read the items in a crate?
items _crate and itemsWithMagazines _crate don't seem to work
In any case, like I said you have 2 immediate problems: 1. you iterate over units of a group, not all players
2. You use player in your forEach loop
Well it's magazinesCargo, weaponsCargo, etc.
I don't recall if there's an itemsCargo
Don't be angry. Now I understand 
(just kidding, don't worry ^^)
glad you caught it - now on to fix ze issues! โ
I'm afraid this will be the only Arma 3 script I will ever make. But at least I can make it works
. Thanks for answering my silly questions.
getItemCargo _crate;
๐
Is there a way to turn off vehicle laser?
โฆ remove / re-add the battery? ๐ฌ
perhaps force "fire"
Removing and readding the weapon or magazine is what I thought of right away, gonna see if fire does anything ๐ค
action ["UseMagazine" works for sure https://github.com/zen-mod/ZEN/blob/master/addons/common/functions/fnc_fireWeapon.sqf#L86
Thanks, just had this working
Quick Question how to move object back and forward with setVelocityTransformation ? I was able to make object go from pos 1 to pos 2 in time interval but how would i make it so when it reaches to pos 2 to flip direction of travel but keep rotation ?
maths
Does AllCurators not work as intended? I have a script which should add all opfor units as editable for two zeus' using the AllCurators command. Only the first zeus gets the units under his control though.
does exitWith not work inside getOrDefaultCall?
can't see why it wouldn't. Example?
myMap = createHashMap;
private _value = myMap getOrDefaultCall ["key", {
if true exitWith {"value"}
}, true];
isNil "value" // true
might be
sounds wut
myMap = createHashMap;
private _value = myMap getOrDefaultCall ["key", {
if true exitWith {"value"}
}, true];
[isNil "value", isNil "_value", myMap, _value, _totallyDoesntExist] // [true,true,[["key",<null>]],<null>,any]``` somehow `<null>` and `isNil` at the same time 
I'm having this weird error trying to call a variable through params
// fn_spawnCache.sqf
params ["_cachePos"];
_cachePos = _this select 0;
_lootCache = "VirtualReammoBox_camonet_F" createVehicle getPosASL _cachePos;
// Some stuff happens
// init.sqf
// _locationPosition is a valid position. Trust me.
_housesArray = nearestObjects [_locationPosition, ["House"], 1000];
_randomHouse = selectRandom _housesArray;
_positionsArray = [_randomHouse] call BIS_fnc_buildingPositions;
_cachePos = selectRandom _positionsArray;
[_cachePos] execVM "scripts\fn_spawnCache.sqf";
It looks like _cachePos is undefined. Any hints would be appreciated!
inb4 randomly selected house doesn't have any buldingPositions defined 
Hm.
Umm, if u have _cachePos in params, you dont need to do _cachePos = _this select 0
That's right, guess the problem in _randomHouse as artemoz stated.
Is there any boolean function to fetch the nearest building with positions?
did you try giving fn_spawnCache just, known good position?
I'll try!
This one works, yeah
Its helpful to post the script ;)
//Gets array of objects, ja?
_housesArray = nearestObjects [_locationPosition, ["House"], 1000];
//slects random object
_randomHouse = selectRandom _housesArray;
//Gets positions of said of said house
_positionsArray = [_randomHouse] call BIS_fnc_buildingPositions;
//Select random position
_cachePos = selectRandom _positionsArray;
//Pases position as in XYZ vector to spawnCache
[_cachePos] execVM "scripts\fn_spawnCache.sqf";
//FN_SpawnCache.sqf
//Grabs POSITION from params
params ["_cachePos"];
//Does same as above again
_cachePos = _this select 0;
//Grabs a ASL Position OF a position and tries to create va there
_lootCache = "VirtualReammoBox_camonet_F" createVehicle getPosASL _cachePos;
//Should be:
_lootCache = "VirtualReammoBox_camonet_F" createVehicle _cachePos;
So the getPos is a problem!
yes you were trying to getPos a position
As the _cachePos is already a position.
Darn it.
Thank you!~
Works like a charm!
Hiya, is this how you use the params in addAction?
intel_1 addAction ["Search Intel", {
hint format ["%1 Has found intel!", _this select 1 params ["_target", "_caller", "_actionId", "_arguments"]];
removeAllActions _target;
}];
Essentially, I want to make an action that appears once, then after one of the players interacts with it, it completely disappears
I cant use holdAction because intel_1 is a dead unit
no
I guess you can jank it and
private _tf = {if (true) exitWith {"value"}; "not value"};
myMap = createHashMap;
private _value = myMap getOrDefaultCall ["key", {call _tf}, true];
//Or if u like one liners
private _value = myMap getOrDefaultCall ["key", {call {if (true) exitWith {"value"}}}, true];
```But yeah exit with doesnt work for some reason....
the params line usually goes at the top of the script using syntax 1
"script" in this case meaning the code block you pass to the addaction
btw, im looking to redistribute my scripts across folders, right now im using initServer.sqf but im pretty sure there's better ways
description.ext -> CfgFunctions
https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Function_Declaration
You can have multiple classes with different folders or have each function in diffrent folder etc
wheels axis for physx vehicles are stored in wheels class parameter center = "axis_memorypoint123456"; for each individual wheel class
wrap it in another call
yeah, can be worked around for sure. was just unexpected.
Hiya! Thanks for the tip. I began doing a bit of stuff.
Right now i have defined my CFG functions like this, how would my file structure look like?
<ROOT>\Category\intelManager_fn_add_intel_port.sqf
?
amm this has to go into description.ext or config.cpp not "intelManager_fn_add_intel_port.sqf"
yeah, its in description.ext
im asking for what path i have to use to write down my method
like the actual logic of it
as far as i know the classes define the paths for the functions
That will be in <missionroot>\functions\Category\fn_add_intel_port.sqf, since it's from description.ext. But you can change that* by adding file = "your\folder\path"; to the category class
- still inside mission root, you can't set it to arbitrary folders wherever
after you've done that
class CfgFunctions
{
class MyUniqueTag //must be unique class, dont use something like BIS
{
class script
{
file = "myFunFolder";
class myAwesomeFunction1 {};
class myAWesomeFunction2 {};
};
class myOtherScript
{
file = "myNotSoFunFolder";
class myUnAwesomeFunction1 {};
class myUnAwesomeFunction2 {file="fun.sqf"};
};
};
Above stuff Would be in following folder structure
mission.sqm
description.ext
fun.sqf <-- this is file of myUnAwesomeFunction2
myFunFolder\fn_myAwesomeFunction1.sqf
myFunFolder\fn_myAwesomeFunction2.sqf
myNotSoFunFolder\fn_myUnAwesomeFunction1.sqf
file = " ... " defines the folder for that category. Individual file names are detected automatically based on the function names you declare, you don't specify an sqf file in that.
Also, it's \ for file paths, not /
thanks
are methods auto-executed or do I need to call them from the initServer regardless?
no, they are not
- though you can specify a file in the individual function class as Marko showed, but there's not much of a reason to not use the autodetection
but you can do this class myAwesomeFunction1 {postInit = 1;}; //This will auto exec it on post
or you could use preInit or bunch of other fun stuff.
mind you it will execute on all. So you have to do a check inside the script something like if (!isServer) exitWith{};
Yep, i'll make sure
Its all working btw, the scripts work and the path is fine aswell
Also functions get tag appended to call them in other scripts you use (from example above) [] call MyUniqueTag_fnc_myAwesomeFunction
Although, an unrelated problem (haha), the "_target" param returns an array, apparently.
Essentially im trying to remove the action from the dead body for all the clients. but ehh... having trouble.
When running it with postInit, it will execute with no parameters
Order of precedence problem, removeAllActions is being evaluated before select
Add some ()
huh, though _caller seems to be working fine
as of (_this select 0); ?
Yep
3rd line in your script params[] will be usesless you wont get those params out
if you would run [1,2,3,4] call TAG_fnc_add_intel_port you would get _target == 1, _caller == 2, _actionID ==3, _arguments == 4, but now you will get nils for most of these
alrighty
i got all working
thanks yall
see you in 15 mins whenever my next confusing problem appears
are you doing this for multiplayer ?
Then the next confusing problem will appear when you try to play this mission with friend and both will be able to get intel ๐
yeeeahhh that's why i kept asking to remove the action across all clients
any workarounds?
you will have to remoteExec the function since addAction and removeAllActions has only local effect
i see, i could remoteExec it over at initServer.sqf?
something like this, i'd guess?
If you dont intend to remove intel_1 object thru out the whole mission, action will add just fine. If you remove it script will error out for someone who joins late and intel_1 is already gone.
you'd wanna add a check like if (isNull intel_1) exitWith {}
Next as script has local effect, you want to run it on ALL clients not server itself, as server has no GUI it cant see action so instead of if (!isServer) exitWith {} you want if (!hasInterface) exitWith {}
yeah no, intel_1 will be persistent, although I will keep in mind the advice
the second part of the message still applies
yes
Im looking at it rn
i applied it
i will now try it across MP with a friend and see how it goes
is there any other utilities to test across MP?
Would Zeus controlled units count as a client?
im guessing not
it will work as follows: For example your buddy goes there, sees action, collects intel, only HE gets those messages (you dont).
Then you go there, you see the action (Even tho it should be gone), you collect the intel (again), and only YOU see those messages.
if this is desired effect then it will work.
Same for the hint.
oh uhm... I think we are on a different line then
the idea is to disable the action across all clients and hint across all clients
Player 1 -> finds intel
-> Hint is sent all clients
-> action is removed from all clients
i understand, i just told you what will happen with your current script ๐
no
if not i'll just consider making the unit be alive so i can do the hold action system and let it be
alright i guess i'll just make the unit alive
hold action will have same effect ๐
Why this is tricky is cause you have to tell all clients across the network that script is already executed, so all clients can remove action themselves. Same for messages you wanna display
aaarghhh
i'll just drop a computer and good ol arma 3 intel system and call it a day
item pops
if you wanna avoid scripting, thats the best way of dealing with it.
I just dont wanna get into messy networking
otherwise you are looking at something like this:
Client picks up intel with action -> addAction scrip uses remoteExec to tell server, to tell all clients to run a different script -> That script would display the messages to said clients, and remove action from intel_1 object (including the client that triggered the action)
Checking before i fully commit to using a mobile phone (new); you cant take a normal GPS object and track it as a separate entity or rename it, right?

Okayyy, here's the method i made.
@stark fjord
fn_clear_intel.sqf
params ["_objectName"];
_object = this select 0;
removeAllActions(_object);
fn_add_intel_port.sqf
if (!hasInterface) exitWith {}
intel_1 addAction ["Search Intel", {
hint format ["%1 Has found intel!", _this select 1];
diag_log format ["%1", _this select 0];
["intel_1"] remoteExec ["TAG_fn_clear_intel"];
}];
Scenario is, players find an abandoned truck and search it for clues, finding a dashboard GPS that needs to be handed off to be decoded.
I previously just used a normal GPS, but all the players have one already and I cant figure out a way to cleanly divide 'GPS in my pocket already' from 'GPS in this truck's inventory'.
I replaced it with mobilePhone_new and rewrote the dialog, but im curious if there was a way I could make a clean distinction.
Hey, can somebody please help me cracking this?
i want a sentry behind a searchlight to check 4 points while he is still alive
this is what i have and it gives error because it cannot be suspended, can somebody please help me fix it?
`SMK_fn_doWatchJedna = {
0 spawn {
SMK_svetloJednaG doTarget SMK_svetloJednaCil_1;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_2;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_3;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_4;
sleep 5;
} remoteExecCall ["spawn", 0, false];
};
while {true} do {
if (alive SMK_svetloJednaG) then {
[_this] call SMK_fn_doWatchJedna;
};
sleep 21; // Wait 21 seconds before checking again
};`
Syntax is busted on the first part. Not even sure how it interprets that.
when i only call for the function it works just fine i just need to loop it somehow
Probably works:
SMK_fn_doWatchJedna = {
SMK_svetloJednaG doTarget SMK_svetloJednaCil_1;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_2;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_3;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_4;
sleep 5;
};
while {true} do {
if (alive SMK_svetloJednaG) then {
[] remoteExec ["SMK_fn_doWatchJedna", SMK_svetloJednaG];
};
sleep 21; // Wait 21 seconds before checking again
};
remoteExec (not -call) runs in scheduled anyway so you don't need a spawn. Function only needs to exec where your unit is local because doTarget is local-argument global-effect.
it gives the same error which i didnt solve "Suspending not allowed in this context"
Maybe quote which line it's complaining about :P
but I guess you're running the code in unscheduled in the first place.
probably simplest to just move everything to the local function.
SMK_fn_doWatchJedna = {
while {alive SMK_svetloJednaG} do {
SMK_svetloJednaG doTarget SMK_svetloJednaCil_1;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_2;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_3;
sleep 5;
SMK_svetloJednaG doTarget SMK_svetloJednaCil_4;
sleep 5;
};
};
if (alive SMK_svetloJednaG) then {
[] remoteExec ["SMK_fn_doWatchJedna", SMK_svetloJednaG];
};
The if is probably redundant. Depends on setup.
Code assumes that the locality of the unit doesn't change.
Actually, can I sanity check where you're putting this code...
well firstly into console just to get it working, from there i will manage im still not sure if i will put it into trigger or sqf i might add little bit of complexity to it
Result:
0.0191 ms
Cycles:
10000/10000
Code:
for "_i" from 1 to 50 do
{
configFile >> "cfgVehicles"
};
Result:
0.008 ms
Cycles:
10000/10000
Code:
private _test = configFile >> "cfgVehicles";
for "_i" from 1 to 50 do
{
_test
};```
initially i thought caching data read from config would useful
however when we tested with getText for simulation type, getVariable was slower
above though again seems to indicate at least certain parts of config access would make sense to cache if you do it very often/frequently
That code looks familiar ๐
Not sure what you think that's demonstrating really, other than fewer commands => faster
configFile >> "thisDoesntExist" is only slightly quicker than configFile >> "cfgVehicles"
MissileCore should detect the Vorona, and does in my usage
Does anyone know what happened to the Server Transfer scripts (i.e redirectClientToServer)? All posts seem to be dead, not sure if anyone ended up polishing it or not
Almost, but you need to do some more switcheroo like this:
fn_add_intel_port.sqf
//This script will execute on all clients because we used postInit=1 in CfgFunctions
//If something doesnt have interface (is not a player) we dont run this
if (!hasInterface) exitWith {};
intel_1 addAction ["Search Intel", {
//Here we get action parameters
params ["_target", "_caller", "_actionId", "_arguments"];
//We remote execute script on all clients, even if self hosted, we pass it two params:
//Who did the action, and what was action done on.
//Here you could safely use [player, intel_1] instead
[_caller, _target] remoteExec ["TAG_fnc_clear_intel", [0, -2] # isDedicated, true];
//Last true means that it will be sent to client, even if they join later/in progress
}];```
`fn_clear_intel.sqf`
```sqf
//This script will execute on all clients, because of remoteExec once one player does the action
//Grab parameters we gave it in remoteExec above (player and intel object)
params ["_caller", "_target"];
//Print the hint. Print all your other messages here too.
hint format ["%1 Has found intel!", _caller];
//Remove all actions from intel object
removeAllActions _target;```
is there a limit to how far out position setting works? 
wowzies
thanks
what's with 0, -2?
Idk if it still works but this:
http://killzonekid.com/farewell-my-arma-friends/
If you are looking for something like Spotlight button to connect (middle button on main dashboard) you can use thishpp class CfgMainMenuSpotlight { class CoopCampaign { text = "Connect to my server"; textIsQuote = 0; picture = "\myAddon\picture.paa"; video = "\myAddon\video.ogv"; action = "connectToServer ['IP',PORT,'Password']"; actionText = "Connect to my server"; condition = "true"; }; };
https://community.bistudio.com/wiki/connectToServer
Has to be done via mod tho.
yes, 50k maximum in positive dir
[0, -2] # isDedicated if server is dedicated, eg its running on its own box with no interface, it does not need to run this.
isDedicated will return true -> [0, -2] # true -> this will select -2 and remoteExec will not execute the script on server.
However if you are hosting from ingame, you are player and server at the same time, and you want this script to run on you also.
in that case isDedicated will return false, select 0th index in array, so 0 and remoteExec will run on all
Has anyone made a custom arma 3 lobby screen when you join a MP server?
Yeah well i dont have access to it right now ^^ Just thought it ask if there were any known issues.
I've already done the Spotlight Button, I'm trying to switch clients from one server to another
Then first link
anyone got a better way to write this?
arsenal_whitelist_weapons_US = [
"CUP_lmg_M249_ElcanM145_Laser",
"CUP_arifle_mk18_tan_holo_laserflash",
"CUP_lmg_Mk48_des_Aim_Laser",
"CUP_arifle_Mk20_LeupoldMk4MRT",
"CUP_arifle_mk18_tan_holo_laserflash",
"CUP_arifle_mk18_tan_holo_laserflash",
"CUP_arifle_mk18_m203_tan_holo_laserflash",
"CUP_arifle_mk18_tan_holo_laserflash",
"CUP_arifle_mk18_m203_tan_holo_laserflash",
"CUP_arifle_mk18_tan_holo_laserflash"
];
arsenal_whitelist_acc_US = arsenal_whitelist_weapons_US apply {
private _properties = configProperties [(configFile >> "CfgWeapons" >> _x >> "LinkedItems")];
_properties apply {
getText (_x >> "item");
};
};
arsenal_whitelist_acc_US = flatten arsenal_whitelist_acc_US;
arsenal_whitelist_acc_US = arsenal_whitelist_acc_US arrayIntersect arsenal_whitelist_acc_US;
kinda heavy getting better
Execution Time: 0.0958 ms | Cycles: 10000/10000
Skip on extra vars and functions
Also since this list seems to be static, just preload it once during mission loading
yeah its gonna be only once anyways. just trying to reduce loadtime so I'm picking through stuff
I looking for a way to create camera on users interface that takes up about half the screen? Help.
I figured it out ๐
Im trying to create to independent camera's. Both camera scripts work independently. However when added together... Only 1 of them works. Help. ```//FRONT LEFT WINDOW//
camera1 = "camera" camCreate [0, 0, 0];
camera1 camCommitPrepared 0;
camera1 camPrepareRelPos [0, -5, 10];
camera1 camPrepareFOV 1;
camera1 attachTo [car, [-0.79, 0.4, -0.4]];
camera1 cameraEffect ["internal", "back", "rttName1"];
if (!isPiPEnabled) exitWith { systemChat "PiP is not enabled in video options"; };
with uiNamespace do
{
private _ctrl = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [safeZoneW * 0.205, safeZoneY, safeZoneW * 0.5, safeZoneH * 1];
_ctrl ctrlSetText "#(argb,512,512,1)r2t(rttName1,1.0)";
_ctrl ctrlCommit 0;
};
camera = "camera" camCreate [0, 0, 0];
camera camCommitPrepared 0;
camera camPrepareRelPos [0, -5, 10];
camera camPrepareFOV 1;
camera attachTo [car, [-0.9, 0.45, -0.4]];
camera setDir -90;
camera cameraEffect ["internal", "back", "rttName2"];
if (!isPiPEnabled) exitWith { systemChat "PiP is not enabled in video options"; };
with uiNamespace do
{
private _ctrl2 = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscPicture", -1];
_ctrl2 ctrlSetPosition [safeZoneW * -0.295, safeZoneY, safeZoneW * 0.5, safeZoneH * 1];
_ctrl2 ctrlSetText "#(argb,512,512,1)r2t(rttName2,1.0)";
_ctrl2 ctrlCommit 0;
};```
camera cameraEffect ["internal", "back", "rttName2"];
"rttName" setPiPEffect [0]; <----- Same? ---- ^
aren't you wanting these to be the same?
Yes. Updated. No luck.
well when you do the first camera effect, you are moving your perspective to that camera, you then override that perspective the next time you use cameraEffect later
One cannot mix and match cameraEffect and can either have multiple r2t cameras or a single camera for the whole screen.
addCuratorEditableObjects only works on the server. maybe thats the issue.
as Quicksilver said...
yeah that sample isnt really telling anything
we tried stuff like
_isTank = _vehicle getVariable "TEST_isTank";
if (isNil "_isTank") then {
_isTank = _vehicle isKindOf "Tank";
_vehicle setVariable ["TEST_isTank",_isTank];
};
or
_isTankSuper = (getText (configFile >> "cfgVehicles" >> (typeOf _vehicle) >> "super")) == 1;
the profiling via the console said direct sqf command is quicker than the getVariable access
Well, the isKindOf one certainly isn't worth it.
Even if you did the setVariable on vehicle creation so that you didn't need the conditional lookup.
The getText one would be a small improvement but doesn't seem like a good tradeoff in code complexity.
I'd stick to caching stuff that's actually slow.
@velvet merlin New getOrDefaultCall is a great feature to cache config stuff
someConfigPropertyCheckCache = createHashmap;
...
someConfigPropertyCheckCache getOrDefault [typeOf _this, {
getText(configOf _this >> "simulation") == "UAVPilot" && (_this isKindOf "Whatever")
}, true];
Maybe also wrap that into a function but that's additional scope
Wrap into #define for additional drop of performance
#define MY_CONFIG_CHECK(VEH) someConfigPropertyCheckCache getOrDefault [typeOf VEH, {\
getText(configOf VEH>> "simulation") == "UAVPilot" && (VEH isKindOf "Whatever")\
}, true]
MY_CONFIG_CHECK(player);
careful tho, in some uses its better performance to simply do the "getX (configfile ..."
is there a way to find if something on screen is covered by part of a gui element (not including transparency)? sounds like it wouldnt be too performant if it is possible in a3
inb4 worldToScreen + ctrlAt
usually nil's are <any> because the game returns a Any typed nill.
But a untyped nill is also possible its just a nil with <null> type
And _isTankSuper = (getText ((configOf _vehicle) >> "super")) == 1; will be even faster
display param is supposed to be 46 not an IDD right?
or whatever the main screen number is
oh finddisplay exists amazing
onEachFrame {
private _screenpos = worldToScreen ASLToAGL getPosASL jeffbezos;
systemChat str ((findDisplay 1044) ctrlAt _screenpos);
};``` should work then? returning no control with ace goggles bits
ah, how would I find the display for that? or is that not possible?
It registers its display using setVariable
Find its name by checking its config or source on github
I used findDisplay "RscACE_Goggles" with no dice either
can someone poiint out what i've missed here?
// Log the shit that Zeus does...
// Zeus Logging
_zeus = ['adminZeus_1','adminZeus_2','z1_module','z2_module','z3_module','z4_module','z5_module','z6_module','z7_module','z8_module','z9_module'];
{
_x addEventHandler ["CuratorObjectRegistered", {
params ["_curator"];
private _scriptName = "Zeus Log";
private _message = format ["%1 has become Zeus", profileName];
[3,_message, _scriptName] execvm "scripts\performance\log.sqf";
}];
_x addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
private _scriptName = "Zeus Log";
private _message = format ["%1 has placed: %2", profileName, _entity];
[3,_message, _scriptName] execvm "scripts\performance\log.sqf";
}];
_x addEventHandler ["CuratorObjectDeleted", {
params ["_curator", "_entity"];
private _scriptName = "Zeus Log";
private _message = format ["%1 has deleted: %2", profileName, _entity];
[3,_message, _scriptName] execvm "scripts\performance\log.sqf";
}];
} foreach _zeus;
12:19:20 Error in expression <module','z8_module','z9_module'];
{
_x addEventHandler ["CuratorObjectRegistere>
12:19:20 Error position: <addEventHandler ["CuratorObjectRegistere>
12:19:20 Error addeventhandler: Type String, expected Object,Group
Well, literally the error says
Not sure what is the intention and what those _zeus array do so can't really say what to fix
The zeus array is the named modules for gamemaster
So like adminZeus_1 is the name of the Game Master module and so forth?
Yep
Then get rid of ' for those _zeuss
oh right, just have it as [adminzeus,ect]
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
I said getVariable...
tried that too but just realised i was trying the wrong one, one mo 
ya i was looking at the effects one, mb
onEachFrame {
private _screenpos = worldToScreen ASLToAGL getPosASL jeffbezos;
private _display = uiNamespace getVariable "ACE_Goggles_Display";
systemChat str ((_display) ctrlAt _screenpos);
systemChat str _screenpos;
};``` also isn't working though isn't throwing any errors, `_display` matches IDD and screenpos is changing when you look about, fails when object not on screen
Yes you should check if screenPos is empty
it's returning systemchats of expected coordinates and no control
[Control #10650] returned by sqf private _display = uiNamespace getVariable "ACE_Goggles_Display"; allControls _display;
would be my guess -- how would I know from its config? not too well versed w/ gui bits
See which class its defined in
rsctitles
Controls vs ControlsBackground
oh
controls i presume then
https://github.com/acemod/ACE3/blob/master/addons/goggles/RscTitles.hpp#L13
Yeah. Dunno then
probably more hassle than its worth rather than just putting icons across the whole screen rather than hiding hud outside of glasses
What are you trying to do tho?
make a hud that doesnt appear over the ace goggles gui
hud part is easy thats just drawicon3d etc
Planning to do some small scale RP stuff with my friends.
I have few civilian vehicles on the map just driving around with waypoints, so that the roads aren't just empty of all traffic.
What would be the best way to make sure the cars driving around don't run out of fuel, but don't have too much either in case my players decide to... "borrow" one.
if (!isServer) exitWith {};
[this] spawn
{
params["_vic"];
while {alive _vic && local _vic} do
{
_vic setFuel 0.5;
sleep 600;
};
};```
If your mission spans a large area and you want to place many cars I advise that you spawn a few and just teleport them around
True, but if he has em set i guess that script would work. If player takes driver, script will end. Or vic gets destroyed
Allright
As for this, it's better to just use a single loop for all those vehicles
I guess. But easier for non versed to just copy pasta into init. And then copy paste as many as you want.
I hope he wont have 50 of em.
I would say it's equally easy to do this:
- Place all vehicles in a layer
- Do this:
{
_x setFuel 1
} forEach getLayerObjects "layer"
In a loop
(Can't type or check bc I'm on mobile but I guess it's understandable)
getMissionLayerEntities
synced "Logic" object with code in its Init ๐ง
It's just a small area. I have 4 cars following various waypoint i set to cycle. Idea being that they pass other vahicles occasionally.
oh, hey, we've invented Modules again ๐
So I just slap that onto the vehicle?
I got http://pastebin.com/kQrBdfRQ this in my init.sqf
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fuel
this addEventHandler ["Fuel", {
params ["_vehicle", "_hasFuel"];
if (!_hasFuel) then {_vehicle setFuel 0.5;};
}];``` 
I guess I could also manually change the fuel of any vehicle they "borrow" as Zeus.
Would that make it simpler to make sure they don't run out of fuel while NPC's just drive around?
Most of the solutions posted here are functional and pretty simple. They're just arguing about the most best way to do it. You can just pick whichever one you like, with only 4 cars it won't make much difference.
Whitelist certain weapons
out of the ACE Arsenal
how would I go about doing this?
Only ace goggles?
ya
Well... just check if the "ace_googles_display" ui var isnil. If it aint show, if it is dont show...
Or you wanna layer it underneath ace goggles?
no as in
if you have goggles on it wont show on the goggles part, only the transparent part ๐
Ooh, so like scale it? To fit actual "cut out area"?
"behind" the goggles drawing
like this where black boxes are bits of ace gui
but i cannot layer with drawIcon3D so it would just need to stop drawing if the object is under the gui
What if you make your own rsc?
needs to be drawicon3d'd
God damn 3d.
its not the end of the world if icons show through the gui tbh
was just wondering if its doable
I mean ace goggles just draw picture over whole screen and stretch ot to fit. So unless u check transparency of pic... idk
its no big deal, more performant without 
Doesn't add rabbits snake and fish for me :D
Btw is nowdays any "clean" method for transforming players into ragdolls on demand.
By clean i mean without hitting them with heavy objects at high speed?
BIN_fnc_setRagdoll exists but idk how clean it is
ACE goggles display doesn't have "bits"
addForce
if you have transparency in the texture
Well that's the thing. It's just one texture
You have to calculate the black areas yourself
Per texture
And if they changed their textures your feature would break ๐คท
Many tanks
Also there is BIN_fnc_setRagdoll however it has evil little text in description
This content is exclusive to the Arma 3 Contact Expansion.
Yes BIN functions are for Contact DLC
given the parameters it takes, it seems to be same exact function
with a check for typeof "Man"
// Exit if _unit is not a man
if(!(_unit isKindOf "Man"))exitWith{};
// Disable damage
private _damageState = isDamageAllowed _unit;
if(_damageState)then{_unit allowDamage false};
// Create collider and increase its mass
private _pos = (AGLtoASL(_unit modelToWorldVisual (_unit selectionPosition _position))) ;
private _collider = "ObjectCollider_01_small_F" createVehicleLocal [0,0,0];
_collider setMass 10^10;
_collider setPosASL _pos;
_collider setVelocity _force;
``` ๐
copypasted from BIN_fnc_setRagdoll
should be "CAManBase" ๐ฌ
Even they use dirty trick ...
hey, what if you want to ragdoll a butterfly?
// Exit if _unit is not a man
like I said the addForce version is added recently
there was no other way back then
_butterfly isKindOf "Man" meme https://imgflip.com/i/7jg95y
ill try it... as soon as 35 gb finishes downloading. But im already in a predicament if this will be good enough.
You see i have a monster and i want it to drag the player for certain distance and then toss them somewhere.
setForce will work fine for tossing... dragging will be a different bridge to cross.
lift player with (optionally invisible) rope
will that ragdolize them?
is there a publicVariableServer for individual namespaces etc or do i need to getvar + setvar
i dont want them to be standing behind the monster with default arma "this is fine" expresion
It won't start a ragdoll, and you can't move non-ragdoll players with ropes since they aren't PhysX. But you can ragdoll them (e.g. addForce), then attach the rope, and drag them while they're ragdolled
thanks, will try, also, how long will they stay flacid?
I'm pretty sure they'll be limp as long as they're being moved around
cool. T. Hanks
Alternatively, you can force them into a downed animation and attachTo them to the monster ๐คท
did that so far but it looks silly. Since monster jumps around quite a bit
ill try the rope (no, not like that). Might be just what im looking for.
For reference its a smoke monster from lost. So it tends to be quite jumpy and quite throwy from time to time, to physically break player and not outright kill them. With ACE breaks bones etc
Because people automatically recover from being ragdolled, since they have arms they can use to get back up
Well, it would be nice if we could control it somehow, imagine a player "fainting" midair and switching into a revive state, looks pretty annoying
Maybe they aren't spawned at that point
or have ragdoll fights or qwop
hmm no matter what i do, i cant string the player.
Neither in "alive" state, as ragdoll or as unconscious.
it just stand still until rope stretches enough to break
Hi, so I have this holdAction that when complete, calls execVM "script.sqf"
And in that script, I've got things like:
["tsk_getAirdrop","SUCCEEDED"] call BIS_fnc_taskSetState;
chemGet = true;
publicVariable "chemGet";
jesterDummy setGroupId ["JESTER I/O NODE 451"];
jesterDummy sideChat "Sensors indicate you have opened the crate.";
sleep 2;
jesterDummy sideChat "The chemical detectors have been modified to seek out trace anomalous readings.";
sleep 2;
jesterDummy sideChat "Please take them with you.";
player createDiarySubject ["keyItems","Key Mission Items"] ;
player createDiaryRecord ["keyItems", ["Anomalous Detector", "You've been given a modified chemical detector. <br></br><br></br>Your friend says it's been modified to be helpful to you.<br></br><br></br>Show it briefly by holding <font color='#FFA600'>O</font>: Toggle it onscreen by double-tapping <font color='#FFA600'>O</font>."]];
systemChat "Key items listing updated.";
** I now understand that this will not properly give the task to all players because of locality issues and only the person triggering the holdAction getting the proper messages and diary record. **
How can I refactor this code to send the same messages to all players (co-op zeus mission) and add the same diary entry to all players?
remoteExec
what is your holdAction code?
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
what, @little raptor
isn't what he posted the addAction code? 
I admit I'm cheating and using eden enhanced, so the execVM is just in one of the boxes (on completed). But the proper invocation for this, I think, would be:
[
airdropCrate,
"Open Airdrop", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{ execVM "script.sqf" },
{},
[],
3,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, airdropCrate];
(ignore the incorrect icons, I just grabbed from the wiki real quick)
I have the good fortune to know that things like the global variable DO fire correctly for everyone in the mission
so the problem is my player createDiaryRecord
etc
and asking allows to see if the action is added to everyone
Everyone has the action, everyone can see SOME consequences of the action but not others
the chat messages from Jester don't work for anyone but the person touching the crate
same for the diary entry
because they're targeting player
instead of every hasInterface or something
I am 99.99% sure I know what is wrong, just not how to write it correctly
yep
also, you don't want that action to be available once one person has activated it (I suppose)
I'm limited by not knowing the language too well
wtf are those spaces/tabs
I'm unworried about the holdAction itself, since I'm using the editor plugin.
So should I just be calling the same script with remoteExec? it still feels wrong to use player here
Artefact of removing wiki comments.
fair
I'd like to do this in a "best practice" sorta way
instead of being An Shitter with bad code
dirty but easiest way would be to remoteExec every single one of the functions in your script. Except sleep and publicVariable.
and add !chemGet to condition, so action disappears once someone completed it.
You mean, remoteExec every sideChat and createDiaryRecord?
unless this is the place where chemGet is declared, in that case use !isNil "chemGet"
Also, is there a less dirty way that's worth pursuing in service of being a better scripter
create a function file, declare it via CfgFunctions inside description.ext, inside function file write part that would be executed on all clients.
Inside your action remoteExec that single function on all clients.
why is it, that
playSound3D ["a3\missions_f_tank\data\sounds\powergenerator.wss", generator, false, [6516.65,20010.7,0], 5, 1, 0];
plays the sound as expected but
playSound3D ["a3\missions_f_tank\data\sounds\powergenerator.wss", generator, false, [6516.65,20010.7,0], 5, 1, 100];
does not? Only difference is the last parameter (being the distance) 
are you within 100 m of [6516.65,20010.7,0]?
yes ^^ im within 1m ๐
Try position generator. Instead of hardcoded position. Or give it nil instead
well, i used the log 3dPos to clipboard option, so unless that is not working correctly, it should be the same
Ok, found the issue
the 3dPos gave me the PositonATL where as playSound3D needs PostitonASL, and since i was 170m above water I didnt hear it ๐คฆโโ๏ธ
thanks for the reminder ๐
The talk feature does not work w me
"Animal" isKindOf "Man"
-> true
A single function for each briefing / cutscene thing? That actually makes sense, wow, and then I don't need a different file for every object.
Thank you!
I did have another question
_heading = rad1 getDirVisual obj_laptopEnc; _heading = round _heading; _caller sideChat format["The transmission in the logs has a listed direction of roughly %1.",_heading]; tri01 = true;
This is intended to force players to triangulate a signal's position during the mission by giving them a compass heading
however, even though the targeted object was properly placed and named and worked in all the other scripts, in this script both of the triangulation computers gave the same heading that was also the wrong heading.
Any thoughts?
what would be rad1? and i assume obj_laptopEnc is an object?
yeah
I think
I just realized what I did wrong
I need to check
Ash you dumb bitch
I copied and pasted the laptop without changing rad1 to rad2
goddamnit
Also "PaperCar" isnt car at all ๐ฆ
Okay, turns out you can tow "alive" player, if you nudge them a little bit with setVelocity. If player is standing on ground rope just breaks. However you cant tow a ragdoll / rope instantly snaps.
Interesting.
By the way, is there a better way to get a fake entity to speak than making some dude and dropping him off in the middle of the ocean so you can use him with
jesterDummy setGroupId ["JESTER I/O NODE 451"];
jesterDummy sideChat "Sensors indicate you have opened the crate.";
or is that actually the way to get a fake speaker
Also, missionNamespace is reset whenever the mission restarts, right?
I don't need to worry about carryover?
yea
Sorry for the noob question but I'm trying to make an "elevator" for a mission I'm working on with scripts. currently I managed to get a teleportation script working to represent the transition from the bottom floor to top and I am currently trying to add some sound effects to go with it but I feel in way over my head. I've tried comprehending the forums but I don't understand any of what there talking about, if anyone can point me to a good source or can help me understand what Im doing wrong it would be greatly appreciated.
i'm having some real issues getting an rsclistNbox to display a background colour, I've set the colour in the hpp definitions and also tried to set it in the script that uses it, is there an issue with listNboxes ??
do you have a sound you want to play
I've been trying to play the base game "Alarm" sound effect
what have you made so far
Currently I have a script that fades the screen to black, telepprts the player then fades back into focus. I'm trying to then add sound effects to it to make it sound like an elevator moving
I want to see it. Post it either with code block or sqfbin.com
Gimme a sec and I can post it
Script currently on the button the players interact with
@fair drum script currently on the trigger attempting to play sound
Hello,
Should default values in item config (CfgVehicles - - MyItem - attributes )
active when I'm not changing those?
Currenlty they doesn't.
Is there some line or something what I'm missing.
I have done attributes with this example
class CfgVehicles
{
class B_Soldier_F;
class MyEntity: B_Soldier_F // Your entity class
{
class Attributes // Entity attributes have no categories, they are all defined directly in class Attributes
{
class MyEntityAttribute
{
// ... attribute properties, see entity attributes
};
};
};
};
So can I some way apply defaultValues of attributes, or do I have apply every attribute to save them.
In expression I have like in example.
expression = "_this setVariable ['%s',_value];"
And I getVariables which I have apply (changed) from attributes in editor.
Hi
How Can i detecte when player aim with her weapons ?
Do you mean ads?
Aim down sight
either make a custom thing with https://community.bistudio.com/wiki/cameraView or use an event handler https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#OpticsSwitch
Yes, or just aiming with the gun
Thanks, i will check that ๐ช
if (_weapon isKindOf ["Pistol"]) then {
_unit fire _weapon, round(random 3);
};```
@warm hedge So the first code I just want to delay the reload animation speed
the second part is I want to make the unit with a pistol not fire only a single round, but consectively randomly between 1-3 rounds, for example when you are far away from AI it shoots once every like 5-10 seconds? but once you are closer it shoots consectively, thats what I am trying to achieve even if the AI is detecting far away
First part and second should work separately? Are not a part of one big code?
CBA_fnc_addEventHandlertakes no such arguments, first should be string second should be code- You can't make the reload animation slower or quicker
- Your second part does not do anything more like syntax error.
- Since I don't really know when/how the second part will happen, I really cannot answer this
inb4 chatgpt
what about setWeaponReloadingTime
That won't do either
https://community.bistudio.com/wiki/setWeaponReloadingTime
Description:
Sets reloading phase on the given weapon's current ammo round.
aaahhh
the second part should just make the ai shoot consecutive shot even if the enemy is far away
I'm not asking what it does, but when it does
When the AI sees the enemy
Regardless if they aim at the enemy or not?
they have to be aiming at the enemy
AI sees enemy, turns around to its position, aims, randomly fires 1 times, then maybe 2 times consecutively, then back to 1, idk how complex that would be.
Well, I actually don't know what is wrong with the current AI
with pistols, they aim at you but shoot one time, long pause, shoot one time, long pause, shoot one time, its not really realistic
Well, it does it for me like only 0.5 seconds, but anyways I'll make one
this addEventHandler ["Fired",{
params ["_unit","_weapon","_muzzle","_mode"] ;
private _scripted = _unit getVariable ["_scripted",false] ;
if (_weapon == handgunWeapon _unit and _unit ammo _muzzle != 0 and !_scripted) then {
[_unit,_muzzle,_mode] spawn {
params ["_unit","_muzzle","_mode"] ;
for "_i" from 0 to 2 do {
sleep ((random 0.05) + 0.10) ;
_unit setVariable ["_scripted",true] ;
_unit forceWeaponFire [_muzzle,_mode] ;
_unit setVariable ["_scripted",false] ;
} ;
} ;
} ;
}]```
great, that helps
waitUntil {_x distance _rearmtarget < 5 } forEach units group player - [player];
How can I check if my AI squad is in range of an object? The one above gives an error.
Hi there, looking to build a FOB script but I am struggling to work out the array format [x, y, z] of every object. Is there a way I can build the FOB in the editor and then generate the position code from the editor? An example would be placing a 10m x 10 square Hesco barrier down and then placing 50mm raised on each corner of the barrier. I can build that in the editor but not sure how to write the code specific positioning.. example for my 50mm raised gun
Sounds like https://community.bistudio.com/wiki/BIS_fnc_objectsGrabber/https://community.bistudio.com/wiki/BIS_fnc_objectsMapper kind of job
Easiest to reproduce workflow would probably be: place objects on VR map, give one object some variable name, start preview in editor, press Esc, run objectGrabber around that object
Does anybody have any stats for how much quicker a bunch of ifs are compared to switch true
the Code Optimisation page yes
Ah thanks
Next question, is it possible to exceed 5 for playSound3D volume? Increasing gain on audio file causes it to lose quality too much
My explosion is too quiet ๐ฆ
no.
i will calculate the delay due to the speed of sound and increase sfx volume for a split second then
I'm not sure playSound3D is actually affected by the speed of sound
it is
at least when ive been using it ๐คท
already did camera shake synchronised to when sound is heard so it's not far off
though it doesnt use the exact speed of sound
thank you mate
hey when I export a faction + images (to file) on ALiVE Orbat creator, where is the file located?
or is it copying to the clipboard and I did not understand it correctly
see ALiVE documentation ๐
Is there a pssibility to prevent someone from shooting at all? Even enableSimulation false allows the player to shoot.
is taking away their weapons or ammo not an option?
using the boxloader mod.. I noticed I can only place down boxloader containers from the zeus function and I cannot find these containers in the editor, with all mods running. Has anyone else came up against this issue and found a fix to spawn boxloader containers outside of using zeus? cheers
Found the containers under civilian. Hope this helps someone else ๐
I know there's an easier way to do this, and also I wanna sue lazy eval.
if((!((!(_turret_point isEqualTo objNull)) && (_turret_point in turret_points_all))) || (!(_turret_className isKindOf "AllVehicles")))exitWith{
if turret point is objNull, or if it isn't and it isn't in known turrets, or if the turret classname isn't a valid vehicle class, exit with.
Oh I think I wrote it wrong too- well, thus is why I hope to simplify it and am asking for help xD
if it's objNull, then no need to look in the turret points array, nor look at classname. If it's not objNull, then check if it is a valid turret spot, if it isn't, again, no need to look up the classname. If valid object, the look up the classname to ensure it's a valid vehicle.
Lmk if you can help, I'ma continue working on the rest of the code. :P
||Oh also, maybe a check for turret_points_all? or is that too much error checking redundancy? xD||
Now, i might be silly but sqf will evaluate all checks in if. Even if they are all and and first one fails.
If what i said above is true. Then best way would be to nest ifs
if(isNull _turret_point) exitWith {};
if!(_turret_point in turret_points_all) exitWith {};
if!(_turret_className isKindOf "AllVehicles") exitWith {};
Or if you have some code inside exitWith do a lazy eval condition:
if(
isNull _turret_point
|| {!(_turret_point in turret_points_all)}
|| {!(_turret_className isKindOf "AllVehicles")}
) exitWith {...code...};
Oh wait, you have different conditions in there, lemme fix
className isKindOf would need inverting, I think
also, wait a sec- I should be able to reduce it a tiny bit. When the className file is loaded, it goes through a thing to confirm it exists already. I could take the preset init's and combine into an array, and check className against that.
(I assume isKindOf basically goes through all of "AllVehicles" to see if it exists in there x3)
It goes through all left operand parents to see if AllVehicles is one of them
wait, if I give it "Akesm" (random letters) and see if it's kind of allVehicles- will it error or?
I like how I can test that
The more I look at your original condition the more it confuses me
It will just be false
yes :)
see this.
Are you trying to check if your turret point exists in turret_points_all and of AllVehicles parent class?
2 different variables
Can you have _turret_point as null but some valid class in _turret_className at the same time?
Ok, both my conditions should work then
function that spawns the turret then returns it. Spawning className at the turret point, correct position and direction, and- MAYBE a collision check? no idea how to do a collision check xD
Depending on what you're checking against and how precise it should be
lineIntersectsSurfaces for precise checks, but its closly
otherwise you can do quicker bounding box checks
could maybe also just sleep for a moment and see if it's dead :P
would be costly tho
no not costly, but yk
My code snippet to check if position is inside entity bounding box
Can be optimized even more by caching inArea array
Won't work for objects which have huge empty spaces in their bounding boxes
B/c-
To check collision you'll need something more complex, yeah

Like, if the static gun in the first image spawns something it shouldn't, it might be able to jiggle around a bit before finding it's way out. But if the AA gun does-
I could maybe do a set up sorta thing-
Check if static turret bounding box is not too big perhaps
B/c I have those pads with names. So if static_weapon_point_light is given an AA gun heavy gun, it could deny it.
or I could just say yolo and deal with it if it breaks xD
If set up properly, it shouldn't spawn an AA gun in a small area, so :P
Yea, I think I will just trust it to be set up right. If someone puts a big turret in a small spot, then that's on them :P
if(
isNull _turret_point || {!(_turret_point in turret_points_all)}
)exitWith{};
if!(_turret_className isKindOf "AllVehicles") exitWith {
oh wait
Keep on scripting and someday your scripts will take over the world
if only it was taking over the world by not slowing things down trying to make them better x3
does a million redundant checks, but also causes it to take forever to do them by mistake
if(isNull _turret_point || {!(_turret_point in turret_points_all)})exitWith{
["Invalid parameter, turret point is invalid. (%1 in turret_points_all == false)",str(_turret_point)] call BIS_fnc_error;
objNull;
};
if!(_turret_className isKindOf "AllVehicles") exitWith {
["Invalid parameter, turret class not found. (%1 isKindOf ""AllVehicles"" == false)",str(_turret_className)] call BIS_fnc_error;
objNull;
};
I think this is it.
Also, isNull, is that just "x isEqualTo [objNull/controlNull/scriptNull/etc]"? As in, universal null check sorta thing?
use it to check if it's null version of anything
I think you need the 2nd setVariable
think
I've seen people do the 2nd set so
You are sending the variable in its current state
The variable doesn't know it has been sent. The pushback won't know it should network sync. So it won't
If you change the value, you need to send again
Yea, I was thinking that
Hmm- Should I look up the offset when spawning the turret or give the offset to the spawner function- Giving to spawner function might let it be faster, but also it'd make more sense if the offset was always used when spawning...
Oh also- heh- Should I make there be a way to do high/low weapons? If so, how would I say "This spot can have high or low, this can have only high" xD
This is where ray cast would work
cast a ray to see if approximate low tripod barrel would be
You can also do that dynamically by checking barrel position of a gun you're spawning
ray casting always is weird for me xD
oh, I know which guns would be high/low
But it'd be to check if the high/low can do there or if they'd just be hitting a wall :P
The idea would be: Spawn simple object a a turret you want to place, find offsets of its barrel, cache the result for that model, delete simple object, cast a ray with barrel offset against the object you're trying to put your static weapon in, see if it hits the object.
Even more complex would be spawning your tower as a simple object too, casting there (so other objects aren't blocking your check cast ray on a real one), cache that too
simpler way, although more complicated set up, might be to either make it part of the global object name or make a variable be set in the object's init field
I actually kinda like the name though-
"static_weapon_point_heavy" "static_weapon_point_heavy_high" "static_weapon_point_heavy_low"
any, only high versions, only low versions.
Premade lists and setups are fine, but not flexiable because they require manual input work
yea
If you'll go down ray casting path, I think you need to check gunBeg and gunEnd of the turret config
I might look into gunBeg for heavy weapons or something. So I can attach a light to them and have spot lights.
Maybe
I have something. Gimme a minute.
is there any particular reason areas cant have rotation in more than one dimension? engine limitation or is there a trick im missing?
my problem is if i have an area on the deck of an aircraft carrier and then turn the carrier upside down, the area would be inside of the carrier thus making it unusable
I really need help because I am lost
I made a faction with ALiVE, I made the Cfgpatches file and everything needed
packed it into pbo, and it's an addons folder and I still can't see it in game
it worked yesterday and I have no idea what is wrong now
player addAction ["", {hint "You can't shoot"}, [], -99, false, true, "DefaultAction", "!commy_allowFire"];
commy_allowFire = false;
set to true to allow firing again
would that be scripting?
Also, maybe it was cached into the game?
My own question. 1st, is there a way to scramble an array?