#arma3_scripting

1 messages · Page 580 of 1

vocal agate
#

let me grab the logs in the RPT file

#

14:00:36 Error in expression < _objects;
[] spawn {sleep 20; hint str _objects;}
14:00:36 Error position: <_objects;}
14:00:36 Error Undefined variable in expression: _objects

winter rose
#
_objects spawn { sleep 20; hint str _this; };
#

Dedmen drunk today

still forum
#

hides behind a exploded tank

vocal agate
#

Oh, I feel ashamed too, I should have caught that before blindly copy/pasting that

#

Thanks Lou Montana, nonetheless

#

ArmA's booting, let's see what's happening.

still forum
#

Arma*

vocal agate
#

Alright

#

the _objects array indeed contains 5 objects

#

the "str"'s giving a weird output, full of #'s and numbers

still forum
#

is any of them null though? after 20 seconds

vocal agate
#

Nope.

still forum
#

and are the numbers the same after 20 seconds (for the flagpoles)

vocal agate
#

all have a .p3d

still forum
#

that means they are the same objects then

vocal agate
#

Which numbers should I look at? the ff08... or the numbers after the #?

still forum
#

don't know 😄

#

all should stay exactly the same really

#

but I do think they are the same, don't even have to check the numbers.
But out of ideas then

vocal agate
#

everything's the same indeed.

#

May the module config have an "impact" on what happens in the script?

#

Most notably, I've set isGlobal = 1;. Should I set to to 2?

#

I'm starting to think it's an issue on my end - I mean, with my client.

#

I'm just using CBA and my mod. Is there anything that could cause any issues with that?

robust hollow
#

arma

vocal agate
#

May you explain?

#

^^'

#

Do you think it could be a bug from Arma 1.98?

robust hollow
#

i think at times arma can be the cause of issues, and in times like these it is best to look the other way and use a different method so our heads dont hurt trying to understand the un-understandable...?

#

for real though I dont know enough about modules to provide any real help here so im gonna chime out 🙂

vocal agate
#

but that's something that's been working for years!

#

this exact code was used across dozens of our maps

#

the fact that it doesn't work is... unexpected...

ebon ridge
#

I had an idea I didn't start to implement yet, just think about:
Using a set of prebaked animations (unit capture style) blended together to control air units. Currently I think helicopter AI can't do contour flying, or combat landings at all, and I would like to try and solve this problem (in a generalized fashion that will take a helicopter from take off to landing).
A few questions:
Is there already a solution for realistic AI helicopters?
Is this something that has been attempted?
Does this sound like a plausible solution?

#

Basic premise would be:

  1. Capture a bunch of useful animations (combat take off/landings of various kinds, turns of various speeds etc.).
  2. Take a start and end point, and use a curve fitting algorithm to select a best set of these animations to get from A to B.
  3. Play back the set, blending appropriately from one to another
  4. Possibly separately control or modify the orientation of the chopper so it looks better (e.g. at the blend points the recorded tilt might not match what would make physical sense, so adjust it here).
#

Issues I forsee:

  1. Recording enough animations, how many is enough?
  2. Generating a good set of waypoints between the origin and target
  3. Curve fitting in SQF could be expensive, might need to use a DLL, unless there is a function I can leverage already.
  4. Will the played back movement be smooth on clients?
compact maple
#

Hey. :)
Is it better to setVariable an array of values
or
make a setVariable for each value ?

queen cargo
#

you would need a hefty lot of prerecorded stuff for that @ebon ridge
like ... a real of a lot

fathom pawn
#

sorry i dont know if this is the appropriate place but im trying to script two things with infistar on a server I run.

#

im trying to place an object on top of another object

#

using the attachto function

queen cargo
#

plus that will only work for open spaces

fathom pawn
#

but every iteration i try doesnt work

still forum
#

@compact maple incomplete question. Not enough details.
Probably the array, but depending on what you're doing maying seperate setVariable's.
Also depends what your definition of "better" is. Less code? Less Memory usage? Less Network Bandwidth? Less CPU Load? Less script execution time?

fathom pawn
#

im also trying to figure out how to move an object lower

#

I tried cursorObject setPos [ getPos this select 0, getPos this select 1, -3]

#

but it didnt work

ebon ridge
#

you would need a hefty lot of prerecorded stuff for that @ebon ridge
like ... a real of a lot
@queen cargo What is your calculation? Technically it only needs one because the curve fitter is just fitting the best available animation to the route it wants to take, even if the best available doesn't fit at all, then blending between them all.

#

I'm suggesting only using the pre-records as a base, then coercing them to fit

queen cargo
#

unless i misunderstood something, you want to use prerecorded paths essentially
and a short curve is different from a long one here

ebon ridge
#

Yeah maybe I wasn't clear: I will generate the desired route, and coerce the pre-recorded paths to fit it by some mechanism, easiest is just a transform matrix

queen cargo
#

and if you want to support landing too, you need a hefty lot of em as otherwise you will crash the helicopter on hard terrain

ebon ridge
#

That won't be the case as I will force the pre-recorded data to fit the path, so the end of the pre-record ends on the ground

#

Simplest way is just calculate a matrix transform that translates/rotates/scales the pre-recorded data so the start and end point exactly match what I want

#

But there are better ways when trying to fit a curve which I would probably use

queen cargo
#

why not "just" try to generate a natural flight path?
prerecorded paths also require one for every kind of helicopter available

ebon ridge
#

Why would they require it? The path is just position and orientation I think?

#

It can be used on any chopper

queen cargo
#

because a littlebird will have a different flight behavior then eg. the Huron

craggy bramble
#

Hiya, tried googling but no luck. I can fix it by changing _someText to a global var, but I'd rather not do that.

0 = [] spawn {
    hint _someText;
};```

is there a way to have spawn accept private variables?
queen cargo
#

pass it into the spawn @craggy bramble (_someText spawn {...})
making it global is also an option, and requires you to remove the underscore

also ... please remove that 0 =
will cause more harm then one needs for no real benefit

ebon ridge
#

because a littlebird will have a different flight behavior then eg. the Huron
@queen cargo Doesn't really mean its required, it might be desirable. However as I mentioned I can augment the animation to change the orientation, speed it play etc.

still forum
#
_someText = "Scopes go over my head sometimes";
[_someText] spawn { //Pass _someText as arguments
    params ["_someText"]; //Pull arguments apart and save first argument into _someText
    hint _someText;
};
craggy bramble
#

@still forum @queen cargo Amazing, appreciate it!

ebon ridge
#

I tried cursorObject setPos [ getPos this select 0, getPos this select 1, -3]
@fathom pawn How are you running this? this isn't valid in general context I don't think, shouldn't it be cursorObject setPos [ getPos cursorObject select 0, getPos cursorObject select 1, -3]?

#

Or cursorObject setPos (getPos cursorObject vectorAdd [0,0,-3])

fathom pawn
#

@ebon ridge thank you so much

ebon ridge
#

It worked?

fathom pawn
#

yup 🙂

#

do you know how to attach one object to another if your spawning in the object?

#

i tried to do attachto

#

but it didnt work for me

fathom pawn
#

what i tried was player vehicle attachTo [cursorObject, [0, 0, 1]];

winter rose
#

and you had a script error

#

it is vehicle <unit>, not <unit> vehicle
so ```sqf
vehicle player attachTo [cursorObject, [0,0,0]];

daring pawn
#

Theres no way to overwrite vanilla functions in mission is there? Either redefining it in a description.ext or maybe a mod config?

If I wanted to edit a function, lets say BIS_FNC_ReviveEHHandleDamage - can a particular function be overwritten or would you have to make your own function, with all the same code and edit that? provided credit/reference to original function from BIS is provided if thats possible/allowed in that manner

#

Can take it to #arma3_config aswell if its more suited there, don't want to double post though obviously

still forum
#

mod config

#

CfgFunctions

daring pawn
#

Can I take it over to #arma3_config and query again there regarding overwriting that?

eager stump
#

On an MP mission, I'm trying to remove binoculars "Binocular" and radio "ItemRadio" with unassignItem, unlinkItem, removeItem and removeweapon. The code is run in onPlayerRespawn. Items refuse to disappear. Adding an GPS with linkItem "ItemGPS"; works nicely. In addition, after removing binoculars, I want to addWeapon "Rangefinder"; Why are these not working?

#

The same issue is on dedi and editor.

fathom pawn
#

@winter rose didnt work for me 😦

#

i am trying to attach the spawned in unit to another spawned in unit

winter rose
#

@eager stump removeWeapon "Binocular", and unlinkItem "itemRadio"/"itemGPS" (iirc)

fathom pawn
#

yea like i can attach myself to the objects

#

but not the objects to each other

winter rose
#

you can, depending on the object

fathom pawn
#

i know on the editor its possible, but when i use that same script in infistar it doesnt work

#

idk ill tinker around

#

ah i figured it out

high silo
#

I have this addAction ["Open Strategic Map", "openMap.sqf"]; How to I limit the range at which this action can be done?

winter rose
high silo
#

Im on that now, but idk how to classify the range

#

How many open close brackets do I need to reach radius, if any

winter rose
#

counting 😅

high silo
#

Is that all I need to do?

winter rose
#

see also below examples, there is an (incomplete) "default values" action

high silo
#

this addAction ["Open Strategic Map", "openMap.sqf", [],[],[],[],[],[5]];

#

I did this, but its not working. Have I just counted wrong?

ebon ridge
#

radius:Number i.e. you don't put [] around it

#

[] declares an array

#

and in fact you are wrong for the other ones as well, see Example 4 on that page

#

(although the example would be better if it commented all the parameter names)

finite sail
#

[player, true] remotexeccall ["setunconscious", _playerIwanttodown]

#

is this right.. to be run from dedi server?

#

tried it, but no work

#
  • remoteexeccall
ebon ridge
#

no, player is not valid on dedi server

#

it should be [_playerIwanttodown, true] remotexeccall ["setunconscious", _playerIwanttodown]

finite sail
#

excellent! it works, thank you

#

i assumed as it was being sent to the player, player would be valid there

ebon ridge
#

the variables you are passing into the remoteExec are evaluated when you make the call, thus on the server

finite sail
#

yep, makes sense

ebon ridge
#

i actually don't know what happens with variables inside a function though

#

Anyone know?

finite sail
#

its sending objects, so it doesnt matter that they are local to the script on the dedi

ebon ridge
#

if you pass code as a string i guess it evaluates them on the target, but if you pass code as code i don't know

finite sail
#

oh, i see

#

yes

ebon ridge
#

i would guess it evaluates on the target in both cases actually, because even if it compiles locally, player is still just a special variable name that is evaluated at the point it is executed I expect

finite sail
#

i'm kidnapping a player for others to rescue, so want them unconscious, but not able to respawn

#

setunconscious does that nicely.. its sometimes seen when players get run pver by vehicles, they get knocked down, but get up again after a few seconds

halcyon hornet
#

Ok so stupid question of the day, in an SQF file that's server side in an @ folder, does the @ need to be included if defining a file location in the SQF? E.g. #define SERVER_PATH "\NAME\Modules" or does the @ not need to be included?

winter rose
#

1/ you can only run this script server-side
2/ just \addonName\your\script\file.sqf
@halcyon hornet

halcyon hornet
#

Great thanks, and yeah I know it's server side only it's to define some stuff server needs to do

halcyon hornet
#

Slightly off topic but not sur which channel would be best for this, is there a A2 version of extDB around at all or should it work with A2 anyway?

dire perch
#

Hi folks. I was wanting to know if there’s a script to add weapons to things. Specifically I wanted to add demining charges off the AL6 demising drone to a regular AR-2 drone.

fair lava
#
_vel = velocity _vehicle;
_dir = direction _vehicle;
_speed = 10; comment "Added speed";
_vehicle setVelocity [
    (_vel select 0) + (sin _dir * _speed), 
    (_vel select 1) + (cos _dir * _speed), 
    (_vel select 2)
];

this is on the wiki, but it doesn't apply any velocity to the z direction, so it only accelerates horizontally, what i find strange here is that DIR doesn't return a 3 dimensional component.

I need something like:
Velocity + (CurrentVelocityDir * _speed)

how do i get an actual directional vector for a unit? like length = 1, do i need to do math on the velocity function? or is there a helper function i've been unable to find

#

oh is it vectorDir?

_vel = velocity _vehicle;
_dir = vectorDir _vehicle;
_speed = 10; comment "Added speed";
_vehicle setVelocity [
    (_vel # 0) + ((_dir # 0) * _speed), 
    (_vel # 1) + ((_dir # 1) * _speed), 
    (_vel # 2) + ((_dir # 2) * _speed)
];
winter rose
#

@dire perch yes, see addWeaponCargo/addMagazineCargo on the wiki 😉

dire perch
#

Doesn't that just allow it to carry stuff as cargo? I want to be able to drop those bombs

civic coyote
#

How might I get a unit to spawn in or weather change when an engine of a plane starts (player enters plane) using an If statement? And How might I get the number of players in a vehicle to be considered in an If statement?

winter rose
#

Doesn't that just allow it to carry stuff as cargo? I want to be able to drop those bombs
@dire perch oh yes indeed. addMagazine and addWeapon then

dire perch
#

That goes in the description, right?

winter rose
#

no…?

dire perch
#

for instance, BombDemine_01_F is the weapon, and PylonRack_4Rnd_BombDemine_01_F is the magazine... I think

#

I'm super new to this

winter rose
#

hi super new, I'm dad!

dire perch
#

I want to add it to the AR-2's turret, because apparently that bomb is actually laser guided anyways.

#

and because I'd be able to use the turret to look down

vocal agate
#

@robust hollow @still forum @winter rose I'm reaching you again in regards to the issue I encountered earlier today. The fix is kinda straightforward: flags' "center" is set to a rather high position. If the maximum distance from which the action can appear was set to any values lower than 5 meters, it led to the action not being visible. I don't know if any of you has a Write access to the BIS Wiki - I think that it might be worth to add a "note" to the addAction page about that.

winter rose
dire perch
#

And I put those in the role description field, right?

winter rose
#

no

#

in a script

dire perch
#

Crap. Yeah, I’m in over my head

winter rose
#

an init field *might* be used (even though not recommended)

#

in that case, surround this with ```sqf
if (isServer) then {
// code here
};

dire perch
#

Okay, so popping right in to EDEN. I’m making a drone controller as player. I’ll put an AR2 darter right next to him, as it might be easier than making it into a backpack...

#

Then what? How do I put a script in there?

#

The wiki doesn’t seem to say how I start putting a scrip in, just why to put in

#

*what

winter rose
#

in your mission directory, create an initServer.sqf

#

there is (almost) everything needed on the wiki; and if there is not, we add it

dire perch
#

Anybody know if it’s possible to set the drones up so that multiple people can connect? Both for all getting a drone feed, and also possibly for one guy flying, one guy “gunning”?

winter rose
#

only one user per drone
as for the feed, it is scriptable (if you want the UAV feed in the bottom right corner)

sage flume
#

can I put a number in the ignoreObject

winter rose
#

and you are talking about…?

sage flume
#

well th escript is calling to apawn a check point on a crossroad but hhe terrain object scan be a bit close by

#

and I want to tell my code to stay just 1 or 2 meter from an object

#

say a tree

winter rose
#

which script?

sage flume
#

while {((isOnRoad _pos) or not (_fe) or ((count (_pos nearRoads 5)) > 0))} do
{
_ct = _ct + 1;
if (_ct > 48) exitWith {};
_pos = [_mPos,5 + (_ct/8),20 + (_ct/4)] call RYD_JR_RandomAroundMM;
_fe = (count (_pos isFlatEmpty [-1,-1,0.25,20,0,false,objNull])) > 0;

#

objNull i want to try 2 (meters?)

winter rose
sage flume
#

yup I'm there but I don't see anything about using other than the default which is

#

ignoreObject (Optional): Object - Object to ignore in proximity checks. objNull to ignore. Default: objNull

winter rose
#

Object

#

so not Number.

lapis ivy
#

How do I apply ModuleZoneRestriction to units that have been killed and respawn?

#

The module synchronizes units and it works on those that have not been killed.

sage flume
#

yup, and when the Check point spawns, I get say a tree coming up throgh the sandbag or some such thing

#

maybe I'm asking Arma for to much,....to tight on the parameters?

winter rose
#

have you checked… hmm, **minDistance **?

sage flume
#

minDistance (Optional): Number - Objects within 50m cannot be closer than minDistance. -1 to ignore proximity check. Default: -1

#

yes but if I understand,....no objeect can be closer than 50 meter?

#

for me that's a bit far

winter rose
#

this ^ means that the check won't happen for objects more than 50m away

_pos isFlatEmpty [-1, -1, 0.25, 20, 0, false, objNull];
#

try 1?

sage flume
#

OOOOOOH! I see

#

you see the CP is actually in the woods, when there is more room across the road

#

and

#

so the wording should be....

#

going from

#

Objects within 50m cannot be closer than minDistance

#

to Objects within 50m will not checked furhterthan minDistance

#

just a twist on the English I suppose

winter rose
#

I'll rewrite it

tough abyss
#

hey guys

#

where would my texture pack be for my map in arma

#

want to us l3td to edit it

winter rose
#

l3td?

#

Large 3D Terrain generator, googled it

stuck musk
#

displayAddEventHandler won't work on huds (specifically keydown)... anyone know why?

exotic flax
#

Because Arma is handling Dialogs (blocks movement), Displays (doesn't block movement) and HUD elements (special type) differently.

stuck musk
#

so do i just need to script in a new display to attach my handlers too? I don't want to use the main display because i want the handlers to get cleaned up when the hud is inactive

robust hollow
#

you could add them to display 46 on hud load and remove them on hud destroy events

#

or, however you deem the hud as inactive

#

for normal hotkey type stuff it does need to be on display 46 i think, otherwise you get the mouse cursor on screen so you cant look around

stuck musk
#

yeah, i dont want them to have control over the mouse... how does the main display allow attaching handlers but not let user control the mouse?

#

why arma

robust hollow
#

tis magical 🧙‍♂️

winter rose
#

@sage flume rewritten up to latest wiki standards

exotic flax
#

if you want to add something to the screen which can't be interacted with (like a HUD element), simply create a Display and use displayAddEventHandler to control it

#

and displays can be created and removed with scripts, and so can their EH's

shut shadow
#

Does anyone have access to a script that allows you to lock a door/gate with a predefined numeric code prior to mission start?

flat elbow
#

is there a list of all the vehicles inside A3 in the wiki? all i could find was a list for operation flash point

exotic flax
flat elbow
#

because i basically have a script that spawn a "HelicopterExploBig", but i can't find this vehicle anywhere

#

(i have to reduce the size of the explosion by spawning a smaller one)

robust hollow
#

HelicopterExploSmall

exotic flax
#

it's not a vehicle, but "Ammo" (it's in CfgAmmo)

flat elbow
#

do we have a wiki page with CfgAmmo like it's with CfgVehicles?

robust hollow
#

i cant seem to find one, though you can browse the classes in the config viewer ingame

flat elbow
#

hah i'd like to, i am writing this from a dual core 10yo laptop

robust hollow
#

oh dear

flat elbow
#

yea my main PC decided to die with a big condensator explosion and due to covid i have to wait a while before they deliver the new parts for the new one

exotic flax
#

extract all A3 pbo's to a P drive, use a decent IDE and search 😉

flat elbow
#

look at my 120gb 5400rpm drive

#

cry

robust hollow
#

do you have arma on ur laptop?

flat elbow
#

i don't think it can run it at all with an intel hd 3000 integrated graphic

#

just playing youtube videos at 1080p brings the CPU to 100%

stuck musk
#

man i swear i have done so many dialogs and never had this problem

#

why would the onLoad event handler not work at all with dialogs

#

keydown works fine but i can only use onLoad within the dialog defines

robust hollow
exotic flax
#

but... if you are manually doing a createDisplay you don't need an onLoad, because you can simply put that code right after it's created 🤔

stuck musk
#

i am not

#
disableSerialization;
createDialog "dialog_my_dialog";
_display = findDisplay 95000;

_display displayAddEventHandler ["Load", {hint "123"}];
exotic flax
#

that should be "onLoad"

robust hollow
#

it is only onLoad in the cfg

robust hollow
#

they dont use on in the sqf command

stuck musk
#

you are suppose to exclude the 'on' prefix

robust hollow
#

i dont think that event would fire if the display has already loaded?

cunning crown
#

Why add the onload? I mean you created the dialog yourself so you know it's already loaded; just call your function directly after your checks

exotic flax
#

ah, I see

stuck musk
#

@robust hollow that probably makes sense

#

true true

exotic flax
#

but... if you are manually doing a createDisplay you don't need an onLoad, because you can simply put that code right after it's created 🤔
@exotic flax

#
disableSerialization;
createDialog "dialog_my_dialog";
private _display = findDisplay 95000;
// is loaded here
hint "123";
if (isNull _display) exitWith {};
stuck musk
#

yeah

exotic flax
#

could even add a waitUntil to be sure

stuck musk
#

the order of events just didnt click

#

i was using load and unload together and the ocd tookover i guess

runic edge
#

Hello guys, i hope you're all going well !
I was wondering if there were another way to learn about if... then ... else than this : https://community.bistudio.com/wiki/if
I'm actually struggling with an if that work only when the condition is true and never execute the else 🤔
Thanks in advance for your help

robust hollow
#
if (cond) then {

};```
?
runic edge
#

Yeah

robust hollow
#

is.. is that it? or are you saying you have an else and it just never executes?

runic edge
#

I have an else that never executes yes sorry if that was unclear

robust hollow
#

could you paste it in chat. if its a big snippet upload it to pastebin and share the link

runic edge
#

I dunno how to tag it as code on my phone but there it is

#

if(!isNull ce)
then {
acces allowDamage false;
acces setVariable ["R3F_LOG_disabled", true];
acces execVM "loads\crate\itemsCe.sqf";
pInf allowDamage false;
pInf setVariable ["R3F_LOG_disabled", true];
pInf setObjectTextureGlobal [0, "pics\ce.jpg"];
}
else {
acces allowDamage false;
acces setVariable ["R3F_LOG_disabled", true];
acces execVM "loads\crate\itemsDa.sqf";
pInf allowDamage false;
pInf setVariable ["R3F_LOG_disabled", true];
pInf setObjectTextureGlobal [0, "pics\da.jpg"];
};

#

"ce" is an invisible helipad that I create with Eden in the scenario I want with this camo

robust hollow
#

@flat elbow i now have a html dump of the ammo cfg if you want me to dm it to you

flat elbow
#

it looks ok to me, are you sure the !isNull ce returns what you think?

#

@robust hollow i wonder if it would be more helpful to make a wiki page with it?

robust hollow
#

it would, but the other config pages are made using BI functions to generate the page. i dont think ammo has one

runic edge
#

@flat elbow there may be the problem I 've read it 10000 times and I think my problem is more a logical one

flat elbow
#

if you place that ce with the eden editor, it will always be there anyways

runic edge
#

!isNull ce : returns true if the ce object is present and false if it is not

flat elbow
runic edge
#

Not that I m lazy but I am using the same code for multiple mission template as my limited knowledge of scripting implies many mistakes

dry tendon
#

I have a line that says if(_uid player = "123") then {
Its telling me that it is missing )

flat elbow
#

if (_uid player == "123") then {};

runic edge
#

@flat elbow you are suggesting that I should use isNil instead ?

dry tendon
#

That's what I have

#

Oh I forgot the second equals

#

Oof

flat elbow
#

i don't know much what are you trying to do but that could be the culprit, test the result with the debug console of isNull and isNil and see what fits

#

isNil is used when something does not exist usually, AFAIK

dry tendon
#

The error went away after changing = to ==

#

That was it I do believe

runic edge
#

I will try
But reading the two wiki pages I m not sure to get the difference between isNil and isNull

exotic flax
#

isNull will check if something is Null (does exist, but no value)
isNil will check if something is Nil (doesn't exist)

flat elbow
runic edge
#

Ooh ok

exotic flax
#

although, if you add a variable through 3den (like an object name), then it will always exists

runic edge
#

@exotic flax makes send now thank you
@flat elbow it should work then with isNil many thanks good sir !

jagged elbow
#

Hey, trying to make it so when a task is completed it will then be deleted but im having some issues, this is what i have so far:

    if (taskState task1 == "SUCCEEDED") then{
      sleep 2;
      ["task1"] call BIS_fnc_deleteTask;
    };

Getting an error about task1 being an undefined variable.

exotic flax
#

so in your case you most likely want to find all similar objects first (like helipads), check if their name is "ce" and then do something with it (and add an 'else' for other helipads)

flat elbow
#

yea as I said, without knowing what you are doing, it's hard to suggest, maybe you can setVariable and getVariable, or set the object to nil, or whatever approach best suits the situation

runic edge
#

Yeah but I have the same initServer and initPlayerLocal for many mission template : it is more tedious at first but I think this spare me some headaches
Then in the mission where I want a "ce" camo I create the ce invisible helipad in Eden and in mission where I want an other camo, I don't create it

#

Does it sound THAT weird 😭

exotic flax
#

yes and no 😉

flat elbow
#

am I the only one that develop custom scripts for every mission?

exotic flax
#

I would simply create functions in my mission framework; one for default use, and one for special cases.
In 3den I would then call those scripts to each item which needs to default or special, in the init field.

runic edge
#

My understanding of sqf isn't allowing me to do that for now ^^ but I'm trying things @flat elbow

exotic flax
#

and no Fluffy, you're not the only one

#

Although I do have a mission framework for loadouts, arsenal inventories and some scripts which we use a lot (but not all the time).
The only thing we need to do is either modify a settings file in the mission, or use mission parameters to change stuff on the fly.

flat elbow
#

hey i passed 8 years without touching arma

#

we're more or less on the same boat

runic edge
#

Except I m drowing in the water besides the boat 😂
Sounds like a very good memory you got there mate !

exotic flax
#

remembers the time where Discord didn't exist and the forums were the only source of help

flat elbow
#

i used skype

runic edge
#

insert pepperidge farm meme here

exotic tinsel
#

Is it possible to stream POV in game to a website? Just wondering before I spend anymore time googling. Essentially it would be cool if you could click a player on website and watch POV. I know how to do this in game.

exotic flax
#

I'm sure it would technically be possible, although it would require a mod with a custom extension which, and probably a second slot per player for the mod to access and stream their POV.

flat elbow
#

you can attach a camera and take that feed, like an helmet cam

#

but i concur it would require a mod with an external DLL to then be able to get it from a web server

exotic flax
#

but streaming 100 POV's at the same time will probably kill your server

#

most streamers already need a special system to handle a single POV stream

flat elbow
#

unless you make the mod run on the clients and stream it to somewhere else

#

not a server i'd play into, tho

exotic flax
#

in that just ask players to stream themselves and have a website which links to each stream 🤔

flat elbow
#

i wonder what happened to killzonekid now that i think about it

queen cargo
#

He is now a bi monkey

flat elbow
#

"REDIRECT CLIENT TO SERVER
So, after almost 2 years of working for Bohemia as external contractor, I decided it was time for me to call it a day. Of" from a website article, so i think that's not the case

bold kiln
#

Is there a something I can add to user action class that only allows Driver to activate?

exotic flax
#

it should have a condition property where you can add some code

bold kiln
#

do you know of an example?

pliant sand
#

What's the correct way to make a percentage chance of something? I'm trying to do random 1 == true, but it isn't working for some reason.
https://pastebin.com/y7KPqAHt

robust hollow
#

you're missing a ) on the end of your if condition

pliant sand
#

I think it was still throwing an error but let me spin up the fixed version on my dedi

robust hollow
#

random 1 < 0.5 would be 50/50 chance

#

random 1 < 0.25 would be 1 in 4 chance, and so on

pliant sand
#

damn it, I'm sorry, I thought it was an integer, the wiki clearly states float...

#

thank you for your help

robust hollow
#

no worries 👍

vocal mantle
still forum
#

@fair lava you know that vectorMultiply and vectorAdd are a thing right?

fair lava
#

no, i did not

robust hollow
#

add it to your keydown/keyup eventhandler

#

fn_keyHandler.sqf if you're using base altis life

grim wing
#

@robust hollow so like this?

  {
    createDialog 'life_admin_menu';
    };
robust hollow
#

if that is inside the switch, then yea

grim wing
#

aight

real tartan
#

I get center of unit via

_position = _unit modelToWorldVisual (_unit selectionPosition "Spine3");

Is there a selection for Air, Sea, Land vehicles ? I am trying to get center of object for Draw3D

grim wing
#

it didnt work

winter rose
#

@real tartan you may find it using boundingBox(real)

real tartan
#

@winter rose isn't it expensive for each frame ?

runic edge
#

@exotic flax @flat elbow isNil does not seems to work either

Edit : I learned to read and apply correctly what is written, works fine now

winter rose
#

@real tartan I think it might be handlable

#

tests to be done in order to ensure it, of course

grim wing
#

@robust hollow i cant get it to work

fervent kettle
#

I am trying so that time and weather changes when someone activates an addAction, but it does nothing

[[2020, 6, 17, 6, 0] remoteExec ["setDate"]];

for time and

0 setOvercast 1;
0 setRain 1;
forceWeatherChange;

for the weather, it`s in an SQF file

grim wing
#
  {

    if((__GETC__(life_adminlevel) > 1)) then {
      if(_shift) then
      {
      createDialog 'life_admin_menu';
      _handled = true;
      };
    };
  };
#

I have no idea why this isnt working

#

its under the key down handler

lapis ivy
#

Hello

#

How do I apply ModuleZoneRestriction to units that have been killed and respawn?
The module synchronizes units and it works on those that have not been killed.

unreal scroll
#

Trying to enable standard BIS revive system for ACE.
All ACE medical modules removed, also from mission file.
Revive settings are applied in the mission_component.hpp (mission didn't changed):

        #include "\a3\Functions_F\Params\paramRevive.hpp"
};```
I select the needed options in lobby, but when somebody falls unconsious (lifestate == "INCAPACITATED"), I can't see any revive options for him. 
Player has "medic" trait, and have a Medikit (it doesn't needed due to settings, but to be sure).
What else should I check for BIS revive system?
winter rose
#

you need to go to mission parameters in Eden to enable the revive system

#

that or enable it in description.ext @unreal scroll

surreal peak
#

this is a random and not at all related to scripting, but why are you orange now Lou?

winter rose
#

I seem to have been promoted as server moderator®

surreal peak
#

ewwww more responsibility

winter rose
#

less talk, more bans 😛

#

and twice the amount of dad jokes!

surreal peak
#

!Warning Fred "Off Topic"

#

The best type of jokes!

runic edge
#

Hello guys ! Is there a way to run a for but with different variables instead of a variable in a given range ?

robust hollow
#

could you elaborate a little?

runic edge
#
 do ... ```
robust hollow
#

as in while _i equals one of a selection of values?

runic edge
#

let me check how while works :3

robust hollow
#
private _i = -1;
// something to change _i probably
while {_i in [1,3,5,8,15]} do {
// something to change _i again I hope
};

?

finite sail
#

that will work

young current
#

forEach is for that @runic edge

finite sail
#

in returns bool for that example

still forum
#

why not forEach?

runic edge
#

i did not know that command

#

I'll look for it

flat elbow
#

a question that have more to do with math than with scripting but anyways: how do one calculate at what direction to shoot a projectile in order for it to hit another projectile?

still forum
#

the other projectile is also moving?

#

with gravity compensation?

flat elbow
#

yes it's an incoming missle/mortar shell

still forum
young current
#

might be too big a question

#

Internet probably has math for that though

flat elbow
#

probably, the problem is that i can't find a good elaboration on that

young current
#

its not simple math so you may need to figure out it piece by piece

flat elbow
#

the best math i have made was 2D one, and it was many years ago, so i don't even know what to look for

young current
#

but also in Arma does it need to be that accurate?

flat elbow
#

all i can think of logically is to know the vector and speed of the incoming projectile, the speed of the one i will be shoot, then calculate the position at wich on time T the projectile will be so that my projectile will hit it

#

at best it's a second or third order equation

young current
#

something like that sounds like in right direction

flat elbow
#

yes, now i only need someone who can think in trigonometry and math to solve for it and then make that solution in SQF language

#

because i have no idea how to solve for it lol

young current
#

you could ask from any of the CIW mod makers how they did it

cunning crown
flat elbow
#

hive mind confirmed

still forum
#

still missing gravity though, and I'd assume as missile defense you'd shoot at long distance where gravity comes into play

velvet kernel
#

anyone knows the syntax for setGearSlotAmmoCount in arma 2? there is no wiki page unfortunately, but patch notes mention it was added

still forum
cunning crown
#

ah yeah right, totally forgot gravity

still forum
#

I think gravity is... would be simple if you managed to figure that math out by yourself

flat elbow
#

does A3 account for gravity?

still forum
#

yes

flat elbow
#

$...

still forum
#

otherwise mortar shells would never come back down

#

😄

flat elbow
#

you can make them come down as a path instead of actually calculating gravity

still forum
#

Arma is a Simulation tho

cunning crown
#

Arma does have a thing that calculate the intercept course (for tanks, planes, etc), would be nice if we could have such command

flat elbow
#

so well you have to expand the calculation to include gravity too... i feel like it would be resource intensive

#

esp. for a gun that shoot 1000 rounds per minute and you have to calculate the interception point of each

still forum
#

should be sufficient to do it 10 times a second

#

considering distance, and gun shotspread, adjusting every 10th second should be sufficient

flat elbow
#

but yes, the game should definetly have a command to return the intercept course

#

i am also surprised this is not provided in the CBA either

jagged elbow
#

Hey, trying to make it so when a task is completed it will then be deleted but im having some issues, this is what i have so far:

    if (taskState task1 == "SUCCEEDED") then{
      sleep 2;
      ["task1"] call BIS_fnc_deleteTask;
    };

Getting an error about task1 being an undefined variable.

quartz pebble
#

Anyone knows the list of brown Mohawk textures?

runic edge
#

@young current i tried the forEach and it works ... or kinda :
I lined up two forEach in the same file and it seems that only the first one runs

if (isPlayer _x)
    then {
        if (!isNil "ce")
        then {
            _x execVM "loads\ce\zeus.sqf";
            }
        else {
            _x execVM "loads\da\zeus.sqf";
            };
        };
} forEach [
god,
god1
];

{
if (isPlayer _x)
    then {
        if (!isNil "ce")
        then {
            _x execVM "loads\ce\cdg.sqf";
            }
        else {
            _x execVM "loads\da\cdg.sqf";
            };
        };
} forEach [
_sgCdg,
_grCdg
];

did I made a mistake in syntax somehow ? if i did, i cant fnid it

unreal scroll
#

that or enable it in description.ext @unreal scroll
@winter rose
I've added the following to my description.ext:

ReviveMode = 1;                         //0: disabled, 1: enabled, 2: controlled by player attributes
ReviveUnconsciousStateMode = 0;         //0: basic, 1: advanced, 2: realistic
ReviveRequiredTrait = 1;                //0: none, 1: medic trait is required
ReviveRequiredItems = 2;                //0: none, 1: medkit, 2: medkit or first aid kit
ReviveRequiredItemsFakConsumed = 0;     //0: first aid kit is not consumed upon revive, 1: first aid kit is consumed
ReviveDelay = 6;                        //time needed to revive someone (in secs)
ReviveMedicSpeedMultiplier = 2;         //speed multiplier for revive performed by medic
ReviveForceRespawnDelay = 3;            //time needed to perform force respawn (in secs)
ReviveBleedOutDelay = 120;   ```
Nothing changed. Any ideas?
fervent kettle
#

I am trying so that time and weather changes when someone activates an addAction (on a server), but it does nothing

[[2020, 6, 17, 6, 0] remoteExec ["setDate"]];

for time and

0 setOvercast 1;
0 setRain 1;
forceWeatherChange;

for the weather, it`s in an SQF file

winter rose
#

@unreal scroll remove the mods

#

of course it doesn't do anything @fervent kettle

#
[[2020, 6, 17, 6, 0] remoteExec ["setDate"]];
↓
[
  [2020, 6, 17, 6, 0] remoteExec ["setDate"]
];
```why would you do that?
jagged elbow
#

@winter rose I took a look at the links you sent and this is what i have now:

if ("task1" call BIS_fnc_taskCompleted) then{
      ["task1"] call BIS_fnc_deleteTask;
    };

But it still doesnt delete the task.

winter rose
#

where do you put this?

jagged elbow
#

This is the whole script:

_commanderAziz = {
    //set up the task
    private _title1 = "Kill Colonel Aziz";
    private _description1 = "Kill The Colonel.";
    private _waypoint1 = "Target";

    //define commander
    private _commander = "CUP_O_TK_Story_Aziz";

    //define and randomize commanders men
    _azizMen1 = ["CUP_O_TK_Officer", "CUP_O_TK_Soldier"];
    _azizMen2 = ["CUP_O_TK_Officer", "CUP_O_TK_Soldier", "CUP_O_TK_Soldier", "CUP_O_TK_Soldier"];

    _azizMen = selectRandom [_azizMen1, _azizMen2];

    //define markers adn randomly choose one
    _markers = selectRandom ["assassin1", "assassin2", "assassin3", "assassin4"];

    //spawn commander
    _groupEast = createGroup East;
    _unitAziz = _groupEast createUnit [_commander, getMarkerPos _markers,[], 5, "NONE"];

    //sapwn commanders men
    _groupAssistAziz = createGroup east;
    _groupAssistAziz = [getMarkerPos _markers, east, _azizMen] call BIS_fnc_spawnGroup;

    //create task
    _azizTask = [player, ["task1"], [_description1, _title1, _waypoint1], _markers, 1, 2, true] call BIS_fnc_taskCreate;

    //complete task
    _unitAziz addMPEventHandler ["MPkilled", {["task1","SUCCEEDED"] call BIS_fnc_taskSetState}];
    if ("task1" call BIS_fnc_taskCompleted) then{
      ["task1"] call BIS_fnc_deleteTask;
    };
};
winter rose
#

why do you set it to succeeded, why do you check status if it is all to delete it?

fervent kettle
#

Oh ok, and regarding the weather?

winter rose
#

also wrong task id in BIS_fnc_taskCreate usage

#

@fervent kettle maybe your code was throwing an error, therefore not doing anything else
try fixing the setDate and see?

fervent kettle
#

weather is in another file, also no errors so far

surreal peak
#

why is it in a remoteExec @fervent kettle ?

jagged elbow
#

But the task itself does get created without error the only issue is the delete part, i need it to be deleted once completed so the script can be ran again

winter rose
fervent kettle
#

on the wiki it said remoteExec is used on MP

winter rose
fervent kettle
#

how exactly do i execute that on the server?

winter rose
#

initServer.sqf for example

velvet kernel
fervent kettle
#

i want 2 files so you can change the weather to your liking

#

maybe im just thinking a bit more complex then it is

jagged elbow
#

Not sure how its wrong, looking at the example on the wiki: [civilian, ["task1"], ["Do this and you get a cookie", "Earn Cookie", "cookiemarker"], [0,0,0] ,1, 2, true] call BIS_fnc_taskCreate; the task id is the same

winter rose
#

the examples are wrong, it should be "task1"

#

well, maybe it works in this syntax too, IDK

#

@fervent kettle
given you use addAction it is potentially clientside, therefore use ```sqf
remoteExec ["forceWeatherChange", 2]; // 2 = server

#

@jagged elbow again, why would you check if it is completed if you set it to succeeded on the line just before? this if check is useless
it might be an MP delay issue, IDK

jagged elbow
#

Because when i simply deleted the task without an if statement it would delete the task insantly not giving the player a chance to do the mission

#

i only want the task to be deleted once the commander has been killed

fervent kettle
#
[[2020, 6, 17, 6, 0] remoteExec ["setDate"]];
↓
[
  [2020, 6, 17, 6, 0] remoteExec ["setDate"]
];
```why would you do that?

@winter rose wait do what exactly?

velvet kernel
#

okay so im trying to set/get individual ammo counts on magazines in arma 2

#

the changelog lists setGearSlotAmmoCount as a command that was added in 1.62

#

so im trying to do the following

#
createGearDialog [player, "RscDisplayGear"];
_dialog = findDisplay 106;  // 106=gear
_control = _dialog displayCtrl 114;  // 114=slot
_control setGearSlotAmmoCount 50;  // set to 50
#

the magazine is still visible in gear after executing this, but despawns whenever the gear refreshes next time

#

the command isnt listed on the wiki so i dont really know if this is the correct syntax. it doesnt error at least

ebon ridge
#

well there is commands to add mags with specific number of bullets, is that what you are trying to achieve?

#

oh sorry maybe not in arma 2

velvet kernel
#

there is, but you cant decide which one to remove

ebon ridge
#

well you would remove and re-add them all i would suggest

velvet kernel
#

nah dont want to do that

#

if possible

#

this command should work somehow i guess

#

hmm it actually throws Bad conversion: bool into logs

winter rose
#

wait do what exactly?
@fervent kettle do place the command in an array 😄
you don't do [player setDamage 1] do you?

astral dawn
#

Hello guys, does anybody have understanding of arma netcode?

We are trying to solve bandwidth spikes when a lot of units are created and we need to know the following aspects:

  • does creation of a single unit from class name generate the same amount of network traffic as creating an empty unit and then filling his inventory one by one?

  • are multiple manipulations of soldier inventory queued separately or will they be converted into a single packet? For instance, is 10xadd magazine "123" going to generate same traffic as add magazine ["123", 10] ?

Currently we have a fixed set of unit loadout variants and we are thinking of making a pool of pre-created and pre-decorated units with disabled simulation and visibility, and taking units from this pool.

Other ideas are welcome too.

still forum
#

does creation of a single unit from class name generate the same amount of packets as creating an empty unit and then filling his inventory one by one?
no, first one less

#

are multiple manipulations of soldier inventory queued separately or will they be converted into a single packet?
both

#

For instance, is 10xadd magazine "123" going to generate same traffic as add magazine ["123", 10] ?
Would need to check but I don't want to check, my op started 19 minutes ago and I'm already a bit late :u

winter rose
#

go play! è_é

still forum
#

need to fix bug :U

winter rose
#

GO. PLAY.

oblique arrow
still forum
winter rose
#

the dots are not

still forum
astral dawn
#

still forum
#

Hah! Stolen

winter rose
#

stahp fixing bugz, if you don't relax from time to time you will add more bugs than you will solve 😄

oblique arrow
astral dawn
#

Thanks that will be useful

oblique arrow
#

Dedmen stealing my emotes

still forum
#

I assume the addmag 10 at a time is more efficient, but cannot look and not confident

winter rose
#

well, it's either same or more efficient (?)

still forum
#

also, some classnames are more efficient than others magic

#

yes

#

addmag 10 at time is always better either way

astral dawn
#

thanks a lot!

quartz pebble
#

Anyone knows the names of dark-green textures for Mohawk?

hallow mortar
#

Can BIS_fnc_hasItem search by variable name or is it only by classname?

winter rose
#

did you check the wiki?

hallow mortar
#

It uses classname in the examples but doesn't actually specify

#

the search parameter is only listed as a String

winter rose
#

you can eventually use typeOf _myObject if needed

#

@hallow mortar ^ ?

hallow mortar
#

I don't see how that covers what I'm asking

#

I just want to know if I can search for an item by its variable name rather than its classname (for example if I have given a backpack a variable name)

winter rose
#

item: String
means it accepts only a string.

typeOf could help search for the type of your backpack - else, this function is not for you

#

this ↓ should cover what you want, or a variation of this to check inside backpacks

_myBackpack in everyBackpack _myBox;
#

@hallow mortar ^

hallow mortar
#

this is in the context of trying to identify and track a specific backpack (including when a player is carrying it)

winter rose
#

context helps, indeed

hallow mortar
#

I know there are some ways of doing it with setVariable and stuff, I'm just trying to see if there's an easier way. I thought fnc_hasItem might be it, but it isn't

winter rose
#

and what I posted may

#

no?

hallow mortar
#

maybe part of it

#

everyBackpack doesn't appear to work on units so it would need to be done in conjunction with other checks such as unitBackpack

grim wing
#
  {

    if((__GETC__(life_adminlevel) > 1)) then {
      if(_shift) then
      {
      createDialog 'life_admin_menu';
      _handled = true;
      };
    };
  };
#

i have no idea why this isnt working

winter rose
#

@hallow mortar yep

#

@grim wing it may be better for you to go on the L*fe Discord server linked in #channel_invites_list in order to talk about their framework.

fervent kettle
#

@fervent kettle do place the command in an array 😄
you don't do [player setDamage 1] do you?
@winter rose so i can just do [2020, 6, 17, 6, 0] remoteExec "setDate";
or
2020, 6, 17, 6, 0 remoteExec "setDate";

winter rose
#

urgh
the first one please

fervent kettle
#

ah right

hallow mortar
#

Parameters do have to be in an array, especially when they are an array in the non-remoteExec version of the command

winter rose
#

if it doesn't work or throws an error, try [[2020, 6, 17, 6, 0]] remoteExec "setDate";

hallow mortar
#

Actually I'm pretty sure "setDate" should be in an array too, since the right side of remoteExec is actually an array with optional elements

winter rose
#

oh wow, I missed that - of course it must be in an array 🤦‍♂️

#

@fervent kettle ^

[[2020, 6, 17, 6, 0]] remoteExec ["setDate"]; // final.pdf
fervent kettle
#

thanks, was wondering why it gave me an error ^^

winter rose
#

Reaaad the wiki 👀 😅

fervent kettle
#

i did and in game it gave me a missing " ]" error so i thought i could just bracket the whole thing lol

whole plinth
#

class CfgSounds
{
sounds[] = {};
class TerminaField
{
//how the sound is refferd to in the game
name = "TerminaField";
//filename volume and pitch levels
sound[] = {"sound\TerminaField.ogg", 1,1};
//subtitle delay in seconds, subtitle text
titles[] = {};
};
};

#

Dose this look wrong??

oblique arrow
#

It does on a discord level since it isnt inside a code block blep

winter rose
#

@whole plinth use the following formatter around your config :
```cpp
/* your code */
```

oblique arrow
#

what does cpp actually stand for?

winter rose
#

C++

#

C plus plus

oblique arrow
#

ah nifty, thanks

winter rose
#

not to be confused with CCCP

oblique arrow
#

Союз Советских Социалистических Республик
Well thats a chonky name

winter rose
whole plinth
#

The problem I keep having is Sound not found

umbral oyster
#

Is it possible to set the textureNoShortcut of a shortcut button through scripting?

winter rose
#

@whole plinth what are you using as a command?

#

@umbral oyster no key change through scripting no.

#

(imagine the hackers…)

umbral oyster
#

😦

whole plinth
#

playsound

winter rose
#

@whole plinth aaand?

#

show me how you use it please

whole plinth
#

playSound "TerminaField";

winter rose
#

and where did you put the above CfgSounds?

whole plinth
#

in the MPmission folder where the mission file is.

winter rose
#

how

still forum
#

where in the folder

#

exactly

winter rose
#

eh you, weren't you away playing?

still forum
#

just killed a tank and had a few seconds while reloading my AT

whole plinth
#

the sound file is in the sound folder.

winter rose
#

…you are not helping us helping you

#

where did you write this config, where did you place the sound file, how is your mission directory organised!

whole plinth
#

Config is in the this location--mpmissions\Afghanistan%20theater%20war_Jarvis.DYA

#

sound file is in the Afghanistan%20theater%20war_Jarvis.DYA folder

still forum
#

Config is in the this location--mpmissions\Afghanistan%20theater%20war_Jarvis.DYA
not helpful

#

which file

whole plinth
#

The Config is in the main folder of the mission.

#

Which has the actual sound file is in the same folder but has its own folder inside the main folder of the mission.

still forum
#

dude

whole plinth
still forum
#

Description.ext then

#

thats what we wanted to hear when asking "which file?"

whole plinth
#

Oh sorry.

#

??

still forum
#

I'm out of IDEs

winter rose
#

well ```cpp
class CfgSounds
{
sounds[] = {};
class TerminaField
{
name = "TerminaField";
sound[] = { "sound\TerminaField.ogg", 1, 1 };
titles[] = {};
};
};

whole plinth
#

Is there away to get that to activate when a person pass through a trigger??

winter rose
#

@whole plinth yes, in the trigger's properties

whole plinth
#

How dose it look?

#

Trigger On Activation playSound "TerminaField";

#

nvm got it.

spark rose
#
striker enableSimulation true;
_wpstrike = striker_group addWaypoint [getPos strike_building,0]; 
_wpstrike setWaypointType "Destroy"; striker flyinHeight 200;
_wpexit = striker_group addWaypoint [getMarkerPos "strike_exit_mark",0]; 
_wpexit setWaypointType "Move";
hint "striker is coming";
striker_group setCurrentWaypoint [striker_group, 1];
striker doTarget strike_building;
striker doFire strike_building;
waitUntil 
{
    !alive strike_building;
}; 
striker_group setCurrentWaypoint [striker_group, 2];
waitUntil 
{
    striker distance getMarkerPos "strike_exit_mark" < 200; 
};
deleteVehicle striker;
#

Alright crew, see code above. want the jet to come in, bomb the designated target, then exit

#

When close to exit, should delete

#

only he never heads to the exit

winter rose
#

try only using addWaypoint, better

#

or even better, just (do/command)move command

spark rose
#

so i can addWaypoint _wpexit ?

#

maybe i don't know how to call my local variables correctly

#
addWaypoint _wpexit;
#

?

unreal scroll
#

Situation: dedicated server, in a player init script I launch the function with:

player remoteExecCall ["OT_fnc_revivesystem",player];```
The function itself:
```sqf
    private _unitP = _this;
    _unitP addeventhandler ["handledamage",{
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
        if (!((lifeState _unit) isEqualTo "INCAPACITATED") && {isNull objectParent _unit}) then {
            if (_damage > 0.96) then {
                 _damage = 0.96;
                _unit allowdamage false;
//here I've checked all of the params - it is ok
                [_unit,_selection,_instigator] remoteExecCall ["PiR0",2];
            };
        }; 
//...somewhere here enabling damage with delay
        if !(alive _unit) then {
            _unit removealleventhandlers "handledamage";
        };
        _damage
    }];```
The probem: this doesn't call PiR0 function: [_unit,_selection,_instigator] remoteExecCall ["PiR0",2];
The function is visible for server, and passed params are ok (_unit,_selection,_instigator) - I've checked it with marker just before the function call line.
It works, if I call it locally, with local params, like ```[cursorobject, "spine3", cursorobject] remoteExecCall ["PiR0",2];``` - but not in the handler. What I missed?

P.S. In PiR0 function, in the beginning:
```sqf
if !(isServer) exitWith {};
params ["_unit","_selection","_shooter"];
//here I put a marker - and nothing```
Interesting, that it works for AI and "MPHit" handler.
winter rose
#

can you put a marker before the isServer?

#

also, are there any sleep or waitUntil in this function?

#

ah, yeah

#

missing } 🙄

#

@unreal scroll ^

unreal scroll
#

@winter rose Good eye, thanks - but it is the typo: I just don't want to put all of the code here, it works well.
"also, are there any sleep or waitUntil in this function?" - no :)
"can you put a marker before the isServer?" - already checking, it is the last option - then I just add the MPHit EH...
Referring to existing info about handler, the main difference is that it can handle more than one event in one frame - maybe the cause lies here.

winter rose
#

@spark rose

striker enableSimulation true;
hint "striker is coming";
striker_group move getPos strike_building;
striker reveal strike_building;
striker doTarget strike_building;
striker doFire strike_building;
waitUntil { sleep 1; not alive strike_building; }; 
striker_group move getMarkerPos "strike_exit_mark";
waitUntil { sleep 1; leader striker_group distance getMarkerPos "strike_exit_mark" < 200; };
{ striker deleteVehicleCrew _x } forEach crew striker;
deleteVehicle striker;
unreal scroll
#

NB: For missions it is essential to add exit conditions, to avoid endless loops. Like

waitUntil { sleep 1; !alive strike_building or time > _timeout};```
winter rose
#

@unreal scroll if you have the smallest repro mission (ever) for your issue, dm me

round scroll
#

I would like to spawn a tanker aircraft for air to air refueling dynamically. Is there an easy way to determine where the enemy units are on a map to avoid them, if possible?

#

something like bis_fnc_find_safePos but with opposing units in the equation

winter rose
#

@round scroll afaik there is no "all-in-one" solution for this (but I might be wrong)

unreal scroll
#

@winter rose Oh, I doubt it would be easy to track all of the the depedencies (the mod is very complex), but thanks. Anyway, If something doesn't work by selected way, there is always an option to walk another one :)

"Is there an easy way to determine where the enemy units are on a map to avoid them, if possible?"
Only to do the math. The best way I believe is to use random pos, until you find a place where the distance to closest enemy unit >= desired distance.
Use allunits + vehicles arrays.

winter rose
#
private _allFlyingEnemies = vehicles select { side effectiveCommander _x == east && { (getPos _x select 2) > 10 } };
#

from there, use random and distance2D maybe

round scroll
#

he he, so far I was more afraid of the pesky NVA AA and SAMs then MiGs, but good point!

unreal scroll
#

@round scroll sqf private _yourplane = _this; private _desired_distance = 3000; private _placefound = false; while {!_placefound or {conditions for backup exit, like timeout}} do { _placefound = ((allunits + vehicles) findif {side _x isEqualTo *** && {_x distance2D _yourplane < _desired_distance} && {...}}) isEqualTo -1; }; if (_placefound) then {} else {};

round scroll
#

nice, thanks

willow basin
#

Sorry to bother. Probably just me being blind but in one of my function SQF files I declared the params

params [["_posX", 0, [0]], ["_posY", 0, [0]], ["_posZ", 0, [0]]];```

But ArmA 3 throws me an error at my face when loading the mod:
```params [["_posX", -1, [4]], ["_posY", -1>
 0:38:02   Error position: <params [["_posX", -1, [4]], ["_posY", -1>
 0:38:02   Error Params: Type Bool, expected Number
 0:38:02 File \Armitxes_Core\functions\map\fn_isMapResourceAvailable.sqf [ARMI_fnc_isMapResourceAvailable], line 16```

I thought maybe ArmA 3 is interpreting 0 and 1 as false and true so I tried to changed it to
```sqf
params [["_posX", -1, [4]], ["_posY", -1, [4]], ["_posZ", -1, [4]]];```

But it makes no difference 😐 can someone tell me what I'm overseeing? Any help is appreciated.
solemn token
#

Put a
diag_log str _this;
On the top of your function. So you can check what input cause the error

still forum
#

your function is being called with wrong input

#

nothing wrong with your params

willow basin
#

Good idea with the diag_log. Actually there should be nothing calling these functions. I'm only declaring them, and not calling them in any script.

Now I just get

diag_log str _this;
params [["_posX", 0, [0]], ["_posY", 0, >
 1:09:13   Error position: <params [["_posX", 0, [0]], ["_posY", 0, >
 1:09:13   Error Params: Type String, expected Number
 1:09:13 File \Armitxes_Core\functions\map\fn_isMapResourceAvailable.sqf [ARMI_fnc_isMapResourceAvailable], line 17
 1:09:13 Error in expression <e]"















diag_log str _this;
params [["_posX", 0, [0]], ["_posY", 0, >
 1:09:13   Error position: <params [["_posX", 0, [0]], ["_posY", 0, >
 1:09:13   Error Params: Type Bool, expected Number
 1:09:13 File \Armitxes_Core\functions\map\fn_isMapResourceAvailable.sqf [ARMI_fnc_isMapResourceAvailable], line 17```

In the logs ^^ will test further 😐
#

But you seem to be correct Dedmen. Something is calling it, types are changing. No idea what since I just made it but atleast I know that my params are set correctly 🙂

willow basin
#

Thanks for the help. My issue is solved -.- My function was called with [""postInit"",1]. Did mess up my CfgFunctions class isMapResourceAvailable { postInit = 1; };.
Removing the postInit solved the issue. Got something mixed up there.

still forum
#

@willow basinyou could've used my debugger, it would've printed you a callstack with all arguments to RPT and you would've seen where it was called from 😉

willow basin
#

Text the makers of the mod. Often something can be arranged. Mostly to prevent reuploads or credit thieves.

#

You would be surprised how many don't care about licenses and terms. And mod owners are tired running after everyone. Anyways, I think this is the wrong channel 😉

young current
#

asking to use something usually can result in a solution both parties are happy with.

#

but keep this channel on topic of scripting

high silo
#

Is there a way to limit who has access to my addaction?

oblique arrow
#

Doesnt addaction have a condition field?

high silo
#

Possibly but no sure how to set it up

robust hollow
high silo
#

Im reading it now

#

I just cant get it to work

spring lodge
#

whats the code?

high silo
#

Probably for a very obvious reason

#
object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]```

I filled it with 

```this addAction ["Open Strategic Map", "openMap.sqf", "", "", "", "", "", "", "5", "", "", ""]```
spring lodge
#

what condition are you trying to use?

#

who are you limiting it to

robust hollow
#

some of those arguments arent even the right type?

high silo
#

Trying to limit the radius, and only allow certain people to use it

spring lodge
#

so whats not working? the radius or is it not showing up?

robust hollow
#

this addAction ["Open Strategic Map", "openMap.sqf", "", 1.5, true, true, "", "true", 5]

high silo
#

Will try that connor

#

So that works, but where do I put the variable name I want to limit it too?

spring lodge
#

in the condition field

robust hollow
#

or if it is just a number you can replace the 5 with it

#

i dont remember if radius hides the action or just doesnt let you activate it. if it doesnt hide it, use the condition.

high silo
#

_this: x for example?

#

In the condition?

robust hollow
#

no?

#

_this distance _target < 5

high silo
#

Player 5 Whiteboard < 5

#

Like that?

robust hollow
#

no.

#

still no.

#

what I wrote above will make sure the player wont see the action unless they are within 5 meters of the object the action is on.

high silo
#

Yeah, but what im wanting to do is limit who can see it as well

robust hollow
#

ok, so only add it to the units you want to be able to use it

high silo
#

But then it will show constantly on there screen if I put it in the init of the player

robust hollow
#

if you're doing it wrong sure.

#

give the object the action should be on a variable (say whiteboard in this case). then give each unit a variable name (say unit1 in this case, where the number increases for each unit). then in the player init do something like

if (player in [unit1,unit2,unit4]) then {
  whiteboard addAction [/* arguments */];
};

or something like that

#

alternatively you can set a variable to the units you want to see it

if (player getVariable ["canUseWhiteboard",false]) then {
  whiteboard addAction [/* arguments */];
};
#

or one of many other ways you could restrict who can see it.

high silo
#
if (player in [Bigdaddy]) then { 
  whiteboard addAction ["Open Strategic Map", "openMap.sqf", "", 1.5, true, true, "", "true", 2]; 
};
``` I did this but it isnt working, have I missed out on something and im just being dumb?
oblique arrow
#

btw if you put 'sqf' after the ``` at the top you get the fancy colors

#

at the top

robust hollow
#

check pinned messages

high silo
#

ayy

#

but ya I cant get it to work

spring lodge
#

whats [Bigdaddy]

#

?

#

is that your name?

high silo
#

ya

spring lodge
#

dont think that works

high silo
#

So I got it to work via a trigger, but its still accessible to everyone, I only want certain people to see and use it

#
if (isPlayer BigDaddy) then {
whiteboard addAction ["Open Strategic Map", "openMap.sqf"]; };
``` I was using this and it worked.
#

I shortened the argument just to test

spring lodge
#

to see what their steam profile name is

high silo
#

I want it to be a slot instead

#

But thats useful to know

spring lodge
#

in the editor if you set the slots variable name you can do if (player == variable name)

#

and i dont think isPlayer works, all that does is check if BigDaddy is a player, not if the current player is bigdaddy

high silo
#

Will try that

#

Still yields same result

spring lodge
#

bad result?

#

where are you running the script?

high silo
#

Trigger

#

I couldnt get it to work in variable

#

Will try with the new change though

spring lodge
#

if you use initPlayerLocal.sqf

#

then it should work

high silo
#

Idk what that is

spring lodge
#

just make a file in your mission called initPlayerLocal.sqf

#

and it will run locally for all clients connecting

high silo
#

Will do

#

Same result, I dont want it to be accessible for other players, but certain people can access and use it at the same time

spring lodge
#

so what have you put in initPlayerLocal

high silo
#
if (Player == BigDaddy) then {
whiteboard addAction ["Open Strategic Map", "openMap.sqf"]; };
spring lodge
#

player should be lower case

#

and the role is named BigDaddy?

high silo
#

Ya, im using zeus to test it though so idk how accurate it is

#

remote controlling AI

spring lodge
#

im not sure about remote controlling

high silo
#

Will have to look into it

spring lodge
#

works for me

grim wing
#

how do I change the distance of scroll wheel option from an AI

upbeat stag
#

Hey guys, new to scripting and this fourm but this seems to be the right place, long story short. I have a night mission where players are going to use flashlights but I want a small amount of ambient light to glow around the players, essentially im trying to achieve this by making any REAL player who joins have a glowing ball of light spawn on them and be attached to them, issue I am currently having is that even though in SP Eden testing, the orb attaches to me but for some reason it seems to be laggy, the orb is trailing me but not smoothly. Hard to explain, here is the code bit I have for right now. ```_players = allPlayers;

while {1 > 0} do{

_lightSource = [] spawn {
lampLight = "#lightPoint" createVehicle position player;
lampLight setLightBrightness 0.65;
lampLight setLightColor [.60,.60,1];
lampLight setLightAmbient [.60,.60,1];
};

sleep 10;

                    {_x attachTo [_players, [-0.1,0.1,1.15],"Pelvis"]} forEach _players;
            };``` Any advice would be appreciated, and please keep it simple for my monkey brain
#

ignore the sleep portion of that, I was trying to see if that had anything to do with the jumpy look of the light, ranged the value from 0.1 to 10 and not using sleep at all. Didn't make a difference.

robust hollow
#

in my experience lightpoints just dont move smoothly when attached to objects.

#

then again, the notes say

When attached, movement is slow to update (jumpy). Use attachTo when attaching a light to moving objects.

upbeat stag
#

See thats the exact note I saw too, but it seems that they both behave similarly. Both are jumpy, basically it creates a light at my pos, as I walk in a straight line, it creates 1 or 2 new light sources a second, with them expiring within about 6 seconds. Its like im playing a game of snake honestly.

robust hollow
#

oh, i didnt read your snippet tbh. give me a sec ill fix it up.

upbeat stag
#

Thats fine, ideally I would like to create "Camping Lamps" and attach them to players with a switchLight addAction on the lamp, but thats beyond my knowledge at this moment.

robust hollow
#

ideally, you wouldnt use a loop for this at all. instead you would create the light once in the player init. something like

private _lightSource = "#lightPoint" createVehicle position player; 
_lightSource setLightBrightness 0.65; 
_lightSource setLightColor [.60,.60,1]; 
_lightSource setLightAmbient [.60,.60,1]; 
_lightSource attachTo [player, [-0.1,0.1,1.15],"Pelvis"];
upbeat stag
#

player init? IS that like an init.sqf but for each player as they join?

#

I'm sorry I literally just picked this up like Monday

robust hollow
#

for this you could use initPlayerLocal.sqf, works the same as init.sqf, but it only executes for the connecting player.

it should start by waiting for the player object to be ready. I dont know how the smart people like to do it these days but i've never had issues with the following.

// initPlayerLocal.sqf
waitUntil {player isKindOf "CAManBase"};
private _lightSource = "#lightPoint" createVehicle position player; 
_lightSource setLightBrightness 0.65; 
_lightSource setLightColor [.60,.60,1]; 
_lightSource setLightAmbient [.60,.60,1]; 
_lightSource attachTo [player, [-0.1,0.1,1.15],"Pelvis"];
#

it's worth noting light points are local. so players will only see their light point. if you want players to see everyone's light points, you would need to modify that ^ a little and make it execute for every player when one joins.

upbeat stag
#

Thank you for the edit! btw just so I know, what does this piece do? waitUntil {player isKindOf "CAManBase"};

robust hollow
#

it waits for the player object to actually be a man type.

hallow mortar
#

basically, for a short period when they're connecting and loading in, the player exists as some kind of weird virtual half-entity, and some things don't work properly if they're done to the player while in that state. That code waits for them to become a real human bean before doing anything.

#

also, don't forget about the new Light Cone objects from Contact. They're useful and can be modified!

upbeat stag
#

Thank you again @robust hollow and thank you for the input as well @hallow mortar, Im going to finish this here in a few minutes and then im going to try the lantern with the ability to toggle the light on and off.

quartz pebble
#

Which way do I use to find UXO on the map globally?
allMissionObjects "<something>" ?

unique sundial
#

to find UXO
whats that

quartz pebble
#

unexploded ordnance - when you drop a cluster bomb, it pollutes the map with its unexploded parts which you need to clean up by a script

fleet hazel
#

Guys. RPT spam

Warning: Cleanup player - person 2:1862 not found
Warning: Cleanup player - person 2:1862 not found

When exiting the game

verbal rivet
winter rose
#

assignedVehicle @verbal rivet

verbal rivet
#

I've tried quickly, assignedVehicle returns something only for actual vehicle crew

#

At least according to the docs, but in any case thanks for suggestion

winter rose
#

It's the closest we have, unfortunately

fervent kettle
#

Lou, I've tried that weather thing you told me yesterday. It worked in Eden MP but when uploaded onto a server it doesn't seem to work

winter rose
#

@robust hollow ```sqf
waitUntil { not isNull player };

robust hollow
#

ive had trouble with a rare issue where the player loads in as a bird, figure the way i wrote might also wait for that extra condition of being an actual person 🤷‍♂️

winter rose
#

fair enough 😂

tough abyss
#

Hi All!!

Anyone knows how to change an image size in a HintC text?!

I'm usint this but if I try yo type the "size" attributes it doen't work and shows me an erro:

_separator = parseText "<br />";
_image = "help_faid.paa";
_txt = composeText [_separator, image _image ,_separator, _separator, "USE THE FIRS AID KITS.", _separator1, "TO CURE YOURSELF"];
"HELP!" hintC _txt;

robust hollow
#

how were you trying size?

tough abyss
#

bcause my image is displayed as 16x16px very very small

wheat island
#

So I'm kinda new to this discord. Can I throw scripts in here and someone tell me if it's borked?

#

looking to bounce ideas off a couple people

robust hollow
#

were you trying it like this though? in my mind this should work

composeText [_separator, "<t size=2>", image _image, "</t>",_separator, _separator, "USE THE FIRS AID KITS.", _separator1, "TO CURE YOURSELF"];

alternatively you could try

composeText [_separator, "<img size=2 image='", _image, "' />",_separator, _separator, "USE THE FIRS AID KITS.", _separator1, "TO CURE YOURSELF"];
#

@wheat island no harm in trying.

wheat island
#

Awesome.

So, I'm attempting to create a "Clear Vehicle Inventory" script, which can be executed once you're inside the driver's seat of a vehicle. I was thinking of something similar to what's below.

addAction for each vehicle```sqf
_this addAction [
"<t color='#ffff' font='' size='1.2'>Clear Vehicle Inventory</t>",
"scripts\client\clearInventory.sqf",
[],
10,
yes,
false,
"",
"driver vehicle == player",
];

scripted code ```sqf
// Add action parameters
params = ["_target", "_caller", "_argumentID", "_arguments"];

// Clear the vehicle's inventory.
_target clearBackpackCargoGlobal;
_target clearWeaponCargoGlobal;
_target clearItemCargoGlobal;
_target clearMagazineCargoGlobal;
#

Thoughts? Improvements?

robust hollow
#
params = ["_target", "_caller", "_argumentID", "_arguments"];

👇

params ["_target", "_caller", "_argumentID", "_arguments"];
#

no need to define the other variables if you dont use them

#

yes -> true (unless that is a variable which is mildly weird imo)

wheat island
#

so I could get away with just _target?

robust hollow
#

shouldnt need to define font='' unless you are specifying a font

#

yea in that snippet _target is all you need

wheat island
#

ok

#

and yeah the <t> stuff is placeholder until I go and actually look up the font face and hex codes

robust hollow
#

"driver vehicle == player" unless vehicle is a variable you might be meaning "driver vehicle player == player"

wheat island
#

hmm

#

yeah im just trying to get whoever's in the drivers seat, and give them an addaction

robust hollow
#

yea what i suggested then

wheat island
#

awesome

#

_this addAction [
    "<t color='#ffff' font='placeHolder' size='1.2'>Clear Vehicle Inventory</t>",
    "scripts\client\clearInventory.sqf",
    [],
    10,
    yes,
    false,
    "",
    "driver vehicle player == player"
];

params ["_target"];

clearBackpackCargoGlobal _target;
clearWeaponCargoGlobal _target;
clearItemCargoGlobal _target;
clearMagazineCargoGlobal _target;```
How's that look?
quartz pebble
#

How to find stringtable codes for standard arma action menu items?
Say, "Engine On", "Get Out", "To Passenger seat"

robust hollow
#

personally i search the string tables manually.

#

@wheat island change that yes to a true and I think it should be decent. assuming those are still two different snippets like they were earlier

round scroll
#

is nearEntities broken or changed its behaviour? This code used to work in 2017/2018: private _entities = (getPos _crane) nearEntities [ ["Plane"], 10 ];

#

would find the planes in 10 meter radius around the crane, but now I don't get any result, just empty array

#

oerks, maybe the getPos ruins it

#

yes, that's it, nevermind

finite sail
#

not sure why getpos would break that @round scroll , nearentities can accept an object or a position for that param. It's possible something else is not working as expected

round scroll
#

it seems to work in VR but not on the Nimitz, I guess it's some problem with ATL vs ASL inside nearEntities and a pos

finite sail
#

ah, on a ship?

round scroll
#

yeah

#

let me check that quickly

finite sail
#

I think... if you provide a 2d position, the check is not spherical

round scroll
#

sorry, just tested this, with getPosATL it returns [], with getPosASL it returns [p]: hint str ((getPosATL t) nearEntities [ ["Plane"], 10])

finite sail
#

let me rephrase.. the check is 3d if you provide an object or 3d pos... the check is 2d (alititude ignored) if you provide an [x,y] type

round scroll
#

ah, like [getPos t # 0, getPos t # 1]

finite sail
#

yes

round scroll
#

understood now

signal kite
#

Hello! How to select a random group from "CfgGroups"? (I would like to use it with BIS_fnc_spawnGroup)

finite sail
#

but be aware, with the 2d check, it will return any aircraft directly overhead your 2d pos, regardess of altitude

#

so even 2000m above the ship

round scroll
#

yeah, I just the crane instead of it's position and all is good

finite sail
#

ok cool

tough abyss
#

@robust hollow I'tried, bit it does not work

#

i also tried:

_separator = parseText "<br />";
_image = "help_faid.paa";
_txt = composeText [_separator, "<img size='2' image='", _image, "' />" , _separator, _separator, "USE THE FIRS AID KITS.", _separator1, "TO CURE YOURSELF"];
"HELP!" hintC _txt;

but nothing

winter rose
#

@tough abyss try

private _txt = parseText "<br /><img size='2' image='help_faid.paa' /><br /><br />USE THE FIRST AID KITS<br />TO CURE YOURSELF.";

"HELP!" hintC _txt;
tough abyss
#

Great!! it works!!!

#

thak you vey much

waxen cape
#

Okay

#

I'm new so sorry if I'm dumb. I want to set up a spawn point where when they spawn they go into patrol and into houses and stuff like that. I have a spawn point setup with the options. Sector tactic and spawnpoints setup

finite vigil
#

hi, does anyone knows how to get the "caller" from a useraction defined on a config? the script is in a vehicle and the caller should be anyone who calls the action ,I got in the config user action : statement = "[this] execVM ""\mlv_static01\scripts\milan\reload.sqf"";";

winter rose
waxen cape
#

I want to set up an ai when it spawn it will patrol does anyone have a video or something for that

winter rose
#

this one happens in Zeus but it is the same in Eden Editor

waxen cape
#

How do I do that on troops that spawn in?

#

I'm using the spawn ai modual

winter rose
#

oh, IDK
scripting, I suppose

waxen cape
#

I have zero experience in any scripting other than today lol

winter rose
#

I don't know how you could do this with these modules.

cosmic lichen
#

for a patrol

#

use BIS_fnc_taskPatrol, or if you have CBA you can use the CBA version of taskPatrol

finite vigil
compact maple
#

Hi, is there an explanation for this code to work in my debug console but not in a script I spawn ?

addMissionEventHandler ["Draw3D", {
  drawLine3D [ASLToAGL eyePos player, [3292.97,12960.5,0.00142646], [1,0,0,1]];
}];
waxen cape
#

Where can I post a picture I'm have a lot of issues I need help with

winter rose
#

@compact maple yes, if you spawn it on the server and not on the client

#

@waxen cape you can post on e.g imgur and link it here (with description, see #rules)

waxen cape
#

Okay I figured it out idk what was going on really

#

My question though how would I create a code that when a player died he respawns with a default loadout

#

Or just spawns at all really

#

I'm trying to make it to where when you spawn you will only have certain cloths on and no weapons so you go to the arsenal and stick up and load up or whatever is there a way to do that

winter rose
#

you can use the respawn event handler yes

waxen cape
#

Where is that?

#

Nevermind I found a way around it XD

#

I guess lol

#

I just start with no loadout I made custome guys and added them to my custom saves and when into multiplayer options and clicked save loadout so now when they respawn they respawn with nothing lol works well ig

loud python
#
_target addEventHandler ["killed", {
    params [ ["_target", objNull] ];
    private _position = position _target;
    private _class = typeOf _target;
    sleep 3;
    deleteVehicle _target;
    sleep 3;
    createVehicle [ _class, _position, [], 0, "CAN_COLLIDE" ];
}]

Arma is telling me "generic error in expression" in the second sleep 3; line

#

any idea what that might be?

still forum
#

you cannot sleep in a eventhandler

loud python
#

oh

still forum
#

they are unscheduled

loud python
#

I see

#

so I have the EH just use spawn?

still forum
#

ye

loud python
#

Seems to have worked

#

thanks ❤️

viral basin
#

hey, if i have 60fps does onEachFrame executes the script 60 times a second so does it adjust the execution time to my fps? If so - isn't it more efficient to use onEachFrame instead of a sleep 0.01 (execution time 100 times a second)? Or am i wrong in the matter of performance?

loud python
#

weird question:
Assuming I have a long script that, at the very end, sleeps for a long time and calls some simple cleanup code

#

is it a good idea to actually spawn code that does only the cleanup stuff?

#

does a piece of code keep any considerable amount of state around to make this in any way helpful?

#

I'm asking it as more of a hypothetical question; I don't have any code long enough to make this relevant, but I'm kinda curious

astral dawn
#

I want to open the CBA settings of my mod through script (the menu in esk->addon options). Is it possible to do this?

_

#

sleep 0.01 (execution time 100 times a second)? Or am i wrong in the matter of performance?
Sleeping less than frame interval is useless to achieve higher execution frequency, scheduler will only resume to your script once per frame

#

hey, if i have 60fps does onEachFrame executes the script 60 times a second so does it adjust the execution time to my fps?
it just calls your code once per each frame

#

if you code takes 10ms to run, each frame will become 10ms longer, framerate will drop

#

@loud python sorry I don't quite understand the question

viral basin
#

Sleeping less than frame interval is useless to achieve higher execution frequency, scheduler will only resume to your script once per frame
@astral dawn makes sense, thanks 😁

loud python
#

remember those oldschool games where some things went faster with unlocked framerate?

#

that's one reason

astral dawn
#

ugh?

loud python
#

that's a thing that happened with some older games

astral dawn
#

In arma SQF we are locked to game's frame rate

loud python
#

there was some game that didn't run over 30 FPS on PC and people modded it to unlock the framerate

#

suddenly their cars went faster

astral dawn
#

And arma runs as fast as the hardware allows it... so... what are we questioning now? 🤔

loud python
#

at 60fps all the cars went twice as fast, etc.

#

aka. the devs had actually tied the speed of certain in-game things to the frame rate

#

so for any kind of simulation like that, you wouldn't want to run something each frame, but in a set interval

astral dawn
#

...or you could multiply your simulation results by delta time (inverse of frame rate)

loud python
#

well, in my example, they probably wanted to do that but forgot

#

and since they only ever tested with 30fps they must have just forgotton

astral dawn
#

so for any kind of simulation like that, you wouldn't want to run something each frame, but in a set interval
with SQF we can't run anything detached from main thread (and its frame rate)

#

anyway what did you want to know about your 'weird question'?

loud python
#

the one with the extra spawn?

astral dawn
#

yeah I didn't understand...

loud python
#
private _lotsOfMemory = lotsOfMemory;
// Do more stuff here, using some more memory, etc.
sleep 1000;
player setDamage 1;
#

imagine a case like that

#

your script is 99% done, but you're sleeping for a long while just do do some last action

#

that means the game keeps the _lotsOfMemory variable around

#

so it uses up memory until the script finishes, right?

#

so would it make sense to instead write

// same as above
spawn { sleep 1000; player setDamage 1 };
#

would that help in any way?

astral dawn
#

so it uses up memory until the script finishes, right?
yes

so would it make sense to instead write

// same as above
spawn { sleep 1000; player setDamage 1 };

well it would free the memory, yeah

#

variable goes out of scope - memory is freed (if nothing else is pointing at that data)
this is true for scheduled and unscheduled code

loud python
#

is there some other more idiomatic way to free the variable?

astral dawn
#

_lotsOfMemory = 0;
it will unref whatever the variable was pointing at

loud python
#

okay

still forum
#

In arma SQF we are locked to game's frame rate
you can at most execute 3 times per frame

loud python
#

never been a fan of clearing variables by reassigning, but I guess SQF just isn't a very refined scripting language in general

still forum
#

reliably tha... semi reliably that is

astral dawn
#

I don't recall anybody care about memory in SQF much... except for some rare cases. You can check how Intercept is done, it implements SQF's variable types

#

you can at most execute 3 times per frame
through different kinds of events?

still forum
#

would that help in any way?
loose CPU time, which is way more important, and gain a tiny bit of memory.. Don't see why, seems rather stupid

#

through different kinds of events?
Yes

astral dawn
#

Don't see why, seems rather stupid
well maybe he wants to allocate a gigabyte, for something 😄

loud python
#

loose CPU time
How so? I see how you'd loose a bit of that, but is spawn an expensive operation?

astral dawn
#

sleep will make the game check every frame 'is this script done sleeping yet?', but there are not many other options to achieve it, IMO it's fine

loud python
#

wait, seriously?

#

isn't there some sort of optimization in place?

#

like having an ordered queue of all the sleeping event and always only checking the top one?

astral dawn
#

I don't know how it's implemented but I assume that it checks all scripts

still forum
#

no and no

#

its still bad tho

#

cookie

#

yum yum

loud python
#

no and no what?

#

huh?

still forum
#

yes queue, no optimization, no only top one, not all scripts

#

sleep doesn't check every frame

loud python
#

ouch

#

that's bad

#

bis plz fix

astral dawn
#

why is it 'bad'.... ? I don't think that it will affect anything in general case if it's changed

still forum
#

no

#

its good nuff how it is

polar anchor
#

hi, how do i check if someone didn't select an item from a listbox?
here's what i tried but doesn't work and i get error zero divisor as error when i don't select the item and i press a button to execute an action that needs the item selected


_pos = [100, 100, 0];
_index = (lbCurSel 1500);
_player = (playerList select _index);

if (index != -1) then {
_player setPos _pos;

hint format ["U teleported %1 at %2", (name _player), _pos];
};```
queen cargo
#

Zero divisor? Should only occur with a / 0

robust hollow
#

playerList select _index would do it with this too i think?

#

if it is outside the range

queen cargo
#

Was that the Zero divisor error there too?

robust hollow
#

next issue in that snppet is if (index != -1) then { should probably be if (_index != -1) then {

#

ill double check. im like 80% sure it gives a zero divisor error for selecting outside the range of an array

#
 8:43:00 a = [0,1,2];
 8:43:00 b = 5;
 8:43:00 Error in expression <a select b>
 8:43:00   Error position: <select b>
 8:43:00   Error Zero divisor
#

doesnt happen when using the array and number directly, but when referencing them as variables it throws the error 🤔

polar anchor
#

ye, mb i missed _

#

but still get the problem

upbeat stag
#

I'm back ladies and gentlemen, im having an issue with a random equipment spawner on ai's in my mission, I have everything successfully spawning on my units as far as uniforms, backpacks, headgear, & weapons, BUT I can not seem to get them to spawn with ammo that cooresponds with the random weapon they are given, I found a loot script online that spawns weapons on the ground with magazines for the gun next to them and it runs fine in the game. ```if (_type == 0)
then {
_weapon= weaponsLoot call bis_fnc_selectRandom;

    _magazines = getArray (configFile / "CfgWeapons" / _weapon / "magazines"); 

_holder addWeaponCargoGlobal [_weapon, 1];
            };``` The above piece is the snippet im using to try and modify from a random ground loot script I found online. The below snippet is what I have but for some reason it throws an "Error Generic error in expression at   ```..."CfgWeapons"|#|/ _weapon...``` So I was hoping somebody can guide me on how to achieve placing ammo in the ai's inventory.```_weapon = ["hgun_ACPC2_F","hlc_Pistol_M11","hgun_PDW2000_F","hlc_smg_mp5a4"];

_this AddWeapon (selectRandom _weapon);

_magazines = getArray (configFile / "CfgWeapons" / _weapon / "magazines");
_this addMagazines [_magazines, 3];```

robust hollow
#

@polar anchor most likely cause is selecting outside the array range. be is from no list item being selected (_index = -1) or the selected item being above the array range.

#

@upbeat stag is _weapon a string in the first snippet?

#

second snippet might work like this

_weapon = selectRandom["hgun_ACPC2_F","hlc_Pistol_M11","hgun_PDW2000_F","hlc_smg_mp5a4"];
_this addWeapon _weapon;

_magazines = getArray(configFile / "CfgWeapons" / _weapon / "magazines") param [0,""]; 
_this addMagazines [_magazines, 3];
upbeat stag
#

Yeah its a very long piece so I only cut the piece where im taking the getArrray line to idenetify the weapon in the players hands to identify the magazzine class.

#

@robust hollow Jesus you're insane. i've been looking at this for like 1 - 1/2 hours trying not to bother anybody and you got it in like 3 minutes.

robust hollow
#

👍

lofty anchor
#

Hey anyone see a syntax Error here i cant seem to get this to work

createBase.sqf form the Dynamic Bulwarks by Hilltop & omNomios

[bulwarkBox, ["<t color='#ff0000'>" + "Virtual Arsenal: 1000p", "
    _player = _this select 1;
    _points = _player getVariable 'killPoints';
    if (_points >= 1000) then {
        [_player, 0] remoteExec [ "Open", [ true ] ] call BIS_fnc_arsenal;
        [_player, 1000] remoteExec ['killPoints_fnc_spend', 2];
    };
","",1,false,false,"true","true",2.5]] remoteExec ["addAction", 0, true];```
robust hollow
#

well, u are clearly missing an end quote somewhere

#
[bulwarkBox, ["<t color='#ff0000'>" + "Virtual Arsenal: 1000p", "
    _player = _this select 1;
    _points = _player getVariable 'killPoints';
    if (_points >= 1000) then {
        [_player, 0] remoteExec [ 'Open', [ true ] ] call BIS_fnc_arsenal;
        [_player, 1000] remoteExec ['killPoints_fnc_spend', 2];
    };
","",1,false,false,"true","true",2.5]] remoteExec ["addAction", 0, true];
#

try that?

lofty anchor
#

yeah i cant figure out what i done wrong & iv tried removing the double " " from Open its get rid of the error spends the point when you use it but doesn't open the VA

robust hollow
#

well yea, this isnt how remoteexec works

[_player, 0] remoteExec [ "Open", [ true ] ] call BIS_fnc_arsenal;
#

you got it correct on the next line ```sqf
[_player, 1000] remoteExec ['killPoints_fnc_spend', 2];

#

have you changed it to just [ "Open", [ true ] ] call BIS_fnc_arsenal;?

lofty anchor
#

if id do

[bulwarkBox, ["<t color='#ff0000'>" + "Virtual Arsenal: 1000p", "
    _player = _this select 1;
    _points = _player getVariable 'killPoints';
    if (_points >= 1000) then {
        [ "Open", [ true ] ] call BIS_fnc_arsenal;
        [_player, 1000] remoteExec ['killPoints_fnc_spend', 2];
    };
","",1,false,false,"true","true",2.5]] remoteExec ["addAction", 0, true];

i get missing ] error

robust hollow
#

oops, fix the quotes again

lofty anchor
#

oh yeah

#

yeah works now Facepalm i tried that first and if id have changed the " to ' it would have worked

light moat
#

hey so, does anyone have that script that allows me to spawn more units after the cap is hit?

young current
#

what cap?

warped shuttle
#

Someone would be kindly teach me hows check "if players in spectator" please?

I need the script to stop looping when the player is in Spectator.
(!alive is not should be use. Because I need runs same at if player in spectator but is still alive.)

light moat
#

@young current after a certain point i can no longer spawn opfor unit

young current
#

in where, how do you spawn them, how many have you spawned?

#

details details details

light moat
#

zeus, spawned them in groups then ungrouped them, I know there is a group spawn cap. I spawned too much kek. there was a script i remember using that I would run in global

#

It would allow me to create more groups again

young current
#

have you checked the forums for that script?

light moat
#

I have, I cant find it, I know it exists @young current

young current
#

Very likely it does indeed. I remember such being mentioned before.

light moat
#

found it!

jagged elbow
#

Anyone able to tell me why, in this script, the addWeapon isnt working? Everything else functions fine but the player doesnt get the weapon.

akWeapon addAction ["Buy AK-74 - £100",
{
  if (cash >= 100) then
  {
  _unit = (_this select 1);
  _UID = getPlayerUID _unit;
  _unit addWeapon "Weapon_arifle_MX_F";
  cash = cash - 100;
  null = [_UID] execVM "saveData.sqf";
  }else
  {
  hint "Not Enough Cash";
  };
}];
spring lodge
#

capital w for weapon?

#

try with a lower case

#

_unit addWeapon "weapon_arifle_MX_F";

jagged elbow
#

Ye was just about to type, copied the wrong class name aha

spring lodge
#

just looking it should be without the weapon

jagged elbow
#

yea it is

tough abyss
#

Heya everyone,

Very basic question: I would like to select every option from an array once.
As I understand it, selectRandom works with replacement (an item may be reselected again). I want to selectRandom without replacement. Is there a command for this?

wheat island
#

Question: When you load a popular mission file, such as BMR Insurgency, it plays a startup sequence, where it moves the camera to your player. Can anyone show me/link me to how that's done?

Alternatively, some missions have the Tanoa single player campaign start, where it says [ SPACE TO CONTINUE ] on the bottom of the screen. Seeing as this might be easier, how would I go about implementing this?

Thank in advance!

robust hollow
#

@tough abyss like this perhaps?

_element = _array deleteAt (round random (count _array - 1));

selects a random index of the array, deletes the element to prevent selecting it again and returns it at the same time.

tough abyss
#

thankyou!

robust hollow
bitter stump
#

Is there anyway to remove Armor Stacking? Ex. CSATS and Carrier Lights? Worn together

oblique arrow
#

No crossposting please @bitter stump

bitter stump
#

Yeah that's my bad just saw this scripting channel

oblique arrow
#

Then delete the message in the other channel(s) please

bitter stump
#

Done

loud python
#

Hey so, bohemia made a new engine, right? does that still use SQF?

real tartan
#

Is there a way to list all "string_names" from Stringtable.xml in game? I want to check if I need to translate some strings or use already translated from game.

winter rose
#

@loud python so far, no

#

@real tartan use isLocalized

loud python
#

Is there any info in whether they will ditch SQF?

#

personally I'd love it if they would switch to a nicer language like Lua

robust hollow
#

dayz is already using what they are moving to isnt it?

loud python
#

the new engine, IIRC

robust hollow
#

yea, with the new language

loud python
#

is that game scriptable though?

winter rose
#

@loud python yes - see DayZ Enscript

loud python
#

ugh... looks like C

loud python
#

no

#

actually

#

it's worse

#

it looks like C++

#

I miss SQF already

winter rose
#

"buh-bye…!"

loud python
#

not sure if I should be happy they didn't pick python

winter rose
#

SQF has lived, I believe
maybe there will be an SQF support, but I honestly do not believe this is a priority, at least right now

loud python
#

I mean, SQF wasn't a particularly good language either

#

better than C++, but that doesn't take much

winter rose
#

C++ will require people to know what they are doing!

loud python
#

lel C++ would require compilers to know what they are doing, which has been proven impossible

winter rose
#

EnScript should also be (way) more performant

tough abyss
#

Hey guys, quick question.

I'm not too knowledgeable on scripting, but has there been any word if scripting in Arma 3 will translate into script support for the Enfusion Engine?

winter rose
#

Question asked just above, plz read 🙄 @tough abyss

loud python
#

first of all, if you are good at any scripting language, you will be able to take many skills to any other scripting language, unless it's something intentionally built to be hard for humans to use like brainf*ck

tough abyss
#

Sorry, just rolled in. All I saw was about SQF and thought it was a different question

#

Okay, that's fair.

I've heard knowing a programming language makes it incredibly easier to learn other ones by comparison, I just didn't know if scripting was a fair comparison to that.

loud python
#

ugh... I find the choice of going with the C syntax of for loops... questionable

tough abyss
#

Thank you for the help, looks like I'll be trying to learn it then.

winter rose
#

for int i = 0; i < 100 ; i++?

loud python
#

like, I love that syntax for C; it makes sense there, but I think the world of scripting language has moved away from that a decade ago and is now switching from the from a to b type syntax to functional stuff like map, inject & co.

#

something even SQF already supports to an extent

#

ugh... didn't even understand what you meant in your first message, sorry

#

years on the internet and still can't understand cultures where people take offense at indirect speech

winter rose
#

I know, but #rules are #rules (and I have to enforce them)
What I don't get is why they don't set the memory management to "automatic", the modding community will be responsible for many memory leaks I guarantee you!

loud python
#

yeah yeah, I understand that, just pointing out why I didn't even notice at first xD

#

What I don't get is why they don't set the memory management to "automatic"
Wait, what?

#

does enforce have no GC or what?

winter rose
#

There is, but you have to set it to autoptr or something

loud python
#

pfffff...

#

welcome to the 90s, I guess

winter rose
#

Hard reference, soft reference etc

loud python
#

BIS can we get Lua please?

#

LuaJIT (even with the JIT disabled) would be like 10 times better for this...

#

( <= this guy is kind of a Lua fanboy, btw.)

verbal rivet
#

A question about file patching. I want to make a PR into ALiVE mod, and so want to test my changes before submitting.
Am I correct that I need to create relevant directory in game folder (e.g.: "ArmA 3\x\alive\addons\mil_ied"), copy the relevant sqf-file there and run game with -filePatching?
(I want to edit this file: https://github.com/ALiVEOS/ALiVE.OS/blob/master/addons/mil_ied/fnc_IEDInit.sqf, it seems to include from that dir: \x\alive\addons\mil_ied\script_component.hpp