#arma3_scripting

1 messages · Page 640 of 1

lean anchor
#

ahhhh ok thanks

#

i was going mad lookinng for a difference haha

robust hollow
#

it isnt missing from that snippet. the error should show you where it thinks the issue is.

spark turret
#

btw, diag_log already turns arrays into string

lean anchor
#

ahhh im bad with diag_log plz let me live xD

spark turret
#

so

diag_log ["i","am","an","array"];

works fine

#

didnt know it till recently too

#

dedmen let his holy light shine into my skull

lean anchor
#

_please = (count (allPlayers - entities "HeadlessClient_F")
if (_please == 0) then {
["ALIVE_MIL_OPCOM"] call ALiVE_fnc_PauseModule;
} else {
["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule;
};

Thats the code that i have an im beinng told this. I think

2020/12/18, 15:52:27 Error position: <if (_please == 0) then {["ALIVE_MIL_OPCO>
2020/12/18, 15:52:27 Error Missing )
do

still forum
robust hollow
#

no semicolon after _please is defined

still forum
#

and missing )

#

as the error msg says

robust hollow
#

also a missing ) on the end of that line

lean anchor
#

this is why i am an idiot

spark turret
#

you got the VSC extensions for SQF?

lean anchor
#

tbh i use notepad ++ and got the SQF in that.

#

im not massively experienced

spark turret
#

visual studio code has some very nice and helpful extensions for SQF

lean anchor
#

@robust hollow just to check _X is a short way to define a variable? ive been slightly off on that for a bit

robust hollow
#

_x is a magic variable in some loops

lean anchor
#

thank yo ironsight, i will go look into that now

#

oops

#

i was using X instead of "_car" "_bus" "_etc"

spark turret
#

.

lean anchor
#

i know that _x is used for the current element in an array. that was one i did learn

spark turret
#

_x is the element of for loops in arma

lean anchor
#

yeah ive read it a few times on the wiki when i get confused late at night haha

spark turret
#

theres a bunch more of these magic variables

#

what are you working on rn?

#

btw did you get the alive collisions to fix?

lean anchor
#

kinda, supergaunlet did some class work and they now blow the fuck up wayyyyy less

#

ive been trying to get the auto pause to work with HCs as none of the code or code snippets i can find actually work

#

and this way i can intergrate it hopefully

#

(it is also the last stage in completeing my alive powered gamemode)

spark turret
#

👍 sounds good

upbeat quartz
#

Hello everyone, does anyone know about text display?

#

For my mission I would like some text to appear in the center of the screen, and that one of the sentences goes to the line, but stick to the first

#

So far I can only go to the line, but always center on the screen, while I would like to shift it a notch to the left

robust hollow
upbeat quartz
#

Yes I saw this page, but I did not manage to reproduce what I expected

lean anchor
#

_please = (count (allPlayers - entities "HeadlessClient_F"));
if (_please == 0) then {
["ALIVE_MIL_OPCOM"] call ALiVE_fnc_PauseModule;
} else {
["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule;
};

is there something i need to be doing on lines 3 and 5 to call this function on the server? This is what im executing and im not getting either of these two functions to do its stuff

robust hollow
#

if it is executing in the onPlayerConnected event then it should already be on the server.

#

have you tried the _uid suggestion yet for the condition?

lean anchor
#

havent yet as i havent wrapped my head around that yet

#

ill go try that or attempt to now

#

private _isPlayer = _uid find "7" == 0;
What is this for?

robust hollow
#

_uid is an argument passed to the event. 7 is because steam uids always start with 7, and dedicated servers and headless clients dont start with 7. they also dont start with any number which is why parsenumber is an option.

lean anchor
#

i guessed it was to do with always starting with 7

#

while it isnt arma, why is every uid start with 7?

#

im just uploading a version using UID now. im lost as to why in my above code, why does it seem like the if statement isnt doing anything and is being skiped?

thorn hedge
#

So, I really like this mod called Ravage, and me and some friends are going to make a ravage server, but if you run out of ammo mid fight and a zombie is after you, it really takes away from the game because in a real life situation you would try to fight it, but arma doesn’t have a melee system, so we got this mod that adds some melee weapons in the game, but I dunno how to add it into the game itself,

#

Is there a way to just add it to your inventory when u spawn

#

I have 0 scripting experience

robust hollow
robust hollow
lean anchor
#

im currently working out my error using the UID option

#

this has scrambled me haha

#

@robust hollow im trying this

#

if
(private _isPlayer = parseNumber _uid != 0)
then {
["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule;
};

robust hollow
#

...

private _isPlayer = parseNumber _uid != 0;
if _isPlayer then {...```
lean anchor
#

i feel your face is your icon atm

#

oh fuck sake

#

i get what you meant by it, i got so damn confused

#

i thought you meant use that to get the number of players (and yes i had the brackets around the UID part before but i just gave up after not having a clue where i was wrong)

robust hollow
#

ahh, no. if it returns true then you have at least one player in the game, which is what the threshold of the original count check was.

lean anchor
#

mind if i DM you?

#

dont want to spam the crap out of this channel

robust hollow
#

this channel is made for spamming, but sure

lean anchor
#

welp if its ok to do it im happy to

#

ill just post what i have as i think ive managed d to just confuse myself.

I have this being called in my initserver.sqf

_APcon = addMissionEventHandler ["PlayerConnected",{ _this execVM "Script\autopausecon.sqf" }];

I understand that calling a script from here may be bad practice (not sure if it breaks it) but im doing this because it makes editing the auto pause stuff easier.
in that .sqf file im doing this.

private _isPlayer = parseNumber _uid != 0;
if _isPlayer then {
["ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule;
};
diag_log format ["autopausecon.sqf done"];

again i know that the diag_log is crap but it works.
have i got the wrong idea?
I think i have

robust hollow
#

you arent defining _uid

#

put params ["","_uid"]; on the first line

#

would an easier alternative for you be to use initPlayerServer.sqf instead?

#

probably wouldnt make much difference either way i guess. this just seems too simple to be having such a hard time with 🤷

lean anchor
#

thats what i thought

robust hollow
#

put it as the first line, move everything else below it

lean anchor
#

because ive managed to get it to fire the EH when players connect, and disconnect but i have only ever managed to get it to auto pause on disconnect

#

rgr

#

which is why im confused, i basically have very similar code for disconnect but it is just checking if it =0 and when it does it pauses like i want it to

#

but it wont work when i connect but if then run the same damn code in the debug and excute on only the server (which is the same as the way im making this EH, it only fires on the server) and when i do this it also works

#

i tried having the first clause as
if (players - HCs) != 0 then....

#

which also didnt work

robust hollow
#

yea thats because the connect event fires before you have a unit in the world.

lean anchor
#

the connect event fires the after you have selected a slot and you hit OK to go into the map loading screen from my testing (could be the same thing?)

#

and if what you are saying is true, it is what i had in mind originally and i got having a look around online. this is still what came up? I could just have an array that is added to everytime someone joins and everytime someone disconnects it removes one? or when someone crashes does it not go through a playerdisconnect EH?

lean anchor
#

and it worked

#

now to make it work on disconnect, @robust hollow thank you so much for your patience and time! very much appericated

past tiger
#

It's so "WTF".

#

"I will create a 10X housa!"

#

May be for rocks

little raptor
#

Question about hashmaps: what happens if I do this?

_hm = createHashMap;
_key = [1,2,3];
_hm set [_key, _value]:
_key pushBack 1;
_hm get _key; //<- what does this return?!

is _value still retrievable?! in otherwords, when I change the array by reference, does the new element get hashed?

#

I'll test this in a few hours myself but wanted to see if anyone knew. (maybe Dedmen?)

robust hollow
#

returns nil

#

the key doesnt change, it doesnt seem to be an array reference to the original

little raptor
#

ah, that's too bad. thanks for testing! 🙂

#

IIRC Dedmen said it hashes arrays element by element, so I was kinda expecting that.

robust hollow
#

yea. it makes sense, seeing as keys can only be "static" data types.

spark turret
#

Uh you can set a whole array as the key?

little raptor
spark turret
#

Code can be a key? Whats a use for that one?

winter rose
#

Whatever you want it to be!

grizzled cosmos
#

How can i make when a task is finished it adds something to ace arsenal

quasi sedge
#

Alpha 1-1 two players,
instead of
moving second buddy to leader's vehicle,
how to rewrite this code to
"move leader of squad to second buddy's vehicle?"

_playerGrp = group player;
_groupLeader = leader _playerGrp;
_vehicle = vehicle _groupLeader;
player moveInGunner _vehicle;```
#
_playerGrp = group player;
_secondBuddy = select 1 in units player;
_vehicle = vehicle _secondBuddy;
player moveInGunner _vehicle;
#

something like this?

#
_secondBuddy = select 1 in units player;
_vehicle = vehicle _s>
15:17:46   Error position: <1 in units player;
_vehicle = vehicle _s>
15:17:46   Error Missing ;```
robust hollow
#

you should read the wiki if you dont know how a command works. no sense sticking commands together hoping for the best.
I’d use param instead of select, just incase there is only one unit in the group.
_secondBuddy = units player param [1,objNull];

quasi sedge
#
_playerGrp = group player;
_secondBuddy = units player param [1,objNull];
_vehicle = vehicle _secondBuddy;
player moveInGunner _vehicle;```
Works flawlessly, thank you so much @robust hollow!
still forum
still forum
#

noone requested it, noones asked for it. I just thought it was funny and interesting so I made it a thing

still forum
#

also array keys that you retrieve via keys or forEach, are read-only and will/should error when you try to write

quartz coyote
robust hollow
#

i believe one objective of it was to be more secure than the old public variable eventhandler method of remote execution. in my experience i dont think it has prevented too many script based hacks but i certainly felt better for using it.

spark turret
#

functions library is to prevent someone overwriting a public variable (aka function) with his own code i believe

#

it probably doesnt prevent code execution in the first place but can stop altering already running code

little raptor
#

altering already running code
not possible via SQF at all

still forum
spark turret
#

if my function is a public variable, i can overwrite it and the next iteration will use the new code is what i meant with "altering running code"

winter rose
still forum
#

Yes CfgRemoteExec was intended as a security measure.
Configuring who is allowed to use what, and blocking the rest.
So you can constrain it to a safe environment

still forum
quartz coyote
#

In my scripts, the only public variable I have are the Team Score, Time

#

not sure I really need any "protecting"

little raptor
#

You can't protect all variable types. It's pretty much only code

#

I'm not sure why

still forum
#

CfgRemoteExec is for script functions and code

#

not variables

little raptor
#

compileFinal protects a variable (code) deosn't it? (which is what I had in mind when I said that)

still forum
#

you can protect all variable types from overwriting on server, by using localNamespace for them to prevent publicVariable overwriting it, and CfgRemoteExec to make sure clients can only do on the server what you want them to do.

or you can use CfgDisabledCommands to block publicVariable command I guess

still forum
little raptor
#

I was hoping all variable types could be protested (as I asked before in a feature request)

still forum
#

it was attempted once. ended badly.

#

It was tried to do things like "server has the highest authority" even with read-only variables

#

and I don't want to try that stuff again. Even if you try, you'll have arrays and stuff that you can modify by reference which is hard to handle

#

Ah I think my new-ish idea was to allow setting variables read-only, but ONLY in localNamespace

#

Or only at game start maybe... but that can cause issues so maybe not

little raptor
#

It was tried to do things like "server has the highest authority" even with read-only variables
I was hoping you could allow modifying with an alt syntax, like lock ["var", player] to only allow the variable to be modifiable on the system where the player is local (like remoteExec). or maybe the other way around (lock ["var", player] locking the variable on this system only)
you'll have arrays and stuff that you can modify by reference which is hard to handle
yeah this is probably not optimal either.

queen cargo
#

What for tho

#

Tbh... Only functions really need to be read only, so other mods and scripters May not override your stuff

#

For values, either use macros or nothing
Tho I agree, having a way to define constant values on a language Level would be nice

#

Might add that to sqc one day 🤔

quick peak
#

Hey, is there any way to play sound only inside vehicle or for crew only? say3d or playsound3d are not working

#

Point is, I want to play hit sound when tank is hit

little raptor
#

say3D too is local

#

I don't know why you say it isn't working

tepid vigil
#
_title  = "<t color='#00ff00' size='2' shadow='1' shadowColor='#000000' align='center'>Kavala Secured</t>";

_text   = "<br /><t color='#0000ff' size='1.4' shadow='1' shadowColor='#000000' align='center'>All enemy units in the area have been eliminated, good job. Await further orders from HQ</t>";

[parseText (_title + _text)] remoteExec ["hintSilent", 0, false];
``` Do _title and _text have to be global variables for this to work?
little raptor
#

no

tepid vigil
#

thanks

wet shadow
#

So Im working on a script to make a blackout on a certain area. Disabling all street lamps and the like is no issue as there are several different codes floating around.

The problem is that some buildings in the CUP mod have lights that are integrated into the building object itself. One can disable the lights on those by inducing damage to the building itself. If anyone here has ideas of a more elegant solution compared to damaging all buildings in the blackout area which might induce new problems please share.

willow hound
#

Have you looked into the building config?

#

Perhaps the lamp has a hitpoint-thing that you can apply damage to directly

wet shadow
#

Hitpoints are indeed the most promising solution. Im currently working on a solution that gets all the hitpoints from the config, then filter those that have '#' (which seem to indicate light sources AFAIK). Then its just a matter of putting damage on those parts.

tough abyss
#

I'm trying to script a system where you can slingload anything. Basically what I want to do is use setMass to change the vehicle's mass only when it is attached to a sling rope. Then when it is detached it sets it back to the default mass for the vehicle. Anyone know a way to do this?

finite sail
#

ooh yeah, a tricky one this

#

the original mass of the vehicle isn't stored in the config

#

so you have to a getMass on the vehicle

#

before you lift it

#

and remember that value so you can set it back after you un-sling it

tough abyss
#

Ah jeez this sounds difficult

finite sail
#

this post covers it

#

post 3 from grumpy does everything you need

tough abyss
#

Would that first solution by the other guy work?

#

I could make that into a function to call pretty easily

finite sail
#

which post?

#

TBH, when Grumpy Old Man posts a solution, it's rare that it isn't the best solution

tough abyss
#

The one by Mr. H

finite sail
#

apologies for the double negative 🙂

#

Yes, the guts of what needs to be done is in the post by Mr H, just as I described earlier

tough abyss
#

Oh I understand Grumpy's now

#

So you dont have to get the initial mass, just enter the slingloaded weight in the array

finite sail
#

Ah yes, he's used a premade array

#

but the getmass command will give you the info

#

you just need to store that on a variable on the slingloaded objects before you change it's mass

tough abyss
#

He uses getMass

finite sail
#

yes

tough abyss
#

The mass arrays are what it is changing to when it is slingloaded

finite sail
#

its the only way afaik

tough abyss
#

Yeah that's not a problem

finite sail
#

oh, is that what he doesn? I didnt look too closely

tough abyss
#

Yeah the comment says that the class name and the number next to it is what the mass is while slingloaded

finite sail
#

ah right, uyes

#

dont forget each helicopter has it's own max payload

#

last time i looked, the Taru is the most powerful

tough abyss
#

Changing it to like 20 for each one will make it quite irrelevant lol

finite sail
#

yeah, but if you make it too light, you can make it behave wierd

tough abyss
#

Would that really matter while sling loaded?

finite sail
#

yes

#

heavy things are harder to lift

#

and lighter things tend to lurch aroundmore

#

are you doing this in multiplayer?

tough abyss
#

Yes

finite sail
#

OK, here's a tip..

#

change the locality of the slung load to the same as the pilot of the lifting helicopter

#

you'll have much less glitching that way

quasi sedge
#
_actionid = _plr addAction ["Spawn vehicle", "scripts\spawnvehicle.sqf"];

{
    _playerGrp = group player;
    _groupLeader = leader _playerGrp;
    if (vehicle _groupLeader isKindOf "Air") then
    {
        _actionid1 = _plr addAction ["getAsGunner1", "scripts\getAsGunner1.sqf"];
    };
};
{
    _playerGrp = group player;
    _secondBuddy = units player param [1,objNull];
    if (vehicle _secondBuddy isKindOf "Air") then
    {
        _actionid2 = _plr addAction ["getAsGunner2", "scripts\getAsGunner2.sqf"];
    };
};
{
    if (vehicle player isKindOf "Air") then
    {
        _actionid3 = _plr addAction ["Change pylons","[player] spawn GOM_fnc_aircraftLoadout"];
    };
};```
#

im totally newbie in codding, thats wrong here? Nothing in .rpt

#

only this work ```sqf
_actionid = _plr addAction ["Spawn vehicle", "scripts\spawnvehicle.sqf"];

#

=================

    if (vehicle _groupLeader isKindOf "Air") then
    {
        _actionid1 = _plr addAction ["Зайти как стрелок к тиммейту 1", "scripts\getAsGunner1.sqf"];
    };
    _playerGrp = group player;
    _secondBuddy = units player param [1,objNull];
    if (vehicle _secondBuddy isKindOf "Air") then
    {
        _actionid2 = _plr addAction ["Зайти как стрелок к тиммейту 2", "scripts\getAsGunner2.sqf"];
    };
    if (vehicle player isKindOf "Air") then
    {
        _actionid3 = _plr addAction ["Изменить пилоны на авиации","[player] spawn GOM_fnc_aircraftLoadout"];
    };

{ }; wrong placed, found

short flame
#

does anyone know a script/mods where i can choose a insignia with ace, but without an arsenal

exotic flax
#

You could set an empty arsenal, and only have the insignia's 🤔

finite sail
#

Can I safely assume a vehicle that has been dead for some time has no crew?

short flame
exotic flax
#

For that you'll have to build something yourself, can't think of a mod which has that specific feature

short flame
#

any idea how i can do that with a module?

exotic flax
#

🤔 a module is just a script, nothing else

short flame
#

I am realy new to modding, this is why didn't knew that sry but thanks for your help

willow hound
hollow lantern
#

ah it is nearestObject [Vulture21VHC, ("Helipad_base_F")]

#

reading the wiki a second time solved my problem

hollow lantern
#

is there an effective way to check a given variable if it is an object, coordinates or a marker? Tried typeOf but that doesn't seem to work on markers.
I basically just need to know what if an object, a marker or some coordinates where passed through

finite sail
#

@hollow lantern your question seems to show a lack of understanding of the fundamentals of scripting in this game, but nevertheless...

#

if its "coordinates", then it will be an array, if its a marker then it will be a string,

hollow lantern
#

I know that coordinates will be a array lol. Yeah typeName was what I was looking for

#

maybe I phrased my question wrong, but thanks

finite sail
#

you're welcome

#

ignore my mood, im drunk 🙂

winter rose
#

hi drunk, I'm dad!

winter rose
hollow lantern
#

@finite sail not drunk enough :b

finite sail
#

i know, got to work tomorrow, so am being sensible

queen cargo
#

@hollow lantern due to the Nature of those types, markers are strings (can probably be checked using eg. _val isEqualType "" && { getMarkerType _val != "" }), Positions are three scalars in an array (_val isEqualType [] && { { _x isEqualType 0 } count _val } and the only actual existing type of that list is object (_val isEqualType objNull)

robust hollow
#

for the position you could also do _arr isEqualTypeArray [0,0,0]

#

instead of the count

#

possibly instead of isequaltype too 🤔

queen cargo
#

Think the isEqualType still is required

#

Unless isEqualTypeArray also checks for array too 😂

#

Not sure tho

robust hollow
#

i imagine it starts by checking if it is an array at all, if not then false

#

ill check

winter rose
#

yep, because it might throw an error as well

robust hollow
#

you're right, it errors. seems kinda weird to me because isEqualType is for comparing different data types, so i would have thought isEqualTypeArray would be an extension of that.

winter rose
#

input must be an array, so it is understandable
should 1 isEqualTypeArray [0] return true or false?

robust hollow
#

i thought it would return false because 1 isnt an array, but no 😢

lean anchor
#

if i know the name of on object and have in it in string format. how can i delete that vehicle?

exotic flax
#

If you have named the object with a variable, you can use the following:

_string = "some_object";
_object =  missionNamespace getVariable [_string, objNull];
deleteVehicle _object;
robust hollow
#

missing semicolon 😱

exotic flax
#

people should never C&P anyway 🤣
but fixed it

lean anchor
#

ok sick, thats what ive got and i think i know whats wrong

sour tapir
#

Hm, any ideas for a method to create a suppression system for the player? I think Laxemanns is good, just would prefer a different type of effect. How would I go about having a detection for impacts near the player(s) ? 🤔

winter rose
#

there is a new EH landing in the next patch

sour tapir
#

Oh wow just what I was looking for I guess 😅 thanks,

winter rose
#

note, it is dev branch only for now

lean anchor
#
_veh = [[getPosATL _namepos select 0 , getPosATL _namepos select 1 , _staticheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
    _veh setVehicleVarName _staticname;
    _staticname = _veh;

should this be?

_veh = [[getPosATL _namepos select 0 , getPosATL _namepos select 1 , _staticheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
    (_veh select 0 ) setVehicleVarName _staticname;
    _staticname = _veh;

what im trying to do is create a vehicle at the pos of a helipad and have it named so that i can delete it again, the next time the script is run.

#

i am struggling to get the vehicles to name proplery (i had it before and have fried myself on trying this)

#

and if i have it right in the last one, why is _veh an array and not an obj?

exotic flax
#

and instead of accessing the name of the object, you can also use the object itself from _veh select 0 in other commands/functions to reference the vehicle

lean anchor
#

i understand why the select thing works!

#

thanks

#

is there anywhere that goes more into what objects are than this page?

exotic flax
#

An Object in the scripting language is a generic reference for a soldier, vehicle or building.
Can't think of a better description than that

lean anchor
#

i mean like for a soldier, what is stored? it is a very basic question (i think?(like i dont know if its a basic question)) and i havent really been able to find out

exotic flax
#

it's the object of the unit, which by itself doesn't contain anything, but can be used to reference all the attached data to that object.

lean anchor
#

thanks!

#

that makes alot of sense

#

i am trying this and the name of the created vehicle isnt test

  _staticname = "test";
_veh = [[getPosATL _namepos select 0 , getPosATL _namepos select 1 , _staticheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
(_veh select 0) setVehicleVarName _staticname;
#

ooooooh wait

#
 
 _staticname = "test";
_veh = [[getPosATL _namepos select 0 , getPosATL _namepos select 1 , _staticheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
_veh select 0 setVehicleVarName _staticname;
#

should it be that bottom one? i dont think so

exotic flax
#

check https://community.bistudio.com/wiki/setVehicleVarName

When a vehicle is created and named in the editor, the name becomes both the variable containing the vehicle object and the string representation of the vehicle object. vehicleVarName on the other hand is only string representation of the object. So if you want to refer to the actual object by its vehicleVarName, an extra step needed to assign the object to a variable of the same name. For example to see and refer to offroad as myFerrari:

_offroad setVehicleVarName "MyFerrari";
MyFerrari = _offroad;
lean anchor
#

yeah so i tried that before with

#
    
_veh = [[getPosATL _namepos select 0 , getPosATL _namepos select 1 , _staticheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
    (_veh select 0) setVehicleVarName _staticname;
    _staticname = (_veh select 0);

and it wasnt working

winter rose
#

just… what do you want to do?
just define a global variable, or use format ["%1", _vehicle] or something?
because vehicleVarName is not a variable definition

#
private _spawnPos = getPosATL _namePos;
_spawnPos set [2, _staticHeight];
private _vehicleInformation = [_spawnPos, _posDir, nameclass, sideEmpty] call BIS_fnc_spawnVehicle;
private _vehicle = _vehicleInformation select 0;
MySuperVehicle = _vehicle;
_vehicle setVehicleVarName "someName";
#
MySuperVehicle setDamage 1; // will work
someName setDamage 1; // does not exist
lean anchor
#

im trying to create a turret when opfor walks into an area and delete and replace it with a blufor turret after they walkout of that area.

my current thinking, and it kinda worked but i need to make it more reliable, is to have trigger that fires a fnc that spawns a turret at all invisble helipads that a synced with the trigger. in that trigger i am passing a classname of the turret and

posary = synchronizedObjects ThisTrigger;

to the function.

in that function it deletes any current turrets THEN replaces them with ones named the same. this means i can just delete and replace it with a new turret named the same, ETC

#

i hope that makes some sense

#

@winter rose ignore the spawn vehicle and all its params. they work. i simply can not name it what i want/give it a reference that i want, then delete it later from that same name/reference

winter rose
#

aaah, problem simplification, I like that

MySuperVehicle = _vehicle; // works
#

then deleteVehicle MySuperVehicle will work, and you can recreate another one with such name

lean anchor
#

that is with your code above or mine? im just checking so i dont confused myself

winter rose
#

mine

#

your code```sqf
(_veh select 0) setVehicleVarName _staticname; // sets vehicle var name, does not declare a variable
_staticname = (_veh select 0); // assigns the object to _staticname

// solution with your code:
MySuperVehicle = _veh select 0;

bold mica
#

is there a way for the respawn module to respawn a specific version of said vehicle? like a light grey version of the AC130

exotic flax
bold mica
#

The thing already has preset textures tho...

exotic flax
#

The post explains step by step how to customize vehicles in the respawn template, and has the link to do the same for textures.
Can't think of a better link/source than that 🤷‍♂️

bold mica
#

To me it looks like setting custom textures, instead of changing preset textures like in the virtual garage either I'm dumb or I'm not getting it

lean anchor
#

thanks Lou, can you just confirm that i have this right, im fairly sure i understood everything just there

    _namepos = posary select _c; // this is a loop, each element of posary is a helipad (object) and where _c is the counter
    _staticname = [str _namepos,_c];   
    _staticname = _staticname joinString "_"; 
    _posdir = direction  _namepos;
    _staticheight = getPosATL _namepos select 2;  
    _staticheight = _staticheight +0.4;          
    _veh = [[getPosATL _namepos select 0 , getPosATL _namepos select 1 , _staticheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
    _tempveh = _veh select 0;
    _tempveh setVehicleVarName _staticname;


#

pretending posary is a single helipad with the name of test.

this should produce a vehicle of "nameclass" type at the helipads location 0.4 m up with the name of test_0?

#

nope, im wrong

#

wait

#

mi think i have it

winter rose
#

I recommend you name your variables for you to get what they are on the first look 🙂

lean anchor
#

yeah i really should, im not great at that

#

see thats the issue, for sure ill do this
private _unit = player;
but it doesnt say why this is worse;
_unit = player;

#

(i do know why for the most part, the whole keeping your variables seprate to others incase of naming schemes crossing over or if your change it in the wrong locality by accident)

winter rose
#

if you call your code/function from another one, if this upper-scope code has a _unit variable, it will be overridden:

#
private _a = 0;
call { _a = 1 };
_a // 1
``````sqf
private _a = 0;
call { private _a = 1 };
_a // 0
#

that's the main, if not the only reason

lean anchor
#

yeah ok, i should rubber duck more. it just hurts my stupiditiy sometimes

#

i only need to define it as private once or until i want it as something other than private?

#

just checking

#

and thanks

winter rose
lean anchor
#

sick

winter rose
#

you cannot private later without overriding:```sqf
_a = [5];
private _a; // throws error
private _a = [6]; // previous _a cannot be accessed, only this one now (if in the same scope)

lean anchor
#

yeah i think it was today that i was on tha toage haha

#

im confused, in your above code. what is MySuperVehicle?

winter rose
#

a global variable

#

anything not starting with an underscore _ is a global variable

private _abc = player; // local
_abc = player; // local
abc = player; // global

setDir = player; // error, reserved keyword (setDir command)
lean anchor
#

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

#

THANK YOU

#

i was literally about to ask

#

ive been wondering for ages

winter rose
lean anchor
#

i have definitely been looking for an explaintion but ive been learning alot and the way you said it just kinda made it make sense

winter rose
#

well, glad I helped then 🙂

bold mica
#

@winter rose I don't know how the rip the .paa file for the plane

winter rose
#

no need to rip anything?

bold mica
#

Or get

#

Use

winter rose
#

well, place a grey plane and use getObjectTextures on it? it should list them

bold mica
#

uh

#

In zeus?

winter rose
#

Eden

bold mica
#

Oh

#

I'll try it tomorrow

#

I'm tired

winter rose
#

good reflex! and good night

lean anchor
#

so this is now the sequel to my last question. Im now trying to delete the vehicle i created but it isnt the scope of the script im using. how do i get it into the scope. This is my current thinking

    private _helipadinuse = posary select _c2;   // gets the current helipad stored in posary that is in use
    private _staticnametobe = [str _helipadinuse,_c2];  // makes an array of the name of the helipad that is inuse in string and of the current loop coutner
    _staticnametobe = _staticnametobe joinString "_"; // joins the array into one string name
    veh = missionNamespace getVariable [_staticnametobe,objnull]; // gets the object from the missionnamespace and returns it into the script as a global variable
    deleteVehicle veh; // deletes the obj?
winter rose
#

yes

#

veh could even be a local variable! (_veh)

#
private _staticNameToBe = format ["%1_%2", _helipadInUse, _c2];
```and don't forget to properly case your varnames 😉
#

(for readability!)

lean anchor
#

so

private _staticNameToBe = format ["%1_%2", _helipadInUse, _c2];

=

  private _staticnametobe = [str _helipadinuse,_c2];  
    _staticnametobe = _staticnametobe joinString "_"; 

#

but better

winter rose
#

yep

#

(easier) better faster stronger

lean anchor
#

yeah much easier i like that

winter rose
#

and since you will not want MySuperVehicle as variable, you will need (on creation) to use```sqf
missionNamespace setVariable [_varName, _vehicle];

lean anchor
#

so this is my final creation script i think

#
    private _helipadinuse = posary select _c;
    private _staticNameToBe = format ["%1_%2", _helipadInUse, _c]; 
    private _posdir = direction  _helipadinuse;
    private _staticspawnheight = getPosATL _helipadinuse select 2;  
    _staticspawnheight = _staticspawnheight +0.4;          
    _veh = [[getPosATL _helipadinuse select 0 , getPosATL _helipadinuse select 1 , _staticspawnheight], _posdir, nameclass, sideEmpty] call bis_fnc_spawnvehicle;
    missionNamespace setVariable [_staticNameToBe, _veh];
    staticnametobe = _veh select 0;

#

then i can delete that vehicle with

        private _helipadinuse = posary select _c2;  
    private _staticNameToBe = format ["%1_%2", _helipadInUse, _c2];
    veh = missionNamespace getVariable [_staticnametobe,objnull];
    deleteVehicle veh;
winter rose
#

I might soon be off for the nie though 😄 don't worry if I don't answer at one point, I might have passed out then 😸

lean anchor
#

for sure! i first tried this script about 5 months ago when i was starting to make a mission, now my mission is done im coming back to make it better

#

and thanks!

winter rose
#

minus last line for the first script
and private _veh for the second script

lean anchor
#

does this only work once? i have both of these statements in foreach loops

#

nope i just had a counter in the wrong stop

#

thank you Lou!!!!

cerulean cloak
#

I'm having a bit of issue with making a hold action. I'm wanting the condition to be within 10m and having a NATO UAV Terminal I've got this
"(_this distance _target < 10) && ([_caller, "B_Uav_Terminal"] call BIS_fnc_hasItem)"
but it's returning an error about a missing square bracket. Any advice?

robust hollow
#

use single quotes inside the main string 'B_UAV_Terminal'

sour tapir
#

Hey i'm having trouble getting ppEffects to 'fade away' and return to normal screen. I can have the effect fade in with; ```sqf
PP_colorC ppEffectEnable true;
PP_colorC ppEffectAdjust [0.1,1,0,[0,0,0,0],[1,1,1,1],[0.33,0.33,0.33,0],[0.35,0.45,0,0,0,0,4]];
PP_colorC ppEffectCommit 0.50;
PP_dynamic = ppEffectCreate ["DynamicBlur",500];
PP_dynamic ppEffectEnable true;
PP_dynamic ppEffectAdjust [1];
PP_dynamic ppEffectCommit 0.50;

but I am struggling to get the effect to dissipate, in my head I would try using sleep but it won't work with this, so I tried; ```sqf
PP_dynamic ppEffectAdjust [0]; 
PP_dynamic ppEffectCommit 1; PP_dynamic ppEffectEnable false; PP_colorC ppEffectAdjust [1,1,0,[0,0,0,0],[1,1,1,1],[0.33,0.33,0.33,0],[0,0,0,0,0,0,4]]; 
PP_colorC ppEffectCommit 1; PP_colorC ppEffectEnable false; ppEffectDestroy PP_colorC; ppEffectDestroy PP_dynamic;

This turns the effect off + destroys it but doesn't 'take the time' to fade it out first, after it is destroyed it can be created by the first part again.

#

Didn't write their conditions for being fired but i'm not sure it matters? Although I am executing this in an eventhandler on a player. 2nd part not in main EH, just for experimenting.

robust hollow
#

why wont sleep work?

#

you need to delay ppEffectEnable false and ppEffectDestroy until after the effects have committed. a 1 second sleep would work, or in my test i used waituntil.

[] spawn {
    PP_colorC ppEffectAdjust [1,1,0,[0,0,0,0],[1,1,1,1],[0.33,0.33,0.33,0],[0,0,0,0,0,0,4]]; 
    PP_colorC ppEffectCommit 1; 
    PP_dynamic ppEffectAdjust [0]; 
    PP_dynamic ppEffectCommit 1; 
    waitUntil {ppEffectCommitted PP_colorC && ppEffectCommitted PP_dynamic};
    PP_colorC ppEffectEnable false; 
    PP_dynamic ppEffectEnable false;
    ppEffectDestroy PP_colorC; 
    ppEffectDestroy PP_dynamic;
};
sour tapir
#

well at least I tried sleep and it wouldn't work, I can't remember why now, I've been awake for quite a while now 😅 I might have missed something

robust hollow
#

if it was a script error then its possible you were testing it in an unscheduled environment. there arent many scenarios where sleep doesnt work but that'll do it.

sour tapir
#

Yeah I was being stupid, still new to how scheduling works. Thanks 🙂

mellow obsidian
#

Hey, is it possible to convert a string of a function "my_fnc_hello" and then call that function?
What i mean is something in the lines of
_stringVar = "my_fnc_hello";
call _stringVar;

robust hollow
#
_stringVar = "my_fnc_hello";
_fnc = missionNamespace getVariable [_stringVar,{}];
call _fnc;```
mellow obsidian
#

Oh that works, never knew missionNamespace could be used for that. Many thanks Connor

robust hollow
#

missionNamespace is where functions/variables are usually saved as it is where most scripts run by default. so that snippet is the same as calling the fnc directly:

call my_fnc_hello```
mellow obsidian
#

Ah cool, I'll keep that in mind

rough heart
#

@mellow obsidian exile does something similar

#

😏

past tiger
#

@still forum sorry, i was just curious to know what people will make with that, i will try to add setObjectScale to my construction system, at least for walls. boundingBoxReal also get updated? Thanks for your answer.

winter rose
#

you know, you can also try and see for yourself 👀

dusty badger
#

Hmm, I need to figure out a way for a trigger to activate as soon as its activation condition returns true, but only deactivate once its activation condition has returned false for 10 seconds

#

Im trying to have a trigger start spawning units as soon as it detects a player inside, but only start deleting units once no player has been detected for 10 seconds or so

#

I have a function written for the evaluation condition, so I guess I just need to wrap it in another condition to handle the timing

little raptor
#

as soon as its activation condition returns true
not possible with triggers. there's always some delay

#

only deactivate once its activation condition has returned false for 10 seconds
very easy. use setVariable

#

start deleting units once no player has been detected for 10 seconds or so
not possible with triggers

#

unless the code is scheduled and runs separately

#

example:

#

activation code:

#
[thisTrigger] spawn {
  params ["_trigger"];
  while {triggerActivated _trigger} do {
    ..//spawn AI
  };
  sleep 10;
  if (!triggerActivated _trigger) then {//delete AI
  }
};

or you could do the sleep 10 and the rest in onDeactivation code, but this way is better

dusty badger
#

found a cba function that should work CBA_fnc_waitUntilAndExecute

#

should be able to use that to return true once the function evaluating activation returns true, and return false a set period of time after the activation function returns false

#

right now I just have the trigger calling the activation evaluation function as its activation condition, in this particular mission its every three seconds

dusty badger
#

yeah I realized that

little raptor
#

and the only difference between that and spawn is that it's unscheduled

#

which could be bad, depending on how CPU intensive your code is

#

the upside is it won't be affected by scheduler load

dusty badger
#

It seems this script uses waitUntil to suspend the script until the trigger is activated, then it runs the code to spawn everything, sets a private variable to true and uses a while loop to constantly check if the trigger is deactivated while the variable is true

#

and then once the trigger has been deactivated it runs the code to delete everything

#

runs in a scheduled environment

#

And once the trigger is deactivated, pretty much schedules the script again and returns to the waituntil

little raptor
#

if you mean CBA_fnc_waitUntilAndExecute

dusty badger
#

Sorry I meant this script that is handling the creation of the triggers and spawning/despawning AI

little raptor
#

which script?!

dusty badger
#

Right now its a variation of the Enemy Occupation System

#

Which is a collection of scripts that handles AI spawning based on markers you place in the editor

#

Basically it executes a core script on every marker from a list, and this core script sets up a couple different triggers on these markers and creates units when they are activated, based on a couple different parameters that are passed to it when it first initializes and from previous trigger deactivations

#

So every trigger has its own scheduled script running that handles the unit creation when it activates and unit deletion when it deactivates

still forum
real tartan
#

any option to mute chat for unconscious players?

#

surprised that it is not by default

sour tapir
#

nvm solved lmao

little raptor
#

currently only in dev build

real tartan
bold mica
#

@winter rose i tried to getobjecttextures command and it kept getting me errors

bold mica
#

uhhhh shoved it in the init

#

lol

winter rose
bold mica
#

uhhhhhhhh so if i go into the virtual garage i get this for the vehicle

[
    _veh,
    ["LightGrey",1], 
    true
] call BIS_fnc_initVehicle;```
#

the get object texture just doesnt wanna work

little raptor
#

are you sure that texture source even exists?

bold mica
#

it works when i use the debug console in the actual game and not eden

#

i dont think it has a .paa texture

vast blade
#

Hey guys! I’m looking for a script or something in arma 3 that lets me hide the hull of a vehicle. For example hiding the hull of a tank while keeping the turret visible for if I wanted too make an in ground turret as an example

little raptor
vast blade
#

A bit of an example as to what I mean is. I was thinking of using the m7a2 Bradley from the cup vehicles mod. Hiding the hull of that vehicle and attaching it too a ugv using both zues and eden

little raptor
#

check if the vehicle supports retexturing: getObjectTextures
if it does, use a hidden texture (e.g. #(rgba,8,8,3)color(0,0,0,0)). otherwise, mod it, as I mentioned before

vast blade
#

Alright. Thank you very much mate!

#

I’m brand new too scripting in arma 3 so far and it seems that the options that scripting has for making new vehicles (compositions) and interesting things is quite large

little raptor
#

It's very unlikely that you'd be able to do it with scripting.
Also I've never worked with compositions, but afaik you can't make dynamic entities with it.

exotic flax
#

You can do a lot with scripted compositions, but you can't modify models on the fly and merge them together...

wild prairie
#

is there a more efficient way to get all items in a vehicle's inventory than

private _items = getItemCargo _box;
private _magazines = getMagazineCargo _box;
private _weapons = getWeaponCargo _box;
private _backpacks = getBackpackCargo _box;

?

little raptor
#

no

brazen lagoon
#

does allowing -filePatching allow you to overwrite core BIS functions?

winter rose
brazen lagoon
#

ty

#

was going to go back and delete that one cuz it's not really relevant to there

#

ill be faster abt the delete next time

quasi sedge
#
ctrlSetText str _killsInfantry + -(_killsInfantry);
#

is that correct code to count teamkills as a kill?

#

ohh abs

#

_ctrlKillsInfantry ctrlSetText str _killsInfantry + abs(_killsInfantry);

hushed tendon
#

Hello. I'm trying to make a unit "flicker" by using hideObject and sleep while also repeating at random intervals.

robust hollow
#

ok... i'll assume you are having some trouble with it, here is an example of that in action:

[] spawn {
    private _duration = time + 5;
    while {time < _duration} do {
        unit hideObject !isObjectHidden unit;
        sleep random 0.25 + 0.1;
    };
    unit hideObject false;
};
oblique arrow
#

Hm, is it posible to use a script to delete one of the vanilla tripwire mines, after it get triggered, but before it explodes?

winter rose
#

deleteVehicle?

oblique arrow
#

but how would I trigger it?

winter rose
oblique arrow
#

true, I'll have to play around a bit and watch what it does when it gets triggered

still forum
still forum
brazen lagoon
#

@still forum ok! I read online that editing system BIS functions isn't possible anymore, is that true?

still forum
#

No

#

ACE mod does it too.
And Zeus Enhanced

oblique arrow
brazen lagoon
#

and as a followup, would editing BIS_fnc_spawn change how every spawn keyword call works?

still forum
#

It should afaik not be possible. It has code to protect it against that, but I found out they just don't work a while ago

#

No. Script functions have no relations to script commands

brazen lagoon
#

gotcha. I looked at the functions page and 'spawn' showed up and I thought it was the same. I assume there's no way to override script commands short of modifying the executable?

#

or like, working at bohemia? 😛

still forum
#

Intercept can do it. But you need a certificate from Intercept makers to enable that "feature"

brazen lagoon
#

ah. Which means I'd have to get in contact with bohemia to get a cert?

still forum
#

It's blocked off because security and humans safety

brazen lagoon
#

yeah it makes total sense why

still forum
#

No. Just the Intercept mod makers

#

It's a open source mod

brazen lagoon
#

oh ok. So if I talk to the intercept guys, I could build an addon that, say, modifies how spawn works to run scripts in a thread pool?

still forum
#

Yeees.... But Arma would crash as scripts cannot run multithreaded

brazen lagoon
#

like, there's too much communication between scripts or?

still forum
#

Not really. Complicated stuffz

#

If you know c++, you can maybe roll your own solution though.
You cannot run scripts in parallel, but maybe you can rewrite your script in c++, and that code can run in seperaten thread then

brazen lagoon
#

oh, this is why the concept of a headless client even exists isn't it

#

because the easiest way to run multiple scripts at the same time is to just run multiple copies of the game

still forum
#

I guess so yeah.

#

Mainly it was built for AI I think, not scripts. But it does the same for scripts too

brazen lagoon
#

yeah, I was looking at the docs for HCs and there's nothing saying you can't run scripts on HCs

still forum
#

Yeah you can do that. Big scripted servers like Life stuff do that

winter rose
#

If you know c++, you can maybe roll your own solution though.
so I take that Dedmen doesn't know C++ 😬 😁

#

I wonder what kind of perf++ could be expected if multithreading were applied to Arma

#

I mean, using moar cores etc

brazen lagoon
#

from what I can tell (obv. not an expert and don't work at bohemia so haven't seen the actual code) the performance issues in A3 generally are 1. scripts 2. AI 3. object count in that order

still forum
#

About 10-15% for average script load (CBA+ace)

#

Scripts is a relatively small part of frametime

winter rose
#

FSM?

still forum
#

If you look at the whole picture.

winter rose
#

wasn't AI a big part of it?

brazen lagoon
#

interesting. Maybe I'm going down the wrong rabbithole, I should probably take a look at that frametime capture stuff in the debug build and see what's actually killing my frames in my missions

still forum
#

Yeah.

Yes do that!

brazen lagoon
#

that's why HCs make such a huge difference for server performance right

#

bc they help offload AI from the main thread

winter rose
#

so FSM does not run in scheduler, but if I understood it well, they are always on the same core? why not more?

still forum
#

There are some pretty bad bugs I've seen lately. AI units out of map, physx blobs at 0,0,0 coords are the most common big time issues I encounter

#

FSM runs in scheduler too

#

Well, right next to the scheduler, they are handled in the same place

#

You cannot run anything script on more than one thread, because they all use some shared stuff

brazen lagoon
#

iirc the script parts of FSM run in the scheduler right?

#

but the decision logic runs separately? is that correct?

still forum
#

The scheduler has 3 seperate parts.
SQS, SQF, FSM

winter rose
still forum
#

It also depends on what specific FSM.
They can function differently depending on where they are used

#

execFSM runs in scheduler

#

Actually multithreaded script should be possible on Linux, but I never actually tried it out

brazen lagoon
#

@winter rose yeah that makes sense honestly, lots of engines as old as RV have the problem of being written in a time when multicore processors just didn't exist at the consumer level

still forum
#

And it's on my list to fix the reason for that, as it hurts performance on linux

willow hound
#

"You can not modify this object's position as it is currently being used in another script"

brazen lagoon
#

so they made a lot of decisions that assumed one core and now that a 4 core CPU is the minimum standard for gaming it's a problem

winter rose
brazen lagoon
#

lmao

still forum
#

Lol

#

More like 20% tops

winter rose
#

lemme dream
what are the other funnels?

still forum
#

And I still have 5-10% stuff laying around for next year

brazen lagoon
#

20% is still a lot

winter rose
#

yyyes, I am not refusing that for sure! 😄

brazen lagoon
#

@still forum ok now here's a real crazy person idea: what if you made an addon that spawned HCs and then overrode spawn to remoteExec stuff on them, round-robin?

#

I mean this is ofc assuming that scripts are actually the problem and not something in the graphics/rendering pipeline or AI or something but

still forum
#

You cannot in general override spawn

#

Locality is a thing, and you need to have some things run locally

brazen lagoon
#

oh true!

#

yeah short of figuring out every change that some script makes and then also doing those side effects locally that's not gonna work

still forum
#

You can create a new command with intercept.
And name it spawnAnywhere and let it be handled by a remoteExec to a random HC

brazen lagoon
#

right

still forum
#

Intercept let's you create your own script commands. And call your own c++ code directly from SQF and the other way around.

brazen lagoon
#

yeah I looked at their repo briefly, it's super cool

still forum
#

The new Hashmap stuff I just did. I already built years ago in Intercept as a experiment

brazen lagoon
#

nice

still forum
#

See Intercept_CBA as example.
I think the Hashmap code is also there

bold mica
#

@winter rose I figured out why none of the stuff worked, USAF does something every different for textures and it's weird

winter rose
#

ah well, yeps

bold mica
#

[(_this # 0),["Base_Black",1],true] call BIS_fnc_initVehicle;

#

^ that was my final product

oblique arrow
# still forum Oof.. I think trigger=explo? No?

Ooh I have an idea, just emulate the mine by having a simple object tripwire mine and a trigger that activates when the mine exists and a person enters the area
then on activation I can delete the mine and do my own stuff

still forum
#

You can configure trigger check interval, might want to turn that lower to have it check not often for small trigger area

brazen lagoon
#

@still forum how do the numbers on the profiler mean? Like it'll say something like gsEva (6.178ms : 2.473 ms)

#

what are those two numbers?

noble tiger
#

Trying to get Virtual Garage to work on a dedicated server so the player can spawn in a Vehicle without having to place them in the Editor or Via Zeus, Problem i'm having with the code provided on BI Wiki is only allowing the client to see the Vehicle & not the other players in the server!

Dose anyone have a line of code that works?

robust hollow
#

it looks like itl take more than a line. the virtual garage isnt designed for mp use. the easiest way is probably to use the garageClosed scripted event handler to recreate the selected vehicle.

brazen lagoon
#

this seems odd, where does 75ms just disappear to?

#

hmm my screencap isnt working

still forum
brazen lagoon
#

yeah that makes sense

#

it's going from frame time 1.973ms for an fsACh call to 77.946ms for an evGet call

#

thats really odd, there's just nothing in between - does that mean it's stuff that's happening in the main call?

still forum
#

Sure you don't see the in-between stuffym

#

?

#

Look in the graph on top of the UI and just click on the things, and find the thing in-between.. except if there is an empty gap :u

noble tiger
serene quiver
#

Howdy folks....

I found this piece of code that checks if there's a LOS with the informer...

if ( [player, "VIEW"] checkVisibility [eyepos player, eyepos informer] > 0) then {  
hint "bla-bla-bla"; 
}```
wich works. What I'm trying to do is this. 
1)-An undercover player is following the *informer* but has to keep a line of sight on it.It can lose it for no less than 10 seconds, or mission will fail.
2)-The *informer* will get in a vehicle and drive away; the player has to use a drone to follow the dude to a house. Once there, a Task will be complete, but I want it to be fulfilled ONLY if the drone camera has LOS with the house/informer/anyobject.
How to do that?
still forum
#

You can assume drone pos == camera pos

#

When the play... Mh

#

Yes you want to use a different check while the player is in drone view and check from drone to target

#

But, that might not take camera direction and FOV into account correctly?

serene quiver
#

Ive try to play around with "CameraOn" but I got lost...

#

The idea is that if the drone camera is looking a certain object, it fire a script..

#

from there I'll take care of the task state and other things..

still forum
#

Does camera on return the drone? Never tried that

winter rose
#

it should yes

still forum
#

If you want to check where the camera is looking you could try
cursorObject
screenToWorld [0.5, 0.5]
getCameraViewDirection (gets the direction vector)

#

If cursorObject works, that's probably the easiest.
If cursorObject == house

#

If you want to check if object is on camera screen.
worldToScreen
Will return something special if object is off screen I think.

#

Should save you complex maths with direction and FOV

#

Or rather let's it do the math for you

quasi sedge
#
    if (_newVeh isKindOf "Plane") then {
    _newVeh setDamage 0;
    } else {
    _newVeh setDamage 0.7;
    };

Where the hell ; missing here?

serene quiver
still forum
quasi sedge
#

i want tanks to explode, not their crew ejecting

still forum
#

I don't see missing semicol.
Maybe above or below the code you posted?

#

Missing semicolon can also be a typo in a script command name

quasi sedge
#
   
  isNil {   
    private _newVeh =  createVehicle [_type, [0,0,0], [], 0, _respMode];
    
    if (_newVeh isKindOf "Plane") then {
    _newVeh setDamage 0;
    } else {
    _newVeh setDamage 0.7;
    };
    
    _newVeh allowDamage false;   
     private _autonomous = (getText (configFile >> 'cfgVehicles' >> typeOf _destroyed >> 'vehicleClass') == 'Autonomous');   
   
    if (!((_pos nearEntities [['landVehicle','air','CAManBase','ReammoBox_F'],(0 boundingBoxReal _newVeh) #2 /2]) isEqualTo []) && !surfaceIsWater _pos) then {   
      _pos = [_pos,0,100,(0 boundingBoxReal _newVeh) #2,1,0,0,[],[_pos,_pos]] call BIS_fnc_findSafePos;   
      _pos set [2,0.1];   
    };   
    _newVeh setDir _dir;   
    _newVeh setPosASL _pos;   
    _newVeh lock (locked _destroyed);   
    if !(_varName isEqualTo '') then {   
      [_newVeh,_varname] remoteExec ['setVehicleVarName',0,true];   
      missionNameSpace setVariable [_varName, _newVeh, true];   
    };   
    [_newVeh,_destroyed] call MGI_fnc_setVehicleLoadout; 
   ...
#

if i just leave _newVeh setDamage 0.7; all works

#

but my a-10 and su-25 insta eject

#

heli's fine tho

still forum
#

Hm. I don't see a problem slant

#

Maybe some invisible character copy-pasted in? Unlikely

queen cargo
#

could you PN me the whole file @quasi sedge

serene quiver
#

most important is the "fail mission" if player lose LOS for more than 10 sec..

still forum
#

Follow informer is maybe doable with worldToScreen

#

worldToScreen eyePos informer

Check what it returns when you look at him, vs when you look away

quasi sedge
#

This code working

  isNil {    
    private _newVeh =  createVehicle [_type, [0,0,0], [], 0, _respMode]; 
    _newVeh setDamage 0.7; 
    _newVeh allowDamage false;    
     private _autonomous = (getText (configFile >> 'cfgVehicles' >> typeOf _destroyed >> 'vehicleClass') == 'Autonomous');

This don't

  isNil {    
    private _newVeh =  createVehicle [_type, [0,0,0], [], 0, _respMode]; 
    if (_newVeh isKindOf "Plane") then {
    _newVeh setDamage 0;
    } else {
    _newVeh setDamage 0.7;
    };
    _newVeh allowDamage false;    
     private _autonomous = (getText (configFile >> 'cfgVehicles' >> typeOf _destroyed >> 'vehicleClass') == 'Autonomous');
#

I paste this code to trigger "On activation" BTW

serene quiver
robust hollow
# noble tiger Yeah I have tried a few scripts using creating .sqf files in the mission file an...

this isnt perfect but it is a start to what you need. run it somewhere in a player's init.

[missionNamespace,"garageClosed",{
    private _localVehicle = bis_fnc_garage_center;
    if (netid _localVehicle != "0:0") exitwith {};

    private _class = typeOf _localVehicle;
    private _position = getPos _localVehicle;
    private _vector = [vectorDir _localVehicle,vectorUp _localVehicle];
    private _customization = [_localVehicle] call BIS_fnc_getVehicleCustomization;

    deleteVehicle _localVehicle;

    private _globalVehicle = createVehicle [_class,_position,[],0,"CAN_COLLIDE"];
    _globalVehicle setVectorDirAndUp _vector;
    [_globalVehicle,_customization#0,_customization#1] call BIS_fnc_initVehicle;

    bis_fnc_garage_center = _globalVehicle;
}] call BIS_fnc_addScriptedEventHandler;
still forum
serene quiver
still forum
#

Oof

#

Maybe it doesn't respect the camera right.... But it should

serene quiver
#

Thank you anyway..it seam more complex than I thought....don't even know if is worthed..

#

And Is late at night here..so I better come back at this with a fresh brain tomorrow..lol

brazen lagoon
#

yeah looks like ive got a big performance issue with my custom HUD but I have no idea how to make it run well

#

something about preloading rsc but I genuinely don't understand the way controls/displays work in arma at all

still forum
#

I'd ask for more info but I sleep nau

brazen lagoon
#

dwbi, was just going to ask if anyone had an example mission with a custom HUD that was easy to understand

#

peace out dedmen!

exotic flax
#

If you use configs, they are already loaded and only need scripts to display.
If the HUD is fully scripted the problem is most likely in the scripts themselves, and for that it would help to see what you're trying to do

brazen lagoon
#

ctrl is made this way

#
    private _ctrl = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
    _ctrl ctrlSetPosition [0.103165 * safezoneW + safezoneX, 0.007996 * safezoneH + safezoneY, 0.778208 * safezoneW, 0.0660106 * safezoneH];
    _ctrl ctrlSetBackgroundColor [0, 0, 0, 0];
    _ctrl ctrlCommit 0;
    _ctrl ctrlSetStructuredText parseText "";```
#

which is passed in along with player to this script: ```SQF
if (!hasInterface) exitWith {};
private ["_textX","_display","_setText"];
disableSerialization;
_player = _this select 0;
_ctrl = _this select 1;

while {alive _player} do {
private _text = format [
"<t align='center' valign='middle' size='1' shadow='2'>" + "VISIBILITY: %1 | UNDERCOVER: %2</t>",
_player getUnitTrait "camouflageCoef",
captive _player
];
_ctrl ctrlSetStructuredText parseText format ["%1", _text];
sleep 1;
};

_ctrl ctrlSetStructuredText parseText "";
ctrlDelete _ctrl;```

#

(there's a bunch of unused variables and such, need to go through and clean it up once I get it actually working)

robust hollow
#

aside from format ["%1", _text] which is completely pointless, that doesnt look heavy at all.

#

what makes you think it is a ui issue?

brazen lagoon
#

yeah it needs a lot of cleanup

#

honestly I'm not sure, but just going off the profiler that's what it seemed to be

#

let me do some cleanup and test it again on my server

exotic flax
#

In the above code I also don't see anything which could cause issues.
Of course, looping code every second can cause issues when it's a lot or written badly, but that doesn't seem to be the case.

robust hollow
#

maybe try dedmen's arma script profiler (if it works on 2.00?). ive found it very helpful to determine which specific scripts and commands are going slow.

brazen lagoon
#

thats what im doing yeah

#

gsEva; 0.74347; 76.42487;"["onUnload",_this,"RscDisplayMPInterrupt"

#

this has to be a bug in timing right? because if you do 1/0.074 that would imply the game is running at 13.5 FPS

robust hollow
#

🤷

#

is that dedmen's profiler or the arma one?

noble tiger
robust hollow
#

yes. the virtual garage spawns vehicles locally (only exists for you) but that code takes the vehicle info when you exit the garage and recreates it as a global vehicle (exists for everyone)

#

like i say, it isnt perfect, but it might be enough for what you need it to do.

noble tiger
#

so i need that to every character i want to be able to spawn a vehicle

robust hollow
#

yea, but you should only need to put it in one place. initPlayerLocal.sqf for example.

noble tiger
#

ah ok

#

thanks man

brazen lagoon
#

@robust hollow oh ive never seen this one before thanks!

languid oyster
#

Hey guys! I got to find a safe position, which works fine with this:

_safePos = [_obj, 0, getpos _obj select 2, 7, 0, 20, 0] call BIS_fnc_findSafePos;

My only problem: The found safe position is often near the sore. (Position is searched from 150m above water). Is there a way to have the safe position a minDist away from the shore line?

robust hollow
#

if hardcoding is an option then you can add the shore line area as a blacklisted position

#

blacklistPos argument

languid oyster
#

What is hardcoding? But I will have a look. Thank you.

robust hollow
#

writing something into the script that is only good for a specific use case, in this case, coordinates.

#

or... one of the other types that argument accepts.

languid oyster
#

Ah, thank you for clarification

leaden summit
#

Ok so I use the classic onPlayerKilled.sqfSQF player setVariable ["Saved_Loadout",getUnitLoadout player];
And onPlayRespawn.sqfSQF player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
And for some strange reason the players respawn will all their gear BUT the rifle. Any ideas? We're using RHS weapons, and the players can respawn in a vehicle or back at base and have the same issue

robust hollow
#

players drop their gun when they die.

leaden summit
#

That's what I thought but I've never had an issue with it before this mission. Would it be the ACE ragdolling?

little raptor
#

does anyone know if it's possible to launch the utils dialog without the utils command? Like is there a function or something?

cosmic lichen
#

yes

#

gimme a sec leopard

#

[] execVM 'A3\Functions_F\Debug\Utilities\utility_moonPhases.sqf'
[] execVM 'A3\Functions_F\Debug\Utilities\utility_jukebox.sqf'
[] execVM 'A3\Functions_F\Debug\Utilities\utility_printConfig.sqf'
[] execVM 'A3\Functions_F\Debug\Utilities\utility_cfgDisabledCommands.sqf'
[] execVM 'A3\Functions_F\Debug\Utilities\utility_scriptCommands.sqf'

little raptor
#

thanks! 🙂

cosmic lichen
#

yw

little raptor
#

btw, if I want to launch the main utils window, which file do I execute?

#

is it index.sqf?

#

or header.sqf

cosmic lichen
#

good question-

#

Let me check

#

a3\missions_f_oldman\systems\scripts\utility.sqf

#

this should work 🙂

#

oh wait no

little raptor
#

I think it's index.sqf

cosmic lichen
#

yeah I guess

#

index.sqf

little raptor
#

based on its contents

#

let me check

cosmic lichen
#

yes

#

it creates a few buttons

#

and assigns actions to them

little raptor
#

yeah, thanks

[] execVM 'A3\Functions_F\Debug\Utilities\lib\index.sqf'
#

this worked

ornate fern
#

hi everyone. I need advice...again.
In a mission, I want a speaker with an addaction to play a sound. I used this command

speaker2 addAction [ "Play message", {
speaker2 say3D ["hades", 50, 1];
} ];

problem is that every single player had to activate the addaction. Which command I use so that if one player activate the addaction, every player hears the sound...thanks for help.

#

I figured out that I need to execute the addaction in mp to every client. I just need help how I type the command in the init of the speaker, the sound source. In the inet I found this command:

#

Say3dMP = { _speaker = _this select 0; _sound = _this select 1; //if (isDedicated) exitWith {}; //if ((player distance _speaker) > 100) exitWith {}; //you probably don't need this, not sure _speaker say3d _sound; };

#

Do I just write this in the init? Or do I need to change some words? The distance in meter for example...

little raptor
#
speaker2 addAction [ "Play message", {
  params ["_speaker"];
  [_speaker, ["hades", 50, 1]] remoteExec ["say3D"]
} ];
little raptor
#

Does anyone know how to open the function viewer?! (function / script name)

#

nvm, found it

#

BIS_fnc_help

ornate fern
#

@little raptor Tanks. I will try it

still forum
# brazen lagoon thats what im doing yeah

My profiler doesn't give you these numbers, so don't think you're using mine.
If it doesn't work in 2.00, there is a new DLL in the discord for it. It's probably linked on the steam page?

fervent kettle
#

Is it possible to store, lets say NVGs in an array, and then delete one of them? tried that one so far:

private _removableStuffArray = ["rhs_1PN138", "rhsusf_ANPVS_14", "rhsusf_ANPVS_15"];

_items = items player;

while{true}do{

if ("_removableStuffArray" in _items) then {player unlinkItem  "_removableStuffArray";};
};
still forum
fervent kettle
#

hears whip getting slacked in the distance

still forum
#

Do you want all items in inventory? Or is item in NVG slot enough?

fervent kettle
#

I want to remove NVGs, Radios and GPS

#

the script should check if the player has one of those items and then removes it if its true

still forum
#

Doesn't answer my question.
Do you need to check in-inventory ones too? In addition to the one in the specific slots for them

fervent kettle
#

I think in slot should be enough, the peeps arent that smart^^

still forum
#

{
If (_x in _removableStuff) then {
Unlinkitem
}

}
forEach assignedItems player;

#

And add a sleep to your while loop.
However much you can tolerate

fervent kettle
#

Yea, wanted to do that as a last step. For testing I like it to hard-loop

#

_x represents the selected item from an array, right? So it doesnt need to be modified

fervent kettle
#

It just keeps dropping me _x is an undefined variable

little raptor
#

post your code

fervent kettle
#
private _removableStuff = ["rhs_1PN138", "rhsusf_ANPVS_14", "rhsusf_ANPVS_15"];

while{true}do{

If (_x in _removableStuff) then {
Unlinkitem
}forEach assignedItems player;
};
#

I feel like someone`s gonna kill me for that code xD

little raptor
#
private _removableStuff = ["rhs_1PN138", "rhsusf_ANPVS_14", "rhsusf_ANPVS_15"];

while {true} do {
  {
    If (_x in _removableStuff) then {
      player unlinkItem _x 
    };
  }forEach assignedItems player;
  sleep 0.1;
};
fervent kettle
#

Ah ok, so the if line itself has to be in curly brackets too

winter rose
#

sleep 0.1 at least

fervent kettle
#

I know, dont worry bout the sleep^^

winter rose
#

and a missing } as well
let's indent what you sent```sqf

while { true } do
{
if (_x in _removableStuff) then
{
unlinkitem
} forEach assignedItems player;
};

fervent kettle
#

aah, I see

winter rose
#

forEach takes a {}, not an if () then {}

fervent kettle
#

so with the {} around the code before the forEach I declare that the forEach takes that part of the code

little raptor
winter rose
little raptor
#

yeah. not useful for beginners

winter rose
fervent kettle
#

Okay

#

Is there an OOP tutorial on the Wiki or somewhere on the web? Cause I couldnt find any up-to-date ones

little raptor
#

why oop?

#

sqf is not oop

fervent kettle
winter rose
#

SQF is not OOP, the above is an abominable attempt to make it so - do not, I repeat do NOT engage the target with that

fervent kettle
#

ah, alright

brave jungle
#

What am I doing wrong here? (I'll shorten it all for ease, there are no undefined variables, just the LB doesn't get populated:

_VTT_Basic_Settings_Display = findDisplay VTT_Basic_Settings; //#defined as the IDD of the display
_ctrl_Players_Side_Combo = _VTT_Basic_Settings_Display displayCtrl 2100;
{ _ctrl_Players_Side_Combo lbAdd str _x } forEach _sides; //doesn't do this, no error.
```I am in the middle of switching from createDialog to createDisplay so perhaps my display just cant be found?
#

I personally don't see any problems with getting the control, but I am most likely missing something

#

#define VTT_Basic_Settings 348567

little raptor
#

yeah saw that

brave jungle
#

Thats the problem right?

little raptor
#

no

winter rose
#

if isNull _VTT_Basic_Settings_Display exitWith ?

little raptor
#

did you try a systemChat or something to make sure it exists?

brave jungle
#

I'll try it ye didn't actually think to check if it existed.

#

😅

#

two secs

winter rose
#

grrrr 👀

brave jungle
#

No error msg

#

if (isNull _VTT_Basic_Settings_Display) exitWith {systemChat "can't find display."};

winter rose
#

_ctrl_Players_Side_Combo ?

little raptor
#

check all of them:

systemChat str [_VTT_Basic_Settings_Display , _ctrl_Players_Side_Combo ,_sides]
brave jungle
#

Also second thought, could I just assign the variable on the first line here:

findDisplay 313 createDisplay "VKN_Template_Tool_Basic_Settings";
_VTT_Basic_Settings_Display = findDisplay VTT_Basic_Settings;
#

im doing the same thing on the second line right

winter rose
#

check your variables to see if you are using values or ghosts yeah 😄

brave jungle
#

I got the bunch of numbers [int, int, [sides]]
Int is just a bunch of unrelated numbers.

#

but nothing is empty

#

so they exist

#

scr shot??

little raptor
#

what is that?

#

it doesn't look like a display/control to me

brave jungle
#

I have no idea

#

thats the output

little raptor
#

usually it should be display#1 or control#1

#

replace #1 with the IDD/IDC

brave jungle
#

Great

#

Well I dunno why is giving me this

#

strange

little raptor
#

what does this give you?

systemChat str findDisplay 0;
brave jungle
#

display 0 as intended

little raptor
#

oh I think I got it

#

your IDD is probably too big

#

try a smaller number

#

maybe that's the issue

brave jungle
#

oh really? Yeah i'll give it a test two seconds.

#

is 4 char too long?

#

say 3481

little raptor
#

no, I've tried up to 5 digits. not sure about the rest

brave jungle
#

👍

little raptor
#

it returns the display. you don't have to "find" it

brave jungle
#

Yeha I thought so

#

Returns the same

#

those weird numbers

#

with the switch as well

#

But this time

#

the lb gets populated

#

Im so confused AwkwardKid

little raptor
#

which one?

#

after updating the IDD?

brave jungle
#
_VTT_Basic_Settings_Display = findDisplay 313 createDisplay "VKN_Template_Tool_Basic_Settings";

if (isNull _VTT_Basic_Settings_Display) exitWith {systemChat "can't find display."};

_sides = [West, East, Independent];

_ctrl_Players_Side_Combo = _VTT_Basic_Settings_Display displayCtrl 2100;

{ _ctrl_Players_Side_Combo lbAdd str _x } forEach _sides;
#

and changed IDDs yes

#

so it was likely they're too long then

little raptor
#

well if you did both there's no way to tell

#

_VTT_Basic_Settings_Display = findDisplay 313 createDisplay "VKN_Template_Tool_Basic_Settings";
this just returns the display. even if the IDD was really big it wouldn't matter

brave jungle
#

My guess is the idd because there was never than a msg to say it wasn't found (line 2 above)

#

but thanks bud didn't know there was a cap

little raptor
#

there's no cap (at least not that small), it just gets rounded due to floating point accuracy

brave jungle
#

Oh right

still forum
#

I think float limit is somewhere around 5-6 digits?

little raptor
brazen lagoon
#

@still forum I will check out your profiler and report back if I still get performance issues, thanks so much for your help!

umbral nimbus
#

I have been scripting for almost 15 years now in OFP/Arma and somehow this simple thing I have never ran into:

#

INIT.SQF

#

if (!DC3_arived) then { {_x moveInCargo DC3} foreach (units playergroup);};

#

INITSERVER.SQF
DC3_arived = false; publicVariable "DC3_arived";

#

Why do the units from playergroup not move in the cargo of DC3 on a dedicated server?

#

works in SP (but that doesnt say much)

brave jungle
#

init.sqf runs once, perhaps clients that haven't connected yet dont get applied it?

#

maybe try in the initPlayerLocal.sqf

brave jungle
#

oh... well you learn soemthing new everyday

#

mission event scripts are boring anyway, addons are where the fun is at

#

😄

winter rose
brave jungle
#

AwkwardKid
oh no

winter rose
#

you will be now cursed with a Curious addRating -(rating Curious + 10000) è_é

brave jungle
#

haha but now i got your attention, I need help... 😄

#

_side = toUpper (_ctrl_Players_Side_Combo lbText lbCurSel _ctrl_Players_Side_Combo); I need the text from an lb, but the line doesn't work, I tested its output and it gives the control., but using the same line above to compare with "" works just fine:

waitUntil { _ctrl_Players_Side_Combo lbText lbCurSel _ctrl_Players_Side_Combo != "" }; //this gives me something

  _side = toUpper (_ctrl_Players_Side_Combo lbText lbCurSel _ctrl_Players_Side_Combo); //this gives me the control id: control #2100
winter rose
#
private "_text"; // one of the rare cases a private string is good
waitUntil {
  private _cursorIndex = lbCurSel _ctrl_Players_Side_Combo;
  _text = _ctrl_Players_Side_Combo lbText _cursorIndex;
  _text != ""
};

private _side = toUpper _text; // toUpperANSI?
brave jungle
#

so can I not have it on the same line?

#

because I do a similar thing 4 times

winter rose
#

you can, but it's cleaner and more readable this way
lbText returns String, so I don't see how you get a control

brave jungle
#

I did symcht str _ctrl_Players_Side_Combo lbText lbCurSel _ctrl_Players_Side_Combo short cuz lazy

#

my guess is that it only did the variable

winter rose
#

yeah well, use ()

brave jungle
#

Yeah there ya go

#

didn't think about it when I was testing it 😄

winter rose
#

otherwise it does```sqf
systemChat (str _ctrl_Players_Side_Combo) lbText lbCurSel _ctrl_Players_Side_Combo

brave jungle
#

Yeah that'll explain why

winter rose
#

hence why temp vars can help in a debug situation 😛

brave jungle
#

Think you've told me that before, it'll get hammered in eventually 😄

winter rose
brave jungle
#

I need to start using private more i've noticed.

#

😄

#

Should I be using it more in a scope inwards rather than the outermost scope?

#

exam 4

_myvar = 123;
systemChat str [_myvar];        // [123]
call {
    systemChat str [_myvar];    // [123]
    private "_myvar";
    systemChat str [_myvar];    // [any]
    _myvar = 345;
    systemChat str [_myvar];    // [345]
};
systemChat str [_myvar];    

Like so?

#

I got it from the wiki

umbral nimbus
#

I have been scripting for almost 15 years now in OFP/Arma and somehow this simple thing I have never ran into:

#

INIT.SQF

if (!DC3_arived) then { {_x moveInCargo DC3} foreach (units playergroup);};

#

INITSERVER.SQF
DC3_arived = false; publicVariable "DC3_arived";

brave jungle
#

Crie you're gonna get told not to copy/paste so quickly

#

and to wait

#

😄 if someone knows they'll help

umbral nimbus
#

ok.I had the idea I was stepped on

brave jungle
#

Well its open to all PES2_Shrug

little raptor
#

how did you define those vars?

#

playergroup

#

DC3

umbral nimbus
#

playergroup is defined in the init of all units of the playergroup

#

plagersgroup = group this

#

DC3 is de name of the aircraft

little raptor
umbral nimbus
#

good point.
since I never did that I think

little raptor
#

also, for safety, do this instead:

if !(missionNamespace getVariable ["DC3_arived", false]) then {
umbral nimbus
#

allright ill try

little raptor
#

not its init

#

also, no need to publicVar DC3_arived in the server init (or even define it)

#

only publicVar it when you change it to true

#

or use setVariable with public flag

umbral nimbus
#

ok

umbral nimbus
#

Or atleast not that I know of

little raptor
#

@umbral nimbus also, moveIn... commands take local arguments

#

you can't use forEach units playergroup

#

unless the other units are AI

umbral nimbus
#

ah damn 😆 thats where I made the mistake

#

hmm...
now to rethink how Im going to do this

#

start in the dc3 instead

#

force eject and setpos

little raptor
#

what?!

umbral nimbus
#

since the arguments must be local

winter rose
#

…you can drag and drop units in the vehicle

umbral nimbus
#

yes I know

#

but starting in the DC3 is conditional

winter rose
#

also, since 15 years, commands have been added: remoteExec for example

little raptor
#

you can just put that single unit in there

#

but you can also remoteExec

umbral nimbus
#

yeah but how is remoteExec going to help

#

in any case the player or the DC3 is not local

winter rose
#

I want to say… wait. stop. hold on.

#

what - do you want - to do?

little raptor
#

not the vehicle

umbral nimbus
winter rose
#

are there respawns?

little raptor
#

why not just put them all in it, then move them out if true?!

umbral nimbus
#

thats what I just said

little raptor
#

I mean put them in your plane in the editor

umbral nimbus
#

yes and then force eject them and setpos if dc3_,arived is false

little raptor
#

ok, so do that

umbral nimbus
winter rose
#

so "everyone should spawn in the vehicle as long as it flies", ok

umbral nimbus
#

right

winter rose
#

initPlayerLocal.sqf

if !(missionNamespace getVariable ["DC3_arived", false]) then
{
  player moveInCargo DC3;
};
```that's it
#

(PS: arrived)

umbral nimbus
#

yeah. other than missionNamespace I tried that

#

(yes also initplayerlocal)

#

so Ill try it this way

winter rose
#

my bet is that DC3_arived = false; publicVariable "DC3_arived"; ran after client init

little raptor
#

yeah, that was my first guess too

#

hence the getVariable

umbral nimbus
#

serverinit goes before playerinit
BUT
init.sqf goes before init.sqf

#

and
ik init.sqs goes before ik init.sqf

winter rose
#

init.sqf goes before init.sqf
it's the other way around, actually 😬

umbral nimbus
#

sqs is first right?

#

no?

winter rose
#

…you wrote sqf twice

austere granite
#

He's just trolling you

winter rose
umbral nimbus
#

Yeah got that in front of me allready

#

never realised init.sqf goes before server

austere granite
#

Just in SP

winter rose
#

then it is written, init.sqs before init.sqf

umbral nimbus
winter rose
#

I edited the page so it does not say "all" but "Multiplayer" where needed

umbral nimbus
#

Well thank you for being my

#

😂👌

dusty badger
#

Anyone happen to know if its possible anymore to only run ACE3 advanced ballistics on specific weapons?

#

seems like ace_advanced_ballistics_simulateForSnipers used to be a setting but not anymore

#

I would like to have it for snipers only, not so much every cannon round from an A-10

umbral nimbus
#

it isnt as far as I know

#

the weapon should be configured for it

#

weapon/ammo

#

I've got an other one.
Anyone had some clever workarounds to use UnitCapture on a car? So you can see the wheels rolling and such.

ornate fern
#

@little raptor one quick question. With remoteexec, will the sound not be played twice? From the server AND the clients???

little raptor
#

say3D has local effect

#

so no

ornate fern
#

@little raptor Check. Thanks

sage dawn
#

I need some help with event handlers in RscInGameUI functions, I have a custom one based on RscWeaponZeroing and it has an onLoad event handler, is that event handler supposed to only fire the first time that UI is created and never again, even if gets removed and created again?

austere granite
#

I think the infantry ui doesn't dissappear like that no

#

It's been years since I touched that though

sage dawn
#

I'm adding some event handlers when a certain weapon's RscWeaponZeroing is loaded, but I can't figure out a way to remove those EHs

#

if I add an EH that removes them when the weapon is dropped, the onLoad doesn't seem to always get called when I pick the weapon back up

#

if I make them get removed by onUnload, it doesn't always seem to trigger

#

so then if I pick up the gun again it adds them again

#

I don't understand when the onLoad and onUnload events actually trigger

austere granite
#

It's funky for rscingameui

quasi sedge
#
_actionid3 = _plr addAction ["Change aircraft loadout",{"[_plr] spawn 
GOM_fnc_aircraftLoadout;_plr removeAction 0;"}];
_actionid3 = _plr addAction ["Change aircraft loadout","[player] spawn 
GOM_fnc_aircraftLoadout"];
#

i give up

robust hollow
#
_actionid3 = _plr addAction ["Change aircraft loadout",{[_plr] spawn 
GOM_fnc_aircraftLoadout;_plr removeAction 0;}];
#

string to a script file path, or code which is what you have ^

#

though keep in mind _plr is not defined inside the action

#

i think it is called _target inside

quasi sedge
#

nah, i just give up and put removeAllActions player; in GOM_fnc_aircraftLoadout

#

thanks, Connor!

winter rose
cosmic lichen
#

-filePatching is the solution

still forum
#

fileExists behaves same as loadFile

#

And #if __has_include works same as #include minus the error

cosmic lichen
#

ok, so I wait for #if __has_include

brave jungle
#

hey guys, getting an error saying there is an undefined variable, however it still picks up this variable and it works. The variable is defined in my config.cpp so I'm guessing the function isn't seeing it straight away. Is this something to avoid in the future?

//Displays IDD define in config
#define VTT_Basic_Settings 348567
//then in my function
findDisplay VTT_Basic_Settings displayAddEventHandler [

undefined variable VTT_Basic_Settings

#

Should note I have already changed to a variable that gets the display in a script form, but would like some information on what I was doing before.

robust hollow
#

however it still picks up this variable and it works
🤔 sounds unlikely.

#

scripts dont see macros defined in the config.cpp.
if you define the macro in a separate defines file you can include that in the config and script, that way both get to use it

brave jungle
#

Oh I see, wasn't aware of that. Do you have a quick example of doing so?

robust hollow
#

of including a file?

brave jungle
#

no no like you said define it in a separate file, is it just a case of including in both config and the function?

robust hollow
#

yea

brave jungle
#

Oh right yeah makes sense now i read it again

#

👍

#

thank you

dusty badger
#

In terms of resources what sort of savings would agents provide over regular AI?

little raptor
#

they don't use visibility ray casts, so a lot if there are lot of targets in the area

#

but naturally, they're dumb

dusty badger
#

yeah, I am considering them for civilian ambiance so really they just need to react to getting shot at most of the time

little raptor
#

I guess they can't be suppressed either, so that has a small performance gain too

little raptor
dusty badger
#

I wonder if I could just script them all to run inside the nearest building as soon as someone fires in their vicinity

little raptor
#

there are a couple of stuff you might be able to use, like firedNear EH and suppressed EH (not in stable branch yet)

dusty badger
#

because really they just need to stand around and look pretty until battle starts, then they just need to leave or hide somewhere

#

and I guess if they do happen to get hit with a weapon they need to fall over

quasi sedge
#

how to check
if gunner turret is empty then

_vehicle addMagazineTurret ["rhs_mag_M829A3",[0]];
#

Such code obv not working

if [] == (_vehicle magazinesTurret [0]);
_vehicle addMagazineTurret ["rhs_mag_M829A3",[0]];
little raptor
quasi sedge
#

abrams turret

winter rose
#

if gunner turret is empty
if the turret has no more magazines (could be understood as "no gunner in it")

quasi sedge
#
while {true} do
{
    _vehicle = vehicle player;
    if [] isEqualTo (_vehicle magazinesTurret [0]) then
    _vehicle addMagazineTurret ["mkk_1Rnd_105mm_HEAT_MP_T_Green",[0]]; //M60A3
};
#

105mm gun is empty, this turret have m240 with ammo

#

i guess i need to check if _vehicle magazinesTurret not contain mkk_1Rnd_105mm_HEAT_MP_T_Green then
_vehicle addMagazineTurret ["mkk_1Rnd_105mm_HEAT_MP_T_Green",[0]];

#

if !("mkk_125mm_SABOT_MAG" in (_vehicle magazinesTurret [0])) then 
 {_vehicle addMagazineTurret ["mkk_125mm_SABOT_MAG",[0]];};

is that correct?

brave jungle
#

When setting text with ctrlSetText in a ctrlEdit class, adding a line break is the same as structured text right?

umbral nimbus
#

however the moveInCargo DOES work in the Debug console, executed Local

winter rose
#

is DC3 declared in the object itself, or by script later?

umbral nimbus
#

in the object itself

winter rose
#

oh - also, for JIP, waitUntil not isNull player

umbral nimbus
#

yeah ok. but this is even without JIP

#

just starting the mission

#

(on a dedicated server)

#

brb afk

umbral nimbus
#

back

winter rose
#

front

umbral nimbus
#

😝

quasi sedge
#

whats the typo here? .rpt is empty


_BotsRespawn = execVM "scripts\BotsRespawn.sqf";

if (isServer) then { 
sleep 5;
 while{true} do 
 { 
  if ((count allPlayers) > 15) then 
  { 
    {
        {if ((side (effectiveCommander _x) == independent) && (!isPlayer effectiveCommander _x)) then {deleteVehicle _x}} forEach vehicles;
        {if ((side _x == independent) && (!isPlayer _x)) then {deleteVehicle _x}} forEach allUnits;
    };
    terminate _BotsRespawn;
    hint "Bots are deleted!"; 
  }; 
 }; 
};
winter rose
#

…do you have an error maybe?

#

also, your while true will never exit 🤮

little raptor
#

and no sleep...meowsweats

exotic flax
#

and if this script isn't spawned it will return an error regarding the sleep

quasi sedge
#

yeah, found error, it was caused by extra { };

#

That's correct in terms of performance?

_BotsRespawn = execVM "scripts\BotsRespawn.sqf";
BotsOnServer = true;

if (isServer) then { 
    while{BotsOnServer} do 
    { 
    sleep 5;
    if ((count allPlayers) > 0) then
        { 
            {if ((side (effectiveCommander _x) == independent) && (!isPlayer effectiveCommander _x)) then {deleteVehicle _x}} forEach vehicles;
            {if ((side _x == independent) && (!isPlayer _x)) then {deleteVehicle _x}} forEach allUnits;
            {if ((side (effectiveCommander _x) == west) && (!isPlayer effectiveCommander _x)) then {deleteVehicle _x}} forEach vehicles;
            {if ((side _x == west) && (!isPlayer _x)) then {deleteVehicle _x}} forEach allUnits;
            terminate _BotsRespawn;
            hint "Боты убраны";
            BotsOnServer = false;
        }; 
    }; 
};
little raptor
#

no

#

you have duplicate forEach loops that iterate thru the same array

#

merge both forEach loops for allUnits and allVehicles

#

also, I recommend that you put this script in the "Botsrespawn.sqf" file too

#

no need to create a separate thread for this

spiral temple
#

hello! maybe someone can answer me my quesiton here:

we use Exile, and as you may know, the vanilla Arma 3 HUD ist disabled in favor of Exile's HUD. sadly nobody there could tell me, how to re-enable the vanilla HUD, thats why I'm here 🙂

little raptor
spiral temple
#

well, then its done via config, because I already tried showHUD

little raptor
dusty badger
#

So im running the arma 3 profiling build but diag_captureFrame 1; does not seem to work?

#

Just trying to capture the first frame after execution

umbral nimbus
#

I can vaguely remember there is a command or script that forces a server to load a certain mission from a running mission.

What I want to achive technically is like traveling from Stratis to Altis, in a somewhat fluent way. (preferably with a text overlay saying "2 hours later")

In MP on a Dedi