#arma3_scripting

1 messages Β· Page 645 of 1

still forum
#

Is that the right syntax for dbPrepareQuery? Again don't have docs in head.

reef grove
#

should be

still forum
#

You can remind me in 9 hours when I can look at the docs

reef grove
#

ok

#

pretty much copy & pasted from the docs

hollow thistle
#

Umm you don't have problem with interceptDb. You have a problem with basic sql. You can't use prepared statements to define columns and table.

#

Unless that "prepare" is not using mysql driver but some custom logic (which I doubt it does) stuff like this won't work.

still forum
#

Should be myself driver yeah

#

And I think "surname,uid" is a invalid column name anyway

hollow thistle
#

That whole query is invalid

#

Prepared statements are there to secure you from weird user input with SQLi (not only) , not build the query dynamicaly.

still forum
#

People tend to take the path of least resistance.
Tell people to use eh.. these server defined functions, or to hardcode queries in config file and not define them in scripts because that's unsafe.

People will ignore all safety and pluck it down to just make it work quick.

If I'd let them store database login credentials inside scripts inside their mission pbo, they totally will do that.

reef grove
#

@hollow thistle thanks for clearing that up, in the past I've only really used SQL in PHP (where you can use prepared statements to define columns and tables) so I though the same behavior would work here.

hollow thistle
#

You can't do it in php, at least not in mysql

#

It's entirely handled by db driver lib. Runtime does not matter.

#

I hope you were not joining strings from user input. ;P

#

This kinda explains basics of prepared statements.

reef grove
#

welp i was joining strings from user input

#

how bad is that lmao

hollow thistle
#

Terrible

reef grove
#

SQL injection didn't work

#

i know that for sure

hollow thistle
#

Don't call that prepared statement.

reef grove
#

I'm sure theres some security threat other than sql injection in that case, what is it?

fair drum
#

is there a command to restrict fire modes on infantry weapons?

final storm
#

with a mod yes, with sqf it gets a little tricky maybe play around with weaponState

topaz field
#

is Say3D Global?

robust hollow
#

no

#

you can check that for most commands on the wiki

fair drum
#

well to be fair, it also has the global tag there too so I could see how he could get confused

topaz field
#

I didnt know those represented it. it was that I was just on some forums and people were mentioning the difference in things etc

fair drum
#

so I keep getting the following error on mission start

23:46:51   Error position: <removeAllContainers _unit;
removeAllAssi>
23:46:51   Error removeallcontainers: Type String, expected Object

yet when I run the function in the mission, everything works fine. I have the function in question on a preinit cfgfunctions and I'm calling the function for every unit on a side in the init.sqf

#

the only param given to the function is an object

robust hollow
#

preinit and init.sqf? if _unit is _this#0 then may it be the string that preinit gives as _this#0?

fair drum
#

I mean, I don't think the function is getting fed that string. I'm calling it with:

//init.sqf

//Maga Loadouts

{
    [_x] call hyp_fnc_maga_loadout;
} forEach (allUnits select {side _x == independent});

//Trumper Loadouts

{
    [_x] call hyp_fnc_trumper_loadout;
} forEach (allUnits select {side _x == civilian && typeOf _x == "C_man_1"});

both functions have the same params and lines at that section where the removeAllContainers is at

#

I think you are right, let me rearrange some stuff here and see if it goes away. I'll take it out of preInit

robust hollow
#

you said you have it on preinit though

#

so in cfgfunctions get rid of preinit=1; and it should be fine

reef grove
#

how do I get a return value from remoteExec

robust hollow
#

assuming you mean from the function you remoteExec, not the jip id remoteExec returns... another remoteExec to send result back to a new fnc. or a public variable targeted at the remoteExecOwner

reef grove
#

ahh alright I was just wondering if there's a better way of doing it

robust hollow
#

there is no getting the return from remotely executed code from the remoteexec command, because remote execution isnt instant

pliant stream
#

You can easily do it with promises though

umbral nimbus
#

Ah yes that solves 80% of it.
Any idea to get some feedback from a virtual firesupport thingy? so spawned in shells.

royal spruce
#

how would I go about making a translator role with ACRE 2's babel system?

#

i know acre_api_fnc_babelSetSpokenLanguages exists, but i'm trying to apply it to two variables, zeus and translator.

quartz coyote
#

Hi, I'm using this from BIS_fnc_establishingShot but can't get the message to display...

#

It'll display only 1/10 times

#

and display for some people but not for all

#

I literally didn't change anything to the script

robust hollow
#

my first guess would be something wrong with the conditions on line 10 or 51.

#

you should add logs in and around those lines to see how far people make it when the script runs

#

i usually copy paste diag_log format["%1 %2",__LINE__,__FILE__]; everywhere so i know exactly which lines are/nt executing

quartz coyote
#

you were right, condition on line 10 ...

#

Thanks

mental prairie
#

I found a script for the spectrum device in multiplayer. Somehow, it refuses to track any targets, despite everything being set properly. Does anyone want to take a look?

worn forge
#

@mental prairie some functions are only available when you're running the Contact expansion.

mental prairie
#

It’s a script, it does not involve any module whatsoever.

exotic flax
#

A module is also a script, and as Ryko said, some functions are only available when you have the Contact DLC so it's possible it doesn't work properly without it.
Additionally; the functions/modules from Contact have not been dissected fully yet, so any scripts build on it might not be working completely or require additional manual work.

long hatch
#

Hello i am a very beginner when it comes to scripting. I try to preconfigure some ACE Slideshows as function but when i call the function i get Error Generic Error in Expression can some one maybe give me a hint where i need to look

params [
    ["_slideObjects", [], [[]] ],
    ["_slideControllers", [], [[]] ]
];

[
    [_slideObjects], 
    [_slideControllers], 
    [
        "z\tr\addons\s3\data\slide1\tr1m1_01_co.paa",
        "z\tr\addons\s3\data\slide1\tr1m1_02_co.paa"
    ], 
    [
        "Slide1",
        "Slide2"
    ], 0, "Training 1"
] call ace_slideshow_fnc_createSlideshow;
exotic flax
#
params [
    ["_slideObjects", [], [[]] ],
    ["_slideControllers", [], [[]] ]
];

[
    _slideObjects,       // is already an array
    _slideControllers,   // is already an array
    [
        "z\tr\addons\s3\data\slide1\tr1m1_01_co.paa",
        "z\tr\addons\s3\data\slide1\tr1m1_02_co.paa"
    ], 
    [
        "Slide1",
        "Slide2"
    ], 0, "Training 1"
] call ace_slideshow_fnc_createSlideshow;
long hatch
#

thanks i was never think about it ^^ i'm so stupid πŸ˜„

vague geode
#

Is there any way to get the localization of the menu buttons? I would like to tell people where they can find and change the Custom Controls-key bindings...

little raptor
#

if you want to use them in your mod, it's really easy because they're already localized
for example, the OPTIONS button in pause menu:

getText (configFile >> "RscDisplayInterrupt" >> "controls" >> "ButtonOptions" >> "text")
exotic flax
#

anything from the vanilla game can be found in \a3\ui_f\config.cpp (or other ui_f_*), and the translation strings in \a3\language_f\stringtable.xml (or other language_f_*)

vague geode
dusky pier
#

Hi, i trying to make an AI logic for animal, but have problem,
I think is something like 2 fsm's on this animal (default arma animal fsm) and my custom.

Is possible to disable default fsm for given animal?

winter rose
dusky pier
#

@winter rose i do, just after creation animal. But this animal is still doing something (i think is default fsm), maybe i doing something wrong:

bear = createAgent ["Brownbear_F", getPosATL player, [], 0, "NONE"];
bear setVariable ["BIS_fnc_animalBehaviour_disable", true];
[bear] execFSM "bear.fsm";
winter rose
dusky pier
#

hm, understood

thank you! I will try to define my fsm into animal config, maybe it will help

#

by logic - this (default animal fsm) must be listed in diag_activeMissionFSMs?

winter rose
#

unsure

fair drum
#

i wonder... if given a red, blue, green, or yellow wire to cut for a defuse without given any hints, which is more likely to be chosen by a player.

little raptor
#

Each has a 25% chance to be selected 🀷

winter rose
little raptor
#

When all of them have the same probability, each of them is just as likely to be selected

fair drum
#

sure if its a computer, but humans have bias

granite zealot
#

He's talking about people associating colors with purposes

winter rose
#

by a player being the key here

little raptor
#

I know what he's talking about.
there's no way to tell. it's completely random

winter rose
#

my bet is on blue and green top, while red is rock bottom

fair drum
#

yeah i think red is rock bottom lol

little raptor
#

red would've been my first choice

#

see?

winter rose
#

so?

little raptor
#

so I just picked red randomly

fair drum
#

i bet even with n = 30, we could see a winner by a significant amount

winter rose
#

(@little raptor)
yeees…? we are wondering what the masses would choose, a single example is pointless!

granite zealot
#

Why though, would the bomb builder use red because people would associate it with a live (aka positive) ? Or does a bomb builder care about norms and use blue as a neutral.

winter rose
#

red may either scare people away (red = danger, forbidden) or make them associate danger = red = cutting red = cutting danger

granite zealot
#

Or is it a double bluff..

fair drum
#

yeah I don't know which way I want to go for this one. do I follow the trope of red = live, or do I do the opposite?

#

or will i be even more mean and make 4 choose 2? lol

granite zealot
#

The bomb builder is already playing mind games using 4 wires, the bomb probably doesn't speak SPI

winter rose
exotic flax
#

It also depends on the type of color blindness πŸ€”

still forum
finite sail
#

in fluitkettels Dynamic Enemy Population scripts, the wire to successfully disarm the IEDs is completely random - you've got a 1 in 3 of getting it right

still forum
#

:U yes

sacred slate
#

can i place a small composition of some units random on the map without scripting?

still forum
#

but you're asking how to do stuff without scripting in the scripting channel πŸ™ƒ

#

in editor you can set probability of presence, set a chance that says whether the object spawns

#

place multiple locations, set chance down so that only one probably spawns on one of the locations you placed it at

sacred slate
#

thx

fair drum
#

from 1 to 2 is two iterations correct? or do i have to do from 0 to 2

winter rose
#

1 to 2 is two iterations yes

reef grove
#

so this might be a really stupid question, but is there any way I can group items of the same type in an array together? or more specifically make an array inside the array with a count

For clarification, here's an example:


3x Item_1
2x Item_2
1x Item 3
1x Item 4```are all put into an array together by using nearestObjects, and the array ends up looking like this:
`["Item_1","Item_1","Item_1","Item_2","Item_2","Item_3","Item_4"]`
but what I want is to get the array like this 
`[["Item_1",3], ["Item_2",2], ["Item_3",1], ["Item_4",1]]`
#

so essentially go from [element1,element2,elementN] to [[element1, count],[element2, count], [elementN, count]]

sacred slate
#

how will zbe cache or bsi dyn sim behave while intensive unit switching?

true frigate
#

Hey so im trying to make a blackout effect, but its not going so well, this is all inside the On Activation field in a trigger.

_lightypes = [
"Lamps_base_F", 
"Land_LampAirport_F", 
"Land_LampSolar_F", 
"Land_LampStreet_F", 
"Land_LampStreet_small_F", 
"PowerLines_base_F", 
"Land_LampDecor_F", 
"Land_LampHalogen_F", 
"Land_LampHarbour_F", 
"Land_LampShabby_F", 
"Land_PowerPoleWooden_L_F", 
"Land_NavigLight", 
"Land_runway_edgelight", 
"Land_runway_edgelight_blue_F", 
"Land_Flush_Light_green_F", 
"Land_Flush_Light_red_F", 
"Land_Flush_Light_yellow_F", 
"Land_Runway_PAPI", 
"Land_Runway_PAPI_2", 
"Land_Runway_PAPI_3", 
"Land_Runway_PAPI_4", 
"Land_fs_roof_F", 
"Land_fs_sign_F"
];  
for [{_i=0},{_i Λ‚ (count _lighttypes)},{_i=_i+1}] do  
{  
   _lights = getMarkerPos "Blackout" nearObjects [_lighttypes select _i, 500];  
   {_x setDamage 0.95} forEach _lights;  
};```
#

It returns an error within that. And im really new to scripting so i cant find it myself haha

queen cargo
deft dock
#

@true frigate
tip: if you use 3 strokes at the beginning and end, you get
codeblock

reef grove
deft dock
#

nvm πŸ˜„

true frigate
reef grove
#

assuming you went where I told you and not your actual install directory they should be right there

true frigate
#

I have mpstatistics

#

but those are the only .log files

reef grove
#

the logs are the .rpt files in the screenshot you sent me

#

right click and open them in n++ or notepad

#

@true frigate

true frigate
#

ohhh thank you haha

reef grove
true frigate
#
];  
for [{_i=0},{_i Λ‚ (count _types)},{_i=_i+1}] do  
{  ```
reef grove
#

thats not the full error

#

the full error should end with something like file at line ##

true frigate
#

According to discord

#

my error message is 3731 characters long

reef grove
#

uhhhh

#

the error is probably looping

#

it should probably only be like 5 lines long

true frigate
#

Ohhh they have timestamps

reef grove
#

5-10 lines

true frigate
#

let me copy all from one second, its just an error - expression - position - missing

#
];  
for [{_i=0},{_i Λ‚ (count _types)},{_i=_i+1}] do  
{  
 >
22:53:59   Error position: <Λ‚ (count _types)},{_i=_i+1}] do  
{  
 >
22:53:59   Error Missing ;
22:53:59 Error in expression <"Land_fs_sign_F"  
];  
for [{_i=0},{_i Λ‚ (count _types)},{_i=_i+1}] do  
{  
 >
22:53:59   Error position: <Λ‚ (count _types)},{_i=_i+1}] do  
{  
 >
22:53:59   Error Missing ;```
robust hollow
exotic flax
#

Error Missing ;

reef grove
#

^

true frigate
#

stupid question, i know im missing a ; . but where exactly am i missing it? because i put it at the end of do and it returns the same error

#

again im very new to scripting - as is probably obvious by now.

reef grove
#

i dont think you're missing a semicolor I think its syntax

robust hollow
#

the other for syntax is faster iirc

for "_i" from 0 to count _types - 1 do {```
reef grove
#

but i dont do much with for loops

true frigate
robust hollow
#
Result:
0.0064 ms

Cycles:
10000/10000

Code:
for [{_i=0},{_i<5},{_i=_i+1}] do {}
Result:
0.0023 ms

Cycles:
10000/10000

Code:
for "_i" from 0 to 5 do {}
#

much faster

true frigate
#

now i need to figure out why the lights arent actually turning off

#
_lightypes = [
"Lamps_base_F", 
"Land_LampAirport_F", 
"Land_LampSolar_F", 
"Land_LampStreet_F", 
"Land_LampStreet_small_F", 
"PowerLines_base_F", 
"Land_LampDecor_F", 
"Land_LampHalogen_F", 
"Land_LampHarbour_F", 
"Land_LampShabby_F", 
"Land_PowerPoleWooden_L_F", 
"Land_NavigLight", 
"Land_runway_edgelight", 
"Land_runway_edgelight_blue_F", 
"Land_Flush_Light_green_F", 
"Land_Flush_Light_red_F", 
"Land_Flush_Light_yellow_F", 
"Land_Runway_PAPI", 
"Land_Runway_PAPI_2", 
"Land_Runway_PAPI_3", 
"Land_Runway_PAPI_4", 
"Land_fs_roof_F", 
"Land_fs_sign_F"
];  
for "_i" from 0 to count _types - 1 do {
   _lights = getMarkerPos "Blackout" nearObjects [_lighttypes select _i, 500];  
   {_x setDamage 0} forEach _lights;  
};```
#

the hint works fine, so everything is triggering and im not getting any visible errors

little raptor
#

for "_i" from 0 to count _types - 1 do {
_lights = getMarkerPos "Blackout" nearObjects [_lighttypes select _i, 500];
{_x setDamage 0} forEach _lights;
};
wat?

#

use forEach

true frigate
#

i am

exotic flax
#
for "_i" from 0 to count _lighttypes - 1 do {
little raptor
#
{
   _lights = getMarkerPos "Blackout" nearObjects [_x, 500];
   {_x setDamage 0} forEach _lights;
} forEach _lighttypes;
exotic flax
#

^^ even better

true frigate
#
_lightypes = [
Youve seen this, ill spare the spam, it hasnt changed
];  
for "_i" from 0 to count _types - 1 do 
{
   _lights = getMarkerPos "Blackout" nearObjects [_x, 500]; 
   {_x setDamage 0} forEach _lights; 
} forEach _lighttypes;```
#

is it like trying to teach a brick wall?

#

πŸ˜‚

little raptor
#

remove the for

true frigate
#

better than my friend, he didnt have notepad installed. Somehow managed to remove notepad from windows

#

dont ask how because im not sure 🀣

robust hollow
#

scripting on windows notepad 😬

exotic flax
#

scripting 😬

true frigate
#

Notepad++ is my go to for general stuff

#
{
   _lights = getMarkerPos "Blackout" nearObjects [_x, 500]; 
   {_x setDamage 0} forEach _lights; 
} forEach _lighttypes;```
#

better? πŸ˜‚

robust hollow
#

no

#

get rid of "_i" from 0 to count _types - 1 do

little raptor
#

remove the whole for loop I meant meowsweats

true frigate
#

ohhhh lol

#
_lightypes = [
a lotta lights
]; 
{
   _lights = getMarkerPos "Blackout" nearObjects [_x, 500]; 
   {_x setDamage 0} forEach _lights; 
} forEach _lighttypes;```
#

hopefully the last time i have to post this lol, trying not to be too much of an idiot

exotic flax
#
if switch while else then do {
   // your code
} forEach count throw try sleep;

🀣

still forum
winter rose
true frigate
#

Ahhh its all good theyre better than me πŸ˜‚

winter rose
#

they butter be helpful or I fite'em πŸ‘€ πŸ˜„

exotic flax
#

btw... the code in the channel description needs to change...

IF (script == true) THEN {chat here};
``` it returns an error 🀣

```sqf
if (_scripting) then {systemChat "here";};
``` looks way better
robust hollow
#

not since 2.00

still forum
#

Not everyone is good at teaching and explaining.
Many people here are experts on a high level, usually not dealing with so low level problems.
And it's been years they've been at that level, not remembering what they would've needed to get told to understand something

still forum
true frigate
#

okay now i dont know if ive got the light names wrong, because its still not working

still forum
#

Try changing the setDamage 0 to a setDamage 1.
It won't work as you want to, but atleast you should see effect

#

The light types I saw look correct, atleast the majority

true frigate
#

but if the lights are "alive" then wont that just make them "alive" again

still forum
#

Depends on the terrain tho, but I guess you're testing on altis or Stratis

true frigate
#

Chernarus, it might use different light names

winter rose
true frigate
#

I shouldve specified that

#

Oh really? i thought damage 0 was

#

ohhhh

#

i get it

#

damage 0 means no damage taken

still forum
#

Uh. Not sure. It's likely there are atleast some lights that will work on cherno.
I don't know what lights they exactly use

true frigate
#

doesnt look like it had any effect 😦

#

let me try with an eden placed light, that way i can get the exact name

still forum
#

There is a better way to write it with isKindOf (the nearestX command that does that) most lights inherit common class.
Dunno it's name

#

I wrote a blackout script a few months ago.

#

@dolph man did you have the lights script?

still forum
#

Fkin phone

#

Can someone ping Dolph man for me?

little raptor
#

@acoustic turret ☝️

true frigate
#

okay no its my script thats the issue, even with the correct light name, it didnt register

#

no damage

#
_lightypes = [
"Land_PortableLight_double_F",
];  
{
   _lights = getMarkerPos "Blackout" nearObjects [_x, 500]; 
   {_x setDamage 1} forEach _lights; 
} forEach _lighttypes;```
still forum
#

Do you know how the debug console works?

little raptor
#

I wonder if nearestObjects is faster?

robust hollow
#

it doesnt return all lamp types

true frigate
still forum
#

Try out just your nearObjects line in debug console and see if you get what you expect

little raptor
#
_lights = nearestObjects [getMarkerPos "Blackout", _lighttypes, 500]; 
#

I think that's faster

true frigate
still forum
#

@acoustic turret reeee.
Did you have the blackout, lights out script?

Answer plox 🐬

true frigate
#

wait is the debug just the box that pops up when you hit esc in game?

still forum
true frigate
#

Cuz right now all thats in there is Qwfsm`

little raptor
#

try what I wrote

#

one line

#

nearestObjects [getMarkerPos "Blackout", _lighttypes, 500];

true frigate
#

not sure what that is lmao

#

okay

robust hollow
little raptor
#

and define _lighttypes too

still forum
#

Read message

acoustic turret
#

ok sec

true frigate
#

Error, type any, expected array

robust hollow
#

a quick test in tanoa main city has nearestObjects returning 102 objects and nearObjects combined returning 202

acoustic turret
still forum
acoustic turret
#

i cheese everything and hardly do anything "for real" lol

little raptor
still forum
acoustic turret
#

its all under a thin curtain thats good for 99% of players

#

maximum cheese

#

doin 1-2 missions weekly for years no time for script

still forum
#

Then I dunno who has it.
Maugrim probably sleep.

My lights out script works on many terrains :u

acoustic turret
#

i thought kirito has one ?

#

at least mason told me that he does

true frigate
#

Okay so

acoustic turret
#

cause i asked mason if he has one, than was too lazy to implement it and cheesed it anyway but mason said that kirito has one

true frigate
#

This is what i put in the execute box

#

getMarkerPos "Blackout" nearObjects ["Land_PortableLight_double_F",500];

#

and this is what it returned

#

[20566b37580# 1033497: portablelight_double_f.p3d]

acoustic turret
#

does this work for preplaced map lamps only or for editor placed ones too ?

little raptor
still forum
#

I found it!
Forget about it working everywhere tho. It's crap and I can't believe that came from me...

{
private _lamps = thisTrigger nearObjects [_x, 5000]; //radius in metern, thisTrigger kann auch variablenname von objekt sein
{_x setDamage 1} forEach _lamps;
} foreach ["Lamps_Base_F","Land_PowerPoleWooden_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_small_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampSolar_F", "Land_LampStreet_small_F", "Land_LampStreet_F", "Land_LampAirport_F", "Land_PowerPoleWooden_L_F", "PowerLines_base_F"];

Power Outage script von Dudemen
Funkioniert super in trigger

#

I thought I had something more fancy.
Maybe I should slep

acoustic turret
#

is that only for lights ? or what does it affect

#

ah i see

#

normal lamp

still forum
robust hollow
acoustic turret
#

na i was looking for a emp script thats what i asked mason for

still forum
#

I think the above was the one that didn't work for fuel stations

true frigate
#

Could i use _lighttypes instead of portablelight?

acoustic turret
#

affecting radios as well

still forum
#

Not in nearObjects I think. It only takes one type

#

The others are talking about nearestObject which can take your multiple types, but apparently there might be some issue with it?

true frigate
#

so getMarkerPos "Blackout" nearObjects [_lighttypes, 500]; wouldnt work?

little raptor
#

no

robust hollow
#

dont, it doesnt work as well

true frigate
#

ah

#

nevermind

still forum
#

But it also didn't work in the mission, had to manually fix it blobderpy

true frigate
#

so i know the issue isnt my nearobjects

#

maybe the damage?

acoustic turret
#

i remember it would not stop and we had problems getting the radios workin again

still forum
still forum
still forum
true frigate
#

should i try {_x setDamage 1} forEach _lighttypes; in the debug?

#

or do a specific?

still forum
#

Lighttypes won't work

#

They are strings, you can't setDamage on a string, only on an object.
Just try your whole script in debug console

crude vigil
#

@true frigate

hint "Initiating blackout. Standby for transformer overload...";
_lightypes = [  >>>>>>>>>>>>>>>>>>>>>>>>> Find the diff
"Land_PortableLight_double_F",
];  
{
   _lights = getMarkerPos "Blackout" nearObjects [_x, 500]; 
   {_x setDamage 1} forEach _lights; 
} forEach _lighttypes; >>>>>>>>>>>>>>>>>>>>>>>>>>> Find the diff
#

_lightypes != _lighttypes

still forum
#

LOL

#

Well.

true frigate
#

me confusion

still forum
#

Double check your variable names

winter rose
#

*unconfuses @true frigate*

still forum
#

this was not very effective

true frigate
#

cheers 🀣

crude vigil
#

Well sometimes a fresh look just help... for hours u get confused thinking hardcore details, then it turns out stuff like this

true frigate
crude vigil
#

it is why taking a break is good

true frigate
#

Wait did i mistype a variable name...

still forum
#

Oh tip, notepad++, double click your variable names so it highlights other places where you used the same.

Can show typoes really easily.

#

Just click around a bit while staring at the screen, instead of just staring

true frigate
#

ughhhhh one uses light types and the other uses light ypes UGHHHHHH

#

i see it now

hollow thistle
#

Also camelCase helps spotting issues light this

true frigate
#

if it works first try now im gonna facepalm into next week

hollow thistle
#

Or snake_case

true frigate
#

....

still forum
#

Well I got a meeting to attend in about 9 hours so I better sleep.
You have a good typo and frustration littered day/night.

true frigate
#

it worked

still forum
true frigate
#

πŸ˜‚

#

Thank you @crude vigil for pointing out my idiocy

queen cargo
still forum
hollow thistle
#

No, plugin buggy

queen cargo
#

but plugin can be fixed if one does it

still forum
crude vigil
#

as I said, fresh eyes see different ^^

#

take a break :P

true frigate
#

Will do haha

#

thank you

#

Okay, so the majority of the lights are disabled, good news, its working

#

bad news, there are still some lights not listed under my Lighttypes

still forum
#

Which ones?

#

Lights embedded in buildings are hard.
For example fuel stations

true frigate
#

Warehouse lights it looks like

#

id send a screenshot but its not allowed here

still forum
#

You can send link to image

true frigate
#

oh theyre just outside of a store

still forum
#

Are they part of the building? Or seperate objects

#

Part of building is annoying, and might actually not even be solvable

true frigate
#

does this work? not sure

still forum
#

Yes works. And yes is part of building

true frigate
#

if need be

still forum
#

You'd need to setHitPointDamage which I can't explain now.

You can also get rid of the building completely

true frigate
#

i can destroy the building. For my backstory its a war torn city

#

but not sure how that ties into a blackout lol

#

or how i find the object name of the building

still forum
#

Object name is easy

#

Go in-game, aim at the building

#

Go to debug console and execute

typeOf cursorObject

#

Have fun, good night Peeposleep

true frigate
#

Thank you for your help everyone πŸ˜„

cerulean cloak
#
[
    tp_1,
    "To Roof",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeoff2_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeoff2_ca.paa",
    "tp_1 distance _target < 3",    
    "_caller distance _target < 3",
    {},
    {},
    {_caller setpos getpos tp_2},
    {},
    [],
    1,
    0,
    false,
    false,
] call BIS_fnc_holdActionAdd;

I'm having an issue with that hold action in a object init field mentioning a missing [. Can anyone give me hand here?

robust hollow
cerulean cloak
#

Ah...

#

Is there any way for me to add a hold action to an invisible object?

robust hollow
#

not added to the object, but you could add the action to the player and only show it if near the object

#

depends on what you mean by invisible though. actions wouldnt work if the object is hideObject true i believe, but objects that are just invisible/textureless models should still work. i know the invisible wall works with actions

cerulean cloak
#

I just want an interaction on an object that can't be seen. I tried clicking the show model box in the attributes but the interaction wouldn't show

hushed tendon
#

Anyone have any clue on how to decrease the size of trigger over time? I'm trying to make a battle royale styled zone.

exotic flax
#

if you used createTrigger to create the trigger you should be able to update the size with setTriggerArea

reef grove
#

how can I append a value to an array inside an array

#

specifically all arrays inside an array

robust hollow
#

like this?

{_x pushBack _value} forEach _array
hushed tendon
exotic flax
#
_curSize = worldSize / 2;
_minSize = 25;
_steps = 10;

// create trigger at center of terrain
_trigger = createTrigger ["EmptyDetector", [worldSize / 2, worldSize / 2, 0]];
// make trigger fill the terrain
_trigger setTriggerArea [_curSize, _curSize, 0, false, -1];

_running = true;
while {_running} do {
   sleep 30; // wait 30 seconds
   // don't make trigger smaller... end of round
   if (_curSize <= _minSize) then { _running = false; };
   // get new trigger size
   _curSize = (_curSize - _minSize) / 100 * _steps;
   // set new trigger size
   _trigger setTriggerArea [_curSize, _curSize, 0, false, -1];
};

something like this

hushed tendon
#

I'm not sure how I should change _curSize for a 65 by 155 area

exotic flax
#

that is a very strange size for an area in a battle royal style system πŸ€”

#

although you can easily modify the script to have an X and Y value

hushed tendon
#

Not exactly a battle royale, just a shrinking border.

#

oh I think I know how to do it now

warm hedge
#

lineIntersectsSurfaces would be the answer

sage dawn
hollow thistle
#

Also the VR BallsSpheres with transparent texture.

loud birch
#

is BIS_fnc_showMissionStatus local or global?

#

its wiki page doesn't actually say

winter rose
#

local

winter rose
loud birch
#

wow that was fast

#

thanks!

winter rose
harsh vine
#
ammocrate = createVehicle ["B_CargoNet_01_ammo_F",[], 0, "NONE"];
_ammocrate = createVehicle ["B_CargoNet_01_ammo_F",[], 0, "NONE"];
addMissionEventHandler ["Draw3D", {
        drawIcon3D [
            "",
            [1, 1, 1, 0.5],
            getPos _crate,
            1,
            1,
            0,
            "LOADOUT Drop",
            2,
            0.0325,
            "PuristaSemibold",
            "center",
            FALSE
        ];

}];

ammocrate will work but not _ammocrate maybe because it local (idkπŸ™„ ) is there a way to get it to work (locally) i call the script more than once, and i would like for each crate to get its own marker

willow hound
sleek nova
#

Hello all! I am having some difficulties trying to create an explosion when a player defuses a bomb with an addaction. For some reason the explosion does not do any damage to the player that is doing the addaction, but the other players around him do get damage. Here is my code.

Inside BR_fnc_SpawnBomb:

if !(isServer) exitwith {};
// Spawn bomb
_bomb = (selectRandom "Land_Suitcase_F") createvehicle (getmarkerpos _bombspawn);
// Add action to defuse bomb for all units WEST(I took out the rest of the pieces of the addaction as it is not relevant to the question)
[_bomb, "<t color='#FFD25525'>Defuse bomb</t>", {_this call BR_fnc_BombDefuse}] remoteExec ["BIS_fnc_holdActionAdd",WEST,true];

Inside BR_fnc_BombDefuse (executed local on player that did the addaction):

_bomb = _this select 0;
// Execute BR_fnc_DeleteAll globally.
[_bomb, true] remoteExec ["BR_fnc_DeleteAll", 0, true];

Inside BR_fnc_DeleteAll (executed globally):

_bomb = _this select 0;
_explode = _this select 1;
// Let the server create the explosion vehicle
if (isserver && _explode) then {
    [_bomb] call BR_fnc_BombExplode;
};

Inside BR_fnc_Explode (executed by server):

_bomb = _this select 0;
_explosions = ["DemoCharge_Remote_Ammo_Scripted","SatchelCharge_Remote_Ammo_Scripted","ClaymoreDirectionalMine_Remote_Ammo_Scripted"];
// Select a random explosion
_choice = selectRandom _explosions;
// Based on https://community.bistudio.com/wiki/createVehicle example 6
_explosion = _choice createVehicle position _bomb;
_explosion setDamage 1;
little raptor
little raptor
#

and one more thing:

_bomb = _this select 0;
_explode = _this select 1;
params ["_bomb", "_explode"];
sleek nova
little raptor
sleek nova
little raptor
#

as mentioned, replace position with the appropriate position alternative

#

it could be the issue

sleek nova
#

i will try that thank you so much

little raptor
#

for example, use:

ASLtoAGL getPosASL _bomb
solar shore
kindred hemlock
#

If I want to do so AIs won't enter a specific area
Anyone got a good method?
Basically the players need to defend an area but that's difficult when AIs can just walk through the walls

young current
#

How are the walls made?

#

Properly set up and placed objects are the only thing that can block movement.

valid abyss
#

Hello everyone!, i'm making a respawn script and i keep getting an error saying "Generic error in expression" if Respawn_Point isn't equal to "plane", does anyone know why?
if (Respawn_Point == "plane") then
{

finite sail
#

if respawnpoint is an onbject, "planw" is a string (or maybe a marker)

#

they are different datatypes, so generic error

valid abyss
#

"plane" is a string and Respawn_Point is a variable

#

how can i fix it?

finite sail
#

cant compare things that aren't alike

#

its a variable? that's not helpful.. is it an array? a position? an object?

valid abyss
#

oh sorry, its a string(i think), this is what i've put in the init
Respawn_Point = "plane";

#

i hope this helps

finite sail
#

it doesnt πŸ™‚

valid abyss
#

i can send the script if you want

finite sail
#

brb, lunchtime

valid abyss
#

alright

finite sail
#

you need to get your head around datatypes, tbh

valid abyss
#

thanks il check it out now

finite sail
#

this lists them, open each one to see what they are for

valid abyss
#

its a position, ive almost got it figured out now

finite sail
#

which one is a position?

valid abyss
#

Respawn_Point

#

i set it to the variable name of an object and it started working

finite sail
#

ok, so it's actually an array that has numbers? [123234, 76547643,0] for example?

valid abyss
#

maybe, i tried an array but i gave me an error saying "array given, expected object, number, string, "etc..

finite sail
#

ok, i'm worried you've got rid of the error by throwing stuff at it, rather than understanding what was wrong and how you fixed it

#

something which we all do sometimes πŸ™‚

valid abyss
#

i did throw stuff at it

finite sail
#

hehe

valid abyss
#

well at least its working

#

for now

high silo
#

How do I find out the current ammo of a player and put it in a box for them? Its for a resupply script, but dont want just every bit of ammo under the sun

finite sail
#

just to save any confusion, you're asking about magazines, ammo is something different

#

but bear in mind, that will only get magazines they have, it might be better to get the magazines from all the weapons they are carrying if you want to strategically fill an ammo box for them

spiral temple
#

I have a small question about

systemTime

when calling it on the server, time of the server is given - but is it true, when calling it on the client, the time of the client is given?

I want to create a permanent text on screen which shows the current date and time of the client (for easier support, when showing screenshots)

hidden heron
#

Hello! I want to make a mission where I have to kill all my enemies in a building. My issue is the task is not workink (when the enemeis dead mission is success) and they are always leaving the building. Can someone send a link abaut how can i set the ai to not leave the building and when they are all dead the mission is success?

high silo
finite sail
#

primaryweapon player

#

will get the rifle

#

secondaryweapon player will get the tube

#

not sure how to get the pistol

#

having got those, you'll need to get which magazine each uses

high silo
#

Got it cheers

finite sail
#

primaryWeaponMagazine

#

will return the magazine of their primary, but (and this is an assumption)

#

ONLY if they have one of the magazines in their inventory

#

which I don't think is what your wafter

high silo
#

Okay will read through that wiki too, thankyou

finite sail
#

πŸ™‚ good luck

high silo
#
_mags = magazines player;
 _mag = ( selectRandom ( _mags ) );
_crate addMagazineCargoGlobal [_mag , (random 10)];
``` Seems to be working thankyou
finite sail
#

remember though

#

if the player has NO magazines of their rifle,

#

this wont work

high silo
#

Yup

little raptor
#

@valid abyss
use isEqualTo instead of ==
and make sure Respawn_Point is defined
if not, replace it with:

(missionNamespace getVariable ["Respawn_Point", ""]) isEqualTo "plane";
finite sail
#

he's mixing case in his string names... I'd be using == instead of isequalto right now

#

string == string is case insenstive

#

iirc

little raptor
#

yes, but the actual problem is he's mixing types

finite sail
#

yeah, i think he's fixed it, but doesnt know how he fixed it

#

which is less than ideal

little raptor
# hidden heron Hello! I want to make a mission where I have to kill all my enemies in a buildin...

use doStop to stop the AI from moving:
https://community.bistudio.com/wiki/doStop
(they may stay move to take cover, which means they may still exit the building)

as for how to win, there are many ways, such as triggers, event handlers, etc.

for example, for the trigger version, you can place a server trigger with:
activation: "EAST", "NOT PRESENT" (
_trigger setTriggerActivation ["EAST", "NOT PRESENT", false])

on activation code: mission completion code, for example: "EveryoneWon" call BIS_fnc_endMissionServer;

You may need another trigger with the opposite activation for losing ("ANYPLAYER", "NOT PRESENT")

and the event handler method involves using the "Killed" event handler.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPKilled
It could be a bit harder to get this to work (especially for beginners), but it's the preferred method

I'm not a mission maker so I'm not sure if there are easier and better ways to do it via Eden for example

valid abyss
tough abyss
#

I have a small issue that maybe some folks out here could help me with

#

I have this _vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive. _vehicle enableVehicleSensor ["ActiveRadarSensorComponent",false]; _vehicle enableVehicleSensor ["IRSensorComponent",false]; _vehicle enableVehicleSensor ["VisualSensorComponent",false]; _vehicle enableVehicleSensor ["PassiveRadarSensorComponent",false]; _vehicle enableVehicleSensor ["LaserSensorComponent",false]; _vehicle enableVehicleSensor ["NVSensorComponent",false]; [_vehicle] call life_fnc_clearVehicleAmmo;

#

The disableTIEquipment works

#

life_fnc_clearVehicleAmmo works and is called fine

#

but for some reason

#

all of the enableVehicleSensor are ineffective

#

but when i run them manually clientside they work too 🀑

#

anyone has any idea why?

winter rose
#

local command?

little raptor
winter rose
little raptor
#

life_fnc_clearVehicleAmmo

#

it is

exotic flax
#

perhaps his tag is life 🀣

little raptor
#

life == ban

winter rose
#

no, it is not a l*fe issue

exotic flax
#

quickly registers dead as my person tag

winter rose
#

which might be 90%, but not 100%.

little raptor
#

I thought they're all illegal

finite sail
#

its a tricky one, isnt it... life mods pushed a2 from nowhere to the top of the charts and made BI a considerable amount of money, yet almost all of the nonlife community actively shun it

winter rose
#

there are even officially monetised servers

but that's offtopic πŸ˜‰

finite sail
#

which is 100% illegal

winter rose
finite sail
#

offtopic

tough abyss
exotic flax
#

so it's a local command, which needs to be executed on all clients

tough abyss
#

meh, so there's no way around to execute it globally?

exotic flax
#

unless you rewrite the RV Engine... I'm afraid not

tough abyss
#

well ok, thanks πŸ˜„

#

and would be glad to discuss with people "hating" on life in #offtopic_arma πŸ™‚

finite sail
#

hate? perhaps not hate... despise, maybe πŸ™‚

supple vine
#

I'm sure somebody made it - static weapon recoil. Any refrence script?

#

Did it use _veh animateSource ["mainTurret", add recoil here, 0.01]; or something else?

little raptor
#

are you sure it's not just cam shake?

supple vine
#

I mean legit static weapons recoil

#

It seems quite intuitive that somebody would do that

#

But now after lurking some time it seems that it's impossible?

little raptor
#

yes it is.
the closest thing you can get is cam shake

supple vine
#

😭

plain patio
#

i have a question which has probably been answered before, but how would i add a teleport script to an object without needing an external notepad doc with the code in it?

robust hollow
#

write all the code on the object

#

the "notepad doc" is just so it is easier to read and edit

plain patio
#

so what i'd write in notepad would instead go into the innit part of the object?

robust hollow
#

yea

#

normally you would put the addaction command on the object and reference the sqf file. but in this case you would put the code in place of the file path

plain patio
#

ah i see

#

so replace the spot the sqf file name is with the code and it should work as it would with an sqf

robust hollow
#

yes

#
this addAction ["action name",{
    // code
}];```
plain patio
#

ah awesome

normal abyss
#

Anyone know of ways to interact with specific items in someones inventory such as using the MagazinesDetail command? I've been trying to track certain items based off their ID but I want to see if it's possible to drop them via script or transfer them specifically via script.

formal brook
#

How do I make the AI automatically use their Night Vision and IR?

little raptor
#

and they only use IR when in combat mode

formal brook
#

So During the night, they automatically turn it on?

normal abyss
#

Adding and removing create a new ID since they are technically not the same thing anymore. Is it possible to persist the ID?

little raptor
little raptor
#

anything you put is the inventory is a string

#

it has no ID

normal abyss
#

The unique ID they are made with whilst using magazinesDetail

little raptor
#

why do you want the ID?

normal abyss
#

Like I said I'm tracking the based off ID, essentially using that ID to have a work around of not being able to use Setvariable on items.

winter rose
#

it's internal usage, and afaik not MP-sync

little raptor
#

IDs are useless

#

they're only used internally by the engine

winter rose
#

(and if you drop/pick-up, it may be different, unsure about that and within which restrictions)

little raptor
#

plus, I think if you transfer an item in the inventory, it'll change

normal abyss
#

Ah so they are essentially assigned client side?

#

I've tested transferring through inventories they remain the same, but if the ID's don't match up in MP or are internal I guess there's not much more I can do with it.

finite sail
#

@normal abyss are you trying to track what happens to a particular magazine?

#

where it goes, who has it etc?

normal abyss
#

Essentially, I've got a custom item setup in CfgMag, I know TFAR essentially does it by defining 1000 unique ones, but I'm just looking into other ways to do that.

eager prawn
#

Working on some multiplayer scripting. Running into an issue with localization and order of initialization.

What I want to do is have some values that are tracked at the server level, and then a "laptop" object with an addAction that allows you to show that value via a hint.

Right now, I declare the variables and setup the handlers for them in the initServer.sqf - however, my singleplayer method of having addActions in the object init of the laptop doesn't work, because objectInit is initialized prior to initServer.

Is the "recommended" method to instead put my addactions in init.sqf (which I believe is initialized after initServer.sqf?)

robust hollow
#

idk about recommended, but if it works then sure.

#

according to the wiki initServer does execute before init.sqf, but idk if it actually completes execution before init.sqf starts because it is scheduled, so that is something to consider. wiki says it does but ive never tested it myself.

eager prawn
#

@robust hollow just tried it, unfortunately it doesn't work.

#

My add action hint is still returning "any" instead of the proper %1 param

robust hollow
#

oh, the server variable is in the action code?

eager prawn
#

Yeah

robust hollow
#

you need to use publicVariable after setting them in initServer

eager prawn
#

ah

#

silly me

robust hollow
#

and again if they ever update

eager prawn
#

They update via an event handler, set in initServer.sqf

#

This is my initServer.sqf (or, a snippet of the relevant code)

lane1targets = [target1_1, target1_2, target1_3, target1_4, target1_5]; 
for "_i" from 0 to 4 step 1 do {(lane1targets select _i) animate["terc", 1]};
lane1score = 0; 
target1_1 addEventHandler ["Hit", {lane1score = lane1score+1}]; 
target1_2 addEventHandler ["Hit", {lane1score = lane1score+1}]; 
target1_3 addEventHandler ["Hit", {lane1score = lane1score+1}]; 
target1_4 addEventHandler ["Hit", {lane1score = lane1score+1}]; 
target1_5 addEventHandler ["Hit", {lane1score = lane1score+1}]; ```
#

And I'd like to return lane1score in the addAction, so in init.sqf I have:
rangePC addAction ["Lane 1 Score", {hint format ["Lane 1: %1 out of 5", lane1score]}];

#

do I have to declare lane1score as a publicvariable in the initServer.sqf, or do I only have to declare it when in init.sqf?

robust hollow
#

you use publicVariable every time after you set the variable.

#

though given how frequently hit can fire it might get a bit hazardous for the network

eager prawn
#

So do I have to put it in the eventhandler?

robust hollow
#

yes. every time you set the variable.

eager prawn
#

target1_1 addEventHandler ["Hit", {lane1score = lane1score+1; publicVariable lane1score}];

#

Does that look right, in my initServer.sqf?

robust hollow
#

publicVariable "lane1score"

eager prawn
#

target1_1 addEventHandler ["Hit", {lane1score = lane1score+1; publicVariable "lane1score"}];

robust hollow
#

and after you set it to 0

eager prawn
#

I will try that now! Should only take 5-10 minutes to implement

tiny wadi
#

No question but holy cow! Hashmaps!

#

Thank you!

#

Can't wait for it to come off of dev branch

winter rose
#

@fallen thunder post in the appropriate channel, whatever its activity. Thanks

finite sail
#

that too

still forum
finite sail
#

my point was that life mods and by extension, dayz transformed the arma world

#

and the company

still forum
ebon citrus
#

Wow, hashmaps

#

That's quite late, though

#

Couldve used this a lot earlier

still forum
ebon citrus
#

Can you fix the actions next

#

There are so many actions that flat out dont work

#

Well, i say so many... but it's probably just a few

#

I just happen to need these actions and none of them ended up working

#

Some worked halfway and some didnt work at all

still forum
#

no

little raptor
#

because it'd be too late πŸ€ͺ

winter rose
#

plz add sqc

tidal swallow
#

Could someone help em with this error 2021/01/13, 12:04:57 File mpmissions\__cur_mp.Malden\addons\ACS\resources\definitions.hpp, line 6: '/RscListbox.sizeEx': Missing ';' at the end of line 2021/01/13, 12:04:57 Error context rowHeight = 0.03;

#

I tried to run it in visual code but cannot get language for hpp

#

oh also...sizeex has been fixed

#

2021/01/13, 12:04:23 Warning Message: File addons\ACS\resources\definitions.hpp, line 8: '/RscListbox.': ';' encountered instead of '=' 2021/01/13, 12:04:23 Warning Message: Config : some input after EndOfFile.

#

there is also this error

robust hollow
#

i'd start by removing the ; off line 12

tidal swallow
#

ok

#

done

#

@robust hollow do you have any idea for the second error? I have no idea how can it even occur because for me, everything seems ok

robust hollow
#

fixing line 12 stops all errors for me

tidal swallow
#

ok awsome thank you πŸ˜„

#

I'll try asap

little raptor
#

does it even exist in the game?

#

I've never seen it

tidal swallow
#

The way i would do it is place units in eden editor that are in the side you want. Even with mods, not all factions are on every side (Obviously), so this would be my solution. Place an player object and mark it as player/playable in it's attributions. Maybe someone else has a different solution

little raptor
#

wat?
what does it have to do with sideFriendly ?

tidal swallow
#

And in arma, sides are not labeled as friendly/enemy/neutral. Only indipendante can have attributes set to be enemy/friendly with west or east

#

This is to set the relations between the factions.

#

If I'm correct

#

@robust hollow What app did u use to check hpp

robust hollow
#

cfgconvert

winter rose
tidal swallow
#

thank you

#

Yeah i used wrong expresion... I did wrote that sideFriendly is to set relations between sides

winter rose
tidal swallow
#

@winter rose U helped me a lot here. And I know you know a lot. So could you maybe help me with 2021/01/13, 12:38:33 Error context #line 1 "addons\vcom\cfgFunctions.hpp" 2021/01/13, 12:38:33 Warning Message: File description.ext, line 740: '.': '{' encountered instead of '=' 2021/01/13, 12:38:33 Warning Message: Config : some input after EndOfFile.

#

line 7 is line 740 in desc.ext

winter rose
#

line 6, you start a block

#

out of nowhere

tidal swallow
#

i should delete that right

#

ok thank you πŸ˜„

finite sail
#

chaps.. does anyone know the effective range of a Titan AT? I can't get a lock beyond 2KM, but can fire an unlocked much further.. I'm wondering how far they will go and damage their target before being deleted?

little raptor
#

combine these and you'll get how far they'll go

winter rose
#

locks are also limited by the object draw distance

finite sail
#

yeah, ive cranked up object draw distance as high as it will go

#

cant get a lock beyond 2000m... 2KM is what the field guide says is the range of a Titan AT

#

but I've got unlocked Titan kills beyond that

#

just wondering how far they will go

winter rose
#

It does not say "you cannot use it afar", only "cannot lock over 2km"

finite sail
#

yes

#

thats what i meant

little raptor
#

it's easy
you need to write a simple equation for projectile motion with quadratic drag and thrust

there are two times to consider:
t <= thrustTime -> thrust > 0
t > thrystTime -> thrust = 0

finite sail
#

you are mocking me now lol

little raptor
#

I'm serious

#

it's easy

#

here I'll just write it for you

finite sail
#

ok, so time to live gives, not unsurprisingly a time, not a distance

#

I'd need to know the velocity of the round... i think i'll just test it in mission and get an imperical answer πŸ™‚

winter rose
#

may also depend on loss of velocity, angle, etc πŸ˜„

finite sail
#

yes, the missile isnt launched at cruiseing speed

#

ill test it in mission, I think

little raptor
#

@finite sail

solution in MATLAB:

t = thrustTime;
v0 = initial velocity
k = drag coefficient
T = thrust
(make sure you change these vars to sqf equivalents)

#define tanh(X) ((exp(2*(X)) - 1)/(exp(2*(X)) + 1))

v = (T^(1/2)*tanh(T^(1/2)*k^(1/2)*t))/k^(1/2);
x = 1/2/k*ln((T-k*v0^2)/(T-k*v^2));

t = timeToLive - thrustTime;
v0 = v from last equation:

v = 1/(k*(t + 1/(k*v0)));
x = -ln(v/v0)/k;
```(this x must be added to the x from the previous equation to get total travel distance)


this is not an accurate equation because it assumes that the projectile moves straight.
the full equation of motion doesn't have an explicit solution.
if you want you can check out some articles. for example:
https://www.atiner.gr/journals/sciences/2014-1-2-2-Chudinov.pdf
finite sail
#

gulp

little raptor
#

and you can find the drag coeff from here:
v

finite sail
#

wow, thanks for looking that up

#

its way beyond my paygrade lol

#

probably be quicker for me to test in game... so far, a titan will hit at 3,2 km

#

i think teh game models top attack and direct attack mode... at least you can switch between the 2, not sure if the flight path is actaully different

#

aha

#

the round detonated before the end of a 4km flight

#

so between 3.2 and 4

finite sail
#

~3300

#

is about the limit of a SACLOS titan AT

ebon citrus
#

why you have to do me like this? Got my hopes up...

grizzled lagoon
#

Hello, I have a problem with a remoteexeccall, normally I never do with this kind of call but I had to make a stupid error. The problem comes from the declaration of the functions I think but I declared it both in the cfgremoteexec and in the config cpp on the server side

little raptor
grizzled lagoon
#

non sorry is translate is not #define is this F(INO_fnc_scommande,SERVER)

ornate fern
#

does anyone know the command for an ai to surrender and put their hands up? i only know the scripting command setCaptive but there it just changes the sides to civilian. other way is to zeus it, set the surrender state manually. but i want activate it with a trigger so four ais surrender at the same time...looked into the bi commands list but cant find it...

ornate fern
#

@little raptor thanks man. Is this mp compatible? How do i set it up in a trigger? I mean the activation field. If my unit has the variable s1 and i want him.to surrender on the radio command Alpha, what do i have to type in?

s1 action ["Surrender"]
???

little raptor
#

and your trigger must be executed by one client

#

preferably the server

onyx elm
#

Hey guys, I've been building out a mission with the ALiVE mod lately and when I go to add in the Dynamic Groups stuff to IniServer.sqg and InitPlayerLocal.sqf but it just seems to break my missions lobby and makes it unable to select any of the player slots to actually begin the mission with.

Any thoughts? Am I missing a step or something important elsewhere?

I just did what the BIKI says, doing option 1 for both files.

https://community.bistudio.com/wiki/Arma_3:_Dynamic_Groups

#

it also seems to work fine locally on an MP server hosted on my computer but when I put it up to the dedicated server thats when I get the issue.

exotic flax
#

Is BIS_fnc_setUnitInsignia still bugged in MP (especially JIP), because for some reason it doesn't set the insignia on dedicated servers...

spiral temple
#

is there a way to let BIS_fnc_dynamicText permanent? just set the seconds higher then the server is online?

little raptor
stuck jungle
#

Does anyone know how to script in custom respawn loadouts? I have 1 working but I cant add in more than 1. It just will not show up. I'm using BIS_fnc_addRespawnInventory

little raptor
stuck jungle
#

Should I send my Description and Init files?

#

I'm quite new to this so I cant really explain what I have done. I just referenced tutorials

#

Ahh Its to large bare with

#

Sorry for being vague I don't have a clue what I'm doing I stayed up all night trying to figure this out

little raptor
#

call the function twice

#
{
  [west, _x] call BIS_fnc_addRespawnInventory; 
} forEach ["TGAF1", "TGAF2"];
#

naturally, if you want more than these two, add them to the array

#

["TGAF1", "TGAF2", "TGAF3", ...]

stuck jungle
#

Ok thanks I'll give it a go

stuck jungle
little raptor
#

you can add it wherever you want it to execute

#

if it was in your init, then yeah, replace it there

stuck jungle
#

I'm getting a error saying [BIS_fnc_addRespawnInventory] "TGAF2" not found in CfgRespawnInventory or CfgVehicles

cosmic lichen
#

did you actually create the inventory?

little raptor
#

so if it's not defined, define it

stuck jungle
#

Yeah I did in Description.ext

stuck jungle
little raptor
#

check your description.ext again

#

if it's defined, it should work

#

and you should completely exit the mission and start it again

#

restart won't update description.ext

stuck jungle
#

Ok I've got it working now. Thank you for the help

modern sand
#

Is it possible to change the thickness of the line created using drawLine3D?

robust hollow
#

i dont believe so

modern sand
#

Yeah didn't have much hope

warm hedge
#

It's possible AFAIK, but not reliable, and will cause unnecessary consequences

tiny wadi
#

I'm intrigued, can you elaborate? How do you do it, and what are the consequences?

robust hollow
#

i guess one hacky way is to draw multiple lines with slight variations in the position 🀷

onEachFrame {  
    for "_i" from -0.01 to 0.01 step 0.0025 do { 
        drawLine3D [player modelToWorld [_i,0,0],  cursorTarget modelToWorld [_i,0,0], [1,1,1,1]]; 
    }; 
};  
modern sand
#

you just draw multiple lines with an offet

#

ughh

robust hollow
warm hedge
#

Via modding CfgCoreData (IIRC). It defines how thick those lines including 2D lines or such, so if I try to make it thicker, every single line in game will become thicker

robust hollow
#

well there you go. they are textures

configfile >> "CfgCoreData" >> "textureLine"
configfile >> "CfgCoreData" >> "textureLine3D"
tiny wadi
#

oh interesting

#

thats pretty cool

warm hedge
#

Yeah interesting but... It's always better to set thickness via the command's argument

#

Dedmen, pwease?

modern sand
#

Would be nice πŸ™‚

#

So I would have to create my own addon config with ```
class CfgCoreData {
textureLine3D="";
};

warm hedge
#

Yes IIRC

modern sand
#

Okay, thanks I will give it a try πŸ™‚

finite jackal
frail egret
#

Hey guys, I'm having some issues playing around with cameras. No matter what I do in the camCreate command, it always spawns the camera at [0,0,0]

private _camera = "camera" camCreate (ASLToAGL eyePos player);

_camera camPrepareTarget player;
_camera camPrepareRelPos [0, -5, 10];
_camera cameraEffect ["internal", "back"];
_camera camCommitPrepared 0;
waitUntil { camCommitted _camera };

_camera camPrepareRelPos [0, 5, 2];
_camera camCommitPrepared 5;
waitUntil { camCommitted _camera };

sleep 30;

_camera cameraEffect ["terminate", "back"];
camDestroy _camera;
#

And then the camera flies towards the player, running as normal.

finite jackal
#

@frail egret what is your intent? If you move _camera camPrepareRelPos [0, -5, 10]; underneath _camera camCommitPrepared 0; it doesn't fly from somewhere out on the map

frail egret
#

I actually fixed it by just using camSetPos

#

But thank you regardless

tiny wadi
#

Not sure if this has an exact answer, but why do while and waitUntil only allow code blocks instead of bools like if statements?

robust hollow
#

because if only evaluates once, but while/waituntil evaluates on every iteration

#

so you provide the code to evaluate, instead of evaluated code

tiny wadi
#

Ohhhh, right. facepalm

digital jacinth
#

I need a little input trying to get a particle effect looking better. I do want it to look like a water stream falling from the (currently imaginary) ceiling.
Right now it looks like this
https://i.imgur.com/0xuuean.png
The particle params are currently this.

[
    ["\a3\data_f\ParticleEffects\Universal\Universal.p3d", 16, 12, 8],
    "",
    "BillBoard",
    1,
    4,
    [0,0,0],
    [0, 0, 0],
    0,
    1.39,
    1,
    0,
    [0.2,0.2,0.2,0.2,0.2,0.2,0.1],
    [[0.7,0.7,0.8,0.3], [0.7,0.7,0.8,0.7]],
    [1],
    1,
    0,
    "",
    "",
    _particleSource,
    0,
    true,
    0,
    [[0.8,0.7,0.2,0]]
]

I already tried to use the refract texture, it does look better but is almost invisible in low light environment.

still forum
little raptor
still forum
#

πŸ™ƒ

timid niche
#

When will breakWith arrive in game?

little raptor
#

when the stable comes out blobdoggoshruggoogly
it's already in dev branch

autumn swift
#

Hello all, I am currently dealing with a weird issue that I am unable to fix.

I run a mission where players do team based PVP. Each match lasts only for a couple of min after which they all get moved to spawn where they can choose loadouts and vehicles.

For some reason a client occasionally gets a bug where their gun makes no sound for other clients when firing. If you attempt to retrieve the bugged client's weaponclass with currentWeapon then it return a silly name like "Throw" or "Grenade" even though the client has equiped an actual weapon. I've tried re-assigning their loadout using setLoadout / getLoadout but it doesn't always fix it.

Does anybody else experience something similiar?

winter rose
#

No, but it sounds like there is a missing addon somewhere

frigid apex
#

Anyway to make an animation play to its full duration (1) then after its done make it return to its place of origin? (0)

#

And then possibly repeating that over and over until turned off by user action.

willow hound
frigid apex
next meteor
#

Hello, is it possible to add an option to an item so that players could go into spectators view?

tiny wadi
#

What kind of option

#

There is addAction for the scrollwheel

next meteor
#

Like that one

tiny wadi
#

you could do this:

player addAction ["Spectate", {["Initialize", [player, [], true ]] call BIS_fnc_EGSpectator;}];```
#

You'd probably also have to code in a way to leave it once you're in. I pulled that code from this:

next meteor
#

That was fast...thank you man

tiny wadi
#

For getting out of it without debug console access you could probably do a keybind or replace the abort button with a close button the same way that the splendid camera does

next meteor
#

Hrm...I'll try to think of something

tiny wadi
#

Sounds good, the code for closing it is this:

["Terminate"] call BIS_fnc_EGSpectator;```
next meteor
#

What kind of Keybind would it be with that one?

tiny wadi
#

You'd have to create one. If you'd like to figure out how to do that here are the steps:
You'll need to do a bind a UI event handler to execute some code (the closing code). Here are all of the UI eventhandlers: https://community.bistudio.com/wiki/User_Interface_Event_Handlers

(Probably you'll want to use onKeyDown)

You can find the spectator display using findDisplay, im not sure what the ID of the spectator display is so you'd need to do some searching. Then you just say if the pressed key is whatever key you want then execute the terminate code

#

Just found it actually, spectator display seems to be 60492

autumn swift
hollow plaza
#

How could one check if a player has any form of a weapon, that being primary, secondary or launcher? Seems like all the answers I found require large scripts which more or less appear to do way more than what I need.
I know of hasWeapon but with that I'd need to list weapons. The only way to use this would be if I could get a list of all weapons.

#

I do realize that not always is there a simple solution, but it'd be preferrable over a wall of text.

winter rose
hollow plaza
#

So that will return false if said player has a weapon equipped (I don't want weapons in backpacks to trigger it)

winter rose
#

this will return false if a player has any equipped weapon (rifle, handgun, launcher)

#

backpack weapons not considered

hollow plaza
#

Yeah, I just realized my typing error, but yeah.

tough abyss
#

what does the getPos script do exactly? from what i understand it's used to activate a module using a trigger using a marker? could this be done (setting a location to activate the module at) in gameplay?

tough abyss
#

thanks i've read that but could this script be used to activate the module at a designated location during gameplay rather than just in the editor?

warm hedge
#

getPos does get, not set

tough abyss
#

so i should be looking at set instead?

warm hedge
#

Yes I think? Depends on activate you meaning

tough abyss
#

i explained more thoroughly what i'm trying to do here #arma3_editor

winter rose
tough abyss
#

so where do i ask my question? i was unsure whether i'd be in trouble for posting it here which is why i redirected to a related topic

winter rose
#

but then we will move the conversation here. that is to prevent multiple threads on the same topic (and having to navigate in multiple channels to find the info)

tough abyss
#

right i'll lurk in editor for the time being

winter rose
hollow plaza
#

@winter rose Thanks btw, the script works as intended now. I was having trouble at first since the sqf file worked perfectly fine except for the part where it should've checked weapons. Issue turned out to be the fact that having _ at the start of the object name (_player in this case) was not tolerated for this part.

winter rose
#

noice!

tiny wadi
#

Not sure why, could be related to my script but if I call tvSetCurSel it crashes my game. But if I do it manually through debug console it doesn't. I'm not sure what could be causing this πŸ€” Any suggestions?

robust hollow
#

share your script

tiny wadi
#
private _display = uiNamespace getVariable "structuresCameraDisplay";
private _structureList = _display displayCtrl 1501;
if (_intersect in structuresCameraLocalObjects && structuresCameraLMB && !structuresCameraDragging) then { 
    structuresCameraSelectedObjectOffset = _offset; 
    structuresCameraSelectedObject = _intersect; 
    structuresCameraSelectedObjectLastValidSpot = getPos structuresCameraSelectedObject;

    private _index = structuresCameraLocalObjects find structuresCameraSelectedObject;
    //_structureList tvSetCurSel [0, _index]; // crashes game for some reason?
};
if (_intersect isEqualTo objNull && structuresCameraLMB && !structuresCameraDragging) then { 
    structuresCameraSelectedObject = objNull; 
    _structureList tvSetCurSel [-1];
};```

This is the bit that causes the crash, if you want the whole thing I can upload to pastebin
#

I've already confirmed that the parent exists and the index returned from find is correct

robust hollow
#

idk really. my only guess would be the _index is out of the tv range but you've already checked that.
i'd change it to only select [0] and see if that works, then [0,0], then [0,_index] again and see at which point does it start crashing.

tiny wadi
#

Ah yeah, I'll give that a shot

robust hollow
#

is that script scheduled?

tiny wadi
#

No

robust hollow
#

could also try [_structureList,_index] spawn {(_this#0) tvSetCurSel [0,_this#1]};

#

just incase it is one of those ui things that doesnt like happening in the same frame as something else

tiny wadi
#

thats actually a good idea

#

Ill see if that works

#

Yeah spawning it worked πŸ‘

robust hollow
#

make sure to spawn that other one as well just to be safe

tiny wadi
#

okay, thanks!

agile pumice
#

I'm trying to test my script in the editor, but it seems remoteExecute isn't working

[_source, "jihadi_song"] remoteExec ["say3D", -2, true];
            //_source say3D "jihadi_song";
#

the commented line works, but the one above doesn't

tiny wadi
#

Did you setup CfgRemoteExec

agile pumice
#

I did not

tiny wadi
#

throw it in your description.ext

winter rose
tiny wadi
#

Oh, my bad

winter rose
#

it should be the file path

agile pumice
#

_source say3D "jihadi_song" works fine though?

#
class CfgRemoteExec
{
    class Commands
    {
        mode = 1;
        jip = 1;

        class say3D { allowedTargets = 1; };
    };
};
robust hollow
#

lou may be thinking of playSound3D πŸ€”

winter rose
agile pumice
#

no worries

winter rose
#

no need for CfgRemoteExec

agile pumice
#

no?

winter rose
#

nope

#

how do you test, btw? are you self-hosting?

agile pumice
#

I'm just in the editor

robust hollow
#

you are testing in editor with -2. you are 2 so it excludes you

agile pumice
#

shit I forgot about that

#

okay problem solved sorry my memory sucks

winter rose
#

just remoteExec without number argument, it's identical to using 0

agile pumice
#

I do want to exclude the server in an actual multiplayer environment though

winter rose
agile pumice
#

when its a dedicated host?

winter rose
#

(as you could experience)

#

dedicated = not a player
player-hosted = server-player

agile pumice
#

right that's what I assumed

winter rose
#

make your mission to be playable everywhere

#

it's not going to cost anything regarding performance

agile pumice
#

hmm okay, I thought it would

#

Why isn't CfgRemoteExec necessary though?

winter rose
#

because by default, everything is allowed

#

only use it to restrict (safen) your mission

agile pumice
#

oh I see

reef grove
#

If I remoteExec something from client to server, how can I set a variable back on the client (ie. player setVariable) I'm currently passing player as a parameter in the remoteExec but doesn't seem to work

#

I know there's remoteExecOwner but seeing as how it's a number I wasn't sure if it'd work

#

and on top of that some of my scripts involve more than one player

#

i guess what I'm asking is how can I pass a player as a parameter via remoteExec

robust hollow
#
[player] remoteExecCall ["myFnc",2];
// myFnc
params ["_unit"];
_unit setVariable ["myVar",_value];// sets value on the unit, only the server can see the variable
_unit setVariable ["myVar",_value,remoteExecutedOwner];// sets value on unit, only player can see the variable
#

you meaning one of those?

reef grove
#

ahhhh was I supposed to be using remoteExecutedOwner as the third param for setVariable? I've been setting it as true

robust hollow
#

true makes it available for everyone

#

and jip

reef grove
#

ahh alright

#

thanks as always

#

@robust hollow would it be possible to do owner _unit in the script above if I'm calling another script through the remoteExec'd script, or should I pass the net ID through the remoteExec

robust hollow
#

on the server, yes.

if I'm calling another script through the remoteExec'd script
if by "calling" you literally mean calling ([] call fnc) then remoteExecutedOwner should still work in lower functions because they are executing in the remoteExec context

#

i believe that is the case anyway, other context based things work like that

reef grove
#

[] remoteExec [serverfnc,2]

inside serverfnc:

[] call fnc_defined_in_functions_library

#

even if it's not an inline function?

robust hollow
#

yea that should be fine. give it a try

reef grove
#

alright cool

robust hollow
#

inline vs variable functions are no different in that sense.

coarse sedge
#

Hey i am the biggest newb with this stuff can anyone explain to me why this wont work if i put it in the init on a static weapon

this addEventHandler 
[
    "Reloaded", 
    {
        _player setVehicleAmmo 1;
    }
];

But this will

this addEventHandler ["Reloaded",{(_this select 0) setVehicleAmmo 1}]
willow hound
#

_player is a local variable (indicated by the _); when the EH code is executed, it can not access that variable.
_this is a parameter that the EH passes to your EH code when it fires, that's why you can use that.

#
_localVar = "Sample text";
systemChat _localVar; //_localVar is available here.

GlobalVar = "Sample text";
systemChat GlobalVar; //GlobalVar is available here (and everywhere else after the line above).

MyObject addEventHandler ["Reloaded", {
  systemChat _localVar; //_localVar is not available here. As a local variable, it stops existing once the script (file) ends, and the EH code is executed long after that (and has its own scope).
  systemChat GlobalVar; //GlobalVar is available here.
}];

execVM "myScript.sqf"; //_localVar is not available in myScript.sqf (because myScript.sqf has its own scope), but GlobalVar is available.
[_localVar] execVM "myScript.sqf"; //_localVar is available as (_this # 0) in myScript.sqf, GlobalVar is also available (as GlobalVar).
```Read https://community.bistudio.com/wiki/Variables#Scopes to learn more about scopes.
grim ravine
#

Hi all, looking for some advice on selecting an array and passing it to playSound3D specifically the ASL information provided by the hitPart EH

In my config.cpp i've added my EH to the object with

        {
            hitPart="(_this) execVM '\pathto\myscript.sqf';";
        };```

and in my script.sqf I have; 

```private ["_target", "_pos"];

_target = ((_this select 0) select 0);
_pos = ((_this select 3) select 0);

before I call playSound3D. When I then use playSound3D ["pathto\mysound.wss", _target, false, _pos, 2, 5, 1000]; I get an error: zero divisor on the _pos variable. I've tried changing the source of _pos to _pos = _this select 3; and I'm also hitting the same error.

Does select work when I'm trying to select the array from hitPart or am I barking up the wrong tree?

little raptor
#

then retrigger the event handler, see what it gives you

grim ravine
#

Thanks, this is a good idea - give me a mo.

little raptor
#

also, instead of select, you can use param

#

param has a safeguard against out of bound errors

#

and you can provide a default value if the index is out of bounds

#

and if you want all elements from your array, use params instead:

grim ravine
#

_this with hitpart returns;

[[1d8f279cb80# 5: blinktroll.p3d,B Alpha 1-1:1 (Vils),<NULL-object>,[5054.36,4045.45,6.66185],[-345.144,657.913,9.94668],["blinktroll"],[10,0,0,0,"B_65x39_Caseless"],[-0.045738,-0.998954,-0],0.403605,"a3\data_f\penetration\armour_plate_12mm.bisurf",true]]```
little raptor
#

it's the same as this then

grim ravine
#

Yeah

little raptor
#

so do you see the issue now?

#

in your code?

grim ravine
#

So in my brain,

_pos = _this select 3; 

Should assign the ASL of the EH to _pos unless I'm missing something

little raptor
#

it's SQF if you're trying to do the syntax highlighting (see the pinned messages)

little raptor
#

the wiki shows the proper way to do it:

#
this addEventHandler ["HitPart", {
    (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
}];
#

so your pos is:

_pos = _this#0#3;
#

also it's not called the "ASL position of the EH"

#

because EH is just a code

grim ravine
#

I see, thank you

#

That resolved it, thanks.

tidal swallow
#

I'm having issues with one of the scripts...could someone help me trace the origin of error Error in expression <tposatl _nearestRoad) getDir (getposatl _connectedRoad)); _vehicle setDir _roadD> 16:58:40 Error position: <_connectedRoad)); _vehicle setDir _roadD> 16:58:40 Error Undefined variable in expression: _connectedroad 16:58:40 File mpmissions\__cur_mp.Malden\addons\vAiDriving\vAiDriving.sqf..., line 429 16:58:41 Error in expression <tposatl _nearestRoad) getDir (getposatl _connectedRoad)); _vehicle setDir _roadD>

#

and this error `Error in expression <alden\addons\scripts\radio.sqf"
_loop = this select 1;
_run = true;

if !(_loop)>
16:58:16 Error position: <this select 1;
_run = true;

if !(_loop)>`

#

also...is it radio script actually bad written? Just asking since i see loop in it and I know this is not good for CPU

tidal swallow
#

the problem at the second script is tat "this" is not defined or smth

spark turret
#

oh for fricks sake, can we get imgae posting already

austere granite
#

Set up sharex with imgur and problems werent

spark turret
willow hound
tidal swallow
#

thank you guys πŸ˜„

tidal swallow
#

if I understand the image corect

#

correct*

spark turret
#

no the arrow point at the source of the error

tidal swallow
#

awwwhhh

spark turret
#

you are trying to get nearby roads, and the select the first one. but if it finds no road, you select "null" as your first road and you can operate on "null" -> error

#

so you need a check to prevent that.

tidal swallow
#

thank you for fiy :3

#

do I play _ infrom of "this..."

spark turret
#

this is a variable that only exists inside special scripts like the editor init field. dont use it in your normal scripts

#

its "_this" in your scripts

#

contains the parameters passed to your script

tidal swallow
#

if (isNull _nearestRoad) then { _roadListSorted = [_roadList, [], { _vehicle distance2D _x }, "ASCEND"] call BIS_fnc_sortBy; _nearestRoad = _roadListSorted select 0; };

#

owki :3

#

This is like the security if the output is null

#

but still

#

it's on 418 line

spark turret
#

that doesnt look very secure

#

ah so if your nearestRoad is null you just get the closest one by sorting all roads by distance

tidal swallow
#

ye

spark turret
#

can you guarantee that _roadList is never empty?

tidal swallow
#

well actually no

#

do you have any good fix for this :/

spark turret
#

could you use _nearestRoad if there are no roads connected to it?

tidal swallow
#

yes

tidal swallow
#

When in went into the game the AI was on the road but they were just bumping into each other

#

done

#

I just increased the size of radius: Number - (Optional, default 50) search radius from center for BIS_fnc_nearestRoad

#

to 500

#

ig that should be enough

#

it was at 20 earlier

spark turret
#

thats not really safe tho. your script can still crash if you re just unlucky

tidal swallow
#

DAMN

#

ugh

spark turret
#

how about you set _connectedRoad = _nearestRoad if its null?

tidal swallow
#

I mean, the default is 50

spark turret
#

since you always have a nearestRoad afai can tell right?

#

or you could just skip the part with the connected road if it doesnt find one

tidal swallow
#

done

#

Will test and come back with results

#

I have to fix something in eden first

#

just a quick question

#

could this be edited so it would automaticlly control all vehicles

#

<vehicle> remoteExec ["AIDC_fnc_init"]

#

not just the vehicles I input

#

i was wondering if i could use vehicle variable or _vehicle

#

but dunno if that would work

copper raven
#

hmm, if i understand correctly what you are asking, cba xeh is the easiest way to do this

tidal swallow
#

what would be the variable? or can you teahc me how...I've only copied scripts using CBA, not actually wrote one

spark turret
#

not sure if arma provides one, CBA probably does

exotic flax
#

unit Event Handler (added locally)

karmic flax
#

So im working on an eventhandler that counts how many times a unit has been hit makes the unit invincible, im using it for accuracy testing and It was working last night but now its broken. The EH is firing and the counter is going up, but the unit is dying. according to the EH documentation the last value in the EH is the new damage, so the unit should take no damage, but they are still dying, can anyone see anything wrong here?

this disableAI "Move"; tgt setUnitPos 'Middle';
lastTick = 0;
x = 0;
this addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
    
    if (diag_tickTime - .1> lastTick) then{
        x = x + 1;
        Systemchat str(x);
    };
    lastTick = diag_tickTime;
    
    0;
}];
#

The diagTick is just to make sure x only gets counted once per bullet hit, bc the EH is firing multible times every time a soldier gets hit

exotic flax
#

Got any mods running? For example ACE?

karmic flax
#

Yeah I have ACE and OPTRE running

#

Il try vanilla see if that changes anything

#

Well theres my issue, vanilla works fine

#

I thought I had ACE loaded last night but i guess I dint

exotic flax
#

Well, ACE has it's own damage system, so that EH will work for logging but not for handling the damage

karmic flax
#

yeah that makes sense, thanks

little raptor
karmic flax
#

will do, thanks for the tip

jade acorn
#

so I'm looking for a great code that allowed the host - through console - to dynamically reassign zeus module to certain zeus slot with variable. I'm having an issue that in uncertain cases when zeuses join game (either JIP or on start) their slots are not connected to proper zeus modules. it is possible to reassign the modules again with the console, but I have no idea how to achieve that. Any suggestions?

reef grove
#

just to be clear if I player setVariable ["varname",value,TRUE] it will only set it on the unit and not all players? I was using Connor's example for me last night and realized the server couldn't read these player variables, and most of these variables in question need to be read by server.

#

^ i run that player setVariable serverside btw

little raptor
reef grove
#

I pass player to the server as a variable, it works fine I just wanted to make sure by setting the publicity to true it wouldn't set it on other players as well since I read in the wiki on the player page that it's executed globally, wasn't sure if that meant it would execute it on all players or make it public to all clients

#

i'm assuming its the latter though

little raptor
little raptor
jade acorn
reef grove
#

Boolean - when true, the variable broadcast is global and persistent Effects of this scripting command are broadcasted over the network and happen on every computer in the network

https://community.bistudio.com/wiki/setVariable

Go ahead and ignore I see that I was correct, I just wanted to make absolutely sure

little raptor
reef grove
#

right thanks

willow hound
# reef grove i'm assuming its the latter though
//Server:
Player1 setVariable ["MyVar", 1, true];
Player2 setVariable ["MyVar", 2, true];

//Everybody:
Player1 getVariable "MyVar"; //1 on all machines.
Player2 getVariable "MyVar"; //2 on all machines.
little raptor
jade acorn
#

I mean that I have to assign proper variables to curator modules too? so each module has it's own variable

#

english keeps getting harder and harder for me sad

little raptor
#

what do you mean by variable? that's what I don't understand

jade acorn
#

that curator's module is named "module_zeus_1", second one is "module_zeus_2" etc

little raptor
#

ok
well that depends on how you want to do it
if you want to work with those variable names then yeah
but there might be better alternatives depending on what you want

little raptor
jade acorn
#

I don't think it's possible to set up zeus slots wrong, but thanks for clarifying, I'll move the topic to another channel

little raptor
willow hound
#

The module has a field where you can fill in the variable name of the slot (placeholder) unit iirc.

jade acorn
#

yes, I know that and I always place curators like that. but the problem is that even with proper Zeus set up there's something wrong with execution of this module that sometimes they just don't connect to owners

#

I can restart same mission 6 times and 3 times the Zeus works, 3 times it's not assigned.

fair drum
#

@still forum
Think we could get another parameter on the say3D playsound series? Since we have an offset of start time, could we get an end time as well? Could be really nice to have one big master voiceline/sound file and just point to different sections.

exotic flax
#

Also had that issue a couple of times.
Usually it helps to start the server and let it rest for 5min before joining.
Alternative is to use a scripted way to create the Zeus module

jade acorn
#

I remember using a script that was searching for any modules preplaced in mission, selecting one by number (something select #0 and some more code, can't really recall) and reassigning to the user's slot. it was quite efficient but I don't have the script now and I have too small brain to reproduce it.

willow hound
#

1. Get all curators.
2. Find one that has no (valid) owner.
3. Assign new owner.
Execute that in initPlayerLocal.sqf for every player that should have Zeus access.

umbral oyster
#

Possible use remoteExec spawn or call from PlayerConnected event handler directly on player?

little raptor
umbral oyster
#

i have PlayerConnected evh on server side, and i trying execute code from handler to player , [[],{diag_log "somde"}] remoteExec ["call",_owner]; But it doesn't work

#

BUT! If i remoteExec, for example BIS_fnc_endmission, function executed success

little raptor
#

does your server block call or spawn?

#

also, have you defined _owner?

robust hollow
#

server ignores cfgremoteexec

umbral oyster
#

right, server ignore config, but it not work

little raptor
#

have you defined _owner?

umbral oyster
little raptor
#

are you saying that this works for example:

["end1"] remoteExec ["BIS_fnc_endmission", _owner];

but this doesn't?

[[],{diag_log "somde"}] remoteExec ["call",_owner];
exotic flax
#

please note that players connect before they are on the server; so it's possible you call stuff too soon?

#

as in; some stuff can't run before the player is in the mission, and not in the lobby/briefing