#arma3_scripting

1 messages · Page 498 of 1

midnight mauve
#

@pure blade Thank you.

pure blade
#

no problem

astral tendon
#

Is there a key bind to opem the editor and select the mission intead of me have to make a new mission frist to be able to select my missions I am working?

digital hollow
#

You can possibly change the center main menu spotlight to open a particular mission in editor.

astral tendon
#

How?

digital hollow
compact maple
hollow thistle
digital hollow
#

Absolutely. I source it in the readme. This is packaged into the menu spotlight.

neon snow
#

So, setCustomSoundController have been removed or what?

outer fjord
#

If I delete a object that has AttachTo objects on it, will it automatically take those out as well or do I need to write a additional set up in the script to get rid of them as well?

runic mica
#

The attached objects will have disabled simulation until moved. So a crate on a truck will stay in the air, while the truck is deleted.
You should detach and delete all attached objects and delete the object afterwards.

outer fjord
#

What would be the recommended way of getting all the objects for deletion after de-attach? Like get them all within a certain radius? Or could I delete them before the vehicle is deleted?

runic mica
#
{
    detach _x;
    deleteVehicle _x;
} forEach (attachedObjects myObjectWithAttachedObjects);
deleteVehicle myObjectWithAttachedObjects;
still forum
unborn ether
#

lol, so && {bool} has worse result than && bool at some point? Interesting.

still forum
#

if all are true yes

#

Always target your lazy eval code after what you expect will most likely happen

proven crystal
#

question on eventhandlers, i want an eventhandler to remove itself on execution. i can get the index of the EH via _thisEventHandler in the code? its mentioned on the wiki but i dont see examples about it

still forum
#

yes you can

#

what kind of eventhandler though?

#

with UI Eventhandlers you could crash the game

proven crystal
#

MPHit

#

also can pass additional parameters to the code somehow?

still forum
#

no you can't

#

And I'm not sure if removing MPHit also removes it on every other machine

proven crystal
#

so i guess i have to remove it with remoteexec on every machine to be sure?

#

hm im either making some mistake or MPHit does nit fire when simulation is disabled? i thought units still take damage

#

apparently they dont...

unborn ether
#

@still forum If you spawn to ctrlDelete or to remove eventhandler by itself - its fine. Just throw that to schedule.

still forum
#

yep

edgy dune
#

so Ik I can attach a particle effect from cfgCloudlets with

_source01 = "#particlesource" createVehicleLocal getpos _u;
_source01 setParticleClass "NameOfParticleEffect";
_l1 attachTo [_unit, [0,0,0], "Spine3"];

but is there a way I can attach a light effect from cfgLights like I would do for particle effect by setting a class for the createVehicle or do I have to recreate it via script like so

_l1 = "#lightpoint" createVehicleLocal getpos _unit;
_l1 setLightDayLight true;
_l1 setLightColor [5, 2.5, 0];
_l1 setLightBrightness 0.1;
_l1 setLightAmbient [5, 2.5, 0];
_l1 lightAttachObject [_unit, [0, 0, 0]];
_l1 setLightAttenuation [3, 0, 0, 0.6];
unborn ether
#

attachTo works for (almost) any CfgVehicles.

edgy dune
#

even for a cfgLights class? maybe Ill go try it again

proven crystal
#

hallo again. im still playing with CBA keybinds and achilles modules. I want to make sure that i can later include my stuff in a server side addon. Keybind and modules need to initialize client side of course.

#
["fez\fez_core\fez_Keybinds.sqf"] remoteexec [execvm, -2, true];
#

would this kind of do the job?

#

at the moment im still working with scripts in mission files

#

but at leats this is how i would do it to be able to initialize everything from the initserver.sqf?

#

ah well... found my answer

still forum
#

cba keybinds should be initialized in preInit

#

just use CBA XEH or CfgFunctions

remote monolith
#

hey guys... i need to know if its possible to make an exception for a specific classname within nearestObjects car/air/ship so it gives back all vehicles except the ones i explicitly dont want to
_nearVehicles = nearestObjects[_sp,["Car","Air","Ship"],10];

carmine abyss
#

Is ```sqf
BIS_fnc_Camera;

pure blade
#

@carmine abyss why you don't create a own camera on the position from the main camera and then do what you wan't

carmine abyss
#

I'm trying that now but the positioning isnt working at all. I have ```sqf
_cam = "camera" camCreate (getPos player);
_cam camSetRelPos [0,-3,10];
_cam cameraEffect ["External", "Back"];
_cam camCommit 0;

pure blade
#

do you switched the camera?

#

you can get your maincamera position with positionCameraToWorld [0,0,0] i think

carmine abyss
#

It switches to camera, but all I see is my feet or nothing at all

pure blade
#

do you used positionCameraToWorld [0,0,0]

carmine abyss
#

let me try

pure blade
#

@remote monolith you can do this :

nearestObjects[_sp,["Car","Air","Ship"],10] select {(typeOf _x) != "BADCLASSNAME"};
carmine abyss
#

I'm just trying to get the camera to look at my own guy

pure blade
#

yeah, does it work with positionCameraToWorld [0,0,0]?

carmine abyss
#

No sir

pure blade
#

ah now i understand what you mean, you can target a object with camSetTarget

carmine abyss
#
_camera camSetTarget player; ```
pure blade
#

yes and camCommit

carmine abyss
#
_cam = "camera" camCreate (getPos player);
_cam camSetTarget player; 
_cam camCommit 0;``` This is what I have and nothing changes now
#

Okay this works sqf _cam = "camera" camCreate (player modelToWorld [0,100,10]); _cam camSetTarget player; _cam camSetRelPos [-1, 1.5, 1.5]; _cam cameraEffect ["internal", "back"]; _cam camCommit 0;

pure blade
#

okay

carmine abyss
#

Not sure why the other one wouldnt work though

remote monolith
#

@pure blade thnx man... will try that

proven crystal
#

i have a function with onMapSingleclick. how do i "unload" it when the player closes the map, without clicking?

#

i mean when that function is called, it waits for that mapclick, and even if you click much later it will fire unwantedly

#

if you know what i mean...

#

basically like onMapSingleClick '';, only that it should do it when not clicked before closing the map....

#

onMapClose....

short trout
#

wait both map closed and click

proven crystal
#

i could waituntil visibleMap is false, but that wnt work in unscheduled

short trout
#

and exit if map closed

proven crystal
#

"if map closed " is the bit that i cant figure out

#
blafnc = {
            openMap true;
            onMapSingleClick {
                bla; 
                onMapSingleClick '';openMap false;
                bla;
            }
 }; 
short trout
#

don't use command from OFP, use stacked EH and remove it when map closed

#

There are links to new approach.

#

But if you old fashion man, you can try something like:

blafnc = {
            openMap true;
            
            [] spawn { waitUntil { visibleMap }; waitUntil { !visibleMap }; onMapSingleClick  ""; };


            onMapSingleClick {
                bla; 
                onMapSingleClick '';openMap false;
                bla;
            }
 }; 
proven crystal
#

ahyes, that is the direction that i was thinking. but also i was not aware about the eventhandler

#

thanks

#

works nicely

carmine abyss
#

@pure blade question camDestroy _cam; works fine in editor, but not during gameplay. no script errors. I also tried cancelling it in debug console still wont exit the camera

pure blade
#

do you switched the camera back?

#

player switchCamera "EXTERNAL"

carmine abyss
#

i just run camDestroy _cam;

#
player switchCamera "EXTERNAL"; camDestroy camB;``` not working either
#

I got it

#

_cam cameraEffect ["terminate","back"];

pure blade
#

ah you don't need to switchCamera but you must destory the camera effect with

 _cam cameraEffect  ["terminate","back"];
#

lol

carmine abyss
#

😉

#

Thank you glow you da man!

#

I read it earlier but for some reason it didnt sink in

still forum
pure blade
#

yes

carmine abyss
#

Thank you Dedmen for your kind words

unborn ether
#

@still forum spit on you 😄

still forum
#

spits on @unborn ether

proven crystal
#

is there a way to reload the current weapon of a player including launchers directly without reload?

#

basically the guys now want a faster way to test weapons and damage

#

just in case anyone has a quick answer to this...

still forum
#

I think.. If the weapon doesn't have a magazine. You can addPrimaryWeaponItem a magazine to have it insta loaded

#

or drop the weapon and a magazine next to it. When you pick it up the magazine get's automatically loaded

proven crystal
#

hmmm for i guess i could check if the magazine is empty and if thtas the case delete the gun and add a new one

#

but on the other hand, what if they want to test different ammo...

unborn ether
#

I think something like

player setAmmo [currentWeapon player, 10000];

in some loop will make it shoot infinitely.

proven crystal
#

hmm i figure for a solution that makes me kind of happy ill have to figure out all compatible ammo types and then maybe add an action or so that lets them keep the gun filled fith that type of ammo, or at least makes sure they dont run out of ammo....

#

oh i would have thought thats too easy

#

works for guns but not launchers

#

launchers return magazines though

#

but only while loaded

#

i would also like to hang people from drones and swing them around like wrecking balls. how do i attach players to the end of a carg rope under a drone?

#

actually maybe i can just attach them to the drone itselfn and suspend them for a while

#

its for misbehaving players

austere hawk
#

simple. make invisible vehicle that is liftable, put player in vehicle...

carmine abyss
#

@unborn ether yea he did.😉😄

proven crystal
#

hm when attaching players to things one cant look around freely?

#

annoying?

unborn ether
#

Well thats how attachTo works, you can't change that.

proven crystal
#

too bad

peak plover
#

setpos on a eachframe handler

unborn ether
#

@peak plover Kill it with fire after, please.

twin steppe
#

Hello. I'm trying to figure out how to hide a map object on all clients ( and on clients that join later on ) executed locally.
{ _x hideObject true } foreach (nearestTerrainObjects [player,["BUSH"],5]);
Executing it globally works for the clients on the server, but not for players that reconnect/connect. HideObjectGlobal doesn't seem to work because it can't be executed locally. Is there a way to execute this code with remoteExec? I'm pretty bad at this.

peak plover
#

@unborn ether attachto runs every frame too

#

It does something that affects performance

still forum
#

fast moving vehicles run every frame too

peak plover
#

They do

#

Do bullets move outside of the frame?

austere hawk
#

vehicle physx simulation step is 30 fps

peak plover
#

Or does it calculate what the bullet moved every frame?

austere hawk
#

simulation step for bullets and projectiles is smaller otherwise it would be extremely glitchy

peak plover
#

So it moves independent of framreate

austere hawk
#

idk if independant, but at least it is calculated much more often than framerate.

peak plover
#

What if it moves a big portion every frame?

#

It might not move at all between frames

austere hawk
#

no idea. Test it i guess

peak plover
#

how? 😄

austere hawk
#

idk... with something clever. If you cant think of a way to test it, why does it matter to know anyway? 😛

peak plover
#

It doesn't

still forum
#

Do bullets move outside of the frame? wat? no. every frame

#

So it moves independent of framreate no

pure blade
#

@twin steppe you can use the Hide Terrain Objects module and in the module settings you can tick a checkbox to run the module locally

twin steppe
#

@pure blade I'm trying to remove the objects from all clients on a Zues server. I can't load in a created mission file. I wouldn't know but maybe there is a way to create the module with a script? Edit: Yes there is - "BIS_fnc_moduleHideTerrainObjects" I have no clue how to create the module though.

pure blade
#

you can try it with createVehicle or createUnit idk if this works or use remoteexec with jip

twin steppe
#

"{ _x hideObject true } foreach (nearestTerrainObjects [player,["BUSH"],5]);" - How would I make this into a remoteexec though?

pure blade
#

create a function and then you can run it with remoteexec

#

and you need jip

twin steppe
pure blade
#

no all you need is remoteexec

twin steppe
#

Yeah sorry I see that now.

#

So this? _function = { _x hideObject true } foreach (nearestTerrainObjects [_newObject,[],4]);
[] remoteExec ["_function", 0, true];

unreal cave
#

how do u script in vehicle acre radio racks for vehicles that dont have them from the outset?

unborn ether
#

@peak plover attachTo is bad but at least it has an engine solution for setting positions, which I cant say about setPos in that application.

proven crystal
#

if i am not sure where my target object (in this case a unit or maybe a group) is local, can i do this to make sure remoteexec targets to execute where object is local?

#

[_object] remoteexec ["FEZ_FNC", groupOwner (group _object)];

#

and could i just use owner?

#

just to have it working also when its not a group?

#

should work i guess... just have no way to really test now

#

and if i execute a function on the client that changes unit stances for example, do i have to remote execute that too?

pure blade
errant timber
#

case toLower "Rif1": { //Rynnäkkökivääri
_ase = selectRandom ["rhs_weap_akm", "rhs_weap_akms", "rhs_weap_m70ab2", "rhs_weap_m70b1", "rhs_weap_pm63", "rhs_weap_savz58p", "rhs_weap_akm"];
_magazines append [["rhs_30Rnd_762x39mm",1],["rhs_30Rnd_762x39mm_tracer",1]];
_weaponitems append [["rhs_acc_dtkakm","primary"]];

#

does anyone have any idea why my soldiers aren't getting any weapons or ammo? I've made missions before and they've worked fine but I've never used SelectRandom

short trout
#

Without full code is not possible i guess

#

(Ad time) Use my dzn gear its already has randomization of everything just from loadout definition

#

@errant timber provide piece of code where items are assigned, please

errant timber
#

if (_unit isKindof "Man") then {
private ["_OTTO_Kypara", "_OTTO_Puku", "_OTTO_Liivi", "_OTTO_Reppu", "_OTTO_Aseistus", "_OTTO_Sinko", "_OTTO_Perustavarat", "_OTTO_Kiikari", "_OTTO_Medikaali"];
Switch toLower(_type) do {

    ////////////
    //Johtajat//
    ////////////

    Case toLower "SL": { //Ryhmän johtaja
        //Vaatteet
        _OTTO_Kypara = "";
        _OTTO_Puku = "";
        _OTTO_Liivi = "";
        _OTTO_Reppu = "";

        //aseet
        _OTTO_Aseistus = "GL";
        _OTTO_Sinko = "";

        //varusteet
        _OTTO_Perustavarat = "Johtaja";
        _OTTO_Kiikari = "Kiikari";
        _OTTO_Medikaali = "";
    };

    Case toLower "TL": { // Partion johtaja
        //Vaatteet
        _OTTO_Kypara = "";
        _OTTO_Puku = "";
        _OTTO_Liivi = "";
        _OTTO_Reppu = "";

        //aseet
        _OTTO_Aseistus = "Rif1";
        _OTTO_Sinko = "";

        //varusteet
        _OTTO_Perustavarat = "VaraJohtaja";
        _OTTO_Kiikari = "Kiikari";
        _OTTO_Medikaali = "";
    };
#

Do you mean that?

#

or would want me to just send the whole file?

short trout
#

Dunno, is it some framework?

errant timber
#

Ehm, I don't think I can explain my code in English

#

I'll just redo the thing and see it then works

waxen tide
#

@errant timber
```sqf
<code>
```

errant timber
#

Where had I written that?

#

my dumb logitech mouse sometimes types the ´ symbol, that's probably it

still forum
#

No. You didn't write that. That's the problem

errant timber
#

sorry man but I don't know what you mean

hollow thistle
#

wrap you code in what he typed.

errant timber
#

all of it?

#

I just type sqf before it and after it

#

i mean

#

´sqf

#

god damn it

hollow thistle
#

just edit your code... stop spamming.

errant timber
#

I don't know what that means though

hollow thistle
#

also tagging your private variables is unnecessary.

errant timber
#

i'll just leave and re-do the whole code. no hablo inglés

waxen tide
#

OI VITTU SAATANA

short trout
#

Ok, just share you file, cuz piece you shown means nothing (it's making things with an array but HOW you want to use it is not clear)

surreal peak
#

What would be the easiest way to find the nearest OPFOR member in relation to another unit?

#

if it helps I am using CBA and Achillies

hollow thistle
#
  • filter found objects by side.
#

Also you should limit the search distance, the command is perf heavy.

surreal peak
#

Since I am trying to make a basic attack dog script, as long as the dog is on the blufor side/ in a units group, will it 'know about the enemy'

#

for the NearestEnemy part

hollow thistle
#

if anyone of the dogs group will spot enemy, it will know.

surreal peak
#

ah that was my problem, I didn't group the dog to a unit

hollow thistle
surreal peak
#

so if im not mistaken, _DogNearestEnemy = _dogUnderCursorBlu findNearestEnemy _dogUnderCursorBlu; would work to find the nearest enemy to the dog?

hollow thistle
#

Think so.

#

Wiki examples are kinda strange. they say <object> findNearestEnemy <object> but the command syntax says it's <object> findNearestEnemy <position>

#

oh nvmnd it's either object or position

#

yeah that should work (if enemy known to unit/unit group).

surreal peak
#

Thanks it works!

robust talon
winter rose
#

you do not addAction?

robust talon
#

line 152-158

winter rose
#

I know, but you don't get the values

#

oh wait, 1 min

robust talon
#

this is my first script in sqf

#

interesting language, i come from powershell & python so I see similarities especially with posh

winter rose
#

no info in your switch: you should do:

switch (_param_) do
{
    // actions
}```
robust talon
#

an empty param var?

winter rose
#

in the launcher, activate "Show script errors" to have error feedback 😉

robust talon
#

thanks, couldnt make vscode debugging w/ sqf work properly with the extension

winter rose
#

add at the top of your file:

params ["_parameter"];

if _parameter is not provided, it will be objNull, therefore not matching any of your switch cases
in the default case (warning! no semicolon) put your addactions. (else it will trigger everytime)

#

also,

[
                "<t color='#FF0000'>Teleport to Drug peninsula</t>";
            {
                comment "Teleport to Drug";
                player setPos [14257.2,13032.5,0];
            },
];``` format won't do anything; go directly to the part under "comment" to do the stuff
robust talon
#

ok so I would move the addaction into the do switch

#

but what would happen with this

gearupStand addAction ["MK1 loadout", "addaction.sqf", 1];
gearupStand addAction ["MK18 loadout", "addaction.sqf", 2];
gearupStand addAction ["OG arms teleport", "addaction.sqf", 3];
gearupStand addAction ["Drug peninsula teleport", "addaction.sqf", 4];
gearupStand addAction ["ARCO scope", "addaction.sqf", 5];
gearupStand addAction ["MRCO scope", "addaction.sqf", 6];
gearupStand addAction ["RCO scope", "addaction.sqf", 7];
winter rose
#

what you are currently writing is a recursive script, meaning it will call itself with the parameter you give (1..7)

#

if you 1st time call your script with execVM "addAction.sqf";, no parameter will be given. place the "addaction"s in the "default" case of the switch

robust talon
#

ahh

#

thanks

minor lance
#

Hello!

#

I have a particle source with water, I would like to know if the water collides with some object in its way

#

is it possible¿?

#

I would like to check the line in wich the particle is and if there is a object do somthing

#

I have read this "You can get position of a particle in onTimer script in particle array" But dont know how

#

Position of the particle is stored in "this" variable.OnTimer - ```
frigid raven
#

I just used Arma 3 Tools and its Options to define my P drive. After that I used the action "Mount the Project Drive". No files were created in that directory tho. Before continuing to follow a setup tutorial I would kinda verify that mounting worked. Any ideas how to do so as easy as possible?

minor lance
#

No files are created until you install bulldozer or extract game files

frigid raven
#

I found that in my windowns explorer the new drive P: was created

#

is that a good sign?

#

ok things seem to work now

minor lance
#

Yes

keen bough
#

Yikes, hey there! I am running a script over initServer.sqf (execvm) and ... it does its work. Yet i have to make sure JIP works so the result is for everyone there. I am a bit clueless at the current state.

winter rose
#

well… we may need more details 😁

keen bough
#

haha, i guess so ^^ What should i post? I could deliver all the (dirty) details. Or should i post the whole script as pastebin?

high marsh
#

firstly, isServer is a useless check because isDedicated will always be a server.

keen bough
#

Noted, was very unsure about it.

short trout
#

[] execVM "script";
try "script.sqf"! 😄

#

and check all global vars initialized in scripts - maybe it works, but you configured it wrong. Type in "WATCH" fields and ensure that vars has any values (e.g. unlimited , merc_arsenal_box, weapon_cache_temp, etc.)

keen bough
#

the script iself does its work. But as a client, i dont see the weapons in the arsenal, and still "ghost" weapons in the merc_arsenal_box inventory

#

Without the execVM it will update on all currently online clients and/or jip clients? @short trout

torpid grail
keen bough
#

ooooh

short trout
#

execVM is not the reason, yeah )

keen bough
#

omg... global, yes -.-" embarrasing

#

i will rewrite a bit and then i will hurt the table with my head 😄

#

thanks all! trying to test it again 😄

#

[merc_arsenal_box, [_weaponname], true] call ace_arsenal_fnc_addVirtualItems; the ],true] should be the 'add globally' boolean of ace's arsenal framework, right? (done, and yes ^^)

keen bough
#

is it possible to display variables with BIS_fnc_typeText together with remoteexec in a text? Whenever i try to put a variable in [["text %1", variable, "formatstuff"] remoteExec ["fnc"]; it does not work. Still not too comfy with scripting yet.

#

I tried [["text","format"], variable] remoteExec ["fnc"]; as well.

frigid raven
compact maple
#
format ["%1", varStuff] remoteExec ["typeText"];

?

high marsh
#

wonder if remoteExec needs prefix to use functions?

keen bough
#

i thought more like
"one","formatoptions" + stringvariable + "two","formatoptions" typetext. Somehow that would be that what i kinda like. Currently i use something with 'systemChat'

compact maple
#
nolo_fncb_logInChecker = {
blah
};

_result remoteExecCall ["nolo_fncb_logInChecker", owner _player];

on inline declared functions, nop

#

what's one/two ?

keen bough
#

Actually something like this:
"Offshore Bank Account","<formatoptions><br>","Transaction done.","<formatoptions><br>","Balance: ","<formatoptions>" + variable + " Dollar.","<formatoptions") spawn bis_fnc_typetext;

high marsh
#

Nop, first param for BIS_fnc_typeText expects array.

#

@compact maple inline functions will not work sadly.

compact maple
#

It does work, I tried it before, why ?

high marsh
#

Hm? My mistake.

compact maple
#

@keen bough could you paste your actual systemChat ?

keen bough
#

yep, sec

compact maple
#

well inline function work as long they're in CfgRemoteExec

keen bough
#

_textMoney = str (mercMoney);
"Operator: A transaction to our offshore account is done. Balance: " + _textMoney + " Dollar." remoteExec ["systemChat", -2, true];

compact maple
#
[
    [
        ["Operator: A transaction to our offshore account is done.","<t align = 'center' shadow = '1' size = '0.7' font='PuristaBold'>%1</t>"],
        [format ["Balance: %1 + Dollar", _textMoney],"<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"]
    ]
] spawn BIS_fnc_typeText;
#

you should put that in a function and remote exec that function

keen bough
#

oh god, right. I put that into "test.sqf" and call that via remoteExec, yes?

compact maple
#

yep

keen bough
#

like
_variable = [code] spawn function;
_variable remoteExec ["bix_fnc_typetext", -2, false/true];?

#

erf, still not awake. Woke up 8 minutes ago ^^

compact maple
#

more like

["first params", "second param"] remoteExec ["fnc_test"];
keen bough
#

Ah, do you have a tutorial somewhere i could see/watch to learn to make functions? It seems a bit different for me. Still very very new to arma mp scripting.

keen bough
#

awesome, thank you

waxen tide
#

don't get confused, a function can be something trivially simple. it's basically just code in a box, and you pass it arguments which then can be accessed inside the function with param,params _this magic variable. the simplest function you can do should be like this:

simplefunction =
{
    systemchat format ["%1", _this];
};

_var = "test";
[_var] call simplefunction;
#

but you can also register them with cfgFunctions in description.ext, or you can use CBA functions, or you can do your own system

compact maple
#

^everything you need to know

keen bough
#

so i actually dont have to register a function and could use a global, lets say, sqf file where it passes its argument in it, like, for example, an array or whatever i want?

waxen tide
#

nope.

#

the bit of code i posted can be in 1 file

#

you CAN do that, but you don't have to

compact maple
#

but on inline declared functions, client need to "read it" at least one time otherwise it will be undefined

waxen tide
#

oh yeah right remoteexec? never used that. no clue 😄

keen bough
#

for the text i want to use. Is it better to use a remoteexec style of setup, where i call/spawn it like
"test.sqf" remoteExec ["bis_fnc_typetext", number, boolean];?

compact maple
#

nope

#

the remoteExec function need to call YOUR function

keen bough
#

ah blep, i see my mistake

compact maple
#

and in that function, you do your stuff

keen bough
#

need to look it up quickly how it was done with remotexec, sec

compact maple
#
params remoteExec [functionName, targets, JIP] 
keen bough
#

found it :D
<params> remoteExec ["fnc_someScriptedFunction", targets, JIP]; //Works

compact maple
#

thats it

#

do you want to remoteExec on each connected client ?

#

or just one

keen bough
#

Each connected client, except the server (-2) that i know already. Yet i will have to test how i can write a function properly. Its todays learning lesson ^^

#

so much help from all of you guys :3 thank you so much. Now its time for breakfast, documenting everything what i wrote yesterday and then stuff to attend. After that its coding time again ^^

waxen tide
#

i think if you register a function with cfgfunctions in description.ext (that should be described in the 2 links above somewhere) you get the advantage of it being compiled once ,which improves performance if you call it a lot. the little example i posted will probably compile every time. you could add compile preprocessfilelinenumbers on the function declaration and make sure you only execute that code once, and achieve the same i guess. also there is CBA functions https://cbateam.github.io/CBA_A3/docs/files/xeh/fnc_compileFunction-sqf.html but i have never worked with those yet. cfgFunctions has some drawbacks Dedmen explained here (to me) like 1-2 weeks ago maybe?

keen bough
#

sweet. When should i use functions? I have currently my save-script, money-script that both run on timers like 15 minutes and 5 minutes.

waxen tide
#

when you want to re-use code multiple times, i always find it a good idea to stuff it into a function.

#

especially if it's basically the same code, but with different input values

keen bough
#

perfect, like the text's i have in mind. I want to see first with the save, unlock and money script if it will be too much if i have typetext spawned all the time while playing or if i keep the systemChat output.

Nothing hurts more if you think something is extremely awesome and cool but annoys you while gaming since its only cool 1 - 3 times ^^

#

one final question before breakfast:
If i want use pictures. Is it better to transform them to paa (or whatever the file format was) or use jpg when i want to use dialogs with pictures (next thing is a garage. I can store everything i need in a database but yet i am unable to put a specific vehicle out, spawn it and delete the entry in the garage)

compact maple
#

I write everything in functions lmao

#

so much easier to work with & to use

keen bough
#

i put everything in so many differend sqf's document it out (nearly every line of code is documented what it does, why it is used and so on)

#

blep, i have one final question that bugs me - not really important but somewhow it bugs me. With getCargo (weapons etc) i get an array with the classname(s) and amount. Is there a way to use the classname and figure out the real name of the gun as example? Just need a general direction where to look (functions or so). Currently i have no clue.

outer fjord
#

Question, how intensive would Reveal be if broadcasted to all units on the map?

compact maple
#

Sure you can

#
_weapon = "myWeaponClassname";
hintSilent str getText (configFile >> "CfgWeapons" >> _weapon  >> "DisplayName")
``` @keen bough
keen bough
#

awesome!

compact maple
#

well you can access nearly everything with the config system

#

you can even create your own config for what ever you want

keen bough
#

nice, all that will help me a lot. Thanks.

high marsh
#

why store it in var if it's not being used outside of getText config reference?

compact maple
#

dont know, just to make it clear

waxen tide
#

I'm still getting used to using extDB3. Is there a way to get rid of all triple layered array stuff?

private _query = format ["0:ADMMSQL:admm_get_mapID:%1",worldname]; 
private _mapID= parseSimpleArray ("extDB3" callExtension _query);
systemChat str _mapID; // [1,[["1"]]]
private _map_ID = (((_mapID select 1) select 0) select 0);
systemChat _map_ID; // 1
compact maple
#

I had that problem too

waxen tide
#

I don't follow

compact maple
#
4 = Get (Retrieve Single Part Message)
5 = Get (Retrieves Multi-Msg Message)
waxen tide
#

I still don't follow

compact maple
#

well 4 return [["1"]] and 5 return [[["1"],["blah"],["blah"]]]

#

anyone can confirm ?

waxen tide
#

now i follow

#

thanks. bit of a slowpoke sometimes.

compact maple
#

I think it require a test im unsure

waxen tide
#
private _query = format ["0:ADMMSQL:admm_get_mapID:%1",worldname];

So i would replace the 0 with a 4, right? I've tried 2 yesterday, didn't work out. Now tried 4, also doesn't work out. Seems only to work in mode 0 ?

compact maple
#

I dont remember very well

#

I dont think its bothering if you have to select your data ?

waxen tide
#

it's an OCD thing.

compact maple
#

ocd ?

compact maple
#

oh yea lmao

waxen tide
#

Does someone know how to handle auto_increment columns with extDB3? I took this post as an example https://armaworld.de/index.php?thread/3153-extdb3-tutorial-wie-man-aus-arma3-auf-mysql-daten-zugreift/&postID=24865#post24865 (second spoiler, line 48 to 52)

[jgkp_loadout_insert]
SQL1_1 = INSERT INTO `po_loadout`
SQL1_2 =     VALUES (
SQL1_3 = '',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22

But it does not work. Here is my ini file entry:

[admm_insert_location]
SQL1_1 = INSERT INTO `map_locations` VALUES ('',?,?,?,?,?,?,?,?);
SQL1_INPUTS = 1,2,3,4,5,6,7,8

And here is my query:

private _querycmd1 = format ["0:ADMMSQL:admm_insert_location:%1:%2:%3:%4:%5:%6:%7:%8",_angle,_name,(_position select 0),(_position select 1),_radiusA,_radiusB,_type,_mapID];
diag_log format ["_querycmd: %1", _querycmd1]; // "_querycmd: 0:ADMMSQL:admm_insert_location:0:no_name:3123.89:20498.7:300:250:Hill:1"
private _query = parseSimpleArray ("extDB3" callExtension _querycmd1);

And this is my error log from extDB3

[13:11:24:839853 +01:00] [Thread 1696] extDB3: Output to Server: [0,"Error MariaDBStatementException1 Exception"]
[13:11:24:857622 +01:00] [Thread 1696] extDB3: Input from Server: 0:ADMMSQL:admm_insert_location:0:no_name:3123.89:20498.7:300:250:Hill:1
[13:11:24:857646 +01:00] [Thread 1696] extDB3: SQL_CUSTOM: Trace: UniqueID: 1 Input: admm_insert_location:0:no_name:3123.89:20498.7:300:250:Hill:1
[13:11:24:857858 +01:00] [Thread 1696] extDB3: SQL: Error MariaDBStatementException1: Incorrect integer value: '' for column 'locationID' at row 1
[13:11:24:857874 +01:00] [Thread 1696] extDB3: SQL: Error MariaDBStatementException1: Input: admm_insert_location:0:no_name:3123.89:20498.7:300:250:Hill:1
queen cargo
#

has nothing to do with extdb3 @waxen tide
auto increment is a database level feature

chilly wigeon
#

I'd specifically list the columns in the query, and omit the auto increment column

queen cargo
#

also i again have to say ... somebody should take the time to develop some proper db extension

chilly wigeon
#

From one of my projects:

[addAttendance]
SQL1_1 = INSERT INTO analytics_attendance (op, player, jip, role, group_name) VALUES (?,?,?,?,?);
SQL1_INPUTS = 1,2,3,4,5
queen cargo
#

extdb is just ... urgh

keen bough
#

or a natural database-inculde to arma

#

i use inidbi

queen cargo
#

depending on the backend, you either need to do what @chilly wigeon did, or just pass NULL

keen bough
#

or, for fog's sake, a way to persistant save ^^

queen cargo
#

there is

#

profileNamespace

#

everything else is not expected to be in scope

keen bough
#

yeah, its too attackable from what i heard

queen cargo
#

everything in arma is "attackable"

keen bough
#

Not the sun ^^

queen cargo
#

the moment i have some way to enter scripts, you are screwed

keen bough
#

its typical that, yeah.

waxen tide
keen bough
#

german words? you german jcd?

waxen tide
#

So Theo if i do it like you did it, i would end up with

[admm_insert_location]
SQL1_1 = INSERT INTO `map_locations` VALUES (?,?,?,?,?,?,?,?);
SQL1_INPUTS = 1,2,3,4,5,6,7,8

Instead of

[admm_insert_location]
SQL1_1 = INSERT INTO `map_locations` VALUES ('',?,?,?,?,?,?,?,?);
SQL1_INPUTS = 1,2,3,4,5,6,7,8
chilly wigeon
#

That wouldn't work because you're not specifically defining your columns names

waxen tide
#

you got a link for me that i should read?

chilly wigeon
#

Not particularly, it's just part of MySQL insert syntax

compact maple
#

If he wants to insert without defining column name, he can

waxen tide
#

Ah, ok, so the extDB3 guy didn't invent anything, he's just straight passing SQL syntax and i can look up any SQL tutorial. I missed that.

chilly wigeon
#

more or less

compact maple
#

well i'm using extdb3 too and I never deal with that kind of thing

["0:ADMMSQL:admm_insert_location:%1:%2:%3:%4:%5:%6:%7:
waxen tide
#

i googled extDB3, found 4 or 5 pages, read them all and picked that up from one of them.

#

How do you do it?

#

@queen cargo I know that it is a database level feature. I don't get what you're trying to tell me. I still need to pass it thru the extDB3 extension and declaring stuff wrong in the ini probably isn't the way to go.

#

Now i get what you meant with "I'd specifically list the columns in the query, and omit the auto increment column" Theo. Still a bit curious why the '' placeholder? i got from that example code isn't working. Maybe outdated tutorial? Or i made a mistake that is not obvious to me right now.

compact maple
queen cargo
#

chances are that it is a different db then you are using @waxen tide

#

as said, mysql IIRC should be that you need to pass NULL on auto_increment fields

compact maple
#

the auto_increment is handle by mysql, no need to put it in a query

waxen tide
#

3rK, the sql custom of extDB3 isn't used there at all, right?

#

I initially asked my question the way i asked it because i think the issue lies withhin my sql custom ini definition of the auto_increment field.

#

I changed the sql custom ini by listing each column specifically, but i still get that error due to colum count mismatch. so i obviously need a placeholder or pass something. Still don't know what and how exactly.

#
[13:56:13:469296 +01:00] [Thread 1696] extDB3: SQL: Error MariaDBStatementException1: Incorrect integer value: 'NULL' for column 'locationID' at row 1
#

i guess if i generated the ID and pass it, it would work splendid but i kinda want auto_increment

compact maple
#

I have no clue

#

I dont know how extdb3 works

#

I just know how to query something

#

and use the result

waxen tide
#

I understand the table has auto_increment on the first column

compact maple
#

yep thats the id

waxen tide
#

And here is an insert, with the column names specifically written out, and it is a partial insert where some columns, specifically the first one with auto increment, are obmitted

#

and i guess this stuff works?

compact maple
#

of course it does 😄

waxen tide
#

So either it is a difference in SQL server (i use MariaDB) or it is the sql custom vs writing SQL statements directly in sqf

#

idk i'm allergic to life stuff my doctor advised me against playing it.

#

i'm strongly guessing the issue is with sql custom which you don't use so i'm not really making progress

compact maple
#

well I dont know why, life bring a lot of players on a3, even if some people dont like it.

thats probably it. I've never dealt with that sql custom

#

btw I use mariaDB too

#

and thats pretty cool

waxen tide
#

yeah then i'm certain it must be the SQL custom

chilly wigeon
#

Like I said, you must define your column names, omitting the auto increment

#

Your query keeps trying to put invalid data into the locationID column

waxen tide
#

yeah i tried that, still spits out an error complaining about the mismatch in colums

#
[admm_insert_location]
SQL1_1 = INSERT INTO `map_locations` VALUES (angle,name,positionX,positionY,radiusA,radiusB,type,mapID);
SQL1_INPUTS = 1,2,3,4,5,6,7,8
#
[14:07:16:173661 +01:00] [Thread 1696] extDB3: Input from Server: 0:ADMMSQL:admm_insert_location:0:Javorje:29393.4:6121.89:300:250:NameVillage:1
[14:07:16:173678 +01:00] [Thread 1696] extDB3: SQL_CUSTOM: Trace: UniqueID: 1 Input: admm_insert_location:0:Javorje:29393.4:6121.89:300:250:NameVillage:1
[14:07:16:173710 +01:00] [Thread 1696] extDB3: SQL: Error extDB3Exception: Config Invalid Number Number of Inputs Got 8 Expected 9
[14:07:16:173721 +01:00] [Thread 1696] extDB3: SQL: Error extDB3Exception: Input: admm_insert_location:0:Javorje:29393.4:6121.89:300:250:NameVillage:1
[14:07:16:173731 +01:00] [Thread 1696] extDB3: Output to Server: [0,"Error extDB3Exception Exception"]
chilly wigeon
#

Your query in SQL custom is wrong

#

it should be

SQL1_1 = INSERT INTO `map_locations` (angle,name,positionX,positionY,radiusA,radiusB,type,mapID) VALUES (?, ?, ?, ?, ?, ?, ?, ?);
waxen tide
#

🤦 Thanks a lot, that now works like a charm.

#

should i bother replacing the actual name of a map with a shorter ID if i'm going to save it millions of times, or is SQL clever enough to do that itself internally?

compact maple
#

you could create a new table with maps, and join it in your query

waxen tide
#

yeah i kinda did it awkwardly, join is a better idea. thanks!

compact maple
#

😄

keen bough
#

Damn, thats a typical unclear thing. Do i need to createCenter or not? "Arma creates center for you" Now what? Do i have to do it myself or not? 😄

#

Or i rephrase: I want a single unit created, and stay at a position, casually doing nothing dumb ^^ My working thing is with createVehicle. But i want to use createGroup and createUnit if that is better (waypoints and such things)

waxen tide
#

i think i read about "createCenter" that it's some old stuff from either flashpoint or arma 1/2, and it isn't needed for arma 3 anymore.

keen bough
#

alright. Still a bit unclear. When i create a group "_group1 = code;" and then a unit to fill into that group. How can _group1 stay that way? How does the game still know that the created group _group1 is still there?

waxen tide
#

ok so a vehicle can be a trashcan, a house, a butterfly, a soldier or a car. that's basically just an object. a unit is a soldier (alive) which is represented in the game by a vehicle of the type soldier_something_something. That unit is (should be) part of a group. so what you should do if you want to do it properly:

  1. create a group
  2. spawn a vehicle (soldier)
  3. assign that vehicle (the soldier) to the group
#

then you can give that group an order, like a waypoint of the type "guard this shit"

#

note: This entire topic is on my long-term todo list and i'm far from an expert.

#

🤔

keen bough
#

hmhmmm, yep no worrie i learn 'to go' ^^ right on the spot when i need something. Easier for me. Dislike theoretical learning that i may or may not use later ^^ when i learn it when i need it, i normally never forget it again.

So __group1 will always be _group1 until i re-use it? because _ _says its local. I want it to be deleted when empty, that i understand.

waxen tide
#

_group1 is a reference to the group you created

#

it's the name of the group inside your code

keen bough
#

dang, discord messing up. So, when the script is done, creating the group and unit with its desired waypoints n 'shit. Does "underscore"group still exist?

#

since _group is currently used as kind of a "group name"?

keen bough
#

already did XD left me clueless

waxen tide
#
_group = createGroup [east, true];
_soldier = "B_Soldier_F" createUnit [[0,0,0], _group];
#

this would create a group, and then spawn a unit of the type "B_Soldier_F" and make it member of the group

#

(see how _group is in both lines)

still forum
#

https://i.imgur.com/6687KmT.png (//by commy2)
This is genius!
cond1 && cond2 && {<thencode>} > if (cond1 && cond2) then {<thencode>}
XD
Sorry for interrupting. sits down and watches you guys doing stuff

waxen tide
#

looks at Dedmen

#

wow rude

keen bough
#

omg, a wild confusion appeared! 😄

waxen tide
#
_group = createGroup [east, true];
_soldier1 = "B_Soldier_F" createUnit [[0,1,0], _group];
_soldier2 = "B_Soldier_F" createUnit [[0,2,0], _group];
_soldier3 = "B_Soldier_F" createUnit [[0,3,0], _group];
#

you could also do this

#

which would spawn 3 soldiers

#

and make them all part of the same group

keen bough
#

Can i call back to the _group anytime i want or just, because its a local variable, when the script that has to do with that group?

waxen tide
#

if you then give an order to the group, they'll all stick together (try to, at least) and do what you told them to do (try to, at least)

keen bough
#

if i want to delete it manually with another script?

waxen tide
#

🤔

keen bough
#

i mean, yes, i can bring in that group [] style but isnt _group then the group's name itself? i am sooooo confused ^^

waxen tide
#

If you simply want to reference the group by "_group" you have to make sure that variable is available wherever you want to use it

#

I think it would help if you explained a bit more in detail what you want to do with that group.

keen bough
#

yeah, i want to use _group only for specific missions. I always will do a safe-strategy to delete the group again if a new mission is generated.

#

I dont use random-mission generation. the mercs can choose a mission (there will be random generated ones of course) most of the time.

waxen tide
#

well i guess a very easy way would be to stuff your group and whatnot you want to cleanup into a global variable

keen bough
#

thought about that, yah

waxen tide
#

and when your conditions are met, loop thru them and delete them all ?

keen bough
#

That would've been the thing i would do when i am too unsure ^^ globalvariables are bit easier for me to use.

waxen tide
#

i myself haven't yet really figured out how to handle that nicely.

#

i have sort of a mission template file which basically just creates a task, calls half a dozen functions to spawn an AO (each function returns the spawned stuff) and then the cleanup just does {deleteVehicle _x} forEach basically.

keen bough
#

I think we should always consider the arma way. Shooting a tank in the air, make it bounce around on the map, kill someone that runs over a stone and then script something like that with the end result that the server is burning.

waxen tide
#

datacenters have fire suppression systems.

keen bough
#

arma scripter uses a script to spawn in a tank. Server explodes, distant sirens, kids crying.

compact maple
#

you can just retrieve your group by doing

_group1 = group player;
#

but lets be clear

#

once you created a _localVariable, when the script exit, the variable is destroyed

keen bough
#

thats why i am curious why i should use _group for units. That would make no sense. It should be then a global variable. Or is there a way to call a group by call-sign or create a call-sign you could refer to?

compact maple
#

You need a global variable when you want to keep an information available

#

if you want to get the group of someone

#

just use the code i gave u above

keen bough
#

i actually know a way to code it. I was just very curious if a local variable can be a continous group name (like a call-sign) i think the answer was/is no. That way i would use globalvariables because i would need to call it steadily as long the mission runs (2 - 3 script files)

compact maple
#

what's a call sign ?

keen bough
#

alpha 1-1

compact maple
#

oh okay

compact maple
#

but I dont think you need a global var for group, as it can be access anytime

waxen tide
#

meh.

still forum
#

A call sign is a sign you call out loudly. For example "THAT SPEEDLIMIT SIGN SAID 30 YOU DEGENERATE"

waxen tide
keen bough
#

XD

still forum
#

@waxen tide space after the end of the link

compact maple
#

lmao

waxen tide
#

just search my first link with "group" and look at everything it finds

keen bough
#

got me good XD i am laughing hard ^^

waxen tide
keen bough
#

hmmm, so i can create stuff with _local and then give it an id (all id's under 21 are not suitable for alcohol) and it could be possible that, over the id, you could alter the group?

waxen tide
#

ok so variables can be limited in scope. say a variable that only exists inside a loop, or inside a script. that's 1. good for performance 2. good for security

tough abyss
#

hi

keen bough
#

hayhay

waxen tide
#

obviously you can't keep that variable limited if you need it elsewhere. there are two ways i'm aware of around that:

  1. make it a less limited variable that is available where you need it
  2. pass it to the script that needs it at a parameter
#

or, kinda, 3rd: use some existing arma mechanic

tough abyss
#

does i need AA in 4k?

waxen tide
#

like if you set the groupID to something specific, you can check the groupID of any group anywhere you want because arma syncs it over network for you to everyone.

#

@tough abyss wrong channel

tough abyss
#

where

#

just joined in 10 mnst ago

keen bough
#

so, over the groupid i can manage the group and say, delete the unit and then the group? Does the id have any informations as array in it (dont see any information in the wiki)

waxen tide
#

🤔

keen bough
#

Ah, no you cant

waxen tide
keen bough
#

the group name is either short (local) or permanent (global) and only when its global (variable) you can alter it.

#

well i think, the final answer is probably, as long you want to make use of a group, you have to make the group a global variable (use it in other scripts) or hand it over to a loop scirpt to keep a variable local and use it later when you actually need it. I think the global-variant is better.

waxen tide
#

no

#

with allGroups you get all groups

#

with GroupID you can check the group's ID

keen bough
#

hmhmmmm right, yeah, makes the script a tad longer but that would work too without global variables.

waxen tide
#
{
    if (groupId _x == "group123") exitWith // find the group with the right ID
    {
        {
            deleteVehicle _x; // delete each unit
        } forEach units _x; // find all units in the group and loop thru them
        deleteGroup _x; // delete the group
    };
} forEach allGroups;
#

i think you CAN do that. idk if it's a good idea tho.

keen bough
#

if you have 144 groups, which is the max, i guess that could take a while, a couple seconds i would say.

waxen tide
#

Ah and you might run into trouble with _x not being available in the loops inside the loops 🤦 so you might need to do:

{
    private _current_group = _x;
    if (groupId _current_group == "group123") exitWith // find the group with the right ID
    {
        {
            deleteVehicle _x; // delete each unit
        } forEach units _current_group; // find all units in the group and loop thru them
        deleteGroup _current_group; // delete the group
    };
} forEach allGroups;
#

t. noob

keen bough
#

hehe ^^ ya.

waxen tide
#

a couple seconds to check 144 group IDs?

#

naah thats way, way faster.

keen bough
#

no worries, i had such things already often enough happen to me. "Why does freaking _weaponname not show the weapons name?! oh... oh... OH! oh... it was not created" haha

still forum
#

Pfft. amateurs

waxen tide
#

🍿

keen bough
#

i tend to forget to every - single - hint the ;

waxen tide
#

looks at Dedmen

still forum
#

@waxen tide delete each unit check that line again

keen bough
#

imagine me going crazy why a script does not work and i am looking all over it dozen times until i figure out it was the hint again ^^

waxen tide
#

I-I'm trying to avoid writing SQL statements

keen bough
#

alright, now to the police-units watching to catch the bacon before the players can deliver it.

still forum
#

Last thing that really Fuffed my brain up.. Was a array that invisibly modified itself.
Like.. I know I'm caching that array, but how is the cached value being modified even though I don't have a setVariable for it anywhere 😄

keen bough
#

arma happens everywhere ^^

still forum
#

Hint: use + to copy arrays and not modify them by ref

waxen tide
#

@keen bough stop making witty remarks and get coding ☝

keen bough
#

yes yes, i am on it, i am writing ^^

#

// Let the player know there is police
"Woop Woop! Thats the sound of the police!" remoteExec ["hint"];

keen bough
#
_waypoint = _group1 addWaypoint [_finalpos, 0];
[_group1, 0] setWaypointType "HOLD";
_group1 setCurrentWaypoint [_group1, 0];

Hmmm, is this correct to add a waypoint, make that waypoing be a hold waypoing and set is as current?

edit:
yes ^^

silent pewter
#

Hello everyone I’m looking for someone that knows how to script a mod/body shop for vehicles so players can go to repair, paint and modify their car. If you can do it just message me and let’s talk more

ruby breach
proven crystal
#

halla

#

so today i have this one

#
private _coordinate = _this select 0;
        if ((isNil "_coordinate") or (_coordinate isEqualTo [])) exitWith {};
        if (!(isNil "_coordinate") ) then {
            
            private _staticweapons = ("true" configClasses (configFile >> "CfgVehicles")) select {"StaticWeapon" in ([_x] call FEZ_fnc_Config_Parents)} apply {configName _x};
            private _mines = ("true" configClasses (configFile >> "CfgVehicles")) select {"MineBase" in ([_x] call FEZ_fnc_Config_Parents)} apply {configName _x};
            private _blacklist = _staticweapons+_mines;
            
            {    
                
                if ((!isSimpleObject _x) && (!(_x isEqualTo ObjNull)) && (!((typeof _x) in _blacklist))) then {
                    [_x] call BIS_fnc_replaceWithSimpleObject;
                };
            } foreach ((allMissionObjects "All") select {((getpos _x) distance2d _coordinate) <= 50});    
            
        };
#

what it is supposed to do is replace objects in a range of 50m with simpleobjects

#

but exclude mines and staticweapons

#

the exclusion of staticweapons works, but for some reason it does not do the job for mines

#

actually it delets the mines

#

it seems that a= BIS_fnc_replaceWithSimpleObject delets mines for whatever reason

#

and b) that my script theere does not properly esclude mines

ruby breach
#

So a few things before we even get into the functionality

#

Why use if (!(isNil "_coordinate") ) then { if you just did an exitWith check for nil one line above?

#

You'd also likely be better off using some command other than allMissionObjects. Particularly since you're only looking in a 50 meter radius

#

Other general recommendations would be to ensure that _staticweapons and _mines contain what you think they do, and to check for case sensitivity issues with (typeof _x) in _blacklist

still forum
ruby breach
#

^ That too

proven crystal
#

yea so the part there with isnil _coordinate apparently has to show up in Achilles custom modules i had errors without that stuff

#

so ignore that bit for the moment

#

allMissionObjects vs nearobjects, right, that was more part of the testing process. id used nearobjects before... also ignore

#

results are even a bit weireder then i thought

#

if i use replacewithsimple on a mine directly, it deletes the mines

#

if i do it via my function, they remain visible but still do get turned into simple objects

simple solstice
#

Is it possible to disable the function of not being able to go into someone elses car, when the rating is below -2000?

proven crystal
#

i switched to this but i believe the result was the same, for the fraction of a secorn, before arma crashed

ruby breach
#

@simple solstice Use a getInMan EVH to force eject the player if rating player < -2000

pure blade
#

make a condition (rating player <= -2000) in the getinman eventhandler and if the condition true kick him out with moveOut

proven crystal
#
private _coordinate = _this select 0;
        if ((isNil "_coordinate") or (_coordinate isEqualTo [])) exitWith {};
        if (!(isNil "_coordinate") ) then {
            
            
            {    
                
                if ((!isSimpleObject _x) && (!(_x isEqualTo ObjNull)) && (!(_x isKindOf "MineBase")) && (!(_x isKindOf "StaticWeapon"))) then {   
                    [_x] call BIS_fnc_replaceWithSimpleObject;
                };
            } foreach (_coordinate nearObjects 50);
            
        };
simple solstice
#

@ruby breach what I mean is that when civ's rating is below a certain point, he cannot go into vehicles where the other civ is the driver

ruby breach
#

You can't stop them from trying to get in

#

You can, however, kick them out if they do get in

pure blade
#

yeah, you can use (driver vehicle) to check if the car has a driver

ruby breach
#
player addEventHandler ["GetInMan", {
    params ["_unit", "_role", "_vehicle", "_turret"];
    if (rating _unit < -2000) then {
        if (side _vehicle == civilian && side _unit == civilian) then {
            player action ["Eject", vehicle player];
        };
    };
}];
``` or similar
proven crystal
#

so yes. that last function that i have there reliable crashes my arma

#

i have never managed to produce such results before, and ive done a lot of crappy stuff

proven crystal
#

everything works, but it crashes when mines are around

#

this alone makes mines disappear

#

[_object] call BIS_fnc_replaceWithSimpleObject;

#

and this makes my game crash ONLY IF mines are in the 50m range

#
if (!(isNil "_coordinate") ) then {
            
            
            {    
                
                if ((!isSimpleObject _x) && (!(_x isEqualTo ObjNull))  && (!(_x isKindOf "StaticWeapon")) && (!(_x isKindOf "MineBase"))) then {     
                    [_x] call BIS_fnc_replaceWithSimpleObject;
                };
            } foreach (_coordinate nearObjects 50);
            
        };

#

crashes also without the check for ines

#

its rather weird

#

maybe it has to do with the fact that i use these achiles modules?

solemn swan
waxen tide
proven crystal
#

now it crashed without the mine... damnit

still forum
#

@waxen tide you have multiple locations with the same ID? Shouldn't locationID be the primary key?
in your roadblocks table
Also in the locations table the type should probably be enum to save space

waxen tide
#

no there is multiple roadblocks belonging to the same location.

#

and roadblocks do not have an ID because i don't need one.

still forum
#

Ah.. hmpf. okey

waxen tide
#

ruby breach
#

@solemn swan Triggered when a guided missile locked on the target or unguided missile or rocket aimed by AI at the target was fired.

#

That says exactly what you said.

still forum
#

You could severely reduce the size of your "houses" table by moving all the classnames into a second table. And just storing the ID of the classname. To get rid of all duplicate names

waxen tide
#

yeah but whats a few thousand houses among friends when you got 4 million positions in another table :/

solemn swan
#

This one says it should work for the player. That or I'm illiterate.

waxen tide
#

i'll add it to the todo list tho.

young current
#

@dim terrace might you have insight on how the backpackContainer and and vestContainer differ from each other?

I tested it out a bit and backpackContainer seems to return the actual backpack object strapped on the player and that can be retextured with the setObjectTexture commands but vestContainer returns a dummyweapon that then can not be accessed with setObjectTexture.

waxen tide
#

the data including the houses was like 4MB, the empty positions is about 1gb by now. (per map)

still forum
#

oof

waxen tide
#

hence why i moved to a db 😛

#

eh c'mon what's 1gb in 2018.

#

yesterday i had my thoughts wander off and i thought about what M242? said, that i should speed this up with a dll and do it on runtime. wtf? i don't even know where to start. I got this caching to work with SQF and SQL in like 2? weeks. My time is the bottleneck to get the mission done, so it has to take priority over elegance there. I wouldn't even know where to start.

tough abyss
#

I sort of have a similar problem where I want to take positions on the terrain to data and have certainly considered doing it via DLL so I can store the cached values externally so I can distribute precomputed ones as well. ACE seems to also be doing something substantial for about a minute at the beginning as well, so an ever increasing list of mods are having to cache large amounts of data around the terrain for what they are now doing

still forum
#

@waxen tide how many entries in the largest table?

waxen tide
#

roughly 4 million

proven crystal
#

several restarts later it does apparently not crash anymore, but delets the mines on both commands.... this is messed up

waxen tide
#

i haven't run it over the entire map for a while, but i've done percentages of the map and done an extrapolation

#

i've divided the map into sectors (1x1km) and subsectors

#

(100x100m)

still forum
#

🤔
Is that your buildingpos table?

waxen tide
#

no safepos

still forum
#

6x 32bit int?
That's 96MB for 4 million entries

#

My hobby projects table with 16 million entries of text messages is 1500MB.
And your 4 million little numbers are already that big?

waxen tide
#

it's a tinyint for mapID, a smallint for mainsector, a tinyint for subsector, and 2x float for X/Y and a tinyint for radius.

#

uhm i suck at math and the critical number was "above 10MB" so i copytoclipboard didn't work out anymore that neatly.

still forum
#

tinyInt is one byte.
so 1+ 2 + 1 + 4 + 4 + 1
that's 13byte per line.

waxen tide
#

last test i did extrapolated to roughly 1gb

still forum
#

So it should be ALOT more efficient now with the DB

#

Run this query

SELECT 
     table_schema as `Database`, 
     table_name AS `Table`, 
     round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
FROM information_schema.TABLES 
ORDER BY (data_length + index_length) DESC;

It'll give you the sizes of all your tables

waxen tide
#

It's 128kb for a sector, and i got 1681 sectors on this map, so that would be 210MB.

#

not complaining ¯_(ツ)_/¯

proven crystal
#

so it turns out that this bit lead to the crashes "(_coordinate nearObjects 50)"

#

dont know why

#

function still deletes mines, which it shouldnt because it should get to do shit with mines in the first place

calm bloom
#

hello. Do you guys think this makes sense?

if (!local _object)  then {_object remoteexec ['functions',_object,false]}
peak plover
#

nah

#
if (!local _object) exitWith {
    _object remoteExec [_fnc_scriptName,_object]
};
#

Usually when I use sth like that

#

It's better to use exitWith

#

Also

#

'functions' doesn't look like a function name

still forum
#

I did a small enscript benchmark.

int test = 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1;
int test2 = 1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1;

in Enscript.
0.029007ms for 10k iterations
0.266997ms for 100k iterations.

And in SQF.

_test = 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1;
_test2 = 1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1;

0.0334ms in... ONE ITERATION.

One single iteration in SQF is already slower than 10k iterations in enscripts. And I don't even include the for loop on the SQF side.

#

So Enscript is about.. 10000x as fast?

waxen tide
#

Enscript like in Enfusion ?

ruby breach
#

Hopefully it's that much faster for... well, basically everything

still forum
#

Yes. And yes 😄

waxen tide
#

Well they better fucking massively improve it when they break compatibility with shit that survived 4 games in a row.

keen bough
#

Hm, plopping in. Is this correct?

_nearestPlayer = _baconManPos nearEntities ["isPlayer", 5];
calm bloom
#

ok sorry may be i have made wrong accent, i mean does remoteexec runs global if sqf _object remoteExec [_fnc_scriptName,_object] _object is local?

keen bough
#

remoteExec alone runs on all machines including server afaik

still forum
#

i mean does remoteexec runs global if no

#

if you let it execute on _object then it will execute where _object is local

#

nowhere else

ruby breach
#

@keen bough No. "isPlayer" is not a typeName

keen bough
#

@ruby breach Hmm, still working on how i figure out when a player is in the radius of my spawned npc (named baconMan).

ruby breach
#
((_position nearEntities ["CAManBase", 5]) select {isPlayer _x}) param [0, objNull];
#

or some derivation thereof

keen bough
#

hmmmmmmm

ruby breach
#

You can do less if you don't want to return a specific player unit there

keen bough
#

Does this work?

_playerDistance = allPlayers distance baconMan;

@ruby breach - Else i would have to use foreach, sort it and find the nearest one ^^

ruby breach
calm bloom
#

@tough abyssmen so there is completely no traffic on network in that case?

keen bough
#

yeah, allplayers gives me all players included the headless back as an array. So, it should be working with distance to another object, right? ^^ I am freaking lazy so that would be great if that really works haha. Gonna test it ^^

pure blade
#

you have always network traffic when you use remoteExec @calm bloom

calm bloom
#

yep that is exactly the thing i am wonder

ruby breach
#
https://community.bistudio.com/wiki/distance
Syntax:
param1 distance param2

Parameters:
param1: Object or Array in format PositionAGL or Position2D
param2: Object or Array in format PositionAGL or Position2D
``` > Tries to use `[Array of Objects] distance [Object]`
calm bloom
#

select thing made me believe in smart functions in arma)

ruby breach
#

I've already given you the solution you're looking for. Don't remember offhand if nearEntities is sorted by distance though, but nearestObjects would be just as good (except slightly worse)

keen bough
#

waaa... ouf course it does not work... why did i expect something else while everything i saw, read and have been told says "nope, does not work" ...

#

Yes, of course a big thank you to you @ruby breach - But also, i only learn when i practically use something to get to the solution myself. Script that others give me, are helping me figuring out how to achieve my goal ^^

#

i would just copy my weapon-unlock script and rewrite it to sort players distance, so i can actually have, as an idea, make the npc respond differently. Like when 2 players are near and so on.

ruby breach
#

Use nearEntities or nearestObjects coupled with select to return a list of player units near a desired position. Then use param to select the first element from that list if you want the nearest player unit

#

No reason to cycle through allPlayers

keen bough
#

It selects automatically the nearest one?

ruby breach
#

For sure if you use nearestObjects

keen bough
#

meant the script here:

((_position nearEntities ["CAManBase", 5]) select {isPlayer _x}) param [0, objNull];
pure blade
#

nearestobjects is sorted

ruby breach
#

Don't remember offhand if nearEntities is sorted by distance though, but nearestObjects would be just as good

high marsh
#

@waxen tide No one expects backwards compatibility. Nor should it be a focus really, if you can't manage to rebuild your mod for new tech, then that's your fault. The laxyness of people should not compromise progress.

keen bough
#

So, technically i have just to write

if (((_position nearEntities ["CAManBase", 5]) select {isPlayer _x}) param [0, objNull];) then {}else{};

?

ruby breach
#

no

#

Because you're returning an object, not a boolean

#

Which brings into question why you even need a sorted list in the first place

keen bough
#

If i have a couple mercs with me, anyone can do this mission, eventually, alone. So i need somehow to check via "if" if there is any player near the baconman, followed by if the delivery truck is there too, as well no enemies within 50 metres.

ruby breach
#
((_position nearEntities ["CAManBase", 5]) select {isPlayer _x} isEqualTo []) //returns true if no players are within 5 meters of given position
keen bough
high marsh
#
{
    if(_x distance baconman <= 5) then 
    {
    };
} forEach allPlayers;

?

ruby breach
#

Again, why cycle through allPlayers?

#

You have a defined position and radius. There are better commands to return objects near that position

high marsh
#

okay,

allPlayers select{_x distance baconman <= 5};

Why would you use nearEntities and check if player? Both are valid methods in my mind. Less checks.

keen bough
#

aye, right. So, gnashes just hands out the object of the nearest player. I am still very new. So, the object i get back is an array of informations or what do i get as a final result? Please :3

pure blade
#

that is the same 😄

keen bough
#

<flops> ayayay... my brain is mush

#

O_O i can create a trigger 😄

ruby breach
#

I write code assuming allPlayers is going to have 75+ units in it. Often better for performance to use other commands

pure blade
#

there multiple anwser with nearentites, where is the problem?

high marsh
#

shrug . You could always bench this

keen bough
#

oooofff i guess if we are around 10 players, its alot 😄

high marsh
#

A iteration through 10 player positions should be next to nothing perf wise

pure blade
#

yeah, but always code performance friendly, so you can learn it

high marsh
#

No, write what works. Then go back and refine.

pure blade
#

nah, two opinions 😄

high marsh
#

75 players plus is an extreme example.

keen bough
#

i hardly understand this currently, could one explain it to me eventually?

((_position nearEntities ["CAManBase", 5]) select {isPlayer _x} isEqualTo []) //returns true if no players are within 5 meters of given position

I mean, _position, nearEntities i do understand. Likewise the camanbase as well as 5. But after that it gets confusing for me.

#

select is also understandable. players _x and isequalto is confusing actually

ruby breach
#
(_position nearEntities ["CAManBase", 5]) //returns an array of all "Man" objects within 5 meters of _position
select {isPlayer _x} //return a list of elements from the previous array that returns true when checked with isPlayer
isEqualTo [] //returns true/false as to whether the list of players is empty
keen bough
#

omg! _x is a magic variable!

pure blade
#

select {bool} is the same as a foreach loop so _x is the current looped item

keen bough
#

i nearly made my head smoke to think what is _x

#

So, based on the function i am using _x does the foreachloop, right?

#

(wrong phrasing, but i think i got it now)

#

So with variable = thecode; i get a true/false statement only? (script from gnashes)

pure blade
#

yeah after select you create a code that return a boolean if the boolean becomes true then the current looped item will be added in the new created array what you get from array select {}

keen bough
#

it returns true as long no player is near and false as soon a player is near. Awesome

#

isnt camanbase and man the same, eventually?

pure blade
#

idk

#

but i think tho

ruby breach
#

Man includes animals (rabbits, snakes, etc)

#

CAManBase does not

keen bough
#

Ah, thanks @ruby breach - And the whole script runs now like a charm. On fire. With a flying tank.

minor moth
#

does anyone know why extDB3 returns a wacky table when using SELECT? i have to do ((_arr select 1) select 0) select 0 just to get to my data.

minor lance
#

Hello!
I have a particle source with water, I would like to know if the water collides with some object in its way
is it possible¿?
I would like to check the line in wich the particle is and if there is a object do somthing
I have read this "You can get position of a particle in onTimer script in particle array" But dont know how


Position of the particle is stored in "this" variable.OnTimer -```
unborn ether
#

@minor lance If you create a particle with createVehicle - it does return a particle as an object.

stark fog
#

how hard is it to add custom ammo types to a base game weapon? specifically, I'd love to make a mod to add lethal loads for the starter pistol. (I'm asking in scripting because I don't think it would require new models or anything... sorry if this is the wrong place)

still forum
#

#arma3_config would be correct place 😄 "how hard" not hard at all.
Weapon has a "magazines" config entry. Just add your own magazines to that. Done.

stark fog
#

wow... ok, thanks!

minor lance
#

Particle as createvehicle?

keen bough
#

Out of the blue: Can i check all the cities via script? I mean, do they exist in any form i could "talk" to or do i have to make the 'talk'-points to each city myself?

#

I plan to make only mission-templates, those mission spawn in the nearest city where the merc-base is.

proven crystal
#

Look into locations

keen bough
#

perfect, thanks @proven crystal

autumn swift
#

I have a question regarding the abillity to reset knocked down walls.

I have tried the following code:

    {
        _x setDamage 0;
    } 
    forEach nearestTerrainObjects [player, [], 50, false]

This works as it resets all the knocked down walls which is good. However the effect appears to be local. What I noticed is that if I execute this on everyone, then leave and rejoin the server, the walls will still be knocked down. The effect will be local for everyone and is not persistant

Please note the paramaters in nearestTerrainObjects are placeholder as I was testing this using the debug console!

#

So how can I make it persistant so that anybody who rejoins will also see the correct state of the wall?

signal pulsar
#

is there a way to tell arma to play a random sound file from a folder with a bunch of diff sounds in it?

pure blade
#

hm, idk if you can get content from a folder but you can count up you sound files and write the numbers at the end and then you can generate a random number in sqf or you make a array with all soundfile names and select one with selectrandom

#

@autumn swift try to run setDamage on serverside

#

@minor moth can you show us the script that you use to get the data from the database

autumn swift
#

@pure blade serverside was tried as well (through the debug console)

pure blade
#

but not with these parameters or? 😄

cold pebble
#

What’s the fastest way to add an element to the front of an array? 🤔

keen bough
#

remoteExec globally for everyone?

pure blade
#

@cold pebble append i think

#

@keen bough how do you mean? it depends on the target you given

autumn swift
#

@pure blade Oh shit.. I forgot that

#

xD

keen bough
#

i meant for the wall problem @pure blade ^^

pure blade
#

ah okay haha

minor moth
#

@pure blade

        // Format the query to send to the database
        _query = format["INSERT INTO `vehicles` (`ClassName`, `Position`, `Direction`, `Damage`) VALUES ('%1','%2','%3','%4'); SELECT LAST_INSERT_ID();",
            typeOf _x,
            str (getPos _x),
            str (getDir _x),
            str _damage
        ];

        // Send the query to the database.
        [1, _query, "SQL"] call SD_fnc_databaseCall;
#

doesnt really matter anyways, going to switch to a prepared query because extDB3 doesnt have allowMultiQuery enabled in its database connections

#

have to use sql_custom

pure blade
#

yeah use sql_custom, its clearer and safer

#

agains sql injections

minor moth
#

yeah i know, but it didnt matter in that case because it wasnt handling any data sent from a client

#

i used prepared queries all the time in gmod

carmine abyss
#

Is it possible to #include a file in an sqf? Also pass local variables through it?

high marsh
#

@carmine abyss Yes it is possible to include a file in sqf. Pass local variables? Why?

meager granite
#

#include is a "copy-paste" of target file into yours, you don't pass anything there, its just entire file pasted as is (with other preprocessor # executed)

high marsh
#
#include "BlaHBlaAhhhh.sqf"
useMacroBlaaah();
carmine abyss
#

@high marsh I was trying to make a loot table in a separate sqf to keep it clean

high marsh
#

Might be easier to make cfg

carmine abyss
#

i'm sure it would be. I'm just a newb

still forum
#

As said. A #include literally copy-pastes the other file into yours. You can do with that whatever you want

carmine abyss
#

ok thank you

autumn swift
#

@pure blade this is my current code:

{
    _x setDamage 0;
} 
forEach nearestTerrainObjects 
[
    getMarkerPos "NameOfMarker", 
    [], 
    75, 
    false
];

Executing it on server side seems to reset the wall on everbody as it should, but the issue remains that new player that connect after this is called will still see the walls in their old state.

ruby breach
#

Turn it into a function and remoteExec it with the JIP parameter set to true?

autumn swift
#

Alright, one more question about remoteExec.

Say I execute the following: [] remoteExec ["fnc_resetWalls", 0, true];

This will execute fn_resetWalls for everybody. with JIP set to true, now if JIP happens, will resetWalls be executed again for every client or only on the JIP client?

sorry for the basic questions, this is my first attempt at creating a MP scenario

pure blade
#

only for the jip client

autumn swift
#

Ah ok. Thanks for the assistance gents!

pure blade
#

as target you can write -2, so it will be executed on every client, but not on the server

autumn swift
#

Yeah true, wasn't sure if it would make a difference so I just went with 0

minor moth
#

-(number) denotes the inverse of the value you specify. so -2 is all clients, not server. if you were to use something like a clientowner id, you could do -(clientowner) to specify broadcast to everyone except that client

pure blade
#

🔝

ruby breach
#

Also, general note. tag your functions. alty_fnc_function

autumn swift
#

The functionname I gave was just a example.

keen bough
#

When i have a object, created via script named 'object_01' and i create it again, will the second one be named 'object_02' ?

minor moth
#

not sure what you mean

pure blade
#

no, that only works in 3den

minor moth
#

are you storing a reference to the object in a variable or something?

#

if so, no

ruby breach
#

If you define it that way, sure. Otherwise the second object is now 'object_01'

keen bough
#

that i wanted to know, thanksies.

#

if you would script a distance checker to cities/etc. Would you use markers instead or use the namecity/citycapital/marine/village/local? I am currently thinking of using empty markers so i dont have to worry what may or may not be a city, village, main city and so on

proven crystal
#

do i have to execute enableAI where the unit is local?

#

ie on the headless client if that is involved

minor moth
#

yes

proven crystal
#

?

#

ah thanks

minor moth
#

locality is always needs to be accounted for

#

@keen bough markers or just a position array

#

markers would be easier to go back and edit

keen bough
#

i thought of an array first too. But i guess markers would be really easy. Do they impact performance (empty) markers? Or is it neglectable?

pure blade
#

its neglectable

minor moth
#

super neglectable

pure blade
#

but you can place your markers in editor and loop the position of every marker than you have your array very easy

minor moth
#

negligible

keen bough
#

so i can work out a way to move the merc-box finally as soon i lay down the foundation for dynamic mission spawning

proven crystal
#
[[_object],
        {
            private _object = _this select 0;
            {
                _x disableAI "AUTOTARGET";
                _x disableAI "TARGET";
                _x disableAI "SUPPRESSION";
                _x disableAI "AUTOCOMBAT";
                _x disableAI "FSM";
                _x enableAI "Move";
            } foreach units (group _object);

            (group _object) setVariable ["Vcm_Disable",true];
        }] remoteexec ["BIS_fnc_call", _object]; 
#

this will do?

ruby breach
#

Definitely not

proven crystal
#

crap

ruby breach
#

private object = _this select 1; isn't going to really do much for you

#

object > _object

proven crystal
#

oh indeed

ruby breach
#

_this select 1 > _this select 0 (or even better, param[0,objNull];)

proven crystal
#

right.... fuck me for copy pasting stuff

#

but the way to call the code in general with the _object argument there should work i mean?

ruby breach
#

Looks right. But why use BIS_fnc_call and not just... call?

pure blade
#

if you create a public mission then i would create a function for this, allow bis_fnc_call in remoteexec is not a good idea

ruby breach
#

^ That too

#

Actually, does [param1,{param2}] remoteExecCall ["call",_target]; even work?

proven crystal
#

yeah i guess thats simpler...

#

well im locally testing....

#

i do get an eror now for the select 0 bit...

#

type object expect array

ruby breach
#

Because you're passing _object, not [_object]

proven crystal
#

ahyes, now works

pure blade
#

yeah should work but then you need to use only _this

ruby breach
#

param and params ignores that convention by the way

#
1 call {_this select 0}; //error type Scalar expected Array
1 call {_this}; //returns 1
[1] call {_this select 0}; //returns 1
[1] call {_this}; //returns [1]
1 call {_var = param[0]}; //returns 1
[1] call {_var = param[0]}; //returns 1
1 call [params["_var"]}; //returns 1
[1] call [params["_var"]}; //returns 1
pure blade
#

😄

ruby breach
#

Figured I might as well edit it to include all examples

#

tl;dr: If you're inconsistent in how you pass single variables, use param/params to save yourself errors later.

proven crystal
#

make sure all your work there ends up somewhere on the wikis ^^

#

on that note i used remoteexec ["BIS_fnc_call", _object]; because that is on the wiki

#

but i suppose it does the came if i just use call or spawn or whatever?

#

why does "BIS_fnc_call" exist?

minor moth
#

to execute code

#

so you pass a code object

#

or you can pass a compiled code object as well

coarse schooner
#

How do I get the vectorDir and vectorUp that points from one position to another. I'm trying to create a bullet and point it at a position with setVectorDirAndUp and make it fly forward with setVelocityModelspace [0,500,0];. 3-Dimensional Vector math is beyond my expertise so it would be nice if I could get some help.

minor moth
#

largestVecDir - smallestVecDir

#

that is the delta, the "change" between two numbers

coarse schooner
#

Thank you

frigid raven
#

Hey guys. Anybody of you wrote an extension without Visual Studio? I am using CLion cause I am used to Jetbrains IDEs and using the Cygwin Toolchain. I tried to follow Killzone_Kid's tutorial but it has too much stuff that depends on VS and I am not very used to C++ to find my own way with CLion now

#

ah forget it I just found the wiki

dusk sage
#

Nothing in his code snippets depends on VS?

#

👍

keen bough
#

How can i transform the outpot i get from [2031fd29f60# 1779919: truck_02_transport_f.p3d] this to a usable configname? I seem to cant find a way. Anyone a idea or knows how to?

#

found it. typeOf 😃

keen bough
#

i tried to give the found vehicle a name. Script looks like this:

_findVehicle = nearestObjects [testCargo, ["LandVehicle"], 25]; 
_selectVehicle = _findVehicle select 0; 
_vehName = typeOf _selectVehicle; 
_vehName setVehicleVarName "transportTruck"; 
transportTruck = _vehName; 
testCargo attachTo [transportTruck, [0, -1.3, 0]];

Currently for testing purpose only. But it throws a generic error. Any clues?

carmine abyss
#

I find a lot of these errors in my server rpt file. sqf Server: Object 4:55 not found (message Type_121) Error: Object(4 : 22) not found Client: Object 4:22 (type Type_121) not found. Server: Object 4:21 not found (message Type_121) Server: Object 4:21 not found (message Type_93) Server: Object 4:20 not found (message Type_93) Server: Object 4:54 not found (message Type_121) Can someone tell me where I can find more info on these errors?

keen bough
#

@carmine abyss From what i know and have read, you can ignore those, because they dont have any impact. There seems to be no way to get rid of that as well.

carmine abyss
#

Ty

kindred lichen
#

Is there a way to get the Ace Arsenal export, but without ace, so I can just use the setUnitLoadout

minor moth
#

@keen bough _vehName is a string, setVehicleVarName is a method of unit objects

#
object setVehicleVarName name
#

that is why you are throwing generic error

#

i also dont know why you'd need setVehicleVarName. its does not creates a variable that stores a reference to the object, like you are using it. all you'd need to do in order to attach the closest object to testCargo is this:

_findVehicle = nearestObjects [testCargo, ["LandVehicle"], 25]; 
_selectVehicle = _findVehicle select 0; 
testCargo attachTo [_selectVehicle, [0, -1.3, 0]];
keen bough
#

Oh, neat, thanks @minor moth another thing i learned.

still forum
#

@minor moth so you pass a code object or you can pass a compiled code object as well
Code == compiled code.
@proven crystal BIS_fnc_call exists because BIS_fnc_MP only supported script function names in the beginning. With remoteExec it became kinda useless.
There is a difference though. Script commands are executed unscheduled. Script functions are executed scheduled.
Meaning if you remoteExec BIS_fnc_call it's actually equivalent to executing the spawn command.
@carmine abyss where I can find more info on these errors -> google.
@kindred lichen getUnitLoadout

dusky pier
#

when ```sqf
(player distance object) > (objectViewDistance # 0)

#

for this object used hideObject?

still forum
#

English?

dusky pier
#

yes

#

google translator 😄

still forum
#

Well I don't understand what you are trying to ask

dusky pier
#

i try'ing make better client fps. But on my mission i have a lot of objects. I really need all this objects and can't delete them.

#

For now i have idea - move objects from mission.sqm to script and create them when player near this objects.

short trout
#

Maybe hide + disable simulation + move to [0,0,0] will be better then re-create objects each time, but not sure :3

dusky pier
#

something like this```sqf
[] spawn {
private _cfg = ["marker1","marker2"];
while {true} do {
{if ((player distance (getMarkerPos _x))<1000) then {[_x,1] spawn spawnObjs;};} forEach _cfg;
sleep 3;
};
};

west venture
#

Objects can be dynamically simulated, can't they?

dusky pier
#

@west venture i was read about dynamic simulation, bot still don't understand how it works

west venture
#

I'm almost certain that's the case, actually, considering there's an objects distance bar in the dynamic simulation tab of performance settings.

west venture
#

An object that has been specifically set to be Dynamically Simulated stops being simulated when a player - or an activator AI (which can turn on dynamic sim objects) gets out of range.

#

It is essentially exactly what you're trying to script.

#

I think AI default to being able to activate dynamic simulation, though, but it might be a mod.

#

Find Dynamic sim stuff in unit Attributes, find Dynamic Simulation options in Performance on the top bar.

dusky pier
#

I thought that the constant checking of the player’s distance from each object would make the game harder and affect the performance

west venture
#

No worse than your script would do, I expect, and Dynamic Sim apparently works well enough that BI added it into the game directly.

still forum
#

Dynamic simulation does all distance checking stuff in engine. Much more efficiently than you could ever do

dusky pier
#

@west venture @still forum Thanks for the help!

compact maple
#

so he only need to play with activationDistance, right ?

west venture
#

No scripting at all.

#

There's a distance slider in the performance options in the editor.

short trout
#

but it's static and not related to actual viewDistance, isn't it?

west venture
#

Dynamic sim isn't related to viewdistance, no - but units that are not being simulated will simply freeze in place in full view of high viewdistance players. This is most notable for air units, so you shouldn't dynamically simulate those.

dusky pier
#

as i understand - is works good only with mission.sqm? Or i can use script to createObjects?

west venture
#

How do you mean?

short trout
dusky pier
#

i want move objects to script

#

It's easier for me to work with the script. But if the solution with the editor is better and easier to use - I will still use mission.sqm

compact maple
#

@west venture This is what I'm talking about, this is the activationDistance

dusky pier
#

@short trout i can change viewObjcetDistance with script for player.

#

is no problem

west venture
compact maple
#

Activation Distance Different distance values for given entity types. Distance is approximate, slider snaps to multiples of 50m. Default values set for infantry mission where players do not have large magnitude scopes or binoculars at their disposal. If such devices are available, try multiply the ranges for Characters and Manned Vehicles by 2x-3x.

From what I understand, objects who have enableSimulation checked will be "active" only if something that can interect with them enter the activation distance

short trout
#

yes

#

so if you have 6000 of objectViewDistance and 3000 of activation distance - you will see freezed objects outside 3000 m

compact maple
#

yup

short trout
#

(or won't see any object, don't know actually)

compact maple
#

got it

west venture
#

Unsimulated objects will be visibly frozen.

#

Combine it with hideObject for best results if you want a high view distance and don't care about long range recon, but you'll get the performance hit from a script trying to emulate the dynamic simulation.

short trout
#

Just to share my outdated expirience:

HideObject + diableSimulation was still less effective than hideObject + disableSimulation + setPos [0,0,0]

So if you won't be pleased with vanilla dynamic simulation - maybe you should try to move objects out of map, it can give you additional FPS

dusky pier
#

@short trout for setPos i use script?

short trout
#

yeah, but try vanilla dynamic simulation first, my expirience is related to times when engine didn't has in-build feature

dusky pier
#

@short trout
Sorry for a lot of questions, but how best to make the object move? I do not want to use a trigger, because he eats fps.

short trout
#

but again -- dynamic simulation by itself may be effective enough for your needs

dusky pier
#

@short trout thank you!

quasi rover
#

I'm in the middle of debugging process.
If I get this value <null> for _randomPos array variable , which one is true for _randomPos? if (count _randomPos == 0) or if (isNil _randomPos)

short trout
#

i choose "isNil _randomPos"

quasi rover
#

thx

still forum
#

neither

#

isNull _randomPos
You didn't give enough info though. <null> doesn't look correct. There should be more specific info in there

quasi rover
#

@still forum thx, here is the code and rpt file.

private _randomPos0 = _this select 0;
_randomPos = _randomPos0 findEmptyPosition [0,20,"B_MRAP_01_F"]; 
diag_log format["*************: _randomPos: %1, _randomPos0: %2", _randomPos, _randomPos0];
17:28:40 "*************: _randomPos: <null>, _randomPos0: [7062.42,16472.1,0]"
still forum
#

🤔

#

If it's nil. It should show <any> I thought

#

isNil "_randomPos" maybe

quasi rover
#

but BIKI for findEmptyPosition says, if not found then [] returned.

frigid raven
#

I try to use my test extension (only 64bit for now).
Placing the .dll into my Arma3 root C:\Program Files (x86)\Steam\steamapps\common\Arma 3\myext_x64.dll
Starting Arma 3 (64bit)
Going into a mission
Running Debug Console and execute "myext" callExtension ""

to call this stub func

void RVExtension(char *output, int outputSize, const char *function)
{
    std::strncpy(output, function, outputSize - 1);
}

.rpt yields therefore: 10:06:59 Call extension 'myext' could not be loaded: Module could not be found.

ℹ I deactivated BattleEye

still forum
#

Maybe your dll requires other libraries that are not in arma directory

#

You can use this http://www.dependencywalker.com/ to find out what other dll's your's depends on.
Find the non-system dll's that are required and missing. And you know what your problem is

peak plover
#

For infantry

#

Handledamage shows damage AFTER armour, right?

#

And hitPart BEFORE armour

ebon sparrow
#

Help me with the use of the function of the missing body, it does not work.

#
    player setVariable ["Cloak_on", true];
    SystemChat "Cloak : Engaged";
    player setCaptive true;```
#

What are the variables that make it disappear?

minor moth
#

@still forum i was trying to convey that you can use the compile command to turn string into a code object

keen bough
#

For testing i have it currently like this

_nearestBench = nearestObjects [player, ["Land_Workbench_01_F"], 25000];

Now i have questions: Can i still use 'player' in mp and can i expect it uses the player who initialized the script? I could write a script-starter for every single workbench that exists (5) but somehow i want it for general use.

Can i write a bigger code into [?, ["workbench"], 25000] to test each and every workbench against every player and figure out the two nearest to each other?

minor moth
#

i didn't explain it the best but i understand it's the same thing

#

@keen bough depends on what locality you are executing the script. if it's on the server, no. if you are running it on a client, yes

still forum
#

diseapper? @ebon sparrow hideObject?

keen bough
#

The script will be running on the server. So should i trie to do a search and test each other out to find the nearest to each other or just write the script to each and every workbench which is just using the workbenches names - no big deal. @minor moth

minor moth
#

hideObjectGlobal

still forum
#

player is always the local player. objNull on server because there is no player on server.
Otherwise if it's running on the players computer. Then player of course is player

ebon sparrow
#

@still forum character

minor moth
#

@keen bough if you are going to use remoteExec to tell the server to do something from the client, you can use RemoteExecutedOwner

#

to tell what player sent the request

ebon sparrow
#

I'm editing server apex farmwork compatibility with mods cysis

keen bough
#

Oh, i did not know about that @minor moths Nice, that could work just fine. So 'player' is then the one who called/started the script?

minor moth
#

player is the entity of the client that 'player' is executed on. as dedman explained above, it'll be objNull on the server

#

because it's the server

keen bough
#

But with the remoteexecuteowner?

minor moth
#

i'd have to know exactly how you are executing your script to tell if it's on the client or the server

#

remoteExecutedOwner returns the client id of the player making the request to the server

#

it returns 0 if there is no client making the request

keen bough
#

Oversaw that. Is the id usable to be used in nearestobjects actually?

minor moth
#

not directly. there is probably a script command i don't know about that takes the client id and turns it into a reference to the unit the client is controlling. i currently loop through allPlayers and compare the owner id of the unit, which isn't very efficient

#

but i don't know of any script command to do it for me, @still forum probably knows though

still forum
#

My name is dedmen. Not dedman.

minor moth
#

sorry lol

still forum
#

You can just iterate through allPlayers. Find the nearest object to each player

#

and then filter out the closest one

compact maple
#

I didnt knowremoteExecutedOwner, what a usefull command, i'm actually sending the player as param then I use owner lol

minor moth
#

i wouldn't trust the client with providing itself like that

keen bough
#

hmmm, that could work out. I also could execute the script on the client, since the only important thing at the end is the global variable that saves the ressources. @minor moth

minor moth
#

if the client isn't doing something like creating vehicles or setting variables, etc. you're probably good to do it all clientside

keen bough
#

yah, they have to stay in the vicinity of the workbench, else the script stops automatically.

#

theres no possible way to createvehicles or anything else haha ^^

minor moth
#

by setting variables i mean like setVariable with the global argument set to true, and you never know the environment that you're scripting for. atm i'm currently working on some database mysql stuff where the client can basically do anything, which is bad juju but i do what i can to make it relatively secure

#

isn't gonna stop anyone from just bis_fnc_call with remoteExec and calling extDB3

#

i can't use CfgRemoteExec either cus of mod conflicts

compact maple
#

why are you using bis_fnc_call ? this is so old

minor moth
#

i don't use it

keen bough
#

So when i execute the script on a client, the global variable(s) used have to be set via setVariable globally?

minor moth
#

anyone can use it though because i'm not using CfgRemoteExec

#

if you want to access them on other localities yes

#

but if it's client only, no

keen bough
#

aye thanks, i think i can work with the new informations :3 Tank you a lot :3

compact maple
#
player setVariable ["lol", lol]; // others player cant access it via getVariable
player setVariable ["lol", lol, true];  // others players can access it
minor moth
#

exactly

still forum
#

(∩`-´)⊃━☆゚.*・。゚

keen bough
#

Well, i came up with this, am i correct on this one?

storedRawRessources = _miningWork;
                                                    missionNamespace setVariable ["storedRawRessource", (+ storedRawRessources), true];
                                                    _mineTimerStart = serverTime;
still forum
#

Why the + ?

#

That's useless

keen bough
#

in case multiple players work on different ways to generate the rawRessources?

still forum
#

🤔 wut

#
  • copies an array
#

Which is useless. As it's copied anyway when it's sent off to others

keen bough
#

can there be a problem when two work at the same time?

still forum
#

Don't know what you mean

#

When you do that setVariable. The variable is set to that value for everyone

keen bough
#

Aye, its a script for basically working in a mine, where mercs can generate the ressource "Raw Ressource". Basically, every Dump, Quarry and/or Mine are producing Raw Ressources

short trout
#

As it's copied anyway when it's sent off to others
Intresding. As for code like:

_myArray = obj getVariable "ObjRelArray"; // [1,2,3]
_myArray pushBack 4;

at this point both _myArray and obj getVariable "ObjRelArray" becomes [1,2,3,4]
then what happens if obj getVariable "ObjRelArray" was defined as global true?
🤔

still forum
#

The same thing happens

#

but the variable only updates locally

#

it doesn't magically update everywhere else

short trout
#

so i will need setVariable [...,..., true] each time. ok, i was making this already, but was not sure is it necessary or magic exists

keen bough
#

Magic does exist. But it only sends moving tanks to the sky.

#

Well, i came up with this now

missionNamespace getVariable "storedRawRessources";
                                                    _miningWork = storedRawRessources + 4;
                                                    storedRawRessources = _miningWork;
                                                    missionNamespace setVariable ["storedRawRessource", storedRawRessources, true];
                                                    _mineTimerStart = serverTime;

That should run on a client and working just fine in multiplayer environment, right?

ebon sparrow
#

I can edit the file. texHeaders.bin What programs?

#

unrap not work

still forum
#

No you cannot edit the file

#

it's not meant to be edited

#

@keen bough That should run on a client and working just fine in multiplayer environment
Well.. If you're fine that everyones storedRawRessources get's overwritten every so often. And if two people set it at the same time, one of the updates will be ignored. Meaning you loose "4" resources

proven crystal
#

when i have set a variable public once with setVariable, do i have to do it again when ichange it?

#

_object setVariable ["lol", lol, true]; everytime or is it enough to do it once like that when i initialize some vars?

still forum
#

yes

#

we just talked about that

proven crystal
#

ah i didnt see that

keen bough
#

Is there a way i can "add" it to the current ressources? Like doing "old ressources + new ressources"? @still forum

still forum
#

you are already doing that

keen bough
#

Yeah, but i overwrite it with the new value, instead of adding it to the old value?

#

i first thought i could do it with "oldressource", (+ newressource)

still forum
#

you can't

#

storedRawRessources = 10;
Player1: storedRawRessources = storedRawRessources + 4;
Player2: storedRawRessources = storedRawRessources + 4;
Player1: missionNamespace setVariable ["storedRawRessource", storedRawRessources, true];
Player2: missionNamespace setVariable ["storedRawRessource", storedRawRessources, true];
Result: 14. But should be 18

#

You simply cannot do it reliably this way

#

you can let the server add up the numbers and re-publish the variable

#

that would be safe

keen bough
#

If i would make an array, lets say "alltheressources" i could simply add every single ressource produced from every player to be added to the array and do a simple timed script that deletes the array every so often and add its content to the main rawRessources. Right?

still forum
#

But again. If you publicVariable that array from the client. You'll overwrite other clients data

keen bough
#

<sighs> dang. I dont see a way currently not messing up instead of making every ressource-generating place unique.

still forum
#

remoteExec to the server

#

tell the server you mined 4 resources. Let the server handle it

keen bough
#

That works, even when multiple persons are doing the same thing at the same time?

still forum
#

yes

#

the server cannot do multiple things at the same time

#

as scripts cannot run in parallel

keen bough
#

Nice. I am not sure about how to write it with remoteexec but i came up with this:

[(("storedRawRessource", storedRawRessources, true), missionNamespace)] remoteExec ["setVariable"];
still forum
#

for one. Syntax error

#

second. another syntax error

#

third. You are doing the exact same thing that you are doing now. Just in a convoluted and way more expensive way.

keen bough
#

hmm, i dont see a solution right now.

still forum
#

run a function on the server