#arma3_scripting
1 messages Β· Page 721 of 1
that's an extremely unoptimized code
tho the blame falls on RavenSunray I guess...
Thanks for explaining π
hahaha yeahhhh I didnt exactly give @vague cipher the best foundation
You could broadcast it out instead and let the client computers on the otherside determine themselves and cut out the necessity for O(N*M) time on the local computer that then needs to propagate to others anyway but π€·ββοΈ
wat? that's even worse
In terms of network I would assume so yes. Either way I do not see a method that you'd optimize it further aside from caching who are the admins and skipping out doing iterations over allPlayers constantly, or caching the resultant of evaluating their name already for admin or not as you don't need to keep evaluating for it past the first time.
I feel like its not very productive either in the end to point out if something is unoptimized as the purpose is to learn, optimization means nothing if someone does not understand code anyways as optimization typically involves unintuitive code for beginners
My group enforces names so that this shouldn't be an issue
it is productive so people learn not to write bad code, slow down the game and blame the game for it.
ofc in that case it wouldn't "slow down the game"
I think you're missing some steps to how you should be learning programming though. You don't teach people advanced stuff before they know the basics.
Optimization involves counter-intuitive changes at times, or much more complex data structures, and other nitpicky stuff. It's simply not productive to a beginner to be overwhelmed with information when they don't even know some basics on how to even interpret such information or algorithm properly.
Its skipping some steps and does not contribute to a better programmer overtime as you don't have the fundamental knowledge to understand why a HashMap is better than an Array in some situations, while other situations an Array is better instead despite the perceived benefits of a HashMap.
You should be building people's knowledge up bit by bit and not give them something they can't clearly handle just yet.
There's a reason why software engineering you learn the fundamentals of data structures first (at least in my case at my time in school) vs algorithms.
Having fundamental knowledge is the basic foundation at being a good and efficient software engineer as that skill set lets you tack on any type of problem and be able to decipher and understand solutions posted online even if they get increasingly complex in implementation
There's a reason why in tech interviews they smile more on the people that have unoptimized algorithms but could clearly explain and talk through what they're thinking of and their process at obtaining the solution vs people that just immediately skip to the optimized problem but couldn't explain it as well.
I think the problem here is that you studied software design. Someone who has never studied it will have a very hard time picking it up from just 0. They should be forwarded to other learning platforms that offer better learning opportunities
What? My stuff wasn't software design at all lol, it was just computer science. Software design is modelling out how to properly implement something so that it satisfies the product needs while also being good architecturally and technical-wise.
Either way yes, a discord server is not the best place to properly learn how to get into computer science from scratch, but they should also be given stuff that should ideally be adjusted to their skill level or they're just going to get confused and both parties will end up being frustrated imo.
They should feel frustrated. Arma 3's sqf is a bad language to start with as your first. Instead they should learn another language, preferably C-type
I agree with that lmao
SQF is a nightmare syntax wise
I would say if they want to get an easy job in the industry to just learn JavaScript and React-Native instead
Highly marketable skills and in high demand typically. Especially if you are capable of demonstrating true full-stack engineering capability, or have some focus on back-end side of things
I would say that regardless of language, helping them understand the pseudocode which is language independent is better than nitpicking over optimization details while still providing them an implementation that actually works in the actual scripting language at hand. Over-thinking and over-optimizing when something isn't a problem is not a good trait to have in reality as well. Of course, every little bit adds up in a game over time, however its more productive a majority of the time to get your feature out first before sitting down and optimizing it if it really becomes a problem, esp something as low priority and quite light as this would be.
Problem in the arma series throughout times has just been that people never end up optimizing their code if they see it "work". This results in poor performance scenarios and an undeserved fame as "badly optimized game" for arma
I mean the game is not that great to be real so there is some merit there. But yes, bad scripts do contribute to bad performance.
If people don't optimize then that's their problem, I do not see why you would want to foster an environment that is less conducive to people learning easier and are fine with a "they should be frustrated" type mindset. Scripting in games is usually the gateway for people to get into computer science and into the industry as a whole.
Over-focusing on optimization is a really bad trait to have.
However I see that we agree to disagree here so I'll drop this convo π
Do yo realise that handledamage fires multiple times and is very sensitive to any damage and you are making it remote execute a comnand from it. This will cause network spam the least
I didn't realise π
I am currently using this solution #arma3_scripting message
Do you have a suggestion for an alternative for what I'm trying to achieve?
it's not really efficient, best would be to have an array of captains/majors computed in some init script, and just loop through them, instead of filtering them every single time on hit.
afaik you can check if _selection https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage is an empty string, it should happen only once
or you can use https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Hit maybe 
I hate this "undefined" crap so much lol, it's clearly defined in the first script but is somehow breaking on the second iteration of the loop
ts_patrol_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_patrol_fnc.sqf";
ts_banditcamp_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_banditcamp_fnc.sqf";
you certainly aren't storing the compiled code, you are compiling, calling it, and then storing it's result (whatever that might be), then later, you're trying to spawn whatever either of those functions returned.
I am not sure what you are trying to do, but using MPHit event handler perhaps is already better as it fires on every PC and then you can just filter a PC you want and display message only on that PC ignoring others
Is there a script command I can use that I can trigger with the in game debug console to make a player fire continuously?
I'm testing some sound related things on a dedicated server and I connect to it with two clients on the same PC and I want to alt tab between clients to test and have one or both players fire while alt tabbed.
That sounds really good actually I will have a look through MPHit on the wiki thanks
just make sure you add them with addMPEventHandler
like infi amo?
forceWeaponFire + setAmmo every frame
I tried oneachframe {player forceWeaponFire ["arifle_MXC_Holo_pointer_F", "single"]; player setAmmo [currentWeapon player, 1]};
which while absolutely hilarious because it's firing faster than a minigun, is a little overkill i just need it to fire a shot every half second or so. The sleep command doesn't work with oneachframe so I'm not sure what to do.
Well changing that "1" to any integer above 1 stops the minigun behavior, but I guess now I know an instant script to turn any infantry weapon into a minigun.
quick & dirty:
TheTime = diag_tickTime + 0.5;
onEachFrame {
if (diag_tickTime > TheTime) then
{
TheTime = diag_tickTime + 0.5;
player forceWeaponFire ["arifle_MXC_Holo_pointer_F", "single"];
player setAmmo [currentWeapon player, 1];
};
};
Thanks that is useful, even though I was able to get it working just by changing the number. Do you have any idea why setting that ammo to 1 causes it to fire literally as fast as your framerate (so 60 fps being 60 rounds a second) instead of the weapons max fire rate? I even got it to work on a slammer by putting
oneachframe {player forceWeaponFire ["cannon_120mm", "player"]; player setAmmo [currentWeapon vehicle player, 1]};
I guess it considers that emptying the magazine sets the bullet reload time to zero, therefore allowing for the MG effect
Well all I know is that this definitely is more of a feature than a bug. The AI will never see it coming π«
Anyone of the top of their head know if ```sqf
markerPos "aMarkerWhichDoesn'tExist"
returns [0,0,0], [], or a different error?
Should be [0,0,0]
Thanks π
And if I was to deleteMarker this marker, it'd just silently fail iirc
Yeah
I require your help once more. I am still looking at simple objects and super simple objects. I am a bit confused how things work. I have this code that in my interpretation will make a simple object with door 1, door 1 handle and glass 1. Be in the animated open state.
[["Land_i_House_Big_02_V1_F","A3\Structures_F\Households\House_Big02\i_House_Big_02_V1_F.p3d",0,2.884,[["door_1_rot",1],["door_1_handle_rot_1",1],["glass_1_hide",1]],[]],[180,5,5], 0,false,false] call BIS_fnc_createSimpleObject;
However the opposite is happening. When i change the last parameter it creates a super-simple object with open door and glass. While this is supposed to be just a 3d model. Can anyone enlighten me what could be possible be wrong in my thinking?
[["Land_i_House_Big_02_V1_F","A3\Structures_F\Households\House_Big02\i_House_Big_02_V1_F.p3d",0,2.884,[["door_1_rot",1],["door_1_handle_rot_1",1],["glass_1_hide",1]],[]],[180,5,5], 0,false,true] call BIS_fnc_createSimpleObject;
I don't think I understand the problem
Also there's no need to use the BIS function... 
Why not it's supposed to make your live easier.
I don't see how that's easier π€·
Instead of 123 lines of code i now just need 3. So back to topic the super simple object that is supposed to be just a 3d model can have it's doors animated open but a simple object that has extra functionality like retexturing can not animate it's doors.
It should 
Just try the normal way and report back
_obj = createSimpleObject ["class", _pos];
_obj animate ...
If you replace classname with model path it becomes a super simple object
Now do you see 123 lines of code? 
(the last line could be a forEach loop)
Sooo looking at BIS_fnc_endMissionServer and addMissionEventHandler MPEnded, am I completely blind or does ArmA actually does not transmit which side "won" the mission? Is there no Mission variable I can read that is filled with that ?
well its kinda up to you to decide how a team wins. you can use variables that you determine to do the rest
I thought at least when defining win conditions in 3den it would fill something
like I do this with one of my PvP missions... haven't touched this since june so if I sat down I'd probably do it a better way but it works fine for me.
https://github.com/hypoxia125/CarrierStrike64/blob/main/CarrierStrikeMalden64.Malden/functions/server/fn_gameEnd.sqf
Stupid question perhaps, but how do you find the default map control for use with primitives such as drawEllipse? Or is it truly like the docs suggest?
private _defaultMapCtrl = findDisplay 12 displayCtrl 51;
Better question, once drawn, how do you erase that drawn element? without necessarily clearing the whole map.
The example suggests that it needs to be drawn every frame, so you erase it by not drawing it anymore.
huh okay interesting
so if we setup a service or callback etc then we need to do a bit of bookkeeping to remember that we can tell 'stop'.
Wat? 
I have no idea what you just said, but anyway, the correct way to draw is using an array in draw3D EH
Then you fill that array with what you want to draw
And when you don't want to draw you just clear the array
in terms of creating or deleting an ellipse 'object' let's say. done in terms of the 'Draw' EH, which implies some bookkeeping must be done.
yes I understand; I asked about ellipse specifically though.
The simplest bookkeeping is using array indices of course
But if you want you can go with hashmaps too (a bit inefficient tho)
sure, I just add a variable on the MAP control itself. caller responsibility to remember to remove the event handler, i.e. delete the 'shape' variable on unload, let's say, etc. ez pz.
is there a way to pass a variable to an event handler w/o making it global?
what event handler in particular
you can use https://community.bistudio.com/wiki/setVariable on the control/display
kk thx ill look into it
howdy, can somebody tell me where I can find the script for enabling decon showers? google didn't help
Is there even one? You might want to look into creating a particle generator and enabling/disabling it on demand
Or try this section
Probably BIN_fnc_deconShowerAnim
If my guess isnt super wrong
Yep, you can make pretty much any object spray water with thay
π
Does anyone have a script to put text onto the screen when you first spawn?
there are many engine commands, and bis functions that display text on screen, pick one and run it in an init script, preferably initPlayerLocal
I don't know any though.
I literally asked if anyone has a script. Not if there are any
https://community.bistudio.com/wiki/BIS_fnc_typeText https://community.bistudio.com/wiki/BIS_fnc_dynamicText i'm not going to link every single one here though
you should probably ask in #zeus_discussion
@copper raven is there an event handler that's called right before death, and only once?
No.
What is your use case for such eventhandler anyways? @brazen lagoon
i'm using selectPlayer to swap unit skeletons dynamically
but I want those skeletons swapped back on death
Killed doesn't seem to be working correctly
Why not?
well I don't know, that's what I'm trying to figure out
What are you using to swap skeletons?
And by skeletons, i suppose you mean swapping controllable character
yes, the wh40k mod has different skeletons for different units
and if you swap loadouts without also swapping skeleton then weird things happens
So you dont know what it should do and what it does?
π€¨
I don't know why Killed doesn't work as I expect
_new_unit setVariable ["OLD_TYPE", _type, true];
private _eh_index = _new_unit addEventHandler ["Killed", {
_this spawn {
params ["_old_unit", "_killer", "_instigator", "_useEffects"];
private _eh_id = _old_unit getVariable "SWAP_EH_INDEX";
if !(isNil "_eh_id") then {
_old_unit removeEventHandler ["Killed", _eh_id];
};
private _type = _old_unit getVariable "OLD_TYPE";
private _group = group _old_unit;
if (isNil "_group") then {
_group = createGroup (side _old_unit);
};
_new_unit = _group createUnit [_type, position _old_unit, [], 5, "NONE"];
_new_unit setVariable ["SPAWNED_AI", true];
sleep 10;
[_old_unit, _new_unit] call SWAP_WITHOUT_EH;
_new_unit setDammage 1;
};
}];```
I would think that this would selectPlayer into the old unit classname on death, but it does not work as I expected
maybe I'm better off using MPRespawn and swapping the loadout into the old unit.
How does it work then?
What is it doing
Also, why do you kill the new unit too?
At the end _new_unit setDammage 1:
Is this intentional?
because it is triggered on kill. so I want the player to die. so that when they respawn they respawn with the proper skeleton
So...
What youre doing here upon player death, is cretaing a copy of the player character that just died, moving control to that and then killing it
yes
not a copy of the player character, a copy of the unit the player spawned as originally
but yes
you get a copy of the unit the eh is attached to, no?
Swap player contorl to that
no
No?
_new_unit setVariable ["OLD_TYPE", _type, true]; this sets the type of the old unit on the new unit
``` this gets the old unit's type from the unit that is about to die
No, the unit is already dead
But moving on
What does happen?
you go to the respawn screen, after like 20 seconds you respawn automatically without clicking respawn
Yes?
What do you expect should happen?
Not going to the respawn screen? After you just killed the player?
If you dont want people to interrupt you, stop using send-message for newline
when you respawn you spawn as the unit you expect (the one selected in the respawn menu), but you don't actually click respawn, which is odd IMO
but in any case you're the right unit for a few seconds, and then after ~5 or so seconds you get swapped back into the unit you had before respawning, but with the post-respawn unit's loadout from the editor
@brazen lagoon could try removing the sleep 10 from your code
If you want to override the respawn behaviour, youre going to ahve to make it yourself
On killed, swap to another camera and do your business on the background
My current plan is just to use the Respawn EH
It is unlikely the default respawn functions work with this
I noticed you said "selected loadout", so i presume youre using one of the respawn templates
No?
Well, the one selected in the "respawn menu"
yes
the vanilla one
Yeah, dont use that
it makes sense that there's conflicts with that yeah
I think I'm just going to use the Respawn EH
The template respaw functions conflict with everything on respawn
and use fade out/in
You do you
The smart choice would be to do your shenanigans after respawn if you insist on using the vanilla templates
They are very temperamental
yes thats what I plan on
π
Is there a better respawn template I should be using?
Literally anything
I'd like to avoid having to do it all myself but an immersive respawn screen that like, shows an overhead camera or something on the point you wanna spawn at would be hype as hell
Then make it
?
just a lot of work
Yes? And?
Get used to it if youre going to script for arma
Youre going to have to do a lot of work and find weird workarounds
I'm aware, that's what I'm doing right now
but I would prefer to spend the time on high value areas
hence why I was asking if there was an existing template i could use
Yes. The vanilla templates
Or literally anything off the web
yes, the latter is what I was asking
Find one you like and use that
I'm searching for them and I don't see anything obvious by searching for 'arma 3 custom respawn template'
Make sure to attribute the creator
Hey, quick question
So if we're using BIS_fnc_replacewithsimpleobject en masse (which I know isn't recommended implementation but bear with me)
And we're getting tons o' freezing at the start of missions because calling it in object inits is overloading the unscheduled script
Would the code:
this spawn {[_this] call bis_fnc_replacewithsimpleobject}
Help to rectify?
no

No. Fix your laggy mission first.
learn to script faster code.
Y i k e s
This is a better implementation.
[this,true] call BIS_fnc_replaceWithSimpleObject;
I'm afraid this solution doesn't really address the root of the problem we're encountering π
The problem we're encountering is that because we're executing this script en masse at the start of the mission, it's clogging up in the unscheduled environment and spiking performance at the start of the mission. It usually levels off as it works through the queue, and after start/during mission we gain some benefit from using simple objects instead of large amounts of simulated objects, but we're currently looking into ways to better optimize our construction-heavy missions
The proposed solution which I needed clarification on is to instead spawn the function so that it executes in the scheduled environment, rather than the default unscheduled environment of object init, that way the engine can work through it at a more reasonable pace and we don't have as big spikes (longer execution time is a worthwhile tradeoff in our situation)
What I clarified was that using BIS_fnc_replacewithsimpleobject en-masse isn't the intended use case, so while I'm perfectly happy to admit I'm far from an expert scripter here, I'm not sure if this solution is necessarily better for our team's use-case π
you can try using loading screen, it will speed up all the init script execution, while you can show nice picture https://community.bistudio.com/wiki/startLoadingScreen
was wondering if someone could help me out with my inidbi and tell me what exactly i'm doing wrong
its not big but too big to post in here
_camera1 = "camera" camCreate (getPosATL player);
_camera2 = "camera" camCreate (getPosATL player);
_camera1 cameraEffect ["Internal", "Back", "rtt1"]; //--All fine, i have PIP in my Control--
sleep 5;
_camera2 cameraEffect ["Internal","back"]; //--_camera1 come broken, i have black screen in my Control--
How to fix this issue?
what if you set camera2 effect first?
Then cameraEffect with camera1 will broke camera2. Order doesn't matter. Last cameraEffect broke all previous cameras.
is this your actual code? I don't see anything wrong
_camera = "camera" camCreate [((getPosATL player) # 0) + _randomValue, ((getPosATL player) # 1)+_randomValue,
((getPosATL player) # 2) + 500];
_camera cameraEffect ["Internal","back"];
//[] execVM "Client\Player\fn_DisplayIntroPIP.sqf";
_camera camSetTarget player;
_camera camPreparePos ([((getPosATL player) select 0) + 21,((getPosATL player) select 1) + 21,((getPosATL player) select 2)+ 25]);
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 30;
Client\Player\fn_DisplayIntroPIP.sqf
_introWatchUnitDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";
_ctrl = _introWatchUnitDisplay ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [-0.25, 0.5, 0.75, 0.5];
_ctrl ctrlSetText "#(argb,1024,1024,1)r2t(rtt1,1.0)";
_ctrl ctrlCommit 0;
introWatchUnitCamera = "camera" camCreate (ASLtoAGL getPosASLVisual player);
introWatchUnitCamera cameraEffect ["Internal", "Back", "rtt1"];
If uncomment //[] execVM "Client\Player\fn_DisplayIntroPIP.sqf"; then camCommitPrepared 30 and all other action with _camera will not execute.
Other way, if i call [] execVM "Client\Player\fn_DisplayIntroPIP.sqf and then do _camera cameraEffect ["Internal","back"];: PIP become broken.
maybe try this:
_camera = "camera" camCreate [((getPosATL player) # 0) + _randomValue, ((getPosATL player) # 1)+_randomValue,
((getPosATL player) # 2) + 500];
_camera cameraEffect ["terminate","back"];
_camera cameraEffect ["Internal","back"];
_camera camSetTarget player;
_camera camPreparePos ([((getPosATL player) select 0) + 21,((getPosATL player) select 1) + 21,((getPosATL player) select 2)+ 25]);
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 30;
[] call Compile PreprocessFileLineNumbers "Client\Player\fn_DisplayIntroPIP.sqf";
_introWatchUnitDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";
_ctrl = _introWatchUnitDisplay ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [-0.25, 0.5, 0.75, 0.5];
_ctrl ctrlSetText "#(argb,1024,1024,1)r2t(rtt1,1.0)";
_ctrl ctrlCommit 0;
introWatchUnitCamera = "camera" camCreate (ASLtoAGL getPosASLVisual player);
introWatchUnitCamera cameraEffect ["terminate","back", "rtt1"];
introWatchUnitCamera cameraEffect ["Internal", "Back", "rtt1"];
You suggest to await while one camera end work then start camera two.
no
I need two cameras in one time.
that's what it does
where did I even put any "wait" command that makes you think so...?
Nowhere, i mistake
Thought that _camera camCommitPrepared 30; is the reason for waiting
Didn't help, same result.
what is the first camera even supposed to do?
@little raptor Show mission intro in whole screen.
First camera appears in the sky above player.
And fly to player in 30 seconds.
I can to send you mission archive, with camera broke example.
Another example:
_display = findDisplay 46 createDisplay "RscDisplayEmpty";
_ctrl = _display ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [-0.25, 0.5, 0.75, 0.5];
_ctrl ctrlSetText "#(argb,1024,1024,1)r2t(rtt1,1.0)";
_ctrl ctrlCommit 0;
_ctrl1 = _display ctrlCreate ["RscPicture", -1];
_ctrl1 ctrlSetPosition [0.5, 0, 0.75, 0.5];
_ctrl1 ctrlSetText "#(argb,1024,1024,1)r2t(rtt2,1.0)";
_ctrl1 ctrlCommit 0;
introWathUnitCamera = "camera" camCreate (ASLtoAGL getPosASLVisual man1);
introWathUnitCamera cameraEffect ["External", "Back", "rtt1"];
introWathUnitCamera1 = "camera" camCreate (ASLtoAGL getPosASLVisual player);
introWathUnitCamera1 cameraEffect ["External", "Back", "rtt2"];
Hey there. Does anyone know how to take a remote image (from a webserver), download it, and then able to display it as a texture? Would be very helpful. I've looked around and seen some extensions that would be a step, but not sure if anyone else has done it.
Is it possible so save the progress of a holdaction? So that next time the duration is shorter, or the amount of ticks is already filled?
You could save the progress yourself and add a shorter one
nice idea
looking at the function, _this select 3 set [20, <duration>] should change it, as the array is never copied
well yeah, extensions are the way to go, you can read more here: https://community.bistudio.com/wiki/Extensions
Yeah, I've seen the extensions, and looked around. maca134 did this, but don't think he released it. Was curious to see if someone else had already done this
I was thinking about using Killzone_Kid's URL Fetch extension, but I'd need to figure out how to store the image, and be able to use it as a texture
So I have to put that into codeStart?
it can be in any of the events
codeProgress probably, and adjust your duration there
it's completely up to you, but in the end you will probably have to use multiple ones, like for example, code progress > save current progress, code interrupt > adjust the duration to the saved progress, or whatever way you wanted initially
Ah okay π
What I could save via the codeProgress is the current progress and those are these ticks. But how can I get the elapsed time? π
1 tick = 1/24 of the action duration
ticks / 24 * duration will get you the elapsed
I've got it working now. Thanks π
Hey guys, I have setup a MP mission with tasks to train different aspects of the game, I was wondering if there is a way to give a task only to the player who is activating the trigger which starts the task?
I have setup an addAction like so
this addAction ["Kortlæsningsøvelser", {
kortlaesning_1 = true;
}];
With a trigger which then starts the task.
!isNil "kortlaesning_1"
Thanks in advance guys π
use the tasking framework functions instead
Okay, from what I can see, the task will be created local to the player who triggered it anyway π
Another question, when all the tasks have been completed I have been using BIS_fnc_deleteTask to delete the tasks again, my problem is I dont know how make them repeatable now.
Is there a way to figure out what an #ParticleSource is?
typeOf returns #ParticleSource
str _particleSource returns : id : < no shape >
I'm trying to figure out if the particle source is from a smoke projectile. (Smoke Launcher)
i don't think you can
just check if there is a smoke projectile near the particle source
Problem is, there is no projectile either, if you use the fired eventhandler, projectile is null.
yes, it's because they're scripted
Okay there is a near SmokeLauncherAmmo however, there is only one, tried deleting it no luck.
waitUntil
{
uiSleep 0.01;
_nearParticles = _this nearObjects ["#particlesource", 30];
!(_nearParticles isEqualTo [])
};
{
deleteVehicle _x;
} forEach _nearParticles;```
works like a charm though.
that ammo is shot by the tank
then there are SmokeShellVehicles created by a script
8 i think on vanilla tanks
don't remember now
ahhhhhhh, fuck yes that works
That deleted my flying shells π
I just used SmokeShell
Thanks Sharp.
yeah, though that is inherited by many smoke ammos(so you might delete unwanted ones), but i guess it doesn't matter in your case
Just trying to delete anything within a zone, tired of smoke everywhere lol
SM_Fired =
{
params ["_vehicle","_weapon"];
if (_weapon == "SmokeLauncher") then
{
deleteVehicle _projectile;
_vehicle spawn
{
private _nearParticles = _this nearObjects ["SmokeShell", 5];
{
deleteVehicle _x;
} forEach _nearParticles;
true
};
};
};
_vehicle removeAllEventHandlers "Fired";
_vehicle addEventHandler ["Fired", SM_Fired];```
still needed the spawn or it don't work at all.
Is there any way to let the game know when the establishing shot is done?
yes because they're created the next frame
I'm trying to make a trigger that only fires when 2 or more people are present
And this includes people in vehicles, which is what keeps a simple count from working
why not use https://community.bistudio.com/wiki/BIS_fnc_taskSetState instead of deleting them?
private _count = 0;
thisList findIf { _count = _count + count crew _x; _count >= 2 } != -1
something like that perhaps?
though that will bypass the trigger detection thing
actually nvm it shouldn't
that wouldn't do anything anyway
arma doesnt like your code
uhm wut?
what error?
that code is syntactically correct, so it's on your end
Because it does not hide them, I would like them to be hidden in the task menu, and even if I did use that, I does not make them repeatable :/
For some reason. setObjectScale doesnt work on my dedicated server
that's unfortunate.
Genuienly dont know why it wont work
can't know eitherβ¦
what I mean is: if you are looking for help, please state your issue, setup and attempt π
Fair enough. Care to elaborate on setup?
(it would be better in #arma3_scripting but)
according to https://community.bistudio.com/wiki/setObjectScale
object: must be either an attached object or a Simple Object
we are in scripting
β¦we are
Thank you for your help lou
I didnt read the wiki properly
the object wasnt attached
I have one more question. How can I implement that only ONE player can use a global hold action. So not several players can use the action at the same time. Only when the other has canceled.
is there any script or mod in the workshop that allows me to change the ace arsenal of an unit that is being controlled by someone?
when i try it it says that cannot edit dead unit or something
In the action's conditionshow I would have a check for a variable. And in the codeStart I would then fire said global variable so no one else can't see the action after someone starts the code. Obviously you would then want to reset the variable in the codeCompleted, codeInterrupted parameters.
That's how I have it too. However, the player performing the action no longer sees the holdaction progress while executing it
conditionShow: _target getVariable ['inUse', false] isEqualTo false;
codeStart: _target setVariable ["inUse", true, true];
codeInterrupted: _target setVariable ["inUse", false, true];
you can setVariable "userDoingTheAction'
this way if the object is null (e.g if the guy disconnects) others can do it
But that doesn't solve the problem. After changing the variable in codeStart to the user doing the action, the show condition is no longer fulfilled, because it isn't null. And this also applies to the player who is currently performing the action.
So as I said the hold action disappears π
Good evening. Do not tell if you can how to implement that bots began to pick up weapons from the ground or crates if he does not have it?
by having the object you can compare with isNull and != player
Oh okay I'll try that π
So I'm back nagging about extensions
I am having trouble using callExtension
the only return value I am getting is Call extension 'extDB3' could not be loaded: Den given module was not found.
(From RTP)
I have also tried with my own
CallExtension 'MyExtension11' could not be found
also fail
Any advice?
I have followed the instructions found here:
https://community.bistudio.com/wiki/Extensions
In your Arma 3 installation folder (for example: ..\arma3\yourextension.dll).```
where is your extension, what is its file name, etc etc
hello everyone, i am join here to ask where i can get my hands on the sqf to bytecode conversion tool? i could find any info on it. do anyone knows? thankx!
*couldn't
ups, my bad, i check here and find the information! thank you very much!
make sure you disable BE as that will block loading of the unwhitelisted dll
for what is worth, i had the same issue with extDB2, problem was memory about managers dlls. in extDB2 (and maybe in extDB3 too), the package you download comes with the memory manager dll (tbbmalloc_bi.dll) and (i think) msvcr100.dll.
you should use those to avoid this problem.
Hey, quick question just to see if anyone here has any solution. I found this composition on the workshop, to get flickering lights. (great for spooky scary stuff). It works wonderfully in SP, though once put on MP dedicated it no longer functions. You can see them trying to flicker, but its a very, very short like single frame, as opposed to the proper random couple seconds that the little script shows.
Here is the entire thing, pasted in the init of the light object. In my scenario, I am using the hanging camping lanterns.
if (isServer) then {
l4 = this spawn {
while {alive _this} do {
_this switchLight "OFF";
sleep (random 3);
_this switchLight "ON";
sleep (random 3);
};
};
};
l4 in this case is the variable name of the light. Any of you have any idea why it would just poop out any not function on dedicated server? I planned on using this for a segment in an upcoming mission, and while i've tested out everything else, this is the one aspect that isn't working and its kind of a bummer, because it really helps to create the atmosphere I was going for.
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
l4 in this case is the variable name of the light
that you replace with a script
also, switchLight has a local effect
https://community.bistudio.com/wiki/switchLight
you could run this on clients instead of server, using remoteExec.
if (isServer) then {
l4 = this spawn {
while {alive _this} do {
[_this,"OFF"] remoteExec ["switchLight", [0,-2] select isDedicated,_this];
sleep (random 3);
[_this,"ON"] remoteExec ["switchLight", [0,-2] select isDedicated,_this];
sleep (random 3);
};
};
};
Just remove isServer check and it is good to go. Looks like a code for init (assuming this variable) , so no need for remoteExec.
also remoteExecuting like that would be very costly network wise.
remoteExet is for sync. every client will have different on and off without it
why would u need sync on such thing.
because if this is for scaring people, some will be at light, and some at totally dark, it breaks immersion
thats the point of @dawn walrus
Unnecessary use case, imo
it will just be a blinking light that will go forever, just an ambient effect
not syncing it is an acceptable loss, I don't think it would be an "advantage" in any sort (especially if the mission is coop)
so, @crude vigil is the acceptable response
if there is an absolute need of sync, yours is (although select isDedicatedβ¦)
meh, select isdedicated is for special cases like hosting and playing at the same time, targets should be different.
creating the array and selecting by calling isDedicated is slower than remoteExec to everyone from the server, so it should be used for big chunks of code, not this
good point, ill keep it in mind
plus, light simulation may toy with server AI now that I think of it
Yeah in scenario of fighting , it is better to keep it synced
Thanks everyone, I would rather have it working and be slightly un-synced than it not working. Its a small price to pay, and ultimatley the effect is only going to be used in a few areas, where players likely won't be lingering for too long anyway so I don't expect anyone to notice any discrepancies really.
maybe...
sleep (serverTime random 3)
never try it, but it should give the same random time.
at least, for the first 300 sects
This is the original author's page on it, figured it would be faster posting a question here since he didn't reply to the last guy https://steamcommunity.com/sharedfiles/filedetails/?id=2583931954
I'll play around a little with some of your snippets, but will probably just use the simplest one.
Hmm, I remember from an old reddit post while searching for this effect, that lights/ lamps are turned off when above the 95% damage threshold. Would using a setDamage instead of switchLight have a more consistent effect? I'm envisioning basically having the script setting the light source's damage between 0 and 0.95, so that it is damaged enough to turn off the light, but not totally destroyed. Would that be more taxing to be running constantly?
it's better to have switchLight; damage syncs on the network, and it also makes the lamp weaker
it may sync faster and better than remoteExec though maybe
perhaps (I honestly don't know)
SO by synching, that would have the effect of all the lights being synched together for players though?
hopefully. You are at the mercy of engine :P
but is there a fight scenario?
or is it solely for ambiance?
lol as it always. Its the bane of existance, half the stuff I want to do, ends up being a bit too much for the engine to handle. Yes, but so far its only a couple zombies walking very narrow halls. So, 80% ambiance, as the players have gunlights.
if there are gun lights, chances are that they ll keep it opened, thus u re not dependent on functional aspect of light anyway.
so switchLight it is imo...
But honestly if you are not picky, just go with switchLight anyway, what are the chances that players will check if your light is synced? :P You know those people who like to find flaws. Well apart from those. ^^
The reason I heavily suggest switchLight because you are probably gonna be having many lights like this? All of these continuously remoteExecing is a huge network wise resource consumption.
That code is highly inefficient, it is the worst case performance wise that one can write, but it does the job for you..
Yeah I know like, one dude in my group that might notice, the others are just happy with pretty much anything as long as they get to shoot something.
Question is, do you really care? I would personally care and handle it considering my experience, but do you? Your mission, your choice.
I mean, I care, but I also care about the simplest little details. I'll go with the simple but working way, I'm not able to write my own scripts really beyond the most simple things, and I don't feel like fussing over it too much anyway, spent enough time head scratching and fixing other unrelated things.
@meager epoch people here are talking about your flickering lights comp. I thought you didn't change it to switchlight and kept it based on damage
you want something for lights Vulture? just use something like this...
private _buildings = nearestTerrainObjects [[worldSize / 2, worldSize / 2], [], worldSize * sqrt 2 / 2, false];
private _lamps = _buildings select {_x isKindOf "Lamps_base_F"};
lampsFlicker = [_lamps] spawn {
params ["_lamps"];
while {!(_lamps isEqualTo [])} do {
for "_i" from 1 to 5 do {
_lamps apply {
if (random 1 < 0.5) then {
_x switchLight "OFF"; //Or _x setDamage 0.9
} else {
_x switchLight "ON"; //Or _x setDamage 0
};
};
sleep (random 0.1);
_lamps apply {
_x switchLight "ON";
};
sleep (random 0.1);
};
sleep (random 3);
};
};
keep it local with this. if you want global or server exec, you can use setdamage to shut the light off and on globally as well instead of using switchlight
i think at like 0.9 damage the light shuts off or something like that
His code should be working fine and yours is just changing all lights. And I dont see any syncing done in here either.
if he uses setdamage instead of switchlight, i believe it will sync
it will, thats another thing. We already discussed it.
this spawn {
private _rsync = { random 3 };
if (isMultiplayer) then {
private _rsync = { serverTime random 3 };
waitUntil { round(call _rsync) % 2 == 0 };
};
while {alive _this} do {
_this switchLight "ON";
sleep call _rsync;
_this switchLight "OFF";
sleep call _rsync;
};
};
this will sync in MP and work in SP, without net code sent.
uses serverTime as random seed, so it will give the same random result to all clients.
at least, for the first 300 secs, as serverTime states it is valid.
Its sparked quite the discussion. But correct, I am only looking to affect certain lights, of which the base script was doing just fine. For context, these lights are placed inside of a narrow "underground" lab, basically just concrete walls with an over head concrete block placed as the ceiling, that have been placed on an airstrip thats had an area cleared out using the hide terrain module.
Don't you just love the smoke and mirrors needed to make things?
thats just arma. there are a billion ways to achieve the same effect, some better than others
Thats the truth, over the years its become very apparent, there is always ten ways to do something you want, but whether they are equally as viable or efficient is another matter.
i'll try that one Alez posted, been taking a break from starting at the editor screen.
Weird, I had a function that worked a little while back, now it's throwing a fit about a sleep in a while-do loop o.0
I will admit that a common method I use for various triggers, is to just place a franta soda can down, give it a name, and use a simple !alive can1 check on a trigger to then trigger other things. Its probably the worst way of doing things, but is also very low on brain power required.
post it
Hoo boy. I will if necessary, but it is a hot mess of a code.
if its long, use sqfbin.com
whats the fit its having?
Generic Error, rpt says 'suspending not allowed in this context'
hum, have some typos and errors, i corrected the function, it works as intended now
It's been calls, for instance
[Dragonfly,Inspect3Tgt,[300,350,2000],"RIGHT"] call SR_fnc_heliTour;
change that call to spawn
Weird, It worked before with Calls... I'll try.
if it had worked with calls before, I bet you did that in an already scheduled space such as init.sqf
Not always, but I can't recall when I last did without running it in an .sqf, true.
Where code starts scheduled
init.sqf
initServer.sqf
initPlayerLocal.sqf
initPlayerServer.sqf
functions with postInit attribute (although suspension is allowed, any long term suspension will halt the mission loading until suspension has finished)
code executed with spawn
code executed with execVM
code executed with exec
**code executed with call from a scheduled environment**
But that doesn't exactly fix it, because when the error first cropped up was when I was running it in an .sqf anyways.
Though it would explain why my freestyle bugtesting wasn't working right... hrn.
just try the spawn
Okay, spawn and call, executed from a .sqf, now don't crash the game.
However, it runs the loop once and quits :/
Wait, hold on, may be moron
Yup, just dumb, calling it on the wrong vehicle. Durr.
I mean, that didn't explain why it worked before and then didn't, but if all that takes is changing a few calls to spawns, I'll live with the mystery.
Alright, think it's resolved, I guess? Ugh.
Works great on the server, thanks. Also thanks for everyone who replied as well.
In the root folder for A3 where arma3.exe is located\steamapps\common\Arma 3
And also in the folder for the dedicated server```
\SteamCmd++\steamapps\common\Arma 3 Server@extDB3
The "Myextension" dll is located at
\SteamCmd++\steamapps\common\Arma 3 Server\
I did π€ I'll test again just in case I did it wrong
Ok, I don't want to waste your time, But could you explain the process exactly to deploy the extension?
@somber radish did you follow this? https://github.com/SteezCram/extDB3/wiki/Instalation
this is what i mean by the dll tbbmalloc.dll, it plays a role on extDB2 as well
I think I did, but I'll read it again and make sure
just copy the malloc library to the \dll\ folder in arma
tbbmalloc.dll
you need to make sure to use it at you start arma. set that in 'parameters' section of the launcher
you have the 'memory manager' option there, choose tbbmalloc
you should decide if you gonna use x64 or x32 arma
then select the plataform and memory manager accordingly
There we go!!!!
NICE! that is what I was missing. Thank you!
i had the same problem and i lost a lot of hours. extDB2 and extDB3 are always used in Exile, and this is a pain for first timers hosters. yw
Q: is it possible to know the vehicle positions available to a vehicle from the class name only?
where do you think the game gets them from? 
well, fullCrew works with an OBJECT, doesn't it? I was wondering if it was otherwise possible to identify them given a class name only, i.e. not create the object.
do you want positions? or number, cause number you can use:
https://community.bistudio.com/wiki/BIS_fnc_crewCount
where do you think fullCrew gets it from? 
params [["_class", -1], ["_inclCargo", false]];
/// --- validate input
#include "..\paramsCheck.inc"
paramsCheck(_class,isEqualType,"")
private _cfg = configFile >> "CfgVehicles" >> _class;
private _turrets = 0;
if (_inclCargo isEqualTo true) exitWith
{
private _fnc_turretsFFV =
{
{
_turrets = _turrets + 1;
if (isClass (_x >> "Turrets")) then {_x call _fnc_turretsFFV};
}
forEach ("true" configClasses (_this >> "Turrets"));
};
_cfg call _fnc_turretsFFV;
getNumber (_cfg >> "hasDriver") + // driver
getNumber (_cfg >> "transportSoldier") + // all cargo positions
_turrets // all turrets including FFV
};
private _fnc_turrets =
{
{
if !(getNumber (_x >> "showAsCargo") > 0) then {_turrets = _turrets + 1};
if (isClass (_x >> "Turrets")) then {_x call _fnc_turrets};
}
forEach ("true" configClasses (_this >> "Turrets"));
};
_cfg call _fnc_turrets;
getNumber (_cfg >> "hasDriver") + // driver
_turrets // default turrets
this is how BIS_fnc_crewCount does it, take a look at its config grabbers
oh nice, thank you. could iterate all that and form a response without having to create the object. huge time saver.
Q: then, commander|gunner|turret how does that align with 'turrets' (?)
https://www.youtube.com/watch?v=k3ZhcJiyaHE
Anyone know how such an overlay could be achieved?
what overlay? its a 21 min vid
you can create your own config value for each icon (RscTitles) then use cutRsc to create and fade out those images
Keep in mind I am near brand new to scripting, so a more idiot proof response would we appreciated :3
You are in for quite the ride for a newbie to be using GUI editing this early...
https://community.bistudio.com/wiki/GUI_Tutorial
https://community.bistudio.com/wiki/Arma:_GUI_Configuration
https://community.bistudio.com/wiki/cutRsc
okay I think I see. after some tinkering, I end up with this report on the turrets.
[2,["MainTurret","CommanderOptics"]]
I do need to know, however; how to interpret such a turrets array. The first turret is the gunner, proper? The second, third, etc, are what? Second is always a commander? Third, fourth, etc?
first, use this https://community.bistudio.com/wiki/BIS_fnc_allTurrets
its order is gunner, commander, fire-from-vehicle
How does that also gain me the drivers, cargo (i.e. passengers), etc? I need to know all the positions.
I am trying to gauge if a vehicle class is unarmed that is does not have a gunner, per se, and supports _
_, i.e. cargo.
I could go with fullCrew, that's not impossible to do, but the draw back is, first time through must create the object.
I can stow the result in a HASHMAP after that, it's just that first aspect I'd like to avoid.
private _class = "B_APC_Wheeled_01_cannon_F";
private _cfg = configFile >> "CfgVehicles" >> _class;
private _hasWeapon = count (_class call BIS_fnc_allTurrets) > 0;
private _hasCargo = getNumber (_cfg >> "transportSoldier") > 0;
//Return
[_hasWeapon, _hasCargo];
@dreamy kestrel
thats on the list of things categorized as "very high time sink, very little appreciation from players". do stuff like that after you've learned to get your game functional
thank y'all for the feedback. I think I have an approach now.
Stuff that takes a low amount of time you can learn
Teleporters
Parachute script on respawn
Random weathers
Death cries/sounds
Animated map briefings
A jukebox
Etc
It is achieved with dynamicText function, no UI scripting is necessary. No any "high time sink scripting" is required..
For more information:
https://community.bistudio.com/wiki/BIS_fnc_dynamicText (you may also want to check other functions related to that, just search Text within function list on BIKI)
https://community.bistudio.com/wiki/Structured_Text to exactly understand what to input as text. (Such as including an image)
Hey guys, me again, trying to setup a task via the TaskFramework instead of the modules after quite a few recomendations to do so from here. So far it is going fine, but I cannot seem to setup a trigger to succed the task.
Here is what I have got;
kortleasning.sqf
[west,["KLR2","KLR1"],["KortlΓ¦sning 1.1", "GΓ₯ til koordinat 090049"],objNull, "ASSIGNED", 1, true, "MAP"] call BIS_fnc_taskCreate;
KLRT1 = createTrigger ["NONE",[905.385,490.606]];
KLRT1 setTriggerArea [10, 10, 0, true];
KLRT1 setTriggerActivation ["ANYPLAYER", "PRESENT", true];
KLRT1 setTriggerStatements ["this", "hint 'Korrekt kortlæsning, bevæg dig til xxxyyy'", "hint 'no civilian near'"];
if (triggerActivated KLRT1) then {
["BIS_task_01","SUCCEEDED"] call BIS_fnc_taskSetState;
};```
I have a screen with an addAction in game to trigger this script, which works fine, as the task is assigned.
I have checked the location of the trigger x100 and it should be correct.
Should I just stick to using the triggers in game or are the better advantages of using the scripted instead?
if (triggerActivated KLRT1) then {
this is checked once obviously
so your task will never complete
you should instead put it in trigger completion statement
[west,
aren't you the guy that wanted the task to show to a specific player only?
Yes, but as I understand the way the task system is setup, the task will only be created locally to the player who executed the script, so I does not matter?
I feel you getting tired from my ignorance π
no
it's global, and you're adding the task to all west units
My bad for misunderstanding a section of the taskframework, which stated the createSimpleTask is purely local
createSimpleTask is
[....] And thatβs why the task framework was created in the first place - to provide comfortable but still powerful tool for synchronized task creation and management in MP scenarios.
Doing my best here,
KLRT1 setTriggerStatements ["this", "[BIS_task_01, 'SUCCEEDED'] call BIS_fnc_taskSetState]";
If I understand you correctly?
sorta
but it's incorrect
if you just use syntax highlighting you'll see
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
do you see now?
Sadly not :/
didn't you notice that their colors are messed up?
it should've been all green
(because they were all supposed to be in a string)
so anyway, the reason that happens is that you're trying to put " inside a string that is wrapped with ""
but " closes a string... 
to fix this you have 3 options:
a. use "" when you want to put it inside a string:
"[BIS_task_01, ""SUCCEEDED""] ..."
b. use ' instead:
"[BIS_task_01, 'SUCCEEDED'] ..."
c. wrap the string with '':
'[BIS_task_01, "SUCCEEDED"] ...'
you also have another mistake, but I'll let you figure it out yourself
Is setBleedingRemaining a local command? Wiki doesn't say but doesn't feel like it's applying from server-side script.
does it even work? 
In singleplayer tests yes lol
my guess is that it's local 
but when you don't know your only options are either to test, or just remoteExec to everyone 
Ew testing π€’
Yeah just confirmed it works with 0.1 or more damage in SP, I'll just remoteExec it
Okay so:
KLRT1 setTriggerStatements ["this", "[KLR2, ""SUCCEEDED""] call BIS_fnc_taskSetState]";
Or
KLRT1 setTriggerStatements ["this", "[KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState]";
both solve your string problem. you can pick whichever you want
but there are still 2 problems left
actually 3...
Well sh*t
just pay attention to your brackets...
basic math: the number of opened brackets must be the same as number of closed ones... 
wait they are... π€£
but anyway you get the idea
If the idea is something is wrong with my brackets then yea'. So far I am (hopefully) able to count to four π
the idea is that you must close the bracket that you opened... (and vice versa) 
you have 2 problems in that category rn
I am clearly not getting something
Can't upload pics, but I dont see any "lonely" brackets
I thought the first one was closed by the last
the last one is in a string...
it's in a "different region"
[(])
kinda similar to the situation you got here
in your case you could've just payed attention to the colors...
the first one was white, but the last one was green...
basically, previously you wrote this:
private _statement = "[KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState]";
KLRT1 setTriggerStatements ["this", _statement;
but you want this:
private _statement = "[KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState";
KLRT1 setTriggerStatements ["this", _statement];
which now brings us to the 3rd problem... 
That kitty sure sweats a lot
KLRT1 setTriggerStatements [KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState";
So here we are, at the third problem, can I get a hint?
yet another hint*
waaat? why did you change it like this? 
Vdauphin did it, I am innocent
Look closely to what Leopard told you
anyway since I guess this is gonna take forever this is what you should've done:
KLRT1 setTriggerStatements ["this", "[BIS_task_01, 'SUCCEEDED'] call BIS_fnc_taskSetState", ""];
your 3rd problem was that setTriggerStatements also needs a triggerDeactivated statement as well
Thanks, I had wondered about it.. Thanks for your patience/trying, I appreciate it.. Sorry if you feel I wasted your time
So the first bracket did not get closed, because of the missing deactivation?
no because you just didn't have any ]
even this "closes" it:
KLRT1 setTriggerStatements [];
if you don't close it you get a parsing error
which means it won't even compile
now it does compile
but throws an error at runtime (probably something like 0 arguments provided, 3 expected)
@plucky hornet anyway the takeaway from this experience is that everything you see in programming has especial significance and you should pay close attention to them. Some examples in SQF:
"" and '' create a string
[] creates an array
{} creates a code
() is just parentheses and are used for evaluating something sooner (changing order of precedence)
e.g.:
1 + 2 * 3 //1 + 6, gives 7
but:
(1 + 2) * 3 //3 * 3, gives 9
I think I need to find (even) more guides online to get a better basic knowledge as well
Nah, I did change it to switchLight
Are you ok with me posting that code on the composition page, so that people who experience the same issue can fix it and stuff?
what is this nonsense?!
my flickering lights code goes nuts to butts in MP and this is somewhat of a fix which apparently works
^
I know but the code itself is nonsense
Gets the job done i guess 
if you simply removed isServer from your code it would "get the job done too"
my problem is with the syncing approach
slight problem, the task is not getting completed upon entering the trigger area, I have been looking over the BI wiki several times and what we talked about but cant seem to figure out why :/
[west,"KLR1",["Kortlæsning 1", "Kortlæsning kursus 1"],objNull, "CREATED", 1, true, "MAP"] call BIS_fnc_taskCreate ;
[west,["KLR2","KLR1"],["KortlΓ¦sning 1.1", "GΓ₯ til koordinat 090049"],[905.385,490.606,2], "ASSIGNED", 1, true, "MAP",true] call BIS_fnc_taskCreate;
KLRT1 = createTrigger ["EmptyDetector",[905.385,490.606,0]];
KLRT1 setTriggerArea [10, 10, 10, true, -1];
KLRT1 setTriggerActivation ["ANY", "PRESENT", true];
KLRT1 setTriggerStatements ["this", "['KLR2', 'SUCCEEDED'] call BIS_fnc_taskSetState", ""];
shouldn't KLR2 be 'KLR2'?
createTrigger ["NONE"?
Is there something like that at all? Isnt it "EmptyDetector"?
Oh snap, thanks, gonna try that out
@plucky hornet Dont forget this ^ he means it for last line.
Thanks boys and/or girls
Just use setDamage
And it should sync
so check out the mapAnimAdd commands and such
https://community.bistudio.com/wiki/Category:Command_Group:_Map
I was tempted to suggest this but I wasn't sure since I didn't know how many structured text tags specifically the img tag would work in it. Nice to know you can.
Does anyone have an(y) idea why this diary record isn't showing the button [Join Platoon]-button?
_diaryRecord = player createDiaryRecord ["Diary", ["Command structure", ""]];
_diaryRecordText = "<font color='#b5f862'>1st Platoon, A Company</font> <execute expression=''[player,B_Player_A_1_1,'Join'] call BIS_fnc_dynamicPlatoons''>Join Platoon</execute> (Lt. Genius Play Unique)<br />";
player setDiaryRecordText [["Diary", _diaryRecord], ["Command structure", _diaryRecordText]];
It just shows
1st Platoon, A Company
player createDiaryRecord ["Diary", ["Execution", "<font color='#A52A2A'>1st Platoon, A Company</font><br/><execute expression=""[player, B_Player_A_1_1, 'Join'] call BIS_fnc_dynamicPlatoons;"">Join Platoon</execute>"], taskNull, "", true];
Does the diary record need to be named execution?!
Nope, my bad
But apart from that and the taskNull, "", true-part it's exactly the same, isn't it?
I replaced '' with "" if you look closely
So you think that's the issue?
It was yes
Ok, fair enough.
is there a command to change a group's side during the mission
Can I also change this globally? This changes the duration of the hold action for the client. But I would like to shorten the time for all players π
joinSilent
yes, but its tricky, you'd have to save the action id for each client, and then use https://community.bistudio.com/wiki/actionParams
And what if I created the holdaction like this?
[ ... ] remoteExec ["BIS_fnc_holdActionAdd", 0, _chest];
Then it is not listed in the actionIDs.
no, that approach wouldn't work
you discard the id that way, you need to make a function wrapper, that adds the action, and saves the id
So it's easier, without remoteexec, to create holdaction locally for each player?
to create holdaction locally for each player?
you are already doing that
and you will have to still use remoteExec
Oh π
Can you maybe help me a little bit there? I have never used a function wrapper before π¬
make a function that adds a holdaction, and saves it via https://community.bistudio.com/wiki/setVariable
then make another one, that retrieves that variable from an object, calls https://community.bistudio.com/wiki/actionParams and sets the duration, via the same _arguments set [20, _duration]
And how exactly I save the holdaction with setVariable?
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd returns the action id
store it into object's(the one you're adding the action to) namespace with setVariable
Ahhh yes I forgot about the return value there.
_actionID = [
...
] remoteExec ["BIS_fnc_holdActionAdd", 0, _object];
_object setVariable ["actionID", _actionID, true];
The second function:
params [
["_object", objNull, [objNull]],
["_duration", 0, [0]]
];
_actionID = _object getVariable "actionID";
_arguments = _object actionParams _actionID;
_arguments select 2 set [20, _duration];
Is that all?
the second one is somewhat ok and might work
but the first one doesn't make sense
_actionID = [
...
] remoteExec ["BIS_fnc_holdActionAdd", 0, _object];
you're not getting an _actionId here, you're getting the return value of remoteExec which you can see here: https://community.bistudio.com/wiki/remoteExec
Return Value:
nil - In case of error.
String - In case of success.
you need to make your own action add function, and remote exec that instead
Thanks I will do that π
Thanks a lot. It works now.
Do you happen to know whether I can use variables in that expression like e.g. _x from a forEach-loop?
When the hold action is interrupted, I call the second function. I guess also via RemoteExec?
Well, it works in singleplayer. I'll test it later in multiplayer.
yes you have to remoteExec everything if you want the changes to apply on all pcs
Evening fellas, please is there a way I can make AI aircraft stick to a certain "area" and not cross half the map to engage targets.
Because in doing so they end up getting shot by AA. In effect what I want is for them to only engage targets defensively, that is targets within a certain area or any targets that are engaging them.
that's not how the AI works by default though. Its always going to detect enemies, switch to combat, and begin attack/defense. what you would have to do is write your own script that modifies the behavior. Start by disabling the AI categories that do with targeting, then you will manually target for the aircraft when an enemy comes inside the zone you want.
@potent dirge Could create a trigger to act as a LOA; basically have the trigger tell the pilot to move away and change behavior + hold fire so they break contact more reliably when/where you want them to. Just an idea.
Thank you both for your suggestions, the LOA trigger seems like it would give me the best possible behaviour
I'm trying to add an icon to a unit but idk how the file path works for it
_grp addGroupIcon ["a3\modules_f_curator\data\portraitanimals_ca.paa", [0, 0]];
Wiki already explains
https://community.bistudio.com/wiki/addGroupIcon
It's not a path
I'd looked at that but still couldn't get it to work...
Did you enable icon visibility?
Got an error prob because Iβm confused on what to put in
Just read the wiki 
Also you must switch to high command to see group icons (afaik)
Is there a quick way of taking an array of strings, and assigning each one to a variable?
If you mean global variables, yes, see setVariable
Hrn, I'd still have to do array select x for each one, I believe?
or just use forEach 
but if you wanted local variables you could've just used params
Nah, they'd have to be global. ForEach would at least go through the array, but I'm blanking on how to assign them unique variable names.
My mission was getting really wordy, and it was eating up a (relative) ton of space to write out each playSubtitles spawning.
At the same time, I wanted to have a way of logging into the diary the conversations, but that would require going through and taking each line of dialog out and plugging it into a createDiary copy-paste, which would have just ballooned the scripts further.
So I opted instead to go for a more streamlined approach, turning both the subtitles and the logging scripts into functions, and reducing the ungainly block of text into an array of arrays, [[chatColor,whoIsSpeaking,whatTheySay,timeSinceLastMessage],[ad nauseum]]
This works after much testing, but my test model is built around creating an array of names and the lines of dialog - the chat colors were already defined in my initialization files.
But this leaves me with the chunky line
[chatCommand,chatNames select 4,chatArray select 0,0]
And I want to tighten it up.
My plan is to create an array of every speaking role, and/or assign the string of speaking roles to variables, and just write the dialog into place, such:
[chatVehicle,chSgtRavai,"Not the TIME, Chao!",6]
I already define a metric wide load of variables in my initServer.sqf, so I'm not concerned with defining more, but wasn't sure if I'd need an array of speaking roles for anything, so wanted to find a way to do both without getting all 'chatNames select'y
Well I didn't quite understand that, but I'm pretty sure your approach is still bad
But anyway, give me an example of this
Sure.
Missed a ; shy of running it as a .sqf on it's own, but you could also input each block on it's own I guess.
- Why do you use so many useless global variables?

- I don't see how defining global variables instead of "chatNames select" can help you in anyway with that
-
it's still in testing and I needed to monitor the steps
-
while chatnames select 0 is easy to process, it's not easy to read.
Are you able to block addon functions via any script commands or through the Description.ext somehow?
- and what do you intend to put there instead?
A variable that is defined at mission start, eg
chSgtRavai = "DRAGONFLY 3-1: SGT. RAVAI";
and then just inputting their line of dialog, rather than calling from an array - much less likely I'll need to reference an array of dialog than the names, and keeping them 'in order' will help with readback and corrections.
use macros
Ooh, that might just do, I'll have to dig into it.
there's no way to enable dynamic simulation on a created unit during mission correct? because enableDynamicSimulation states that it only is for a given non AI object.
i think you're supposed to use it on a group
add AI to group -> enable dynamic simulation on group
oh okay gotcha
I have this in the init of a playable unit
this addItem "ACE_Vector";
for some reason this gets executed every time a new player joins the server
Init is executed for every client + server
oh so everytime anyone inits that unit?
yes
if (!isServer) exitWith {};
this addItem "ACE_Vector";
or
if (!local this) exitWith {};
this addItem "ACE_Vector";
and because addItem has global effect it will keep adding away...
couldn't I also just do
if (local this) then {this addItem "ACE_Vector";}
or is that considered bad practice? edit fixed then
missing then
It's the same, I prefer to reduce code nesting to improve readability.
okay, thanks!
In programming this practice is called "Early return". You can find a lot of articles about it and then you can make your own conclusions as to when to use it or not.
Personally it really depends on context. If it's literally only a single line, it's typically more readable to keep it inside of the if.
If there's more and there's deeper nesting of control structures (if/for), then you typically go for an early return.
programming != scripting
what may be considered "good practice" in programming may not be so in scripting (and vice versa)
https://www.google.com/search?client=firefox-b-d&q=programming+vs+scripting gives plenty of examples
well off the top of my head:
a compiled C/C++ code like this
if (blabla)
return 1;
return 2;
vs
if (blabla)
return 1;
else
return 2;
will be identical. so no performance diff
but:
if (blabla) then {
1
} else {
2
}
if (blabla) exitWith {
1
};
2;
are not the same thing
ah i see
another example might be this:
std::find_if(arr.begin(), arr.end(), [](const auto& item) {return item == 1;})
//vs
std::find(arr.begin(), arr.end(), 1)
both will probably give the same performance (might need compiler optimizations; not sure
)
but:
arr findIf {_x == 1};
//vs
arr find 1;
the performance diff is night and day
Hello!
I wonder if someone could help me with this one:
I am trying to make some TCP guards be suspicious about players passing through with this script, but Im getting errors:
I'm intending for this to be MP as well.
_Supsicious = floor (random 100);
if (_Supicious < 50) then
{
_group = createGroup WEST;{[_x] joinSilent _group} forEach units (group player1);
Hint "Player is compromized";
};
what error?
also use syntax highlighting:
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Are public variables not guaranteed to arrive in the same order they were sent? Had a situation where it could've been a case. Any insight?
ok so what error are you getting?
also you could just write:
units group player1 joinSilent _group;
afaik remoteExec and other sent data are queued... 
Wait π .. Jesus.. Typo ..
_Supsicious _Supicious 
Sorry about that - but question still stands.. how to make this work MP?
Can you run it like this?
I'm not sure what that code is supposed to do...
but the code itself has no MP problem
(except hint)
read this if you haven't already:
https://community.bistudio.com/wiki/Multiplayer_Scripting
@little raptor
I am wanting the guards in traffic control points to become suspicious about players passing through it with a chance of becoming hostile ... I will add more conditions once I get the basics - but for now there is a random chance.
so the "guards in traffic control points" are on EAST side then?
and the reason you're joining them to WEST is to make them hostile to the guards?
They are indipendent for now - I am using this in the "vindicta" gamemode just to make it more interesting
THey never react to players if getting close
what is the default side then? civ?
Players are civ when in cars or in civilian clothing
As for now the government forces never react to close proximity
so why don't you just use setCaptive?
So I want to script a function for that
Well kinda new.. So I am trying to figure stuff out really - with your help hopefully β€οΈ
I could try.. any suggestion on how?
use _unit setCaptive true when they're not "compromised"
and when they are use _unit setCaptive false
In vindicta I think civilians are setcaptive true maybe when they are without weapons and in vehicles..
But thanks for your help!! - I'll look into it.
If anyone has a suggestion for a small script on how to do this - would be appreciated.
Otherwise I'll find my way around!
well don't know of any premade ones. but if you have any questions about the one you're making feel free to ask here.
Got a question about CuratorObjectRegistered Event Handler
Wiki says
Triggered when player enters curator interface. Assign curator cost to every object in the game. This is the primary method that a mission designer can use to limit the objects a curator can place.
Which confuses me, does it fire whenever zeus places something down or does it fire whenever the local players enters the zeus interface?
Triggered when player enters curator interface
Yeah, but "This is the primary method that a mission designer can use to limit the objects a curator can place." makes it sound like its object specific?
what it means is that you can give object types a certain cost
curator cannot place an object if its cost is too high
does it fire whenever zeus places something down
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CuratorObjectPlaced that does it
I might have gotten confused in semantics
https://community.bistudio.com/wiki/Arma_3:_Curator#Assigning that's what the registered one is used for
yeah I'm reading that rn, thanks π
I'm trying to a log output whenever I enter the zeus interface.
player addEventHandler ["CuratorObjectRegistered", {
diag_log format ["Hello, %1!", name player];
}];
executed locally through debug console does nothing.
(editor, host local multiplayer, spawn in, execute code, enter zeus interface)
any pointers as to why?
I've looked at the wiki examples in addEventHandler to get something working but I feel like I'm missing sth
you are supposed to add the curator event handlers to the curator module
I've added it to the init of of the game master module, still no luck.
just opened the game and tested, works ok
did you use the vanilla zeus module or the one from ace?
lets just pretend I never said that, I added it to the vanilla module π
is it possible to have a do - while as opposed to a while - do?
cause i need the code to run at least once
Hello, i am trying to make a module in a scenario. It doesn't seem to work so i think i'm mission something. I try to just follow the wiki and copy past the examples to get a working module but it's just not showing up. https://community.bistudio.com/wiki/Modules
waitUntil? π
does not work in unscheduled tho.
are the loadout arrays from setUnitLoadout compatible with CfgRespawnInventory classes?
another question, can i forcefully exit from an EH when a certain condition is met (without deleting the EH)?
So modules have to be created as addons right ?
yep
Hey I am still working on my TCP script here:
But for some reason I cannot use the sleep command anywhere to slow down the loop.
Any idea how and where i can slow down the loop?
It also returns _checks = 0.. I guess it goes through all 5 checks in a millisecond..
_distance = player1 distance bargate;
_checks = 5;
while {_checks > 0} do
{
_suspicious = floor (random 100)+_distance;
_checks = _checks - 1;
hint format["The guards have checked you %1 times",_checks];
Sleep 2;
hint format["Your detection chance is %1",_suspicious];
Hint "Guards are not suspicious";
Sleep 5;
If (_suspicious < 30)then
{
_group = createGroup WEST;{[_x] joinSilent _group} forEach units (group player1);
Hint "You have been comprimized!";
} else {
};
};
you can't suspend in unscheduled environment
I don't know what to do with this info at this level of competance...
Apparently using sleep in a while loop is not possible. I presume you want to use spawn instead of a while loop, but I no idea how.
EDIT: Just realized you can use sleep within a while loop - but apparently not when i nest it with IF /then/else..
no the if then else should have nothing to do with it. scheduled scripts do not allow the commands waitUntil, sleep, uiSleep to suspend/halt the script. For those commands to work you have to execute your script in a scheduled environment with execVM, spawn
Aha .. but that's what I am doing ... Wait.. I used the Arma Local execution bug fixer function... to check if it worked..
The script is run from a execVM
I just tested the code you posted and it works
well modified a little bit as I don't have your variables but general syntax is functional
@distant oyster Thanks!
I got this down - and it's working:
Would be nice to see your version as well !
[] spawn {
private _checks = 5;
while {_checks > 0} do {
private _distance = player1 distance bargate;
private _suspicious = random 100 + _distance;
hint format["The guards have checked you %1 times", _checks];
_checks = _checks - 1;
sleep 2;
hint format ["Your detection chance is %1", _suspicious];
if (_suspicious < 30) exitWith {
private _group = createGroup WEST;
{[_x] joinSilent _group} forEach units (group player1);
hint "You have been comprimised!";
};
sleep 5;
hint "Guards are not suspicious";
};
};
as i said, just the global variables:
_distance = player distance cursorObject;
_checks = 5;
while {_checks > 0} do
{
_suspicious = floor (random 100)+_distance;
_checks = _checks - 1;
hint format["The guards have checked you %1 times",_checks];
Sleep 2;
hint format["Your detection chance is %1",_suspicious];
Hint "Guards are not suspicious";
Sleep 5;
If (_suspicious < 30)then
{
_group = createGroup WEST;
{[_x] joinSilent _group} forEach units (group player);
Hint "You have been comprimized!";
} else {
};
};
};
no wait
now
and executed with @little raptor 's Advanced Developer Tools Debug Console (Run scheduled) which uses spawn I suppose
coming back to a script I was trying to get working last week, it needs to continuously spawn objectives capping at 3 active, no idea why it's not working or where to go from here
TaskSpawner.sqf:
if (!isServer) exitWith {};
taskCounter = 0;
publicVariable "taskCounter";
ts_patrol_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_patrol_fnc.sqf";
ts_banditcamp_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_banditcamp_fnc.sqf";
private _taskTypes = [ts_patrol_fnc, ts_banditcamp_fnc];
while { true } do {
if ( count taskCounter < 4 ) then {
[] spawn ( selectRandom _taskTypes );
} else {
sleep 30;
};
};```
ts_patrol_fnc,sqf:
private _ObjectiveMrk = ["marker_1", "marker_2", "marker_3", "marker_4", "marker_5", "marker_6", "marker_7", "marker_8", "marker_9", "marker_10", "marker_11", "marker_12", "marker_13", "marker_14", "marker_15", "marker_16", "marker_17"] call BIS_fnc_selectRandom;
[west, "task", ["We've detected a CSAT recon element in the marked area - track them down and eliminate them. Reward: $750", "($750) CSAT Patrol"], _ObjectiveMrk ,1, 2, true] call BIS_fnc_taskCreate;
_grp = [getMarkerPos _ObjectiveMrk, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons")] call BIS_fnc_spawnGroup;
[_grp, getMarkerPos _ObjectiveMrk, 150] call BIS_fnc_taskPatrol;
_ObjectiveMrk setMarkerColor "ColorOPFOR";
_ObjectiveMrk setMarkerText "CSAT";
taskCounter = taskCounter + 1;
publicVariable "taskCounter";
while {{ alive _x } count (units _grp) > 0} do
{
waitUntil {{ alive _x } count (units _grp) == 0};
["task","Succeeded"] call BIS_fnc_taskSetState;
[750,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false];
_ObjectiveMrk setMarkerColor "ColorUnknown";
_ObjectiveMrk setMarkerText "";
["task"] call BIS_fnc_deleteTask;
taskCounter = taskCounter - 1;
publicVariable "taskCounter";
"PATROL"
};
Why is it impossible to lock out the copilot seat in a helicopter?
player addEventhandler ["SeatSwitchedMan", {
params ["_unit", "", "_vehicle"];
private _pilot = driver _vehicle;
private _gunner = gunner _vehicle;
private _copilot = _vehicle turretUnit [0];
if (_vehicle isKindOf "Air" && {
!(_vehicle isKindOf "ParachuteBase") && {
if (_unit in [_pilot, _gunner, _copilot]) && {
!((_this # 1) getVariable ['isPilot',false])}
}
}) then {
moveOut _unit;
};
}];
This code is not working. I am trying this with an RHS Mi-8 chopper and it never works. Should I just spawn an invincible AI in the seat instead?
so what do I use to just run the scripts instead of spawning the return of those functions
i just need them to run the scripts and update the Counter variable when the objective is finished so the loop can spawn a new one
because your code is all wrong
Quick question for anyone who may know of the top of their head; onMouseButtonDown UI EVH, is the LMB 0 and RMB 1 for the _button param
yes
ty π
you can just put a systemChat 
Saves me even opening arma π€£
Just getting started in scripting been toying around a little bit with some stuff. I can't get much to work so far.
private _bomb = xbomb
_bomb addAction ["<t color='#FF0000'>Defuse bomb</t>", {}];
I've put the var name in the item I want to addAction to be xbomb
- missing semicolon in the first line
- just use xbomb directly:
xbomb addAction ["<t color='#FF0000'>Defuse bomb</t>", {}];
I knew it was something simple. π€£ My bad. Been playing around scripts all night
Thanks
no worries, we all started somewhere π
I tried rewriting this stupid script, i'm still getting this fucking "_taskCounter is undefined" bullshit even though it's clearly defined, why is this not working no matter what I try
if (!isServer) exitWith {};
private _taskCounter = 0;
_ts_patrol_fnc = execVM "TS\ts_patrol_fnc.sqf";
_ts_banditcamp_fnc = execVM "TS\ts_banditcamp_fnc.sqf";
private _taskTypes = [_ts_patrol_fnc, _ts_banditcamp_fnc];
while { true } do {
if ( _taskCounter < 4 ) then {
[] spawn {
_taskCounter = _taskCounter + 1;
selectRandom _taskTypes;
waitUntil { scriptDone _taskTypes };
_taskCounter = _taskCounter - 1;
};
} else {
sleep 30;
};
};```
spawn opens a new scope. all local variables are unknown there.
so i need a global variable?
easier. you pass it as a parameter
example please ;_;
[_taskCounter, _taskTypes] spawn {
params ["_taskCounter", "_taskTypes"];
...
also
selectRandom _taskTypes;
waitUntil { scriptDone _taskTypes };
``` doesn't make sense. you are not using the output from taskTypes and try to use scriptDone on an array
yeah i know but i was gonna tackle that after this, ive already been struggling with this shit for a week straight lol
the changes to _taskCounter are also not propagated to the upper scope, so that should be a global variable
are there bis functions that show a structured text hint? since you can't remoteExec structured text hints
I think I got it running, tyvm, on to more problems but its a step in the right direction
all you had to do is remove two words from the previous code you sent
"Debugging is like being the detective in a crime movie where you are also the murderer." - Filipe Fortes
it's still only spawning 2 objectives no matter how high I set the "taskCounter < #" line >_>
yes because your code is wrong
and it's only spawning one task/group of enemies, I'm assuming it has to do with the TaskID being overwritten every time it's looped and makes a new task, how do you generate new tasks with a new taskID?
SAY HOW LOL
saying "its wrong" isn't helping, obviously it's wrong, I'm asking why is it wrong and what is the proper way to write it ;_;
i told you the issue already, and even pasted you the message link from the previous time
i rewrote it to just use execVM like so ```sqf
if (!isServer) exitWith {};
taskCounter = 0;
publicVariable "taskCounter";
_ts_patrol_fnc = execVM "TS\ts_patrol_fnc.sqf";
_ts_banditcamp_fnc = execVM "TS\ts_banditcamp_fnc.sqf";
private _taskTypes = [_ts_patrol_fnc, _ts_banditcamp_fnc];
while { true } do {
if ( taskCounter < 4 ) then {
[_taskTypes] spawn {
params ["_taskTypes"];
taskCounter = taskCounter + 1;
selectRandom _taskTypes;
};
} else {
sleep 30;
};
};```
sorry if i'm being a dick, this has been making me pull my hair out for like 8 days
i assumed what you said before meant I shouldn't use the "preprocessFileLineNumbers" lines because they were just using the return of those functions
so i tried to rewrite it to simply run the scripts and update the counter
no, you shouldn't have called the functions
you need to store the compiled code, and then reuse it later
otherwise you discard the result, and lose the reference to it
ok, thanks for the explanation
Q: re: drawing shapes on a map... how is it I can connect some 'shape arguments' with a draw request? seems like maybe that is more bookkeeping that I must do (?)
_map ctrlAddEventHandler ["draw", {...}];
use an array
yeah, thinking that, or a HASHMAP, i.e. given named shapes and so forth
Can you show a custom screen when using startLoadingScreen?
Q: does {...} count _hashMap provide _y?
so that little bit of bookkeeping done via HASHMAP works pretty well.
about the only adjustment I could think of making is to order the shapes in a Z order if that is important.
otherwise works great.
allMissionObjects "EmptyDetector" - only returns scripted triggers. how to get editor placed ones?
works for me 
maybe they're of different type?
if so try this:
allMissionObjects "" select {isClass (configFile >> "CfgNonAIVehicles" >> typeOf _x)}
or even better:
allMissionObjects "" select {getText (configOf _x >> "simulation") == "detector"}
hm works only for the scripted too
ok seems the "guarded by" are not considered normal triggers..
wanted to test if you can move their position (editor placed or scripted)
but apparently doesnt work..
what does configOf testTrigger2 return in the mission?
testTrigger and testTrigger2 are seen as not defined
for the scripted its bin\config.bin/CfgNonAIVehicles/EmptyDetector
I guess they're not actually triggers then. they're scripted
seems the guard points are not triggers indeed
https://community.bistudio.com/wiki/createGuardedPoint they have their own command too, so yeah
Question: Id like a script for guards checking civilian players for papers and weapons based on proximity and chance.
The closer you are to the guard patrol, the higher the chance for them to order you to stop. I made the random chance working and I attached a trigger to one of the guard leadera, but id like for ALL guard leaders to be scanning players.
Any ideas?
How do I attach a trigger to all AI independent guard units ... I am thinking foreach and iskindof... but I dont know how to write it
so all units or only the group leaders?
I was thinking leadera to save resourses. Maybe a parameter for leader, group or both..
for leaders:
{
// code
} forEach (allGroups select {side _x == independent} apply {leader _x});
Nice! Is it possible to add iskindof to determine unit type?
and for all units:
{
// code
} forEach (allUnits select {side _x == independent});
So ita not ALL leader but only specific type of units or unit names
either check in the loop agains the _x variable of use another conditional select
{
// code
} forEach (allUnits select {side _x == independent && _x isKindOf "Man"});
@distant oyster
Thanks a lot ..
So if I want it to nest with this function :
call{Trigger1 attachTo [Guard1,[0,0,0]]}
I guess I need to define the position of each "independent", "man".. And I need to spawn a trigger of each of them and attach that trigger to them.
yes. with createTrigger and attachto _x in the forEach loop
@distant oyster
How do I define _x ?
see biki for forEach, it is a magic variable
@copper raven I am happy you realized! It was just a test to see if you had a better solution XD
I guess it's better to use distance - but triggers allows a easy way for me to define conditions - so there you have it π
my idea would be to simply turn that whole logic around. instead of the independent units getting a trigger why not giving the player a trigger?
@devout gazelle as in: check around the player if there are independent leaders, instead of checking around all independent leaders if there are player units
independent numbers are more likely to be higher than the amount of players
is onDraw EH called every frame for the map?
ok thx
doesnt onDraw mean when the map is moved?
I'm not moving it but the EH fires
Is KeyName supposed to be replaced with something in:
player addUserActionEventHandler ["KeyName", "Activate", {
...
}];
Also, is the EH supposed to be attached to the player (the one who activates the action)?
keyName is the name of the action
no that EH doesn't get added to anything
Did you read the wiki page?
π
That absolutely make sense! XD
I guess I was thinking from the perspective of the guards instead of efficiency.
I've never attached a trigger to a player - I guess it's the same procedure...
better not use triggers at all 
@little raptor
That is why I am here - to learn from those with more experience.
But not sure if i learnt that much from your answer.
Any able to elaborate on this?
sharp already told you why
attaching triggers = bye bye FPS
also triggers evaluate their conditions in unschd env
I'm trying to find a way to spawn multiple ai's on a trigger if its possible
I followed along a video explaining how to do a single unit and tried tweaking it to spawn a squad
Can some one take a look I will show you the one I followed and what I did.
From the Video
group_1 = creategroup west; enemy1 = group_1 createunit ["b_soldier_f",getmarkerpos "spawn1",[],0,"form"]; enemy1 domove (getmarkerpos "waypoint1")
What I changed
group_1 = creategroup East; enemy1 = group_1 createunit ["rhsusf_army_ocp_squadleader","rhsusf_army_ocp_teamleader","rhsusf_army_ocp_rifleman","rhsusf_army_ocp_autorifleman","rhsusf_army_ocp_grenadier","rhsusf_army_ocp_teamleader","rhsusf_army_ocp_autorifleman","rhsusf_army_ocp_grenadier","rhsusf_army_ocp_riflemanat",getmarkerpos "spawn_1",[],0,"form"]; enemy_1 domove (getmarkerpos "waypoint1")
you are trying to pass all your units to createUnit at once, but createUnit syntax does not allow this
you have to call createUnit for each of your units individually instead
or use BIS_fnc_spawnGroup
Can I force a difficulty in an SP scenario? If yes, how?
and by force, i mean put a custom difficulty
Only thing you can force is CBA settings like ace. Mission tab in the addon settings. Vanilla Arma, you can't but you can script things around it.
I'm making a script right now for mp where if the opfor faction does something then it sets off stuff for the blufor faction, that i am fine with, however I was wondering if there is a way I can test it w/o bringing in a 2nd person
like for example if opfor drops a crate from a plane then it'll alert the people on the blufor faction so they can go get rid of it
in this case both factions would be player controlled not ai controlled, im trying to see if there is a way I can be on BLUFOR at the same time as opfor so that I can activate it and then do the other part on BLUFOR without needing to have 2 computers or another person
hello, Q: I have created some units, aligned CIV, there are definitely two different objects.
they are not appearing in allUnits however.
additionally I am creating some EAST units in patrol of the civilians.
I see groups there, but they too are not showing up in allUnits.
An eden placed, not server only, radio alpha trigger with onActivation as:
systemchat format ["%1", local thisTrigger];
played in MP (not dedi) results in a systemchat on every machine, and in addition it is false for everyone but the host player.
but if i understood the advice repeated on this channel this should not be the case
I think I see what might be going on... the objects and units are somehow being placed at [] or [0,0,0], not appearing 'on map' I guess.
you misunderstood or read wrong information then, when a trigger is placed on 3den, the server creates this trigger, so this trigger becomes the owner of this trigger as the creator of it so it is local to the server. For rest of machines(players/HCs etc etc), this object is not local but a remote one. This is the same scenario for all entities created, not just triggers.
Triggers placed in Eden can be server-side only or not (checkbox)
An eden placed, not server only, radio alpha trigger with onActivation as:
Assume it is server only... the trigger itself still exists on all machines, as the server only part defines where the evaluation will be done. So it would return the same thing anyway.
(Of course trying this in "On Activation" while server only is ticked will not yield anything obviously but thats out of context as he clearly defined "not server only".)
Would someone be willing to help me out with using remoteExec to change a bool via setVariable? I have at least gotten it to stop making errors, but it still doesn't seem to be changing the bool in question.
A voice chat would be preferable as that is little more conducive to how I learn, but I understand if people want to use text instead.
I overlooked the fact that setVariable can deal with locality on it's own.
I was wondering about why, but more interesting is ideas about how.
Wiki isnt always helpful in that way, so this is why i ask someone that could show examples that i can test. Saying something doeant work points me away from the wrong direction not towarda the correct one.
Nevertheless I am grateful for the advice!
Q: how do I ensure that my remoteExec lands on the correct machines? specifically this is to attach some particle sources. testing it under isServer&&hasInterface, i.e. selfHosted (?), so -2 does not seem like the correct targets argument. Is it a JIP (i.e. true) or a targets that I want?
https://community.bistudio.com/wiki/remoteExec#Syntax
Perhaps detecting selfHosted, 0 is best, when not, then -2 i.e. every other machine besides the server.
Thank you...
well it's obvious. use loops instead:
now I'm not 100% sure how you wanted to do what you said but this should give you an idea:
while {true} do { //infinite loop
_cnt = {//_cnt: number of alive guards
alive _x && {
_guard = _x;
if (!scriptDone (_guard getVariable ["inspect_script", scriptNull])) exitWith {true};
{
if (side _x == CIVILIAN && _x distance _guard < 15 && { //only check if player is a civilian & within 15m radius
time > _x getVariable ["nextInspect", 0] && { //only consider for inspecting every few seconds
!(_x getVariable ["Inspected", false]) //not already inspected
}
}) then {
_x setVariable ["nextInspect", time + 10]; //check this unit 10 seconds later
if (random 1 > _chance) then { //inspect
_x setVariable ["Inspected", true];
_script = [_guard, _x] spawn MY_fnc_Inspect;
_guard setVariable ["inspect_script", _script];
};
}
} forEach allPlayers;
true;
}
} count _guards;
if (_cnt == 0) then {break}; //no guards are alive anymore. break the loop
sleep 1;
}
if you expect there to be fewer players than guards you can swap the inner and outer loops.
Is it because triggers by default get evaluated twice a second or sth else?
well triggers evaluate their conditions unschd
plus he wanted to attach the triggers to the guards (or to the players?). attaching is inefficient
triggers by default get evaluated twice a second
you can change this
Yeah that's why I said "by default" :D
Isn't "normal" code unscheduled aswell?
E.g. I init some script on the server that checks if players are in area and does that every 2 seconds.
init how?
Initserver.sqf
initServer is schd
that checks if players are in area and does that every 2 seconds.
this by definition is also schd (unless you use a per frame EH)
@little raptor
Thanks for the effort!
I am attempting to wrap my head around what you've done and find how to test it.
I have a question:
I want TCP guards to check if a player has weapons and papers.
If they detect weapons in your backpack or holster or you don't have papers they will consider you hostile.
If you are clean and have paper item on your person - guards will let you go.
Any ideas how to script such a check?
yes
if (hasWeapon || !hasPapers) then {
beHostile;
};

So I am making a script for military police/guards patrolling towns and setting up check points to search civilians for legal papers and counterfeit
I want a specific type of independent units to act as guards (like a certain faction class for example).
The guards will scan you every 7 seconds 5 times with a random chance of being suspicious the closer you get to them.
If they are suspicious they will approach you, search you and ask for papers.
If you have no weapons and have the paper item, they will go back into safe mode and head back to the guard post or continue patrolling.
I've already made some parts of the script that "works", but problem is that I want to run the script just on Military police and not on normal AI.
My solution was to spawn a trigger on all the patrols, but you found a better method that I haven't really figured how to implement yet.
This is what I have so far:
[] spawn {
private _checks = 1;
private _Compromized = false;
while {alive guard1 and _checks < 5} do {
private _distance = player1 distance Guard1;
private _suspicious = random 100 + _distance;
if (_distance < 25) then
{
hint format["The guards have checked you %1 times", _checks];
sleep 4;
hint format ["Your detection roll is %1...", round _suspicious];
_checks = _checks + 1;
};
if (_suspicious > 25 && _suspicious < 50) then
{
Hint "The guard is starring suspiciously at you...";
guard1 dowatch player1;
guard1 setBehaviour "AWARE";
guard1 doMove (position player1);
guard1 globalRadio "Hey you! Papers!";
};
if (_suspicious < 25) exitWith {
private _group = createGroup WEST;
guard1 dowatch player1;
{[_x] joinSilent _group} forEach units (group player1);
guard1 setBehaviour "COMBAT";
hint "You have been comprimised!";
_compromized = true;
};
if (_distance > 25) exitWith {
hint "You are at a safe distance.";
_compromized = false;
};
sleep 7;
};
if (_checks >= 5) exitwith
{
guard1 setBehaviour "SAFE";
guard1 doMove (getMarkerPos "guardpost1");
hint "Guards are not suspicious";
};
if (!alive guard1) exitWith
{
Hint "The guard is dead";
};
};
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Now it worked π
Eyo! I have been working on a scenario for my unit for a few days now with most thing going smoothly. Its about 2 teams stranded and separated and them having to find eachother while working around limited resources.
I say this because as it flows, I want both groups (both in BLUFOR) having markers set from the editor that only members of that same group can see. I've spent about a day total digging for solutions for this and I cant seem to find a script of config that works. I would like some help constructing a script where some markers and only visible to members of a specific group and invisible to members of the other. Can anyone help me out with this?
I am mostly new to scripting only recently begun trying to learn the ways scripting works. So most of the time that I read someone talk about the technical aspects of what a function or so is in context of a script I just blank out
do mods work for you?
https://github.com/ArmaForces/FriendlyTracker
if not you can learn from the code I guess.
I have designed basic functional scripts before so I know enough to tell where one begins and the other ends but why a thing is where it is still hasn't been something I can consistently understand unless I recognize the like in question
Anything basic I should recognize and look at to start with?
The mod is based on CBA template and is not really begginer friendly.
tl;dr it's a loop that updates the markers for everybody in your group/side/however it's set up
So far ive got a functional script for tracking groups by location with a marker but its basically displayed globally
The markers I wish to set should be static
Also, I should ask
This mod you sent me
What would I need to edit for it to work with my intent?
Ah wait, you meant markers as in Markers that track positions of your group members? (Blue force tracker)
Because I've understood it like this.
Or just normal map markers visible to only certain group?
I mean static markers only visible for a single group
in this case its a marked crash site
makes no sence for a team across the map to know what the crash team just found out (in context of the mission)
I would suggest putting the markers in 2 separate editor layers layers.
Then make them all alpha 0/invisible
and show them on init with a check in what group player is in.
how can I construct this script?
First step simple enough, layers are set correctly to the markers
BTeam_Markers
With
"C_Mark" and "J_Mark"
if (group player == crashedGuysGroup) then {
private _markersToShow = getMissionLayerEntities "crashed_guys_markers" select 1;
{
_x setMarkerAlphaLocal 1;
} forEach _markersToShow;
};
in the init.sqf right?
testing
would any seprate commands from triggers effecting these markers break anything?
maybe, can't say without knowing what commands.
MarkerPos
I think not, IIRC it will update the position of the marker for everyone but if it's invisible to some people it should not matter.
can I test the functionality of this script by playing alone on a hosted server or?
yes, if you mean dedicated server just change groups. For local hosted boot the game 2 times.
hm?
" For local hosted boot the game 2 times"?
its player/local hosted server
hmm
got it to work with Bteam (the ones who should see it)
lets try with A
Holy moly it works
thanks for the help
I will probobly be back later for some help with respawn script
Do I repeat the script (with edits for what layers and groups it applies to) if I want the same to apply for another team with different markers?
yeah, you could make it maybe a bit smarter and set the layer to uncover on the group as variable or smth.
But you can also just copy paste it for other groups if there's not many of them.
Just 2 groups
ok this one should be more simple
how do I set respawn on squad members?
Trying to find a way to do that. Without map markers for respawn
for example if i have this array
[3,4,2,5]
How i can get the index of the highest number? i know that selectMax returns me the highest number of the array but how i get the index of where that number its?
I have a stupid question, is it possible to use a flagpole to call this ?:
Function name:MRH_fnc_EndCredits;
Author: Mr H.
Description: plays movie like end credits with player names
Return value: None
Public: Yes
Parameters:
0 -<NUMBER> speed (default 20)
1 - <STRING> mission title
2- <STRING> mission maker's name
3- <STRING> special thanks
4- <STRING> extra text
5- <STRING> year
Example(s):
[20,"MRH Milsim Tools demo","[TGV] Mr H.","Special thanks go here.<br/>Accepts structured text","Extratext comes here<br/> accepts structured text","Made in 2018"] call MRH_fnc_EndCredits;
Or do i need to set up a script ?
you can either use find, or sort it yourself manually
First of all, is βfinding the indexβ necessary? What's your goal?
e.g.:
_sorted = [];
{
_sorted pushBack [_x, _forEachIndex];
} forEach _arr;
_sorted sort true;
_minIndex = _sorted#0#1
or:
_min = selectMin _arr;
_index = _arr find _min
Hi, I got this response from ace a few weeks back now, but I don't understand scripting well enough to implement what they suggested can someone help me?
https://github.com/acemod/ACE3/issues/8455
just create a dummy object, use initBox to give it a limited arsenal
then add an interaction to your box that calls openBox function, but use the dummy as the actual box that contains the items
I don't know how to create an ace interation call they never worked for me
you don't have to make an ace interaction
it can be a vanilla addAction
plus their docs already explains how to use it:
https://ace3mod.com/wiki/framework/interactionMenu-framework.html
so just to summarize what you should do:
- not sure how ACE arsenal works, but this either goes in
initServer.sqf, orinitPlayerLocal.sqf+ replacecreateVehiclewithcreateVehicleLocal:
my_dummy_box = createVehicle ["HelperBase_F", [0,0,0]];
[my_dummy_box , [...]] call ace_arsenal_fnc_initBox;
- in a box init:
this addAction ["Open ACE Arsenal", {
params ["", "_caller"];
[my_dummy_box, _caller] call ace_arsenal_fnc_openBox
}];
[...] this is the "export" part of the arsenal correct?
it's the limited arsenal thingy
yeah
I haven't used ACE arsenal in a long time. I just pulled that from the docs:
[_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_initBox
Β―_(γ)_/Β―
see my issue is I know other languages but can't seem to understand the docs nor logistics of this one
that's because you don't understand the syntax I guess
pretty much
so I can create a "initServer.sqf" file within the server files correct so it loads on all missions right?
or is it per mission?
what you posted is part of the function description
per mission
like I said I don't know where it goes
because I don't know how ACE fetches the list (local or global)
if you can't test just use the second approach
I think it'll work just fine
@still forum Is it intentional that Arma bonks itself to the Desktop when an include can not find the requested file while being accessed by compile preprocessFileLineNumbers ?
yes
the only way to avoid that is to run with -nologs (or fix the bad include path π )
god damn it xD why tho
im pretty sure it got fixed though(?)
or only in description.ext or something like that

Nope apparently not.
But I found a way around it:
#if __has_include ("pathtofile.sqf")
#include "pathtofile.sqf"
#endif
yes, you can use the __has_include
can you check if it crashes for description.ext includes?
how can i add new rows and stuff like an apostrophe or quotation marks in a hint
\n -> new line
\n and escape
It simply will not load the description.ext in that case, at least via test in MP
but I am getting an error message in the editor
no crash
interesting
and what if you preprocessFile "description.ext"?
i assume it will crash the game
what about ' and "? or do they not conflict with the quotes from the hint
hint """quotes"""
that is very likely, but I really do not wanna try that right now xD
hint "'differentQuotes'"
ait ty
yes
or, you know... just write and
