#arma3_scripting
1 messages ยท Page 639 of 1
@fossil yew your code was wrong. you never parsed the _this into _group correctly, i assume bc _this doesnt exist in an init field, or bc its the group and not an array. anyways, this code works if put into the groups init field:
Also, if the game tells you theres an error with _group, you can believe it. No need to search for errors somehwere else :P
if (!isServer) exitWith {};
systemChat str this;
this spawn {
params ["_group"];
waitUntil { time > 0 };
systemChat str _group;
{
doStop _x;
_x doWatch (_x getRelPos [100, 0]);
} forEach units _group;
_group setBehaviour "AWARE";
_group setCombatMode "YELLOW";
_group setSpeedMode "LIMITED";
}
so my main goal is to be able to use that similar support framework, but to have it use a requested weapon
!wiki params
Can you try adding a vehicle that definitely can't provide artillery support to see if that gets greyed out too?
yeah sure thing
Where does he use _this?
assigned to a Rhino MGS- also grayed out
He never said his code doesn't work, he said it works everywhere but on dedicated server, that is the problem, not _this.
well the code he provided does not work from the init field
Ah, dangit.
Then you'll have to make your own system I believe. Two options:
Simpler: Use addAction.
More complicated: Use a custom Commanding Menu.
Since you've mentioned that you're new to this (and since I have no experience with custom Commanding Menus) I suggest the simpler option.
Or maybe you're lucky and someone has made and shared a script that does what you want before.
He also said:
This is a function called on group in group init field.
I will have to do some exploring, then!
in initPlayerLocal.sqf should I use
[player] execVM "myScript.sqf";
or
params ["_player", "_didJIP"];
[_player] execVM "myScript.sqf";
Should I expect that player is already initiated ?
player should work; I use player.
hm is there a simple way of counting all objects that are currently visible on the player screen?
i mean not just based on line of sight, but also objects that could be behind a wall but are still being rendered
i'm doing some debugging and want to check where how many objects are eating performance
I'm guessing that function can basically act as a look trigger?
I'd say no, not unless you have access to the engine itself.
I've manually placed that soldier in 3den looking just where I want him to look, that's why ... it's silly, I know, but I'm getting desperate.
Telling ai where to look shouldn't be that difficult.
A dirty way that achieves it is "this disableAi "move";"
It stops the ai from walking or rotating. Can still shoot and move upper body a bit
also your code works fine for me with slight alterations
you can probably try worldToScreen, then use inArea
I don't remember what that command returns for offscreen objects
https://community.bistudio.com/wiki/worldToScreen
returns empty array if offscreen
so no need for inArea
Does setPlayerVoNVolume set any players VON volume globally or locally to the PC executing it?
hello can someone help me remember the function that allows a group of player to spawn in a random marker on the map together?
currently im using this because is the only one i remember, but for groups you need a total different one.
randomSpot = selectRandom ["pos_01","pos_02","pos_03","pos_04","pos_05","pos_06","pos_07","pos_08","pos_10"];
this setPosATL getMarkerPos randomSpot;
Use forEach and units with the group.
sorry, still at the beginning with scripts what should i do? ๐
_randomPos = getMarkerPos (selectRandom [...]);
{
_x setPosATL _randomPos;
} forEach (units MyGroup);
oooooooooooooooh thanks alot mate!
local effect
strange, i tried it and it doesn't work
_randomPos = getMarkerPos (selectRandom ["pos_01","pos_02","pos_03","pos_04","pos_05","pos_06","pos_07","pos_08","pos_09","pos_10"]);
{
_x setPosATL _randomPos;
} forEach (units MyGroup);
```sqf
/* your code */
```
please
sorry
am i missing something?
Wiki updated
MyGroup perhaps? It's not a command, you need to replace it with the group's variable.
Yes it was that
Ok, thanks.
thanks alot ๐
sometimes, I discover something and think... wow.... I wish I knew about that before
is one such thing... as a dynamic mission maker (the mission is dynamic, not the author), I have, in the past written my own code to do what this does
Dw, i recently found out too arna can do math with Vectors
Had also written my own stuff for that before
but vectors are the work of the devil
because I don't understand them, obv
I do understand them, tbf, just not how to work with them...
Dedmen, feature request: could fnc_isPosBlacklisted be expanded a little? It can take an array (making a rectangle) or a trigger as a blacklist area.. could it also accept a marker?
I don't do script
who could I ask?
KK
thanks
but he'll want ticket prolly
yes ty
Vectors are nice. Reliable and intuitive
Quaternions on the other hand...
Once you understand how to add and do scalar product, you can do anything really
yaoi*
Checking a player's pockets for Demo charges, what syntax should I be using instead of Magazines?
if ("DemoCharge_F" in Magazines Player)
@jovial steeple "DemoCharge_Remote_Mag"
Did I get the classname wrong?
my guess is that the democharge_remote_mag is the class used as the item and the democharge_f is the physical object after being placed
Found it, DemoCharge_Remote_Mag is the name of it when its an inventory item.
Hello! There was a problem with doFSM. I would like to make an atomic evacuation command (helicopter arrived -> took the detachment -> flew back). Implemented at a high level (execFSM), but I would like doFSM. The problem is that when using _heli land "LAND", it shifts its position x y in search of free space, respectively, after landing, immediately takes off and flies to the previous moveTo, how can you interrupt moveTo without killing fsm? It only helps to force flyInHeight, but it's not so effective.
So I'm trying to use an interaction on an object in game with variable name clacker to detonate some explosives. I'm trying to use BIS_fnc_holdActionAdd launched from the init.sqf file to do that. Here's my code.
[
clacker,
"Detonate Claymores",
"images\destroy.paa",
"images\destroy.paa",
"_this distance _target < 3",
"_caller distance _target < 3)",
{},
{},
{
{
private _claymore = missionNamespace getVariable [format ["clay_%1", _x], objNull];
_claymore setdamage 1;
} foreach [1, 2, 3, 4];
},
{},
[],
1,
0,
true,
false,
] BIS_fnc_holdActionAdd;
When I run it it says error missing square bracket in the last line.
you have a , too much @cerulean cloak
In the line with false?
yea, the last , after false and also ] BIS_fnc_holdActionAdd; -> ] call BIS_fnc_holdActionAdd;
yep last line
Thanks
Anyway to define an array as a series of integers between a &b without typing them all out?
Use for and pushBack
i found something interesting. basically im making a spotlight that points at wherever the mouse cursor is. if you use the setVectorDir command, it is supposed to only rotate the object from 0-360 degrees around 1 axis (so rotating the light left and right but it stays pointed at the same elevation). But, if you use BIS_fnc_setPitchBank and set the pitch to any angle, then it "unlocks" the other 2 axis and setVectorDir also affects the pitch? anyone want to explain?
`_light = createSimpleObject ["a3\data_f\VolumeLight_searchLight.p3d", getPos player]; // create spotlight
//[light, -90, 0] call BIS_fnc_setPitchBank; // why does this work?
_light setPos (getPos player vectorAdd [0,0,5]); // move light above player
_trailLight = "Reflector_Cone_01_Long_white_F" createVehicle getPos player; // create spotlight light effect
_lightOrigin = _light modelToWorld [0,1.9,0]; // origin of spotlight, since the model origin is not where the light comes from
_trailLight setPos (_lightOrigin); //
_trailLight setDir (direction _light + 180); // set light effect as same direction as spotlight
_spotLight = "#lightpoint" createVehicle getPos player; // create ground light effect
_spotLight setLightBrightness 0.6; // brightness
_spotLight setLightAmbient[0.99, 0.99, 0.74]; // ambient
while {alive player} do {
_target = screenToWorld [0.5,0.5]; // get cursor location
_light setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1); // set direction spotlight
_trailLight setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply 1); // light effect
_spotLight setPos _target; // move ground light
sleep 0.025;
};`
@chilly bronze
use syntax highlighting. see the pinned messages.
use setVectorDirAndUp
sorry, im just asking why if you uncomment the second line, the setVectorDir magically also controls the pitch of the light and it works as intended, its just kinda weird
I cant read your code. add syntax highlighting
_light = createSimpleObject ["a3\data_f\VolumeLight_searchLight.p3d", getPos player]; // create spotlight
//[light, -90, 0] call BIS_fnc_setPitchBank; // why does this work?
_light setPos (getPos player vectorAdd [0,0,5]); // move light above player
_trailLight = "Reflector_Cone_01_Long_white_F" createVehicle getPos player; // create spotlight light effect
_lightOrigin = _light modelToWorld [0,1.9,0]; // origin of spotlight, since the model origin is not where the light comes from
_trailLight setPos (_lightOrigin); //
_trailLight setDir (direction _light + 180); // set light effect as same direction as spotlight
_spotLight = "#lightpoint" createVehicle getPos player; // create ground light effect
_spotLight setLightBrightness 0.6; // brightness
_spotLight setLightAmbient[0.99, 0.99, 0.74]; // ambient
while {alive player} do {
_target = screenToWorld [0.5,0.5]; // get cursor location
_light setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1); // set direction spotlight
_trailLight setVectorDir (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply 1); // light effect
_spotLight setPos _target; // move ground light
sleep 0.025;
};
_light setPos (getPos player vectorAdd [0,0,5]); // move light above player
this is wrong. getPos is inAGLS format
_target = screenToWorld [0.5,0.5];
(getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25]
incompatible position formats. getPos: AGLS
screenToWorld: AGL
when you use:
[light, -90, 0] call BIS_fnc_setPitchBank;
the object's new "dir" becomes the model's up vector (Z vector in model space)
so when you setVectorDir, you're actually changing the vectorUp (or should I say, Z vector in model space)
that's why it "works"
if you simply use setVectorDirAndUp, you can save yourself the confusion
incompatible position formats
@chilly bronze
read this if you don't understand position formats:
https://community.bistudio.com/wiki/Position
test this instead:
_dir = (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1);
_light setVectorDirAndUp [[_dir,90] call BIS_fnc_rotateVector2D, _dir];
I think it should work too
no need for the BIS_fnc_setPitchBank
that didn't work, i just used this and it worked```sqf
_dirVec = (((getPos _light) vectorFromTo (_target vectorAdd [0,0,0.25])) vectorMultiply -1);
_light setVectorDirAndUp [_dirVec, [0,0,1]]; // set direction spotlight
I don't understand what's wrong in this
{
{_x setPos (getPos RTB)};
forEach allPlayers};
is the only content of an sqf supposed to teleport all players to an invisible helipad called RTB
First of all, {} codes themselves doesn't do anything. It requires to be call or spawned. Second, the ; afther the getPos RTB terminates the current code, so forEach can't recognize the code
(sorry if I'm something gibberish, I'm drunk)
so
call {
{_x setPos (getPos RTB)};
forEach allPlayers};
?
Remove the ; after the RTB, should do I think
Also, remember that getPos and setPos formats are not the same
getPos: AGLS
setPos: AGL
that can cause issues
used ASL and it worked
_houseList = [];
{
for "_i" from 0 to 20 do {
if ( [(_x buildingPos _i), [0,0,0]] call BIS_fnc_arrayCompare ) exitWith {
if (_i > 0) then {
_houseList set [count _houseList, [_x, _i]];
};
};
};
}forEach _nearesthouses;
_randomHouse = _houseList select (floor (random (count _houseList)));
_housePos = (_randomHouse select 0) buildingPos (floor (random (_randomHouse select 1)));
_crate = createVehicle ["Box_East_Wps_F", _housepos, [], 0, "CAN_COLLIDE"];
getting the error "0 elements provided, 3 expected"
are you trying to create a box at a random position of a random house?
yes around a map marker
private _position = selectRandom selectRandom (getMarkerPos "WEST_AO_3" nearObjects ["House", 25] apply {_x buildingPos -1} select {!(_x isEqualTo [])});
private _crate = createVehicle ["Box_East_Wps_F", _position, [], 0, "CAN_COLLIDE"];
(implying there will always be a house with atleast one position inside within the radius of the origin)
one-linersโฆ
Thanks guy main problem ended up being the map. I guess zargabad has no "safe" locations to spawn a crate.
you can add your own positions in some config, then vectorAdd the offset to the origin of the house
get to se choppah!
I got it to work! 25 was too low of a number I guess. thanks everyone
houses are big and have their object center and position in the middle
soldier playMove "Acts_Pointing_Front"
when doing animations, is it possible to stop the AI that has a rifle rested from raising their weapon for a moment before and after? it looks awful
nevermind fixed by setting behaviour to safe
Use different play commands perhaps
switchMove should usually work
but it doesn't show transitions
playMoveNow could also work, though in my experience it depends a lot on unit behavior settings
Quick question, is there any function that allows calling a script on a particular object from an sqf file itself? Something like <variable> execVM "script.sqf"? I've been searching, but haven't been able to find any script-calling functions that also have a left hand variable
execVM is good for a one-time usage only, that's it
Good to know then
Whats the difference between execVM and callcompile?
execvm is spawn compile
execVM is (more or less) equal to spawn compile preprocessFile
How I can check DLC active in player or not? I wish if player not buy DLC script give to him vanilla weapon, if buy he has DLC weapon.
getDLCs will do?
if player not buy DLC, ingetDLC he not have this?
https://community.bistudio.com/wiki/getDLCs
if (288520 in getDLCs 1) then
{
hint "you own Karts!";
};
isDLCAvailable the same?
I don't think so?
I don't knowโฆ is it available on Steam or is it in owned DLCs
in doubt, use getDLCs @last rain
Okay, thanks
iirc it also returns the line numbers, so it's spawn compile preprocessFileLineNumbers
yes, lineNumbers is set to true, so I guess it should.. but.. dunno, code is weird
params are passed to preproc, but never used or stored.. weird stuff ๐
or its some child class virtual shenanigans.. but the lineNumbers is set to true
why the double selectRandom?
one to get the array of positions (for each object)
one to return a random position
but buildingPos only returns one position?
-1 returns all
ah -1 specialty
Answering my own question;
_arr = [1,2,3];
selectRandom _arr // produces 1, 2, or 3
_arr = [[1,2,3], [4,5,6]];
selectRandom selectRandom _arr // produces 1, 2, 3, 4, 5, or 6
yup
otherwise multiple selectRandom statements produce an error
see it as selectRandom (selectRandom _arr)
or, less one-lined,
private _array = [[1,2,3],[4,5,6]];
private _subArray = selectRandom _array; // [1,2,3] or [4,5,6]
private _result = selectRandom _subArray; // 1,2,3,4,5 or 6
How to parse all classes of vehicles from current moddset?
"rhs_t72bd_tv","rhs_t80bv","rhs_t80um","rhsusf_m1a2sep1tuskiiwd_usarmy"...
"getNumber (_x >> 'scope') == 2" configClasses (configFile >> "cfgVehicles")
you can also use > 0 instead of == 2
any trick to cut full path and use classnames like that?
M1238A1_Mk19_socom_wd,bin\config.bin/CfgVehicles/rhsusf_rg33_wd,bin\config.bin/CfgVehicles/rhsusf_rg33_m2_wd,bin\...
to this
"M1238A1_Mk19_socom_wd", "rhsusf_rg33_wd", "rhsusf_rg33_m2_wd"
configName
@winter rose could you write full command? im kinda lose a bit here
private _classes = "getNumber (_x >> 'scope') == 2" configClasses (configFile >> "cfgVehicles");
private _names = _classes select { configName _x };
https://i.imgur.com/l498ACv.png
"Error Generic error in expression"
roger
private _names = _classes apply { configName _x };```
mm nothing happens
21:26:20 [CBA] (settings) INFO: Checking mission settings file ...
21:26:20 Script 'cba_settings.sqf' not found
21:31:20 [CBA] (settings) INFO: Checking mission settings file ...
21:31:20 Script 'cba_settings.sqf' not found
.rpt is empty
your data is in the _names variable
just type _names in the debug console after your code (and a ; of course)
gotcha, big thanks!
Sometimes player setCaptive true seens to fail... really?
Likely something else is setting it back? I haven't noticed an issue
that or a locality issue ๐
Admin players can use setCaptive only on their player character. Player character is allways local.
WIKI says Local Arguments, Global Effects
So nothing wrong.
Sometimes i use setCaptive and AI units don't stop to shot me.
But if you have no issue, i will check better.
mods ๐
Any trick to sort only ground and air playable vehicles? I've got some CUP classes"Land_PedestrianCrossing_01_8m_10str_F","Land_Puddle_01_F","Land_Puddle_02_F"..
typeOf _vehicle; ?
in the "getNumber (_x >> 'scope') == 2" filter, but I don't remember how. maybe a configist will come by and halp!
I don't know what you mean. maybe isKindOf?
"getNumber (_x >> 'scope') == 2 && {configName _x isKindOf 'Air'}" configClasses (configFile >> "cfgVehicles");
playable vehicles
that's trickier
you also have to filter out UAVs for example
ok, also remember to remove the UAVs
I think it was IsUAV
so getNumber (_x >> isUAV) != 1
you can find it in the wiki
or config viewer
So i am doing some testing in my mission and i was wondering if there is some global entity that alive will always return true for?
Hmmm alive objNull is always false, so I guess you could have true with !alive objNull...
you know what i figured out how to do it without doing something crazy like I was looking for. thanks
{
addMissionEventHandler ["Draw3D", {
drawIcon3D ["", [1,0,0,1], ASLToAGL (getPosASL _x), 0, 0, 0, "Target", 1, 0.05,"PuristaMedium"];
}];
} forEach _opforNearby;
can someone explain why this returns error Error 0 elements provided, 3 expected? I know it has to do with the position array but I don't see why this is returning an error
_opforNearby is just an array with units [unit1, unit2, ...] etc
printing ASLToAGL (getPosASL _x) returns a 3 element position array so no clue why it doesnt work
The Event Hรคndler has nรถ idea about the scope it was registred
What you could do, is create a string for it and Compile that
compile Format ["...", Position _x]
worked, thanks
Probably better to loop through the units inside the eh itself
Not really, Performance wise
But could also be done indeed
If you call this code again, it'll readd the eventhandlers again, and it won't work properly if units start moving
True that, but the question was not how that Code could be done better ๐คช๐คช
Plus we do not know the Details here
Maybe exactly that is the purpose and just an attempt to get it
Well.. Working for starters ๐คทโโ๏ธ
I'm wondering if someone might be able to help me with an issue that I'm having. I'm using Simplex Support Services to call in a CAS Drone. I've been able to set the custom init code to change the pylon loadout with "setpylonloadout" command. Looking at the drone the weapons have been changed to what was scripted but when I enter the gunner's position it shows the old loadout weapon names and they are red (empty). Am I attempting to do something that can't be done or am I just missing a few steps? Any advice that you can give would be greatly appreciated, thank you in advance!
I was able to figure out the issue as to why the gunner couldn't use the newly added weapons. I didn't have the turret path set to it defaulted to the pilot. But I'm still having the issue of the original weapon showing up in the weapon selection.
Remove the weapons before applying new pylon loadout
Is there any means by which I can force AI to only be able to fire a weapon when crouched or prone? Ideally in a way I can bundle in to a weapon addon?
that would not be #arma3_scripting I believe, maybe #arma3_config
Question: If I send a local "entity" to another computer, then send it back to the original computer (remoteExecutedOwner), will it get "lost in translation"?!
Like:
_ctrl = _disp displayCtrl _IDC;
[[_ctrl], {
[_this#0, name player] remoteExec ["ctrlSetText", remoteExecutedOwner]
}] remoteExec ["call", 2];
or maybe:
_ctrl = _disp displayCtrl _IDC;
[_ctrl, {
[[_this, name player], {_this#0 ctrlSetText _this#1}] remoteExec ["call", remoteExecutedOwner]
}] remoteExec ["call", 2];
?
what do you mean by lost in translation?
not defined anymore
yes
so that one simply does not do anything at the other end but being null and imo should throw an issue
I send the original value
_ctrl = _disp displayCtrl _IDC; // Returns DISPLAY type
#arma3_scripting message
step 1: get the control on my computer
step 2: get player name on the server (also sends the control)
step 3: remote exec the command on my computer again (sends the control back)
it's a double remoteExec
[...] (also sends the control) [...]
pretty much doubt that
you might get something
but not the actual control, that much i promise you (afterall ... it does not exist on the server)
yes, but I send back the original array
does not matter
your original array resides on your pc
not the server
the server has its very own representation of that array
which has no control of yours
hmm so do you have an idea how one can do it? (if it's possible)
aka:
client --> server: [DISPLAY, PLAYER] --> [NIL, SERVER]
server --> client: [NIL, SERVER] --> [NIL, SERVER]```
what you want is a Promise, or something that pretty much resembles that
got some implementation of them here: https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0
rather straight forward to use and allows you to send requests to the server that get back to you
Store control in an array on client, send index to server, receive index again, retrieve control.
great idea!
I think your method does the same thing, right @queen cargo ?
more or less
the promise system of mine is general purpose though
[
_target, "method_name_or_code", [/* args */], //request-related
[_arguments], {
params ["_arguments", "_result"]; // _result comes straight from the server here;
// [...] CODE
}
] call Promise_Create;```
and youre done, given that the methods are exposed on all clients and servers (eg. init.sqf)
Do mission event handlers work in 3DEN?
try and thou shalt see? ```sqf
addMissionEventHandler ["EachFrame", { systemChat "lol" }];
yeah. thanks. I was being lazy! ๐
is there a way to set/remove shadow from (scripted) markers via sqf?
yes, setMarkerType
https://community.bistudio.com/wiki/CfgMarkers
All the above markers have a _noShadow variant (eg "mil_end_noShadow") with no shadow
wow, the more you know
@winter rose ok so you have to make duplicates in configs essentially
I have difficulties to tell an AI unit hanging from a steerable parachute to move to a certain position. Is the steerable parachute bugged somehow?
may very well be not AI friendly - but I have no experience with that besides "eject" and let live
Yeah, they don't. They just move about randomly
Technically, the parachute is a vehicle, and the unit hanging is the driver. Must be something in the chute 'vehicle' wrong then.
that or AI not knowing how to deal with it, that's a possibility ๐
I would lean more on that side actually
I think it's a height problem
they want to "fly" to a set height
but they can't
pretty much like helicopters
Yes, helicopters in big heights steered by AI have problems too.
Start doing circles and not hearing to commands anymore
yup
Anyone tested sendSimpleCommand already?
something tells me you are about to ๐
also, it needs a commander ( which cannot be the driver)
a parachute is one man only!
is there a command for the init of a vehicle to set the lights on, on spawn/start?
hey guys trying to get a trigger activate if a specified amount of civilians is inside the trigger area. No real time to play Arma currently.
_trigger setTriggeractivation ["civilian > x"];
``` would this work? or am I totally off
is x defined anywhere?
totally off!
x would be the number of civilians I want in that case
well trigger activation doesn't work that way
or the number 1 under the amount of civs I would need for it to actiavet
You'd want something like:
_trigger setTriggerActivation ["CIV", "PRESENT", true];
and then
_trigger setTriggerStatements ["this && count thisList > x", "hint 'trigger on'", "hint 'trigger off'"]
oh tanks a lot ๐
that might also include incapacitated players.
hmm will keep that in mind. Also unconcious ones with ace?
I suspect so; I think in both cases those systems use setCaptive to prevent enemies from shooting downed players, and that changes the player's side to CIVILIAN
which is why I was using side group _x
another option
_trigger setTriggerStatements ["this && {((typeOf player) splitString "_" select 0) == ""C""} count thisList > x", "hint 'trigger on'", "hint 'trigger off'"]
that's bad
I'm solving his problem, rather than making comments about somebody else trying to solve someone's problem.
using any present and {side group _x == civilian} count thisList > x is faster
and I'm preventing someone from teaching others bad ways
I honestly don't know what your problem is.
doing the side check in slow script rather than letting it happen in engine is better?
Everything here is bad as Alex's start context was wrong. problem solved in other discord
didn't actually want setTrigger*
Which other discord Dedmen?
mine
But we basically did what Ryko wrote.
Which is what I already told in the other discord before Alex even asked the question ยฏ_(ใ)_/ยฏ
I'm just getting tired of Leopard20 jumping on everything to show how right he is.
Well can't expect someone to have his eyes everywhere 
Just trying to help out.
But still thank you guys
Ah I see, for setCaptive.
Doing civilian check in engine to get rid of the bulk, and then only filtering out captive in script would be faster.
yeah, single operator vs 4
_trigger setTriggerStatements ["this && {!captive _x} count thisList > x", "hint 'trigger on'", "hint 'trigger off'"]
good lord captiveNum
wat
dafuq is this
I suppose I can see a use case where you'd want to have different sub-levels of captivity... A is "more" captive than B...
and I'm tired of you. so deal with it
done
No drama boys, and if code is bad it should be trashed 
never take code review personally.
I'm fine with code review. My own ethic is never to issue criticism unless I can offer a suggestion, rather than just saying "it's bad". It's just noise, otherwise.
Perhaps you're both blind and illiterate: #arma3_scripting message
Your code was just genuinely terrible and bad tho.
Your code doesn't work
Your code will be hella slow and inefficient
There are ways to make your code more efficient, but it still wouldn't work, and still be less efficient than even a suboptimal solution
Your script also wouldn't have solved the problem, as your code doesn't work.
Civilian units don't necessarily start with C_. Especially not in this case as this code is for a modded mission which you couldn't know.
Even if you want to check for start with C, you could just check if the first character is C, there is no need for a splitString?
Now I really wish I first would've seen Dedmen's suggestion before asking here
All of this is true. I'm aware that searching for strings as a method isn't the most optimal, but I was also responding to OP's need for what seemed to be an immediate, if far from perfect or efficient, solution.
Also Ryko.
Your script has a syntax error, you messed up the quotes around the _
And the double "" mess is messy, just use ' as quote marks when you are already in string, like you did with the hint's. That also prevents errors like the above
I mean I said I don't really have time to play/test right now when I initially first asked the question. But still thanks.
Enough fuel now let's all be friends and bake some Cookies for Christmas together
Well I did edit the quote mark thing, so I think it's unfair to poke at that particular code; further, I provided an alternate solution which abandoned that method altogether and went for the captive approach, which I think solved several issues. Unless you think that doesn't solve the problem either.
Nah your last code is I think the optimal solution
but not for Alex' usecase. we don't care about captive units actually
this && count thisList > x is the solution. combined with civ presence
players getting incapacitated won't trigger a CIV trigger?
If we get that many players unconscious, the mission is already a fail
what's the best way to check if soliderA has LOS to soldierB? I currently have an array of soldiers (_targets) that I use via _targets call BIS_fnc_selectRandom to get one unit out of it. However that does not check for a LOS of soldierA to that unit.
I think playing around with checkVisibility might work
I haven't had 100% success trying to make a command that does this: I use a combination of terrainIntersectASL, lineIntersectsObjs and checkVisibility but even then it's failed when I'd assume it should succeed. I haven't scoured all of Arma's scripts and functions for something that's already doing this effectively, which is often the case... happily I don't need to verify whether one target can see another very often.
@Dedmen If you get time could you look into allowing vests and helmets to work with the setObjectTexture command?
I would say; make a ticket on the Feedback Tracker, because this is not the place to ask for features ๐คทโโ๏ธ
Thereโs already several last I checked, so no point adding another.
Pretty sure nothing in the inventory is an object.
backpack and vests are iirc
So about the event handlers that need local arguments (like "Killed"), what happens if the object changes locality?
will it not trigger anymore?
correct
its why for instance on arma 2 dayz the killed evh gets added to all vehicles on the map when you login as a client
- server so atleast 1 machine is doing the exec when it triggers
ah, so I need to handle locality too...
so another question. what if the unit changes locality back to the original computer?
then its fine again
tbh i replaced my killed evhs with killedmp evh, didnt notice a change in network traffic
is it also true about "local" setVariables?
like can I use:
_unit addEventHandler ["Local", {
params ["_unit ", "_isLocal"];
if (_isLocal && {_unit getVariable ["killed_EH", -1] == -1}) then {
_unit setVariable ["killed_EH", _unit addEventHandler ["Killed", {...}] ];
}
}];
oh, didn't realize it existed! https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPKilled
yes dayzmod was written before the introduction of mpkilled aswell
so it doesnt use that
i do not know about your other question
_visTargets = {[objNull, "VIEW"] checkVisibility [eyePos _sniper, eyePos _x]} forEach _targets;``` this sadly only returns a number. I'm thinking to complicated.
What I need is to return an array with units from the array ``_targets`` that is visible to ``_sniper``.
I'm currently thinkering around with find and pushback
```sqf
_visTargets = _targets find {([objNull, "VIEW"] checkVisibility [eyePos _sniper, eyePos _x] <=1)};``` however this code as well only returns SCALAR instead of "objects"
Can someone help me out where to start from, thanks!
find doesn't work like that
use select
also, you're using <=1
which makes zero sense
you should use > 0
oh well , ok thanks I'll give it a try
damn that works flawless, thanks @little raptor
That's the code I used now:
_visTargets = _targets select {([objNull, "VIEW"] checkVisibility [eyePos _sniper, eyePos _x] > 0)};```
No
["shotdark", 100, 1, false, 0]] remoteExec ["say3d"]
who do i fit this into addaction?
?
i want a laptop with an addaction option to execute this above!
(how*)
yeah sry XD i meant how sry
Read that and it will answer questions you didn't even ask yet.
hm lets see, im not good a scripting ๐ฌ
this addAction ["Musik",["shotdark", 100, 1, false, 0] remoteExec["say3d"]]
``` looks right to me i test it now
nope
what is missin a target?
second part should be between { }
this addAction ["Musik", { [theSpeaker, ["shotdark", 100, 1, false, 0]] remoteExec["say3d"] }];
ah ok thx!
missing what will say the thing
is it what you are adding the action to that will say it?
"shotdark" yes its a music file set in the description.ext
CfgMusic?
put it in CfgMusic and remoteExec playMusic then
yeah right see that now that i openend the description.ext why did my brain put say3d in there ???
no ๐คฃ
@winter rose hm wont work That is the full init of the laptop (Var name laptop): ```sqf
this addAction ["Musik", { [laptop, ["shotdark"]] remoteExec["playMusic"] }];;
did i miss something
?
Ok well could you provide an explanation as to why? Like is it an engine limitation, etc?
one ] to much behind shotdark?
[laptop, "shotdark"]
ah ok
if you use the ["shotdark"] syntax, you need to provide a start time after, eg ["shotdark",3]
should it not just ignore it and play it from the begining?
no because that syntax expects a start time. if you want it to start from the beginning you would just give the string, not an array
ok
engine limitations
Ok thank you!
no need for laptop argument, playMusic only takes the music, it has no source
now im fully confused! so its just ```sqf
this addAction ["Musik", { ["shotdark",0] remoteExec["playMusic"] }];
try just ["shotdark"]
this addAction ["Musik", { ["shotdark"] remoteExec["playMusic"] }];
yep
https://community.bistudio.com/wiki/playMusic takes only one (right-hand) parameter (string, or array)
so remoteExec arguments would be [leftArg, rightArg]
since there is no leftArg, it's just [rightArg]
oh FFS i know the error its "demonfire" not "shotdark" fml
workls enough for today ๐คข
Hello, im trying to make a shrinking marker (area), every minute i want it to shrink a bit, all the scripts i saw online were over complicated and some of them laggy, i don't want the player to take damage outside the area but i would like a hint saying that the zone has moved, any ideas?
I'm using the MQ-9 Reaper from the USAF mod pack and I can't seem to figure out the command for removing the current weapons from the pylons. I can use the setpylonloadout command to change it be it seems to still register the old loadout as attached. Would anyone be able to help me with what command should be used?
any think about scripting intel in the BIS wiki i cant seam to find any!
in the sense of "pick up intel" and "show a new task!"
so i'm doing a basic teleport script but the game keeps giving me the error "script Tele.sqf does not exist" yet i have them in the respectful folder for the map itself, what should i do to fix this issue?
Show your folder structure and code calling it?
@digital hollow i just sent you a dm with what ur after
while {condition} do {//condition must return true
sleep 60;//wait 60 seconds
"MarkerName" setMarkerSize (getMarkerSize "MarkerName" vectorMultiply 0.9 select [0,2]); //10% smaller
hint "Marker was resized";
};
it's easy to do it:
https://community.bistudio.com/wiki/Arma_3_Task_Framework
- create the task:
https://community.bistudio.com/wiki/BIS_fnc_taskCreate - when the user picks up the intel, set the task state the true. you need a take event handler: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take
you can use the item type to detect your intel item. for example:
if (!isServer) exitWith {};//assuming this is both for MP and SP
this addEventHandler ["Take", {//assuming this is put inside the init box of a player unit
params ["_unit", "_container", "_item"];
if (_item == "Document") then {
["taskName", "SUCCEEDED"] call BIS_fnc_taskSetState;
};
}];
you can also do it another way. add the intel to a container (let's call it my_container), and use a condition like _container == my_container in the above code to detect the item being taken. (or do it both: _container == my_container && _item == "Document")
[(position player), side player, (configFile >> "cfgGroups" >> "empty" >> "by_Assault" >> "Training" >> "Funbox")] call BIS_fnc_spawnGroup;
how do I make this so it places the objects just like in editor
without it all being faced in one direction
CODER WANTED!
Make me a vehicle! I want a steerable parachute with an AI command slot. So I can test 'sendSimpleCommand' on that!
I can offer: Stop spamming the board for 24h!
it won't work
because the command simply doesn't work on air vehicles
there's no way you can get the AI to steer the parachute
the best thing to do is write an eachFrame event handler that simulates parachute flight
it's not hard to do if you're good with vectors and physics
in editor they all face the same direction (?!)
I'm NOT good with vectors and physics. I'll try to push him in the direction I want him to. But it will look crappy for sure. Will see what I can do.
nice! thanks alot ๐
i wonder how well the sqf compiler can handle an per frame event with calculations.
i can help you if you need some answers. did a lot with vectors and physics for my spacegame
just for fun! ๐
create some empty vehicle named "hel"
put it up in the air
run the code!
@languid oyster
you can set the destination using hel setVariable ["destination", _pos]
and you can have as many units up in the air as you want
why would the compiler do that? compiler only runs once per script
maybe i have a once per frame call of my script ๐
what do you mean? you obviously don't want to recompile your script every frame, compile it once, then call it every frame
please don't tell me execVM in onEachFrame pleasepleaseplease
i actually used to do this years ago when first starting to script ๐ i didnt know how to debug so i just test and the easiest way was to have the script call itself again instead of a loop, bc it would use the updated code ๐
Opened editor, put a parachutist unit about 100 m height, then point on him an local exec:
GlobVehicle = cursorObject;
onEachFrame {
_vel = velocity GlobVehicle;
_dir = direction GlobVehicle;
_speed = 2;
if (speed GlobVehicle < 40) then {
GlobVehicle setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)
];
};
diag_log format ["Speed: %1", speed GlobVehicle];
};
Cool, now I only need: Calculate wind speed and direction, make a vector subtraction to not have to high air speed, make smooth turns to desired position, and simulate 'dangling' of the chute while in flight ๐
see? easy!
your code is prone to fail. if you go at speed limit, it doesnt correct the direction anymore
instead get the velocity, set new velocity which is capped to 40
Yes, it was only a little proof of concept. If that thing does what I wanted him to do
GlobVehicle setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)
];
GlobVehicle setVelocity (_vel vectorAdd [sin _dir * _speed, cos _dir * _speed, 0])
@copper raven Thanks for optimisation ๐
what is this code supposed to do exactly?! the unit just keeps speeding up in his direction...
you know setVelocityModelSpace is a thing? :3
_newVel = (vectorNormalized (_vel vectorAdd [sin _dir * _speed, cos _dir * _speed, 0])) vectorMultiply _absoluteSpeed;
GlobVehicle setVelocity _newVel;
capped to a speedmax and still stearable
altough i think it might behave not perfectly like real force addition would
I want to code SUPERMEDIC! When using ace, and the heli is hit by some AA, player often goes unconscious. If there is a medic aboard, which is still alive and not unconscious, he shall throw out player, jump out, tandem paradrop him to ground, then heal him (if he is still alive).
Problem is, what if the heli is above water? Then the AI medic should find a suitable landing position, steer the chute to that position, and land.
This is my motivation behind the AI steerable thing
it's a bit wrong
it's always capped to maximum...
shouldn't it "accelerate"?
(it was obviously on a joke tone, just to make it clear ^^ I hate 3D calculations/rotations)
GlobVehicle = cursorObject;
onEachFrame {
_speed = 2;
if (speed GlobVehicle < 40) then {
GlobVehicle setVelocityModelSpace ((velocityModelSpace GlobVehicle) vectorMultiply _speed);
};
diag_log format ["Speed: %1", speed GlobVehicle];
};
so much simpler no?
not quite sure what you're trying to achive. but model space velocity will be quite a bit easier to use?
yeah i know. it requires more complex scalar product stuff/projecting vectors to mimic good acceleration with a cap. so i thought a constant speed for the parachute is nice to
hm now that i think about it, if its constant, you dont need to cap it
anyway, I just tested my own code with parachutes
it doesn't work
which means setVelocity doesn't work on parachutes
so the setVeolcity method won't work
you forgot to report that in #arma3_feedback_tracker
I was about to
got on arma now, placed a trigger and a marker named Safe, trigger configuration: any player , repeatable, on activation:
sleep 60;
"Safe" setMarkerSize [4300, 4300], (getMarkerSize "Safe" vectorMultiply 0.9 select [0,2]);
hint "La zona si รจ ristretta!";
};```
not going to work, you cannot sleep in a trigger - the code there is unscheduled
ah i see, so... how do i make it repeat every 60 seconds?
this && round (time %60) ==60 ?
spawn the code
wdym? im a noobie
@languid oyster the old code I posted works perfectly fine:
https://sqfbin.com/evevabewacibipabirok
I also added some "bobbing" simulation to make it look realistic
@obtuse quiver
https://community.bistudio.com/wiki/spawn
the code only resizes the marker, not your trigger
thanks im going to read that now
there's not much to read:
[] spawn {
while {true} do {
sleep 60;
"Safe" setMarkerSize (getMarkerSize "Safe" vectorMultiply 0.9 select [0,2]);
hint "La zona si รจ ristretta!";
};
}
yeah i just want to understand what everything mean but hey thanks again dude!
also you code is wrong
you're always resizing the marker to [4300, 4300]. it never shrinks
let me guess the "true" and set marker and ger marker size
Ah
ops
sooo i have to set the minimum in there
why didn't you use the code I sent?
#arma3_scripting message
was there a problem?
not at all, i was experimenting ๐
if you simply remove: [4300, 4300], from your code it will work fine
nice thanks i learned something today
np. I updated the code above
HA! Thank you very much, big cat! Tomorrow I will test this and that with your code.
How can I make this MP compatible? It's currently pasted in the unit's init.
call {
this spawn {
while {sleep 1; (currentWeapon _this) == "arifle_MXM_F"} do {
waitUntil {uiSleep 1; (daytime > 20) && {cameraView == "GUNNER"}};
setApertureNew [2, 5, 14, .9];
waitUntil {uiSleep 1; cameraView != "GUNNER"};
setAperture -1
}
}
};
Any ideas?
yes - don't use init field
remove this call wrapping too, it is useless
use initPlayerLocal.sqf to put your code in it?
https://community.bistudio.com/wiki/Event_Scripts#initPlayerLocal.sqf
"remove this call wrapping too, it is useless" not in init field, it fixes the 0=... stuff that people normally do.
@winter rose
I started using call instead of null=, but if it goes in initplayerlocal that scope is useless, like you said.
do I need remote exec or anything? Just that in the initplayerlocal?
ughโฆ
isn't it what CBA does btw?
ye
Huh?!
you can't return anything to the init fields, otherwise you get an error (unless u run cba)
can someone help me why this isnt showing in zeus under compositions?
its showing in the editor
Even if you call that you get a return value
It still returns the handle
That's what I mean
Dunno, never did that
Man sqf just keeps getting weirder the more you learn
I think 3DEN and Zeus compositions are not the same.
is there a way to port them over to zeus?
https://steamcommunity.com/app/107410/discussions/0/1698294337768646762/
Looks like people have found a workaround, but I've never tried it.
I don't know why, it just works
3DEN compositions work completely differently from Zeus compositions.
A 3DEN composition is actually literally just the copy-paste information (when you press ctrl+c) dumped into a file.
Zeus works completely differently and cannot handle that stuff.
Zeus compositions are actually not "compositions", but groups. Like how you place a group/squad of soldiers down.
Ahh so basically change
{
side=8;
name = "Compositions";
class Custom
to a group instead of empty
didnt work sad face
Is anyone good at world to screen projections?
let me ask the question first.
so I'm trying to create a "drawLine2D" function.
there's a problem with worldToScreen command. if the position is offscreen the command returns an empty array.
so I want to account for these cases as well.
what I do is project the position onto the camera plane, then convert the projection to the camera coordinates.
but the line angle is off. can anyone tell why?
deleteVehicle test;
test = createSimpleObject ["Sign_Arrow_F", eyePos player, true];
onEachFrame {
_disp = findDisplay 46;
_n = getCameraViewDirection cameraOn; //camera view dir; and the normal of the view plane
_vup = vectorUpVisual cameraOn; //camera's vectorUp; used only for banking
_u = _n vectorCrossProduct _vup; //side vector
_vup = _u vectorCrossProduct _n; //get the actual vector up; used to later transform the projection from world to camera (screen) space
_p = positionCameraToWorld [0,0,0];
_p1 = ASLToAGL eyePos player;
test setPosASL AGLToASL _p1;
_p2 = ASLToAGL eyePos AI;
_p1p = worldToScreen _p1;
(if (_p1p isEqualTo [] || true) then {
_v = _p1 vectorDiff _p;
_p1p = _v vectorDiff (_n vectorMultiply (vectorMagnitude _v * (_v vectorCos _n))); //projection
test setPosASL AGLToASL (_p1 vectorAdd _p1p);
[0.5 + vectorMagnitude _p1p * (_p1p vectorCos _u), 0.5 - vectorMagnitude _p1p * (_p1p vectorCos _vup)]; //projection in screen coordinates
} else {_p1p}) params ["_x1", "_y1"];
_p2p = worldToScreen _p2;
(if (_p2p isEqualTo [] || true) then {
_v = _p2 vectorDiff _p;
_p2p = _v vectorDiff (_n vectorMultiply (vectorMagnitude _v * (_v vectorCos _n))); //projection
test setPosASL AGLToASL (_p1 vectorAdd _p2p);
[0.5 + vectorMagnitude _p2p *(_p2p vectorCos _u), 0.5 - vectorMagnitude _p2p * (_p2p vectorCos _vup)]; //projection in screen coordinates
} else {_p2p}) params ["_x2", "_y2"];
test setVectorDirAndUp [_vup, _n];
_line = _disp getVariable ["LLine", controlNull];
if (isNull _line) then {
_line = _disp ctrlCreate ["RscLine", -1];
_disp setVariable ["LLine", _line];
};
drawLine3D [_p1, _p2, [1,1,1,1]];
_line ctrlSetPosition [_x1, _y1, _x2 - _x1, _y2 - _y1];
_line ctrlCommit 0;
};
this is a copy paste example,
you also need to create some unit named "AI" for it to work
I want to get the 2D line (ctrl) and the 3D line to overlap
ok here's another question:
does anyone know the name of the function that 3DEN uses when you hover the mouse over a connecting line?
apparently it also uses controls for those lines
so I could see what I'm doing wrong
It's a bit buggy, but at least not broken like mine! ๐
its probably not script
can you send me the code then?! ๐
Tell me what exactly to search for
I don't know. Maybe a mouse moving event handler?
It only shows when you hover the mouse over some line in 3DEN. like hovering the mouse over the line connecting group members
I guess it should be in a mouse moving event handler, no?
world to screen on non-map screen right?
no wait screen to world?
mouse hover will be screen to world
do you mean hovering over the connecting line when the "Group to" whatever tooltip appears? @little raptor
yes
that's the one!
@still forum maybe searching for "Group to" can have some results!
I did a search in functions, but no dice
functions in 3den.pbo
UI mouse position distance to the closest point on line defined by its UI render coordinates is smaller than 0.01ยฒ, then mouse is "on" line
I assume you want "WorldLineToUI" which turns a line in 3D world coordinates, into a line in 2D UI coordinates
yeah
or just WorldToUI which does it for one coordinate.
Well how does it draw? DrawLine3D I guess
no, it's a control
at least looks line one
drawLine3D doesn't pass thru lods
but this one does
for example, if you put a wall between the group members you can see the line passing thru it (it's actually a 2D line, so it doesn't really pass thru anything, it's just in front of the screen)
"DrawDiagLine3D", I guess that one passes through lods
what is that?!
nothing you have access to
it just uses the normal engine line drawing. same as everywhere
as for the WorldToScreen, it finds the rotation from camera towards the pointby rotating the inverse transform by point-camPos.
then X screen coord = 0.5 * (1.0 + camDirX * (1/CamDirZ) * cameraInvertedLeft);
y= 0.5 * (1.0 + camDirY * (1/CamDirZ) * cameraInvertedTop);
that sufficient?
thanks, I'll see what it means!
actually WorldToScreen does the same thing, just copy-pasted instead of calling the actual function for it
"if the position is offscreen the command returns an empty array."
nope, if the position is behind the camera it returns empty array.
The other code that 3den uses does the same, no position when behind camera
but I guess 3den must do something extra to handle that, as you can put your camera into the line?
Ah!
no the other code had special check for behind
if direction to point is behind camera, it does a intersection with juuuust infront of camera nearPlane
0.001m infront of nearPlane
and then uses that as the point
I don't think you have script access to the near clip plane.
But I guess with cam pos and direction you should be able to generate it
Is there a way to add a scope on a weapon that is in a weapon crate/container ?
X screen coord = 0.5 * (1.0 + camDirX * (1/CamDirZ) * cameraInvertedLeft);
y= 0.5 * (1.0 + camDirY * (1/CamDirZ) * cameraInvertedTop);
what arecameraInvertedTopandcameraInvertedLefthere?
this is pretty much the same thing I do:
[0.5 + vectorMagnitude _p1p * (_p1p vectorCos _u), 0.5 - vectorMagnitude _p1p * (_p1p vectorCos _vup)]
but I don't understand how the ui scaling part works
maybe that's the solution!
"what are cameraInvertedTop and cameraInvertedLeft here?" properties of the camera perspective ยฏ_(ใ)_/ยฏ
anyway, thanks for bearing with me! I'll see if I can figure this out
well my copy paste is broke.. grr
x = (xScreen - uiTopLeftX) / (uiBottomRightX - uiTopLeftX)
xScreen is the thing you got above
These are UI region from 0-1 
default for uiBottomRightX and Y is 0.925
and topleft 0.075
can be configured in the config where the fovTop/fovLeft/tripleHead things are
never seen these values be configured though
that's very interesting. thanks. let's see if it works!
help needed!... would like one character to have nightvision capabilities without wearing nods. just a simple press "n" option ... is this possible?
I can think of two solutions.
- Create an invisible nvg (requires modding)
- Use post processing effects
If you use the second option, you will lose the nvg features (e.g. you can't see the lasers anymore)
Set a password and don't tell people what it is until you're ready?
oh no i mean i for like 2 mins at the start of a mission restart
(it auto restarts every 3 hours)
super confused trying to modify Escape BI game mode
- it assigns all playable slots to BIS_grpMain, yet on a DS
unis BIS_grpMainalways returns empty array
init="BIS_grpMain = group this;"; isPlayable=1;
allPlayerstakes a 60+ seconds to become non empty- getting separated from my group right at mission start despite any respective sqf commands as far as i can see - does
setUnitLoadout(executed on the server) mess group assignment up? - playableUnits remains empty despite the other 9 AI still present from the player slots
rpt wise the only strange stuff is this:
9:30:27 Cannot create object 4:5 with type[AIGroup], param[group], NMT code[103]:
9:30:27 Cannot create object 4:6 with type[AISubgroup], param[subgroup], NMT code[107]:
9:30:27 Client: Object 4:6 (type Type_108) not found.
9:30:27 Client: Object 4:5 (type Type_104) not found.
9:30:27 Cannot create object 4:8 with type[AIUnit], param[unit], NMT code[112]:
9:30:27 Client: Object 4:5 (type Type_104) not found.
9:30:46 Client: Object 4:8 (type Type_113) not found.
9:30:46 Client: Object 4:8 (type Type_114) not found.
9:30:47 Setting invalid pitch -0.0000 for L Alpha 1-1:1 REMOTE
9:30:47 Setting invalid pitch -0.0000 for L Alpha 1-1:2 REMOTE```
in Eden/SP, all this works fine. i am quite experienced in MP coding, but never seen this - yet haven been using Eden but 2d editor so far
Is there a way to check if a trigger is currently active from within its own activation condition using thisTrigger?
Ideally I want to use this so that once count allUnits is above a certain number, no new triggers may be activated but triggers that are currently activated will stay active
I don't understand what you mean.
"this" in trigger condition means that the trigger condition is satisfied
"this" means it's "preliminary condition" is satisfied
for example, for a trigger with CIV PRESENT condition, this returns true if there are any civilians in it
this still has the same meaning as before.
so yeah, it should be triggerActivated thisTrigger || {this && {count allUnits < n}}
it satisfies the condition that @dusty badger asked
I want to use this so that once count allUnits is above a certain number, no new triggers may be activated but triggers that are currently activated will stay active
So when the trigger is looping the check for its activation condition, will this return its activation state at the end of the previous loop? If that makes sense.
no, only if it's "initial condition" is satisfied
for example, for a trigger with
CIVPRESENTcondition,thisreturns true if there are any civilians in it
https://community.bistudio.com/wiki/setTriggerStatements
this (Boolean) - detection event
I'm not 100% sure but it'd make no sense if it worked in a different way
Ok, I think I get it, thanks!
Btw, about that camera problem, I couldn't figure it out, but instead I resorted to a "creative" way to use worldToScreen
all I had to do was mirror the position relative to the camera position, then use worldToScreen on this mirrored point. and then finally stretch the line to the outside of the screen! :D
nope, if the position is behind the camera it returns empty array.
this helped a lot! thanks for the explanation! :)
onEachFrame {
_disp = findDisplay 46;
_line = _disp getVariable ["Line", controlNull];
if (isNull _line) then {
_line = _disp ctrlCreate ["RscLine", -1];
_disp setVariable ["Line", _line];
};
_p = positionCameraToWorld [0,0,0];
_uiScale = 10*(safeZoneWAbs + safeZoneH);
_p1 = ASLToAGL eyePos drone;
_p2 = ASLToAGL eyePos AI;
drawLine3D [_p1, _p2, [1,1,1,1]];
_p1p = worldToScreen _p1;
_p2p = worldToScreen _p2;
if (count _p1p == 0 && count _p2p == 0) exitWith {
_line ctrlSetFade 1;
_line ctrlCommit 0;
};
_line ctrlSetFade 0;
if (_p1p isEqualTo []) exitWith {
_p1p = worldToScreen (_p vectorAdd (_p vectorDiff _p1));
_p1p params ["_x1", "_y1"];
_p2p params ["_x2", "_y2"];
_line ctrlSetPosition [_x2, _y2, (_x2 - _x1)*_uiScale, (_y2 - _y1)*_uiScale];
_line ctrlCommit 0;
};
_p2p = worldToScreen _p2;
if (_p2p isEqualTo []) exitWith {
_p2p = worldToScreen (_p vectorAdd (_p vectorDiff _p2));
_p1p params ["_x1", "_y1"];
_p2p params ["_x2", "_y2"];
_line ctrlSetPosition [_x1, _y1, (_x1 - _x2)*_uiScale, (_y1 - _y2)*_uiScale];
_line ctrlCommit 0;
};
_p1p params ["_x1", "_y1"];
_p2p params ["_x2", "_y2"];
_line ctrlSetPosition [_x1, _y1, _x2 - _x1, _y2 - _y1];
_line ctrlCommit 0;
};
this one works, if anyone else was interested
Do custom functions called from within trigger conditions have access to magic variables only accessible within those conditions?
called yes
spawned no
alright cool
Hey guys, I have difficulties changing AI parachute deploy height. Basically, I want to tell an AI unit dropping towards ground at which height the parachute should be deployed. Standard height is 150m, but I need the AI to deploy at higher altitude.
unit action ["openParachute", unit]
why is there such long delay after mission start until allPlayers picks up player entities?
even in a hosted session it takes several seconds
@little raptor works like a charm. Once again, many thanks!!
only in a hosted session no?
according to https://community.bistudio.com/wiki/allPlayers
In a player-hosted game, the complete array of allPlayers may get delayed on mission start. Use BIS_fnc_listPlayers if you need it earlier.
the same is true on dedicated server
like i was questioning the implementation on the engine level
like it has to sync the data sure, but something is done strangely there
kinda agree. both player-side and server-side?
tested only server side - player side it most likely has the player itself at least instantly/once defined
@little raptor I'm currently testing this and that with your parachute script. I can only draw my hat on your math skill. It looks really cool when the AI homes in to me. Never could have done this by myself.
@velvet merlin allPlayers scans all "player camera positions" in the world.
Basically every player announces "Hey, there's a camera of a player here, so when you do stuff around me, I wanna know about it"
and thats what allPlayers looks into and returns
Though I don't see why that would be delayed for so long
thanks. will add some logging both and client to determine timing
the only reason for a longer delay i can think of is to make sure it detects all players from the start rather to init the variable once the first was found
How can i make a unit invincible with ace? This allow damage false seems not to work.
It should work after medical rewrite.
After medical rewrite? When would that be?
Hmm. I think i figured out the issue. thanks guys
changing the trigger interval seems like a pretty good way to simultaneously reduce the amount of work it takes to update triggers in your mission, while also compensating for things moving at high speeds that you may not want activating triggers that often
like if it checks every 3 seconds then anything going faster than 233m/s is less and less likely to activate a trigger with a range of 700m, and when it does it will be only for a brief moment
im trying to spawn randomized loot containers. i can place the containers in my map, but i want to place random predefined items in them. i was told i need a script and i am inexperienced
before Lou says this, I call dibs:
hi inexperienced, I'm dad! ๐ ๐ค (j/k)
anyway, see:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
https://community.bistudio.com/wiki/addItemCargoGlobal
wait, when did I become a veteran?!
yes magic happened
somewhere between now and 4 hours ago
wat
somewhere between now and 4 hours ago
20 minutes ago in #arma3_feedback_tracker he was white
that's what I was thinking! ๐
with blue name comes great responsibility.
only a bottle of scotch no?
do i pay my rent to leopard instead of lou now
no
no ๐ indeed
Imma overthrow Lou! ๐
sounds like fast way to lose the blue name ๐
he was a brave veteranโฆ for one hour
no sir, have mercy! 
I still have no access to the wiki! 
slow down man. Blue for 20minutes, now biki access, what's next? BI CEO? ๐
I thought it came with the title! ๐
The only thing that comes with the title is access to that channel with the weird ppl ๐
At what point does on become a veteran
there is no point
there is only a blurry line
someday you are not careful and trip over the line and smash your face into the ground and BAM! veteran!
When you are old.
THAT'Sโฆ accurate
Hey. Is it possible to enable and disable respawn module? Syncing it to trigger don't work, neither changing condition of presence
nope afaik
i see, thanks
Respawn position? Disable simulation
It works when respawn is on object so might work on module too.
can I ask here questions about scripting?
that's that this channel is for
well, better to ask before ;)
I'm not really into scripting, but not a beginner in general.
I want to parse an array into params like
_myArray = ["item1", "item2", "item3"];
[_myArray] call myFunction;
how should I design the params? for single values I use ["myString", "", [""]] or ["myNumber", 0, [0]] , as example. can someone give me a hint?
We can handle both of you at once ๐
This is the noobest of questions
lol
How do I know where to write a script and how to name it?
that's really rude bud
?
Check the examples at https://community.bistudio.com/wiki/params
Makes sure you always put an underscore before the variable (since they're always private), and it's not required to validate the values (although good practice).
For arrays you can use params [ ["_array", [], [[]]] ];
I am asking for myself, I am not implying anything if that is what you mean
@exotic flax thanks, already took a look into that, just want to get sure :)
@waxen sand well, ASL is not exactly the same like PHP, VB or C++ what I already learned at University ๐
I think he was refering to his own question that he was about to post.
The location of scripts is (almost) wherever you want, and there are multiple ways to access them.
My personal preference is using either CfgFunctions (see https://community.bistudio.com/wiki/Arma_3_Functions_Library#Adding_a_Function) or using the PREP macro in CBA (more a modding thing though).
I have to say sorry, understood it wrong.. had a long day at work today
https://community.bistudio.com/wiki/Event_Scripts
These always have the same name and are always in the mission root folder.
Other than that you can place script files in any number of subfolders of your mission root folder, naming them however you like.
Ohhhh..."Other than that you can place script files in any number of subfolders of your mission root folder, naming them however you like."
That was the answer I was looking for
So as long as I am strict on the names I use for my text files I can call the "Bob" or "John" for all the game cares
yup, except for naming them as the event scripts in a mission of course ๐
Allright
You just saved me two days of research to finally understand something as basic as that
One final question
Do I have to use more than one text files to separate vehicle related script and infantry related script, meaning scripts that are for different things.
?
Or can I just dump all the commands on one and separate them with notes
?
The game doesn't mind (and doesn't know) what it is you're doing in your script, it just runs one command after the other.
MyScript.sqf:
MyVehicle setPos [2, 1, 0];
MySoldier allowDamage false;
systemChat "Sample Text";
```Only the human knows what these have (or don't have) to do with each other.
You could dump everything in a single file, but I would do it.
First of all; you'll go crazy working on it or debugging issues
Second; it will limit you from proper/safe implementation (like using CfgFunctions).
That said; it doesn't matter what you do within a script, although I believe it's good practice to split up stuff unless related to each other. This comes in handy the moment you need to call scripts from Event Handlers.
Yes, that's what I thought from your previous answer
Thanks a lot, you have no idea how much you helped me
Now I just need to plan this mess I am about to make to be as less messy as possible
How to teleport player
to gunner seat in leader's vehicle(let's say its AH-64 Apache, or Bradley M2A3 whatever)
Both players in same group (Alpha 1-1)
my shitty code obv not wokring
_plr = _this select 0;
_playerGrp = group player;
_GroupLeader = leader (group (player));
_vehicle = leader vehicle;
_plr moveInGunner leader _vehicle;```
moveInGunner takes a vehicle, not the leader of a vehicle
_vehicle = leader vehicle; you mean the vehicle OF the leader?
_playerGrp = group player;
_groupLeader = leader _playerGrp;
_vehicle = vehicle _groupLeader;
player moveInGunner _vehicle;
```There we go, I hope you didn't read the nonsense that I just deleted.
Just plain english.
vehicle of the leader
vehicle leader
_vehicle = vehicle _groupLeader
onPlayerRespawn.sqf ```sqf
_plr = player;
_plr addrating -100000;
_actionid = _plr addAction ["New vehicle", "scripts\spawnvehicle.sqf"];
_actionid1 = _plr addAction ["GetAsGunner", "scripts\getAsGunner.sqf"];
scripts\getAsGunner.sqf sqf _playerGrp = group player; _groupLeader = leader _playerGrp; _vehicle = vehicle _groupLeader; player moveInGunner _vehicle;
scripts\spawnvehicle.sqf
https://pastebin.com/7MtcnNNV
im a bit tilting that such simple thing not working 
0:41:58 [CBA] (xeh) INFO: [12679,279.967,0] PostInit finished.
0:41:58 [ACE] (common) INFO: Settings initialized.
0:41:58 [ACE] (common) INFO: 3 delayed functions running.
0:41:58 Unknown task state:
0:41:58 Unknown task state:
0:41:58 Unknown task state: ```
@willow hound Could you checkout this vid, what i do wrong?https://www.youtube.com/watch?v=Bab4uCOFum8
Is it possible to have a sector call a function and pass all three of its parameters?
statement - Code that will be executed when the ownerside of the sector changes. The following arguments will be passed: [module, ownerSide, previousOwnerSide]. (Default: Nothing)
so as long as I place the call llama_fnc_whatever it will pass the params?
If you put the following in that field it should work
_this call llama_fnc_whatever;
``` or ```sqf
params ["_module", "_newOwner", "_oldOwner"];
[_module, _newOwner, _oldOwner] call llama_fnc_whatever;
Does the group leader exist in this clip?
https://community.bistudio.com/wiki/Eden_Editor:_Scenario_Attributes#Multiplayer > Enable AI
There is a mission setting (see the link above) where playable units don't exist if there is no player actually playing them.
@exotic flax thank you
Thank you so much, all working as intended!
Kinda stupid question, but how i can download https://forums.bohemia.net/forums/topic/204747-release-gom-aircraft-loadout-v135/ ?
gom aircraft loadout
โฆthere are two download links, click on one?
uh, armaholic ftp blocked in Russia hmm, VPN works
["BIS_grpMain 1",[O Alpha 1-1:1 (test) REMOTE,O Alpha 1-1:2,O Alpha 1-1:3,O Alpha 1-1:4,O Alpha 1-1:5,O Alpha 1-1:6,O Alpha 1-1:7,O Alpha 1-1:8,O Alpha 1-1:9,O Alpha 1-1:10]]
["BIS_grpMain XXX",O Alpha 1-1,[O Alpha 1-1:1 (test) REMOTE,O Alpha 1-1:2,O Alpha 1-1:3,O Alpha 1-1:4,O Alpha 1-1:5,O Alpha 1-1:6,O Alpha 1-1:7,O Alpha 1-1:8,O Alpha 1-1:9,O Alpha 1-1:10]]
["allPlayers XXX",[]]
["playableUnits XXX",[O Alpha 1-1:1 (test) REMOTE,O Alpha 1-1:2,O Alpha 1-1:3,O Alpha 1-1:4,O Alpha 1-1:5,O Alpha 1-1:6,O Alpha 1-1:7,O Alpha 1-1:8,O Alpha 1-1:9,O Alpha 1-1:10]]
["switchableUnits XXX",[]]
Cannot create object 4:5 with type[AIGroup], param[group], NMT code[103]:
Cannot create object 4:6 with type[AISubgroup], param[subgroup], NMT code[107]:
Client: Object 4:6 (type Type_108) not found.
Client: Object 4:5 (type Type_104) not found.
Cannot create object 4:8 with type[AIUnit], param[unit], NMT code[112]:
Client: Object 4:5 (type Type_104) not found.
Cannot create object 4:9 with type[AIGroup], param[group], NMT code[103]:
Cannot create object 4:10 with type[AISubgroup], param[subgroup], NMT code[107]:
Client: Object 4:10 (type Type_108) not found.
Client: Object 4:9 (type Type_104) not found.
Cannot create object 4:11 with type[AIGroup], param[group], NMT code[103]:
Cannot create object 4:12 with type[AISubgroup], param[subgroup], NMT code[107]:
Client: Object 4:12 (type Type_108) not found.
Client: Object 4:11 (type Type_104) not found.
Cannot create object 4:13 with type[AIGroup], param[group], NMT code[103]:
Cannot create object 4:14 with type[AISubgroup], param[subgroup], NMT code[107]:
Client: Object 4:14 (type Type_108) not found.
Client: Object 4:13 (type Type_104) not found.
Client: Object 4:8 (type Type_113) not found.
Client: Object 4:8 (type Type_114) not found.
["BIS_grpMain XXX",<NULL-group>,[]]
["allPlayers XXX",[]]
["playableUnits XXX",[]]
["switchableUnits XXX",[]]```
is there anything on sqf side to remove AI from playableUnits? or an Eden setting? or something in server.cfg?
Maybe !isPlayer _x
But don't think you can remove them
its like "something" tries to clean them up/remove them
they dont get deleted but every playable units gets separated into a <null group>
im not sure if this is the correct channel but we need to know if we have a headless client will we lose control of AI spawned in by Zeus?
shouldnt be any different unless you use a script to transfer ownership
Hi guys trying to fix an issue with a system I have made. Here is my extract:
_side_Option_Temp = toUpper (lbText [2100, lbCurSel 2100]);
systemChat format ["Before Switch %1", _side_Option_Temp]; //this is "GUER", as expected
switch (_side_Option_Temp) do {
case ("WEST"): {
_side_Option = "West";
};
case ("EAST"): {
_side_Option = "East";
};
case ("GUER"): {
_side_Option = "Indep";
systemChat _side_Option; //this is Indep
systemchat "Indep chosen."; // this is correct
};
default {};
};
systemChat format ["After Switch %1", _side_Option]; //this becomes any.
///blah blah - later on...
collect3DENHistory {
_squad = configfile >> "CfgGroups" >> _side_Option >> _factions_option >> "Infantry" >> _squads_option;
systemChat format ["%1 is the squad chosen", _squad]; //this becomes a number?
For some reason independent faction is never passed through correctly. I have run some debugging, and found that although my variable under the switch _side_Option is correctly set to "Indep", which is required for cfgGroups, it is picked up outside of the switch as any and then a number when using configFile.
Any ideas on this? the other two factions, west and east, work perfectly fine.
is _side_Option defined before the switch?
Uh it should be... I bet it isn't.
based on that snippet alone it looks like a scope issue, none of the cases should work.
ok, but why?! ๐

//preprocessFileLineNumbers "userconfig\test.sqf"
#define TEST 1
#if TEST
bla
#endif
#if __has_include ("test2.sqf")
ble
#endif
#pragma I_do_stuff(bla, bla, bla) bla \
bla bla

โฆare you trying to replace sqf with preprocessor commands ๐
are there any problems related to switch do when conditions are strings?
`_randomPrices = [
"cash", "respect", "materials", "cdah"
];
_randomPriceValue = selectRandom _randomPrices;
switch(_randomPriceValue) do {
case "cash": {
};
case "respect": {
};
case "materials": {
};
case "cdah": {
};
default: {
};
};`
is not working at all.. but when I do it in classic if else statements, it works just fine. or do I miss something?
default takes no *semi*colon
also, ```sqf
strange.. https://community.bistudio.com/wiki/switch_do describes it with default { hint "default" };
and you wrote default**:** {
count (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_reconSentry") What is this actually counting? returns 6, should probs mention
colon* (:)
semicolon (;)
I made a mistake as well, it's colon
number of subclasses, see count wiki page?
Oh i Missed that that third one the number of sub-entries in a config entry

so thats not the way to count a units in a group via config
no ๐
Any ideas on that? Im guessing just count these sub classes
to be fair, that page was refactored yesterday as well ๐
And thats why i didn't remember it... yes you're right ๐
haha
see code at the bottom of https://community.bistudio.com/wiki/Arma_3_CfgGroups
private _units = "true" configClasses _x;
count _units; // maybe?
but isn't counting subclasses correct?
careful, for tis I who wrote that code ๐
more like "be wary, may implode your CPU, steal your money and burn your pillow"!
hahah better get a fire extinguisher ready in that case
hmmm there is still something wrong.... for me it looks ok
switch(_currentDay) do {
case 6;
case 13;
case 20: {
};
case 24: {
};
case 25;
case 26: {
};
case 31: {
};
default {
_randomPrices = [
"cash", "respect", "materials", "cdah"
];
_randomPriceValue = selectRandom _randomPrices;
switch(_randomPriceValue) do {
case "cash": {
};
case "respect": {
};
case "materials": {
};
case "cdah": {
};
default {
["ErrorTitleAndText", ["Something went wrong. Please report this to an admin (error: random price not set)"]] spawn ExileClient_gui_toaster_addTemplateToast;
};
};
};
};
or is this
case 6;
case 13;
case 20:
not intended for numbers?
Looks fine to me, what's the error message?
I am afraid he does not have them activated, otherwise he would have seen the default'#': error
@winter rose sorry, now I understood ๐
sqf only need to be after the top ```
restart with error logging and try again
client side?
In the A3Launcher, goto parameters, under author at the bottom tick the show script errors box
restart your client and then try again with the code
are these script errors logged into my local .rpt?
they'll show in a black box in trhe middle of your screen
it vanishes too fast ๐
aye, I missed a ; anywhere in the code, much thanks
what did the full rpt say
it can be misleading with the missing ; if you're not familiar with this debug system
15:28:07 Error in expression <leClientPlayerScore = _newPlayerRespect
format["setAccountScore:%1:%2", _newPlay>
15:28:07 Error position: <format["setAccountScore:%1:%2", _newPlay>
15:28:07 Error Fehlendes ;
15:28:07 File a3_infiSTAR_Exile_customApps\apps\fn_avmg_advent_calendar.sqf..., line 74
15:28:07 Error in expression <leClientPlayerScore = _newPlayerRespect
format["setAccountScore:%1:%2", _newPlay>
15:28:07 Error position: <format["setAccountScore:%1:%2", _newPlay>
15:28:07 Error Fehlendes ;
15:28:07 File a3_infiSTAR_Exile_customApps\apps\fn_avmg_advent_calendar.sqf..., line 74
Ah yeah un-related to above, check your code above the switch
every time these stupid semicolons... the beginner error #1
haha
"alright, we are shipping your machine to the client"
(but please, no links without description #rules)
@winter rose wilco ๐
im using MGI_1ManTank script
after some time script stops working with following .rpt error
MGI_agent = nil;
(findDisplay 46) displayRemoveEventHandler ["keyDown",MGI>
17:23:18 Error position: <displayRemoveEventHandler ["keyDown",MGI>
17:23:18 Error Type Any, expected Number
17:23:18 Error in expression <gent;```
then it's broken ๐คทโโ๏ธ
MGI_EHTank = ["MGI_TK","onEachFrame", {
_veh = vehicle player;
if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith {
deleteVehicle MGI_agent;
MGI_agent = nil;
(findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving];
MGI_keysDriving = nil;
};
posting the EH isn't gonna fix it ๐
@quasi sedge ask the author to fix it, or see if there isn't an updated version available already
the script is written kinda badly
but the fix is simple:
(findDisplay 46) displayRemoveEventHandler ["keyDown", missionNamespace getVariable ["MGI_keysDriving", -1]];
I don't understand the author's compulsive need to set everything to nil! ๐
the issue is due to timing
if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith {
it may exit here without ever defining the variable
memory spaaace!
I bet he really needed those 4 bytes! ๐
@little raptor big thanks!
while !{ _totalUnits isEqualTo _total } the ! is in the wrong place isn't it...
so basically while _totalUnits isn't == to _total do some stuff
Ignore me...
Would help if I read by errors.
Hello, I have a question how do we adapt the size of the dialogs according to the screen resolution?
Sounds like a question for the #arma3_gui channel
Yes
So uh.
I made an infinite loop and I can't figure out why.
_total = 60;
_totalUnits = 0;
_unitCount = count ("true" configClasses _squad);
_groupSide = west;
_Finalgroup = createGroup _groupSide;
while { !(_totalUnits isEqualTo _total) } do {
//Catch code before going over 60 units
_NextTotal = _totalUnits + _unitCount;
if (_totalUnits isEqualTo _total) exitWith {};
if (_NextTotal >= _total) then {
_intDiff = _NextTotal - _total;
systemChat str _intDiff;
for "_i" from 0 to _intDiff do {
_unitID = format ["Unit%1", _i];
systemChat str _unitID;
_unitType = getText (_squad >> _unitID >> "Vehicle");
systemChat str _unitType;
_Unit = _unitType createVehicle _position;
[_unit] join _Finalgroup;
};
} else {
//Create a group with given data
_group = create3DENComposition [_squad, _position];
{
add3DENConnection ["sync", _x, _ZeusAttributeCuratorAddEditableObjects];
_x set3DENAttribute ["ControlMP", true];
sleep 0.01;
} forEach _group;
_totalUnits = _totalUnits + _unitCount;
};
};
//to avoid loading screen lock (found during testing)
sleep 0.1;
};
it's looping at
} else { //Create a group with given data _group = create3DENComposition [_squad, _position]; //blah
Variables are correct, no errors.
My guess is it isn't catching that its reached 60 because the while loop is never ending. I attempted to stop it via if (_totalUnits isEqualTo _total) exitWith {};
Should add that the squads are created correctly, its on the final part where it is making the final units to get to 60, in which it just never ends.
Have you checked the value of the variables?
Ahhhh
Just check the variables next time
put a systemChat or diag_log or so everywhere
Yeah I have been, but didn't catch the bad value etc. from the looping
thank you anyhow
Think im over thinking it... How would I go about fixing it?
Yeah
private _array = [];
private _limit = 5;
while { count _array < _limit } do
{
_array pushBack "value";
};
It seems that running player enablesimulation false in a vehicle doesn't work. The player can still fire turrets and move the vehicle. Is this a known issue, and if so is there a workaround? I'd like the player to only be able to look around for a set amount of time and then able to move/fire turrets normally.
if you're trying to stop the vehicle itself, use vehicle player enablesimulation false
by using player, you're stopping the player inside the vehicle only, not the vehicle
Yeah that seems to work. However I can't look around. Is there a command to disable everything but looking around?
nope - you can lock turrets and/or vehicle though
Are you talking about the option in the editor to lock vehicles or something else?
Seems interesting but doesn't work for my purposes. It needs to work when the player is already in the turret/driver seat.
Hi
easy question:
How can I make the game do a sector owner check?
Or detect when a sector changes owner and act as a trigger
?
the module comes with an event handler that runs when the owner changes (called "expression")
that plus
sector getVariable ["TaskOwner", 0]
Yes
you can find all the possible values in the config
Just found it
Thanks
Ok. I am completely new to this and probably not very smart so bear with me for a bit.
sector getVariable ["TaskOwner", 0]
That is the command when a trigger is triggered for the game to check the owner of a sector, right?
all it does is gets a variable from whatever sector is, it doesn't check/compare anything
Sure
What I need is the trigger. Like "when sector_1 changes owner, do "this""
Nvm
Found that as well
Ecevm is what you should not use and get the "use [...] call fnc_your_method and Cfgfunctions" and can be used to spawn sqf scripts
Execfsm runs the "finite state Machine" you probably do not have and use ๐
Fsm is documented in biki tho
Can always stop the vehicle from starting if you need to disable movement, and then only allow them in the driver's seat. Guess it depends on your use case though.
_vehicle setFuel 0/setHitPointDamage (on the engine) or removeWeapon(Turret) can help you ๐
Is there a way to load an arsenal loadout by name?
I want to equip AI with loadouts that I have created in the arsenal and saved under a particular name.
you could export the loadout and use that?
I obv want to do it programatically and dynamically.
you could make a list with exports (done with getUnitLoadout), and dynamically set the loadout when needed with setUnitLoadout
maybe using profileNamespace content, but then it would not work on another machine
getUnitLoadout requires an actual unit to have the desired loadout already.
Ok, thanks, I'll try that.
I still don't see how to use getUnitLoadout to access arsenal saved loadouts.
it isnt, it is an alternative way to access defined loadouts (not in arsenal)
if you are really set on using arsenal loadouts then this might work, but as mentioned it would only work for you unless someone else has the same preset defined on their profile.
private _name = "My arsenal name"; // name to search for
private _data = profilenamespace getvariable ["bis_fnc_saveInventory_data",[]];
private _index = _data find _name;
private _inventory = if (_index == -1) then {[/* default loadout? */]}else {_data#(_index + 1)};
_inventory params ["_uniform", "_vest", "_backpack", "_headgear", "_goggles", "_binocular", "_primary", "_secondary", "_handgun", "_items", "_other"];
@robust hollow That works, thanks
hey guys,
im slightly confused as why my maths isnt working here.
_test = if ((count (allPlayers - entities "HeadlessClient_F")) > 0 ) then {diag_log format ["autopause debug"];};
I am running this after creating an EH for Onplayerconnect that then does the code above on server side(called 2 mins after server start so that the mod it will call is init'ed). i know that this being evaluated as i have another diag_log to show if it runs past this line and im only using the diag_log format ["autopause debug" to debug.
i have managed to get the disconnect to work by simply changing it from more than 0 to equal to 0. I am about to go try != as i hope that works.
oddly when running this from the debug in game and executing on server works fine....
do i need a hpp file for a insignia mod? nad if so, what does "timepacked=" mean?
@robust hollow Do I use _inventory with setUnitLoadout?
nah its not the right format for that. you could reorganize the array if you want, or use individual commands which is what arsenal does i imagine
Okay, I'll just try the _data select (index + 1) array for now
any kind of file as long as it is included in the config.cpp. i dont think you need to worry about time packed, iirc its an addon builder thing.
because im trying to make a insignia mod and its not showing up so im thinking that im missing some code to force it to the arsenal
onPlayerConnected might fire before the hc has an entity in the world.
i have the EH's firing 2 mins after mission start and the two HCs are there
not scripting, #arma3_config
does the EH store the number of HCs as it created or is it evaluted every EH fire
im new to this! idk what the differnnce is
ah! well scripting is using SQF, config is hpp/defines ๐
ah i see
if that code is in the eh it will evaluate every time it fires. i think i misread it a bit so let me clarify: you want that diag_log to run when there is atleast one player loaded in (including the one connecting)?
im trying to get an EH that fires["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule; when players connect
you can replace "autopause debug" with ["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule;
its just that it isnt firing ["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule; ever....
how many players are connected?
if it is just one, then you will need to change the condition because they also wont have unit when that event fires.
i think a reliable alternative check would be on the _uid. the server (dedicated) will return "__SERVER__", and if the wiki is to be believed, HC's will return "HC1234" where the number is the process id. so you could do one of these
private _isPlayer = parseNumber _uid != 0;
// ----
private _isPlayer = _uid find "7" == 0;
or something like that, and it should only be true when a real player is connecting.
Hey all,
there is 'mission end' trigger?
if i wanna execute script / command when the text pops up
or event
so while my mind is reee'ing trying to work out what you mean, ill get back to you on if it works soon!
tnx, but Ive tied it before, that event fired when the mission complete (score table), I want to execute some code when the 'mission complete / fail' appears.
sorry for broken English ๐
if ((_test) != 0) then {diag_log format ["acon.sqf done"];} else {diag_log format ["acdddddddddddddddddddsqf done"];};
im being told im missing brackets?
where from?
let's clean it up a bit:
if ((_test) != 0) then {
diag_log format ["acon.sqf done"];
} else {
diag_log format ["acdddddddddddddddddddsqf done"];
};
and please read the documentation about format, because that is not how you use it
either use diag_log "acon.sqf done"; or set the proper parameters in format ["string %1", _value];
i dont think there are any good ways. you would have to do a loop to check if the text display is open.
eg:
// inside a loop of some form
// the RscMissionEnd rsclayer uses RscDisplayDebriefing as the variable name
private _display = uiNamespace getVariable ["RscDisplayDebriefing",displayNull];
if !isNull _display then {
/* end event */
};
ok, that a little bit socks, but iam glad to have any solution, although I dont like infinite loops. I will try it tomorrow and come back with the conclusions.
thank you!
ahhhhh ok ty Grezvany! i get what i did wrong there
@exotic flax is there any syntax change inyour code to mine?
nope, just made it readable so it's easier to spot any errors
because i made it neater in my script and ive changed it a bit and its still telling me im missing brackets


