#arma3_scripting
1 messages · Page 720 of 1
this is exactly the same thing with other commands as well
they're just operators
hmmm... good point... I guess it's just still unclear to me what side to put certain variables on... or does it not matter?...
Does anyone here know how to fix something for me? I am using this Server hosting & I keep getting this certain error when I try & upload the mission onto the server.
ErrorMessage: File server.cfg, line 30: '.MISSIONS': 'C' encountered instead of '='
MISSIONS CYCLE
= class Missions
{
class TestMission01
{
template = Invasion%20of%20Chernarus.chernarus;
difficulty = "Regular";
class Params {};
};
};```
player setDamage 1; //binary command: "setDamage"
//similar to:
1 + 2;
alive player //unary command: "alive"
//similar to:
+1
This makes a lot of sense. Definitely helps me wrap my brain around it. Thx 🙂
So... instead of it being, like, a "function" based language, it's like an "operator" based language? Where you define operators instead of functions?
instead of it being, like, a "function" based language, it's like an "operator" based language?
yeah exactly.
Where you define operators instead of functions?
you can define "functions"
but what we call "functions" in sqf are just data of type "CODE"
which we assign to a variable of our choosing
e.g:
my_function = {
};
what you wrap in {} becomes an object of type "CODE"
which is callable
and [] is array
can my_function from your example be called with variables in front and after it?
() is not an operator. it's just parentheses
sqf is not statically typed so you can pass anything to it:
my_function = {
params ["_a", "_b"];
_a + _b;
};
_ret = [1,2] call my_function; //3
_ret = ["bla","bla"] call my_function //"blabla"
it's not exactly a function. it's like opening a scope
so it still sees the variables you've defined in the parent scope btw
Change it to this (you have a syntax error):
// MISSIONS CYCLE
class Missions
{
class TestMission01
{
template = Invasion%20of%20Chernarus.chernarus;
difficulty = "Regular";
class Params {};
};
};
But this is more of a #server_admins question, and not #arma3_scripting.
Oh, apologies.
technically this was a #arma3_config question
Thanks btw
Ohhhhhhhhh... I keep forgetting my_function is not a function, but a variable with code, that is called by call.
Can you define an "operator" without using #define that takes in two variables (one before and after)?
in sqf no
but using C++ extensions yes
ok, so #define would be the way to go then?
C++ extensions?... any docs on this I can read?
I was specifically referring to:
https://github.com/intercept/intercept
but anyway:
https://community.bistudio.com/wiki/callExtension
Also, last question, in your opinion, what language is SQF closest to? Or is it pretty unique in it's operator-operand structure?
lol
Nothing else
true 🤣
Truuuuuuu
but the command names are pretty much similar to C++
using just sqf "functions" is better
Okay wait... Just had a thought...
This still confuses me...
This makes sense to me:
player setDamage 1; //binary command: "setDamage"
//similar to:
1 + 2;
But 1 setDamage player doesn't work.
Now, that's pretty obvious... But I feel like it's less clear of the order with other operators
No, it was... I just still think SQF is too vague
operators may take different left and right arg types
Which is fine... but is this well defined in the docs/biki?
data types are shown on the wiki page
Okay, so... If it's a binary operator, "Parameters" will always have 2 lines? But what if it's like:
var1 operator var2 var3```
err, I guess var2 and var3 would be in an array?
okay, so operators can only take 1 var on each side, and if it's more it has to be an array (on either side)?
yeah
okay, I think I get it 🙂 thx!
Is it possible to make any object fire something or would I need to use an invisible vehicle with a muzzle to fire it?
For example make a can of beans fire a Titan missile.
you can create the projectile yourself
some effects might be lost tho... + the firing sound
Yeah so far I have been unable to force the cruise profile on it that way.
I can spawn projectiles and target them with BIS_fnc_exp_camp_guidedProjectile but that makes them go direct to the target with out any of the advanced behavers like terrain avoidance.
what if you use setMissileTarget?
From from what I have seen that gets applied to the launcher and not the missile.
no it gets applied to the missile
Will play around with it a bit more.
Best method to animate a smooth 90 turn for a unit/player?
Using animations to have the players walk forward during an intro, and I need them to make a 90 degree turn toward a helicopter while in this intro state.
setDir works, but obviously is instantaneous and doesn't look good.
You could record the unit's movements then play those.
Will unitcapture/play work for player units? I considered using that, but thought it would only work for AI
Read further on unitcapture, and it appears it will work on players, so I'll just use that.
The missile isnt tracking that target but I think that is because the target doesn't have the missile's usual target parameters.
Im using the VLS missiles so going to try and use reportRemoteTarget.
Thanks.
It actually still is
You just have more data types and order matters (imagine matrices multiplication eg. Where order can decide in graphics design whether rendering works or not)
Is there a way to change the literal crate in the supply drop module? not the contents, I found a really good script for changing the contents (which if anyone needs that script lmk) I just need to change the literal crate itself. Like from the standard NATO supply crate to the orange IDAP crate. Any ideas?
if the crate has hidden selection textures you can retexture it
I'mma be honest with you, chief. IDK how to do that lmao
probably gonna have to extend your script to grab the crate's location, delete the crate, spawn a new crate with the class you want, then run the crate init that you have and attach it to a parachute
not sure if it's my code or what but I get the addMissionEventHandler ["EntityRespawned" to trigger only once in my mission
whats faster with hashMaps in sqf? (for small amount of elements vs "high" number - ie thousands)
a) dynamically building the hashMap (adding each key-value pair individually)
b) building first the array data structure and then use createHashMapFromArray
hey peeps im new to scripting completely
I just have a quick question. Idk if im mean to ask it here
Im trying to add an action that lets me "remove" a disguise on a vehicle.
This is what i wrote as a concept
_this addAction["Remove Disguise", {_this hideObject True; KamazBomb1 hideObject False;}];
Now hideobject doesnt really work in this case and i dont realy know why
if you can @ me when and if you wanna help out thatd be great. thanks
_this in the addaction code (the second _this) is an array. you have to extract the params first.
Ohh thanks
First array, then hashmap:
private _elements = 100;
private _structure = [];
for "_i" from 1 to _elements do {
_structure pushBack [format ["Key%1", _i], _i];
};
createHashMapFromArray _structure;
Execution Time: 0.1342 ms | Cycles: 7451/10000 | Total Time: 1000 ms
Hashmap only:
private _elements = 100;
private _structure = createHashMap;
for "_i" from 1 to _elements do {
_structure insert [[format ["Key%1", _i], _i]];
};
_structure
Execution Time: 0.1579 ms | Cycles: 6332/10000 | Total Time: 1000 ms
Is there a way to hide the objects model but still let it move around? as hideObject freezes it
Hashmap only (with set):
private _elements = 100;
private _structure = createHashMap;
for "_i" from 1 to _elements do {
_structure set [format ["Key%1", _i], _i];
};
_structure
Execution Time: 0.1502 ms | Cycles: 6659/10000 | Total Time: 1000 ms
Im assuming not right?
Is there a way I can force units to have their gun raised? In combat mode, they just switch to Aware, and lower their weapons. Ive looked online and found the weaponLowered page, but it doesnt really have anything of use to me :/
Also as far as I'm aware, their guns should be raised in aware mode.
Hey Ho, I have a question mayby someone can help me.
Is it possible to create a 3D showen area like the Trigger does it in the Editor?
It must be visible for players in multiplayer.
So i looked around and I dont find anything jet.
Mayby someone has a tip or a script command.
thx
https://forums.bohemia.net/forums/topic/218980-sharing-is-caring-draw-triggers-area-in-game/ kinda hacky but it works
okay thanks.
So i found this to and it works, but in this version only the lines are shown. Is it mayby possible to see a transparent wall like the trigger area.
What kind of object. Entities can still move while hidden.
Vehicles
if the object supports retexturing you might be able to remove the textures instead of hiding the object entirely
I was thinking that. Maybe ill fiddle with it later. thanks
When using a listen server, can i run a server only mod? I mean, a mod that is only loaded on the listem server.
How do you quickly find the functions you need to develop? Thank you very much
wdym?
mum,I wanted to find out the original features of the game and modify them to make a small plug-in, but I searched the keywords and couldn't find the relevant features
@pure socket if you is a first time coder, you will probably find the functions you need on fly.
When you see the same code is used more than one time.
This is the first time FOR me to make it. I used to modify and compile the function found in the package that the author allowed me to learn
Don't know where the author found the function and made the call...
what do you mean by "function"?
I have a document about being kicked out for moving too fast, and it works. I want to add another function about being kicked out for keys, but no error was reported after I added declaration and judgment, but the function is not working well, I used onKeyPress ().
you need to learn the SQF syntax first
there's no such thing as "onKeyPress ()"
are you familiar with programming?
Beginner, learning logic by watching the big boys code
I mean non-SQF, such as C, C++, etc.
i learn c++
I don't have any project experience at present
I feel very confused when I write again
@little raptor you know about this ☝️ sorry to ask directly, fell free to not respond 👍
nope
ok good. so I guess I can give you a quick tutorial about SQF then.
SQF is an operator-based language, not function-based. so there's no fnc()
We call those operators "commands". you can find all of them here:
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
SQF has 3 types of commands:
nular: commands with no args, such as player. they're sort of like variables.
unary: commands with 1 arg, such as alive
binary: commands with 2 args, such as setDamage
operators are like math operators. for example, we have when you write + 1, + is a unary operator, and when you write 1 * 2, * is a binary operator. that's how you write sqf commands:
alive player; // similar to: +1
//and:
player setDamage 1; //similar to 1 * 2
to make a command work, you have to pay attention to its data types, which you can read on the wiki. for example, if you look at setDamage:
https://cdn.discordapp.com/attachments/105462984087728128/899063047652536330/unknown.png
SQF has several data types. including:
scalar (or number): such as 1, 3.14, 1e3, 0xFF
string: wrapped in "" or '' such as "hello"
array: wrapped in [], such as :[1, 2, "blabla"]. arrays can contain a mixture of data types, including arrays themselves.
code: a callable object, wrapped in {} such as {player setDamage 1}
object: all "physical objects" you see in the game, such as soldiers, vehicles, trees, rocks, etc.
group: a squad of units
those are the most common ones.
that's just about it. now all you have to do to make a command work is look at the wiki, see what variable types it needs, and provide the correct data types
of course you can store them into variables if you want, e.g:
_damage = 1; //scalar
_unit = player; //object
_unit setDamage _damage //OBJECT setDamage SCALAR
once a statement is finished, you end it with a ;
yes
Would anyone be able to tell me how to properly use BIS_fnc_showNotification?
Here's how I call it:
["PointCaptured",["",_pointName + " has been neutralized by OPFOR"]] call BIS_fnc_showNotification;
And here's my PointCaptured class.
class CfgNotifications
{
class PointCaptured
{
title = "%1";
iconPicture = "";
description = "%2";
duration = 1.5;
priority = 0;
};
};
End result is just a blank notification with no text
The wiki page doesnt explain anything about arguments
read the function then... 
it made me even more confused
don't see anything wrong there, should work
You can send additional arguments into the template, where they are applied to title, icon or description using the format command.
so how would I apply that to my case
what?
["PointCaptured",["",_pointName + " has been neutralized by OPFOR"]] call BIS_fnc_showNotification;
where do I use the format command here
yet it doesnt work
yeah, that's a problem on your end, not the function's
what is _pointName?
maybe your description.ext is setup wrong
a string
I know 
did you verify it's correct?
print it to be sure
it would throw a generic error if it wasnt
for testing I removed the variable and its the same thing happening
okay what the fuck
I literally changed nothing
and it worked?!?!?!
did you even exit to eden?
or just restarted the mission?
you must exit back to eden for description.ext to update
it should've thrown an error if the template wasn't defined
sry for wasting your time
It was defined, but %1 and %2 werent
so you didn't change nothing 😄
nil type string, but i think format would handle it as an empty string
yeah:
format ["%1", format nil]
gives ""
and if you did str [format nil] you should see string, but i guess it's because array needs to format it like that to represent equal amount of elements
no guys, my issue was that my title and description in the description.ext were literally just a nil string ""
yes that's how I got the nil string... 
and when I added %1 and %2, I forgot to go back to eden
oh this is interesting, though is kind of expected 😄 format ["%1",getMissionConfigValue nil] gives "array string scalar"
so it seems like only nil of type string has special handling done by format, format ["%1", getPosATL nil] gives "array" 👌
Trying to make AI follow the player, the AI just walk to the players first position and stop there
while {1 > 0} do {
sleep 1;
this domove getpos player
};```
It also gives me a error that it is a generic expression
yes because you're sleeping in unscheduled
How to fix that?
is there a way modify what Zeus has selected(add a object to the selection, etc.)?
Can you explain that a bit more? Unsure what you're asking.
I wanna add a object I spawned add to the objects the Zeus has currently selected(selected i mean just left clicking on some object), or that curatorSelected returns that new object.
As in, you want to select multiple objects? Or you want Zeus to be able to select objects placed in the editor / spawned by other Zeus players?
I'm sorry I still dont completely understand what it is you're trying to do.
You know how normally you can select units/object with just mouse by pressing on them? I wanna add a object to that selection with sqf.
Oh okay... for what reason?
Basically that object can't be selected normally by Zeus.
But you spawned it using Zeus? Im confused.
If I spawn a thing with createVehicle it's not selected by default.
Oh, so just use something like Zeus Enhanced, it has an "add objects to zeus' module
That's not the same thing....
What are you trying to achieve by selecting the object?
I mean that's what I am trying to achieve: to automatically select a object. That's the only thing I am trying to achieve.
I'm glad this can be done! I need to set the server mod in the Launcher parameters?
Ok, I don't think I can help mate, I don't understand why the addon module is insufficient, and I don't understand why youre trying to select something (and why the module way of selecting is not appropriate)
https://community.bistudio.com/wiki/Category:Command_Group:_Curator
These are all Zeus-related commands, so probably not.
You can make an object editable with addCuratorEditableObjects, but I don't see a way to mess with the user's selection.
Hey guys, I'm trying to make an IED truck using compositions. Is there any way you could link the use of the horn to 2 attachedTo ieds blowing up ?
I am not sure if it is useful, but I was thinking of using the [attached ied] setDamage = 1, causing it to blow itself up upon the player honking the horn?
Is there a way to make a trigger activate when only a certain unit walks through it? for example a guy with variablename Man1
Man1 in thisList 🙂
I tried that, and its not triggering for some reason 🤔
The trigger is set to the side of the unit too
Ah I was using the driver of the vehicle, not the vehicle itself. Working now! 🙂
Triggers 
yes, via -serverMod launch parameter
So my AI follows the player in Eden Editor but when I start a zeus, they run into oblivion
this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/25)}];
{
_x doWatch objNull;
_x forceSpeed 10;
_x stop false;
_x disableAI "TARGET";
_x disableAI "AUTOTARGET";
_x disableAI "COVER";
_x disableAI "SUPPRESSION";
_x enableAttack false;
_x doFollow (leader _group);
} foreach (units _group);
[]spawn {
while {true} do {
sleep 4;
Zombie domove getpos player
};
};```
start a zeus?
syntax highlighting is sqf btw
?
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/25)}];
{
_x doWatch objNull;
_x forceSpeed 10;
_x stop false;
_x disableAI "TARGET";
_x disableAI "AUTOTARGET";
_x disableAI "COVER";
_x disableAI "SUPPRESSION";
_x enableAttack false;
_x doFollow (leader _group);
} foreach (units _group);
[]spawn {
while {true} do {
sleep 4;
Zombie domove getpos player
};
};
what do you mean by "start a zeus?"
Sorry meant I was in a Zeus playing as game master
Composition
@copper raven unit init field
that's not what im asking
what makes it not work?
you going into zeus interface?
i don't get it
When I place AI, they don’t follow the player and just run into oblivion full sprint
The AI work in Eden but not Zeus
And yeah I am in interface
i'm missing context here 
I might just make them run to a object
I think I found the problem
What does a player go by in dedicated?
I remember someone saying it goes by something else
My bad, I just saw 2 Huntsman
Don't know which one you are
i added atextDB3 to the launcher server mod parameter and added atextDB3 folder to the Arma 3 game folder (inside Steam folder) but when i start the listen server with my mission the atextDB3 mod don't load, the ============= List of mods ============= in RPT don't show it 🙁
I'm will try to install the mod as a local mod in the launcher.
at is the know symbol behind mod name...
you can just do: \@
Does anyone know the Control inside Display #602 (Inventory Display) that returns the list of displayed items in your selected container? I'm assuming it's a ctrlGroup but can't find it
I think it's #633 but unsure how to get the controls in that ctrl group. I feel like it's obvious but I'm missing something.
allControls
not really, try with your name, @ can't be escaped
anyone worked with There Is Only War any? I want to see if I can make a mission where you normally spawn as a cadian rifleman (normal soldier skeleton) but then you can unlock spawning as a space marine (different skeleton)
or I suppose the question I have is changing a unit's skeleton
oh, looks like my best bet is using createUnit and then using selectPlayer to force the player into that created unit
im trying to add a flyover at the end of my mission, and I am using
[[8429.28,9792.6,50], [8434.72,8604.38,50]] call BIS_fnc_ambientFlyby;
this works fine, but how can i change it to be a different helicopter instead of a littlebird?
read the wiki
https://community.bistudio.com/wiki/BIS_fnc_ambientFlyby
thanks
maybe serverMod doesn't work with client exe
just use -mod then
Hello,
I do have a basic technical question:
I try to return the player that trigger the ... trigger by radio call activation.
I manage to do that with a presence activation thanks to this or thisList but it does not seems to work with the radio call menu > Alpha etc. Because the array is empty using radio call.
Any suggestion to do that ? Maybe using setTriggerActivation ? But in an execVM sqf ? Trigger editor only ?Thanks
the trigger is created on all the machines
therefore it is local
you can use player
as simple as that, alright thanks 🙂
Can i change the Launcher language? There is no such option in parameters.
not through scripting, but you sure can through its top-right options
I'm wondering if thats only due to more temporary arrays being created.
Your first test has
["Key%1", _i]
[format ["Key%1", _i], _i]
2 arrays inside the loop.
Your second hahsmap only test has
["Key%1", _i]
[format ["Key%1", _i], _i]
[[format ["Key%1", _i], _i]]
3 arrays inside the loop.
create from array is internally just calling insert.
so create from array is the same as create + bulk insert.
Also [key, key, key], [value, value, value] insert will be more efficient than [key,value],[key, value] insert
bulk insert actually isn't doing anything fancy like reserving memory all at once.
bulk insert is just a loop with normal set's.
So it really shouldn't be that much faster
Only thing you might save is SQF command executions. Bulk insertion being one, seperate sets being many
What's the difference between the PlayerConnected eventhandler and the initPlayerLocal.sqf and initPlayerServer.sqf event scripts?
I am looking to add some code to change a player's face when the player connects to the server. Not sure if I should use the PlayerConnected event handler in init.sqf or just use the initPlayerServer.sqf event script.
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#PlayerConnected
https://community.bistudio.com/wiki/Event_Scripts#initPlayerServer.sqf
Here's the BIKI articles I am reading
PlayerConnected EH runs when player connects... at the time of the connection his avatar/unit might be not initialized yet.
Use init scripts for your use-case.
Thanks for the succinct explanation
there is no player on a dedicated. and in multiplayer, player changes depending on which client is currently running the script.
Hello, i'm having some issues with a script.
I used the following one i found on a Steam thread:
_variable addaction ["Title", {[["TEXT", "PLAIN DOWN", -1, true, true]] remoteExec ["titleText", 0, false];}, nil, 0, false, true];
This did make the object i wanted (in this case a pad) interactable, yet the main issue is that it doesn't matter how distant i am from said object, if i look in its direction in general even while being pretty far from it, the interaction still appears. I'm very new to scripting and scenario makings in general, any help would be appreciated...
Check the BIKI on addActions.
https://community.bistudio.com/wiki/addAction
By default, addActions have a radius of 50m. Add an argument to change from 50 as explained in the article above.
So how do get the player?
their actual name?
I'm trying to make AI chase them
hey guys what is the name of this particle? https://gyazo.com/07815c14260c6712a323f606fdb53c77
name player
will return the name of player the script is local to
what is a good example of a mod that's is using sqfc, than i can take apart to learn about sqfc ?
?
Do I need the players name in it?
Or will it find the player's name
https://community.bistudio.com/wiki/name
name is a function (if that is the correct name...) which returns the name of a object.
the object being player
Yes, i'm wondering what the dedicated player name is
My AI would run into the sunset
If I give them the name "player"
ehm... 😅 idk, join your server, open debug console and server execute "name player"
and see what it returns
I'm guessing nothing
oh, I do it in composition
I also tested it
Just stands still
I might just make them run to the object they are protecting
Someone else told me to try unit
didn't work
why do you need the player's name to "make AI chase them"?
Hypoxic already told you. there's no player in dedicated server~~/headless client~~
player is always a null object
If you let me get home from work I'll help you
Side note: On HCs it actually returns the HeadlessClient_F entity 
ok 
Okay ty
are you wanting it to charge the person that shot it or nearest person?
yes
nearest person
specifcally a player
so you have a group of zombie units that you want all of them to charge when one of them is hurt?
Here, i'll send script
Works but mine just gives the position of the player and makes them run to them like maniacs
this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/25)}];
[]spawn {
while {true} do {
sleep 4;
Zombie domove getpos Player,1};
};```
im reading the post you posted with the original event handler you put which there is so much wrong with so I'm just asking the idea you want
1 zombie or a bunch of zombies
abunch
and all these zombies are grouped in a single group
it's not just about "breaking group limit"
grouping AIs improves performance too
Oh yeah the large amount of green lines(move markers)
bin's not being friendly today...
that's just using your original commands you wanted in the original script
don't think you can hide your comment @crude vigil ! I saw it
Where do you put the script? I feel retarded asking
you define it into a function then you'd call it using the group's variable as the argument
Hello, i ran into a problem while trying to remoteExec say3d and show a text at the same time using addAction, i figured out how to play the sound pretty quickly using the wiki, tho i don't really understand how to incorporate the text too:
[g1, ["Azione", {titleText ["<t color='#ff0000' size='5'>Stop</t><br/>non ti muovere!", "PLAIN DOWN", -1, true, true];
}, {g1 say3D ["red1", 1000, 1];} ]] remoteExec ["addAction",0];
I'd wager }, { is the problem: addAction only takes one script argument, but you have two.
you can define subtitles to a sound that you made in cfgsounds
which I'm assuming red1 is
Is there a way to Preprocess a string like you can do with a file before compiling it?
ok i see, thanks to both! :D
you mean just compile?
I do not believe that compile supports comments using // or /* and */ and PreProcessor Commands.
https://imgur.com/hikvGYm guess i missed something lol
class CfgSounds
{
class red1
{
name = "red";
sound[] = {"red.ogg",1,1};
forceTitles = true;
titlesFont = "LCD14";
titlesSize = 0.1;
titlesStructured = true;
titles[] = {0,"<t color='#ff0000' size='5'>RED LIGHT</t><br/>non ti muovere!", "PLAIN DOWN"};
};
};
im lost :/
oooopss
left size='5'in
got it lemme refer
So what's the operators for variables? I can't seem to get this to work and I thought I did it correctly but clearly... not.
inMainBase = {player inArea "mainBase" OR player inArea "mainFiringRange"};
I did check to see if the variable in-game was correctly spelled and inside the script.
I just wanted to mainly make sure that this was the correct OR operator.
inMainBase is a code
It is the boolean for some ACE Teleport things.
I have no idea what you're trying to do without context
inMainBase = {player inArea "mainBase"};
rangerMenuClass = ["rangerClass", "4RB Menu","","",{true}] call ace_interact_menu_fnc_createAction;
[player, 1,["ACE_SelfActions"],rangerMenuClass] call ace_interact_menu_fnc_addActionToObject;
teleportMenuClass = ["teleportClass","Teleports","","",inMainBase] call ace_interact_menu_fnc_createAction;
[player,1,["ACE_SelfActions", "rangerClass"],teleportMenuClass] call ace_interact_menu_fnc_addActionToObject;
{
_x params ["_target", "_name"];
private _action = [_name, _name, "",
{
params ["_actionTarget", "_player", "_actionParams"];
_actionParams params ["_target"];
player setPosATL (getPosATL _target);
}, inMainBase, nil, _target] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions", "rangerClass", "teleportClass"], _action] call ace_interact_menu_fnc_addActionToObject;
} forEach [
[MBTP, "Main Base"],
[FRTP, "Firing Range"]
];```
I figured that'd make little to no sense so this is the whole file.
seems correct (except you didn't need to make it a global var)
instead of using player like that you might need to pass the actual caller...
Well yes this works.
but let's say I want another defined area without having to create another variable to call and create another forEach statement.
Which is where the OR operator comes in play I'd hoped...
But I'm not sure how I'd access the actual caller in this case since I'm using ace interactions I'm not sure how it processes that.
doesn't it mention in the docs?
if not you can just put a systemChat str _this inside the code
see what it gives you
my guess is that the first var is the caller
Where does systemChat output normally? I don't think I've done it right or I don't know where it's outputted.
bottom left
where other chat stuff is
Would anyone like to hop into a Team Speak with me & my buddy to help us out with some server issues. We have been frustrated for a few days.
Thanks
Oh god I can't chat in editor singleplayer
so, this is all that comes of it.
[B Alpha 1-1:1 (Mercury),false]
mutliplayer > host lan > editor
so my guess was correct then
the first element is the caller
so I guess you didn't write this yourself then?
well anyway:
_code = {
params ["_caller"];
_caller in "blabla"
};
The ForEach statement I had help from another person who just researched more into ASL than me.
Hello guys,
I checked the score system but I do have a small question still, how could it be possible to know which unit killed a specific AI ? I guess it's possible to return that since i saw on servers "Killed by JohnDoe" Thanks
yes. see "killed" and "MPKilled" event handlers
Are playActions and switchActions defined in specific animation config values?
CfgMovesBasic >> ManActions
Does anyone know if there is an event for a unit becoming unconscious (or vice versa)? I'm aware that lifeState and incapacitatedState exist but I'm trying to avoid having a loop to check it periodically.
handledamage maybe
That would work if damage makes you go unconscious or you're getting healed (if I see it right from trying it). But if a vehicle explodes around you and you're invincible or the Zeus toggles your state it wouldn't.
well for those cases, you need to detect it yourself
it would be nice to have an event handler for it, but oh well
There is a "VisionModeChanged" EH marked for 2.07 in the wiki already which I'm coincidentally interested in. One can dream for a "LifeStateChanged" or something as well. :)
You can make a feature request. maybe the devs will add it
Oh? How and where do I do that?
See #arma3_feedback_tracker and its description
Also odd versions = dev branch
You can already try that EH if you switch to dev branch
Basically 2.07 is what 2.08 stable will be
I'll look into the feedback tracker, thanks. Also not sure if I wanna dabble in dev branches as I don't know the release cadence. Will it be available "publicly" in a few days, weeks, months, etc.
no
Ah it already exists... for a while: https://feedback.bistudio.com/T120118 
Q1 2022 maybe
and its now on my todo list :wob:
(my todo list is long)
confused happy noises
Hello Guys, I have a question regarding how doTarget works. it seems when I make a unit target an other unit it wont target it forever but will change to an other enemy unit instead. Is that intentional? How can I approach this making my units target an enemy untill its dead and nothing else without using a loop? Im afraid a target loop might mess up the built in AI
You can disableAI autotarget
why does empty group become null when I set the deleteWhenEmpty to false (when creating it) ?
i think it's the joinSilent that causes empty group to be deleted (probably a bug...)
Hi everybody, I have another (probably) lame question but I would be very grateful if you can at least point me in right direction cuz I can even google anything similar.
I write this from work so I don't have actual code in front of me but I can't stop think about it, can't find anything and its bothers me.
I will make it simple : group with 9 units, 1-3 white team, 4-6 blue, 7-9 red. I have multiple blufor specific EH which works just fine BUT - I would like to make a different actions depending
on the team. I could make if / then parameters for each unit but with this number and number of EHs It would be very tiresome. I tried something like _teamRed = [u1,u2,u3] but then EH gives a error
message about expecting Object / Unit and not a string / array (I just can't remember which because I tried many different scenarios)
Is there anything similar possible? Can you point me out for some examples?
Thanks!
I have no idea what you are trying to do exactly regarding "actions depending on team"
as for your EHs… which ones?
Right, sorry. For example EH Killed, where if _killer is blufor, then _radio = selectRandom [sound1, sound2, sound3 etc.], then _killer groupRadio _radio; And it plays one of the messages when enemy unit is killed.
And I like substitute _killer with something like if _teamRed = selectRandom [sound1, sound2, sound3 etc.]; _teamBlue = selectRandom [sound4, sound5, sound6 etc.] and I can make it work like that if I do it unit by unit by name but I want to group multiple unit in one parameter (?) which EH recognize.
I'm really sorry but I'm trying to be clear as I can. Thank you
Thanks for the Idea. Unfortunately it doesn't seem to work. one of the units still fires upon the non targeted one and kills it.
see assignedTeam _killer
https://community.bistudio.com/wiki/assignedTeam
you could do something like this:
private _teams = [[white, ...], [red, ...], [blue, ...]];
private _sounds = [[sounds for white, ...], [sounds for red, ...], [sounds for blue, ...]];
private _sound = selectRandom (_sounds select (_teams findIf {_killer in _x}));
or
private _sounds = ["MAIN", "RED", "BLUE"] createHashMapFromArray [[sounds for white, ...], [sounds for red, ...], [sounds for blue, ...]];
private _sound = selectRandom (_sounds getOrDefault [assignedTeam _killer, [sounds if not in above teams]]);
if you are using the assigned teams thing (what Lou said)
though both of these assume that _killer is in one of those teams, otherwise you need to handle the case where it's none of those
actually you could even simplify the second one by using a hashmap
Thanks to both of you! I will try it as first thing I'm home 🙂 I knew about assugnedTeam but didn't know how to use it correctly. Sry guys, still learing. And Thanks again!
i mean for it to work, you need to first https://community.bistudio.com/wiki/assignTeam
unless you do it in group menu thing
Yup, already got that part in init.
edited the second one to use hashmaps
it's best if you create the arrays(first) or the hashmap(second) in some init script, so you don't recreate it everytime
and don't apologise for learning 👀
I must say that I don't understand how hashmap works but I will try to make it work by your first post and then look into this and try to iron it out.
Thanks, also with the terrain commands in diag is there a way to get the closest terrain vertex?
do math
ugh!
Okay... thanks. Will try and implement it in a different way.
terrain starts at 0,0,0
you have a command to get terrain grid
heightmap points are on terrain grid spaced grid, so you can calculate where the grid points are, and thus also where the closest is
there is no command for it, but you can script it yourself
Yeah, I understand but for my use case this causes a good amount of delay between start of the brush and when the loop starts. (Tested with exporting) Just didn't know If I overlooked the functionality of a command or not. Will try implementing the math and see if the delay is noticeable like it is with my exporter.
you just need to round your X coordinate once to next lower multiple of terrain grid, and to next higher multiple of terrain grid
repeat the same for your Y, now you have 4 points.
then distance2D to find the nearest.
That should be pretty fastish
@winter rose @copper raven It works like a charm guys. Thanks! I have few new hiccups but I'll try them solve myself first. 
I'm building a showcase on suppression mechanics.
Part of it is facing the players against a line of RPG troopers, because when suppressed, the AI can miss even 100m easy shots.
But the problem is, when these guys get spawned in, there's a good chance they just put their RPG away and cycle down to prone then back up. :/
I've disabled most all ai functions besides those needed to target and be surpressed, but it's made no real difference in the chances :/
Usually, it's only the AI facing the player; the AI facing the friendly AI have no issue attacking
is there a way to tell is sqfc is loading instead of the sqf files ?
is it guaranteed that the sqfc is used over the sqf ?
yes iirc
I'm trying to make a script that spawns a vehicle through a gui and then when the player presses a button it detaches the vehicle, I have the first part done and it spawns and attaches the vehicle but when i try and do an event handler for key down that executes a script that will detach the vehicle(with some checks to be added) it doesn't work because the variable isn't passed through, is there a way I can pass through the _veh variable(w/o making it a global var) so I can detach it through the code called from the event handler?
private ["_vehicleSelected", "_classVeh", "_playPos", "_veh"];
closeDialog 999;
_vehicleSelected = lbCurSel 1500;
_classVeh = lbData[1500, _vehicleSelected];
_playPos = player modelToWorld [0, 10, 0];
_veh = createVehicle [_classVeh, _playPos];
_veh setDir (getDir player);
_veh attachTo [player];
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
clearItemCargoGlobal _veh;
clearBackpackCargoGlobal _veh;
_keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", {
_keyCode = _this select 1;
_handled = false;
switch(_keyCode) do {
case 14:
{
call detachVehicle;
_handled = true;
};
};
_handled;
}];
detachVehicle = {
// detaches vehicle + some checks to make sure not inside building etc.
};
I've tried doing
_veh = attachedTo player;
in detachVehicle but it return object null
params to pass through a var into another script
@astral lynx https://community.bistudio.com/wiki/params
so
[ _veh ] call detachVehicle;
then in detachVehicle
params ["_veh"]
something like that iirc
also define your variables as private next to the var rather than in an array at the top, more efficient
detachVehicle also aint gonna run as you are calling it before it gets defined, either move it up to the top or make it its own file etc
okay thx doign the params worked, I didn't think it'd work when i started because just trying to use the variable in the event handler wasn't working but this way worked. and with detachvehicle not running idk cuz it is able to work now that I used the params
oh maybe it does work then sound
im prob wrong about the define before you call it thing
🙂
A question for anyone with experience using the EXTDB3 extension
I have set up a mysql server locally and created a connection(user) that works.
And I have set up the config
[Database]
IP = 128.0.0.5
Port = 3206
Username = MyUsername
Password = MyPassword
Database = Arma3_DB
I have pasted the @timber cypressdb3 in the root folder for the dedicated server.
\steamapps\common\Arma 3 Server\@extDB3
Question 1: What syntax do I use to insert data from arma to the database (a short example would be great)
Question 2: How do I retrive information from the database?
Such as ```sql
select * from randomtable2
or ```sql
INSERT INTO Kills_Table VALUES
(2, 32423151, 33227131, 'Rahim', 350, 'head', 1200, '[2048,0285,120]', '', '',0);
Anyone have any ideas on how to get WEST to kill agents on sideAmbientLife? I've tried everything I can think of and no success. Blufor ignore them, maybe aim in the general direction, but that's it. Could also be a addon issue with the @zombies mod (Abandoned in 2015):
sideAmbientLife setFriend[west,0];
sideUnknown setFriend[west,0];
civilian setFriend[west,0];
west setFriend[sideAmbientLife,0];
west setFriend[sideUnknown,0];
west setFriend[civilian,0];
sideAmbientLife addScoreSide -10000;
civilian addScoreSide -10000;
sideUnknown addScoreSide -10000;
{_a=agent _x;_a setCaptive false;
removeUniform _a;
_a setFace "Default";
_a hideObjectGlobal false;
_a enableSimulationGlobal true;
_a addRating -10000;
}foreach agents;
in-game you run
"extDB3" callExtension format ["0:%1:%2", _protocol, _query];
where _protocol is the unique identifier you used to add one with ADD_PROTOCOL
for insert queries and others that you don't care about the result, use query type 1 instead of 0
Nice thank you!
So something like this would work?
Private _query = "Insert into RandomTable values (Hello, 32);"
Private _protocol = 0;
"extDB3" callExtension format ["0:%1:%2", _protocol, _query];
get WEST to kill agents on sideAmbientLife
they just can't see them
the game AI has been optimized to ignore some sides for performance reasons
you might be able to make them see ambient life agents if you use reveal (which needs forgetTarget every few seconds to reset the knowledge)
in short, you really can't do it anyway
wahhh 
or is this the correct way?
Private _query = "Insert into RandomTable values (Hello, 32);"
Private _protocol = ADD_PROTOCOL;
"extDB3" callExtension format ["0:%1:%2", _protocol, _query];
no
also afaik ambientLife is already hostile to all sides
so what you're doing just means nothing
Well shit.
this is how you add a protocol
"extDB3" callExtension "9:ADD_PROTOCOL:SQL:my_unique_protocol_id_bla_bla"
with id my_unique_protocol_id_bla_bla in that case
In that case, the mod I'm using is probably just junko. Could have sworn I had it working last night but I must've dreamt Arma coding lol
, the mod I'm using is probably just junko
depends. what mod are you using?
you can just attach a target object to them I guess
(at sign)zombie by Zuba
Got it from the Steam Workshop. Last updated in 2015 sooo yeah.
never seen it...
btw you might want to check if animals have a VIEW lod
afaik they don't have that either... 
so might be another reason why they can't be seen
Ahhhh interesting, I'll check
but I guess the easiest way for you might be attaching an invisible target object (not using hideObject; inherently invisible)
CBA has one
Yeah I figured that'd be the only way, but wouldn't that be counterproductive of using agents? Or is it not that bad
well yeah attaching is slow
It's an idea though, I'll take it into consideration. Thanks Leppy.
@little raptor You are correct, bunny doesn't have geometryView LOD
Thnx sharp!
no, that tells you if the file exists but not if it actually was loaded
You can potentially spot the differences in assembly code with diag_dumpAssembly, but.. overall no
Deleting 3 messages.
Done! (This message will self-destruct in 10 seconds.)
@lyric schooner?

yeah but if there is sqfc variant of the sqf file, then you can assume it loaded it, no?
if you use compileScript that is
there could be an error during loading, it will silently fallback to the sqf
yeah, that's true
Ok! A deleted own message in #arma3_gui and post it there. no crossposting ok @lyric schooner ? How to change textureNoShortcut on CT_SHORTCUTBUTTON scripted? Or create button with this attribute in script? WIKI page is empty https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control_-_Button

@cloud sable there isnt
not possible
if you want to change that property, you have to create multiple classes in the config yourself.
Ok thanks!
When you run a multiplayer listen server, the function **plubicVariableServer ** does what it need to do when you exec it in the host client.
When you run a single Player session, **plubicVariableServer ** does nothing.
This make the creation of a universal mission (single and multi player) a bit more complicated.
@copper raven some old code use publicVariableServer, the mission have more than 5 years of development.
What do you mean it does nothing? In singleplayer, you already are the server 
the EH does not do anything
as in, "on var update, run this code"
Logic is hostile to every faction in arma, even itself. Makes sense.
hue hue hue
Also, good to see you Lou. I'm glad to be back if just to talk with you again
Hi guys, just another quick and silly question.
Is there something like EH which can "see" actions like when someone (unit) give a squad command to move or regroup ? I'm trying to find a way to use custom voices for commands without redoing whole (far too complex for me) Radio Protocol. I would like to use some basic stuff like enemy seen, move, regroup, injured, killed atd. without complex system like Man, 400m, west etc. Most of it I can do (somewhat) by using EH. I don't say its the good or best way but it's so far a way my knowledge permits me
Any pointers or kind FY is appreciated. Thanks
i feel like youre trying to reinvent the wheel here. Radio Protocol is the way to go about this. Do feel free to disagree, though
afaik there are no "command" EH.
what you could do is have your own system, e.g hold Y then press space to give them a move waypoint at where you are looking
unless I misunderstood and you are trying to use RadioProtocol words in a sentence, then such thing could be done using the Conversations system
I think you're right but Radio Protocol is more complex than I would like at least if I understand correctly what I read on Biki and forums. And there is no option to turn off function which I don't like or need. So I'm looking for a way to invent a wheel 🙂
Well even if there was such an EH, to replace those you have to disable the radioprotocol AI feature, so the EH wouldn't trigger anymore! 
@little raptor so I found a different way the other day that I used way back when that I didn't even think of.
inMainBase = {player inArea "mainBase" || player inArea "trainingGround" || player inArea "airfield" || player inArea "artillery"};```
I kinda make it work so far by using EH like hit, killed and suppress (badly) with _unit groupRadio "msg" and setting "NoVoice" and last thing I would like is move, end moving orders. But I know I'm out of my league here with some silly ideas. So sorry guys and thanks for "grounding" 
you do realize you can loop that right 
You can still use radio protocols. It's not as complicated as you think
I'll give it a shot. Thx
I hadn't had a chance to try this until now, I'm getting an error that I'm missing a ] at the end of it near _caller in "area"
but I genuinely don't know where it's asking me to put this bracket or where I'm missing one.
this code is good
you may have some issue somewhere else
hmm, likely something I didn't see I'll check through again.
The EH don't trigger. My mission is not only single player.
I'm trying the most to make the mission compatible with single player and multiplayer with client-host and dedicated. This is my actual assigned task.
It was a dedicated server only mission.
aaah, the infamous "my server is dedicated"devs 😁
but, yeah, remoteExec is the way to go 🙂
both
Is there a function to change the typename from an array to an object?
- nearestObjects returns an array and I want it to return an object in the way cursor target does
why are you using that if you only need one object?
ya i just realised it would make more sense to use nearest object when u linked it
had missed it haha
cheers
Even if you used objects then couldn't you just select the index you were looking for
yes but why do that when there is a command specifically designed for that
True
one last question for this week, can the BIS_fnc_dynamicGroups be set up without a leader, and is there more information the wiki seems to skip over a few things
anyone here used selectPlayer much before?
I'm trying to do something with it and I'm getting really weird behavior.
if I use selectPlayer it seems to mess up with cursorObject returns.
wdym?
so, if I use createUnit to make a unit
and then I use selectPlayer to swap into that unit
it seems sometimes cursorObject is still sometimes left as the last unit's cursor
is that a normal unit or are you doing weird things again?!
what do you mean a normal unit
soldier
and how do you know it's the old unit's cursor object?
well if I do position cursorObject it returns something very different from what position player does (and this is while I am looking at a unit that's a few meters away)
very different from what position player does
from what?
position player
also for the record, stop using position...
like yeah just doing it for the sake of a quick test
position cursorObject
position player
wat?
of course they're different
yes, but they should be like, a few meters different
player is now the unit you're controlling
instead they are thousands of meters different
what does position cursorObject return?
I'm moving units to 0, 0, 0 after I swap players, so it's returning [0, 0, 0]
[0,0,0] is for objNull... 
it means you're not even looking at something
OK, so I'm staring at another marine right now
position player returns [3440.1,14459.4,-3.8147e-006]
position cursorObject returns [0,0,-113.229]
and what does cursorObject return?
NOID auto_cannon.p3d
see thats what I thought at first, but no matter what angle I look at him with I can't get cursorObject to return the unit
is the weapon too big?
that must be it
try getCursorObjectParams instead
maybe it works better
hmm
yeah it has to be that I messed something up when looking at the unit with cursorobject
thanks for the sanity check leopard
So if I write some code in say a mycode.sqf
What's the correct way of remote executing it for all players?
are you sure that the code has to be remote executed?
not everything needs remote execution
it's stuff like code for side chat text to pop up and BIS_fnc_infoText
depending on where this code exists, you can use several approaches.
the best (and fastest one) is making a function, and remoteExecing that function
the second option is remoteExecing execVM, but only if the script exists on all machines
the third and worst option is remoteExecing call or spawn and passing the code data
the remote execute function always confuses me so I thought it would be best to write them in an sqf saved to the mission folder and remote execute them.
looking at the wiki, this looks like what I should be doing?
"scripts\examplecode.sqf" call BIS_fnc_execVM;
make a function, then do:
[arguments] remoteExec ["murix_fnc_function", allPlayers];
if the script is on all machines say a mission file then:
[arguments, "scripts\myscript.sqf"] remoteExec ["execVM", allPlayers];
yeah it's in the mission folder so i assume it should be. I'll give it a test
what if you don't have any arguments you need to pass @fair drum ? just pass something like 0?
[0, "scripts\myscript.sqf"] remoteExec ["execVM", allPlayers];```
execVM has a unary syntax too
0 seemed to not muck anything up lol
["scripts\myscript.sqf"] remoteExec ["execVM", allPlayers];
oh right that's easy
see the pinned messages for remoteExec examples
oh wow, thanks yeah looking through that now
thanks Hypoxic and Leopard20, really appreciate it
I feel like I am going insane. https://sqfbin.com/rojusirazuvurasexawo
when this runs, if I spawn in soldier 1 with skeleton a, and then I create soldier 2 with skeleton b, and then call this function, I swap into soldier 2.
When I die, there's about 15s in the respawn screen and then I don't actually choose to spawn, I just automatically spawn back in as soldier 1 with skeleton a. But then at some point after another 10 seconds, I get swapped to a new instance of soldier 1 with skeleton b.
I have no idea why this is happening so I'm just posting this and going to bed, because I have no clue what could be causing it. Any suggestions on how I'm doing selectPlayer wrong are appreciated. basically what I want is to have a function thta you can call with an old and new unit, swap player from old to new unit, and then when new unit dies, swap them back to the old unit's type so that on respawn they have the right skeleton.
Is there a surefire way to detect storage objects like ammo crates for example?
I tried this but it didn't work, i suppose i coulda tried other types.
(_x iskindof "ammocrate")```
there's no such thing as "ammocrate"
Is there any iskindof type that are unique to storage containers? I'm not sure where I found ammocrate.
just look at config viewer:
I guess ReammoBox_F is what vanilla assets use
Reammobox_F is a magic?
wat
"magic variable"
unique to one object type or would it be like refrencing "land" for example?
or "air"
I have no idea what you're trying to say 
if you mean like _veh isKindOf "air", air is also a classname
So like is that classname for a specific object like for example like "Land_houseV_2T1" is a specific type, but would that work in the same manner of "air" which encompasses all the air vehicles?
ahh so that sounds like what i'm after
there's no guarantee it works with non-vanilla assets
ty for pointing me in a direction at least, i'll do testing from here with the ReammoBox_F
Works good for vanilla stuff, i'll test some cup stuff and post back in case anyone in the future is wondering, even though mod stuff generally changes very often
I guess the better way might be checking its vehicle class:
getText(configFile >> "CfgVehicles" >> typeOf _x >> "vehicleClass") == "container"
The "ReammoBox_F" seems to be detecting and working on a few cup containers as well for now, but i appreciate the hell out of the snippet, i'll for sure mess around with that if it winds up needing something better.
Is there a way to determine if the copilot is actually using the vehicles gun or camera (if available)?
currentPilot?
configOf 
That is about controlling the vehicle, not something else.
cameraView seems to be about the player, not others. currentPilot is still not relevant.
actually using
what do you mean "actually using"?
If the copilot is using the gun/camera. Whatever keybind you use to see the camera-view and look around and do whatever you're able to do.
one way is using "pilotCamera" user action event handler, but there might be a better way
pilotCamera seems to be for the player only as well, not for others?
ah so you want to check this for AI? 
technically yes. Or other players.
for AI not possible. For other players you can check if they're moving the camera or something locally and send it over the network... 
So there's no way around having pilot AND copilot using the mod so the communication can happen then.
not sure what you mean 
Are you implying a mod (client-side) can execute code on someone elses machine?
of course it can... 
That sounds scary as hell.
So since I can determine the copilot I can send them what to do. Alright, will look into that.
btw, the server can disable remoteExecution for some commands.
and one more thing, you can't really do "dangerous things" with scripting commands (except for extensions)
Now my goal changes to figuring out if the player is in a camera/gun of a vehicle and then think about how to make the communication work properly.
cameraView isEqualTo "GUNNER" && {player isEqualTo (objectParent player turretUnit [0])}
that should work
Just saw something about the upcoming 2.07 update. Will VisionModeChanged finally allow us to use cameraView to force 3rd or 1st pp in different areas/conditions?
I think I can answer my own question by saying no. Looks like it'll just check for nvg/thermal.
can i disable time synchronisation between client and server? associated with the https://community.bistudio.com/wiki/date command
i want to set a specific client to night-time and another to day-time on the same server
so i thought of just remote executing the necessary setDate command, but the issue is the time sync between server and client
or is time only synced on JIP/mission start?
no can do; such thing is sync'ed automagically every ~5s iirc
A-ha
Then i must set the time every time it chabges before 3d draw call
😀
@winter rose is there an EH for time change, or do i need to make a scripted one?
scripted, no existy
Darn
Well, lets hope that the order of operation for time sync is with the script engine running somewhere inbetween the call to 3d draw and the endine time sync
So that i can nope the time change
it most likely won't happen during a frame
what I think is that you will experience some setDate stutter every 5s
setDate has stutter associated with it?
I thought it was just information passed to the shader stack
Welp, time to reverse engineer the netcode and gimp those time syncs on server side... for personal use ofcourse
What you are after would in most time considered a bug if a desync between time occurs. The game is afterall intended to stay in sync between server and players.
I know, but it would be a neat feature

Oh darn, Lou is now bohemia.net and i tagged him by habit
If you explain what you are trying to achieve perhaps alternatives cn be found that are within the games features
you will be court-martialled for this grievous offence
In case you were not joking its not personal use if you got multiple players.
I did. Im trying to achieve a scenario where some portion of the players experience daytime and some are playing on night-time
a general grievous offence, must I say
Put them into different servers
Too much overhead
Im not made of money
come on, your liver is worth 5k$ at least
Do not say that even jokingly
😒
Also, organ markets are banned here to combst forced organs transfers. Consensual or not. Same applies for going abroad and selling your organs
Anyway, i just wanted to make a scenario where players could experience night and daytime on the same server
tough and glitchy but doable
Looks like the sync frequenzy is 5min
source plz?
(not challenging the claim, but interested to add to the wiki)
that's… time, not weather
yes, the discussion was about time
you can already do that, what? and yes that particular event handler is for thermal stuff
So there is a separate sync in addition to server time
And i forgot the tag on again
🤨
perhaps
that is something I don't know
I guess the only way to know is to ping Dedmen test and see
Tell me which EH fires on 3pp>1pp or vice versa
We made this script like 6 months ago before they added it, no?
Missioneventhandler draw 3d, check if viewmode is desired, if not, chabge
i didn't mean event handler,
Will VisionModeChanged finally allow us to use cameraView to force 3rd or 1st pp in different areas/conditions
i meant you can already script that
actually you can use user action EH now
Viewmode can be chabged without user action eh triggering
I used this exploit to get past exile thermal ban back in the day
But you can still run a missioneh on draw3d where you check the viewmode against something and change if necessary
well that was just an addition to my original statement
and yes, that's the usual solution
The one that works the best
If you do it in draw3d, it can intercept before you get the flickering
Then you probably want to setup one in the user action too, to make sure the screen doesnt do the fade animation
So that tapping 3rd person view doesnt do the vignette effect
But catch anyone trying to exploit with the draw3d check
Thanks for the replies! What's the advantage of running both of those instead of just eachFrame?
Draw3d runs before the 3d draw call. This eliminates flickering if you try to switch to 3rd person. As a missioneventhandler it is also prefered over eachframe eh and oneachframe in terms of performance.
The reason for also doing the action is because arma 3 adds a vidgnette fade from black effect when switching between 3rd and 1st person, so by eliminating the action key, you eliminate the fade from balck from ever being created.
Both is important so that you get a good result and also prevent most common exploiting to bypass it
is there no way to have multiline text with https://community.bistudio.com/wiki/drawIcon3D ?
draw a dummy one? 😄
with empty texture, the text should appear below the first one pretty sure
practically impossible to get correct line spacing with that tho
Any easy script to remove map drawings/markers at all?
you can get the list of markers with https://community.bistudio.com/wiki/allMapMarkers
and run https://community.bistudio.com/wiki/deleteMarker to delete them
btw, I was working with BIS_fnc_compatibleItems some days ago and figured out, to get silencers, I have to write
_muzzles = ["rhs_weap_m92", 101] call BIS_fnc_compatibleItems;
but where do I get this magical number 101 from? I cannot find anything in the wiki about it
Not with that, but you can world to screen the voordinates and have almost the same effect by scaling your text depending on distance
private _cfgWeapons = configFile >> "CfgWeapons";
["rhs_weap_m92"] call BIS_fnc_compatibleItems select {getNumber (_cfgWeapons >> _x >> "itemInfo" >> "type") == 101}
that should work
So I put these pretty simple end conditions together, but I was looking for it to count the overall alive blufor force in both two markers.
_resForce = allUnits select {side _x == west};
_resAlive = _resForce select {_x call FNC_alive};
_resArea = _resForce select {_x inArea "evac"};
if ( (count _resArea > (count _resAlive * 0.4) ) ) exitWith {
"BLUFOR Victory!<br/>The US has managed to extract 40% of their overall forces. Well done." call FNC_EndMission;
};
40% alive extracted is the end condition, but let's say 10% was in marker 1 and 30% in marker 2.
How would I make it check from both, i.e they could win with 40% in one marker or a split between the two?
If you know that 10% are in Marker1 and 30% in Marker2. How much % does that make?
also allUnits select {side _x == west}; → count units west
Have a particles question, trying to simulate a smoke column. I am trying to achieve a couple of things.
First, the column dimensions, depth (length, width) as a function of the bounding box.
Second, I am okay with minor changes in the column angle, but I want to keep the intensity of angular changes to a minimum if possible.
My goal there is for the column to be more of a 'beacon' that players can search for on the horizon, that sort of thing.
So far, based on the fire examples(s), the column has been fairly narrow.
Also, the angles have been pretty 'flat' and changes have been fairly intense, IMO
In general, not really sure what the options are talking about how to influence any of that.
In terms of angle, are we talking about degrees? radians? the fire example would suggest that is radians i.e. rad 30, but the primitive example suggests that is degrees i.e. 45.
https://community.bistudio.com/wiki/setParticleParams
https://community.bistudio.com/wiki/setParticleRandom
40%??
Thing is, I dont know if they'll have 10% in one marker or not.
They could have 20% alive in one and 20% alive in the other.
you already have the solution. But instead of counting from one area you count from however many you have and sum them up before checking.
Yeah. Just do what you did with the first marker, for the 2nd one and add both results
_resArea = _resForce select {_x inArea "evac1"};
_resArea = _resForce select {_x inArea "evac2"};
I could just add that, and then I need to add a check for 40% from both basically?
no
right.
Oh yeah sorry
_resArea = count (_resForce select {_x inArea "evac1"} + _resForce select {_x inArea "evac2"});
private _alive = units west select {_x call FNC_alive};
private _areas = ["evac1", "evac2", "evacblabla"];
private _ratio = 0;
private _aliveCount = count _alive;
if (_areas findIf {_ratio = _ratio + (_alive inAreaArray _x) / _aliveCount; _ratio >= 0.4} != -1) then {
"BLUFOR Victory!<br/>The US has managed to extract 40% of their overall forces. Well done." call FNC_EndMission;
}
Just exlplain like I'm five here, but with the ```sqf
private
Whats the difference between mine above, and yours sharp.
depends on the context
That private would make a change.
it makes the variable private to the current scope
it doesn't need to lookup parent scopes to see if it was defined already or not
so depending on the context, it will be more efficient, though regardless, you should always use private also see https://community.bistudio.com/wiki/Variables#Scopes
not sure if i understood your question correctly
This?
yes
what do you mean by "call the variable from another func"
It's fine. I misunderstood.
private _a = 0;
call {
_a // ok, 0
};
if you mean't that, then no
private _a = 0;
call {
private _a = 1;
hint str _a; // 1
};
hint str _a; // 0
private _a = 0;
call {
_a = 1;
hint str _a; // 1
};
hint str _a; // 1
hope that explains it better
Thank you.
Oh also.
Does anyone know if ACE3 has it's own damage handlers?
Been trying to use the simple player allowDamage false, but to no avail and I imagine it's because of ACE3
ACE3 medical uses custom damage handler but it respects the allowDamage.
For real?
I've tried so many methods to get it to work, to no avail.
I also imaged the dev team would respect the command.
Might be other mods.
I've had it work before.
Odd.
it works in ace without any other mods ¯_(ツ)_/¯
That command, should totally disable ALL damage right?
Including lets say, collision into the work while in a parachute?
yes
Everything but being killed via helicopter tailrotor 😂
AFAIK, allowDamage does not always guard against all damage. For that you need to filter on the damage events themselves. I do that for my debugging in a GOD|MORTAL mode and it seems to work. I even throw in some damage reflection for good measure.
YMMV if ACE is also in the picture, however.
I am also trying for the flames to emit orange red intense color if possible... better still if it is an actual heat soure.
it might work for TI equipment (not confirmed)
Getting a Error in expression <t (_resForce select {_x inArea "evac1"} + _resForce select {_x inArea "evac"}); > Error position: <+ _resForce select {_x inArea "evac"}); >
in lieu of creating the fire/smoke PS?
with doing the fire
huh, well that definitely changes the fire PS itself... so I wonder.
@dreamy kestrel are you familiar with https://steamcommunity.com/sharedfiles/filedetails/?id=1613905318 yet?
interesting, but... three years ago? where is the rest of the code?
it only adds fire damage afaik, and maybe TI heat effect too
no, it definitely seems to change the particle effect as well.
what is the change that you noticed then?
how can i know the total amount of alive enemies in a certain radius
Try with a combination of count, distance and units.
I'm having some trouble getting setObjectscale to work in MP. Below works, but I want my objects to either A. Be hidden/unhidden on demand or B. Get scaled on demand. The objects are static, but are in/on/submerged in water. Any ideas? And yeah I know it's not MP supported but it works for the host, just the clients don't see the effect.
if (isServer) then {
private _simpleObject = this call BIS_fnc_replaceWithSimpleObject;
_simpleObject setObjectScale 3.0;
};
do count (units _side inAreaArray [_origin, _radius, _radius]) should be faster than manually checking it
(i think :D)
ok :D
OK. What is a good event handler to use that only fires once on death and only locally. Am I better off overriding handleDamage and firing if damage > 1?
yeah, I thought Killed as well. But it seems to be inconsistent for me? Or I'm finding some sort of weird edge case with selectPlayer
@copper raven for reference this is my script: https://sqfbin.com/rojusirazuvurasexawo
what I'm trying to do is use selectPlayer to swap the player into another unit, preserving rank/group/name/etc
and then once the unit dies, swap them back into the old unit and then kill the old unit
so that when they respawn, they have the right skeleton
but doing this with the Killed EH doesn't seem to work. What happens instead is on death they respawn automatically (after like 15s) and then get swapped again after 10 seconds
which makes me think that the killed EH is firing multiple times
or that selectPlayer is going onto a queue or something
i think you're overcomplicating things with this and that it could be done a lot simplier
event handlers like killed are persistent, meaning that they will automatically be added to the respawned unit too
maybe that's the issue
@copper raven how would you suggest to do it then?
and yeah that would explain a lot
im looking at that code, and i don't understand what it's supposed to do
😄
where do you run it?
@copper raven runs local to the computer where you want to switch units, you pass it the old unit and the new unit
what do you do in onPlayerRespawn.sqf?
does it do anything related to the code you sent?
is onPlayerRespawn.sqf called with selectPlayer?
no
[_old_unit, _new_unit] call SWAP_WITHOUT_EH; _new_unit setDammage 1;
you swap into _new_unit, and then kill it, this will trigger the respawn event. i kinda grasp what you want to do now, but 
like I was just calling it there because I have some code in there that players need to have running on their units
@copper raven right, but wouldn't if !(isNil "_eh_id") then { _old_unit removeEventHandler ["Killed", _eh_id]; }; delete the EH before it has a chance to run?
Is it possible to enable helicopter rolling feature without advanced flight model ?
I'm working on a script that uses selectRandom to create objectives/tasks, but I want it to be able to spawn more than one task at a time. Here's the script, I tried adding a counter but I think it's pausing the script when it waits for the task to be completed so it doesn't repeat until _counter hits its max:
private ["_mkr_array", "_ObjectiveMrk", "_ObjectiveType", "_grp1"];
_counter = 0;
while {_counter < 4} do
{
_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;
private _objectiveType = call selectRandom [
{
_counter = _counter + 1;
[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";
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;
_counter = _counter - 1;
};
"PATROL"
},
...more objectives here, I erased for space reasons
];
};```
so basically i want it to continuously spawn objectives capping at 3 total but like I said, i think the waitUntil line is stopping the script from doing that?
Quite possible. Try spawning the part where you await completion, that might help.
like so? ```sqf
_handle = [] spawn {
while {{ alive _x } count (units _grp) > 0} do
{
waitUntil {{ alive _x } count (units _grp) == 0};
["task","Succeeded"] call BIS_fnc_taskSetState;
[500,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false];
_ObjectiveMrk setMarkerColor "ColorUnknown";
_ObjectiveMrk setMarkerText "";
["task"] call BIS_fnc_deleteTask;
_counter = _counter - 1;
};
Almost, you also need to pass the _grp and _objectiveMrk variables as parameters.
I don't know why you decrement _counter (three loop iterations should be completed long before any of the tasks is completed, so by the time tasks are completed, the script should have terminated), but if you really need that, it needs to be a global variable.
Ah I see why you decrement _counter. The outer structure of your script is slightly flawed for that purpose, it needs to be more like this:
CPT_Counter = 0;
while {true} do {
if (CPT_Counter < 3) then {
//Create random objective
} else {
sleep 30;
};
};
hmm
I think i may have gotten it working but it's getting more complicated as well
if (!isServer) exitWith {};
private ["_mkr_array", "_ObjectiveMrk", "_ObjectiveType", "_grp1"];
_counter = 0;
while {true} do {
if (_counter < 4) then {
_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;
private _objectiveType = call selectRandom [
{call compileFinal preprocessFile "TS\ts_patrol_fnc.sqf";},
{call compileFinal preprocessFile "TS\ts_banditcamp_fnc.sqf";}
];
} else {
sleep 30;
};
};```
so I need to have it check that the marker isn't already being used for another objective so it doesn't spawn objectives on the same marker twice at once
Is the part where you await completion in the TS\ts_* scripts spawned?
yea
here's one of them:
ts_patrol_fnc.sqf:
_counter = _counter + 1;
[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";
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;
_counter = _counter - 1;
};
"PATROL"```
I don't see a spawn 🙂
(so you're back at your first problem where you create one objective and then wait for it to complete before creating more)
i don't understand how exactly to use spawn here nor how to "pass variables as parameters" :\
me big dumb
do I just add spawn to the fnc scripts, like sqf [] spawn { /OBJECTIVE SPAWN HERE };
yh that works
or
[] spawn myScript;
then for params to pass a var through
// -- myFirstScript.sqf
private _myVar = "Hi";
[ _myVar ] spawn myScript;
then in myScript.sqf
// -- myScript.sqf
params [ "_myVar" ];
diag_log _myVar; // Logs 'Hi' to RPT
@undone dew
private _localVariable = 1234;
[_localVariable] spawn
{
systemChat format ["_localVariable does not exist: %1", isNil "_localVariable"]; // _localVariable does not exist: true
params ["_localVariable"];
systemChat format ["My _localVariable is now: %1", _localVariable]; // My _localVariable is now: 1234
};
^ That example from spawn documentation shows it as well
awesome thanks
will do
No
on the second line, would it be like:
private ["_mkr_array", "_ObjectiveMrk", "_ObjectiveType", "_grp1"];
_ObjectiveMrk = ["marker_1", "marker_2", "marker_3",...] call BIS_fnc_selectRandom;
[ _ObjectiveMrk, _grp ] spawn "TS\ts_patrol_fnc.sqf";
I'm confusd about the spawn because i thought spawn was used to run code after like [] spawn {};
Files export as Code
right... so is that correct? sqf [ _ObjectiveMrk, _grp ] spawn "TS\ts_patrol_fnc.sqf";
no, you'd have to import that file first, spawn accepts the type Code you're passing a String
functionToImport = [] call compileFinal preprocessFileLineNumbers "path\to\function-as-a-file";
[param1, param2, ... paramN] spawn functionToImport
Or in your file you declare the function globally instead and you can use that. i.e.
// someFile.sqf
someFunction = {
params [param1, param2, ...paramN]
// Do something
};
[] call compileFinal preprocessFileLineNumbers "path\to\file";
[param1, param2, ...paramN] spawn someFunction;
there is two ways spawn can be used, inside a script or to call a script
hint "hello world";
spawn {
// some random code to be spanwned
};
hint "hello again";
the script outside of the spawn brackets is unscheduled, you can also spawn an entire script so that the whole script is scheduled e.g.
[] spawn myScript;
// myScript.sqf
hint "hello again";
uiSleep 5;
hint "bye";
With the latter method you can 'hot reload' it if you're just tinkering stuff while the mission is loaded so you don't need to keep restarting your mission
And by that I mean just literally copy and pasting the function code into the debug console and hitting exec
faster to iterate on than reloading your entire mission
using private rn to the var e.g.
private _myVar;
is faster than doing it in the array btw 🙂
if myScript is in a folder, does it still work? Like if it's [] spawn scripts\Myscript.sqf
so
myFunction = [] call compileFinal preprocessFileLineNumbers "scripts\Myscript.sqf";
[] spawn myFunction
i think i see
if (!isServer) exitWith {};
private ["_mkr_array", "_ObjectiveMrk", "_ObjectiveType", "_grp1"];
_counter = 0;
ts_patrol_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_patrol_fnc.sqf";
ts_banditcamp_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_banditcamp_fnc.sqf";
while {true} do {
if (_counter < 4) then {
_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;
private _objectiveType = call selectRandom [
{[ _ObjectiveMrk, _grp ] spawn ts_patrol_fnc},
{[ _ObjectiveMrk, _grp ] spawn ts_banditcamp_fnc}
];
} else {
sleep 30;
};
};
or you can define your scripts in cfgFunctions (https://community.bistudio.com/wiki/Arma_3:_Functions_Library)
and call scripts thats name is fn_myScript.sqf like call tag_fnc_myScript
you dont need to call select random
i don't? wouldn't it use the same marker every time?
or you mean i just don't need "call"
private _objectiveType = (selectRandom [
{[ _ObjectiveMrk, _grp ] spawn _ts_patrol_fnc},
{[ _ObjectiveMrk, _grp ] spawn _ts_banditcamp_fnc}
]);
oh i see
if that works then nice, if it dont (i cant remember if it will then you can do this)
if (!isServer) exitWith {};
private _counter = 0;
ts_patrol_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_patrol_fnc.sqf";
ts_banditcamp_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_banditcamp_fnc.sqf";
while { true } do {
if ( _counter < 4 ) then {
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;
private _objectiveType = selectRandom [ "A", "B" ];
switch ( _objectiveType ) do {
case "A": {
[ _ObjectiveMrk, _grp ] spawn ts_patrol_fnc;
};
case "B": {
[ _ObjectiveMrk, _grp ] spawn ts_banditcamp_fnc;
};
};
} else {
sleep 30;
};
};
it seems to work
ok sound
does the spawning of the scripts work? because otherwise you might need to call _objectiveType
it seems to because I'm getting an error in the scripts that are spawned lmao, I edited it to pass _counter but it's still saying it's undefined ```sqf
private _objectiveType = (selectRandom [
{[ _ObjectiveMrk, _grp, _counter] spawn _ts_patrol_fnc},
{[ _ObjectiveMrk, _grp, _counter ] spawn _ts_banditcamp_fnc}
]);
whats the error
in ts_banditcamp_fnc.sqf:
Error undefined variable in expression: _counter```
it's in there 😦
private _objectiveType = (selectRandom [
{[ _ObjectiveMrk, _grp, _counter] spawn _ts_patrol_fnc},
{[ _ObjectiveMrk, _grp, _counter ] spawn _ts_banditcamp_fnc}
]);
nono look at this example agani #arma3_scripting message
see how i have the params in the new script
otherwise the var does not exist in the new script until we do params
oh right, right
hrm, I added them as params but I'm still getting the same error:
params [ "_ObjectiveMrk", "_grp", "_counter" ];
_counter = _counter + 1;
Still saying _counter is undefined
this is pain
if (!isServer) exitWith {};
private _counter = [];
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 _counter < 4 ) then {
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;
[ _ObjectiveMrk, _grp, _counter ] spawn ( selectRandom _taskTypes );
} else {
sleep 30;
};
};
ts_patrol_fnc.sqf
params ["_objectiveMrk", "_grp", "_counter"];
private _id = groupID _grp;
_counter pushBack _id;
// When task is finished
{
if(_x == _id) exitWith { _counter deleteAt _forEachIndex };
} forEach _counter;
if you're relying on your inner task code to update a value in its parent scope you either make counter global or you make it something that passes by reference and not pass by value
no i updated i mispoke
_counter does not need to be global but for your purposes it should maybe be global
or you can use an array and pass by reference instead
either way you need to realize it has to sync the value back to its parent scope as params passed in are typically not pass by reference but a pass by value
meaning changes inside the child scope does not reflect in the parent scope
at least afaik they are not pass by reference
gotcha, thanks for the explanation
yeah that makes sense now
hrm I've changed the code quite a bit through trial and error. I've got this now, it no longer gives me any errors BUT it will only spawn one objective. It spawns the patrol script first, then the banditcamp script second, but when it goes to ts_banditcamp_fnc.sqf it gives an error saying ts_banditcamp_fnc is undefined... 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
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"
};
ts_banditcamp_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", ["A group of bandits have set up camp in the target area - clear the area of these pests.", "($500) Bandit Camp"], _ObjectiveMrk ,1, 2, true] call BIS_fnc_taskCreate;
_grp = [getMarkerPos _ObjectiveMrk, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_G_F" >> "Infantry" >> "IRG_InfSquad")] call BIS_fnc_spawnGroup;
[_grp, getMarkerPos _ObjectiveMrk, 150] call BIS_fnc_taskPatrol;
_ObjectiveMrk setMarkerColor "colorIndependent";
_ObjectiveMrk setMarkerText "Bandit";
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;
[500,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false];
_ObjectiveMrk setMarkerColor "ColorUnknown";
_ObjectiveMrk setMarkerText "";
["task"] call BIS_fnc_deleteTask;
taskCounter = taskCounter - 1;
publicVariable "taskCounter";
"BANDITCAMP"
};
I'm trying to make a script to notify admins when a blue on blue incident occurs. I've tested this in the editor and appears to work but when I put it on a dedi it no longer works. I'm using initPlayerLocal and initServer for this script as I loosely based it off this video: https://youtu.be/VFTH3tVt6hY Would anyone be able to help me out?
post the script
//InitPlayerLocal
{
if (side _x == West) then {
_x addEventHandler ["Hit", {
_unitName = (_this select 0);
_source = (_this select 1);
unitHit = [_unitName, _source];
publicVariableServer "unitHit";
}];
};
} forEach allUnits;
player addEventHandler ["Hit", {
_unitName = (_this select 0);
_source = (_this select 1);
unitHit = [_unitName, _source];
publicVariableServer "unitHit";
}];
//initServer
"unitHit" addPublicVariableEventHandler
{
private ["_data"];
_notify = [
"maj",
"capt",
"lt"
];
_data = (_this select 1);
_unit = (_data select 0);
_source = (_data select 1);
_split = (name player) splitString " ";
_rank = toLower (_split select 0);
_unitName = name _unit;
_sourceName = name _source;
if (_rank in _notify) then {
systemChat format ["%1 hit %2", _sourceName, _unitname];
};
};
oof. what on earth... 
hahaha have I over complicated it?
first of all, do you only care about player-player or AIs too?
player-player and player-AI if possible
well first of all, "Hit" should be added where a unit is local, and it only triggers on that machine.
second of all, publicVariableServer is outdated and useless now
third of all, you're only printing the message on the server
🤦♂️
for starters, you can try this:
initPlayerLocal.sqf
params ["_player"];
_player addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "", "_instigator"];
[format ["%1 hit %2", name _unit, name _instigator]] remoteExec ["systemChat", 0];
_damage;
}];
it shows player-player messages
if you want AI too you either have to use an EH to detect when a new AI is added (needs CBA) or use a loop
roger I'll give that a go. I've got a CuratorObjectPlaced event handler on my gamemaster module would that work?
well if you place all your AIs like that maybe
Yeah we spawn all out AI through zeus so I assume it would be something along the lines of:
this addEventHandler ['CuratorObjectPlaced', {
if (side _x == West) then {
_x addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "", "_instigator"];
[format ["%1 hit %2", name _unit, name _instigator]] remoteExec ["systemChat", 0];
_damage;
};
} forEach allUnits;}]
A mod would work too just unsure of how to go about it
Of you can, you could add a script to the baseclass Man init that checks if the target is local and if so, adds the EH to it. That would be a pretty good solve it all, in my opinion. Very drastoc and potentially not 100% compatible bit everything
The init runs every time a new instance of that class is created
No matter on what machine
It runs on all machines
So check for locality, and if true, add EH
And this would be done through a mod?
Yes
You cant edit classes from missionnamespace
@little raptor do you see something wrong with that solution i've overlooked?
¯_(ツ)_/¯
I'll do some more testing based on what you guys said, thanks for the help
No problemo, i just dropped in to give my 2 cents
Add HandleDamage EH to all the units that need this logic and the EH has logic to determine if its worthy of broadcasting a notification.
As per the wiki
Triggers when the unit is damaged and fires for each damaged selection separately Note: Currently, in Arma 3 v1.70 it triggers for every selection of a vehicle, no matter if the section was damaged or not). Works with all vehicles. This EH can accept a remote unit as argument however it will only fire when the unit is local to the PC this event handler was added on. For example, you can add this event handler to one particular vehicle on every PC. When this vehicle gets hit, only EH on PC where the vehicle is currently local will fire.
So just have the EHs be added globally, the client that its local will handle it.
If its determine blue on blue, loop through all curators for valid curators that have units attached to them that is not null (would be online players only afaik)
Remoteexec the notification to each of these valid curators
hahaha ahh I'll have to look into how to implement that more as I am pretty new to scripting
I'm having some difficulty with making it so that only the admins can see this message 😕 I'm trying:
params ["_player"];
_player addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "", "_instigator"];
_notify = [
"maj",
"capt",
"lt"
];
_split = (name player) splitString " ";
_rank = toLower (_split select 0);
if (_rank in _notify) then {
[format ["%1 hit %2", name _instigator, name _unit]] remoteExec ["systemChat", 0];
};
_damage;
}];
wat?
["systemChat", 0];
that means remoteExec to everyone
if (_rank in _notify) then {
and your logic is flawed
hahaha I think I see what you mean, so how would I make it only appear in the system chat of those in _notify? (Again apologies I've got only a rough idea of scripting mainly from outdated youtube videos)
private _notify = ["maj", "capt", "lt"];
{
private _player = _x;
private _rank = toLower (((name _player) splitString " ") select 0);
{
if(_rank find _x > -1) exitWith {
[format ["%1 hit %2", name _instigator, name _unit]] remoteExec ["systemChat", _player];
};
} forEach _notify;
} forEach (allPlayers - entities "HeadlessClient_F");
https://community.bistudio.com/wiki/remoteExec 2nd param after the function name is the target environment to remoteExec to
Loop through all players DO:
Loop through all ranks considered admin DO:
if player rank is contained in the ranks that should be considered admin THEN:
remoteExec a notification to the player
END
END
END
However this is easily abusable as anyone can change their name
As previous, if you want to send it to only actual legit admins with a zeus module that they are assigned to, you have to use allCurators and getCuratorAssignedUnit
Or alternatively you can loop through allPlayers and get if they have an assigned curator logic
Either method works and will work more foolproof than substring matching which is also abusable as anyone can change their name
Wow thanks for explaining this, definitely helpful for understanding this all! I do have a question for
if(_rank find _x > -1) exitWith {
[format ["%1 hit %2", name _instigator, name _unit]] remoteExec ["systemChat", _player];
};```
what is does the > -1 means?
_string find _substr
find means to find the instance of the right hand side (the substring) with the left side (the source string)
If it's found inside the left-side then it will return the index of the string that the substr starts in.
Strings are an array of characters, so String[0] represents the very first character of the string
So
"capt" find "cap" // Outputs 0
"acapt" find "cap" // Outputs 1
you could just put in
