#arma3_scripting

1 messages Β· Page 742 of 1

grim ravine
#

Thanks!

steel fox
#

To get the diag exe just switch branch to development in steam.

grim ravine
#

Does it work with the profiling branch as well?

#

Seem to remember using something similar on that branch

dreamy kestrel
#

rather CONDITION not the parent statement. gotcha. thanks...

runic spoke
#

Does arma have an audio source limit? I seem to be having a crash related to audio. I disable the audio creation and it works perfectly fine no crashes, but as soon as I re-enable my audio I get crashes.

steel fox
undone dew
#

Does anyone have experience with the GRAD Persistence script that could help me figure out how to save some custom variables from the Ravage mod? I'm following this page about saving variables, and this is what's in the CfgGradPersistence customVariables class:
https://github.com/gruppe-adler/grad-persistence/wiki/Saving-Variables

   class customVariables {

        class HG_Cash {
            varName = "HG_Cash";
            varNamespace = "player";
            public = 1;
        };
        class hunger {
            varName = "hunger";
            varNamespace = "player";
            public = 1;
        };
        class thirst {
            varName = "thirst";
            varNamespace = "player";
            public = 1;
        };
        class radiation {
            varName = "radiation";
            varNamespace = "player";
            public = 1;
        };
        class rvg_array_bases {
            varName = "rvg_array_bases";
            varNamespace = "mission";
            public = 1;
        };
    };
#

i can see in the Ravage MP saving function that the public variables for hunger/thirst/radiation are these, so I'm not sure why these aren't working:

    player getVariable ["thirst", ""],
    player getVariable ["hunger", ""],
    player getVariable ["radiation", ""],
    player getVariable ["status", ""],
    player getVariable ["rad_status", ""]//vars to a single array would be best
brazen lagoon
#

@undone dew where is the save running

undone dew
#

it's saving to profile in the description.ext

brazen lagoon
#

Since grad-persistence only saves on server, you can only save variables that are known to the server. So if a client defines a variable locally, without making it public, you will not be able to save this variable.

#

are those public variables?

undone dew
#

hrm, perhaps they aren't

brazen lagoon
#

maybe I'm misunderstanding how the persistence script that you're using works

#

but if it's using player on the server I don't see how that would work

#

If you have a script that saves a variable in a unit, for example _unit setVariable ["mcd_myVariable_test",1337], this variable is saved in the unit's namespace and you need to use varNamespace = "unit";.
I think you probably want to use unit

undone dew
#

i can try it, I saw that list of varNamespace values but wasn't sure what to use - the example they gave used Player i think

brazen lagoon
#

this is a bit of a #arma3_config question but: how do I select vehicles dynamically for a faction that have no gun turrets but do have a certain number of seats

past wagon
#

does diag_log throw an error when not executed on dedicated server?

brazen lagoon
#

no

#

it'll log to console

past wagon
#

ah

#

thanks

ruby bronze
#

In as simple terms as possible, does anyone know why when I use group to return the name of the player's group, it does return it but with a capital B in front of it? I assume this is for Blufor, but how can I make it not do that lmao

bitter jewel
#

it is the string representation BI has chosen for groups

#

use groupId to get the callsign

#
    _name = groupId (group player);
ruby bronze
#

Thanks I'll keep trying to make groupId work, so far it hasn't but now that I know it's the way to go I'll stick with it instead of just group

bitter jewel
#

it is not working?

drifting sky
#

Is there any way either to check that an ai group or vehicle is able to navigate to a waypoint, or to choose a waypoint position that it definitely can navigate to? A2OA.

ruby bronze
#

@ takadoshiki, no I couldn't quite get it working with my code tonight and ended up switching projects, but I will try again tomorrow evening.

hoary cobalt
#

Hey guys using the in game console, how would one edit what a player soldier's voice is?
Like this setSpeaker "Male01CHI";
Except I need it to change a specific player's voice and I am unsure how to call that

boreal parcel
#

heyo, I have some old custom made structures/buildings from id guess before the 3d editor or something idk, anyway every single wall/window etc has code in its init with setPos etc, is there a simple way to get rid of all the code in the init?

little raptor
boreal parcel
little raptor
#

Depends. But I don't see what's the point

boreal parcel
#

Largely just me hoping to be lazy and not need to delete 377 individual lines and just remove the brackets around the numbers

little raptor
#

That'll break everything

boreal parcel
#

gotcha 😦

haughty copper
#

hello im trying to get an rvmat right so i made a simple build with out doors so how do i define it as an a3 rvmat #define ARMA or #define ARMA_3 ,,, also how do i define this
class CfgPatches
{
class work_shop_new
{
units[]={};
weapons[]={};
requiredVersion=0.1;
requiredAddons[]=
{
"what i need to add here "
"whats i need to add here"
};
};
};

last rain
#

Is there a command to randomly shuffle the data in the array?
For example, from [1,2,3,4,5] make [3,1,5,4,2]

haughty copper
#

what you trying to make like a random selection?

last rain
#

I want to shuffle the array and then use it with the command {} forEach Array

winter rose
haughty copper
#

thanks πŸ™‚

sand summit
#

is there possibly a way to point at a secondary magazine within the primary weapon? i.e. integrated grenade launcher

tepid hornet
winter rose
sand summit
#

effectively, i have a script that swaps the gun you're currently using, with an identical gun with different texture. it also carries over any and all attachments, magazine and capacity, the whole nine yards. is there a way that i can specifically point the script to a secondary magazine in any fashion?

little raptor
sand summit
#

like

#

primaryWeaponMagazine

#

but for the primary weapon's "other" magazine

#

oooh thank you lou

#

this might be what i've needed

little raptor
sand summit
#

now for the question i dread asking

#

would i just ask for _unit weaponsItems # 7 and # 8 in the variable assignment?

tepid hornet
little raptor
#

at least not the vanilla debug console

tepid hornet
#

its the CBA one i think

little raptor
#

that's the same as vanilla

tepid hornet
#

ah ok

little raptor
#

put the script in a file and exec the script from there

#

using execVM

tepid hornet
#

ok ill go download it

tepid hornet
sand summit
#

how would you recommend i draw those values as strings then?

little raptor
sand summit
#

and for reassigning them within a script, not sure how to handle that one either.

winter rose
sand summit
#

i am new to scripting, sorry

winter rose
#

hi new, I'm dad!

little raptor
#

weaponsItems shows the weapons in no particular order

#

you can't tell which one is what

winter rose
winter rose
sand summit
#

i think i have a reliable way around the issue of primaryWeaponItems not being great

tepid hornet
winter rose
#

of course here "myFile.sqf" is placed at the root of your mission directory

tepid hornet
#

is it possible to open command line in editor? or only in game?

winter rose
#

in editor, try Ctrl+D if you have CBA

#

@tepid hornet all good?

tepid hornet
#

i already started loading mission, gimme 5, takes me a little longer than the normal person haha honestly appreciate the help, its hard to find when your a complete novice

#

i have it open now, so would i be typing *execVM "UCR_Setup.sqf"; * in the debug console?

tepid hornet
#

after pressing localexec it gave me a directory to my mission folder under the debug console box but nothing else happened

little raptor
#

then the script was executed

tepid hornet
#

does that mean im super sneaky now? imma go walk through a crowd of opfor and find out

little raptor
#

Β―_(ツ)_/Β―

tepid hornet
#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

#

my script is in a folder called INC_Undercover, should it therefor be "INC_Undercover/UCR_Setup.sqf";?

little raptor
#

yes

tepid hornet
#

ok now now my pc is doing something because its froze πŸ˜‚ update pending lol

#

no directory this time

still forum
runic spoke
#

No, using a Xonar u5 audio driver, with audio technica headphones

#

Gonna do more testing, but so far if I disable my remote exec for Say3D the crashing stops.

#

It's a hard crash to desktop too

#

if (_sound == "" || {isNull _object} || {isNil "SM_SoundDistance"}) exitWith {true};

_object say3D [_sound, SM_SoundDistance];
true```
#

I'm not the only one that gets crashing too, everyone does, some times the server.

still forum
#

do you get crashdumps?

acoustic abyss
#

Speaking of crashdumps; I'm messing around with functions, but am not getting very good debug info, besides short temporary messages and the RPT.
I know there are several tools that help with sqf scripting; can anyone recommend a few?

runic spoke
#

still doing more testing to see if I can find the source of the issue.

acoustic abyss
#

Well; going to have a go with Arma.Studio (and Arma Script Profiler). But I'm all ears for other suggestions for improved debugging.

still forum
acoustic abyss
#

For now, very basic: a way of compiling script files and getting runtime errors, without having to restart missions.

still forum
#

BIS_fnc_recompile will recompile all your CfgFunctions

#

without a mission restart

#

But it needs to be enabled, see the wiki page

acoustic abyss
#

Thank you! And if I wanted the game to give longer error messages that I could read in a text editor (instead of a few seconds of black-boxed text in the middle of the screen), what could I do for that?

still forum
#

Just open the RPT in a text editor

#

its all in there

#

If you start arma with the -debug start parameter, you also get calltrace for the errors

acoustic abyss
#

Fair enough. But there's no program that combines these features. OK.

warm coral
#

does anyone know a script where i can make the player get damage when they get close to a object? as in stuff like razorwires so if a player touches them they get damaged

winter rose
warm coral
winter rose
distant oyster
#

or via a trigger:

Activation: Any Player
Condition: this && (round time) % 1 > 0.5
Repeatable: Yes
On Activation: {_x setDamage (damage _x + 0.01)} forEach thisList;
boreal parcel
#

heyo, ive got this script that works fine on my local machine however once its on the dedicated server calling it like normal does nothing and I dont get any errors surprisingly. Any idea whats up?

if (!isServer) exitWith {};

// Ensure the targets do not pop up again once shot
nopop = true;

// Step 1a
_selection = _this select 3 select 0; // Gets the first element in the list (list is at index 3), should be array of targets
// Step 1b
_selectedRandom = _this select 3 select 1; // Gets the second element in the list (list is at index 3), should be an integer
// Step 1c
_offset = _this select 3 select 2; // Gets the third element in the list (list is at index 3), should be an integer
// Step 1d
_display = _this select 3 select 3; // Gets the fourth element in the list (list is at index 3), should be a boolean

// Step 2
_offset = round random _offset; // Where random returns floating point, round gets us an integer
_polarity = round random [0,0.5,1]; // [min,mid,max]
if (_polarity == 0) then {
    _offset = 0 - _offset; // Set to negative if the coin flip is zero
};
_selectedRandom = _selectedRandom + _offset;

// Initialize array of accepted targets (allows for global scope)
_targets = [];

if (_selectedRandom > 0) then
{
    // Step 3a
    _target = _selection call BIS_fnc_selectRandom;
    _targets = [_target];
    _selectedRandom = _selectedRandom - 1;
    // Step 3b
    while {_selectedRandom > 0} do
    {
        _target = _selection call BIS_fnc_selectRandom;
        while {_target in _targets} do
        {
            _target = _selection call BIS_fnc_selectRandom;
        };
        _targets append [_target];
        _selectedRandom = _selectedRandom - 1;
    };    
}
else
{
    // Step 4a
    _targets = +_selection;
};

// Step 5
{
    _x setDamage 0;
    _x animate["terc",0];
} foreach _targets;

// Step 5a
if (_display) then {
    hint format ["Targets: %1", count _targets];
};
open fractal
boreal parcel
#

Sorry took a shower I'll get the exact code in just a second but I believe I'm providing the script with an array of target variables and a few strings/ints

#

As an addaction on a laptop prop

boreal parcel
# open fractal how are you calling the script?
this addAction["Sector Targets","popup.sqf",[[target_218,target_223,target_224,target_226,target_229,target_231,target_232,target_236,target_238,target_244,target_250,target_219,target_220,target_221,target_222,target_225,target_230,target_237,target_243,target_249],0,1,true]];this setObjectTexture [0, "readytarget.jpg"]```
#

This is just one of the times the script is called. Its on multiple laptop props with different targets

open fractal
#

I'm not familiar with how locality works with addAction, but I would try

if (!isServer) exitWith {["Failed"] remoteExec ["hint"]};

so it notifies you if the script is terminated at the start

open fractal
boreal parcel
#

ah gotcha, ill try that and see what happens

open fractal
#

if it hits you with Failed then it's just a matter of executing your script on the server with remoteExec

#

afaik

boreal parcel
#

makes sense

#

I cant test it just yet since I already threw the server back to our public preset but when I try it later ill let you know how it turns out

brazen lagoon
#

@still forum dunno if this is the right place to ask, but.. kind of an out there request, how hard do you think a command to get texture data given a texture path would be to implement?

still forum
#

didnt we recently get one for size?

brazen lagoon
#

by this I also mean, if I do this with intercept what are the odds that I can get you or another dev to put it in the game

still forum
brazen lagoon
#

how hard would it be to have that also return texture data

still forum
#

what is texture data

brazen lagoon
#

as in, an array of arrays of size x,y where each point has the rgba values of that pixel

still forum
#

usecase?

#

I don't think I like that

#

translating that stuff into script values will be hella expensive

brazen lagoon
#

I'm floating my idea again of dynamically figuring out camo values

still forum
#

I could give you average color

brazen lagoon
#

since cf bai is dead

still forum
#

that is stored directly in the paa

brazen lagoon
#

is it? avg color is probably good enough

still forum
#

yes. Make FT ticket for getting it added to getTextureInfo. I can just add more return values

brazen lagoon
#

how long would it be before that gets added? dunno what arma's release cadence is like

#

but yes ok will do

still forum
#

couple months

brazen lagoon
#

eh that's not bad

#

esp. considering that simplifies my work significantly

still forum
#

be quick. Its couple months if you get it till branch split which is gonna be next week

brazen lagoon
#

oh also. how will that work with alpha pixels

#

does paa avg color ignore alpha pixels?

still forum
#

avg color is RGBA, it also averages the alphas afaik

brazen lagoon
#

ok I will make the ticket once I get to my computer

#

hmmmm that might be a bit annoying

still forum
#

you may need to remind me tomorrow afternoon

brazen lagoon
#

but eh. probably good enough

#

will do

#

what tz are you in?

#

is tomorrow afternoon... 12 hours from now?

still forum
#

germany

#

yes πŸ˜„

#

well more like 15

brazen lagoon
#

πŸ‘ cool cool

#

will set an alarm

graceful kelp
#

does anyone know if i can grab the rotor speed or a value stating the rotor is in its blur state

crystal lodge
#

Hi I have an problem and it is very important. I have scripted a vanilla Giga Rabbit armed with a 30mm gatling gun. He is king of the skies of Altis. However, whenever he flies over the water at any altitude, the rabbit is de-spawned leaving only an invisible Xi'an in his core. I assume this is because the game was not designed for rabbits to spawn over water. This is clearly the result of poor foresight on the part of the dev team but I am wondering if anyone has a workaround I could try? Thanks in advance

brazen lagoon
#

lmao

#

@crystal lodge could you maybe use just the rabbit model with createSimpleObject?

#

Dunno if it'll animate though

#

also, anyone have any ideas on how to make a respawn position only visible to one unit?

crystal lodge
#

Hmm, I considered making it a simple object, but then the problem is that he will lose his animations and not be able to gallop majestically through the air. (edit, turns out he still despawns even with damage disabled as well)

#

As far as respawn visibility, the only way I know how to separate visibility between groups is if those groups are on different factions. Same faction, they always all see it unless there is some script I don't know about.

flat eagle
#

hey guys, so iv been playing with
[_logic,nil,true] call BIS_fnc_moduleCAS; and i somewhat understand what its doing.
_logic is
params [

"_position",["_vehicle","B_Plane_CAS_01_dynamicLoadout_F"],["_type",0],"_logic"

];

_logic = "Logic" createVehicleLocal _position;
_logic setVariable ["vehicle",_vehicle];
_logic setVariable ["type",_type];

and true is if it spawns or not but im not sure what kind of numbers you can pass in place of nil. like how high is the max number it understands? does the number variable even matter?

flat eagle
#

so i think i figured it out [_logic,nil,true] call BIS_fnc_moduleCAS;
_logic is as i stated above
nil is from 0-1 and its for probability of presence
true is either true or false and its for condition of presence

boreal parcel
boreal parcel
#

not particularly, ill take a loot at the link

open fractal
#

if you use remoteExec you can have your script execute on just the server

boreal parcel
#

Gotcha, so something like ["popup.sqf"] remoteExec ["call", -1]; and call normally from the addaction on the laptops?

also as for -1 I see -2 is all but the server so I assume -1 is the opposite?

open fractal
boreal parcel
#

ahhh, I need to throw this in the init of the laptop with the parameters not in some script?

open fractal
#

i'll show you in a minute

boreal parcel
#

much appreciated, in the meantime ill fiddle with it some

open fractal
boreal parcel
#

Right, and I was doing so in another script like this
execVM "popup.sqf";

open fractal
#

exactly

#

so to do that on the server you write "popup.sqf" remoteExec ["execVM",2]

#

if you need to include parameters you can do

["script.sqf", [_targetsArray,0,1,true]] remoteExec ["execVM",2]
#

_targetsArray of course being that ghastly array of targets

#

note I may have done the syntax wrong but that's the general idea

#

shit

#

i forgot the script itself

boreal parcel
#

lol yeah the array is a bit bad, and its all good I was just about to ask about that

open fractal
#

fixed it

boreal parcel
#

yep thats what I figured it was gonna be

open fractal
#
_myArray = [1,2,3,4];
#

a little trick i've learned is you can create an object in the editor, let's call it myTargets, and then you can right click and synchronize it with all the pop-up targets

#

then you can just do ```sqf
_targetsArray = synchronizedObjects myTargets;

boreal parcel
#

ohhh that would be much better.

boreal parcel
open fractal
#

no

#

go check the documentation

#

if you put {curly brackets} around your code you can slap that in your addAction where it says script

#

so that you know how to structure your stuff to fit a command's parameters

#

that explains the difference between scripting in singleplayer and multiplayer

boreal parcel
#

Ill do so, and something like this?

this addAction["Sector Targets",{["script.sqf", [_targetsArray,0,1,true]] remoteExec ["execVM",2]}];
open fractal
#

yeah that's what i'd try

boreal parcel
#

gotcha, ill give it a shot

open fractal
#

something that might happen is your _targetsArray may not be defined in the addaction scope

#

which an easy fix is to make it a global variable

#

or even better make it an argument in addAction

#

🧠 you can synchronize the targets with the laptop itself as well

boreal parcel
#

Alrighty, sorry for the slow responses lol im slowly writing/catching up with everything said so far in-game/script

boreal parcel
open fractal
#

the variable will have to be passed to the script

boreal parcel
#

that makes sense

open fractal
#

refer to the addAction page to pass the variable

#

i cant really speak confidently to this since I don't have the game open

#
this addAction["Sector Targets",{
    _targetsArray = _this select 3;
    ["script.sqf", [_targetsArray,0,1,true]] remoteExec ["execVM",2]

},_targetsArray];
#

arguments: Anything - (Optional, default nil) arguments to pass to the script. Accessible with _this select 3 inside the script. If Array is used as an argument for example, its first element reference would be _this select 3 select 0

#

essentially _targetsArray cant be accessed {inside the curly brackets} unless you pass it as an argument in the addAction command

boreal parcel
#

hmm, why _this select 3 ? shouldnt I be calling something like this _targets = synchronizedObjects controlLaptop_16;?

open fractal
#

watch

#
_targets = synchronizedObjects this;

this addAction["Sector Targets",{
    _targetsArray = _this select 3;
    ["script.sqf", [_targetsArray,0,1,true]] remoteExec ["execVM",2]

},_targets];
#

you define it in line 1, then pass it as an argument

boreal parcel
#

ah ok

open fractal
#

let me edit for clarity

#

then _this select 3 grabs _targets from the addAction argument

#

and slaps it into _targetsArray localized within the {curlybrackets}

boreal parcel
#

right, it makes sense now

open fractal
#

so hypothetically pasting this in the laptop's init should activate your script for all the synchronized targets when you hit the "Sector Targets" button

#

even better you can do ```sqf
if (!isServer) exitWith {};

_targets = synchronizedObjects this;

this addAction["Sector Targets",{
_targetsArray = _this select 3;
["script.sqf", [_targetsArray,0,1,true]] remoteExec ["execVM",2]

},_targets];

boreal parcel
#

gotcha, I gave it a quick test locally before throwing it on the server and got some errors saying _this is undefined.

Also would It matter having the isServer exitWith in the init if its already in the script itself?

#

ah and errors being

0:53:46 Error in expression <hint"]};

nopop = true;

_selection = _this select 3 select 0; 

_selectedRand>
 0:53:46   Error position: <_this select 3 select 0; 

_selectedRand>
 0:53:46   Error Undefined variable in expression: _this
open fractal
#

it shouldnt be necessary since the script will only be executed on the server with remoteExec

#

i think i wrote the remoteexec backwards (?)

boreal parcel
#

it doesnt look like it in the documentation

open fractal
#

i think the arguments are supposed to come before the file name

boreal parcel
#

oh

#

hmm lemme give that a shot

open fractal
#
[[_targetsArray,0,1,true],"script.sqf"] remoteExec ["execVM",2]
#

my take

#

im ready for a sqf vet to come in and tell us we're barking up the wrong tree

boreal parcel
#

lol

#

actually

open fractal
#

at the very least you've learned a couple commands

boreal parcel
#

it seems weird that the error pops up as soon as the server starts rather than when I hit the Sector Targets addAction at the laptop

open fractal
#

did you leave it in the init

boreal parcel
boreal parcel
open fractal
#

SHAME!

#

SAD!

boreal parcel
#

oh was I not supposed to?

open fractal
#

no

boreal parcel
#

then how does this refer to the laptop? now im confused

open fractal
#

oh my bad

#

init.sqf

#

not the object init

boreal parcel
#

I still dont understand, you want me to throw that code in the init.sqf?

open fractal
#

it should be in the object init

#

i was asking if you put the code in an init sqf file somewhere

boreal parcel
#

oh like the popup.sqf script, your asking if I left the execVM including it in a file?

open fractal
#

if what we worked on is only in the laptop's init box then there shouldnt be an issue

#

i was confused when you said the error happens before you hit the button

boreal parcel
#

ah actually that makes sense, I forgot to remove the execVM from the init_server.sqf

open fractal
#

yeah that'll do it

#

so _this refers to arguments passed to the script

#

and if you execVM without arguments then it'll be confused

boreal parcel
#

hmmm

#

does synchronizedObjects return false?

#

after hitting the button I get the error

 1:10:33 Error in expression <p = true;


_selection = _this select 3 select 0; 

_selectedRandom = _this sele>
 1:10:33   Error position: <select 0; 

_selectedRandom = _this sele>
 1:10:33   Error select: Type Bool, expected Array,String,Config entry
#

no looks like it should only return an empty array

#

hmm

#

oh

boreal parcel
open fractal
#

you can try it I think the remoteExec will just fail

#

i think what's happening is it's looking for an array in the fourth argument

#

which is true

#

so just swap out select 3 for select 0 to indicate the first argument

#

or move your _targetsArray to the end

#

that's probably a better plan

#

in hindsight it initially might've thrown Failed because it executed locally and on the server

boreal parcel
boreal parcel
open fractal
#

i figured it out

#
this addAction["Sector Targets","popup.sqf",[_array,0,1,true]];this setObjectTexture [0, "readytarget.jpg"]
#

no i lied i didnt

boreal parcel
#

lmao

open fractal
#

it's interpreting the arguments differently because you're using execVM instead of executing the script straight from addAction

#

by differently i mean in a different order

boreal parcel
# open fractal or move your _targetsArray to the end

alright I tried swapping _targetsArray with true and got two errors

 1:18:33 Error in expression <f (_polarity == 0) then {
_offset = 0 - _offset; 
};
_selectedRandom = _selected>
 1:18:33   Error position: <_offset; 
};
_selectedRandom = _selected>
 1:18:33   Error Undefined variable in expression: _offset
 1:18:33 Error in expression <t 0; 

_selectedRandom = _this select 3 select 1; 

_offset = _this select 3 sel>
 1:18:33   Error position: <select 1; 

_offset = _this select 3 sel>
 1:18:33   Error Zero divisor
open fractal
#

before we do anything else

open fractal
#

can you go back and do the original thing you did at the very start

#

and check if it executes on the server

boreal parcel
#

huh?

#

the thing I did at the very start?

open fractal
#

just add in the sqf script if (isServer) do {"Success" remoteExec ["systemChat"];

#

because if it works on the server then you can just ditch all this

#

and it's a different issue entirely

#

i didnt stop to think it might be executing both locally and on the server, hence failing once and succeeding once

boreal parcel
#

hmm if that was the case wouldnt the targets have popped up?

#

and also my editor is saying there is something wrong with the line you sent

open fractal
#

it could just be a separate issue

boreal parcel
#

Missing if operation after condition

open fractal
#

my bad

#

then not do

boreal parcel
#

yeah I was just about to say it doesnt like do lol

boreal parcel
#

ah wait

open fractal
#

no, all that will do is write "Success" in the game chat if it executes on the server

boreal parcel
#

nvm syntax error, missing an end bracket lol

open fractal
#

my bad

boreal parcel
#

no all good, I shoulda noticed

open fractal
#

systemChat is a good tool for debugging

boreal parcel
#

especially with the previous pain ive gone through with those kinda errors lol

open fractal
#

shouldve started with that actually

#

instead i assumed the issue

boreal parcel
#

Oh wow just figured out you dont need to restart the server/local server everytime you change the script

#

😦

#

well it works locally, lemme throw it on the server

open fractal
#

if my hypothesis is correct it'll hint "Failed" and chat "Success" and i will look dumb

#

usually someone swoops in and corrects me by now

warm hedge
#

If you launch the server from Eden Editor, you just need to restart the mission

boreal parcel
#

alright I threw this line above the previous !isSever line

if (isServer) then {"Success" remoteExec ["systemChat"]};
#

starting the server now

boreal parcel
warm hedge
open fractal
#

you could also login as admin and do #missions or whatever method is quickest

warm hedge
#

It's a builtin Eden Editor feature

boreal parcel
# open fractal if my hypothesis is correct it'll hint "Failed" and chat "Success" and i will lo...

almost came back and told you it didnt chat success, then I remembered we disabled system chat, now I gotta restart the server again:\

disableChannels[] = {
    {0, true, true}, //--- Global Chat
    {1, false, true}, //--- Side Chat
    {2, true, true}, //--- Command Chat
    {3, false, true}, //--- Group Chat
    {4, false, true}, //--- Vehicle Chat
    {5, false, true}, //--- Direct Chat
    {6, true, true} //--- System Chat
};
boreal parcel
#

only getting failed

open fractal
#

alright then

#

back to remoteExec I guess

#

all you need to do is make sure it's being fed the right arguments

boreal parcel
#

put the following, perhaps because its not in brackets?

if (isServer) then {"Success" remoteExec ["systemChat"]};
if (!isServer) exitWith {["Failed"] remoteExec ["hint"]};
open fractal
#

you can try it but it shouldnt be necessary for one parameter

boreal parcel
#

ok

little raptor
open fractal
boreal parcel
little raptor
open fractal
boreal parcel
boreal parcel
open fractal
#

since your arguments are in an array rather than a subarray

little raptor
little raptor
boreal parcel
# open fractal by the looks of it you can just delete `select 3`

hmm, did so however im getting the following now

 1:50:03 Error in expression <tedRandom - 1;
};    
}
else
{

_targets = +_selection;
};


{
_x setDamage 0;
_x a>
 1:50:03   Error position: <+_selection;
};


{
_x setDamage 0;
_x a>
 1:50:03   Error +: Type Bool, expected Number,Array,Not a Number,HashMap
#

guess the order is still wrong

#

for the selects

little raptor
open fractal
#

is this what you have?

#

arguments should be in the original order

boreal parcel
#

ahhhhh

#

I never reverted switching targetsArray and true

open fractal
#

that'd do it

open fractal
#

we're a little goofy so it's taking a minute

little raptor
little raptor
#

It can just be embedded in the code

open fractal
#

is this what you mean?

little raptor
#

No

boreal parcel
# open fractal that'd do it

no more errors, code seems to execute successfully locally however the is getting 0 targets, so I think synchronizedObjects is coming back empty

open fractal
boreal parcel
little raptor
#

Yes

boreal parcel
#

Yes to artisan?

little raptor
#

To you

boreal parcel
#

oh, we removed a set of the selects, the original code had the arguments in a subarray

open fractal
#

thats what we just fixed

little raptor
boreal parcel
#

are you saying just create the array of pre-placed targets variablenames in the sqf file itself?

open fractal
#

the script rather

little raptor
#

no. like I said it should be embedded. altho I'm not sure how many times it's gonna be called. but anyway:

//some_file.sqf
_array = [target_1, .... , target_100];
[_array] call some_code
remoteExec ["some_file.sqf", ...];
little raptor
open fractal
#

why not do this?

//some_file.sqf
_array = synchronizedObjects _this;
[_array] call some_code
little raptor
#

also iirc synchronizedObjects doesn't work on normal objects

boreal parcel
#

hmm, ok manually writing down each targets variable is doable, however im curious how would I reference that variable from the objects inits?

For instance I would create a variable for each building with targets, would I just do

// some_file.sqf
_targBuilding1 = [target_1, etc];
_targBuilding2 = [target_5, etc];


// obj init
this addAction["Sector Targets",{ 
    [[_targBuilding2,0,1,true], "popup.sqf"] remoteExec ["execVM",2] 
 
},_targBuilding2];
little raptor
#

that's not what I meant

boreal parcel
#

ah sorry hang on

little raptor
#

anually writing down each targets

#

you don't have to

boreal parcel
#

oh

little raptor
#
_array = [];
for "_i" from 1 to 100 do {
  _array pushBack (missionNamespace getVariable ["target_" + str _i, objNull])
}
open fractal
#

it lets me just point and click on what i want gone once the script is executed

#

convenient for me at least

little raptor
boreal parcel
# little raptor ```sqf _array = []; for "_i" from 1 to 100 do { _array pushBack (missionNamesp...

hmm, that could work, I guess I could rename each target to have a prefix for its house and do

_house1 = [];
_house2 = [];
for "_i" from 1 to 25 do {
  _house1 pushBack (missionNamespace getVariable ["target_house1_" + str _i, objNull])
  _house2 pushBack (missionNamespace getVariable ["target_house2_" + str _i, objNull])
}

However they dont all have the same number of targets so if it doesnt find the variable will it simply not add anything?

little raptor
#

that synchObjs was empty?

boreal parcel
open fractal
#

dont forget you can always ```sqf
systemChat str _array;

boreal parcel
#

ah there we go

open fractal
#

oh what a coincidence

#
str
#

be sure to remoteExec if it's executed on the server

little raptor
boreal parcel
open fractal
#

has anything come through systemChat on that server

boreal parcel
boreal parcel
#

the sector target I mean

#

add Action

#

locally

open fractal
#

maybe because it's running unscheduled

little raptor
#

it must run with some delay

boreal parcel
#

ok

little raptor
#
_targetsArray spawn {
  sleep 1;
  systemChat str _this
}
boreal parcel
#

should be fine to throw a sleep before the systemChat then right

#

oh

little raptor
open fractal
#

leopard you write those code blocks damn fast

boreal parcel
#

huh, I know your helping me with the code atm but whats the _targetsArray spawn {} for?

little raptor
#

I'm passing it to the spawn

little raptor
#

spawn has its own scope

#

it doesn't inherit the current scope. so you must pass the variables to it

boreal parcel
#

huh ok

little raptor
boreal parcel
#

I cant seem to send images here but it looks like its outputting an empty array

#

[] is what it looks like basically, except no space inbetween because of the font

open fractal
#

[] amgery

little raptor
open fractal
#

why is synchronized objects so finicky

little raptor
#

Β―_(ツ)_/Β―

open fractal
#

i love arma 3

little raptor
#

I've only found it to work with modules

open fractal
#

it works spot-on for me for whatever reason

#
{deleteVehicle _x} forEach (synchronizedObjects hideShit);
{_x hideObjectGlobal false} forEach (synchronizedObjects showShit);
little raptor
#

just name one, then copy paste it

#

their names will be like name_1 name_2, etc.

open fractal
#

my caveman method of getting already-named objects would be ```sqf
_targetsArray = nearestObjects [_reference, _targetClassname, _radius]

boreal parcel
#

gotcha, yeah im gonna replace all of them now, I have this in my init, anything else I need to change?

_targetArray = []; 
for "_i" from 1 to 20 do { 
  _targetArray pushBack (missionNamespace getVariable ["target_house5_" + str _i, objNull]) 
};

this addAction["Sector Targets",{ 
    _targetsArray = _this select 3; 
    [[_targetsArray,0,1,true], "popup.sqf"] remoteExec ["execVM",2] 
 
},_targetsArray]; 
boreal parcel
open fractal
#

understandable

boreal parcel
#

so unless I could define a rectangular radius

#

its probably best to do it this way lol

open fractal
#

im actually distraught over synchronizedObjects

#

that was just too perfect

boreal parcel
#

lol yeah that would have been so much easier

boreal parcel
#

oh ok lmao

#

I was confused

#

mmm 2:30am

open fractal
#

shit

#

adios

boreal parcel
#

how does it always get this late when I do arma stuff

open fractal
#

wont be the first time

boreal parcel
#

im trying to get this mission working for my little group before saturday lol, and every time something works, another thing decides thats too much happiness

#

and then the firing range has me worried because the first round idk if the guy testing it was blind or what but he said he didnt see the first few pop up lol, but then it ran smoothly

#

so, hopefully all works out

open fractal
#

I’ve been sitting on a SOG PF mission since SOG PF came out

boreal parcel
#

lmao

open fractal
#

I got so burnt out making it because I decided I absolutely had to have the players insert on a helicopter with a cutscene and now all that’s left is the briefing

#

I’ll run it one day

little raptor
#

instead of passing the whole array over the network

boreal parcel
#

do what? put the array of classes in the file itself?

little raptor
#

classes? you mean objects? yes

boreal parcel
#

yeah sorry, the variableNames I guess

#

hmm

#

I could do that actually, and instead have the laptop send back the house number instead of an array, then just do a simple if-else-if statement or something to assign the array to _selection based on the house

little raptor
boreal parcel
#

so far the biggest house has 20 targets, so each time the script is activated its 20 targets or less

little raptor
#

just wanted to point out that sending arrays over the network is not good (unless you have no choice)

boreal parcel
#

it used to be 200+, but got rid of a bunch

boreal parcel
#

nah, there might be bigger houses in the future so ill just attempt that. if it doesnt work out before saturday ill go with the original way.
Just curious but is this the correct way to go about it? instead of the array I tried sending back 5 in its place

if (_this select 0 == 5) then {
    _selection = _house5; // Gets the first element in the list (list is at index 3), should be array of targets    
};
#

_house5 is created a few lines above

_house5 = [target_218,target_223,target_224,target_226,target_229,target_231,target_232,target_236,target_238,target_244,target_250,target_219,target_220,target_221,target_222,target_225,target_230,target_237,target_243,target_249];

little raptor
tardy oriole
#

hey so im having an issue with removing an object from being editable from zeus

_group = createGroup [west, true];

_AI = _group createUnit ["B_Soldier_F", _pos, [], 0, "FORM"];
_Jug = createVehicle ["3as_Jug", _pos];

_AI hideObjectGlobal true;
_AI setUnitPos "Down";

_Jug attachTo [_AI, [0,0.5,0]];
_Jug setObjectScale 0.5;
_Jug removeCuratorEditableObjects [[_x],true];``` this is what I have right now everything but the remove curator works
little raptor
tardy oriole
#

I was assuming it was wrong google wasnt doing me justice

#

what should I be using instead?

little raptor
#

curator obj is the first arg

#

also _x is undefined in your code

tardy oriole
#

I tried _Jug instead of _x and that didnt work

#

Also I know im probably not seeing the obvious answer, coffee isnt helping me much right now

little raptor
#

there is no answer rn

tardy oriole
#

Ah

#

so assuming I would just need to put "myCurator" in front

little raptor
#

if that's your curator, maybe

#

but still it depends when the object is added to the curator

#

you have to remove it after it's been added

tardy oriole
#

would that be the variable name of the 3den module?

stuck rivet
#

how can i get the impact position of the bullet when a gun is fired?

#

even if it has missed entirely

tardy oriole
#

then I know the name thanks

little raptor
stuck rivet
#

what does that mean?

little raptor
#

add a Fired/FiredMan event handler
get the projectile
launch a loop to find out when the projectile dies

#

the last position before its death is roughly the impact pos

stuck rivet
#

what about ricochets?

little raptor
#

use vectorCos or something

#

Β―_(ツ)_/Β―

stuck rivet
#

idk what that is but i suppose i could end the loop when the z value starts getting higher

little raptor
#

ricochet doesn't always cause the projectile to go higher

#

it simply changes its direction

stuck rivet
#

most of the time it would

#

at least over a flat plane

tardy oriole
#

apologies I am back, neither the variable name nor the owner name work as the curatorModule

little raptor
tardy oriole
#

so it being the last thing on the list would not be that would I need to add a delay for it?

little raptor
#

even a delay may not be enough

tardy oriole
#

so im better off using the "remove from Zeus" module then trying to get it to do it for me automatically

little raptor
tardy oriole
#

oh

tardy oriole
#

gotcha

stuck rivet
#

are there any way to have an invisible object that works with a HitPart eventhandler?

hallow mortar
#

Depending on the object you may be able to make all its textures invisible using setObjectTexture. It will still have collision etc though

stuck rivet
#

why isn't this working? In theory it should only show the hint once teh while loop is done, instead it shows up immediately with the muzzle position

this addEventHandler ["FiredMan", { 
 params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];

projectilepos;
while {alive _projectile} do 
{
projectilepos = _projectile;
};
hint str position projectilepos;
}];```
copper raven
#

event handlers are unscheduled

winter rose
#
this addEventHandler ["FiredMan", { 
  params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];

  projectilepos; // useless
  while { alive _projectile } do // in an unscheduled environment, this does max 10000 iterations then stops
  {
    projectilepos = _projectile;
  };
  hint str position projectilepos;
}];
stuck rivet
#

what does it being unscheduled mean?

winter rose
#
this addEventHandler ["FiredMan", { 
  params ["", "", "", "", "", "", "_projectile"];
  [_projectile] spawn {
    params ["_projectile"];
    private _projectilePos = 0;
    while { sleep 0.01; alive _projectile } do // scheduled
    {
      _projectilePos = getPosASL _projectile;
    };
    hint format ["final position: %1", _projectilePos];
  };
}];
winter rose
#

basically, unscheduled is "run everything at once now (therefore no sleep or waitUntil) whereas the scheduler is a pile of scripts where each gets 3ms runtime per loop then it goes to the next

stuck rivet
#

i notice you use sleep, does that not require [] spawn to work?

copper raven
#

it does

winter rose
#

line 3

stuck rivet
#

oh i see it now

#

anyway thanks

#

i always get [0,0,0] though

#

also an error if the impact is close: Error getposasl : Type number expected Object

brazen lagoon
winter rose
stuck rivet
#

thanks, what was the mistake?

winter rose
#

I did _pos = projectile then getPosASL _pos which obviously did not work

still forum
stuck rivet
#

oh i see

brazen lagoon
#

;__;

#

@still forum when's branch cutting date?

still forum
#

some time next week

little raptor
#

what on earth is branch cutting? thonk

still forum
#

I call it branch split. When we split off a release

little raptor
still forum
#

yeah

#

And after the split everything that goes into the "stable" branch needs to be manually checked and approved, and usually only bugfixes and critical stuff goes through

brazen lagoon
#

yeah

#

ok I will try to remember to ping you monday

little raptor
brazen lagoon
#

hopefully you get time for it before branch cut but oh well

#

yes @little raptor some places call it splitting some place call it cutting ive heard a lot of different phrases for the same thing

#

I'm thinking of making an addon similar to CF_BAI but in reverse, so I'm hoping to get an addition to getTextureInfo that gets you the avg color of a texture so that I can generate how good a uniform/vest/helmet/etc should be, camo-wise, in relation to the ground texture

little raptor
#

I once had the same idea. but since it wasn't possible I didn't persue

brazen lagoon
#

worst case scenario I can do this manually for the stuff in EBOs and write something in Intercept to pull the data externally for stuff in pbos.

#

but having it in the command would make it much easier

#

actually both you and @still forum might have some input on this - this script would likely need to do a nearObjects call on all units to get trees nearby - is this going to be a performance nightmare?

#

should I write that using intercept w/ C++?

little raptor
#

otherwise could be

little raptor
brazen lagoon
#

ok

still forum
#

nearObjects is now multithreaded. so larger distances work quite a bit better than before

brazen lagoon
#

neat

#

so as long as the individual thing I'm doing on each object is simple, it should be fine

boreal parcel
#

heyo leapard, I got that script from last night working locally however whenever I throw it on the dedicated server it doesnt work, however im sure its not exiting due to the server anymore as it chats success but doesnt hint Failed. Any Idea what could be the issue?

// Check to make sure this script is executed on the server ONLY
if (isServer) then {"Success" remoteExec ["systemChat"]};
if (!isServer) exitWith {["Failed"] remoteExec ["hint"]};
boreal parcel
little raptor
#

you're always executing it on the server

boreal parcel
#

yeah, but im confused why its working on my local machine, pops the targets up fine but doesnt work when I throw it on a dedicated server

little raptor
#

im confused why its working on my local machine, pops the targets up fine but doesnt work when I throw it on a dedicated server
could be a locality issue

#

but as far as I can see that script doesn't have one

#

all commands have global effect/args

boreal parcel
#

Throw this in the init of a laptop

_targetArray = [];
for "_i" from 1 to 20 do {  
  _targetArray pushBack (missionNamespace getVariable [format ["target_house%1_%2", 5, _i], objNull])  
};

this addAction["Sector Targets",{ 
    _targetArray = _this select 3; 
    [[_targetArray,0,1,true], "popup.sqf"] remoteExec ["execVM",2] 
 
},_targetArray]; 
#

and trigger the addAction, sends a chat in systemChat Success so the script runs, and it works just fine locally

#

I even got it to print the array showing it has all of the targets

#

but when I do so on the server, it doesnt hint saying 0 targets or do anything at all besides chat Success

little raptor
#

according to the wiki animate is global effect

#

I'm gonna take its word for it for now

#
this addAction["Sector Targets",{ 
    _targetArray = _this select 3; 
    nopop = true;
    [[_targetArray,0,1,true], "popup.sqf"] remoteExec ["execVM",2] 
 
},_targetArray]; 
#

what about this?

little raptor
#

or on the server?

boreal parcel
#

isnt nopop a local variable to the script? and no just locally, ill try doing so on the server.

And one more thing, I have a firing range script that instead of animate uses animateSource, would that make any difference?

little raptor
#

isnt nopop a local variable to the script
no

#

instead of animate uses animateSource
maybe blobdoggoshruggoogly

#

if your script is too old maybe the object animations have changed

#

I don't know what those target objs use

boreal parcel
#

hmm, ill just try doing all of the above real quick, and I dont know how old the script is to be honest. However my firing range script, which works for the most part, uses event handlers such as this

//Target is in line, initalize it
_x setVariable ["RQR_controller", _laneController];
_x animateSource ["terc", 1];
_x addEventHandler [
  "HandleDamage", 
  { 
    params ["_target", "_selection", "_damage", "_source", "_projectile", "_hitPartIndex", "_instigator"];
    if(_target animationPhase "terc" == 0) then {                
      if(_projectile isKindOf ["BulletBase", configFile >> "CfgAmmo"]) then {                
        playSound3D [SOUND_POPDOWN, _target, false, getPosASL _target, 1, 1, 300];
        _target spawn {
          waitUntil {(_this animationPhase "terc" == 1)};
          waitUntil {(_this animationPhase "terc" < 1)};
          _this animateSource ["terc", 1];
        };
      } else {
        _target animateSource ["terc", 0];
      };
    };
    0
  }
];
little raptor
boreal parcel
#

yeah, its a firing range with multiple rounds

#

its code thats way to complicated for me to replicate/modify lol

little raptor
boreal parcel
#

uh

#

changing animate to animateSource worked, the targets popup now

#

I assume the reason there is no hint Targets: 20 message is because the script is only executed on the server

#

hmm the targets do keep poping back up though

#

So that was a lie

// Ensure the targets do not pop up again once shot
nopop = true;
#

hmmm

#

the targets stay down locally though

little raptor
boreal parcel
#

Ah I just decided to use systemChat instead

warm coral
#

does anyone know a script where when the trigger is activated it ONLY damages the nearest player to the trigger?
currently my issue is that it damages all players

warm coral
little raptor
warm coral
#

thank you very much

limber rune
#

Not sure where to post this since there isn't a mod help channel - I'm having a problem here. I have all my pbos signed in my mod and they are all binarized but when I export one pbo and edit something and repack it with pbo and try and join the server with the same updated mod it says its not signed with the key in the server and if I use addon builder the server says a list of mods require it the pbo but its in there. what is a fix for this?

warm coral
#

anyone know why when i use this script

    while {alive barb1} do {
     sleep 1;    
      _distance = player distance _this;
        if (_distance < 2) then {
        sleep 0.5;  
          [player, 1, "leg_l", "stab"] call ace_medical_fnc_addDamageToUnit;
              [player, 1, "leg_r", "stab"] call ace_medical_fnc_addDamageToUnit;

          };   
    };

just breaks when in multiplayer?

brazen lagoon
#

@warm coral where is it running

#

if that's not running local to the player that's why

warm coral
#

how can i make it run local to the player?

warm coral
brazen lagoon
#

@warm coral where is it being called from

warm coral
#

nvm for some reason it just works now

limber rune
#

any help for me πŸ™‚

brazen lagoon
limber rune
brazen lagoon
#

then idk

#

I haven't actually figured out pbo signing yet so I'm sorry I can't be more helpful

trim solstice
#

Ok dumb, abstract idea I need help with because I can't script for the life of me. So I've got this thing, where I'm planning on having an "Ice Mage", I'm just planning on using the VR Arrows, and just calling them "Ice". I would like them to "throw" these ice arrows at the players, with two different types of attacks, one directly from them, and one from above that descends down. Any ideas for the scripting?

ruby bronze
#

Should marker manipulations like resize or hide be in init.sqf or initPlayerLocal.sqf ?

I'm trying to get a pulsing or "ripple effect" from a marker but

while {true} do {
  sleep 4;
    "marker_81" setMarkerAlpha 1;
      ["marker_81",[50,50],3] spawn BIS_fnc_resizeMarker;
    ["marker_81",3] spawn BIS_fnc_hideMarker;
    ["marker_81",[0,0],0.0001] spawn BIS_fnc_resizeMarker;
  };

Is flickering on dedicated server, and even when editor testing it flickers back on one time after fully fading out

fair drum
ruby bronze
#

Thanks, would sleep x be sufficient in between each or is there another delay I'm not aware of

Edit: Adding a sleep in between each has done the trick, going to dial in the exact numbers a bit but this is quite promising, thank you again

Edit 2: Still flickering on dedicated, even though editor testing is now perfect.
Could this have anything to do with where I'm running it?
I've got an [] execVM "markerPulse.sqf"; inside my init.sqf
Or is sleep not reliable enough on dedicated server, hence why it's only flickering there?

Edit 3: Moving the execVM to initPlayerLocal did the trick on the dedicated server. Everything is good now =D

acoustic abyss
#

My mission objective requires that a terrain object be destroyed. After some lazy searching I came upon a script executed on a game logic:

0 = [this] spawn  
{  
waitUntil{!alive (nearestObjects [_this select 0, ["Land_TTowerBig_1_F"], 3] select 0)};  
boomradio1 = true;
publicVariable "boomradio1"; 
};

But I'm rethinking this for two reasons: 1) the waitUntil and nearestObjects is spamming the RPT. 2) A publicvariable is a bit inefficient networkwise.

Is there a more efficient way of detecting the destroyed object, then synchronizing a change in player objectives for everyone?

#

First thing I could do would be to hide the terrain "Land_TTowerBig_1_F" and replace it with a variable named one. But I rather liked this set up for not needing to replace objects.

little raptor
little raptor
# acoustic abyss My mission objective requires that a terrain object be destroyed. After some laz...

Is that why you think it's inefficient? meowsweats
No.

  1. It's using a waitUntil and no sleep
  2. It's using nearestObjects
  3. It doesn't even check if the list is empty and just does select 0
  4. It uses a loop for something that doesn't even need a loop -> waste of performance
    And publicVariable is not inefficient per se. But doing it for no reason, in bursts and more importantly sending large data is.
    Anyway, there are event handlers for something like that. See BuildingChanged or something like that
acoustic abyss
#

Yes, publicVariable isn't automatically inefficient. But in this looping check, with a long variable name, it of course is in terms of network bandwidth. I suppose I was asking a second question: how to efficiently synchronize a task state across clients on dedicated.

#

With thanks for your patience to my programming naivety.

#

I have a lot to learn

little raptor
#

Not sure why you start with a "No".
because the publicVar is not the reason it's inefficient

#

waitUntil and nearestObjects are repeatedly flooding the program with errors
neither waitUntil nor nearestObjects have errors

#

the error is probably because of what I said in my 3rd note

distant oyster
haughty copper
#

im trying to make animals spawn on players if they go to certain parts of the map but i like it to be random amount and times when it dose so this what i can think of tbh _unit = group player createUnit ["RaptorAIM1", position player, [], 10, "FORM"]; // is there a little script laying around i can adapt to what i need

distant oyster
#

for random times:

if (random 1 > 0.5) then {
  // spawn
};
``` for random amounts:
```sqf
for "_i" from 0 to (ceil random 5) do {
  // spawn
};
haughty copper
distant oyster
#

the if would only spawn in 50% of the cases, the for loop will spawn between 1 and 6 units

haughty copper
#

ok kinda follow i'll make something up see if works i'll drop in again if i broke my server lol πŸ™‚

haughty copper
#

if (random 1 > 0.5) then {

for "_R" from 0 to (ceil random 5) do {
_spawn = ["R1","R2","R3","R4","R5","R6","R7","R8","R9","R10","R11","R12"] call bRs_fnc_selectRandom
spawnmodule = [["RaptorF1_ID1","RaptorF1_ID2","RaptorF1_ID3","RaptorF1_ID4" ["createVehicleLocal", "getMarkerPos _spawn"]];

removeallweapons _x; // not sure this is needed
removeallmagazines _x; // not sure this is needed

spawnmodule setvariable ["LifeR_Spawn_move","MOVER",true];
spawnmodule setvariable ["LifeR_Spawn_pos",position player,true];

};

};
};

#

hmm this kinda s**t but can think of a way lol

willow hound
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
trim solstice
faint oasis
#

hi, i'm creating a gui and i want to know if we can have a "Listbox" with a text automatically resized or the text move left to right until the text reach the end ?

tidal ferry
#

Hey, question

#

Why is BIS_fnc_replacewithsimpleobject not recommended for use in MP or for use with large numbers of objects?

winter rose
#

it might be performance-expensive

tidal ferry
#

Hmmm

#

Like, in what way? Just while things are converting, or long-term after everything has been converted to simple objects?

#

Currently, a method our unit uses for optimization is converting compositions with large numbers of static objects to simpleobjects at the start of the mission, using a script we used that forces excecution in the scheduled environment to keep the unscheduled queue from overloading

#

In our experience it's laggy at the start of missions, but in missions it levels out

#

Of course since I'm still learning things, I'm looking to review whether that's the best option or not

winter rose
#

one thread, all the config reading the network deletion-creation, etc all for only one object I would tend to believe

tidal ferry
#

Hmm okay

opal sand
#

@little raptor hey bro, what was that link you sent before on converting image formats please? didnt save it to my favorite
Nvrm - found it
#arma3_model message

and, do you know the dimensions of the weapon picturs for loadout screen please?

cosmic lichen
#

You can get the text's width and resize the listbox

#

You could also cut the text and display the full text in a tooltip

faint oasis
#

yeah but i want to resize only the text line

#

not the listbox

#

i don't know if you see what i mean

cosmic lichen
#

The text line's width is almost the full width of the listbox

#

minus some margin left and right

#

so not sure how you would resize the the row without the listbox

faint oasis
#

oh yeah so i mean the "row"

#

ok interesting

#

no problem

cosmic lichen
faint oasis
little raptor
faint oasis
little raptor
#

just put the listbox in a controls group

faint oasis
#

but what is the difference ?

little raptor
#

when you resize the listbox in a controls group the visual size will be that of the controls group

faint oasis
#

ok but it will resize what ? just the row i want ?

little raptor
#

do you even know what a controls group is?

faint oasis
#

yeah you can put a lot of controls in

#

it's like a listbox for controls

#

i already used a controls group

hollow plaza
#

Hey there, this script is returning "error undefined variable _tokensWithdrawable" and I can't find any issues with it.

addAction itself pops up and a systemChat before it is able to show the value of _ctokens (0)```
_atmID addAction
[
"Withdraw 5 Tokens",
{
[(_this select 0), _atmInv, 5, _ctokens] execVM "WithdrawTokens.sqf";
},
nil,
1.5,
true,
false,
"",
"true",
3,
false,
"",
""
];


In ``WithdrawTokens.sqf``:

_tokensWithdrawable = (_this select 3);
systemChat str _tokensWithdrawable;

little raptor
#

that's the point of it

#

not "putting a lot of controls in it"

faint oasis
#

yeah a window and you can put control on or in

#

it's the same

#

and when you move the control groups

#

all controls on will move

#

without moving all controls one by one

#

but i haven't tried to resize a control groups

#

i just tried a control groups with a lot of combo box in

little raptor
#

I said resize the listbox

faint oasis
#

ok

#

then i will try

#

but i will get what after ? because i haven't really understand sorry

bitter jewel
hollow plaza
#
systemChat str _ctokens;

_atmID addAction
[
    "Withdraw 5 Tokens",
    {
        [(_this select 0), _atmInv, 5, _ctokens] execVM "WithdrawTokens.sqf";
    },
    nil,        
    1.5,        
    true,        
    false,        
    "",            
    "true",     
    3,            
    false,        
    "",            
    ""            
];
little raptor
hollow plaza
#

Here it it is with the systemChat included

bitter jewel
#

the code block you give inside the addaction creation has a different context which does not have the _ctokens variable

#

it is undefined in that context

#

you can try to systemchat the value of _ctokens inside that codeblock before your execVM and it will tell you the same

faint oasis
#

i will tell you what i get thx for your help

hollow plaza
tidal ferry
#

Hey question- so for the titles config entry in CfgSounds

#

Got a voice line sound where I have subtitles configured

#

How do I play the voice line with the subtitles on screen? Is there a way to do that?

#

Ah nvm I'm a fool, it's baked into playSound XD

#

Thanks!

limber rune
#

Anyone good with Main Page buttons that instantly connect to your server? I have it all setup and everything but when clicking it won't connect before I changed the IP to new one it used to bring me to server browser since it wasn't the updated one

stone coral
willow hound
#

Quite possibly yes. You can measure the code execution time in the Debug Console and compare the results πŸ€·β€β™‚οΈ

limber rune
#

anyone?

limber panther
#

hello everyone!
I need a little help. I would like to spawn a vehicle using a script and i need the vehicle to be a medical vehicle - i'm referencing to ace3 mod where (in attributes) you can check a checkbox of each vehicle whether the vehicle will or won't be a medical vehicle, this is the script i use and works: ```sqf
this addAction ["Means CV EMS", {
private _vehicle = createVehicle ["M_CVPI_EMS", [14909,13771]];
_vehicle addAction ["Last 112 call", {
[caller_position] spawn gps_fnc_main;
}];
_vehicle addAction ["Last 911 call", {
[caller_position2] spawn gps_fnc_main;
}];
_vehicle addBackpackCargoGlobal ["B_Bergen_hex_F", 1];
_vehicle addBackpackCargoGlobal ["TFAR_rt1523g", 1];
_vehicle addBackpackCargoGlobal ["CUP_B_SearchLight_Gun_Bag", 1];
_vehicle addBackpackCargoGlobal ["CUP_B_SearchLight_Tripod_Bag", 1];
_vehicle addBackpackCargoGlobal ["ACE_TacticalLadder_Pack", 1];
_vehicle addItemCargoGlobal ["TDD_Talon_Mag", 6];
[_vehicle, true] remoteExec ["enableDynamicSimulation", 0];
}];

distant oyster
calm yarrow
#
while {alive BEE} do {
 sleep 1;
  if (BEE distance (getPosASL player) < 50) then 
    {
      player switchmove "AmovPercMstpSrasWrflDnon_AinvPercMstpSrasWrflDnon";
};
};```
#

Having looping problems

#

Trying to make it repeatedly check the distance from the player and if it is inside of its distance, it will run the script

limber panther
limber panther
distant oyster
#

the second one requires the macro to be defined

limber panther
#

well i have no idea what it is

#

anyways, have you any other suggestion, how to make a vehicle medical vehicle using a script?

distant oyster
#

maybe

_vehicle setVariable ["ace_medical_isMedicalVehicle", true, true]
limber panther
calm yarrow
#
while {alive BEE} do {
 sleep 1;
  if (BEE distance (getPosASL player) < 50) then 
    {
      player switchmove "AmovPercMstpSrasWrflDnon_AinvPercMstpSrasWrflDnon";
};
};```
#

needa help looping

graceful kelp
still knoll
#

I personally perfer to use vectordistance e.g.

(getPosWorld BEE) vectordistance (getPosWorld player) 
#

Also make sure you are running your script in a scheduled environment

hushed tendon
#

Is it possible to use structured text in systemChat?

winter rose
#

no

hushed tendon
#

dang

winter rose
#

the wiki says it all

hushed tendon
#

I'm blind I guess

winter rose
#

"String" πŸ˜‰

hushed tendon
#

Yeah I kept searching for ways to make it a string but couldn't find any so that's why I asked

fair drum
#

if you want funny colors in chat, you can create other custom chat channels with colors, but its just the channel title that will be a different color

hushed tendon
#

I managed to get it working with some RscStructuredText

real tartan
#

addEventHandler, which event handlers are persistent (i.e. they stay attached to the unit, even after it dies and respawns) ?

willow hound
#

If it's not on the wiki, then you'll have to test it yourself.

tall dock
#

So I could need some help here. I'm trying to execute code when a variable is equal to DisplayNull . I did this with if (someThing && {isNull (uiNamespace getVariable "my_var")}) then { , but it never executes. When I check the comparison via systemchat, it does not provide the expected false, but it returns bool instead. I also tried this with (uiNamespace getVariable "my_var") isEqualTo displayNull and (uiNamespace getVariable "my_var") == displayNull. Everything returns bool instead of false.
What am I missing here?

distant oyster
#
isNull (uiNamespace getVariable ["my_var", displayNull])
little raptor
#

it returns bool
it means the variable is not defined. use what Terra said to give it a default value if it doesn't exist

tall dock
#

Nice, thank you! I guess that'll fix it.

#

Yup, totally fixed it. Thanks a ton!

slim spire
#

how do I configure what to whitelist or blacklist for BIS_fnc_3DENExportSQF?

tough parrot
#

How would this generate zero divisor error?

        _pointerY = (matrixMdlSpc select 1) select 0;
dapper cairn
#

Sorry if this is the wrong channel and #arma3_scenario Would be better but I need help, this mission needs to be ready in 2 hours.

I am looking to put the MW2 Radio Chatter into a mission but I cant find the page that says how to. I want it to start when the players enter a trigger that way it doesnt all play before they get there

winter rose
dapper cairn
#

okay ty

#

i get confused between which would be the right one

real tartan
#

if I define function in initServer.sqf can I use it already in initPlayerLocal.sqf or should I re-define it in initPlayerLocal.sqf again ?

// initServer.sqf
MY_fnc_somethingToDo = compile preprocessFile "fn_somethingToDo.sqf";
// initPlayerLocal.sqf
[player] call MY_fnc_somethingToDo;
distant oyster
#

the player wouldn't even know about the function in the first place (unless it is a hosted mp)

real tartan
distant oyster
#

CfgFunctions is the best option anyway

real tartan
#

could it work with initServer.sqf and then publicVariable function ?

distant oyster
#

technically: yes. but that only makes sense in certain situations

#

otherwise you are wasting performance and bandwidth

dusk gust
#

Does anyone know if backpackSpaceFor still works? Tried to run it and it just returns a generic error in expression.
https://community.bistudio.com/wiki/backpackSpaceFor

Edit: Nevermind, the example using (backpack player) seems to be wrong and should be (backpackContainer player)

pale glacier
#

Hello! I have a public variable in my init.sqf

ma = _nearestMarker;
   publicVariable "ma";

I tried using the variable itself in my initServer.sqf but it seems to not recognize it

How do I make sure the publicVariable is useable ALSO in other SQF files?

#

Thanks in advance

winter rose
pale glacier
#

So if I use publicVariable in initServer.sqf..It would be recognized in init.sqf?
Of course make sure it's a server thing running there..

#

Thanks for the link, very useful!

copper raven
#

publicVariable broadcasts to other machines

#

it has nothing to do with files

pale glacier
#

Ok, learning all the time πŸ™‚

Thanks again!

copper raven
#

a global variable is available anywhere on a machine as long as it's defined before it's used(obviously)

pale glacier
#

Roger that. Solves my question about why it's not recognized in other SQF but it IS ingame
πŸ˜πŸ‘Œ

slim spire
#

how do I configure what to whitelist or blacklist for BIS_fnc_3DENExportSQF?

cosmic lichen
#

Probably via the 4th parameter @slim spire

slim spire
cosmic lichen
#

I believe via it's Eden Entity ID

slim spire
#

Where would I use that number to blacklist it?

#

Sorry if I'm not understanding, but say for example, I want to grab only a specific amount of AI. I'm not sure how to whitelist that group or blacklist every other object before calling that command

white kite
#

How do you attachTo with automatic offset but without it changing the rotation of the attached obj?

white kite
#

Found it -> BIS_fnc_attachToRelative

languid tundra
#

Am I correct to assume that the effect of setTriggerStatements gets synchronized to all machines if applied to a trigger created with the makeGlobal true?

#

Apparently I'm wrong notlikemeowcry

copper raven
#

wiki says effect local

eager prawn
#

I have a script in initPlayerLocal that executes when a player joins the server. It references an array and sets a local variable on the player so that we can reference it later (i.e, player rank = private). It's annoying to this do on every mission.

Is there a way to do player JIP scripting from a mod?

#

Anything like an event handler for a player connecting?

#

found onPlayerConnected actually, that'll work I think

distant oyster
#

not sure about mods but any function with the preInit or postInit attribute will run on mission start

warm coral
#

anyone know a easy way to make a vehicle follow a object like train tracks?

brazen lagoon
winter rose
brazen lagoon
#

well he did tell me to ping him about it

winter rose
#

fair enough

brazen lagoon
#

I wouldn't bug him if he didn't! promise

#

his time's valuable

round scroll
#

CBA_A3 keybindings offer something like that, for example sqf private _keys = ((_keybinds # 8) apply {_x call CBA_fnc_localizeKey}) joinString ",";

sonic sleet
#

Is there a Command to check how strong a object is? Or some way to Measure its Resistance/Bullet Pen Value? Basically the Armor of an Object

languid tundra
winter rose
#

weather-related commands perhaps?

languid tundra
#

Maybe, I remember there were some discussion about such cases recently, but I can't find it πŸ˜…

limber panther
#

hello, i've got a problem and i would like to try to fix it with a script but i have no idea what should i do, the things is, that no matter how hard i try, players still get marked as team killers by game (tried adding huge score, disabling negative points, ...) for example when they survive a plane crash. So since there is no way to prevent this from happening, at least i want to let players know they got marked as teamkillers and force them to relog. My idea is to have a script, that checks for teamkillers and once someone is a teamkiller, he gets a hint saing to relog and an annoying sound in a loop πŸ€·β€β™‚οΈ in terms of identifying teamkillers, i found this https://community.bistudio.com/wiki/sideEnemy does anyone have any idea how to solve this issue? thank you

hushed tendon
#

So I uh overwrote the BIS_fnc_endMission with my own code cause I wanted to run something before the mission ended (Mission ends when tickets are 0) and now no matter what end mission command I use the mission doesn't end anymore... anyone know what to do?

supple cove
#

I have a question... I can't test because my potato laptop will burn down if I open 2 armas

Are joining players considered to be in the group?

With joining I mean people who were on the briefing section, now loading the game but still not in the actual game.

I'm trying to wait to start the mission when everyone is ready, so i've made a trigger set to wait for the whole group and another to wait for no blufor units in the area, something like this:

A * B, where the first trigger will register a variable when the group is ready and then the second will register when they are gone, so only true when 1 and 1, = 1

But i suspect people join the group as they spawn, so the first person is considered to be a full group.

Maybe i should check if allPlayers are currently alive and then register that trigger, but testing is hard here

supple cove
#

Now I don't know if allPlayers return people loading the mission yellowchain

fair drum
fair drum
#

i got something in the think tank for you but it won't be tonight

fair drum
fair lava
#

would it be possible to make a mod that shows you your own sensor targets on the map?

#

not spotted targets, i mean the actual sensor info

#

possibly even display stuff like the radar cone and other sensor radius's

paper fulcrum
#

hey does anyone know hot to make setObjectScale work in MP? I've seen some youtube videos featuring it but I couldn't find a script or make it on my own

warm hedge
#

It says Global Effect. So there's no problem

paper fulcrum
#

hmm I tried using it when it first came out but couldnt get it to work. I'll try again xD

warm hedge
#

β€œIt didn't work xD” won't help you. Write what's wrong and what's the code

paper fulcrum
#

trying to find it

#
[] spawn {
    while {alive dude} do {
    dude setObjectScale 1.5;
    };
};```
#

had this which partially worked

warm hedge
#

What does partially you mean

paper fulcrum
#

the "dude" went back and forth to normal scale

#

like twitching

warm hedge
#

It's normal

paper fulcrum
#

can I get over it?

warm hedge
#

Better not to

paper fulcrum
#

/=

warm hedge
paper fulcrum
#

πŸ€”

#

sad

#

wanted to make a toy soldiers op πŸ˜›

#

anyway thanks for your time mate

crude vigil
paper fulcrum
#

yeah that's my idea rn

crude vigil
#

You ll face some other issues depending on scenes but, well up to a point it can be handled I believe.

paper fulcrum
#

I'll try and see. the issue I saw was that only the texture gets scaled not the hitbox, units could walk thru a scaled building's walls

crude vigil
#

Yep thats one of those issues right there.

paper fulcrum
#

maybe I can put invisible walls to prevent it

#

I have heard a myth that AI can phase thru objects with disabled sim. Is it true ?

warm hedge
#

If the AI didn't recognize the wall/object, yes

#

It doesn't matter if the simulation is enabled or not

paper fulcrum
#

I see

#

how to be sure that AI recognizes the object?

warm hedge
#

Nothing. If you place an object in Eden Editor (aka not as a terrain object), it won't be recognized AFAIK

paper fulcrum
#

😯

#

that's interesting

open fractal
#

or (presumably) attachTo

paper fulcrum
#

πŸ‘πŸΏ

last rain
#

Arma 3: Dynamic Simulation
Limit by View Distance Limits all activation distances to player's object view distance (default: true). Dynamically simulated entities beyond the object view distance will be disabled.
I can off option Limit by View Distance in game with script?

little raptor
#

you can just write a script that adjusts dyn sim dist based on view distance tho

restive slate
#

Hi there. Anyone knows how 3den gets info for surface snapping on buildings? Tried all available LOD's in LineIntersectSurfaces and I can't get to the real intersect point

little raptor
restive slate
#

I have the interesect positions, they just don't match the surface snapping point on some buildings

little raptor
#

sadly that doesn't give the surface normal notlikemeow

little raptor
restive slate
#

ah

#

but that is not an option LOD in lineintersectssurfaces is it?

little raptor
#

no

restive slate
#

anyway to get it by script?

winter rose
little raptor
little raptor
restive slate
#

Sorry, getpos seemed such a weird answer that I thought you didn't understand my question. Iim going to see how it works. Thanks!!

distant oyster
little raptor
# still forum

btw you wouldn't happen to be interested in implementing a command that gives all triangles in a lod right?
I'm working on something right now to use lineIntersectsSurfaces to "dump" the LOD and its animations (for path finding, using its convex hull)
but if I could simply get all the triangles it would save me a lot of effort (and performance meowsweats )

still forum
#

correct, I wouldn't very much

little raptor
#

I'm talking about VIEW/GEOM/FIRE LODs, not the high quality res LODs

hushed tendon
still forum
#

Geom I would potentially.. but.... not.. no
FTon of data to export :u

little raptor
#

well I only want the triangles, in one array of 3D positions (e.g. [[1,2,3], [4,5,6], [7,8,9], ...])

#

if the game also stores indices that can reduce the number of vertices (so you'd return two arrays: one array of vertices, and one array of indices)

still forum
#

possible... but eh

little raptor
#

maybe you'd be more interested in the final product πŸ˜…
I'll show it to you when it's done

still forum
#

I can smell burned cheese from my baguette. Thats not good

restive slate
little raptor
#

no

#

at least not as of now

restive slate
#

so I'll be creating a bunch of them, I'm using 10cm balls

little raptor
#

I personally need it a lot too

restive slate
#

and deleting them

little raptor
#

that's super slow

#

just use one

restive slate
#

and setposasl it, right!

#

so i create my helper objects in the beginning of the script and move them around as needed. It's amazing that it never crossed my mind before

winter rose
still forum
#

It was a good baguette, it has now been eaten

winter rose
#

uwu

fair lava
#

does sqf have a ternary operator

little raptor
#

no

copper raven
# fair lava does sqf have a ternary operator

you can recreate similar behaviour with other commands, like this:
_something = ["Player is dead", "Player is alive"] select alive player
though, with the select both of the values will be evaluated(i won't explain how it works), so in cases where you have constant literals, or very cheap computations, it's fine, otherwise you can use if:
_something = if alive player then {something expensive to compute} else {blablabla}

brazen lagoon
#

@still forum I love you <3

#

how do I buy you a drink lmao

still forum
#

Become a big modder and community figure and be invited to bohemias next big anniversary party and meet me there at the bar

brazen lagoon
#

damn

still forum
#

Trust me, thats the best for all of us

little raptor
#

or just support him on Patreon

still forum
#

:pout_kitty:

brazen lagoon
#

oh right you have a patreon

tired delta
#

Hey guys, i ran into a problem while scripting a small script. My problem is im trying to make a unit come close up to the player like this:
_npc domove getposATL _player
But the unit stops 20m away of the player and i dont seem to get it working. I hope someone of you guys got a clue πŸ˜„

little raptor
tired delta
#

yeh that could be sorry πŸ˜„

tired delta
little raptor
hollow thistle
#

also setDestination could help, no?

little raptor
#

it only works on agents

#

another method is using animations directly
that one will definitely work but needs a lot more work compared to a simple doMove, etc.

tired delta
little raptor
#

idk what it uses

#

Β―_(ツ)_/Β―

#

could be animation

tired delta
#

i tryed to look up like how the zombies behaviour was build and they did it just like this _zombie domove getposATL _target;

#

but i will give it a shoot

#

thx @little raptor ❀️

sharp grotto
#

arma is weird and ryan zombies & demons is a bad example since the boundingbox of a heli can already stop them from moving torwards a person. ^^

hushed tendon
#

I know it’s a little weird but you could have an invisible unit (The AI/Brain of unit) and attach another unit (What you see) and just animate the visible unit. Seeing as the unit is invisible I think it will move closer to the targeted unit from what I’ve experienced before

#

I’ve done this before when I made some rabid rabbits and they would literally run and sit on the feet of the unit

little raptor
#

that'll look weird

#

animating the unit will do the job

brazen lagoon
#

yeah this is a tough one

#

just to be clear @tired delta what do you want to happen? You want AI units to walk up to players and attack them, correct?

oblique summit
#

Hi guys, how could generate a random number?

brazen lagoon
#

bis_fnc_randomint

#

or bis_fnc_randomnum iirc

little raptor
winter rose
#

ooor… this ^

brazen lagoon
#

both of those work, random is faster

#

the bis functions are useful if you want random numbers between a range

oblique summit
#

thanks guys πŸ˜„

little raptor
brazen lagoon
#

oh can it that's nice

#

oh right but it has to be weighted

winter rose
#

otherwise (10 + random 80)

oblique summit
brazen lagoon
#

right right. I think the only real reason to use the bis fnc is for a random int simply

#

but you can achieve the same yourself ofc

winter rose
#

yep, the functions are shortcuts

oblique summit
#

I need an Script that generate a random number tu desactivate a bomb, but in each game play I want the number could generated randomly

#

I reading the function how do this

winter rose