#arma3_scripting

1 messages · Page 720 of 1

little raptor
#

¯_(ツ)_/¯

#

this is exactly the same thing with other commands as well

#

they're just operators

austere wigeon
#

hmmm... good point... I guess it's just still unclear to me what side to put certain variables on... or does it not matter?...

austere ocean
#

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 {};
    };
};```
little raptor
#
player setDamage 1; //binary command: "setDamage"
//similar to:
1 + 2;

alive player //unary command: "alive"
//similar to:
+1
austere wigeon
#

So... instead of it being, like, a "function" based language, it's like an "operator" based language? Where you define operators instead of functions?

little raptor
#

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

austere wigeon
#

can my_function from your example be called with variables in front and after it?

little raptor
#

() is not an operator. it's just parentheses

little raptor
#

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

austere wigeon
austere ocean
#

Oh, apologies.

little raptor
austere wigeon
#

Can you define an "operator" without using #define that takes in two variables (one before and after)?

little raptor
#

but using C++ extensions yes

austere wigeon
#

ok, so #define would be the way to go then?

#

C++ extensions?... any docs on this I can read?

austere wigeon
#

Also, last question, in your opinion, what language is SQF closest to? Or is it pretty unique in it's operator-operand structure?

queen cargo
#

Math expressions

#

Quite literally

austere wigeon
#

lol

queen cargo
#

Nothing else

little raptor
#

true 🤣

austere wigeon
#

Truuuuuuu

little raptor
little raptor
austere wigeon
#

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

little raptor
#

well it's not exactly 100% similar

#

maybe my analogy wasn't good... meowsweats

austere wigeon
#

No, it was... I just still think SQF is too vague

little raptor
#

operators may take different left and right arg types

austere wigeon
#

Which is fine... but is this well defined in the docs/biki?

little raptor
#

yes

#

even in the game

little raptor
#

data types are shown on the wiki page

austere wigeon
#

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?

little raptor
#

yep

#

similar to addAction

austere wigeon
#

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)?

little raptor
#

yeah

austere wigeon
#

okay, I think I get it 🙂 thx!

jovial steeple
#

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.

little raptor
#

some effects might be lost tho... + the firing sound

jovial steeple
#

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.

little raptor
jovial steeple
#

From from what I have seen that gets applied to the launcher and not the missile.

little raptor
jovial steeple
#

Will play around with it a bit more.

signal pebble
#

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.

jovial steeple
#

You could record the unit's movements then play those.

signal pebble
#

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.

jovial steeple
# little raptor no it gets applied to the missile

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.

low sierra
#

Thanks.

queen cargo
tough abyss
#

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?

little raptor
tough abyss
fair drum
proven charm
#

not sure if it's my code or what but I get the addMissionEventHandler ["EntityRespawned" to trigger only once in my mission

velvet merlin
#

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

visual brook
#

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

distant oyster
visual brook
#

Ohh thanks

distant oyster
# velvet merlin whats faster with hashMaps in sqf? (for small amount of elements vs "high" numbe...

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
visual brook
#

Is there a way to hide the objects model but still let it move around? as hideObject freezes it

distant oyster
#

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
visual brook
#

Im assuming not right?

true frigate
#

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.

cosmic cipher
#

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

cosmic cipher
#

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.

fair drum
little raptor
visual brook
low sierra
#

When using a listen server, can i run a server only mod? I mean, a mod that is only loaded on the listem server.

pure socket
#

How do you quickly find the functions you need to develop? Thank you very much

pure socket
#

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

low sierra
#

@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.

pure socket
#

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...

little raptor
pure socket
#

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 ().

little raptor
#

there's no such thing as "onKeyPress ()"

little raptor
pure socket
#

Beginner, learning logic by watching the big boys code

little raptor
pure socket
#

i learn c++

#

I don't have any project experience at present

#

I feel very confused when I write again

low sierra
little raptor
# pure socket i learn c++

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
pure socket
#

thanks now i go to read it

#

very thank you

little raptor
#

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 ;

quaint ivy
#

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

little raptor
quaint ivy
copper raven
#

don't see anything wrong there, should work

copper raven
#

You can send additional arguments into the template, where they are applied to title, icon or description using the format command.

quaint ivy
copper raven
#

what?

quaint ivy
#

["PointCaptured",["",_pointName + " has been neutralized by OPFOR"]] call BIS_fnc_showNotification;

#

where do I use the format command here

copper raven
#

the function does it for you

#

title = "%1"
description = "%2"

quaint ivy
#

yet it doesnt work

copper raven
#

yeah, that's a problem on your end, not the function's

little raptor
copper raven
#

maybe your description.ext is setup wrong

quaint ivy
little raptor
#

I know meowsweats
did you verify it's correct?

copper raven
#

print it to be sure

little raptor
#

actually nvm

#

it shouldn't matter anyway

#

it should give you any maybe

quaint ivy
#

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?!?!?!

little raptor
#

or just restarted the mission?

quaint ivy
#

I did

#

or at least thought I did

little raptor
#

you must exit back to eden for description.ext to update

quaint ivy
#

yes i know

#

I think I just forgot that I never exited to Eden

#

im just tired

copper raven
#

it should've thrown an error if the template wasn't defined

quaint ivy
#

sry for wasting your time

quaint ivy
copper raven
#

so you didn't change nothing 😄

copper raven
little raptor
#

gives ""

copper raven
#

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

quaint ivy
#

no guys, my issue was that my title and description in the description.ext were literally just a nil string ""

little raptor
quaint ivy
#

and when I added %1 and %2, I forgot to go back to eden

little raptor
#

nil string ""
that's an empty string

#

not nil string meowsweats

quaint ivy
#

ok

#

I just cant think but yeah

copper raven
#

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" 👌

calm yarrow
#

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

copper raven
#

yes because you're sleeping in unscheduled

calm yarrow
copper raven
#

also 1 > 0, just put true meowsweats

calm yarrow
#

ok

#

@copper raven Works, thanks

dusky owl
#

is there a way modify what Zeus has selected(add a object to the selection, etc.)?

maiden wren
dusky owl
maiden wren
#

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.

dusky owl
#

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.

maiden wren
#

Oh okay... for what reason?

dusky owl
maiden wren
#

But you spawned it using Zeus? Im confused.

dusky owl
maiden wren
#

Oh, so just use something like Zeus Enhanced, it has an "add objects to zeus' module

dusky owl
#

That's not the same thing....

maiden wren
#

What are you trying to achieve by selecting the object?

dusky owl
low sierra
# copper raven yes

I'm glad this can be done! I need to set the server mod in the Launcher parameters?

maiden wren
willow hound
#

You can make an object editable with addCuratorEditableObjects, but I don't see a way to mess with the user's selection.

spark terrace
#

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?

true frigate
#

Is there a way to make a trigger activate when only a certain unit walks through it? for example a guy with variablename Man1

willow hound
#

Man1 in thisList 🙂

true frigate
#

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! 🙂

willow hound
#

Triggers krtecek

copper raven
calm yarrow
#

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
    };
};```
calm yarrow
#

Right now

past wagon
calm yarrow
past wagon
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
past wagon
#
 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
    };
};
copper raven
calm yarrow
copper raven
#

do you use the zeus unit thing?

#

or game master module, and then a seperate unit?

calm yarrow
#

Composition

copper raven
#

so if you don't put the module down, then it works?

#

or what is it?

calm yarrow
#

@copper raven unit init field

copper raven
#

that's not what im asking

#

what makes it not work?

#

you going into zeus interface?

#

i don't get it

calm yarrow
#

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

copper raven
#

i'm missing context here blobdoggoshruggoogly

calm yarrow
#

I might just make them run to a object

calm yarrow
#

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

low sierra
# copper raven yes, via `-serverMod` launch parameter

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...

little raptor
violet gull
#

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.

low sierra
brazen lagoon
#

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)

brazen lagoon
#

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

restive ocean
#

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?

restive ocean
#

thanks

copper raven
#

just use -mod then

unkempt bay
#

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

winter rose
unkempt bay
#

as simple as that, alright thanks 🙂

low sierra
#

Can i change the Launcher language? There is no such option in parameters.

winter rose
still forum
# distant oyster First array, then hashmap: ```sqf private _elements = 100; private _structure = ...

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

cold mica
#

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.

hollow thistle
#

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.

cold mica
#

Thanks for the succinct explanation

fair drum
tough abyss
#

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...

cold mica
calm yarrow
#

their actual name?

#

I'm trying to make AI chase them

tough abyss
upper siren
#

will return the name of player the script is local to

violet remnant
#

what is a good example of a mod that's is using sqfc, than i can take apart to learn about sqfc ?

calm yarrow
#

Do I need the players name in it?

#

Or will it find the player's name

upper siren
#

the object being player

calm yarrow
#

Yes, i'm wondering what the dedicated player name is

#

My AI would run into the sunset

#

If I give them the name "player"

upper siren
#

ehm... 😅 idk, join your server, open debug console and server execute "name player"

#

and see what it returns

#

I'm guessing nothing

calm yarrow
#

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

little raptor
little raptor
#

player is always a null object

fair drum
#

If you let me get home from work I'll help you

willow hound
little raptor
#

ok meowsweats

calm yarrow
fair drum
calm yarrow
#

nearest person

#

specifcally a player

fair drum
#

so you have a group of zombie units that you want all of them to charge when one of them is hurt?

calm yarrow
#

Here, i'll send script

calm yarrow
#
 this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/25)}];
[]spawn {
    while {true} do { 
sleep 4;
Zombie domove getpos  Player,1};
};```
fair drum
#

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

calm yarrow
#

oh

#

Chase the player

fair drum
#

1 zombie or a bunch of zombies

calm yarrow
#

abunch

fair drum
#

and all these zombies are grouped in a single group

calm yarrow
#

Yes

#

So I can spawn multiple without the group limit breaking

little raptor
calm yarrow
fair drum
#

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

calm yarrow
fair drum
obtuse quiver
#

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]; 
willow hound
#

I'd wager }, { is the problem: addAction only takes one script argument, but you have two.

fair drum
#

which I'm assuming red1 is

hollow tinsel
#

Is there a way to Preprocess a string like you can do with a file before compiling it?

obtuse quiver
#

ok i see, thanks to both! :D

hollow tinsel
#

I do not believe that compile supports comments using // or /* and */ and PreProcessor Commands.

obtuse quiver
#
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

little raptor
torpid pike
#

got it lemme refer

open star
#

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.

open star
#

yes.

#

it's a variable in a larger script.

little raptor
#

not code

open star
#

It is the boolean for some ACE Teleport things.

little raptor
open star
#
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.

little raptor
#

seems correct (except you didn't need to make it a global var)

little raptor
open star
#

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.

little raptor
#

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

open star
#

Where does systemChat output normally? I don't think I've done it right or I don't know where it's outputted.

little raptor
#

where other chat stuff is

austere ocean
#

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.

austere ocean
open star
#

Oh god I can't chat in editor singleplayer

#

so, this is all that comes of it.

#

[B Alpha 1-1:1 (Mercury),false]

tired coral
#

mutliplayer > host lan > editor

open star
#

but that's sloow xD

#

Also that doesn't shot systemchat in mulitplayer

little raptor
#

the first element is the caller

open star
#

Right, so what am I changing here instead of having it be the "player"

#

Sorry...

little raptor
open star
#

No that part I did, actually most of it I wrote.

#

a year ago.

little raptor
#

well anyway:

_code = {
  params ["_caller"];
  _caller in "blabla"
};
open star
#

The ForEach statement I had help from another person who just researched more into ASL than me.

unkempt bay
#

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

violet gull
#

Are playActions and switchActions defined in specific animation config values?

little raptor
quick lagoon
#

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.

copper raven
#

handledamage maybe

quick lagoon
#

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.

copper raven
#

well for those cases, you need to detect it yourself

#

it would be nice to have an event handler for it, but oh well

quick lagoon
#

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. :)

little raptor
quick lagoon
#

Oh? How and where do I do that?

little raptor
little raptor
#

Basically 2.07 is what 2.08 stable will be

quick lagoon
#

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.

quick lagoon
still forum
#

(my todo list is long)

quick lagoon
#

confused happy noises

final sun
#

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

winter rose
proven charm
#

why does empty group become null when I set the deleteWhenEmpty to false (when creating it) ?

proven charm
#

i think it's the joinSilent that causes empty group to be deleted (probably a bug...)

weary dirge
#

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!

winter rose
weary dirge
#

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

final sun
copper raven
# weary dirge Right, sorry. For example EH Killed, where if _killer is blufor, then _radio =...

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

weary dirge
#

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!

copper raven
#

unless you do it in group menu thing

weary dirge
#

Yup, already got that part in init.

copper raven
#

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

winter rose
weary dirge
hollow tinsel
# still forum no

Thanks, also with the terrain commands in diag is there a way to get the closest terrain vertex?

still forum
#

do math

winter rose
#

ugh!

hollow tinsel
#

Okay... thanks. Will try and implement it in a different way.

still forum
#

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

hollow tinsel
#

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.

still forum
#

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

weary dirge
#

@winter rose @copper raven It works like a charm guys. Thanks! I have few new hiccups but I'll try them solve myself first. meowtrash

manic sigil
#

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

violet remnant
#

is there a way to tell is sqfc is loading instead of the sqf files ?

copper raven
#

use loadFile to check?

#

or fileExists rather

violet remnant
#

is it guaranteed that the sqfc is used over the sqf ?

copper raven
#

yes iirc

astral lynx
#

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

cunning oriole
#

params to pass through a var into another script

#

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

astral lynx
#

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

cunning oriole
#

oh maybe it does work then sound

#

im prob wrong about the define before you call it thing

#

🙂

somber radish
#

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);

violet gull
#

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;
copper raven
#

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

somber radish
#

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];
little raptor
#

the game AI has been optimized to ignore some sides for performance reasons

little raptor
#

in short, you really can't do it anyway

violet gull
#

wahhh BabyRage

somber radish
copper raven
#

no

little raptor
#

so what you're doing just means nothing

violet gull
#

Well shit.

copper raven
violet gull
#

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

little raptor
#

you can just attach a target object to them I guess

violet gull
#

(at sign)zombie by Zuba

#

Got it from the Steam Workshop. Last updated in 2015 sooo yeah.

little raptor
#

never seen it...

little raptor
#

afaik they don't have that either... thonk

#

so might be another reason why they can't be seen

violet gull
#

Ahhhh interesting, I'll check

little raptor
#

CBA has one

violet gull
#

Yeah I figured that'd be the only way, but wouldn't that be counterproductive of using agents? Or is it not that bad

little raptor
#

well yeah attaching is slow

violet gull
#

It's an idea though, I'll take it into consideration. Thanks Leppy.

#

@little raptor You are correct, bunny doesn't have geometryView LOD

somber radish
#

Found some more resources just in case someone else is interested

still forum
still forum
lyric schoonerBOT
#

Deleting 3 messages.

Done! (This message will self-destruct in 10 seconds.)

winter rose
#

@lyric schooner?

lyric schoonerBOT
copper raven
#

if you use compileScript that is

still forum
#

there could be an error during loading, it will silently fallback to the sqf

copper raven
#

yeah, that's true

modern ginkgo
lyric schoonerBOT
cosmic lichen
#

@cloud sable there isnt

little raptor
#

if you want to change that property, you have to create multiple classes in the config yourself.

modern ginkgo
#

Ok thanks!

low sierra
#

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
#

why are you even using that

#

unless you're in arma2?

#

use remoteExec in arma3

low sierra
#

@copper raven some old code use publicVariableServer, the mission have more than 5 years of development.

copper raven
#

public variable event handler stuff doesn't work in singleplayer

low sierra
#

Ok

#

Thanks for the info.

#

I will get ride of all publicVariableServer.

willow hound
winter rose
#

as in, "on var update, run this code"

ebon citrus
#

Logic is hostile to every faction in arma, even itself. Makes sense.

winter rose
#

hue hue hue

ebon citrus
#

Also, good to see you Lou. I'm glad to be back if just to talk with you again

weary dirge
#

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 derpWolf Any pointers or kind FY is appreciated. Thanks

ebon citrus
#

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

winter rose
weary dirge
little raptor
open star
#

@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"};```
weary dirge
little raptor
open star
#

I mean yeh.. but I don't check often enough.

#

it'll be fineeee

little raptor
weary dirge
open star
#

but I genuinely don't know where it's asking me to put this bracket or where I'm missing one.

winter rose
#

this code is good
you may have some issue somewhere else

open star
#

hmm, likely something I didn't see I'll check through again.

low sierra
#

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.

winter rose
#

aaah, the infamous "my server is dedicated"devs 😁

but, yeah, remoteExec is the way to go 🙂

low sierra
#

On single player, client id is... 0?

#

Like in the editor.

#

I was expecting 2...

winter rose
#

both

cunning oriole
#

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
copper raven
#

no it doesn't?

#

it returns an object

cunning oriole
#

*nearestObjects

#

my b

#

lol

copper raven
#

why are you using that if you only need one object?

cunning oriole
#

ya i just realised it would make more sense to use nearest object when u linked it

#

had missed it haha

#

cheers

tropic mirage
#

Even if you used objects then couldn't you just select the index you were looking for

copper raven
#

yes but why do that when there is a command specifically designed for that

violet remnant
#

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

brazen lagoon
#

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.

brazen lagoon
#

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

little raptor
brazen lagoon
#

what do you mean a normal unit

little raptor
#

soldier

brazen lagoon
#

it's a wh40k marine

#

bis_fnc_objecttype returns ["Soldier","Infantry"]

little raptor
brazen lagoon
#

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)

little raptor
#

very different from what position player does
from what?

brazen lagoon
#

position player

little raptor
brazen lagoon
#

like yeah just doing it for the sake of a quick test

little raptor
#

of course they're different

brazen lagoon
#

yes, but they should be like, a few meters different

little raptor
#

player is now the unit you're controlling

brazen lagoon
#

instead they are thousands of meters different

little raptor
brazen lagoon
#

I'm moving units to 0, 0, 0 after I swap players, so it's returning [0, 0, 0]

little raptor
#

it means you're not even looking at something

brazen lagoon
#

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]

little raptor
#

and what does cursorObject return?

brazen lagoon
#

NOID auto_cannon.p3d

little raptor
#

you're looking at its weapon... meowsweats

#

not the unit itself

brazen lagoon
#

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

little raptor
#

is the weapon too big?

brazen lagoon
#

that must be it

little raptor
#

maybe it works better

brazen lagoon
#

hmm

#

yeah it has to be that I messed something up when looking at the unit with cursorobject

#

thanks for the sanity check leopard

torpid quartz
#

So if I write some code in say a mycode.sqf
What's the correct way of remote executing it for all players?

little raptor
#

not everything needs remote execution

torpid quartz
#

it's stuff like code for side chat text to pop up and BIS_fnc_infoText

little raptor
torpid quartz
#

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;

fair drum
#

if the script is on all machines say a mission file then:

[arguments, "scripts\myscript.sqf"] remoteExec ["execVM", allPlayers];
torpid quartz
#

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];```
little raptor
torpid quartz
#

0 seemed to not muck anything up lol

little raptor
#
["scripts\myscript.sqf"] remoteExec ["execVM", allPlayers];
torpid quartz
#

oh right that's easy

little raptor
torpid quartz
#

oh wow, thanks yeah looking through that now

#

thanks Hypoxic and Leopard20, really appreciate it

brazen lagoon
#

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.

quaint oyster
#

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")```
little raptor
quaint oyster
#

Is there any iskindof type that are unique to storage containers? I'm not sure where I found ammocrate.

little raptor
#

I guess ReammoBox_F is what vanilla assets use

quaint oyster
#

Reammobox_F is a magic?

little raptor
#

wat

quaint oyster
#

"magic variable"

little raptor
#

of its parent

quaint oyster
#

unique to one object type or would it be like refrencing "land" for example?

#

or "air"

little raptor
#

I have no idea what you're trying to say meowsweats

#

if you mean like _veh isKindOf "air", air is also a classname

quaint oyster
#

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?

quaint oyster
little raptor
quaint oyster
#

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

little raptor
quaint oyster
#

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.

quick lagoon
#

Is there a way to determine if the copilot is actually using the vehicles gun or camera (if available)?

quick lagoon
copper raven
quick lagoon
#

cameraView seems to be about the player, not others. currentPilot is still not relevant.

little raptor
#

actually using
what do you mean "actually using"?

quick lagoon
#

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.

copper raven
#

one way is using "pilotCamera" user action event handler, but there might be a better way

quick lagoon
#

pilotCamera seems to be for the player only as well, not for others?

copper raven
#

ah so you want to check this for AI? meowsweats

quick lagoon
#

technically yes. Or other players.

little raptor
quick lagoon
#

So there's no way around having pilot AND copilot using the mod so the communication can happen then.

little raptor
#

not sure what you mean meowsweats

quick lagoon
#

Are you implying a mod (client-side) can execute code on someone elses machine?

quick lagoon
#

That sounds scary as hell.

little raptor
#

¯_(ツ)_/¯

#

also useful

quick lagoon
#

So since I can determine the copilot I can send them what to do. Alright, will look into that.

little raptor
# quick lagoon That sounds scary as hell.

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)

quick lagoon
#

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.

copper raven
#

cameraView isEqualTo "GUNNER" && {player isEqualTo (objectParent player turretUnit [0])}

#

that should work

tired coral
#

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.

ebon citrus
#

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?

winter rose
ebon citrus
#

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?

winter rose
#

scripted, no existy

ebon citrus
#

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

winter rose
#

it most likely won't happen during a frame

#

what I think is that you will experience some setDate stutter every 5s

ebon citrus
#

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

young current
#

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.

ebon citrus
young current
ebon citrus
#

Oh darn, Lou is now bohemia.net and i tagged him by habit

young current
#

If you explain what you are trying to achieve perhaps alternatives cn be found that are within the games features

pliant stream
young current
ebon citrus
winter rose
young current
#

Put them into different servers

ebon citrus
#

Im not made of money

winter rose
#

come on, your liver is worth 5k$ at least

ebon citrus
#

😒

#

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

winter rose
#

tough and glitchy but doable

ebon citrus
winter rose
ebon citrus
winter rose
#

(not challenging the claim, but interested to add to the wiki)

winter rose
ebon citrus
ebon citrus
winter rose
#

no, no wait

#

you get it wrong, serverTime is not at all about daytime

copper raven
ebon citrus
#

And i forgot the tag on again

#

🤨

winter rose
#

perhaps
that is something I don't know

#

I guess the only way to know is to ping Dedmen test and see

tired coral
ebon citrus
#

We made this script like 6 months ago before they added it, no?

#

Missioneventhandler draw 3d, check if viewmode is desired, if not, chabge

copper raven
#

actually you can use user action EH now

ebon citrus
#

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

copper raven
#

well that was just an addition to my original statement

copper raven
ebon citrus
#

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

tired coral
#

Thanks for the replies! What's the advantage of running both of those instead of just eachFrame?

ebon citrus
# tired coral Thanks for the replies! What's the advantage of running both of those instead of...

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

velvet merlin
copper raven
#

draw a dummy one? 😄

#

with empty texture, the text should appear below the first one pretty sure

still forum
#

practically impossible to get correct line spacing with that tho

bright robin
#

Any easy script to remove map drawings/markers at all?

copper raven
spiral temple
#

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

ebon citrus
copper raven
#

that should work

cobalt sorrel
#

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?

cosmic lichen
#

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

dreamy kestrel
#

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

cobalt sorrel
quick lagoon
#

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.

cosmic lichen
#

Yeah. Just do what you did with the first marker, for the 2nd one and add both results

cobalt sorrel
#
_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?

cosmic lichen
#

no

cobalt sorrel
#

right.

cosmic lichen
#

_resArea1
_resArea2

#

or

cobalt sorrel
#

Oh yeah sorry

cosmic lichen
#

_resArea = count (_resForce select {_x inArea "evac1"} + _resForce select {_x inArea "evac2"});

copper raven
#
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;
}
cobalt sorrel
#

Just exlplain like I'm five here, but with the ```sqf
private

#

Whats the difference between mine above, and yours sharp.

copper raven
#

depends on the context

cobalt sorrel
#

That private would make a change.

copper raven
#

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

cobalt sorrel
#

ooooooh

#

So if it isn't private, I can call the variable from another func??

copper raven
#

not sure if i understood your question correctly

copper raven
#

yes

cobalt sorrel
#

Then that answers my question haha

#

No then

copper raven
#

what do you mean by "call the variable from another func"

cobalt sorrel
#

It's fine. I misunderstood.

copper raven
#
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

cobalt sorrel
#

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

hollow thistle
#

ACE3 medical uses custom damage handler but it respects the allowDamage.

cobalt sorrel
#

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.

hollow thistle
#

Might be other mods.

cobalt sorrel
#

I've had it work before.
Odd.

hollow thistle
#

it works in ace without any other mods ¯_(ツ)_/¯

cobalt sorrel
#

That command, should totally disable ALL damage right?
Including lets say, collision into the work while in a parachute?

cosmic lichen
#

yes

hollow thistle
#

Everything but being killed via helicopter tailrotor 😂

dreamy kestrel
dreamy kestrel
cobalt sorrel
dreamy kestrel
winter rose
dreamy kestrel
#

huh, well that definitely changes the fire PS itself... so I wonder.

velvet merlin
dreamy kestrel
winter rose
dreamy kestrel
#

no, it definitely seems to change the particle effect as well.

winter rose
#

in which way? heat effect?

#

heat "haze" iirc?

dreamy kestrel
#

I did not notice any, at least not in thermals.

#

or if there was a shimmer, dunno

winter rose
#

what is the change that you noticed then?

meager epoch
#

how can i know the total amount of alive enemies in a certain radius

willow hound
#

Try with a combination of count, distance and units.

lilac hemlock
#

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;
};

copper raven
#

(i think :D)

meager epoch
#

ok :D

brazen lagoon
#

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?

brazen lagoon
#

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

#

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

copper raven
#

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

brazen lagoon
#

@copper raven how would you suggest to do it then?

#

and yeah that would explain a lot

copper raven
#

where do you run it?

brazen lagoon
#

@copper raven runs local to the computer where you want to switch units, you pass it the old unit and the new unit

copper raven
#

what do you do in onPlayerRespawn.sqf?

#

does it do anything related to the code you sent?

brazen lagoon
#

is onPlayerRespawn.sqf called with selectPlayer?

copper raven
#

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 blobdoggoshruggoogly

brazen lagoon
#

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?

outer yarrow
#

Is it possible to enable helicopter rolling feature without advanced flight model ?

undone dew
#

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?

willow hound
#

Quite possible. Try spawning the part where you await completion, that might help.

undone dew
#

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;
       };
willow hound
#

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.

willow hound
undone dew
#

hmm

undone dew
#

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

willow hound
#

Is the part where you await completion in the TS\ts_* scripts spawned?

undone dew
#

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"```
willow hound
#

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)

undone dew
#

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 };

cunning oriole
#

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

undone dew
#

awesome thanks

cunning oriole
#

🙂

#

if you get stuck let us know

undone dew
#

will do

undone dew
#

I'm confusd about the spawn because i thought spawn was used to run code after like [] spawn {};

vague cipher
#

Files export as Code

undone dew
#

right... so is that correct? sqf [ _ObjectiveMrk, _grp ] spawn "TS\ts_patrol_fnc.sqf";

vague cipher
#

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;

cunning oriole
vague cipher
#

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

cunning oriole
undone dew
cunning oriole
#

so

#
myFunction = [] call compileFinal preprocessFileLineNumbers "scripts\Myscript.sqf";

[] spawn myFunction 
undone dew
#

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;
        };
};
cunning oriole
cunning oriole
undone dew
#

i don't? wouldn't it use the same marker every time?

#

or you mean i just don't need "call"

cunning oriole
#
        private _objectiveType = (selectRandom [
            {[ _ObjectiveMrk, _grp ] spawn _ts_patrol_fnc},
            {[ _ObjectiveMrk, _grp ] spawn _ts_banditcamp_fnc}
        ]);
undone dew
#

oh i see

cunning oriole
#

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;
    };
};
undone dew
#

it seems to work

cunning oriole
#

ok sound

#

does the spawning of the scripts work? because otherwise you might need to call _objectiveType

undone dew
#

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}
]);

cunning oriole
#

whats the error

undone dew
#

in ts_banditcamp_fnc.sqf:

Error undefined variable in expression: _counter```
cunning oriole
#

oh right ig its running then

#

make sure u add _counter to params

undone dew
#

it's in there 😦

#
        private _objectiveType = (selectRandom [
            {[ _ObjectiveMrk, _grp, _counter] spawn _ts_patrol_fnc},
            {[ _ObjectiveMrk, _grp, _counter ] spawn _ts_banditcamp_fnc}
        ]);
cunning oriole
#

see how i have the params in the new script

#

otherwise the var does not exist in the new script until we do params

undone dew
#

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

vague cipher
#

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

undone dew
#

yeah that makes sense now

undone dew
#

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"
};

torn beacon
#

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?

torn beacon
#
//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];
    };
    
};
little raptor
#

oof. what on earth... meowsweats

torn beacon
#

hahaha have I over complicated it?

little raptor
torn beacon
#

player-player and player-AI if possible

little raptor
# torn beacon 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

torn beacon
#

🤦‍♂️

little raptor
# torn beacon 🤦‍♂️

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

torn beacon
#

roger I'll give that a go. I've got a CuratorObjectPlaced event handler on my gamemaster module would that work?

little raptor
#

well if you place all your AIs like that maybe

ebon citrus
#

Dont forget vehicles

#

😀

#

I presume you dont want to do this in a mod?

torn beacon
#

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

ebon citrus
#

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

torn beacon
ebon citrus
#

You cant edit classes from missionnamespace

#

@little raptor do you see something wrong with that solution i've overlooked?

little raptor
#

¯_(ツ)_/¯

ebon citrus
#

Well, i guess it cant be super bad, then

#

I've been doing it this way until now

torn beacon
#

I'll do some more testing based on what you guys said, thanks for the help

ebon citrus
#

No problemo, i just dropped in to give my 2 cents

vague cipher
# torn beacon I'm trying to make a script to notify admins when a blue on blue incident occurs...

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

torn beacon
torn beacon
# little raptor for starters, you can try this: `initPlayerLocal.sqf` ```sqf params ["_player"];...

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;
}];
little raptor
#

that means remoteExec to everyone

#

if (_rank in _notify) then {
and your logic is flawed

torn beacon
# little raptor wat? > ["systemChat", 0];

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)

vague cipher
#

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");
#

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

torn beacon
vague cipher
#

_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