#arma3_scripting
1 messages · Page 144 of 1
Disabled all filtering and just logging beginning of EHs
FiredMan - No Detonation Yet
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Fired Man
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Projectile: 627389: c4_charge_small.p3d
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Ammo: DemoCharge_Remote_Ammo
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Simulation: shotmine
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Adding event handlers to projectile: 627389: c4_charge_small.p3d
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Explosion EH Successful: 627389: c4_charge_small.p3d
12:52:00 [CARRIERSTRIKE] (Mission) LOG: HitPart EH Successful: 627389: c4_charge_small.p3d
12:52:00 [CARRIERSTRIKE] (Mission) LOG: Submunition EH Successful: 627389: c4_charge_small.p3d
HitExplosion && HitPart - Detonated
// no response
Generic HandleDamage is picking up the projectile/hit though
What object are you blowing up?
"Land_Device_disassembled_F" wonder if that object just doesn't track? I'll try other objects.
On a helicopter (ghosthawk)
FiredMan
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Fired Man
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Projectile: 627276: c4_charge_small.p3d
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Ammo: DemoCharge_Remote_Ammo
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Simulation: shotmine
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Adding event handlers to projectile: 627276: c4_charge_small.p3d
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Explosion EH Successful: 627276: c4_charge_small.p3d
12:51:06 [CARRIERSTRIKE] (Mission) LOG: HitPart EH Successful: 627276: c4_charge_small.p3d
12:51:06 [CARRIERSTRIKE] (Mission) LOG: Submunition EH Successful: 627276: c4_charge_small.p3d
Hit Explosion
12:51:15 [CARRIERSTRIKE] (Mission) LOG: Hit Explosion
12:51:15 [CARRIERSTRIKE] (Mission) LOG: Projectile: 627276: c4_charge_small.p3d
12:51:15 [CARRIERSTRIKE] (Mission) LOG: Ammo: any
12:51:15 [CARRIERSTRIKE] (Mission) LOG: Simulation: shotmine
12:51:15 [CARRIERSTRIKE] (Mission) LOG: Hit Entity: 2cab770c080# 627205: heli_light_03_unarmed_f.p3d
Huh, it doesn't register for me either
Looks like there are some model requirements for these events to register
I wonder which one, so I can just change the object to something different
edit: none of the device alternatives work either
is anyone able to help me with extdb3 for amra 3 server database? i have it set and running but is saves data locally to .vars not to a db on my server. Somthing has caused my server to imprint a bad local db save to the players .vars file causing the scripts on my server to not run for select players. I know it is in the .vars because when i told them to delete it, it worked. A few joins later the server re-imprints on their profile making the scripts no longer run again for select players out of random. what do i do
Probably having HitPoints
Looks like an oversight that these events don't even trigger to be honest
Worth a ticket? Or would it be a pain in the backend too?
Its weird though, since shotbullet and shotrocket work find
maybe I could do a explode projectile event handler and just do a distance check instead for the satchels
edit: yes i think this is the answer. I'll pull the explosion radius from the config and do a distance check
I am writing a script that does something akin to garrisoning units, but basically it just copies a single unit's loadout and creates new units in the places of pink helper arrows.
{
_unitLoadout = getUnitLoadout _entity;
_unitGoggles = goggles _entity;
_grp = createGroup east;
if (side _entity == west) then {
_grp = createGroup west;
};
if (side _entity == resistance) then {
_grp = createGroup resistance;
};
if (side _entity == civilian) then {
_grp = createGroup civilian;
};
_count = _count + 1;
_unit = _grp createUnit ["B_Survivor_F", getPosATL _x, [], 0, "NONE"];
_unit setPosWorld (getPosWorld _x);
[_unit] joinSilent _grp;
_unit setUnitLoadout [_unitLoadout,true];
removeGoggles _unit;
_unit addGoggles _unitGoggles;
if (_randomizeRotation) then {
_unit setDir random 360;
};
{_x addCuratorEditableObjects [[_unit],true];} count allCurators;
if (_deleteArrows) then {
deleteVehicle _x;
};
} forEach nearestObjects [_entity, ["Sign_Arrow_Pink_F"], _radius];
Everything works totally fine here, except for the fact that the goggles slot is not populated by the getUnitLoadout and setUnitLoadout combination. Everything else is copied except for the facewear, and I even tried manually getting the goggles, removing the new unit's goggles, then assigning the saved classname via addGoggles with no success. Every time the units spawn, they either have no facewear, tactical glasses, or the combat goggles and it seems pretty random.
My first assumption was that the getUnitLoadout doesn't save facewear, but the _unit addGoggles _unitGoggles; line isn't doing anything either so now I'm just stuck
I think so
Worth a ticket*
inb4 character randomization
you leave the server?
yeah
tried with a few different goggles, just using getunitloadout and setunitloadout. works fine for me
It works when I do something like this in the init field of the new unit:
_loadout = getUnitLoadout originalUnit;
this setUnitLoadout _loadout;
but when I try to use the script I posted, it still excludes facewear:
https://cdn.discordapp.com/attachments/546396406034726915/1248711577398411405/image.png?ex=6664a8c7&is=66635747&hm=649e4a1d77aa9ef9ac200741fd02aa6ddd36615b3912ad3cfffdc13a4716a255&
have you tried cba_fnc_getloadout and cba_fnc_setloadout
I thought maybe it had to do with the unit I was using as the base when creating the unit since the B_Survivor_F always randomly picks between no facewear, tac glasses, or combat goggles, and the B_RangeMaster_F always has the tac glasses
yep artemoz called it
hello again btw artemoz nice to see you're back
yeah, hello, i guess 8 months of no arma is enough to fix my arma/life balance after averaging like 6 hours per day 🤣
your daily inb4s were missed
hmm. B_Survivor_F does not appear to have an init event handler.
@outer bay Are you running with any mods?
Since I'm creating units via script, I presume that setting _unit setVariable ["BIS_enableRandomization", false]; before I set the loadout will work since the unit has to be created first? So in my code I'd be adding it here, but it doesn't fix the issue so I wonder if it is related to the order of the commands?
All vanilla
I'm developing with pub zeus in mind
{
_unitLoadout = getUnitLoadout _entity;
_unitGoggles = goggles _entity;
_grp = createGroup east;
if (side _entity == west) then {
_grp = createGroup west;
};
if (side _entity == resistance) then {
_grp = createGroup resistance;
};
if (side _entity == civilian) then {
_grp = createGroup civilian;
};
_count = _count + 1;
_unit = _grp createUnit ["B_Survivor_F", getPosATL _x, [], 0, "NONE"];
+ _unit setVariable ["BIS_enableRandomization", false];
_unit setPosWorld (getPosWorld _x);
[_unit] joinSilent _grp;
_unit setUnitLoadout [_unitLoadout,true];
removeGoggles _unit;
_unit addGoggles _unitGoggles;
if (_randomizeRotation) then {
_unit setDir random 360;
};
{_x addCuratorEditableObjects [[_unit],true];} count allCurators;
if (_deleteArrows) then {
deleteVehicle _x;
};
} forEach nearestObjects [_entity, ["Sign_Arrow_Pink_F"], _radius];
Yeah this is what I tried, but I guess if the config for the survivor unit doesn't have the handler, I'll need to find one that does
I guess the goggles are from the identity, not the headgear randomization.
So maybe I'd have to find the identity that has those goggles and use setIdentity
You'd kinda expect the identity to be set locally on unit creation anyway...
The headgear randomization thing at least has the excuse for a delay.
right when i was typing my half-joke about spawning a separate thread
oh look at that, a diff syntax. wonder if you can combine it with other syntaxes
how on earth do you do that
```diff
stuff
```diff
looks flashmob-y
oh
@outer bay What's your testing context here btw?
```diff
- diff remove
- diff add
nothing changed
```
eyyy, markdown strikes again 
You mean where I'm executing the code?
I am currently in single player
ok
yeah the script properly creates and loads loadouts on both SP and MP, but both do not have correct facewear
one other piece of context is that I am using the EZM framework to make this a module, so that's where the execution occurs
Confirmed, this generates mismatches in SP:
_grp = group player;
_unit = _grp createUnit ["B_Survivor_F", getPosATL player, [], 0, "NONE"];
_goggles = goggles _unit;
[_unit, _goggles] spawn {
params ["_unit", "_goggles"];
sleep 2;
hint format ["Old goggles %1, new goggles %2", _goggles, goggles _unit];
deleteVehicle _unit;
};
CBA running? With its separatly stored XEHs? 
nothing except ADT
fun stuff. As always.
Engine adding frame delay for some goddamned reason
inb4 head spawns a frame later than body
inb4 dedmen tries to fix it and everything breaks
yaay for reason to finally dive Reforger?
hah
so what I'm getting from this is that it is a real limitation
not a lot I can do for a workaround under my current implementation
You'd need to add a delay before setting the loadout.
any delay at all? sleep 0.01 would suffice or is there a number to be safe
or will I have to experiment
Trying to figure that out atm.
oh, wait, i've just now realised it's comparing the unit to itself. It's even funnier this way 
it worked with 0.1, I might be able to get that lower
though I do wonder if that would be different on an MP server
0.05 worked as well, I think I'll just leave it at that so at least the script doesn't accidentally spawn 1000 units all at once if it was given the chance to
one frame seems normal. Given that it's engine it shouldn't be variable.
fun fact, if you add an each frame handler it runs in the same frame you added it, and the goggles aren't there at that point either.
Kinda the wrong test given that we care when they're added relative to when scripts execute :P
try CBA_fnc_execNextFrame
wtf is with you people and CBA. CBA is just script.
cause all of the lovely math is already done for you in these cases. frame comparisons, delays, etc
CBA execNextFrame uses eachframe addMissionEventHandler, so same problem. This works for scheduled code anyway:
_grp = group player;
_unit = _grp createUnit ["B_Survivor_F", getPosATL player, [], 0, "NONE"];
diag_log format ["Start frame %1 goggles %2", diag_frameno, goggles _unit];
[_unit, diag_frameno] spawn {
params ["_unit", "_start"];
while {true} do {
diag_log format ["Frame %1 goggles %2", diag_frameno, goggles _unit];
if (diag_frameno > _start + 10) exitWith {};
uisleep 0.001;
};
deleteVehicle _unit;
};
So confirmed next frame works for both scheduled and unscheduled code.
face _unit starts as "Default" and changes next frame as well 🍿
Did you check the name?
nah, only face and goggles for now
workaround with unclear sideeffects: lockIdentity _unit; right after spawning the unit. Facewear set by setUnitLoadout getUnitLoadout doesn't get changed 🤣
nice
side effect 1: unit doesn't get a name 🤣
because we Cant Be Arsed to write it ourselves
i mean, CBA exists in that grey area between language core library and NPM's leftPad package
Is there any way to force a specific lod to load for a vehicle? Like the cargo lod even if you arent inside the vehicle? Google isnt giving anything.
I'm also good with being able to create an object with that lod, like a simpleObject
no
Solved.
In fn_endMission:
"NUP_endSequence.sqf" remoteExec ["execVM", 0];
then in NUP_EndSequence.sqf
private _playerSide = side player;
if (_playerSide == Winner) then {
// Display win message with typewriter effect
[
[WinMessage, "<t align='center' shadow='1' size='1.0'>%1</t><br/>"]
] spawn BIS_endText;
playMusic ["LeadTrack01_F_Bootcamp", 132];
0 fadeMusic 2;
} else {
// Display lose message with typewriter effect
[
[LoseMessage, "<t align='center' shadow='1' size='1.0'>%1</t><br/>"]
] spawn BIS_endText;
playMusic "BackgroundTrack03_F_EPC";
0 fadeMusic 2;
};
//camera script here
waitUntil { diag_tickTime - _start >= 25 };
5 fadeMusic 0;
waitUntil { camCommitted _camera };
endMission "end";
Thanks for the help attempts!
Btw boundingBox's boundingSphereRadius does change for each segment and it shows almost perfect segment size ONLY if segment is bigger than base model. So its always more than 0.3.
Thought its a perfect way to get segment length fast but no
So far the fastest way to get segment length is vectorMagnitude vectorUpVisual _seg * 0.3
0.3 is model height for RopeSegment from bounding box
Tom Cruise Simulator 2035
this must be a repeating topic here but.... is there a good workaround for seting night time to a specific player? (setAperture wont work in this case because i want players to be capable of using flashlights and nvgs.)
the idea is, players can enter a bunker and i want it to be very dark, forcing players to use nvgs and fleshlights
i know that time in arma is set globaly but would it work to run a
[] spawn {while (playerInsideBunker) do{setdate[2024,1,1,0,0];}; };
or something like that? or is setdate a server onl command?
i am thinking of forcing the player to update frequently to night time before server syncs in
dont know... just an idea
Updating time regularly might not work very well because changing date causes micro freeze
Won't be a smooth experience
Sadly this forced sync ruined a lot of stuff in A3
That looks painful. How did you do this?
Doing rappeling where unit is traversing actual rope
Compared to attaching rope to a unit
Also tilts the unit by rope orientation
It works fine, this is a good addition, will stick with dev build for now.
There are some new angular velocity commands in dev build, could it be of any use for your Nautilus?
You can use nvgs with setAperture afaik
Also the flashlights can be scripted directional lights attached to the weapon (with very large intensity to cancel the effect of setAperture)
that entire predicament is why the commands are being added0
leopard spent so long trying to help me with it lol
Good day. I'm trying to spawn a ModuleHideTerrainObjects_F module. And facing a strange issue - if there is a player object nearby it will work in most cases. If there is no one nearby - it will not work at all. I suppose it has something to do with dynamic simulation? Did anyone face the same issue before? Is there a workaround/fix?
UPD: it's even wierder than that - it seems like it has something to do with how much time has elapsed since the start of the mission
They really only work correctly at mission start. If you want to hide terrain objects mid mission, use nearest terrain objects and hide them through script.
Is there any known explanation to that? I look through A3\Modules_F\Environment\HideTerrainObjects\init.sqf and I see no reason for it not to work on demand. Is there a way to call it for a newly created module?
Is there a way to check if a script / function is clogging the network in a multiplayer environment?
Usually easiest to read it :P
Like if you know which function might be problematic. If not then there's profiling, but you can't get complete information there.
Jesus Christ I swear this game works in mysterious ways sometimes.
Just in case anyone will face the same issue spawning a module mid-game that seems not to work. What you got to do is to save mission with module in it, so save -> export -> sqf -> copy. And follow exactly as in copied code:
- Spawn module with createUnit
- Setup variables
- Setup
setVariable ["BIS_fnc_initModules_disableAutoActivation",true] - ... continue spawning other objects
- And right after you placed everything else, get back to the module and
setvariable ["BIS_fnc_initModules_activate",true]
There. It works now. 
Why is this code so slow (~0.2ms)? I have rewritten in differently, and it takes like 33 times less to finish. I don´t get it.
private _eyeDirVec = vectorNormalized (eyeDirection opf1);
private _targetVec = (getPos opf1) vectorFromTo (getPos player);
private _dotProduct = _eyeDirVec vectorDotProduct _targetVec;
private _horizontalAngle = acos _dotProduct;
getPos is relatively slow, use one of the specific format commands if possible
so, basically, objects spawned after the module has done its work aren't hidden? 🤣
Spawned objects should not matter at all since this module takes nearestTerrainObjects to hide as I see in BIS_fnc_moduleHideTerrainObjects
And yet here we are
?
It just effect to object that is exists when it's created.
Or do you create it middle of mission or in editor?
You could do that without module.
Just some dot or some other marker, and hideObjectGlobal nearest objectsm
they have a massive-ish mission that dynamically spawns submissions. I suppose the problem surfaces at that point
and submissions are created by different people, exported to SQF and stored in the main mission as plain pieces of code to run. At least that's what i remember of it. Having to manually add code to run may be inconvenient in the workflow or something.
huh, unintended pun of "submission" here
You can also just call the function that the module runs off of directly avoiding all of that
Yeah, I saw that too that I can call a BIS_fnc_moduleHideTerrainObjects and pass the module object as an argument.
Counterpoint - the setVariable magic is universal for any module type as far as I can tell, so I'll be able to re-use my solution
But I'll keep both options in mind just in case. Thanks
offtop: I went further and reduced the entire thing to array of objects with type/pos/dir, placeholders, randomization, combination and all the shenanigans, basically re-inventing the mission import-export
was it worth a 100 workhours? We'll see. (it was not)
except BIS_fnc_moduleHideTerrainObjects is likely to be that very function you're looking at... and it expects the objvar to be set at line 55 _area append (_module getVariable ["objectarea",[]]); 
but anyways, workarounds should still be useful for, say, running the exported mission as Zeus or something
hi guys. quick question. is there a cleaner/better way to check admin status both in dedi and listen other than this:
((admin parsenumber getplayeruid player == 1) or (admin parsenumber getplayeruid player == 2) or (owner player == 2))
its mostly for addactions so _caller would be used instead of player.
im not sure if owner player always returns 2 for the host in a listen server tho.
... i guess "local player" would only be true for the host, all the time...
... or "isServer" lol.
Is it possible to attach tracer model to a bullet without changing regular ammunition?
this model a3\weapons_f\data\bullettracer\tracer_red.p3d attach it to the projectile with fired eventhandler?
@native hemlock
- use tripple ` for code blocks
- your code lacks support for different keyboards and non-default settings thus actionKeys should be used
This is true, I was just trying to show a quick and dirty example
just wanted to note
and 1. is a hint
nvm, solved it by using createSimpleObject and attaching it to the projectile
is it worth two headless clients on same pc, or better only one ? 
Game lags after 10+ hours of playing, I start the mission with hasInterface in singleplayer, I play in Zeus, I have the mod Alive. I checked the FPS and it's very good but the game still freezes. I don't know what the cause is? I closed Chrome, turned off some applications, turned off the Internet, nothing helps
Thanks, I didn't even know that triple ` existed
You can still vault with that code by spam clicking V
even when using input action. There is no way to prevent vaulting without changing configs
And you could bind vaulting to a mouse button, so keydown doesn't prevent that either.
Using an animChanged eventhandler doesn't work either. I've tried that before.
It causes you to float forward, no matter if you use playMove, switchMove etc.
when is scripting involved?
Hey there gents, Im looking for an Ambient flyby script for a mission. Ive looked on the bohemia site though it has left me confused. I could jsut be slow
https://community.bistudio.com/wiki/BIS_fnc_ambientFlyby
Spawns an air unit that moves from point A to point B, never engaging nor being engaged. It is set as captive and will despawn once it reaches its destination.
[startPos, endPos, altitude, speedMode, classname, side] call BIS_fnc_ambientFlyby;
So one way to do this is use a couple of markers, give them a name (pointA and pointB), then something like
// DAP_simpleFlyby.sqf
// Get positions of the points
_startPos = getMarkerPos "PointA";
_endPos = getMarkerPos "PointB";
// Define other parameters
_altitude = 300; //default is 100
_speedMode = "NORMAL"; //default
_className = "B_Heli_Light_01_F"; //default
_side = west; //default
// Call the function to perform the flyby
[_startPos, _endPos, _altitude, _speedMode, _className, _side] call BIS_fnc_ambientFlyby;
Then in your mission init:
execVM "DAP_simpleFlyby.sqf";
@astral saddle
That is brilliant thankyou
untested
So, problem: I need a civ bus to travel a route. I need the bus to stop at a busstop if the player is standing there and waiting. Then the player needs to "ping" the bus to stop at the next bus stop.
Is this doable simply, with some effort, or a shitload of work? I have a vauge idea about using load/ unload waypoints for the bus, and triggers, but is there a neat and tidy way to accomplish this?
Why do you need side? If the flyer is setCaptive anyways, I mean?
altitude, speedMode, classname, and side are all optional.
Ah. Ok. Thanks
I can't think of a better way
You can use setDriveOnPath instead of waypoints for example, to make the AI movement more predictable, but that might make it too complicated
Hello, trying to get this script working propperly, its telling me im missing a ) but I cannot for the life of me see it:
// Result
if (YESgun=true) then {
Obj2 setTaskState "SUCCEEDED";
["TaskSucceeded", ["", "Get NVGs"]] call BIS_fnc_showNotification;Specop say "niceshooting";
titletext ["Nice shooting, the NVGs are your's, Im sure you'll put them to good use."];
sleep 5;
player addItemToBackpack "optic_tws";
player addItem "UK3CB_BAF_HMNVS";Obj3 setTaskState "ASSIGNED";
["TaskAssigned", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
};else {Obj2 setTaskState "FAILED";
["TaskFailed", ["", "Get NVGs"]] call BIS_fnc_showNotification;
sleep 3;
Obj3 setTaskState "ASSIGNED";
["TaskAssigned", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
};
(Yes this is an attempt to port over 100 Days from A2 - A3)
You have 2 errors:
if (YESgun = true);beforeelse
// Result
if (YESgun==true) then {
Obj2 setTaskState "SUCCEEDED";
["TaskSucceeded", ["", "Get NVGs"]] call BIS_fnc_showNotification;
Specop say "niceshooting";
titletext ["Nice shooting, the NVGs are your's, Im sure you'll put them to good use."];
sleep 5;
player addItemToBackpack "optic_tws";
player addItem "UK3CB_BAF_HMNVS";
Obj3 setTaskState "ASSIGNED";
["TaskAssigned", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
}
else {
Obj2 setTaskState "FAILED";
["TaskFailed", ["", "Get NVGs"]] call BIS_fnc_showNotification;
sleep 3;
Obj3 setTaskState "ASSIGNED";
["TaskAssigned", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
};
Also if you're using this directly in a trigger code or something you should remove the comments
not in a trigger in a separate SQF
idk what 100 Days is but make sure you have the permission to do this
Its an incredible campaign from A2 - Dont think the guy has been active since about 2014, but Its more for me than with the intent of releasing it
You can replace (yesgun == true) with just yesgun. You don't need to do a check that returns true/false if the variable is true/false, just use the variable itself.
Cheers to the both of you!
One last one, is it possible to addItemToBackpack and addItem to Multiple units by using the squads variable name or will it not like that?
or just add a variable name to each unit and add multiple entries?
You can't use the group reference directly, those commands only accept units. But you can use it indirectly:
{
_x addItemToBackpack "someClassName";
} forEach units _group;```
So with my code above it would be
// Result
if (YESgun==true) then {
Obj2 setTaskState "SUCCEEDED";
["TaskSucceeded", ["", "Get NVGs"]] call BIS_fnc_showNotification;
Specop say "niceshooting";
titletext ["Nice shooting, the NVGs are your's, Im sure you'll put them to good use."];
sleep 5;
{
pfsquad addItemToBackpack "optic_tws";
pfsquad addItem "UK3CB_BAF_HMNVS";
} forEach units _group;
Obj3 setTaskState "ASSIGNED";
["TaskAssigned", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
}
else {
Obj2 setTaskState "FAILED";
["TaskFailed", ["", "Get NVGs"]] call BIS_fnc_showNotification;
sleep 3;
Obj3 setTaskState "ASSIGNED";
["TaskAssigned", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
};```
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
And no, that's not quite right
https://community.bistudio.com/wiki/forEach
_x is a magic variable that represents the current item that the forEach is operating on. Don't replace that, it's important.
If your group is named pfsquad, then that's the reference you need to use to get the list of units, which the forEach is applied to.
{
_x addItemToBackpack "optic_tws";
_x addItem "UK3CB_BAF_HMNVS";
} forEach units pfsquad;```
Gotcha!
im taking it that I cant just drop that in the middle of the code though as the "{}" brackets will throw off the other code?
It's safe to put it exactly where you put it in the code you posted a minute ago (although you should give it one extra indentation to make it visually clear what scope it's in)
The { } don't throw anything off, they're just the start and end of a piece of code; they can be put inside other pieces of code as long as they're a correct matching pair.
They don't work the same as the "" used for strings. You have to be careful doing this with strings because they use the same character for start and end, so nesting them can confuse the game. With {} the game can tell whether it's a start or end and find its correct counterpart.
I think im following you there
it doesn't seem to be liking something however, It says one element produced and 6 expected
Making a simple restricted arsenal, however I can't seem to be able to add items to the arsenal for whatever reason, what am I doing wrong?
Weapons, Mags & Backpacks work, problem is only with Items....
// works - i don't want to do this
// add everything
[player, ["%ALL"]] call BIS_fnc_addVirtualItemCargo;
// does not work
// all items excluding weareables
_itemsAll = "( getText (_x >> 'vehicleClass') isEqualTo 'Items' )" configClasses (configFile >> "CfgVehicles") apply {configName _x};
[player, _itemsAll] call BIS_fnc_addVirtualItemCargo;
// grasping at straws, do not work either
[player, _itemsAll, false, false] call BIS_fnc_addVirtualItemCargo;
[player, _itemsAll, true, true] call BIS_fnc_addVirtualItemCargo;
// does not work
// basic test items
_itemsAll = ["Item_Rangefinder","Item_NVGoggles","Item_NVGoggles_OPFOR","Item_NVGoggles_INDEP"];
[player, _itemsAll] call BIS_fnc_addVirtualItemCargo;
It should give a line number for where the error is.
One place to look: titleText. You're passing an array of one element (the text, p.s. yours, I'm) but the command requires a second element in the array (the fade type). The other elements are optional, but the first two are required.
I know a dll can return a maximum of 10240 octets, but is there a limit to the size of passed arguments ?
Gotcha, Thanks for your help
Gents, question for you. How do I find the variable name of weapons and ammo for modded vehicles (specifically the RHS Mi-24V)? I want the Hind's gun to place on a vehicle using the addWeapon and addMagazine scripts.
Do you mean the classname?
Exactly the same way as you would with a vanilla vehicle - look it up in the Config Viewer.
The vehicle's weapons are either in its first-level config under weapons (for driver-controlled weapons) or in its Turrets >> whicheverTurret subclass under weapons, for weapons controlled by other crew members.
"funny", but the https://community.bistudio.com/wiki/Extensions page does not mention 10240 bytes limit
(octet = byte in English ^^)
But this one does https://community.bistudio.com/wiki/callExtension
damn, Extensions and their scattered doc
My bad, i didn't even see the page says there is no limit to how much data you can pass to the extension
Im curious, anyone have a quick and dirty way of making the scripts trigger for all playable units no matter who triggers it?
So for example if the script currently says
player setPos [getPos tent select 0, getPos tent select 1, 1];
Could this be changed to
allPlayers setPos [getPos tent select 0, getPos tent select 1, 1];
And when one unit triggers the action it will happen for all playable units? or is this wishful thinking?
you can use forEach event
https://community.bistudio.com/wiki/forEach
and use getPosALT and setPosATL commands rather than getPos and setPos
https://community.bistudio.com/wiki/getPosATL
https://community.bistudio.com/wiki/setPosATL
So say putting this one one script rather than just a small snippet would this work?
{
Obj3 setTaskState "SUCCEEDED";
["TaskSucceeded", ["", "Return to Camp Manchester"]] call BIS_fnc_showNotification;
leed removeAction 0;
player say "gotNVG";
titletext ["Good News Sir, I have the NVGs","plain down"];
sleep 4;
leed say "GotNVGr";
titletext ["You have them, excellent! Ill hand them out, keep one for yourself. Get some sleep, its going to be busy soon.","plain down"];
sleep 12;
nul=[] execVM "nightfall.sqf";
leed addItem "UK3CB_BAF_HMNVS";
leed assignItem "UK3CB_BAF_HMNVS";
} forEach units player;
or would it have to be broken down for multiple secions with the forEach?
//Get human players (i.e. all players excluding Headless Clients):
private _players = allPlayers - entities "HeadlessClient_F";
private _pos = (getPosATL tent) vectorAdd [0,0,1]; //set pos z +1
{
private _player = _x;
_player setPosATL _pos;
} forEach _players;
You don't need the nul= for execVM. That's an old thing that was a) only for Editor code fields and b) fixed
Alright, but in theory if I used the code posted above but changed the middle and put it over the scripts it would work for all playable clients right? or would it have to be broken down
Try testing it. Turn off battleye and click play a second time on the launcher to boot up a parallel client and connect to the first.
Didnt even know you could do that
Gotta start learning to test MP stuff. It's much faster feedback than constantly coming back and going, "will this work?". Now all you have to come back with is, "well I got this error here, now what do I do?"
Is there a way to find the file size of a mission by script? I feel like probably not because it wouldn't be very useful, but I'm curious
I have a lot of scripts in the mission, among them is spawn, the first wave of spawn is in about 40 minutes
It's really hard to say if that would be a script problem, or a mod problem, or just your PC sharting itself...after 10 hours(!) of playing I wouldn't be completely surprised if something self-annihilates even without specifically doing something wrong
find the cause yes
yeah but how
Is it possible to use class CfgUserActions in a mission scenario? Or to invoke a custom function on keypress other than with an event handler?
remove all mods, run a vanilla game for 10h
if it does not slow down, it's a mod or a script
there is unfortunately no magic way to find out
no, what do you want to do?
(when in doubt, visit https://community.bistudio.com/wiki/Description.ext to see if it is available)
Thanks. I want to invoke a function when a player changes weapon, magazine or suppressor, but without using any CBA stuff.
if they can do it, so can you
you will have to use some event handlers or cycle checks
I think that I may use addUserActionEH on each client machine for all cca. 10 ways to swap a weapon and then remoteExec this to the server.
Could do it with cycling, but that is an undesirable burden for CPU.
add a UI event handler for when the displayed weapon name changes
Hi, is there a way to order the AI to look at a specific direction with a vector or something like that and order it to fire with the "forceWeaponFire" command ? Because i tried the command lookAt but it's just a simple direction and the weapon is in "Low Ready" position so it can't shoot the front target, it will shoot the ground instead.
@tough abyss Wouldn't using
_this select 1 in actionKeys "StepOver"
catch it every time?
Here are all the commands you need. You need to first tell the unit to target an object, and then to fire.
doFire for firing at objects
doSuppressiveFire to fire at a position
The rest can be found here: https://community.bistudio.com/wiki/Category:Command_Group:_Unit_Control
oh ok it's really interesting, i have a question though, can i only target the position ? Because i wanted to manage the weapon fire myself with "forceWeaponFire", i saw doTarget but i didn't try it.
I think i can place a gamelogic and target it, i'm not sure if that will work but i will try, btw thank you for your answers 😄
If you wait for 2.18 you'll be able to use weaponChanged and slotItemChanged EHs
Could I already use the weaponChanged EH in dev build. I am currently running it.
Yes, it was added to dev branch in the 15/5 update
slotItemChanged was added....before that...so is also available on dev
Keep in mind that if you use it, other people will also need to be on dev to use whatever system you made with it, until it releases to stable
Is there any documentation for the weaponChanged EH, passed params... ? Thanks
action name is actually "getOver"
I am having a problem with my scripts, they are running fine in SP, hosted MP, but when I launch it on a dedicated server (current dev build), everything seems to be broken. I am trying to figure out what is causing this problem, but with no luck. It seems like that the server does not initialize all my scripts properly. When I do it manually from the debug console, it works.
This is my init.sqf
if (isServer) then {
call STMOD_fnc_initSettings;
call STMOD_fnc_processSettings;
opfor call STMOD_fnc_setupEnemy;
pl1 call STMOD_fnc_setupPlayer;
};
Do you have any tips?
Hello.
I'm doing a PVP scenario that involves 1) Briefing time 2) make halo jumping for a group avaliable only in a specific location, 3) the leader of this group when isTouchingGround can call to paradrop a off a box to 4) set up a respawn point for this group.
All of this by addAction, all of them only the leader of the group can see it.
The main mechanism for this I got it working nicely.
Now i'm looking for "safety measures" about the MP environment. Like, if some leader of these groups disconnects in the middle of these 4 steps above and get back to the game.
Is there a nice way to "inform" the player that connects later, in what stage of those steps the game is? In specific, in what stage of the player group itself is (if they've already halo, if they've already called paradrop, if they've already set up a respawn point).
I've tried using (group player) setVariable and (group player) getVariable, I got something, but I can't go around it when the player connects, it resets those variables of course.
any errors?
got any code examples on both of these solutions? i tried nvgs with setAperture but it got very bright anyways because the lighting was high anyways. and about the flashlights seems like a good solution but i have no idea on how would i be able to script that with a player only inside the selected location, I do have a variable called "isPlayerInsideBunker" that could be used to trigger that. but if you got examples that would be very helpful. But thanks in advance 🙂
Yeah I don't know what you can really do about mouse buttons
everything is hidden behind the functions, for example STMOD_fnc_setupPlayer, what does it do and how it interacts with the player or local objects? You need to be more specific.
I haven't been able to vault using this no matter how hard I spammed (findDisplay 46) displayAddEventHandler ["KeyDown", { if(_this select 1 in actionKeys "getOver") then { true; } else { false; }; }];
But using middle mouse or another button gets around it
thousands upon thousands of square markers on the map acting as a makeshift bitmap
https://github.com/jokoho48/ArmaMarkerBasedVideoPlayer
https://www.youtube.com/watch?v=kLnVtYz5kPA
#arma3_scripting message
I need the .mdmp file, not the rpt nor the bidmp
#arma3_scripting message
ArmaScriptCompiler would turn an array of constants, into a single constant.
#arma3_scripting message
Afaik ropes only stretch along one axis.
getObjectScale returns the scale of all axis combined
Yeah, already found a way to get proper scale, vectorMagnitude vectorUp returns the scaled axis
Still wish there were more handy commands to deal with ropes
#arma3_scripting message
Uh that source view works with current arma script profiler version?
I have not seen that before
probably only works when the script file has the absolute path, and not with internal relative paths. Like what all mods would have.. Which is why I never see it.
Dang that would be so nice to have, if only I had time to improve ASP 😄
Here's something to begin with.
You must call it globally for every client using remoteExec, like this:
[true] remoteExecCall ["My_fnc_isInsideBunker, 0]
And use false once outside
To test it locally, you can just manually set _isInside=true or _isInside=false instead of the params
params ["_isInside"];
TAG_isInsideBunker = _isInside;
TAG_isLightOn = false;
if (_isInside) then
{
setAperture 200;
{
deleteVehicle (_x getVariable ["#flashlightObj", objNull]);
_light = "#lightreflector" createVehicleLocal [0,0,0];
_light setLightDayLight true;
_light setLightIntensity 0;
_light setLightAmbient [1, 1, 1];
_light setLightColor [1, 1, 1];
_light setLightConePars [45, 10, 0];
_light attachTo [_x, [0.05,0.1,-0.05], "proxy:\a3\characters_f\proxies\weapon.001", true];
_x setVariable ["#flashlightObj", _light];
} forEach allPlayers;
}
else
{
setAperture -1;
{
deleteVehicle (_x getVariable ["#flashlightObj", objNull])
} forEach allPlayers;
};
if (missionNamespace getVariable ["TAG_lightKeyEvent", -1] >= 0) exitWith {};
TAG_lightKeyEvent = addUserActionEventHandler ["headlights", "Activate", {
if (TAG_isInsideBunker) then
{
TAG_isLightOn = !TAG_isLightOn;
(player getVariable ["#flashlightObj", objNull]) setLightIntensity ([0, 3e6] select TAG_isLightOn)
}
}]
It assumes all players enter/leave the bunker together
It also makes the flashlight key (default: L) toggle the custom flashlight obj
@bleak gulch @fair drum #arma3_scripting message
I got this error.
2:33:21 Mission stmod.Stratis: Missing 'description.ext::Header'
2:33:23 Error in expression <tings;
opfor call STMOD_fnc_setupEnemy;
pl1 call STMOD_fnc_setupPlayer;
};
if (>
2:33:23 Error position: <pl1 call STMOD_fnc_setupPlayer;
};
if (>
2:33:23 Error Undefined variable in expression: pl1
2:33:23 File mpmissions\__cur_mp.Stratis\init.sqf..., line 7```
pl1 is a variable name assigned to player's unit in Eden.
MP init order is a bit different from SP
In dedicated, pl1 is only defined once that player joins and claims that spot afaik
(if disabledAI is set)
oh fuck no LMAO
Yeah forgot to mention that 👍
Hi, can someone give me a hint?
params ["_unit", "_container"];
private _weaponsConfig = configFile >> "CfgWeapons";
private _unitRifle = primaryWeapon _unit;
private _ARifle = ("toLowerANSI getText (_x / 'cursor') in ['arifle'] && {getNumber (_x /'type') in [1]} && {getNumber (_x /'scope') == 2}" configClasses (configFile /"cfgWeapons")) apply {configName _x};
private _ARifleselect = (weaponcargo _container) select { _x in _Arifle};
private _ARifleinbox = selectrandom _ARifleselect;
private _compatibleMags = compatibleMagazines [_unitRifle, "this"];
private _compatibleMagsinbox = (magazineCargo _container) arrayIntersect _compatibleMags;
private _compatibleMagsArifleinbox = compatibleMagazines [_ARifleinbox, "this"];
private _compatibleMagsforArifleinbox = (magazineCargo _container) arrayIntersect _compatibleMagsArifleinbox;
private _rifleLoaded = count (primaryWeaponMagazine _unit) > 0;
private _amountofmags = {_x in _compatibleMags} count (magazines _unit + primaryWeaponMagazine _unit);
if ((_unitrifle == _ARifle) and (_amountofmags < 4) and ((count _compatibleMagsinbox) < 4) and ((count _ARifleinbox) > 0) and ((count _compatibleMagsforArifleinbox) > 4)) then {
} else {
};
_unitrifle == _ARifle is not correct . How can i check that _unitrifle have the same params like in _ARifle ?
_ARifle is a bool and _unitrifle is a string
Nvm _ARifle was an array, missed the config classes (I'm on mobile)
What classes?
I meant configClasses
Sorry, i don't understand, what i need to do?
I just mean I misunderstood your code. Just ignore what I said there
Anyway, it's a bit hard for me to read it on mobile so I can't be of any help. Maybe someone else can help (or I might look at it in a couple of ours when I'm on PC)
Ok
@winter rose @little raptor How do I catch the moment player is instantiated then, I think I can use onPlayerRespawn.sqf, but are there any other ways?
(_unitrifle == _ARifle) == ("" == [])?
``````sqf
(_unitrifle in _ARifle)
@glass nest seems it is the right way. Thanks
Hello, I want to create a low chance of spawning IEDs in certain places of the map, and I came to that doing so in a scripted file would be better than try to put a lot of triggers and stuff on editor for each place I want a chance of explosives.
Can anyone point me at a simple code to kick it off, for a chance to spawn an IED or mine object in a very specific position?
Would try work for my intentions:
_ied1 = createVehicle ["IEDItem", POSITION, [], 0, "NONE"];
I would still need a way to create a randomized number or a % chance of triggering this
private _chance = 0.5; //50%
if ((random 1) < _chance) then {
private _positions = ["markerName1", "markerName2"]; //Positions to choose from
private _spawnPos = getMarkerPos (selectRandom _positions);
..your spawn code..
};
bump
if (round(random 3)>1) then {//50%
```🤪
Did I just got rickrolled by the A3 Map?
JFC, this community will NEVER cease to amaze
That's probably better, because my version is 0.00000001 in favor of a positive result.
you can always operate using MODulo
True, but you still miss the end of the range value. 😄
do you though?
anything that is not zero is false, using selectRandom [0,1] you would always get the 2 absolute values without rounding so you save command realstate
well, many possible solutions
random 1 doesn't roll 1 anymore, so random 1 >= 0.5 should be unbiased, if that really matters :P
but at that point you might aswell do selectRandom [true,false] for a 50% roll
awesome! thanks a lot for the tip! i will need to work some logic for it to affect only the players inside, because in my case i could have players in or out of the bunker but that is a pretty good start to it.
or do this commands like setLightAmbient, setLightDayLight and setLightColor affects all server? or do they run locally?
Lightpoints (the special objects that those commands operate on) only exist as a separate local copy on each client - note the use of createVehicleLocal. So those commands will only affect the local copy that they're used on.
is there a reason why this code would not work so that JIP message is not removed from queue ? ```sqf
updateJipId = format["%1%2",[_place] call getPlaceStr, _targetSide];
remoteExec ["", _updateJipId]; // Clear previous update call
In your case, you can pass the player who entered as an arg too and like before exec globally
In the function, instead of applying that code to all players, only apply it to the passed player
Also, only apply the setAperture and change the TAG_isInside value if _player==player
That was one way of adjusting it for your case
You need to remoteExe it for everyone because lights are local
Of course before all this, test the code I posted locally to make sure it does what you need
Yeah mine uses a modified CBA framework for a mission instead of mod.
I don't have any explicit absolute paths though
But I guess the mission does it itself
I am clueles, I have been trying to find a way how to initialize EHs for a joining player or an AI controlled unit in MP game all day, but I can not make it work. I need some EHs to be added on the server and some on a client for each flagged unit. Since units in MP are not instantiated right from the start, I can not use init.sqf. I use a variable as a flag to mark those units which should be setup upon creation, but I struggle to find any reliable way to catch the event of player or AI unit joining/spawning/respawning.
onPlayerRespawn.sqf kinda works for players, but not for AI units.
Event handlers like EntityRespawned, MPRespawn, does not fire on the initial spawn, only on respawn. EntityCreated is fired even before the object's init field is executed, so I can not even read the flag in the namespace of that object. I am really tired of this trial and error and still nothing works. Do you have any tips how to solve this? Thanks.
i dont think AIs can respawn, instead you just create new AI. take a look here for some event scripts for player init: https://community.bistudio.com/wiki/Event_Scripts
initPlayerLocal.sqf & initPlayerServer.sqf could be useful to you
Check if player is in vault animation and reset it with switchMove ""?
Shouldn't you pass a non-empty string to remoteExec? 
So I just checked. The game does allow empty strings for fnc
But if you're trying to remove something from JIP queue, use a custom JIP string. Yours looks like the vanilla JIP style which causes the game to do things differently (it tries to get the netID of the JIP string, and then tries to find the remote object, and only then attempts to remove the JIP queue)
vanilla style?
What remoteExec returns by default
hmm idk if it makes difference if you use the return value or string you created
I am
Not in the "x_y" format
why not?
^
I'm not 100% sure if that's the problem but just try it 
you mean like netId over string?
i will try this and come back with the results. but it might take some time since i am finishing other stuff first
I'm just reading this: https://community.bistudio.com/wiki/remoteExec#Example_3
Are you sure what you generate manually is the same as the generated JIP ID by the game? (If you're referring to the first case)
In any case, just create a different JIP ID like I said
e.g "x??y"
Instead of that "x_y"
if I do _ret = remoteExec ["jipTestFn", 0, true]; _ret is empty string
Are you testing in MP?
oh I wasnt, used editor MP now and it gives back "2_192"
Well yeah. Like I said if your custom JIP is also in that format the game does things differently
It thinks it's a JIP ID generated by the game itself
didnt know that
So create your own format that looks nothing like that
but in wiki the example also has "MY_JIP_ID"
Well I'm reading the game source code. Who do you choose to believe?! 
wiki or you 😄
maybe this is not accurate then (from wiki): if the string is in format "Number:Number" (e.g. "0:0"), it is interpreted as a netId (see below)
else the string is treated as a custom JIP ID and the remoteExec statement is added to the JIP queue, replacing statements that have the same JIP ID
That's also correct 
Well just try this. Maybe it'll work
Uhm yeah it doesn't care about the x_y format, it cares about the x:y format
My bad
Then maybe this is the problem?
i.e. the JIP ID you generate when clearing the queue is not the same as what you passed to remoteExec?
im pretty sure it is (correct one)
i think my problem was that the message is already sent over network so it doesnt help to remove it from queue at that point
Just in case, try logging it
As in you're removing it after JIP has joined? Well yeah it doesn't work ofc
yep and im using same variable "_updateJipId" for those remoteExec calls
it wasnt actually JIP issue even I play with that but I needed to send two remexec messages after each other and thats where it got problematic. had to create a workaround
the later was supposed to cancel the first one
anyways thx for the help Leo, appreciate it
Would rpt help?
If you still need help I'll message you later tonight.
Are there any SQF UI frameworks/libraries? I'm ideally looking for something high-level like DialogBox("Do you like ice-cream?", ["Yes","No"]) , but anything that abstracts away some of the UI-complications would be appreciated :)
Does anyone know how the arsenal creates the camera that allows you to rotate and pan around the player? I'm trying to replicate it
I think I've found it and it appears incredibly complex and ingrained into the arsenal code
this code spawns the IED, but it doesnt denotate by approach as it should, nor is detected by mine detector, as also should
_ied1 = "ACE_IEDLandBig_Range" createVehicle [11650.5,14997.3,0];
Do I need to write something else to "arm" the ied?
wow thanks a lot
trying to play a schizo poem for my arma 3 mission and i put this in the activation box in my trigger
``class CfgMusic
{
sounds[] = {"sound/boots.ogg"}; // Ensure the path to the audio file is correctly specified within quotes
class boots
{
name = "boots";
sound[] = {"sound\boots.ogg", db+10, 1.0};
titles[] = {0, ""};
};
}; // Added semicolon to close the CfgMusic class definition
``
And?
Your code doesn't even look legit for Description.ext either, but where is your question
why are you doing a config in a sqf box?
i detect chat gpt
Could be
I have progressed a little bit. Found this solution, but it is buggy. It somehow works on a dedicated server, but it freezes a hosted server after some time of messing around. I suspect that the change in locality when rejoining, dying and respawning breaks something. Here is the code: https://pastebin.com/t9whNEg0
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
this I would be doing completely within initServer and initPlayerLocal. Would wait for server init to finish before progressing the local player
The messy part is that some EHs need to be re-added and some not when respawned. And it differs with dedicated and hosted a bit.
And? which ones which?
@warm hedge @fair drum I was following a youtube tutorial and I cant figure out why it wasnt working. It says it missing a semi colon and Ive tried fixing it myself before coming here
what you posted, goes into the description.ext file, not in a trigger
Sounds like you haven't followed the tut
you then call your sound using
playSound "boots";
in the trigger
copy, ill try that.
ive tried that and i dont understand why it isnt working. Im trying to learn but all these tutorials say the same stuff and i need to have this done pretty soon.
when you try to rush, you'll have the illusion of learning
I need some help getting the respawn system to work properly. I have it set up so that my players can respawn, but I want to disable the function where the scenario automatically ends if they all die. I tried unchecking the setting in the attributes menu, but it still ends when everyone dies at the same time.
Is there something I can put into the description.ext to force this setting?
what is in your description so far
``#include "VVS\menu.h"
class CfgFunctions
{
#include "VVS\Functions.h"
};``
that's it? are you adding respawns via the editor attributes or something?
Yes, I added respawns via the editor attributes and the editor respawn position module. I've gotten it to work as far as getting to respawn, but as soon as I respawn, a Mission Failed screen comes up
show me what you have ticked in the editor
(btw, description.ext overrides the editor so I can just force it but I'd rather show you)
also, are you making sure to preview in multiplayer, not singleplayer?
I am previewing in Multiplayer
well you don't have it selected. wonder what VVS\menu has in it.
anyways to force it so that it doesn't happen, you define the respawnTemplates[] = {} in the description.
you can see the available things here:
https://community.bistudio.com/wiki/Arma_3:_Respawn#Respawn_Templates
scroll down in the rulesets menu
and see if there is anything about tickets selected
Okay, I wasn't aware that could be empty. I thought it was required to define one.
yup its the last on you have ticked
I had that selected because I thought it was an issue of the game thinking that there was no more tickets left.
so it was happening before you selected it then?
Yes, it was.
must be something you accidentally enabled in 3den enhanced, and even if you disabled it, it didn't save.
force it via:
respawnTemplates[] = {"MenuPosition", "Counter"};
I would prefer to not have respawn tickets at all
the above removes the ticket system by not defining it
this one?
all 3den enhanced is doing is applying these templates to your mission.sqm instead of the description file
I tried the first thing you mentioned, it did not work. I am testing the respawnTemplates[] = {"MenuPosition", "Counter"};
then lets see whats in VVS\Menu then as well
That's a vehicle spawner menu
the first thing i mentioned, the blank template, was not something you should have tried. its blank.
I am still getting the same result with MenuPosition and Counter.
Notepad++
search all files for BIS_fnc_endMission or endMission
No results for either
something is messed up somewhere. what mods you running
if its minimal, i can run through your files in my own editor. if its a bunch, then you're out of luck
It's a lot, but the only ones I can think of off the top of my head that would do something like this is ACE and Drongo's Map Population.
Try remaking a simple version of your mission using vanilla.
FiredMan and AnimStateChanged on server needs to be re-added every respawn, but not if it's a hosted game (probably applies only to units local to the server). And other EHs, like WeaponChanged, ItemSlotChanged can be added only on clients, these are added just once per join.
I just made a simple version of it only running Drongo's and ACE. It still produces the same result. It has to be one of those.
Hello.
I'm trying to run a function by remoteExec targeting a specific "side", but seems like some commands inside the function doesn't work with this type of targeting but it works when the target is 0.
The function is getting variables from sectors and altering its markers, etc.
I can't understand why it's not working by targeting sides
I feel like a dumbass, but I found out what it was. The mission module itself had its own setting to end when all players are down. Apologies for wasting your time.
the answer is always user error lol
lets see your remoteExec so far
if (isDedicated) then {/* dedi only server stuff */};
if (isServer && hasInterface) then {/* hosted server stuff */};
if (!isServer && hasInterface) then {/* client */};
if (!isServer && !hasInterface) then {/* headless client */};
if (!isMultiplayer) then {/* singleplayer stuff */};
Does anyone know of a way to do a trigger that will detect if vehicles of a specific class name? I’m trying to make a trigger where if air vehicle my unit uses enters a specific zone it will destroy their engine and all control surfaces .
I know damage was this
v1 setHitPointDamage["hitengine",1];v1 setHitPointDamage["hitrtrack",1];v1 setHitPointDamage["hitturret",1];
But I’m stuck on the class name detection.
probably better to use a loop since you don't know if anyone is going to go through the trigger as its already activated and waiting to deactivate for the repeat.
one example:
private _classname = "vehicleclassname";
private _trigger = myTrigger_1;
while {sleep 0.5; !(missionNamespace getVariable ["PLATZ_TriggerDamageArea", false])} do {
private _vehiclesInArea = entities _classname inAreaArray _trigger;
_vehiclesInArea = _vehiclesInArea select {!(_x getVariable ["PLATZ_DamagedByTrigger", false])};
if (_vehiclesInArea isEqualTo []) then {continue};
_vehiclesInArea apply {
_x setHitPointDamage["hitengine",1];
_x setHitPointDamage["hitrtrack",1];
_x setHitPointDamage["hitturret",1];
_x setVariable ["PLATZ_DamagedByTrigger", true];
};
};
to do this as damage over time would I change the damaging bit to
_x setHitPointDamage["hitengine", getHitPointDamage "hitEngine" +0.5];
that
private _currentDamage = _x getHitPointDamage "hitengine";
_x setHitPointDamage ["hitengine", _currentDamage + 0.5];
that makes sense
just to make sure im doing it right its all of that as like "PlatzDamage.sqf" in the mission file and then set a trigger to the variable name "myTrigger_1"
another guess would be if I want to apply this to multiple triggers I would do something like
this = _trigger
or
_trigger= myTrigger_1 && myTrigger_2
first off, you know this isn't going to be placed in a trigger right? this is to be placed in say, initServer.sqf with a [] spawn {/*code};
I know I know, only bit in a trigger directly is the variable name
the issue I can kinda forsee is they likely wont allow me to put the code on the server, they have this rule where all scripts have to be executed via mission files
standby
Hey man! Sorry if I don't get back to ya later. Just realized it's past midnight for me and I got work tmr lol.
/* PLATZ_DamageVehicleInArea.sqf */
params [
["_triggerArray", [], [[], objNull]],
["_classname", "", [""]],
["_rate", 0, [-1]]
];
if !(isServer) exitWith {};
if !(canSuspend) exitWith {
_this execVM "pathTo\PLATZ_DamageVehicleInArea.sqf"; // Edit this line
};
if (_triggerArray isEqualType objNull) then {_triggerArray = [_triggerArray]};
if (_classname == "") exitWith {};
if (_rate < 0) then {_rate = abs _rate};
while {sleep 0.5; !(missionNamespace getVariable ["PLATZ_TriggerDamageArea", false])} do {
private _vehiclesInAreas = [];
{
private _vehicles = entities _classname inAreaArray _x;
_vehiclesInAreas insert [-1, _vehicles];
} forEach _triggerArray;
_vehiclesInAreas = _vehiclesInAreas select {alive _x};
if (_vehiclesInAreas isEqualTo []) then {continue};
_vehiclesInAreas apply {
private _engineDamage = _x getHitPointDamage "hitengine";
_x setHitPointDamage["hitengine", _engineDamage + _rate];
private _rtrackDamage = _x getHitPointDamage "hitrtrack";
_x setHitPointDamage["hitrtrack", _rtrackDamage + _rate];
private _turretDamage = _x getHitPointDamage "hitturret";
_x setHitPointDamage["hitturret", _turretDamage + _rate];
};
};
// init.sqf
[trigger_1, "myVehicleClassname", 0.5] execVM "PLATZ_DamageVehicleInArea.sqf";
[trigger_2, "myVehicleClassname", 0.5] execVM "PLATZ_DamageVehicleInArea.sqf";
A simplistic function for creating a simple message dialog with 'Yes' and 'No' options is BIS_fnc_GUImessage, not really a 'UI framework/library' @rich bramble , but its something...
@split vigil I changed _crew moveInCargo _seat; to _crew moveInCargo _helicopter; and it works
InitServer.sqf:
currentWestSectors = [ sectorA ];
westAttackSector = currentWestSectors select 0; // First sector west side
[ westAttackSector ] remoteExec [ "PIG_fnc_updateAttackMarker", west, "JIPwest"];
fn_updateAttackMarker.sqf:
params ["_sector"];
// get a reference to the trigger of this area
private _trig = _sector getVariable "areas" select 0;
// get the marker for this trigger
private _trigMarkers = _trig getVariable "markers";
private _markerIcon = _trigMarkers select 1; // select 0 - markerArea (grid), select 1 - markerIcon (middle icon), select 2 - iconText (sector's name)
// change type and color of the icon marker
_markerIcon setMarkerType "o_unknown";
_markerIcon setMarkerText "Attack";
_markerIcon setMarkerColor "colorOrange";
// Make marker area visible
_trigMarkerArea = (_trig getVariable "markers") select 0;
_trigMarkerArea setMarkerAlpha 1;
// Change the brush
_trigMarkerArea setMarkerBrush "Border";
_trigMarkerArea setMarkerColor defaultMarkerAreaColor;
Seems like it's mandatory to have to remoteExec this function ^ with the server, but well, every client will see the change, and I want only one side to be able to see it.
Using clientOwner also works.
Hey, I am trying to create an area-marker (ellipse or rectangle) via script. But it seems like you can't do that with createMarker as the CfgMarkers doesn't include the areas. Any ideas?
the top comment at https://community.bistudio.com/wiki/createMarker seems to be about creating a rectangular marker?
once again, I am completely blind
I used these two event scripts, and it somehow works. Thanks. Though, I still need at least MPRespawn for each playable unit to re-add some other EHs.
Use onPlayerRespawn.sqf
Check to see if the event exists by saving the handle. If it doesn't, then readd
@spiral trench Thanks, that's a start :)
anyone?
Use the local versions of the marker commands
With the normal (global) versions, any use of the command broadcasts the whole marker to everyone. Use the local versions to restrict changes (and therefore the marker) to the client where the command is executed.
Thank you for the response. Well, it didn't change anything, I think it's because I'm getting those variables from modules (sectors).
I got it working by calling the function in the init.sqf.
But why is not working with remoting exec side? 😭 It's weird because it's working using clientOwner lol
inb4 init.sqf on client tries to access variables before they're transmitted from the server 🤷♂️
@rich bramble most of that stuff would require ObjectOriented systems
and those are not rly used widely yet
but feel free to start writing your own using eg. OOS :)
I'm kinda lost. It seems I incorrectly passed the variables _doorConsole and _blastDoor into ace_common_fnc_progressBar function.
Maybe anyone could hint me on what exactly I'm doing wrong?
params ["_doorConsole", "_blastDoor", "_unit"];
_hackDoor = ["HackDoor","Hack Door","\A3\ui_f_orange\data\cfgmarkers\civildefense.paa",
{
params ["_target", "_unit", "_params"];
_params params ["_doorConsole", "_blastDoor"];
_unit playActionNow "Gear";
systemChat "ACTION";
systemChat str _doorConsole;
systemChat str _blastDoor;
[2, [_doorConsole, _blastDoor],
{
// hint "Success!";
params ["_doorConsole", "_blastDoor"];
systemChat "BAR";
systemChat str _doorConsole;
systemChat str _blastDoor;
playSound3D ["@A3\Sounds_F\sfx\alarm_independent.wss", _doorConsole];
// _blastDoor setVariable [format ["bis_disabled_door_%1", _door], 0, true];
// _blastDoor setVariable ["bis_disabled_Door_1", 0, true];
},
{
// hint "Failure!";
}, "Hacking Door"] call ace_common_fnc_progressBar;
},
{
true
},{},[_doorConsole, _blastDoor]
] call ace_interact_menu_fnc_createAction;
[_doorConsole, 0, ["ACE_MainActions"], _hackDoor] call ace_interact_menu_fnc_addActionToObject;
The output I get is on the screenshot
I would like to create a mod or script that changes the controls for mods that use CBA_A3.
The idea is to give my friends the same controls as me without having to change everything manually and so they don't have to download a copy of my profile.
I'm thinking the solution lies in the profileNamespace
https://community.bistudio.com/wiki/profileNamespace
What are your thoughts on making this happen? If you're not sure, where should I look to start educating myself on modding this?
I think I have already heard about something similar to this in a video on YouTube some time ago. Someone had a similar idea.
What would you search for on YouTube to find that video?
It was a long time ago, he just proposed an idea to create something like this, he basically said the same thing you have written here.
Try to look here:
https://community.bistudio.com/wiki/Category:Command_Group:_Interaction
https://community.bistudio.com/wiki/inputAction/actions
Sending some data over network is possible, but I am not sure, if redefining keybinds via sqf commands is.
Regarding YT, this video is the closest thing after a quick search.
https://www.youtube.com/watch?v=g8z0uPD43sc
Let me take a look at those wiki pages
This Video will show you how to keep your profile settings when creating a new Profile on Arma 3. This includes custom controls such as joysticks as well as Recent and Favourite Servers.
"This video was created using content of Bohemia Interactive a.s."
"Copyright © 2017 Bohemia Interactive a.s. All rights reserved."
"See www.bistudio.com for m...
InputActions is definitely good to know for the vanilla keybinds. Though I obviously would need to to access CBA to assign changes to the profileNamespace
ChatGPT gave this example:
// customKeybindings.sqf
if (isServer) then {
// Define your custom keybinding
["Jump", "your_custom_key_here"] call CBA_fnc_addKeybind;
};
Don't use ChatGPT.
It's very wrong in this specific example, as demonstrated by the docs, and generally does not understand SQF.
The syntax it gave for the CBA function call is outright wrong, and using an isServer check for this would be very silly, because custom keybinds by nature are used by each client separately.
Yeah, isServer seemed undesirable.
Anyhow, it answered the question of how to possibly edit a CBA keybind of an existing mod via script
Any thoughts on the big picture @hallow mortar ?
That addKeybind function appears to be for a mod to add a control in the CBA controls list. It's not the right choice for changing the key an existing control is bound to.
Would there by another function that you know of?
Or could the addKeybind function be used to overwrite an existing mod similar to how many mods overwrite some settings in existing mods? Such as Enhanced Movement - Rework overwrites some things in Enhanced Movement?
Probably it could but that's a very non-ideal way of approaching this
I'm pretty sure the CBA keybindings are stored in variables/a variable in the profile namespace, so in theory it would be possible to getVariable -> copy, send to friend -> setVariable, in order to overwrite their saved keybinds with yours
But I don't know enough about how this system works to say exactly how it's stored. The code is fairly complex. The information is in there but I don't want to get into it.
I appreciate your input!
If there is possibly a better way that does not involve shareing the Arma3Profile or manually changing keybinds, let me know
[READY] Create and Delete AI gunners to attack and support helicopters
In my adventure of submunition stuff, is it not possible for
Explode
Deleted
HitExplosion
HitPart
from https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Projectile_Event_Handlers
not able to use triggerAmmo? I have a simple test script and if I say trigger 1 second after firing the submunitions deploy, but if I have it on any of the above EH the submunition doesnt deploy. This is my script
test_fnc = {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
//This works
//sleep 1;
//triggerAmmo _projectile;
//These dont work
_projectile addEventHandler ["Explode", {
params ["_projectile", "_pos", "_velocity"];
triggerAmmo _projectile;
}];
_projectile addEventHandler ["Deleted", {
params ["_projectile"];
triggerAmmo _projectile;
}];
_projectile addEventHandler ["HitExplosion", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_hitSelections", "_instigator"];
triggerAmmo _projectile;
}];
_projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius" ,"_surfaceType", "_instigator"];
triggerAmmo _projectile;
}];
};
ace_player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_this spawn test_fnc;
}];
no, the projectile is deleted next frame after for most of those EHs
ooooof, I figured as much 😦
well I guess wat I can do is have another class that I spawn when the main projectile explodes spawns this dummy class that is then triggered it self 
is there a way to create fog only inside a specific trigger area? Like I have the vehicle damage script I was looking for but I realized I should have some kind of visual effect on it. Read the documentation on particles (https://community.bistudio.com/wiki/Particles_Tutorial) but im not sure how use them to do this.
Critically I need to be able to raise the base of the trigger off the ground and have the base of the fog be visable from below.
If you use particle and call it a fog, definitely yes. You can try some of examples by copy n paste to see the ideas of particle
found this online https://www.youtube.com/watch?v=7neNE8EFQks so that might help me figure out how this works
Combined tornado script with a cloud script i made a while ago to see if it can be handled by engine
Arma 3 scripts
https://www.youtube.com/playlist?list=PLod_PhpAOFQhpTRYpoVPwiikPN1aoboFs
[strong]Software used:[/strong]
Drawing: CorelDraw
Animation: FlashMX
Sound processing: Audacity
Video processing: Corel VideoStudio Pro
Video capturing...
Wish you could do 12 toFixed -3 to return 012
or 10.3 toFixed [3,4] for 010.3000 🙃
https://ace3.acemod.org/wiki/functions/common#ace_common_fnc_progressbar
Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode]
you'd needthis#0 params ["_doorConsole", "_blastDoor"];in your progressBar code 🤷♂️
CBA stores their keybinds in profileNamespace yes.
Go to CBA github, read the code on how it stores the keybinds, replicate it to set your own..
But it will overwrite your players keybinds which they might not be happy with.
You likely won't find much more help for this. Helping more would imply someone else doing basically all the work for you
Good day. Question about Dynamic simulation Limit by View Distance setting:
- I do not see the script commands to get/set amongst
https://community.bistudio.com/wiki/Category:Command_Group:_Dynamic_Simulation
Is there none? - How exactly does this setting work in MP environment?
It's likely that's not a direct feature of the engine dynamic simulation system, but rather a script that uses https://community.bistudio.com/wiki/setDynamicSimulationDistance and https://community.bistudio.com/wiki/viewDistance to do it
Valid theory. But that would mean that in MP scenario or in scenario where viewDistance may be changed this setting is becoming unreliable.
Speaking of unreliable: Is there any explanation as to why worldName command returns lowercase in some missions and capital first in others? (e.g.: "stratis" VS "Stratis"). It is somewhat mildly infuriating.
UPD: Even funnier
- check in my mission:
worldName->"stratis" - open my friend's mission:
worldName->"Stratis" - open my mission again:
worldName->"Stratis"🤨
It could be a looping script that keeps it updated....or it could indeed be unreliable. There are plenty of imperfections in Editor stuff.
This is speculation, but it might be that worldName doesn't actually look up the world name in config (which would always be the same), but instead checks the world suffix on the mission file, which can be written by the missionmaker and so can be capitalised differently per mission.
I think that would be a silly way to do it, but it does fit the observation.
Though so too, but then did more experiments and check my update to this post

Renamed the mission name's suffix to AltiS, worldName returns Altis
Some mission.sqm value?
Mod modifying CfgWorlds config and changing the casing?
Can't find any that would mention the name of the world, also doesn't explain why result changes in the same mission after loading another
Loading different missions in the same game session, so mods stay the same. So also negative.
Just asked my friend, he says '"yeah, this always returned first capital, I even have to do toLower". Which, again, is wild to me as I also use worldName in my mission and it was always lowercase for me.
It takes the name that was passed when the mission was loaded.
So on server what was passed to #mission command, or listed in server config mission rotation.
I would expect for Eden and Server loading, it would just pass the foldername or name of the pbo.
But because filenames being case-insensitive, means they are completely lowercase, a case-insensitive open could pass a lowercased name. Very possible that some places handle it differently.
Also the worldname might only be set on terrain switch.
So first load different terrain, then load mission on that terrain. Could behave differently than loading a mission on a different terrain.
Its also different when the file comes from steam.
A workshop mission, it takes the filename from steam, which would probably be uppercase.
A pbo it finds in mpMissions on a server, would come from the case-insensitive filesystem, which would be lowercased.
Eden is windows only, so it doesn't need to care about case-sensitivity, so it might have another way that doesn't use our filesystem that just keeps the case of the mission folder in your documents directory
👍
Thank you! It works, yes. I didn't see the args... 
Fantastic! Thank you!
@rich bramble @queen cargo loves his objectoriented coding
@still forum @iron goblet I have looked at the CBA code. I may be mistaken, but my understanding is that it just adds another layer of keybinds on top of the native Arma keybinds. And within this space you can alter the already existing CBA-dependent keybinds. Correct me if I am wrong. For examplpe, if you use W for move forward, you can also use it for triggering an IED explosion event or any other script, but that CBA keybind won´t replace the walking action.
Yes. That is how it works. I am hoping to overwrite another mods CBA keybinds though.
when i get Intercept done, someone should port Qt to it... :D
lmao
actually Jaynus already had the basis for a Qt library render in Arma.
Then, this is probably possible, you need to retrieve the mod's existing keybinds from CBA, replace them with your own, there are probably already existing functions for that, then you have to create some script called either through console or some GUI element to ditribute this data over to other clients and invoke a function that will replace their keybinds. You would probably need to implement it as a scenario script or in form of an addon. Look at these folders: CBA_A3\addons\keybinding and CBA_A3\addons\events of the CBA source code. But I bet it will take time and may not pay off in the end.
but if you learn Qt to just do Arma dialogs something is wrong with you.
Yeah. I would prefer it as an Addon..and activate via another keybinds until I can learn to activate via a GUI
hello I need help with some code
private _pos = getposasl this;
if ( _pos select 2 > 0) then{
private _dist =(_pos select 2) - 0;
_pos= this setPos (getPos this vectorAdd [0,0,-distributionRegion]);
};
private _bomb = createvehicle ["pook_SCUD_nuke_spawner", _pos ];
null=[]spawn{
sleep 3;
["cordium_explosion"] remoteExec ["playSound", 0];
};
private _intensity = [1,4] call BIS_fnc_randomInt;
[_intensity] spawn BIS_fnc_earthquake;
this setDamage 1;```
This runs in a move waypoint of a loitering munition drone
I get the following error
_pos is not a valid array
_pos = getPos this vectorAdd [0,0,-distributionRegion];```
Does anyone happen to know the name of the BIS function that handles the squad-mates icons UI rendered on screen above units? (not the static group ones)
Does "audibleCoef" unit trait affect also the audibility of gunshots, or just the unit's foosteps alone? Thanks
new game_value when
I've found I've actually got nothing to do
@timber shore essay?
huh?
Discord keeps saying you're typing
weird
for like the past 5 mins
was typing but not an essay hahaha
got a new question for help/assistance, bit more complex than my last. If a player has a weapon in the primaryweapon slot, disallow them to get into a vehicle. if they are in a vehicle with a weapon in the primaryweapon slot disallow them to eject/getout of the vehicle. I'm guessing so far it would be done through EVH's blocking actions of GetInDriver GetInCargo GetOut and Eject if !isNil primaryWeapon player;
Unit noise, not gunshots
player addEventHandler["GetIn", {
if (!isNil primaryWeapon player;) then {
player action ["Eject", player];
hint "Store your weapon safely first!"
}
}];
hey, what the name of the controller in the middle of screen? I wanna see if the player point of an object
cursorObject
thanks you!
Does anyone know what causes my arma 3 scripts to not run
Ppl can join the server but for a hand full the scripts won’t run.
Someone please help me
They run for most people?
Do they not run for the people who join after the mission begins by any chance?
!isNil primaryWeapon player --> primaryWeapon player != ""
It only works if they delete the .vars in the documents of their profile then if breaks again. It works for half the people
Post the whole mission in GitHub or something so we can see what you have. Or zip and post.
can i just send a google drive link
@hallow mortar
hi, need help with a script that using a trigger perhaps, rearms the player and AI units to what they originally had at the start of the mission
tried using this but it rearms a generic loadout and not the one the unit in the editor
hint "You have been rearmed and healed!";
use getUnitLoadout to first get the loadout and then save it so you can use it with setUnitLoadout later
wouldn't replace dropped empty mags, though
i have 2 units, p1 (player) and p2 (AI), had the first trigger:
getUnitLoadout p1;
getUnitLoadout p2:
typeof _x returns string
didnt get how to rearm them back on rearm trigger
setUnitLoadout <string>; does: When String for class name is supplied, the command will search CfgVehicles for the given class in order to extract the loadout from config.
so typeof should work?
not if the loadout was changed manually by mission maker or player
oh right
yeah loadout is custom
id do sqf p1 setVariable ["loadout", getUnitLoadout p1 ]; // Then use that to restore the loadout _x setUnitLoadout (_x getvariable "loadout");
in the trigger, right? and it works for AI's loadout?
the one with _x works with thislist. p1 is for one player only
might want to check "loadout" is set for them
first line at some point where the unit still has the full loadout you want to restore to. Mission start, maybe. Or Arsenal closing.
mission start wud do
put this in the trigger and didnt work:
_x setUnitLoadout (_x getvariable "loadout");
did you set the "loadout" variable before that?
yeah i used this in a separate empty trigger
p1 setVariable ["loadout", getUnitLoadout p1];
p2 setVariable ["loadout", getUnitLoadout p2];
ok the timing of that is crucial. idk when the trigger runs. you could use init.sqf file or something
inb4 this setVariable ["loadout", getUnitLoadout this]; in units' init fields
didnt work for some reason
put this in the unit's init
this in the trigger that will rearm them back
and this in the mission's init.sqf:
p1 setVariable ["loadout", getUnitLoadout p1];
p2 setVariable ["loadout", getUnitLoadout p2];
your missing the "foreach thisList;" loop that you first had
{ _x setUnitLoadout (_x getvariable "loadout"); } foreach thisList;
put that in the second trigger activation
im not good with triggers but i think thats it
and trigger being not repeatable sure adds to confusion :3
thnx, this worked
was wondering why p2 couldn't rearm
ty
p1 was able to rearm but not p2, trigger set to repeatable
p2 is AI
p1 is player
also is there a way to use this for the entire group, lets say i got like 9-12 AI units in my group, i would like them to rearm their original loadout when we get back to base or something
So instead of p1, p2, p3...have instead all units in this group
... forEach units _group
yep
ty
https://steamcommunity.com/sharedfiles/filedetails/?id=3267097921
Fun little scripted comp in here for terminals, kinda like helldivers terminals
can someone explain how addMissionEventHandler works? I want to show a message using "PlayerConnected" to every client when player enters the mission. Do I put this MEH on initServer or initPlayerLocal?
hey, can someone explain what HashMap globally means. The wiki is very understanding but this time I am lost
PlayerConnected only fires on the server, so if you wanted to broadcast then you'd need to put it in initServer and then remoteExec messages to the clients.
From a user perspective it's a collection of key/value pairs with fast lookup by key.
so it fires just once?
So, running something on postInit with CFG FUnctions. How do i stop the function from running in the main menu and 3den, (already know how to get it on player client only)?
Google didnt help much. Current guess is checking what UI is currently running. Next step is finding an example via github (no idea where to start) or ask here for the answer🤷
postInit doesn't run in main menu for Eden, just use if is3DEN exitWith...
Weird. Somethings running in menu.
All i got is CBA settings in preinit (to test i disabled this really quick).
and my function in postinit.
thats it. including config.cpp i have 3 files.
what im working with cna adjust saturation so i think its running cuz my menu backdrop (which is a in-game scene if enabled) is black n white.
unless its running postinit for the backdrop but the functions breaking cuz there is no player entity to get info from.
Ah
need to do some debugging now.
even with the 3den check its still running in a broken state on 3den first load, but if i play as a character and then back out its fine.
Is there a way to check in multiplayer if a specific player is alive but not using his/her name? The player in question has to be set as some sort of "VIP".
There's steam UID if that's useful.
You didn't really describe what you're trying to do, so maybe you wanted the slot instead.
Yeah my bad, here is basically what I want to do:
- One player has to be the VIP and broadcasted globally, this will be set when that player interacts with an object (got the interact with object already)
- Once he is acknowledged by the server as VIP, there is a loop that checks if he is alive and runs something if he dies
What I want to accomplish is making it possible that anyone can be the VIP, without setting it up on mission load
It sounds like you're setting a global variable to be the player that interacts with the object. If thats the case, then just check if that variable is alive or not.
If the association isn't supposed to be death-persistent then you can just store the player's object.
in what way
In the same way as there is simulation state and visual state (getPosWorld vs getPosWorldVisual)
nice
I noticed that visual state of segments is very unreliable soon after creation and they get created all the time during rope unwinding. Unreliable in a sense that they zoom from [0,0,0] to their actual position after fraction of a second. Any idea how this could be checked inexpensively?
Yes. Don't know if it's interpolated
Mh yeah must be right 🤔
🍞
how do I make it so the player would spawn inside of a box thats floating in the sky instead of the terrain below
teleport them up using a trigger
yeah a trigger
i know what that is
yeah..
😭
(i dont)
@flint topaz Could you help me out 🙏
Im sure I have this wrong somewhere, im testing it out, states im missing a ";" on line 4
_players = allPlayers;
{
titleCut ["", "BLACK IN", 7];
_x car1 SetPos (getPos) "TP1";
} forEach _Players;```
setPosATL getMarkerPos "TP1"
also "_x car1"? did chatGPT write that?
Why would it have?
I thought you had to add the "magic variable" for all players, maybe you can correct me on that line of thought rather than whatever it was you were trying to do there, please?
This also returns the same error too
That's because in such case, "_x" will already act as the object/variable "forEach _Players".
I believe you should keep the _x, but remove the Car1 and use the string from Lou Montana; so try with this:
_x setPosATL getMarkerPos "TP1";
Which means that for every unit/object inside "_players", the script will use "_x" to do the stuff upon every one of them.
Oh, by the way, you might not need those "" around TP1, whether it is a variable name...?
_x setPosATL getMarkerPos TP1;
Maybe I should explain what I'm trying to do and see if that works too, I have a vehicle that the players will be driving ("car1"), I would like to make the screen fade to black and then teleport the vehicle with the players from the trigger zone to a designated point ("TP1" which is an empty item with the same variable name)
So to confirm:
_players = allPlayers;
{
titleCut ["", "BLACK IN", 7];
_x setPosATL (getPos) "TP1";
} forEach _Players;```
But juding by your reaction Im not on the right track here?
I think you need to put car1 outside the {}, so every player will have the screen fade out and then the car1 will teleport - bringing all players inside it.
Try this, instead, see if it works as intended:
_players = allPlayers; { _x titleCut ["", "BLACK IN", 7]; } forEach _players; sleep 1; car1 setPosATL getMarkerPos "TP1";
Seems to be doing the trick, however its put me in the middle of nowhere and not on the variable thats TP1
but I think thats because its getMarkerPos and not getPos
Oh, sorry, I though TP1 was a marker you had on the map. If it is an actual object with that variable name, then you actually need to use GetPos TP1
though I could change the item to a hidden marker and that would work and not have as many assets down?
chat
This definitley is working, thank you!
That last issue from MrGecko might get exactly what you need.
Try giving that "floating" object a name (like "box1") and disable its simulation, so that it would hang steady on the air.
Then use something like this:
player setPosAtl getPosAtl box1;
As you still haven't got the hang regarding triggers, add the line above on the "init" box of the player, to see how it goes.
Create tasks and use triggers to assign new tasks. This tutorial doesn't assume you know anything about mission making or tasks. Simple and easy to follow guide to start making your own missions.
If you have any questions, comments or requests, please leave them below.
Thanks to Bohemia Interactive for the best military sim ever.
Thanks ...
i put that code in player? it wont mess up anything else on lets say the map n stuff right
No. There are of course much better ways to do that, like adding that line inside an external file - like "description.ext" or "init.sqf". The worst that will happen is that your player will spawn and immediately start a free falling. 😄🪂
I suppose theres no way to uh
make it so just the spawn point has an XYZ instead of XY axis
right
Another one for tonight whilst I tear my hair out ```sqf
_car1 setFuel 0; obj1 setTaskState "SUCCEEDED";
["TaskSucceeded", ["", "Preparation : Get Transport To Timurkalay"]] call BIS_fnc_showNotification;
player setCurrentTask Obj2;
["TaskAssigned", ["Clear the Way", "Rapier Stage 1 : Clear the way"]] call BIS_fnc_showNotification;
You can do that pretty easily with a trigger mate, setup like so
Once the players enter the area youve set the trigger over, it will set the vehicle fuel to 0
Thats how I have it set, as a trigger
comes back with, type : string Expected Object
Can you paste your On Activation text here mate? Ill check it over 🙂
_car1 setFuel 0; obj1 setTaskState "SUCCEEDED";
["TaskSucceeded", ["", "Preparation : Get Transport To Timurkalay"]] call BIS_fnc_showNotification;
player setCurrentTask Obj2;
["TaskAssigned", ["Clear the Way", "Rapier Stage 1 : Clear the way"]] call BIS_fnc_showNotification;
You use onPlayerRespawn.sqf, check where the player spawned, if it's within said distance, modify their position with the commands.
I can't help you much as I am in Colorado for the week and don't have my computer
I don't know if that would help given that Arma 3 doesn't use Rust at all
This seemed to start working all of a sudden so im at a loss, something else must have been conflicting
well since for some dumb reason i cant use signature check ->#server_linux message
im doing some script to check if more mods are loaded.
Ive tryed to use ace_common module, but ppl is only kicked once the mission starts, i want to warn him before as posible to fix it, ideally when join the server, or at least at role selection... but i cant find a way to do it.
im trying to use bis_fnc_guimesagge, but i cant find a way to execute it in any of this insances
ive tryed with a fuction with preinit = 1 , and the displayes aviables are: 11:17:33 "[Display #0,Display #18,Display #70]"
Ive used 70, but it only show when i go out the mission
i can execute this via mod too... but im not finding a way to do it
Hello. Is this command still working?
https://community.bistudio.com/wiki/serverCommand
anyone got alot of knowledge on ctab
got an issuie where only the side ctab display wont open in our mod heli
yes
I saw in a youtube video a bit ago someone was able to have a picture pop up of a person and had executed a audio file of them talking. Trying to find out where to start with creating that.
how can i place a camera thet films me playing
Heyo.
Anyone know the way to remoteexec a function on a player, then get the data back from it to the server?
The FNC I need to run is, [player] call ace_medical_fnc_serializeState
IE
_healthdata = [_player] remoteExecCall ["ace_medical_fnc_serializeState", _pMID];
You need to create a callback, a return remoteExec that sends the requested data back.
e.g.
[_player] remoteExecCall ["my_fnc_aceHealthRetriever",_pMID];
// my_fnc_aceHealthRetriever
params ["_player"];
private _healthData = _player call ace_medical_fnc_serializeState;
[_player,_healthData] remoteExec ["my_fnc_aceHealthCallback",remoteExecutedOwner];```
so the first one sets up the code to be run, then the second exec sends the data back?
assuming this is done scheduled, how do I get the data to use
What do you mean?
This function needs to be setup / available on the client side, prior to me calling it, right?
Any function needs to be defined on the machine where it is executed, before it's executed
Here's a diagram, hopefully my writing is legible
So the problem I have here, is that addon is purely Server side. There won't be anything client side to attach to
Therefore I need to build this in a way where I can do it all SERVER side.
You can use publicVariable to transmit functions to clients
I was just looking at using publicVariableServer, to store the data that way
e.g.
my_fnc_healthRetriever = compileFinal { // some code };
publicVariable "my_fnc_healthRetriever";```
Spawn Wait until ServerVar is notnil
{
Remote exec the code, store output in variable, send it via publicVariableServer
}
publicVariable will send it to all clients, which wouldn't be needed here
The point of using publicVariable is to define the function on all clients so that they can be told to execute it later. While it's plausible that not all clients will need to use the function during any given mission, it seems likely that any of them could. Picking and choosing which clients to define the function on is not very important.
Oh I see what you mean
The reason to use a function is so you can instruct clients to refer to that function, and avoid sending a function's worth of code over the network every time you want to do this task.
Ok I get that, however this function will only run 1 time in the lifetime of the clients connection. So there's no real gain here 😄
You could use publicVariableServer instead of a function callback, but a function callback is a convenient way to immediately act on that information, rather than relying on a waitUntil or something. It also doesn't require generating unique variable names per player.
Example structure:
// define function and send to clients
my_fnc_healthRetriever = compileFinal {
private _healthData = "";
if (alive player) then {
_healthData = player call ace_medical_fnc_serializeState;
} else {
_healthData = "Dead. RIP.";
};
[player, _healthData] remoteExec ["my_fnc_healthCallback",remoteExecutedOwner];
};
publicVariable "my_fnc_healthRetriever";
// request info from a particular player
0 remoteExec ["my_fnc_healthRetriever",_targetPlayer];
// my_fnc_healthCallback
params ["_player","_healthData"];
systemChat format ["%1 health info: %2", name _player, _healthData];```
hi guys. im kinda having this one issue and im not sure how to solve it. i have some tasks where you have to retrieve an item from a box, or a body. And there is this one instance in which if the "carrier" of the item, or even the item itself, is inside a building and said building turns to rubble, the object gets buried and there is no way to get to it (seems it depends on the type of rubble?). does any of you know of a way to work around this? i've tried playing with checkvisibility in conjunction with other commands but i can't seem to get reliable results.
Hi, I'm looking to make a tweak to the Revive system and was curious how I could change this to setDamage 0.25 instead of 0
Also if possible just disable this, I don't want all heals to be full heals
Wee problem, one of you may know, Copied this from the BI wiki and edited just the text that was displayed but its coming back with an error
[
[
["100 Days", "<t align = 'center' shadow = '1' size = '1.0'>%1</t>", 15]
]
] spawn BIS_fnc_typeText;
``` the error it comes back with is ```missing [```
this is the example ```sqf
[
[
["CAMP ROGAIN,", "<t align = 'center' shadow = '1' size = '0.7' font='PuristaBold'>%1</t>"],
["RESUPPLY POINT", "<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"],
["10 MINUTES LATER ...", "<t align = 'center' shadow = '1' size = '1.0'>%1</t>", 15]
]
] spawn BIS_fnc_typeText;
Works for me without any problem. Where do you place it?
_camera = "camera" camcreate [0,0,0]
camdestroy _camera;
_camera cameraeffect ["internal", "back"]
;comment "18:02:20";
_camera camPrepareTarget [-17991.63,108614.89,8.34];
_camera camPreparePos [5974.523,11551.71,2.00];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0
~20
titlecut [" ","BLACK out",1]
~1
titlecut [" ","BLACK IN",1]
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal", "back"]
;comment "12:30:21";
_camera camPrepareTarget [66571.51,-71027.65,-10681.14];
_camera camPreparePos [5966.483,11549.305,2];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0
~9
[
[
["100 Days", "<t align = 'center' shadow = '1' size = '1.0'>%1</t>", 15]
]
] spawn BIS_fnc_typeText;
~8
endMission "END1";
_camera cameraeffect ["terminate","back"];
camdestroy _camera
enableradio true
showcinemaborder false
exit
Excuse me, SQS?
SQS does not support multiline statements (and is considered obsolete, too)
That will be where im going wrong then, managed a work around with an execVM
Hello. I'm trying to make a script that kicks the player out of the game using
serverCommand in UI context, but the command isn't working.
_display = ((findDisplay 1133) displayCtrl 1601);
_display ctrlAddEventHandler ["ButtonDown", {
_player = profileName;
hint _player; // works
serverCommand format ["#kick %1",_player];
}];
You sure your client has a permission to do it?
i've come up with this. so far so good. if anyone has a better idea im all ears.
_itemBox addEventHandler ["EpeContactStart", {
params ["_object1", "_object2", "_selection1", "_selection2", "_force", "_reactForce", "_worldPos"];
if (("dam" in typeOf _object2) || ("ruins" in typeOf _object2)) then
{
_pos = getPosATL _object1;
_object1 setpos [_pos #0 + 10, _pos #1 + 10, _pos #2 + 0.5];};
}];
seems to work 60% of the time, every time. 😛
good question
how do we eject all vehicles from a plane to airdrop
@tough abyss That's the great thing about arma, diversity.
Has anyone ever fixed the leight opfor pack configs? Configs look really confusing to me. :S
_object1 setpos [_pos #0 + 10, _pos #1 + 10, _pos #2 + 0.5];};
|
v
_object1 setPos (_pos vectorAdd [10, 10, 0.5]);
these {} parenthesis....
the reason why I use ANSI standard:
{
{
{
}
}
}
instead of K&R
{
{
{
}
}
}
I use both styles. Whatever I feel like is more legible at a moment. 😄
oh, Allman style is ANSI standard? ^^
Yep. Placement of braces (curly brackets) section.
The most commonly used style in C++ programming is ANSI or Allman while much C programming is still done in the Kernighan and Ritchie (K&R) style.
https://en.wikibooks.org/wiki/C++_Programming/Programming_Languages/C++/Code/Style_Conventions
Nice, that's how I roll. Thanks!
whats the name for ungided 155mm rounds coming from a 2s6
You can check in Config Viewer
i checked and styped it in but i think it places a dot in the front
?
so it dosnt work
What doesn't work and what have you done then
"32Rnd_155mm_Mo_shells_0" dosnt work
Doesn't work in what sense
What are you trying to do
What is your code
artel1 commandArtilleryFire [getPosATL target,"32Rnd_155mm_Mo_shells_0",32];
The class is 32Rnd_155mm_Mo_shells_O and your last character is 0 (zero) not O (alphabet)
sup every one! is it possible to create and spawn a group that hates every other group? i know that i can create groups on EAST, WEST, INDEPENDENT and CIV
but i wanted the possibility to create AI that will engage any other group that it finds
but if i spawn 2 sideEnemy AI groups, will they engage eachother?
According to that article, maybe
awesome! will try! 🙂 thanks
Alternatively you can use setFriend
now to issue is that it will only fire if im inside one of artellery vehicles
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
// unit inti: [this,rs_mob1] execVM "scripts\rs_mob.sqf";
params ["_p","_rs","_pos","_rsa"];
_p = _this select 0;
_rs = _this select 1;
_pos = position _p;
_p removeaction _rsa;
waituntil {sleep 3;getpos _p select 2 < 2};
sleep 30;
_rsa = _p addaction ["Relocate spawn point",{_rs setpos _pos;[_p, "AinvPknlMstpSnonWnonDnon_medic0"] remoteExec ["switchMove"];[[west, "HQ"], "Mobile respawn relocated"] remoteExec ["sidechat"];}];
I keep getting an error saying _rs is undefined. What am I doing wrong?
_p is working just fine...
Why you redefine _p _rs _pos etc when you declare them in params
What @warm hedge said. Ideally you'd either use one or the other but params are typically the better way to go imo.
hmm....
params and _this select do the exact same thing (getting arguments from the script scope)
mostly since I'm not used to work with params maybe...
The others are correct about the redundant definitions, but the specific problem is that the addAction code (that gets executed when the action is used) is a separate scope from the script that added the action. So local scope variables from the action-adding scope don't exist in the action code scope.
-.-
As for what you actually asked for help for, is there any chance that rs_mob1 could be null or nil outside of the scope you are feeding it to before your execVM?
Use params. It offers the possibility to define default values if scripts are being called with less parameters (can save you some work too) and it allows to "force" dataTypes
I was just hoping to avoid the 100 small script diseace...
Whoops sorry ignore this @hallow mortar is correct. I am on mobile so a little harder for me to read atm
i mean. Isn't addAction's script the separate scope? How would it see any of private variables here? 🤔
He has an inline code block which spawns a new script
Add action Code contains:
params ["_target", "_caller", "_actionId", "_arguments"];
So _target might be the vehicle for example
Ah I see. Last addaction doesn't declare any values
and _arguments isn't passed in what code i see posted
Yeah would have to pass the object either via _target or in _arguments (can but most not necessary be an array)
also, this entire code looks like a mixup of old private <array> syntax with params, tbh 🤔
Also this may entirely not matter but if you plan on having your mission being used in a multiplayer environment, I would recommend uiSleep over sleep to better preserve client time. If this is for a solo mission really shouldn't matter but figured I'd put it out there 🙂
maybe try replacing the last line with sqf _rsa = _p addaction ["Relocate spawn point",{_this#3 params ["_p", "_rs", "_pos"]; _rs setpos _pos;[_p, "AinvPknlMstpSnonWnonDnon_medic0"] remoteExec ["switchMove"];[[west, "HQ"], "Mobile respawn relocated"] remoteExec ["sidechat"];}, [_p, _rs, _pos]]; to pass the used variables into the addAction's code
Refined your code and added respawn safety
// unit init: [this,rs_mob1] execVM "scripts\rs_mob.sqf";
params ["_p","_rs"];
_rsa = _p addaction [
"Relocate spawn point",
{
// interpret available arguments
params ["_target", "_caller", "_actionId", "_arguments"];
// move the spawn point and do anims etc
_arguments setposASL (getPosASL _caller);
[_caller, "AinvPknlMstpSnonWnonDnon_medic0"] remoteExec ["switchMove"];
[[west, "HQ"], "Mobile respawn relocated"] remoteExec ["sidechat"];
// start the cooldown
missionNamespace setVariable ["mrb_var_spawnMoveLast",([time,serverTime] select isMultiplayer),true];
},
_rs, // pass the spawn point object as an argument to the action code so we can use it
1,
true,
true,
"",
"isTouchingGround _this && {(([time,serverTime] select isMultiplayer) - (missionNamespace getVariable ['mrb_var_spawnMoveLast',0])) > 30}",
0
];
// respawn handling
_p setVariable ["mrb_spawnMoveAction",_rsa];
_p setVariable ["mrb_associatedMobileSpawn",_rs];
_p addEventHandler ["Respawn",{
params [_unit,_corpse];
[_unit, _unit getVariable ["mrb_associatedMobileSpawn",objNull]] execVM "scripts\rs_mob.sqf";
_corpse removeAction (_corpse getVariable ["mrb_spawnMoveAction",0]);
}];```
* not tested in game, beware typos
If you find this results in the spawn object being teleported directly into your own body, killing you instantly, replace _arguments setPosASL (getPosASL _caller); with this:
private _posModified = getPosASL _caller vectorAdd (vectorDir _caller vectorMultiply 5);
_arguments setPosASL _posModified;```
eyyy, i'm an official slowpoke (again)
Bizarre one, this is one of many scripts that work correctly on a dedicated server running on the same computer as client, however when run on a remote dedicated server, It doesn't work, why would that be?
// customize ending
[missionNamespace, "respawnTicketsExhausted", {
params ["_target"];
systemChat str formatText["RESPAWN TICKETS EXHAUSTED - %2", _target];
_ticketsWest = [west] call BIS_fnc_respawnTickets;
_ticketsInd = [independent] call BIS_fnc_respawnTickets;
// override debriefing text - endType setDebriefingText [title, description] - DEBUG: "WINNER" call BIS_fnc_endMission, "LOSER" call BIS_fnc_endMission
// VICTORY
["end1", ["VICTORY", "", str formatText ["NATO have claimed victory over the battle! (%1 - %2)", _ticketsWest, _ticketsInd], "", "\A3\Data_F\Flags\flag_NATO_CO.paa"]]
remoteExecCall ["setDebriefingText", 0];
// DEFEAT
["SideLost", ["DEFEAT", "", str formatText ["AAF have claimed victory over the battle! (%2 - %1)", _ticketsWest, _ticketsInd], "", "\A3\Data_F\Flags\flag_AAF_CO.paa"]]
remoteExecCall ["setDebriefingText", 0];
if (!isNil "v_endInvoked") exitWith {};
v_endInvoked = true;
// Mission doesn't seem to end properly on server, so end mission manually
if (_ticketsWest == 0) exitWith {
// [endName, isVictory, fadeType, playMusic, cancelTasks] call BIS_fnc_endMission
["SideLost", false, true, true, true] remoteExecCall ["BIS_fnc_endMission", 0];
};
if (_ticketsInd == 0) exitWith {
// [endName, isVictory, fadeType, playMusic, cancelTasks] call BIS_fnc_endMission
["end1", true, true, true, true] remoteExecCall ["BIS_fnc_endMission", 0];
};
}] call BIS_fnc_addScriptedEventHandler;
Thank you Sir.
Edit: However, now the action does not appear to the unit...
I'd recommend posting a new message rather than a late edit that contains critical new information :U
That's probably because serverTime returns 0 in SP and I guess you're testing in SP, thanks BI. Previously posted code has been updated.
ok. ty. Will try new code.
Is there availiable an SQF checker that would find errors for you? I remember way back there used to be one
like a Syntax checker
Best bet is to paste it into ADT tbh.
Forgive me ADT?
Advanced Developer Tools. It's an Arma mod with a better debug console & config viewer. The syntax checking in the debug console is very good.
Sorry just realised what you meant 🤦♂️
Seems to be working just fine. Again, thanks you for your time and patience. 🙂
["CAManBase", "Killed", {
params ["_unit","_killed"];
if (!isPlayer _unit && var_removeMagazinesDead
) then {
{_unit removeMagazine _x} count magazines _unit;
_unit setAmmo [handgunWeapon _unit, (selectRandom [5,10,15,20,25])];
_unit setAmmo [primaryWeapon _unit, (selectRandom [5,10,15,20,25])];
_unit removeItems "vn_b_item_firstaidkit";
_unit removeItems "vn_o_item_firstaidkit";
_unit removeItems "FirstAidKit";
_unit removeItems "Medikit";
_unit removeItems "vn_b_item_medikit_01";
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
I want to change the 'CAManBase' to only choose east side units, how can i accomplish that according to the rules of 'CBA_fnc_addClassEventHandler'?
it says ^Can be a base class^ in the website
EDIT: thanks to John and Nikko got it quickly solved
change>>> !isPlayer
with>>> (side group _unit) == east
I don't think there's any strict side base class. You'd need to add a side check inside the event handler instead.
Don't forget to check the group's side rather than the unit's side, since units become Civilian when dead
Hello, if someone wants a game type like BF2:Project Reality AAS style (related to the capturing of sectors), here's a template:
https://github.com/PiG13BR/Arma-3/tree/main/AAS_PIG
Got finaly working on dedi server
Okay having a bash at holdActions but cant seem to get it to work correctly, I have a tent placed down with the variable name of tent and its Init has it destroyed this setDamage 1; I'd like to add and action to it to "fix it" so I have created this
[
_tent,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{},
{},
{["TentBuilt", true. true];},
{},
[],
10,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _tent];
``` which I have running as an SQF script in the mission folder, It calls the script correctly but states im Missing a ] on line 4?
I also have a trigger placed with ```
Condition: tent getVariable ['TentBuilt', true];
on Activation: tent SetDamage 0;``` hoping for it to be "built"
appologies, the error is on Line10 not 4
Well, for one thing, there is a . instead of a , in the "on completion" code field. I don't actually know if that's a valid array separator but it seems highly suspect.
Also, the array in the "on completion" code is...just an array. It's not doing anything, just defining an array. I think you might be missing a tent setVariable at the start of it.
That said, you don't need to set a variable and then have a trigger waiting for that variable to set the tent's damage. You can just do the setDamage in the action completion code.
Im giving that a try, I think im also missing setting the item tent as a variable so _tent is causing errors
hmm, its not throwing errors at me now, hoever there is no action on the item in game
You just need to pass the tent object as an argument when you add the action, by putting it in the custom arguments array (the currently empty array just after the code fields)
e.g.
// ...
{},
{ (_arguments select 0) setDamage 0; },
{},
[_tent],
// ...```
btw, beware of the "remove on completion" parameter for BIS_fnc_holdActionAdd. It only removes the local copy of the action, so other clients will still have it in MP. If you want to globally remove the action, you need to have each client add it locally so they can save their own action ID, and then when it comes to removing it, you need to have each client remove it locally with BIS_fnc_holdActionRemove and retrieving their own action ID.
it now seems to be having an issue with this line ```sqf
//
] remoteExec ["BIS_fnc_holdActionAdd", 0, _tent];
Error: Type Any exopected Bool, String, Object
Im not following, how would I go about adding it to each client locally and then removing it?
It seems like _tent isn't defined in the main script. I assumed you had done that :U
If you want this script to be reusable with various different objects, you can pass it into the script as an argument, kind of like we just did with passing it from the script to the action. You'd use params for that. For example:
// calling the script from an init field:
[this] execVM "myscript.sqf";
// or
[this] call my_fnc_tentFunction;
// inside the script, line 1:
params ["_tent"];```
I'd recommend that approach because reusability is good, but if this is just for one specific object, you could hardcode it to refer to the object's global variable name by using that instead of the local variable `_tent`.
remoteExecing BIS_fnc_holdActionAdd alone doesn't give you the opportunity to save the action ID it returns. You'd need to make an action-adder function that itself does BIS_fnc_holdActionAdd and saves the return, then remoteExec that function. Then you'd need to have a counterpart remover function that retrieves the ID and removes the local copy of the action, which you could then remoteExec.
So if the variable name in the editor is tent then that’s is global variable name correct?
Yes, though you might want to make it more unique to avoid conflicts with other scripts or mods.
Gotcha
So for example ```sqf
params ["_fgtent1"];
[
_fgtent1,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{},
{},
{ (_arguments select 0) setDamage 0; },
{},
[fgtent1],
10,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, fgtent1];
Well, that will probably work if you call that script correctly, but...you've done both solutions at the same time. You only need one.
EITHER:
Use params to make the script reusable, passing the object to the script as an argument and using the local variable inside the script
OR:
Hardcode it with the object's global variable name
Ahhh I see I see im following you
[
fgtent1,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{},
{},
{ (_arguments select 0) setDamage 0; },
{},
[fgtent1],
10,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, fgtent1];
As such?
Yes.
I do want to stress again that making a reusable script without hardcoded variable names is usually better, because...it's reusable. If you want to have this script run on several different tents in the same mission, you'd need to have multiple copies of this code with the variable name changed; it'd be better to have a single generic piece of code that you can run multiple times with different arguments.
It is only for the one item for this script, though I had planned on doing a similar one that will be reusable for a different part of the mission
This for the one tent and then another for Sangars and Wall defenses
It is still kicking off an error on the last line however
Is it the same error as before?
You don't need to send in ARGS your fgtent1 object if you are adding current addaction to the same object.
You can use instead In statement
params ["_target", "_caller", "_actionId", "_arguments"];
_target setDamage 0;
If you want use args.
You need use array
It's true you could use _target and skip passing it as an argument. I guess I still had the previous thing on my mind and didn't realise it was the same object.
However, you don't need params inside the action code (BIS_fnc_holdActionAdd already defines the variables for you as if params had been used).
Also, an array is already being used to pass the argument, so that's not the problem - it's technically a bit of a redundant way of doing it, but it should work.
In terms of the actual error, I don't really know what's up with that. If fgtent1 is the object's Editor variable name (and it's spelled right), then that should be fine. No reason it would be undefined, which is what "type Any" really means.
could I change ```sqf
{ (_arguments select 0) setDamage 0; },
```sqf
{ fgtent1 setDamage 0; },
Yes, but I'd suggest using _target so that when you copy this code to make your other variants, you don't need to change it.
So add the code supplied by Prisoner on line 1?
params ["_target", "_caller", "_actionId", "_arguments"];
[
fgtent1,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{},
{},
{ _target setDamage 0; },
{},
[fgtent1],
10,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, fgtent1];
No.
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
The function provides you with some predefined named variables containing useful references. These variables can be used in the start, progress, completion, and interrupt code fields. _target is one of the predefined variables, and it refers to the object the action is attached to.
You can just use it without params (and that params as you've posted would be in the wrong place if you did need it, because that's outside the BIS_fnc_holdActionAdd code)
Ahhhh I see I see
Appoligies, Im still learning, I do really appreciate the help though
its still triggering an error on that last line, Type Any
Can you post the exact and complete error, please?
And if this is in an external file, make sure you've saved the file since making changes
This is an external file, I just post it into ADT for quick checking
the script itself is being called in the initPlayerLocal
execVM "tentholdaction.sqf"; //Construct Tent
Oh, you're trying to do it in the actual Editor, not the mission preview. That's why. Nothing actually exists yet.
The Editor isn't a live scenario, it's all dummy objects. Nothing's actually running and object variables aren't defined.
I have tried doing it by playing the mission, It doesnt appear on the tent
by hitting play scenario
Have you tried doing that since making and saving all the changes?
Yes
How big is the tent btw? Distance is measured from the object centre, not its actual shape, so if it's a bigger-than-tiny tent, you may need to increase the distance check in the action conditions.
its the CUP East tent, I shall try but it doesnt even appear when im standing ontop of it in the middle
to be fair, adding the script to the item using 3den Enhanced it doesnt show up either
Maybe its the item itself that isnt liking it
That exact code works for me
How strange
ill try it on a different asset and see if its the tent itself
for whatever reason its not showing up for me
Maybe I shall just have to do it the old fashioned way with addActions
you can easily check your distance.
on watch list
And you can pin that to left your screen to see when you move
There's no reason why addAction and holdAction would be different here. They actually use the same system - holdAction is a scripted hack of the addAction system.
I dont understand it though, I have had addActions work before and this doesnt seem to be working, It may be conflicting with a mod or something, if its working on your end but the same code isnt working on my end
Not sure how to do this
Right interestingly addAction is also not working
Which It was previously
Go to game.
Press ECS
you should be able to see Console
Press + right down corner to get Expression 1 box to show
add on upper box
player distance fgtent1
press Pin button next to text box
Well within range, Im not sure what is causing this to be honst
Share your current code that you are using
Tried it in a clean mission with just the tent, a player and only that script and it still isnt showing up inside the game
[
fgtent1,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{},
{},
{ _target setDamage 0; },
{},
[fgtent1],
7,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, fgtent1];
execVM "tentholdaction.sqf"; //Construct Tent
``` Just this in the init.sqf
You dont need remoteexec when using init.sqf
It wil be called from client so client will get addaction
Try add systemChat to be sure that your .sqf is called
systemChat "Holdaction .sqf called";
[
fgtent1,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{},
{},
{ _target setDamage 0; },
{},
[fgtent1],
7,
0,
true,
false
] call BIS_fnc_holdActionAdd;
Still nothing. it does say its being called
Accidentally asked in reforger
Does anybody know the effect or animation thats used to ragdoll a player when theyre hit by a car? It knocks them down then they eventually roll over and get up. Is there a name for this or is it a compilation of different things?
It's just the physics engine
You can use addForce to do it yourself (though note that until 2.18, they will be set unconscious if you hit them hard enough to ragdoll them)
Okay cool, I was curious about the revive system and how it knocks the player into a ragdoll state. I have a custom revive system I am working on editing and I want it to ragdoll the player and drop their guns on the floor before they roll over onto their backs using the agonystart action
The revive system probably uses setUnconscious
Its does but it has a weird method which Im trying to change. Basically it just forced them to the agonystart action and I hate watching the players lay down after being shot. I think I will try the add force method into this function
Its the AIS revive system but heavily edited
then.
Start figuring out where the issue.
systemChat "Holdaction .sqf called";
[
fgtent1,
"Construct Tent",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa",
"_this distance _target < 50", //increase showing distance
"_caller distance _target < 50", //
{},
{},
{ _target setDamage 0; },
{},
[],
7,
0,
true,
false
] call BIS_fnc_holdActionAdd;
This is 100% what I was looking for thanks once again for the quick info you rock man
hey guys
that seems awesome! you got tickets working and everything? what is the victory condition? i really want to know more.
actually, i wil ping you on DM
im looking for script that i was used long time ago
it's about Ace arsenal and i have only few clues about this script
in my memories Ace arsenal open with holdaction function (like revieve circle progressbar)
and there is whitelist.sqf in folder
whitelist .sqf was like
//headgears
"rhs_headgear"
"cup_headgear"
.....
//vest
"rhs_vest"
"cup_vest"
I tried to find it for 5 days, but i couldnt .. god please help this nescient and innocent lamb
This sounds cool. If you ever find anything on it, hmu
hey, about this one... i tried running this in editor:
private _grp2 = createGroup sideEnemy;
_unit1 = _grp1 createUnit ["B_G_Sharpshooter_F", position player, [], 0, "NONE"];
_unit2 = _grp2 createUnit ["B_G_Sharpshooter_F", position player, [], 0, "NONE"];
[_unit1] join _grp1;
[_unit2] join _grp2;```
and it just dont spawn anything.... Just to be sure that i did not mess the code i tried:
```private _grp1 = createGroup east;
private _grp2 = createGroup west;
_unit1 = _grp1 createUnit ["B_G_Sharpshooter_F", position player, [], 0, "NONE"];
_unit2 = _grp2 createUnit ["B_G_Sharpshooter_F", position player, [], 0, "NONE"];
[_unit1] join _grp1;
[_unit2] join _grp2;```
this works fine....
the problem seems to be that ```sideEnemy``` is more like a status that have ```rating``` below -2000 it does not seem like i can create groups on side enemy. The result that i want is like (in the terms of arma wiki) to create a group with multiple units that work as a proper group but hates each and every other group. I am using this for a survival exile server, so since exile is going pretty slow this days (not to say dead), i want to give the server more life and combat even with low player count. I want DMS AI from each mission to hate each other, A3XAI that is going pass by DMS missions to engaged and be engaged by DMS AI. zombies, to engage and be engaged. And each and every other group of A3XAI roaming AI to engage other A3XAI groups if they come across each other. but ive been reading through A3 wiki and i could not find a way to make that happen. it seems that i need to stick to GUER, EAST, WEST or CIV.
might have somehting with this:
i am lost in this one..... do you or anyone know a work around?
Hello. Well, it's just a template for the sectors that you can actually copy and paste and modify if you have more or less sectors spawned. It's not configurated for actual gameplay, but I can updated it
Maybe i can use east as a group for every one and start my server with
east setFriend["east", 0];
is there any mod out there that allows you to breach locked vehicles?
antistasi has some addAction related to breach vehicles with enemy inside
I'm aware
but nothing standalone
I could try making it myself but
I'd rather not
Ask the creator if you can make that specific thing a standalone item, copy it over, troubleshoot, post
this dont work aswell... the group killed itself LOL
What are you trying to do?
Set a certain group to spawn hostile to everyone?
yeap. but not to itself hehehe
Ahh
sideEnemy makes them attack everyone, their own faction included. Useful for scavenger types, otherwise not always useful
i noted that , i cant create sideEnemy groups, so maybe creating a unit on lets say east, a and use silent join on sideEnemy?
It would cause them to act like an impostor and attack everyone, yeah
_this addRating -2000;
Does the trick
everyone like, even the other members in the group?
on the group or on the unit?
this does not seem to work
private _grp2 = createGroup sideEnemy;
_unit1 = _grp1 createUnit ["B_G_Sharpshooter_F", [4050.45,4200.6,0], [], 0, "NONE"];
_unit2 = _grp1 createUnit ["B_G_Sharpshooter_F", [4050.45,4210.6,0], [], 0, "NONE"];
_unit3 = _grp1 createUnit ["B_G_Sharpshooter_F", [4040.45,4200.6,0], [], 0, "NONE"];
_unit4 = _grp1 createUnit ["B_G_Sharpshooter_F", [4040.45,4210.6,0], [], 0, "NONE"];
[_unit1] join _grp1;
[_unit2] join _grp1;
[_unit3] join _grp1;
[_unit4] join _grp1;
[_unit1] joinSilent _grp2;```
have no idea why, nobody starts shooting
Oh you meant that kinda scripting lol
Above my paygrade 😭
I think the only way to get onto Enemy is by having a -2000 rating
yeap, but that way, i think that the units that have -2000 will shoot other -2000 aswell
They will. Its unavoidable
AFAIK
Seems so?
Civvy isnt friendly to East. So try that?
Or Unknown
I think that i will need to try some different factions on my server. but lets see if anybody comes with a solution
Alright
any clever way to detect if an object _obj is an ACTUAL driveable/rideable vehicle?
nice, I was just looking at this command
fuck it, I'll do it myself
@warm hedge anything on this D:
?
I have no time to read full context and do anything
locked can also work apparently
do the MLRS rockets just not fired eventhandlers? I've tried explode and hitPart and neither even fire. Anyone got ideas?
Nvm looks like I needed to change the eventhandler to submunitionCreated
Is there a way to detonate a flying missile ?
setDammage 1 doesn't appear to be working
triggerAmmo
thank you very much 🙂
is there any function from BI to display a center screen warning message? (aka not hint or notification based)
yo bros is there a command to make the game open a URL?
like in the main menu if you click the sitrep logo it opens up sitrep website
A msg box?
There is 3denMessage or so
im trying to make the main menu spotlight open a link but it doesnt seem to support url config token like the other buttons, so will need to open the link via script
@ripe sapphire afaik you have to whitelist custom urls
well whats the command to open them tho
works only with button controls i think
spotlights are two or three control types layered ontop of each other
is it input blocking or a display?
Blocking with buttons
Hey guys. I`m having some troubles with some Mod Houses. Usually a House has a variable called "numberOfDoors". Unfortunately all the houses from this mod do not have this variable. the script im using is checking for that variable so it can identify all the doors of a certain house and after that the door, the player is standing in front of. My question is, how can i identify all the doors of those mod houses ?
Probably by checking animationNames or number of actions
no
Issue is we are trying to lock the doors. However we seem do not be able to refer the doors. Presumably because the mod creator has done some weird stuff to the building cfg.
'''sqf
This setVariable ['BIS_Disabled_Door_0',1,true];
'''
This does not refer the door. Nothing happens. While this:
'''sqf
this animate ["door_0_anim" ,1];
'''
Opens the door just fine.
To my understanding the reference for the door should therefor be door_0. Which makes me not understand why the disable_door doesn't work. Any ideas?
To my understanding the reference for the door should therefor be door_0
Not necessary so no
Do you have an idea how to get the reference?
What I suggested are the only thoughts I have
being able to lock the door isn't a given 🤷♂️
door names following any convention isn't a given
you can check config of the building in question (specifically UserActions subclass) for how door opening/closing is coded and what conditions does that include
mod house:
condition = "this animationPhase ""door_0_anim"" > 0.5;
position = "useraction_0";
statement ="this animate [""door_0_anim"" ,0]";
vanilla house:
actionNameSel = "Door_1_action";
condition = "((this animationSourcePhase 'Door_1_sound_source') >= 0.5) && ((this getVariable ['bis_disabled_Door_1', 0]) != 1) && (cameraON isKindOf 'CAManBase')";
position = "Door_1_trigger";
statement = "([this, 1, 0] call BIS_fnc_Door)";```
as you can see we found the animation name and useraction but the problem is that doorPhase outputs -1 and the function BIS_disable_Door cant be used since we have no door name
statement doesn't use BIS_fnc_door, condition doesn't have anything to disable it. The door can't be locked 🤷♂️
sorry that was what im talking about. but there must be a workaround to disable the animation for example or disabling the useraction for the door. lets just say we "fake" a locked door
i don't know any methods of disabling config or engine-defined actions via script
thats sad.
locking a door is possible
by disabling the simulation of the entire house?
there is that
now regarding the conversation above, I did not scroll high enough
you will have the actions, but doors won't open
but there is the lock door module that animates the door as if it were locked, why not use that
nope not correct. place a vanilla house and disable simulation. you still can open and close all doors. about the module: because the mod creator didnt set this up correct, as you may see above. if you place the house there arent even doors you can click on in editor.
thats the mod house. no doors at all
Indeed disabling simulation doesn't stop it
Simple Object does, so that might be the workaround
yeah that's true. but my script needs to interact with it. you need to lock and unlock doors during gameplay. simple object doesn't allow that:(
then you're out of luck for this modded building
Hi im trying to get cargo containers to spawn on the back of a ship, ive come up with this, i dont get any errors but i just cant get it to work any help would be very much appreciated 🙂
terminal addAction ["Request Container",
{
_marker = createMarker ["Marker", CMspawnerPad];
_markerPos = getMarkerPos _marker;
_markerPos set [2,100];
hint "Container";
sleep 1;
"plp_ct_ContPlainBlack" createVehicle getMarkerPos _marker;
hint "done!";
}
];
You are setting _markerPos z to 100,
But you are used in createVehicle marker own pos, not re set position.
That might be an issue.
If you change your last command
"plp_ct_ContPlainBlack" createVehicle _markerPos;
the script runs same as b4 but nothing spawns in the air 😦
If you have a pad. Where you are creating your marker.
You could use position of that pad.
And if that retuns wrong z position, you could use vector add to get spawn position higher.
createMarker is ignored if a marker with the same name already exists, and "Marker" is not a very unique name
Unless you actually want a visible marker to appear, it would be better to just skip creating the marker at all. It's not necessary for what you're doing here.
private _position = (getPosASL CMspawnerPad) vectorAdd [0,0,100];
private _crate = "plp_ct_contplainblack" createVehicle [0,0,0];
_crate setPosASL _position;```
thanks guys i have it working now absolute legends @stable dune @hallow mortar
Could do a config overwrite to fix it
ye, but not scripting
ok? cant really follow you on that. what do you mean