#arma3_scripting

1 messages Β· Page 100 of 1

warm hedge
#

Quick Q: Does missionDifficulty return other number than -1 if is a MP session and forcedDifficulty is set in server cfg?

kindred tide
#

is it true that init.sqf is always executed after all init EHs at the mission start?

warm hedge
tulip ridge
#

What "normal" programming language would people consider is closest to sqf?

granite sky
#

Any general programming language similar to SQF would have been strangled at birth.

still forum
#

Depends on why you are asking

warm hedge
#

At least it is not 01010110100110 thingy

queen cargo
#

@grizzled cliff interesting, abusing locations as sqf namespace. But that could confuse some scripts which rely on locations or do i miss something?

tulip ridge
tulip ridge
tulip ridge
granite sky
#

I feel like you'd have to go back a way to find an interpreted language where the primary data structure is an array.

#

VB? :P

sullen sigil
#

the engine it is for, however, not so much

#

looking at the biki for sqf to enfusions language makes me sad for a lot of things i liked going

kindred tide
#

is A4 not gonna have sqf?

split oxide
#

Reforger uses enforce, so probably not

south swan
#

and at this point what i've seen of enforce looked like triple the code for half the effect compared to SQF, tbh </shitpost>

cosmic lichen
#

We can now write long code as the big guys 😬

jagged cloak
#

Hello,

I just had a quick question how i would script an AI Drone to act like a suicide drone?
My current setup is that i have put a marker on the tank i want it to fly into, and on the drone itself i have put this doMove (getMarkerPos "Marker1");
Then i have a trigger that has this setup:

 ((uav1 distance marker1) <= 70); 

On Activation
 [uav1, 0, "ATL"] call BIS_fnc_setHeight;```
#

the drone approaches the tank but then steers off anf flies to the end of the map

kindred tide
sullen sigil
#

read the biki article lambda linked

#

a lot of the nice bits of sqf are going

#

readability through the floor in exchange for being 40x faster(?) in an engine that is theoretically better than rv4 but i am yet to have a single compelling argument made for switching to it

#

and thats from the pov of someone who spent 6 months writing a movement system within sqf only for it to be totally fucking useless in mp bc the engine has no angular velocity commands so does not interpolate it -- enfusion has had those commands from day 1 and i still dont want to touch it

fair drum
kindred zephyr
#

Its just a matter of practicality against performance really, people that have a more serious background on coding will have an almost seamless transition, and with the time, the enscript wiki will become more fleshed out to the point in which we can rely on it as we do for A3. If it makes it order of magnitude faster, I don't mind being left out in the dark for a bit until someone does some sort of "friendlier integration" more akin to A3 current sqf

fair drum
#

I just want more documentation on the classes so I don't have to trial and error to find what the heck things do

tulip ridge
sullen sigil
#

case sensitivity can go suck my fucking nuts

#

its horrendous and serves zero purpose

#

aside from stopping people do mYVaRIabLEnaME at which point stop trying to read their code its a pointless exercise

tulip ridge
#

Yeah

sullen sigil
#

typed variables is also dreadful and i hate it

#

i dont give a shit about what the variable was before i want to overwrite what it is now

#
private _var = _unit getVariable ["variablethatisnotabool",true];
if (_var) exitWith {}; //variable undefined, cheap exit.```
#

BRILLIANT!

tulip ridge
#

At that point just use isNil, sure it's clever but why?

sullen sigil
#

isnil is an extra command

#

bad.

#

(though granted more readable, but just macro it)

#
#define EXIT_IF_UNDEFINED(param1) if (##param1##) exitWith {}
private _var = _unit getVariable ["variablethatisnotabool",true];
EXIT_IF_UNDEFINED(_var);
//my code below```
#

perfect and you dont have to always remember pissing isnil taking a string

#

(this is one of many instances where this is useful)

tulip ridge
#

Never really forgotten that isNil takes a string, but I guess?

#

I do like the nicer syntax in Enfusion

if (someVar == null) { return; };

Although the alt syntax seems a bit odd, since you're basically just checking it like a bool

sullen sigil
#

i am going to macro == to isEqualTo

#

if i ever work in enfusion (never)

#

i also HATE return commands theyre so stupid

#

what else are you going to do if theres nothing there

tulip ridge
#

?

tulip ridge
sullen sigil
#

== not as readable

#

if (myvariable isEqualTo "string") then {code} is just the most readable you can get

south swan
#

== is like half-century-old convention and pretty readable blobdoggoshruggoogly

sullen sigil
#

the word equal is 7 centuries old and very readable

wary needle
#

anyone have a script where walls close in.
like a hallway that keeps shrinking

hardy valve
#

hello does anyone know of a working script for a server to warn, and eventually kick a player for being afk?

calm lantern
#

need 2 things for add action to stay to vic after it dies and and for warlords the independent faction to be playable faction.

queen cargo
sullen sigil
#

i personally write all my sqf code in haiku format

queen cargo
sullen sigil
#

maths being more readable isnt a bad thing either

queen cargo
sullen sigil
#

isEqualTo is easier to not have to think about what every single character means and just reading the code

#

which is one of my favourite parts of sqf

#

if you are reading a competent scripters code, it is extremely readable once you get the basics down

queen cargo
sullen sigil
#

versus most other languages which are bloated with type definitions etc etc etc

sullen sigil
#

words mixed with maths stuff is a big confuse

split oxide
#

I mean, math is a language that's meant to be read?

sullen sigil
#

yeah, which is all mathematical notation

#

rather than a weird blend of the two like _word == value

#

be consistent with it

queen cargo
sullen sigil
#

digital gives me a better feeling because i dont have to sit there going hmmm how many minutes left

queen cargo
sullen sigil
#

rather than analog having to be interpreted

sullen sigil
#

im not supposed to be thinking about developing im meant to be on a break but here i am defending sqf

#

what has my life come to

queen cargo
sullen sigil
#

if (value isEqualTo othervalue) then {do this} else {do that}; is just pure english

queen cargo
sullen sigil
#

and can be read as a completely valid sentence

queen cargo
#

That is true, but again, not a valid point against the =

It also will not magically teach people to code because it is English (because it is not... What are those curly things doing and why is the stuff between then and if in ()?)

sullen sigil
#

yeah, im not saying its magically making it easier to code

#

like, _this params ["_proupu", "_pwuepouqe", "_pwoeiqpipmpa"]; what the fuck

#

but it benefits from being able to just look at it and understand what is going on with using a lot less energy actually understanding what you are reading because its more close to just... sentences

queen cargo
#

Long story short for enscript is: it is a different language with pros and cons

Sqf is great with pros and cons

But == > IsEqualTo and macros can go to hell

sullen sigil
#

i fucking love macros

#

mostly because of organisation i dont have to remember what project name is etc

#

(mistyping KJW_MedicalTreatment instead of KJW_MedicalExpansion has caused me a lot of headache over the past few days so i just macrod it)

#

in my defense
i was also overwriting ace_medical_treatment functions

queen cargo
#

A death spiral of confusion and an easy path to obfuscate your code for other people. If thst6is your definition of great then yes, very great

queen cargo
#

You are still at mercy of typos

sullen sigil
#

yeah they will because COMPONENT is now always the correct thing

sullen sigil
#

once youve done that then its solved for the entire project

#

and if you want to change it, just change it in one place too πŸ™‚

#

the common macros like GVAR() and QFUNC() etc are also easy enough to understand once you get the hang of it

#

G = General
E = External
Q = Quote

QQEGVAR => Quote Quote External General Variable

#

easy

#

g may mean global ive never looked

queen cargo
#

No, always

There is no benefit of writing that, ****** GVAR(xyz) thing (and the corresponding cba group) over ace_whatever_xyz
Not even readability is a pro point because the former obfuscates what you are doing and always requires additional context to understand.

You are also never going to rename ace to totally_not_ace and moving script files from one "component" to another breaks the entire code.

Reality of things here is: it is just a way of making code look more "professional" and "complex" then it is for no reason but internet swag

#

Probably enough hot takes for a single day

sullen sigil
#

you dont need that additional context for modifying it, thats the whole point -- GVAR(xyz) is just the xyz variable for whatever module you're working on, no need to think about it

#

of course anyone who wants to hook into gvar(xyz) does need to understand it yes

#

but from a development pov having recently switched to macroing variables like that it solves a ton of headache

#

we will have to agree to disagree regardless

simple trout
#

like X39 said you are hiding what it actually is

#

GVAR expands to TAG_Component_xyz

#

which breaks if you try to use that variable in another component, hince EGVAR(component,xyz)

#

No need for SQF when you have C#!!!

queen cargo
calm lantern
#

okay can anyone tell me how to make independent freidnly in warlords

hallow mortar
nocturne bluff
#

Don't they fetch locations from the map?

simple trout
calm lantern
#

HEY ANYONE GOTTA BLAACKLIST LAYING AROUND FOR ALL VANNLIA WEAPONES

warm hedge
#

No allcaps, thanks

tough abyss
pastel quartz
#

The intention here is to create a new AI unit and assign it to another human player - presumably in a separate group.
Is this an anti-pattern and is the better approach to script the newly-created AI unit to 'follow' the player instead? And is 'follow' possible in the commands?

wary needle
#

how do i use a trigger on only the unit that enters. cant fund any examples online
tldr player enters trigger, only him gets hint.

golden cargo
warm hedge
calm lantern
#

@tough abyss for warlords to need to bla klist everything but the spe gear for the arsenal im use the the warlordsint module so idk how I will do that.

wary needle
#

Make a whitelist, much easier

queen cargo
hollow plume
#

Any possible way to get Jet countermeasures /Chaff more brighter and last longer in Editor?

sullen sigil
#

i used to make the mistake of confusing projects very often

brazen cobalt
#

How can I set my dedicated server so that it tempbans anyone for 12 hours if they die?

I'm running an antistasi dedicated server - the theme is you only get one life (per day). Hence the automated 12 hour tempbans.

The dedicated server is with armahosts.

Additionally, is it possible for an admin to unban someone in case they die from a bug?

I have no coding experience at all so I may have more questions trying to figure this out!

warm hedge
#

Not sure if there is a scripted unban way

south swan
#

inb4 12 hour kick timeout

brazen cobalt
magic sundial
#

coming back into scripting, is there a way to monitor the amount of kills an ai gets?

#

Like the goal is for an ai to get more health, move faster etc whenever they kill something

#

Figured it be like an eventhandler thing

#

because theres things for being hit and killed, but not for killing

#

like firing would be close, but not every shot is a kill

little raptor
#

Alternative approach is adding Killed EH to every unit

magic sundial
#

Yea thats what i was thinking

#

Thank you, i was more or less wondering if my train of thought wasnt like completely off haha

#

A killed EH would be sick though

#

Could even do HadleScore actually

kindred zephyr
granite sky
#

Worst thing about macros is that you can't paste the code into the debug console.

sullen sigil
#

i paste the script component include

sullen sigil
winter rose
#

good thing about Enfusion is it doesn't let you macro

kindred zephyr
#

LOL

sullen sigil
#

yet another reason i will not move to enfusion

lavish canyon
#

hi guys! I have a question. How to hint a message when hovering over a marker in map?

simple trout
#

I sold my soul and my time

storm crystal
#

Yo how could I merge two variables like

private _player = name player; // imagine player name is Nav
private _prrt = _prrt + _player; // how to get _prrtNav?

and if its not possible is there any way around?

granite sky
#

missionNamespace getVariable ("_prrt" + name player)

#

Normally these days you are better off making a hashmap than doing this stuff, although there are special cases.

storm crystal
granite sky
#

Depends what the player name is?

#

_prrtNav in your example, I guess

winter rose
#

if however you want the content of the _prrt var, use _prrt without quote

storm crystal
#

i'll try this Dr.House πŸ™

#

i don't want the content

granite sky
#

You should probably describe what you want to put in this variable and then people will tell you better methods :P

winter rose
#
private _str1 = "ABCD";
private _str2 = name player; // e.g "Nav"
private _str1n2 = _str1 + _str2; // "ABCDNav"
private _other = "yolo" + _str2; // "yoloNav"
granite sky
#

hmm, can you even set local vars on missionNamespace...

storm crystal
#
_bb = "Land_TripodScreen_01_large_F" createVehicle position player;
_bb setObjectTexture [0, "#(argb,512,512,1)r2t(playerrtt,1)"];
private _playerrtt = "_prrt" + name player;
{
    cam = "camera" camCreate [0,0,0];
    cam cameraEffect ["Internal", "Back", "_playerrtt"];
    cam attachTo [player, [0.18,-1,0.18], "head"];
    cam camSetFov 0.7;
} for allPlayers;

Well this is the script so far, I'd like it to automaticly creates a screen behind all player with a livefeed of their shoulder on it. The livefeed works well but I don't really know how to like make it work so i'm trying schtuff but I'm running out of ideas...

ornate whale
#

How do you debug/diagnose your code when playtesting? My current method is to print events and values into the system chat. What are the other options, ideally visible right in the game?

granite sky
#

You can draw what you like with cutRsc or other UI functions. I'm normally more inclined to spam diag_log and read RPTs on the fly, as for most things the progression is more important than the state.

#

@storm crystal "playerrtt" here isn't a variable, it's just a text string used as a reference.

#

So you'd just build the texture string with something like this:
_texstring = "#(argb,512,512,1)r2t(" + (name player) + ",1)";

#

setObjectTexture is local effect though, so the code won't work.

orchid dagger
#

Affichage icone grade matricule

    params ["_from", "_to", "_t"]; // array [0,0,0,0], array [0,0,0,0], float
    
    _r = (_from select 0) + ((_to select 0) - (_from select 0)) * _t;
    _g = (_from select 1) + ((_to select 1) - (_from select 1)) * _t;
    _b = (_from select 2) + ((_to select 2) - (_from select 2)) * _t;
    _a = (_from select 3) + ((_to select 3) - (_from select 3)) * _t;
    
    [_r,_g,_b,_a];
};

if (hasInterface) then {
    addMissionEventHandler ["EachFrame", {
        {
            private ["_offset", "_xdist", "_iconSize", "_colour", "_rankIcon", "_rankTitle", "_name"];
            
            if (side _x == side player) then {            
                // height offset
                if (_x == vehicle _x) then {
                    _offset = ((_x modelToWorld (_x selectionPosition 'head')) select 2) + 0.4;
                } else {
                    _offset = 1;
                };
            
                _dist = _x distance player;
                //                
                _xdist = _dist / PX_TAGS_VIEW_DIST;
                _colour = getArray (configFile/'CfgInGameUI'/'SideColors'/'colorFriendly');
                _colour = [_colour, [255,0,0,1], damage _x] call PX_fnc_LerpRGBA;                                                            
                _rankIcon = [_x, "texture"] call BIS_fnc_rankParams;
                _iconSize = 1.0 - _xdist;            
                                    
                if ((cursorTarget == _x) && ([objNull, "VIEW", objNull] checkVisibility [eyePos player, eyePos _x] > 0)) then {
                    _rankTitle = [_x, "displayNameShort"] call BIS_fnc_rankParams;                
                    _name = format["%1. %2", _rankTitle, name _x];
                    drawIcon3D [_rankIcon, _colour, [visiblePosition _x select 0, visiblePosition _x select 1, (visiblePosition _x select 2) + _offset], _iconSize, _iconSize, 45, _name, 2, 0.03, 'PuristaMedium'];
                } else {                        
                    if (_dist < PX_TAGS_VIEW_DIST) then {
                        _colour set [3, 1.0 - _xdist];
                
                        drawIcon3D [_rankIcon, _colour, [visiblePosition _x select 0, visiblePosition _x select 1, (visiblePosition _x select 2) + _offset], _iconSize, _iconSize, 45, "", 2];                    
                    };
                };
            };
        } count playableUnits - [player];
    }];
};
#

Hi everyone. I have this script, showing the rank icon and the player's name. I tried to hide the rank icon and just keep the name without success for now. Have you an idea ?

storm crystal
granite sky
#

@orchid dagger Isn't that what it does in the target-obstructed case?

#

oh wait, you want to show the name and not the rank...

#

I think you just use drawIcon3D with an empty string for the icon name.

tulip ridge
#

What would be the easiest way to hide a (base game) action?
There's these examples on the inGameUISetEventHandler wiki page, but I was hoping to actually hide the action rather than just overwriting it.

inGameUISetEventHandler ["Action", "if ((_this select 3) isEqualTo ""xyz"") then {true};"];

The condition isn't passed, otherwise I could just set it to false

hallow mortar
#

There is no easiest way to do that, or to be more exact there is no way to do that

#

Certain kinds of actions can be prevented in various ways (lock to prevent getIn/Out, lockInventory to prevent inventory, the building door lock variable, using a dummy simple object instead of an interactive item, etc) but there's no way to actually remove an engine-controlled action.

tulip ridge
storm crystal
#
[cam, [0.75]] remoteExec ["camSetFov",0,true];
``` anyone knows why this isn't working?
granite sky
#

camCreate creates local objects.

storm crystal
#

even if its remoteexec?

hallow mortar
#

Put all your camera stuff in a local function and remoteExec that. Each client will maintain their own variables locally, removing the problem

#

* by "local function" I mean "operates locally" not "only defined locally on the sending client". Use cfgFunctions

south swan
#

or just publicVariable the function before running it with remoteExec πŸ™ƒ

tulip ridge
#

I'm working on adding an inventory item to let players carry small amounts of fuel around with them. I've thought of a couple ways to do it but wanted to throw some stuff out to see if there was potentially a better way to do it.

One way I had thought of doing it was having multiple items for different sizes, and then whenever a player picks up X amount of fuel it would either round to the nearest item or give them several items to roughly equal the right amount (haven't decided on which way if I did do it that way).

It'd be great if I could just assign a variable to an inventory item, but sadly can't do that (at least as far as I can tell from looking at setVariable

open hollow
tulip ridge
#

It's been a thing for a while

open hollow
tulip ridge
#

It was only enabled in ~50% of servers as a test, but it's pretty much enabled in most servers now

tulip ridge
open hollow
open hollow
#

and made 1bullet = 1 liter, or less.. it depends, it need to be an integer

tulip ridge
#

Oh nice, I wasn't sure if you could do that
Is there just like a "setAmmoCount" command?

tulip ridge
sullen sigil
#

yes that is convention

tulip ridge
#

Why...

sullen sigil
#

unless theyre doing all of them instead of the loadorder addon

tulip ridge
#

Only mention of "load" is "a3_supplies_f_heli_slingload"

sullen sigil
tulip ridge
#

I've never seen a single mod ever do that (not specifically the DLCs)

fair drum
#

you don't need to, its just safer to

sullen sigil
#

you havent looked at many decent mods then

#

putting loadorder in the requiredaddons is convention because you dont want the game to load halfway then start loading your stuff that relies on base game stuff

open hollow
sullen sigil
#

i always put arma loadorder into requiredaddons

#

no reason not to

tulip ridge
#

Alright I get the loadorder one specifically, but every addon?

sullen sigil
#

every addon is stupid just replace with loadorder

#

tho immersion cigs is quite old iirc so may be before the convention came about

open hollow
sullen sigil
#

lou doesnt actually believe in cfgpatches

drowsy geyser
#

What is the maximum distance for Remote controled units? because after a certain distance the unit stops responding.

south swan
#

inb4 draw distance

drowsy geyser
#

is it possible to increase it?

open hollow
tulip ridge
open hollow
tulip ridge
#

Although since empty magazines are automatically removed, I guess I'd need an item for an "empty" container item?

drowsy geyser
drowsy geyser
#

i'm controlling the vehicle with remoteControl command

tulip ridge
open hollow
open hollow
tulip ridge
#

If you addMagazine an empty it mag it seems to stay, even when moving to/from different inventory containers

#

I think just having a normal item would be easier, especially for saving loadouts

open hollow
tulip ridge
kindred zephyr
#

you can also config empty mags to stay in your inventory, their removal comes by default activated so just change that?
regarding arsenal, i dont think you can actually place emtpy magazines in it

tulip ridge
#

So yeah I'd need to do a separate item as the empty can

kindred zephyr
#

when the ammo count is 1 or 0 the bar on the left you mentioned should not be visible, alternatively you can config it as an item instead of a mag, only for the empty one

tulip ridge
#

That's what I was planning on doing

#

when the ammo count is 1 or 0 the bar on the left you mentioned should not be visible
It's still visible when at 0

granite sky
#

I think he means the correct load order addon for vanilla dependencies.

#

"A3_Data_F_AoW_Loadorder", last I heard

little raptor
#

yeah it's weird that it's mentioned in the class inheritance page meowsweats

molten yacht
#

So if I wanted to get the inventory of each box in a trigger area

#

and lump them into an array

#

how do I finish this code

#
{ AllCrateInventories append getItemCargo _x } forEach ??? in campTriggerArea
#

(given that AllCrateInventories is an existing array, usually empty)

little raptor
#

nearSupplies

#

I guess think_turtle

#

well your syntax is still wrong

#

but I think nearSupplies is the fastest way to get the boxes

molten yacht
#

I don't think that returns what I want it to return

#

oh wait

#

no it does

#

hm

#

I really want "any non-player inventory including vehicles"

hasty gate
#

Hi, is there a way to make AI units avoid friendlies in line of sight (between them and enemy)?

hardy valve
#

Im using a vehicle "unflip" script on my server - But i just reazlied players can unflip a vehilce as long as theyre pointed at it from any distance.

How can i adjust this to only work if you are within 3 meters of the flipped vehicles? Or better yet only show the option IF the vehicle is flipped?

https://sqfbin.com/umokaqakubaziwuxenum

granite haven
#
((!isNull _target) && {alive _target} && {_target distance player < 3} && {_target isKindOf 'Landvehicle' || _target isKindOf 'Air' || _target isKindOf 'Ship'})
sharp grotto
#

Is there a away to get the code of draw3D EH's like we can do with addactions/holdActions ?

south swan
#

Inb4 people start flipping the planes in the sky

granite haven
hardy valve
split oxide
hardy valve
hardy valve
split oxide
#

may be worth fiddling with the threshold, since < -0.9 is certainly upside down and 0 should be on it's side so there's room in between for choosing

hardy valve
#

Ok i'll play with it i've noticed the BTR's tend to lay on their sides

split oxide
#

good luck! make sure to check on slopes since vectorUp is world coordinate relative

hardy valve
#

I am researching but figure i would ask since you're here blobcloseenjoy

granite sky
#

just for players?

hardy valve
granite sky
#

There's a simple one in Antistasi that you can take. fn_carry.sqf

#

but I think they're all copied off each other. The secret sauce is just the animation states to use.

#

The Antistasi and ACE ones both jam up if you ADS after starting the drag, for example.

sturdy bobcat
#

hello everyone, good day

#

can anyone give me some orientation whit a small issue?

granite sky
#

just ask, don't ask to ask.

leaden ibex
torpid pike
#

outta curiosity, has anyone got experience using buttons to turn on/off UI elements, especially in particular to main menu edits? trying to add elements to the main menu with the hopes i can toggle it back off (theoretical for now)

granite sky
tulip ridge
#

Not really an issue, just thought it was strange

sudden yacht
#

The Module ModuleSpawnAIpoint_F i noticed you can sync it with a trigger, allowing ai to begin spawning. Any idea what script is being used to turn it on and off?

hardy valve
#

Me again. Scripts on server tend to stop working after 2-3 hours. Does this mean there is an issue?

#

They are fine when mission restarts

tulip ridge
#

Probably, unless you put some sort of "stop running this script after X amount of time" in there
What scripts, is it every script on the server that stops working or just a specific one(s)?

tulip ridge
fleet sand
#

Question i have a object that is moving really fast. And i want to attach sound to that object. What would be the best way for me to do that so that people on the ground have a clear sound of a object comming in ?

tulip ridge
#

Another way (if you didn't want to put the sound in a loop and sleep) would be to make an invisible "fountain" object and attach it to the vehicle

tulip ridge
#

Have it working now (or well this part of the whole system), but I can't seem to figure out what this mystery item is

drowsy geyser
fleet sand
# tulip ridge [`playSound3D`](https://community.bistudio.com/wiki/playSound3D) with a big area...

Yea the problem with a playSound3D that i found is if you want to increse distance you have to go trough all the other optional parameters, like soundPosition. But if i enable sound position then it will create a sound on a position that object was when when i ran the command. But it wont continue updateing the position. (even if i put getposASL _soundSorce in soundPosition). I manage to get it to work with say3D tho. Just dame doppler effect man.

tulip ridge
tulip ridge
fleet sand
sudden yacht
#

@tulip ridge after a couple hours. Ram caps out and generally scripts stop work.

tulip ridge
sudden yacht
#

It will generally degrade in performance the more workload.. players, scripts.. ect..

#

The longest we ever had a working running server run is 24 hours.. that was with only 7 people joining and very limited activity and time.

#

After that scripts stopped working.

tulip ridge
sudden yacht
#

Your best bet is find a way to save information after an hour and have the mission restart, or have it load a continuation into a new mission.

tulip ridge
sudden yacht
#

I wish you guys luck =}

hardy valve
#

They are very simple ones as well

tulip ridge
#

You'd need to send them, either uploading the files or just copy/pasting

#

If you copy/paste just remember to use !code formatting

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
tulip ridge
fleet sand
#

Question is there a quick way for me to get magazines for all the Missiles in game. From all vehicles and on foot ?

tulip ridge
#

Could just do configClasses (configFile >> "CfgMagazines) and check if they inherit from the base missile (don't know the classname off the top of my head)

#

This is how the KP Liberation mission checks for everything

private _weapons = [];
private _magazines = [];
private _items = [];
private _backpacks = [];
private _configClasses = [];
private _type = [];
{
    _configClasses append (
        "
            _type = (configName _x) call BIS_fnc_itemType;
            (getNumber(_x >> 'scope') isEqualTo 2) && !(((_type select 0) isEqualTo '') || ((_type select 0) isEqualTo 'VehicleWeapon'))
        " configClasses _x
    );
} forEach [
    (configFile >> "CfgWeapons"),
    (configFile >> "CfgMagazines"),
    (configFile >> "CfgVehicles"),
    (configFile >> "CfgGlasses")
];
private _classnames = _configClasses apply {configName _x};
hardy valve
# tulip ridge You'd need to send them, either uploading the files or just copy/pasting

Here's the 2 I've added.

https://sqfbin.com/anoledelafimowabiqiv

https://sqfbin.com/exoyunavuhicomacaqiw

It was foolish to say only 2 becuase its a warlords mission and I think its script mayhem and this might be why some scripts are lost. I think some packets are getting lost between server and client creating an issue where when a player is in the game for 4+ hours these 2 scripts stop working.

My 2 scripts execute locally initplayerlocal

mild relic
#

Hello all.
I have a question.
Is it possible due to some conditions or triggers to change the skin / model of the character? For example, by activating through menu. And that this happens directly during the game.

One of my friends said that it is impossible.
Thanks for answer.

manic kettle
#

It's possible to use setFace to change a players face

warm hedge
#

Yes

open hollow
granite sky
tulip ridge
hallow mortar
#

You can't modify cfgVehicles in mission config outside of a very specific case for sound sources

#

The init it's talking about is likely to be the object's Editor init field, not its init event handlers

tulip ridge
#

The init it's talking about is likely to be the object's Editor init field, not its init event handlers
I know, I meant calling the script in the init event handlers

copper nova
hallow mortar
#

I can't test it right now, but if it's not possible you can disable its simulation to stop it being opened.
I'm not sure how much you'd gain from locking it though, since you can just crawl under it (maybe vault it too).

copper nova
#

But still useful for vehicles πŸ˜„

orchid dagger
#

As some of you previously said, I think it's linked to the DrawIcon3D

hallow mortar
sullen sigil
#

just edit action condition

orchid dagger
sullen sigil
#

referring to bar gate

hallow mortar
#

You can only do that if you're making a mod. If you're just making a mission, that's not an option.

tulip ridge
#

Isn't there a setting in DUI squad radar (assuming that's the mod you're using in the screenshot) to remove the rank icon?
Nevermind, it's in ACE Nametags

drowsy geyser
#

is there any specific reason why hidden vehicles are "frozen", when set to hideObject true?

#

i remember a time where it was possible to drive while the vehicle was hidden (i could be wrong idk)

granite sky
#

I'm not sure how well thought out any of that stuff is.

brave zinc
#

what programming language does the game use??

tulip ridge
#

SQF Misunderstood question

hallow mortar
#

Internally, something beginning with C. For us, SQF.

brave zinc
#

so i am probably out of here since i only know python and lua

tulip ridge
#

Were you asking about Arma's internals or what users (us) write code in?

tulip ridge
#

Then yeah, sqf

granite sky
#

It's a fairly idiosyncratic language but not complex.

brave zinc
#

i was searching abt it and it looks like C# and lua

leaden moss
#

does anyone have experience making whole gamemodes, if so i would like to hire someone to make one for my server

leaden moss
#

thanks

opal zephyr
#

I'm having some issues with uiontexture, I'm applying it to units, and the game seems to forget what the display is supposed to look like and turns black or just doesnt load correctly to begin with.
Ive done strenous testing to see if I can find a particular thing that causes this, but I cant. However it seems to be more likely to happen when other displays are being updated, or when the player zooms in (idk lol).

Ive checked and when it displays as black the controls exist and are valid and the text of the image control on the display is correct.
^A note with this, when I request that text of the control with ctrlText the display updates and becomes no longer black. Without me using displayUpdate or anything.

This has been tested on other systems and other graphics settings with the same results. I'm starting to think its a bug with the function or something...

If anyone has any suggestions or ideas to share that would be greatly appreciated! Thankyou

tulip ridge
#

Modifying some code from another mod (with their permission), essentially it's a couple of scripts to let you remote control a unit. It had some issues that I wanted to fix for my own use case.

Rough break down of the code:

  1. Scroll wheel action to control unit
  2. X conditions are checked every two seconds, if true, stops remote control
  • Player is alive, unit is alive, etc. etc.
  1. Scroll wheel action to stop controlling unit

Works fine; except for if the player dies while remote controlling it.
If the player dies while remote controlling the unit:

  • The camera remains focused on the player's old corpse, requires entering/exiting zeus to refocus it on newly respawned unit
  • You only have partial control of your new respawned unit
    • Can open inventory
    • Can zoom in/out
    • Can switch from FPV/TPV
#

This is the code responsible for switching control back to the player's unit

// _caller is the unit (player) who activated the action to start remote controlling
// _target is the unit being remote controlled
if (cameraOn != (vehicle _caller)) then
{
    // Reset camera view to player
    (vehicle _caller) switchCamera cameraView;
};

objNull remoteControl driver _target; // Reset control
player remoteControl _caller;
#

I thought maybe adding a temporary respawn event handler to the player's old unit could work, but haven't tested it

agile pumice
#

anyone kickin around?

tough abyss
#

Yep

nocturne bluff
#

Nien

heavy dew
#

Is it in any way possible to do remoteExec on callExtension?

agile pumice
#

I'm getting a stupid generic error in expression for this line...: if ((!isNull _source) && (!isNil "_source") && {_source != ""}) then {

thin pine
#

{_source != ""}

#

why curly brackets?

hardy valve
hardy valve
jaunty drift
#

pretty sure that's how you do lazy evaluation

split nebula
#

wouldn't you want to check for nil before null?

thin pine
#

thats a good one

tulip ridge
tough abyss
#

i bet source is weird

outer plover
#

I'm pretty sure sqf's IF statement evaluates all components, it won't do early termination of evaluation, so the order (isNull or isNil) doesn't matter, both get executed

split nebula
#

thats why you should check isNil first

outer plover
#

Yeah, bit in a separate if

hardy valve
tulip ridge
#

Technically there's some cases that the action will show up but not do anything but if that bothers you you can just copy/paste the condition from the flip code (the (!isNull cursorTarget) && {alive cursorTarget} && {cursorTarget distance player < 3} && {cursorTarget isKindOf 'Landvehicle' || cursorTarget isKindOf 'Air' || cursorTarget isKindOf 'Ship'}) and replace cursorTarget isKindOf 'AllVehicles' with it.

Just remember to keep it in quotes

outer plover
#

if (!_isNil "_source") then {if ...

split nebula
#

forgot " "

agile pumice
#

giving it a whirl

outer plover
#

:P

indigo snow
#

Dont need a separate if, if you make the nulk evaluation lazy as well

outer plover
#

It does ? I remember it didn't always do that

indigo snow
#

Then you may want to ignore thaf

#

Might be thatnil fucks up the compiler yea

outer plover
#

Would be worth checking this out, early termination would be nice

rich bramble
#

@outer plover Lazy condition evaluation uses a different syntax but yes, it's implemented in SQF

#

It's not the default, however, so if ( false && [] call fake_fnc_TakesForever) then {...} will take a long time to return ;)

outer plover
#

Yeah, that's what I mean :D

rich bramble
#

It's a good habit to get used to doing if (false && { [] call fake_fnc_TakesForever}) then {...} when you've got a "trivial" check happening before a significant computation. I.e. testing a unit is present/not-null/alive before testing if there's an entereable building withing 500m ;)

molten yacht
#

Does revealing a mine with revealMine stop the AI from pathing into it?

outer plover
#

O.o Somehat counter-intuitive, but then, it'S SQF :|

rich bramble
#

Exactly. Since #arma3_scripting has also become #sqf-ranting let's all just marvel at the amazing langauge design process that must have been going on somwhere at 3am, hours after the coffee ran out, to give us this marvel of "WTF SQF" behaviour.

kindred zephyr
#

not strictly, no, certain conditions makes the AI ignore them, basically as long as they are not in AWARE or SAFE behaviour modes they will "risk" pathing on the mines even if revealed

rich bramble
#

(I know language design and implementation is hard. I'm not really giving the original creator(s) sh*t about it, I'm just poking fun at the fact it's still the best (ok, only) way to write code in A3)

agile pumice
#

so I ended up just using bis_fnc_param for my source to only accept objNull type, and I'm only using !isNull for the if condition, but my the handleDamage is writing a string for the source at the very end (from an explosion)

rich bramble
#

@agile pumice remember that bis_fnc_paramis unnecessary overhead nowadays. We've got the params command that will do the same thing much faster.

ornate whale
#

How does the Deformer Eden addon work? Does it run purely on SQF scripts?

agile pumice
#

tell me more about this params command

#

the wiki page is confusing AF

#

oh

#

i get it now

rich bramble
#

Cool! It's a pretty neat command.

agile pumice
#

Just hope I've set this up correctly: params [["_unit",""], ["_part",""], ["_damage",0], ["_source",objNull], ["_projectile",""]];

warm hedge
#

Yes

agile pumice
#

or would: params [["_unit","",""], ["_part","",""], ["_damage",0,0], ["_source",objNull,objNull], ["_projectile","",""]]; be safer?

#

third param needs to be an array though I believe

dusk badger
#

I need some help with the Gendarmerie offroad, I know it has a PoliceHorn but wont activate via forceWeaponFire

still forum
heavy dew
# still forum Uh.. yes, maybe? More details needed

Well I'm making a mod along with an extension where I'd like to limit the function and extension calls to local execution only
doing so with functions is easy enough with cfgRemoteExec as far as I can tell
with extension calls I'm somewhat treading unknown ground for me, I couldn't find anything about calling remoteExec on callExtension or how to prevent it
thought of looking into call_context to write a check but haven't fully looked into that yet

tender fossil
still forum
#

CfgRemoteExec can also block the callExtension command

heavy dew
#

wouldn't that interfere with other mods?

still forum
#

And yeah I think the second part would be the call context thing that was added recently

still forum
tender fossil
#

Isn't remote executing extension calls a (very) bad practice anyway πŸ˜…

still forum
#

It always goes through at least some SQF function wrapper

#

Probably yeah

#

Thinking of it makes me shudder

heavy dew
tender fossil
#

The (server side!) wrapper function could contain additional logic whether to accept the extension call request or not. If you want extra security, you can e.g. make it a server side mod so clients don't have direct access to it

heavy dew
#

I'm writing an API wrapper so people can shock themselves if they get shot/suppressed/etc. Allowing remoteExec means people can shock each other w/o consent

heavy dew
tender fossil
heavy dew
#

Can't do API calls ingame afaik
most of the process is handled ingame, its just the transmit/receive that's done with the extension

tender fossil
still forum
#

I would say just block callExtension from remoteExec, I don't think you'll have any problems.
And if you do, you'll see it in your logs and can do something about it then

#

Unless you can easily solve that with the call context thing

agile pumice
#

and obviously unit isn't a string, but It seems to work now so

heavy dew
#

I'd prefer to block remoteExec on callExtension completely, while having the option on in-game functions
that'd be the safest option

still forum
#

Extension context doesn't solve it

#

That seems like a missed opportunity there. I don't know if it can still be fixed without adding another function

agile pumice
#

ill be using the new params from now on it seems

#

thanks alexander

heavy dew
# still forum Extension context doesn't solve it

call_context gives the steamID of the caller, that might work
also there's a difference between Extension Context and Call Context right?
Extension Context: What extension returns to extensionCallback EH
Call Context: Caller, Source etc of the extension call

wind hedge
#

guys, this script used to work for me but no longer does. I can't spot the issue:

// initPlayerLocal.sqf
VAL_fn_showAllyOnMiniGPS = {
    if (isNil "gpsDisplay") then {gpsDisplay = _this#0;};
    if ((visibleGPS) && diag_fps > 15) then {
        {
            _icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon');
            gpsDisplay drawIcon [
                _icon,
                [0,0.3,0.6,0.90],
                getPosWorld _x,
                18,
                18,
                getDirVisual _x
            ];
        } forEach (units group player - [player]);
    };
};
// description.ext
class Extended_DisplayLoad_EventHandlers {
    class RscCustomInfoMiniMap {
        VAL_DrawGPS = "\
            params ['_display'];\
            private _control = _display displayCtrl 101;\
            _control ctrlAddEventHandler ['Draw', { call VAL_fn_showAllyOnMiniGPS; }];\
        ";
    };
};

That used to display the icons of all the player's team mates on the mini GPS screen (CTRL+M).

fleet sand
wind hedge
#

I can only see my own icon

little raptor
#

Well for one thing you shouldn't serialize the display

#

Just use params ["_disp"] and use the local var

#

also verify if the EH is getting called at all

#

It could be a problem on CBA's side

wind hedge
little raptor
#

Then you can't do it like that

little raptor
wind hedge
#

I will look for a "CBA less" alternative

queen cargo
#

@agile pumice so .. first of all, use the damned tripple ` to make code blocks or single to make code lines ...

#

then ... what you want to do?
is it really required to do all the type checking?

wind hedge
#

How do I find the mini GPS display?

fleet sand
# wind hedge How do I find the mini GPS display?

You can do something like this:

private _displays = uiNameSpace getVariable ["igui_displays", []];
{
  private _ctrl = _x displayCtrl 101;

  if (!isNull _ctrl && ctrlType _ctrl == 101) then {
        //do stuff
  };
} forEach _displays;
wind hedge
#

ok, my approach did not work but at least I found a new way to destroy my Arma 3 stability:

VAL_fn_showAllyOnMiniGPS = {
    addMissionEventHandler ["EachFrame", {
        if (diag_fps > 15 && !(visibleMap)) then {
            private _displays = uiNameSpace getVariable ["igui_displays", []];
            {
              private _ctrl = _x displayCtrl 101;

                if (!isNull _ctrl && ctrlType _ctrl == 101) then {
                    if (visibleGPS) then {
                        {
                            _icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon');
                            _ctrl drawIcon [
                                _icon,
                                [0,0.3,0.6,0.90],
                                getPosWorld _x,
                                18,
                                18,
                                getDirVisual _x
                            ];
                        } forEach (units group player - [player]);
                    };
                };
            } forEach _displays;
        };
    }];
};

At least it doesn't show an error

still forum
#

Uh actually we can easily extend the context.
It's just an array of strings. So we could add remoteExec ID into there

heavy dew
#

fairs, pretty much settled on disabling remoteExec on extension outright anyway.
Focusing on to see if I can have a toggleable system on the ingame functions
isRemoteExec seems to cover that

still forum
#

and remoteExecutedOwner to see who remoteExec'ed a thing

heavy dew
#

yup

#

that however gives the network ID
is there a way to fetch the steamID using that?

little raptor
#

On the server yes

still forum
#

but it only works on the server

#

I looked at the extension context.
I have some ideas on how we can expand this further in 2.16
Include the remoteExec information, include a full stacktrace (if you want it) and maybe more

grizzled cliff
#

@queen cargo, yes it does slow down the location commands nearestLocation(s) but I've actually never really seen anyone use locations for anything and the engine doesn't even really use them

heavy dew
#

Well I'm glad that I unintentionally gave you a feature idea
but yes, remoteExec info could be useful to people (even if using remoteExec on callExtension may not be a good idea as discussed earlier)

queen cargo
#

still a cool idea :P

#

however, it rly just adds objects then to SQF

grizzled cliff
#

I might ask BI to give us something like just a generic data object

queen cargo
#

more a generic namespace object

#

or some sort of "pushNamespace"

#

then it owuld not even be needed to move above the object generation

grizzled cliff
#

nah, just "createDataObject" would be fine, its all in the code, a namespace is just a global GameVarSpace in the engine

#

every object has a GameVarSpace, locations have one, teammembers, and a few other things

#

they could literally just copy the locations class and get rid of the commands for drawing them finding them on the map, and any other stuff that'd be pointless

#

BI though does seem really reluctant to add new datatypes though

#

cause they'd have to handle a few serialization issues

#

for the plebs that still play singleplayer ;)

tough abyss
#

Hey now, singleplayer is quite fun ;)

nocturne bluff
#

@grizzled cliff i asked, and asked

grizzled cliff
#

i'll poke Joris tonight or next week about it, i have a few tickets from the ACE people that I need to have him look over too.

thick sage
#

Hi, I am trying to understand the following function: https://github.com/official-antistasi-community/A3-Antistasi/blob/unstable/A3A/addons/gui/functions/GUI/fn_configColorToArray.sqf

private _configColor = _this select 0;
private _configColorAsString = str _configColor;
private _colorArrayString = "[" + (_configColorAsString select [1, (count _configColorAsString) -2]) + "]";
call compile _colorArrayString;

and its example of use

private _color = [A3A_COLOR_SELECT_MARKER] call A3A_fnc_configColorToArray;

where

#define A3A_COLOR_SELECT_MARKER {1,1,1,0.75}

I do not understand how this works - I could not find it in the wiki and the debugger window throws errors when this is used.

is {1,1,1,0.75} valid SQF?

still forum
#

It is sadly valid SQF yes

#

It creates a piece of code, that pushes these values onto the stack (You can check its disassembly)
Then it pulls the text string out of it, and puts it into an array
What it really is doing there is basically parseSimpleArray in... bad

thick sage
#

is it the preprocessor that is doing that?

still forum
#

no

#

Preprocessor doesn't do any script. Preprocessor just moves text pieces around

thick sage
#

But then why does it throws an error when used in the debug window? (this is why I assumed was the preprocessor)

still forum
#

what are you executing in debug window, and what error

thick sage
#

I did it this morning to confirm, but I am not with it rn. Will write it here in 1h or so when I get hold of it!

still forum
#
private _configColor = {1,1,1,0.75};
private _configColorAsString = str _configColor; // "{1,1,1,0.75}"
private _colorArrayString = "[" + (_configColorAsString select [1, (count _configColorAsString) -2]) + "]"; // "[1,1,1,0.75]"
call compile _colorArrayString; // compiles to {[1,1,1,0.75]}, gets called and returns [1,1,1,0.75]

That is the same (just alot more complex and slower) as if you did
parseSimpleArray ("[" + toString {1,1,1,0.75} + "]")

So that whole function can be replaced by one line, or even put into a macro.
parseSimpleArray ("[" + toString (_this select 0) + "]")

#

I just ran it in debug console and had no problem

#

As for if its valid SQF
diag_dumpScriptAssembly {1,1,1,0.75}

push 1
push 1
push 1
push 0.75
hasty gate
#

Is there any way to prevent drawing of a friendly UAV "icon" in UAV Terminal display?

nocturne bluff
#

What did joris job title switch?

hallow mortar
grizzled cliff
#

eh?

#

Added: execVM and spawn command now define a _thisScript variable containg a handle to the SQF script

#

awwwwesome

#

needed that

#

:O

nocturne bluff
#

Nice

#

Oh

#

Joris stepped down from project lead.

velvet merlin
#

does A3 itself have some spawn plane into air scripted action or best to do some custom coding?

little raptor
#

Yes, createVehicle with "Fly" special state

#

Also afaik that's the only way to spawn vehicles that have long startup time (e.g. helicopters or I guess planes with propellers)

steady matrix
#

Hey everyone. Looking to get a bit of help from someone who is a bit familiar with the Arma 3 custom modules system. I'm working on a canine handler script, and I have it working in mission scripting, now I'm trying to practice porting it over to a module. The issue I appear to be having, is passing variables/data from the config to the function itself attached to the module class. I was wondering if someone might be able to take a look and assist? I want to get comfortable with the module system in general because I feel like it will help with a lot of the systems I'd like to reuse between missions that I am developing.

#
class AHS_DogType
            {
                displayName = "Dog Type";
                tooltip = "Select the type of dog";
                property = "dogType";
                control = "Combo";
                typeName = "String";
                expression = "_this setVariable ['%s',_value];"
                defaultValue = "MFR_B_GermanShepherd";
                class Values
                {
                    class MFR_B_GermanShepherd {name = "German Shepherd"; value = "MFR_B_GermanShepherd";};
                    class MFR_B_GermanShepherd_Black {name = "German Shepherd Black"; value = "MFR_B_GermanShepherd_Black";};
                    class MFR_B_Shepinois {name = "Shepinois"; value = "MFR_B_Shepinois";};
                };
            };```
#

For instance: - I want to pass the property of dogType to the function attached to the module.

#

the value of that property specifically.

little raptor
#

To move things between missions you don't need modules btw
Unless those modules have some necessary "editor functionality"

steady matrix
#

I'm specifically putting the module down to sync with a unit, to assign that unit as a handler, to spawn a dog for said unit, and to select the breed of the dog.

#

So it has editor defined parameters.

velvet merlin
# little raptor Yes, createVehicle with "Fly" special state

to clarify - a player needs to get in manually in the plane first on the ground (hence the "action")

this is my 10+ year old code for it

        //beam into the air
        _speed = 150;
        _position = position _plane;

        _plane setPos [_position select 0,_position select 1,500];
        _plane setVelocity [_speed * (sin (direction _plane)),_speed * (cos (direction _plane)),10];
//        _plane setVelocityModelSpace [x, y, z];```
astral bone
#

hmm- Should I move back all my parameters or add a new one to the end? (The angle brackets)
light point settings, intensity, <dayLight???> flareSize, start, constant, linear, quadratic, hardStart, hardEnd <dayLight???>

astral bone
#

it might make more sense to put it near the start, but then I'd need to either make backwards compatability (no) or change all the things I go that are calling the function xD

little raptor
#

Also you might want to avoid the setPos and getPos/position meowsweats

grizzled cliff
#

oh didnt know that, who is project lead now?

thick merlin
#

Unable to get this code working for both h1 and h2.works for h1 but not h2.Any help appreciated.

#

while {true} do {
sleep 0.1;
if ((h1 distance pzsmokepos1 < 2000) || (h2 distance pzsmokepos1 < 2000)) exitWith {};
};

little raptor
steady matrix
#

Okay, awesome, will look into this and give it a shot... stupid probably noobish question but how do I look at the vanilla module code?

little raptor
#

Open the function in function viewer

little raptor
thick merlin
#

yes

#

works just for h1

little raptor
#

It already does that tho

thick merlin
#

so that should work?

little raptor
#

Yes

thick merlin
#

hmmm

little raptor
#

Is h2 defined?

thick merlin
#

hmm

#

wait 1

#

a bit of a mess here..

#

in the private section or in mission?

little raptor
#

I don't understand the question

thick merlin
#

_h1 = h1;
_h2 = h2;

#

here?

little raptor
#

You're using global vars in the code you showed earlier so in the mission

thick merlin
#

heli is named h2

#

how do i add it in here in the code type text?

little raptor
#

So if you type "typeof h2" in debug console it returns the heli type?

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
thick merlin
#

wait 1

silk hill
#

jay crowe ;)

fallen locust
#

"Added: execVM and spawn command now define a _thisScript variable containg a handle to the SQF script"

For what tough? im missing smt obv am i?

thick merlin
#
_carrier = ussliberty;
_p1 = p1;
_gun1 = gun1;
_gun2 = gun2;
_gun3 = gun3;
_gun4 = gun4;
_pos1 = getMarkerPos "target_1";
_pos2 = getMarkerPos "target_2";
_pos3 = getMarkerPos "target_3";
_pos4 = getMarkerPos "target_4";
_grp = grp1;
_grp_b = grp1_b;
_h1 = h1;
_h2 = h2;


while {true} do {
sleep 0.1;
if (_h1 distance pzsmokepos1 < 2000)  || (_h2 distance pzsmokepos1 < 2000) exitWith {};
};


{ _x enableSimulationGlobal true } forEach units _grp;
{ _x enableSimulationGlobal true } forEach units _grp_b; 

[_p1,"RadioMsg_Alpha_1_1_approaching"] remoteExec ["sideRadio",0];
uisleep 6;

[_carrier,"RadioMsg_Alpha_1_1_cleared_for_landing_1"] remoteExec ["commandradio",0];

_gun1 doArtilleryFire [_pos1, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
uisleep 1.5;

_gun2 doArtilleryFire [_pos2, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
uisleep 2.5;

_gun3 doArtilleryFire [_pos3, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
uisleep 2;

_gun4 doArtilleryFire [_pos4, "magazine_ShipCannon_120mm_HE_shells_x32", 6];

};  ```
#

thtas what i have so far

#

h2 doesnt fire the rest of code

thick merlin
#

wait 1

outer plover
#

@grizzled cliff Pettka

thick merlin
#

yup

#

iam in h2

little raptor
#

Just to double check put this in the while loop:

systemChat str [_h1 distance pzsmokepos1, _h2 distance pzsmokepos1];
thick merlin
#

k

little raptor
#

Then try to see what it returns for distances

thick merlin
#

i get an error in h1 but nothing in h2

#

must not be firing script in h2

#

gonna check

#

wasnt firing script in h2 when entering.

#

Thanx

#

i have an error from messing with it no i think

#

*now

#

gotta check my code

#

πŸ‘πŸ»

steady matrix
#

@little raptor I got it figured out now, thank you so much for pointing me in the right direction!

thick merlin
#

@little raptor I got it figured out now, thank you so much for pointing me in the right direction! Me TOO !! lol

#

πŸ‘πŸ»

grizzled cliff
#

Ah.

#

"Added: execVM and spawn command now define a _thisScript variable containg a handle to the SQF script"

For garbage collecting. Need to track script handles.

fallen locust
#

i guess with combination with diag_activeSQFscripts
but noting really amazing

But wait, how would you track it that way?, you can allready do
handle = [] spawn {};
or
handel2 = [] execVM "";

slender meadow
#

Is there an event handler for when a player has spawned in

#

Or any good way of executing a script once they have

#

I've tried to use player addEventHandler ["Init", and player addMPEventHandler ["MPRespawn", but they both seem to run the script before the player has been initialised. I've got it printing the player name to system chat for debugging and when it's called it prints out Error: No vehicle

#

And is there any reason getPlayerUID would return an empty string?

granite sky
#

Being passed a null object, probably.

tulip ridge
slender meadow
slender meadow
coarse needle
#

It's really confusing reading this on mobile, the simple code format doesnt show at all.

tough abyss
#

i think _thisScript is inside the thread

fallen locust
#

yea i know but how does that influence anything?

#

i really dont see a point in it

tough abyss
#

you could use it maybe for some inter thread communication

fallen locust
#

yea you can allready do that

#

breakOut
breakTo

#

^^ dont break betwen threads it goes wrong horiblly

#

i simply cant see how handle of a thread within that thread does anything,
as you can either terminate a thread or check if its null or done, and none of that makes sense from thread itself

tough abyss
#

this is used to find out if something could go wrong with inter thread communications

grizzled cliff
#

Grim, it is because when i create objects i need to track where they were created so i can collect them later when they are no longer in use

#

since you usually create objects inside threads, you need to know the thread id in which it was created

fallen locust
#

but threads self terminate when execution is done

#

[] spawn {};

grizzled cliff
#

again, i need to associate objects to threads

#

there was no way to do that before

#

so when i walk the object list i can check oh, this was created in a spawn thread, is that spawn thread still running? no? collect this object for deletion

fallen locust
#

oh i get it

#

so lets say you spawn an event in 1 thread

#

insted of using an array to gather object check all objects to be deleated after not needed

#

smt like that?

grizzled cliff
#

kinda, ill explain more when i get back from class, gotta go do me some art history bitchessss, get that futurism on yeaaaaa

fallen locust
#

i see i see

#

but i garantee it 4 people will use it in total :P

drowsy geyser
#

just out of curiosity why does 'setObjectScale' reset objects scale when object is moved?

winter rose
#

engine ways and matrix transformation iirc

drowsy geyser
#

Can't it be optional? Because there are some examples with eachframe eh, why forcing it when it could be optional.

winter rose
#

I know it would be nice but I believe it was intricate way too deep in the engine to allow for that
Dedmen is the one behind the feature's access

sullen sigil
#

has to do with magnitude of vectors or something along the lines of that

#

probably

#

either way even changing scale of objects is stretching rv4

#

rv4 mesh deformation when

winter rose
#

aw come ooon, now Dedmen ran away again
watch your mouth will you! πŸ˜„

sullen sigil
#

given i turned his majestic object scaling into a cursed height changing mod for the memes i cant blame him

#

though i dont understand why it doesnt work if not local to server πŸ€”

manic kettle
winter rose
#

don't spread the forbidden knowledge!

sullen sigil
acoustic yew
#

Ello, sorry for interjecting, I want to know something.

So how can I combine everything into a single group rather than multiple groups?

allTrucksWithCrew =  createVehicleCrew _emptyTrucks;```
granite sky
#

Create the crew for each vehicle individually and then joinSilent them into a single group.

acoustic yew
#

how...

#

i mean

#

lemme show u something

#
{
    _x params ["_id", "_classname"];

    for [{_i = 0}, {!isNil ([_id, _i] joinString "")}, {_i = _i + 1}] do {
        _placeholderC1 = missionNamespace getVariable ([_id, _i] joinString "");
        _spawnPosC1 = getPosATL _placeholderC1;
        _vehC1 = _classname createVehicle [_spawnPosC1 select 0, _spawnPosC1 select 1, (_spawnPosC1 select 2) + 0.2];
        _vehC1 enableSimulationGlobal false;
        _vehC1 allowDamage false;
        _vehC1 setDir (getDir _placeholderC1);
        _vehC1 setPosATL _spawnPosC1;
        [_vehC1] call KPLIB_fnc_clearCargo;
        sleep 0.5;
        _vehC1 enableSimulationGlobal true;
        _vehC1 setDamage 0;
        _vehC1 allowDamage true;
        _vehC1 setVariable ["KP_liberation_preplaced", true, true];
        [_vehC1] call KPLIB_fnc_addObjectInit;
        convoyVehiclesC1 =  createVehicleCrew _vehC1;
    };
} forEach [
    ["c1LV0_", KP_liberation_c1LV0_classname],
    ["c1LSV0_", KP_liberation_c1LSV0_classname],
    ["c1FBV0_", KP_liberation_c1FBV0_classname],
    ["c1TTV0_", KP_liberation_c1TTV0_classname],
    ["c1RSV0_", KP_liberation_c1RSV0_classname],
    ["c1RV0_", KP_liberation_c1RV0_classname]```
granite sky
#

yeah I'm not reading that for-loop logic.

acoustic yew
#

;-;

granite sky
#

This isn't your code is it?

acoustic yew
#

nope, KP_Liberation, you know me I cant code that well

#

Im just editing one of the file that would let me create a convoy and then I want to add crew and then combine them all into one single vehicle and use that 8)

granite sky
#

you realise that this is just the first of a thousand problems

#

Don't make convoys in Arma unless you have very strong tolerance.

fleet sand
#

Hi guys quick question why is this not detecting when i fire from vehicle am i doing something wrong ?

if(isNull objectParent _unit) then {
    //on Foot
    _unit addEventHandler ["Fired",{
    systemChat "Fire foot";
    }];
} else {
    //in Vehicle
    (vehicle _unit) addEventHandler ["Fired",{
    systemChat "Fire vehicle";
    }];
};
granite sky
#

Are you talking gunner seats or FFV or what?

fleet sand
#

Basicly in a plane as a pilot and trying to shoot it dosent fire at all.

granite sky
#

If you're working with units then maybe just try FiredMan.

fleet sand
#

I am working with a player not untis.

granite sky
#

The player is a unit.

#

Unless they're a headless client, in which case they don't fire :P

fleet sand
#

Ty very much

#

Firedman was the awsner.

granite sky
#

As for why that code doesn't work, maybe describe where/when you're calling it.

#

It should work if the unit is already the pilot when it's called.

fleet sand
granite sky
#

But is the player in the plane already at that point?

fleet sand
#

No. its outside the plane

granite sky
#

Then it's not going to work, is it?

fleet sand
#

oh.. yea πŸ€¦β€β™‚οΈ.Firedman basicly fixed it.

granite sky
#

raises eyebrow

fleet sand
#

Actually another question i have

acoustic yew
#

:0

fleet sand
#

I have this code to give me magazine names of all missiles in game:

getAllMissiles = ("toLowerANSI getText (_x /'nameSound') in ['missiles','rockets']" configClasses (configfile >> "CfgMagazines")) apply {configName _x};

but this dosent include the ["Vorona_HEAT","Titan_AA","Titan_AT","NLAW_F"] is there any way to make above to include everymissile in game from turrets, vehicles, aircrafts, and on foot ?

queen cargo
#

well XD new ideas new problems
garbage collection would not be needed with arrays :P

acoustic yew
granite sky
#

@fleet sand You'd probably need to drill down to the ammo.

#

I think nameSound is only used for vehicle weapons?

#

In CfgAmmo you can just use the simulation type.

fleet sand
granite sky
#

probably want to keep the toLower in there. Config is all busted.

#

Although if you're not checking shotRocket as well then you can just use ==

fleet sand
granite sky
#

just use ==

#

(it's case-insensitive, unlike isEqualTo)

#

otherwise you'd need to be comparing to 'shotmissile'

granite sky
#

In front of the loop:

_groups = [];

Replace this line:
convoyVehiclesC1 = createVehicleCrew _vehC1;
with
_groups pushBack (createVehicleCrew _vehC1);
After the loop:

MyStupidConvoyGroup = createGroup convoySideGoesHere;
{
  units _x joinSilent MyStupidConvoyGroup;
} forEach _groups;
acoustic yew
#

xD 'myStupidConvoyGroup'

#

thank you so much <3

kindred tide
kindred tide
#

here's the relevant part, you should be able to extract what you need from it

acoustic yew
#

:0

#

TY :D

rain fern
#
    num_veh = [1, 3] call BIS_fnc_randomInt;
    vehtypes = ["UK3CB_TKC_C_Lada", "UK3CB_TCK_C_Hatchback", "UK3CB_TCK_C_Hilux_Civ_Closed", "UK3CB_TCK_C__Hilux_Civ_Open", "UK3CB_TCK_C_S1203", "UK3CB_TCK_C_Skoda", "UK3CB_TCK_C_V3S_Closed", "UK3CB_TCK_C_V3S_Open", "UK3CB_TCK_C_UAZ_Open", "UK3CB_TCK_C_UAZ_Closed", "UK3CB_TCK_C_Ural", "UK3CB_TCK_C_Ural_Open", "UK3CB_TCK_C_Pickup"];
    
    veh = createVehicle [selectRandom vehtypes, position block_1_spawn];
    vc = createVehicleCrew veh;
        
    wp = vc addWaypoint [position block_1_stop, 0, 1];
    wp setWaypointType "HOLD";
        
    wp_2 = vc addWaypoint [position block_1_despawn, 0, 2];
    wp_2 setWaypointType "MOVE";
    
}];```
#

Hi... I've been trying to get this code to spawn a vehicle, but for some reason I can't get it to work...

If I do veh = createVehicle ["some_vehicle", position block_1_spawn];

It does work, but it won't if I try to get a random vehicle

#

Could someone help me? I will be eternally grateful

warm hedge
#

Doesn't work how?

rain fern
#

When selecting the addAction, the vehicle fails to spawn

kindred tide
#

hint what selectRandom returns before spawning it

rain fern
#

I did that previously, it returned what you'd expect "UK3CB_TCK_C_Ural_Open" for example

#

I tried to format it in case it wasn't returning a string just in case, neither case works

warm hedge
#

Any errors?

rain fern
#

Negative

kindred tide
#

it's like if the vehicle class was non-existent

warm hedge
#

Are you sure all of classNames there are all valid?

rain fern
#

I'll try with just 2 classNames that for sure work on their own

#

Okay I found the problem

#

I think, brb

#

I misspelled most vehicle classes with TCK instead of TKC

#

I would like to apologize for the wasted brain cells

warm hedge
#

No need to. Whenever it happens it happens

rain fern
#

Thanks to both for your help. Valuable lesson learned in debugging

stray jackal
#

Need armaism testimony. I've added an addaction onto some traders in my exile server so they switch to a standing idle position from a captive position simulating they were saved. the problem is, some of the traders default back to the captured animation and some of them don't

{
                    _allTraders = (getMarkerPos "MafiaTraderCity") nearEntities [["Exile_Trader_Hardware","Exile_Trader_Food","Exile_Trader_Armory","Exile_Trader_Equipment","Exile_Trader_SpecialOperations","Exile_Trader_Office","Exile_Trader_WasteDump","Exile_Trader_Aircraft","Exile_Trader_AircraftCustoms","Exile_Trader_Vehicle","Exile_Trader_VehicleCustoms","Exile_Trader_RussianRoulette","Exile_Guard_01","Exile_Guard_02","Exile_Guard_03"], 500];
                    for "_i" from 0 to (count _allTraders)-1 do
                    {
                        _trader = _allTraders select _i;
                        removeAllWeapons _trader;
                        _trader setVariable ["ExileAnimations", ["Acts_ExecutionVictim_Loop"]];
                        _animation = "Acts_ExecutionVictim_Loop";
                        _trader switchMove _animation;
                        _trader setCaptive true;
                        _trader addAction ["Release Hostage", 
                            {
                            (_this select 0) switchMove "HubStanding_idle1";
                            (_this select 0) removeAction (_this select 2);
                            }]; 
                    };
                };
#

i want them to change to the standing idle animation permanently after the add action has been used

little raptor
grizzled cliff
#

yea but i already wrote one for fast hash maps in ACRE

#

there is no getting around the slowness of arrays being used as hash maps

#

so if i have a GC for that, then dynamic objects are not that big of a deal

#

besides easier to write a GC than write all that typing stuff into a compiler :P

#

@fallen locust I want to roll this into CBA in the future, so at least then everyone will have it (well anyone that runs serious modifications).

grizzled cliff
#

Though to be fair I'd probably never use carma in my own projects simply because I already have existing codebases that are massive and arma doesn't really require an OOP language to do everything.

#

In fact I'd say its a benefit that it doesn't have OOP because most people have no idea what to do with OOP

#

most sqf coders are the equivelent of a virgin walking into a tantric sex seminar when it comes to programming concepts.

queen cargo
#

True dat @nou ... typing was a bitch

#

And still is

stray jackal
little raptor
#

that is the exile animation

#

_trader setVariable ["ExileAnimations", ["Acts_ExecutionVictim_Loop"]];

#

you should reset that too

#
params ["_trader", "", "_id"];
_trader setVariable ["ExileAnimations", []];
_trader switchMove "HubStanding_idle1";
_trader removeAction _id;
stray jackal
#

I'll give it a go, thanks!

#

Would it be better to set it to nil vs empty you think?

#

I can try both I guess

tulip ridge
sharp grotto
#

Same for the animation changes on "Release Hostage".

gusty flame
#

Can anyone explain to me why this returns "This value should be impossible to return" and only prints "In getdatapad string", "after unit", "at very end RET:" and "This value should be impossible to return": http://pastebin.com/srJxgiZM

#

I just don't understand how neither if nor else can be executed...

tough abyss
#

any way to disable nvgs without removing them? a event handler for when they are on would work

stray jackal
tough abyss
torn stream
#

Hey can someone help me out?
I'm making a campaign for a MilSim group i Zeus for and i need a Script that acts in the doors of the non-enterable CUP buildings so they can climb them, my first thought was making a trigger in each door where it creates a addAction to teleport to each trigger (one being the door on the bottom and the other the door on the top), i have one issue with the script i was using

trigArse attachTo [arse, [0,0,1]];}```

That is the trigger (Variable name =  Entrance1) in the door at the bottom of the building, and there's a trigger Building1 at the top of the building

I found this script online a while back that adds a Arsenal Action to players within the area, when left the addAction disappears

The problem is when i make the teleport script using this same format the addAction stays in the player like he didn't left the trigger and it will keep stacking, i need help figuring this out

Other methods are welcome, they are a Realism heavy MilSim unit so they wouldn't accept just a random flagpole there, and removing the flagpole model makes so the addAction does show up
candid sun
#

is there a decent explanation of arma's implementation of try/throw/catch anywhere? the ones on the wiki are bare bones

winter rose
tough abyss
winter rose
tough abyss
#

ah thank you i will look into this

tough abyss
#

nvm i see you linked it

winter rose
#

"nightVision" is the key

tough abyss
#

wait reforger has nightvision? ooh might have to explore that at some point between pulling my hair out dealing with enforce script

cosmic lichen
winter rose
south swan
#

it should fire at each and every vision mode change and i know at least one place where it's used to show a fullscreen dark overlay as a means to disable thermals

tough abyss
#

@gusty flame It isn't displaying "In First Else"?

#

And is it displaying any errors in there?

hallow mortar
tough abyss
gusty flame
#

No on both, I have show script errors on but it isn't giving me any errors

hallow mortar
#

The "Arma Reforger" column is for the Reforger-like control scheme preset in Arma 3. That page is a reference for Arma 3 only.

tough abyss
#

So it must be skipping over the entire if statement. I know everyone is different in their style of coding, but maybe the else { being on a seperate line than } is causing a problem?

gusty flame
#

I have plenty of other cases in my code where I have my elses like that and they work, but I'll try it anyway lol considering how weird this is

tough abyss
#

I always place the } else { on the same line, never tried it any other way haha

ornate whale
#

Will the if command return false or an error?

_var = nil;
if (_var-1 > 5) then {};
jaunty drift
#

try doing _var = _unit getVariable 'datapad_bioweapon_data'; and then if(_var)...

dreamy kestrel
#

Hello, I have the following properties defines for a UI button control, which play the appropriate sounds as expected.

soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1};
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1};

However, when I try to getArray soundClick[], for instance, and playSoundUI, A3 is telling me the file is not found in the logs. So, is there perhaps an unnamed extension for these embedded resources that the default 'just knows'?

// i.e.
private _args = getArray (_config >> "soundClick");
playSoundUI _args;
hallow mortar
tough abyss
#

try printing _var after that ^^^

hallow mortar
dreamy kestrel
#

it is correct, .wss, thanks...

hallow mortar
#

.ogg is one of the formats commonly used by the community, but a lot of the default game sounds are .wss.

dreamy kestrel
#

good to know, thanks man

jaunty drift
#

actually, what is 'data_bioweapon_data'? is it a boolean?

#

if not you need to compare that to something in order for the if statement to work

gusty flame
#

Changing the else did not work

#

It's going to be a boolean yes

dreamy kestrel
#

hmm, okay, it 'works' but the actual button click sounds rather muted, not sure why...
but when I play the resource itself from the config, it is MUCH louder... is there a volume squelch I may apply before I play it?

#

perhaps applying the getAudioOptionVolumes UI factor?

gusty flame
#

For now it's just nothing, haven't implemented it yet, so expecting to hit all the elses for now and return "no data on it"

#

I'll try the _var thing now

tough abyss
#

well if it doesnt exist then the getVariable returns nothing and the if statement breaks right?

gusty flame
#

I'm pretty new to Arma scripting, but in no other language I've used can an if-statement break :P It's either true or not, and if not the else is executed

#

I'm expecting getVariable to return nil here I guess, and I'm expecting an if(nil) to return false and execute else

tough abyss
#

Ive never been able to break an if statement before, but not saying it isn't possible.

#

I would try filling your unit with test data to begin with.

dreamy kestrel
#

tried that, or soundVolume, both of which claiming 1 for volume settings... other bits are diminished in getAudioOptionVolumes in particular, but I do not think those are appropriate for UI volume? could be wrong...

getAudioOptionVolumes;
// [0.085194,0,0,0.80622,1,0.693248]

I cannot imagine FX volume factor should be used here, but given the difference, it 'sounds' more plausible than UI.
ideas?

acoustic yew
#

Hello, Sorry for interjecting. May I ask how I can convert a string (leader convoyGroup) to an object that can be used? :D
Or just make it a variable that I can call in another script (different sqf script)?

fallen locust
#

use getVariable array i had similar issues before

hasty gate
winter rose
acoustic yew
winter rose
#

don't code while tired! ^^

dreamy kestrel
gusty flame
#

what do you mean by getVariable array? I'm pretty new to Arma scripting :)

fallen locust
ornate whale
#

Can I exit from a .sqf script like this? Will it return false? Or should I put _returnMe; once on the last line of the exitWith {_returnMe;}? ```sqf
if (_nearTargetsDistIndex == -1) exitWith
{
_returnMe = false;
_returnMe; //Needed here or redundant?
}

jaunty drift
#

try this

split oxide
#
if (_nearTargetsDistIndex == -1) exitWith
{
    false; 
}
jaunty drift
#

it should return "Data undefined"

ornate whale
sullen sigil
ornate whale
#

The assign operation returns true if successful, am I right? So basically the opposite of what I need.

tough abyss
#

That was what I was thinking ^^

little raptor
#

it doesn't return anything

little raptor
ornate whale
little raptor
#

I meant generally

dreamy kestrel
ornate whale
winter rose
gusty flame
#

Haha wow :O that worked. Never have I ever worked with a language quite like this one before hehe.....

#

Thanks for the help guys!

stray jackal
still forum
hardy valve
#

Hello - If one was to create an AFK script for a server to check player location, would it also be possible to check if a key is being held for x_ amout of time?

For example, a player is trying to avoid the AFK (position check) and place an item on their keyboard making them continue to move to avoid being kicked

granite haven
#

You can have an onKeyDown EH, store the last key pressed and time in an array, if the button pressed is the same as the first element in the array then substract current time from last time and then you have seconds inbetween

ornate whale
#

Would a standalone string work as a return value? Thanks

getSomeString =
{
_nonsesHere = 1 + 2 - 1 - 2;

... ... ...

"Hey there!"; //Return value
};

hint call getSomeString; //Will it display hint with "Hey there!"?
dreamy kestrel
tulip ridge
#

Are there general "player is in zeus" or "player is in camera" checks?

#

Kinda like how there's is3DEN

warm hedge
#

In Zeus, search by curator and interface

#

Camera, no. There's no command

tulip ridge
#

Figured that was how I'd have to do it
By chance do you happen to know what display the camera ui is in?

warm hedge
#

Camera UI?

#

Camera has no UI

tulip ridge
#

The splendid camera, where you can change the weather, time, angle, etc. etc.

warm hedge
#

I'll check later after I eat

tulip ridge
#

Appreciate it, if I had to guess it'd be in "GUI_displays", couldn't find a specific display for it on the allDisplays page

warm hedge
#

It is obtainable by findDisplay

tulip ridge
#

I was looking on the IDD List but can't seem to find the one for the camera.

warm hedge
#

configfile >> "RscDisplayCamera" >> "idd" 314

tulip ridge
#

πŸ‘

#

Appreciate it

desert socket
#

How do I create a custom 3dsound and play it using a script or addaction?

#

Is it the same as making a music file?

hallow mortar
hardy valve
warm hedge
#

Just while?

hardy valve
tulip ridge
#

Yep

#
while { /* condition, could just do true to always run*/ } do
{
    // destroy trees
    sleep 1800;
};
hardy valve
#

appear correct?

tulip ridge
#

Yeah

hardy valve
#

THANKS

tulip ridge
#

πŸ‘

kindred lichen
#

Sqf doesn't support if then else does it?

desert socket
#

How can I change the atmosphere color?

warm hedge
#

There is no direct and easy way

#

Overcomplicated way exists though

desert socket
#

Is there a way to make the sky/fog an orange color?

warm hedge
#

Same answer

jaunty zephyr
#

wot

#

if (condition) then { something; } else { someting_else;}; ?

hallow mortar
little raptor
little raptor
#

worst case scenario is you crash/freeze the game blobdoggoshruggoogly

#

(well you could also erase saved stuff if you mess with profileNamespace...)

candid sun
#

what's a better idea for getting players' inventories in MP and saving to a db?
a) using BIS_fnc_saveInventory (which i just discovered)
b) continuing using my own functions

drowsy geyser
#

Why are some gestures not working?
player playAction "gesturePoint";
the above for example does nothing

warm hedge
#

It probably is not configured well for your current animation

#

Or try playActionNow

drowsy geyser
#

hmm doesn't seem to work

warm hedge
#

Then it doesn't

drowsy geyser
#

haha xD

drowsy geyser
#

no still nothing

#

this for example work:
player playAction "GestureLegPush"

warm hedge
#

Again

It probably is not configured well for your current animation

drowsy geyser
#

ah okay just noticed if i hold a weapon it works

hasty gate
stray jackal
#

What makes you think the event handler is causing it?

candid sun
#

lol i just noticed an Ali G reference in bis_fnc_respect

#

default {hintc "NO RESTECP!\nError in respect evaluation script."};

hasty gate
cosmic lichen
#

Why not use setCaptive instead?

queen cargo
#

A

#

dont even consider bothering with own functions if BIS already did the work for you ...

#

also ... why the hell you want to save inventories?!

native hemlock
#

really? Unless his function is written poorly it would be better since bis_fnc_saveInventory returns an array and saves to the profilenamespace, which is relatively taxing. It also still uses bis_fnc_param

queen cargo
#

ye youre right @native hemlock
better write your own function by copy the BIS function and changing those lil things

#

thats the good way

#

because reinventing the wheel always worked

#

and redundant coding is good

#

🍭

thick merlin
#

I am getting an error with this code-

#
sleep 1.5;
if ((_h1 distance pzsmokepos1 < 2300) && (activate1))  || ((_h2 distance pzsmokepos1 < 2300) && (activate1)) exitWith {};
};```
#

Any help appreciated.

#

Thanks

sullen sigil
#

what is the error

thick merlin
#

type bool .expected if.

#

But i think i fixed it.

sullen sigil
#

you need parentheses around the entire condition

#

if (true || false) exitWith {};

thick merlin
#

Yup.Got it Huge thnx for the immediate reply!!

#

πŸ‘πŸ»

candid sun
#

think i'll stick with my functions, will be easier to debug in future

#

and i'm saving inventories, etc, so everything's persistent after mission restart, what's weird about that?

#

saving the engine and light status of every vehicle on the map...now that's weird

queen cargo
#

as long as you do not plan to do some weirdo altis life or wasteland thing you simply do not need any database

fallen locust
#

only player stuff or vehicles as well @candid sun

candid sun
#

both

fallen locust
#

have fun

#

as contents of backpacks is a nightmare

thick merlin
#

Me again. i have this in a script

#
sleep 1.5;
if ((_h1 distance _pzsmokepos < 2300) && (activate1)  || (_h2 distance _pzsmokepos < 2300) && (activate1)) exitWith {};
};```
#

and i have

#

activate1

#

in a waypoint but i dont think the script is getting the condition activated

#

any thing i am missing?

#

Thanks

fallen locust
#

saving is prity easy

#

loading it is another story

thick merlin
#

Also , i have activate1 = false;

#

in my initplayerlocal file

candid sun
#

ah, backpacks inside vehicles?

thick merlin
#

i think i needed this to be defined correctly in the script _activate1 = activate1;

fallen locust
#

yes

#

and then you have weapons with attachments in thoes

candid sun
#

well

south swan
#

i have activate1 in a waypoint
Wut?

candid sun
#

fuck those backpacks then

fallen locust
#

its just a nightmare to load

manic sigil
candid sun
#

yeah i think i'll work on saving bullet count in each magazine first

#

that'll be much more enjoyable

thick merlin
#

think i got it friend.i forgot to add it in the defines.just testing now.:)

ornate whale
#

Hmm, is there even any debuggin tool for SQF? πŸ€”

thick merlin
#

0 = [] spawn {

private["_p1","_p2","_base","_h1","_h2","_activate"];
_p1 = p1;
_p2 = p2;
_base = carrier;
_h1 = h1;
_h2 = h2;
_activate = activate0;

while {true} do {
sleep 1.5;
if ((_p1 in _h1) && (_activate) || (_p2 in _h2) && (_activate)) exitWith {};
};



uisleep 1;

[_p1,"RadioMsg_Request_takeoff"] remoteExec ["sideRadio",0];
uisleep 5;

[_base,"RadioMsg_Request_takeoff_TowerReply"] remoteExec ["commandRadio",0];
uisleep 5;

[_p1,"RadioMsg_Request_takeoff_confirm"] remoteExec ["sideRadio",0];
uisleep 10;

"Reminder: Adjust View Distance Before Take Off" remoteExec ["hint", 0];


[[this]] call ANZ_heli_mission_fnc_pzchat1;
};```
#

error is undefined variable in expression.

#

activate0 = true;

#

in a waypoint

#

any help appreciated

ornate whale
thick merlin
#

dunno.A handle iam guessing.

#

not even a novice sqf coder...

ornate whale
# thick merlin not even a novice sqf coder...

If you declare a function with a variable then you probably might want to put the code after the equal sign into curly brackets.
0 = { [] spawn { ........... }; }; One closing bracket is for spawn and one for the whole fucntion.
And I would probably choose more self-explanatory name for a function instead of just "0". πŸ˜„

fallen locust
#

as long as you dont go into contents of containers in vehicles its pritty easy

thick merlin
#

that fixed it m8.πŸ‘πŸ»

#

it ran ok b4.is the activate bit a variable?

#

i am working from examples from internet

ornate whale
# thick merlin it ran ok b4.is the activate bit a variable?

Usually it might skip some wrong lines of the code, and then stop after the compiler/parser realizes that the context of what it originally thought it is in is now completely different. For example when you forget ; or combime two not corresponding brackets like { and ).

thick merlin
#

rgr that.Thnx

ornate whale
# thick merlin rgr that.Thnx

Usually u use {} for a code block, () for regular expressions (if statements) and for setting calculation priorities, and [] for arrays or arrays of arguments that go into function as an input.

thick merlin
#

Np.Thank you!

#

iam using this code and it works but shouldnt it be && instead or?waitUntil {uisleep 1;{!(alive _x) || _x in _heli} count units _grp == count units _grp}; _copilot vehicleRadio "RadioMsg_troops_on_board";

queen cargo
#

cant be that hard @fallen locust ...
hell -.-' if i would not be compeeting against @grizzled cliff ... i would spend the this WE with writing some fancy function for that

granite sky
#

Probably correct? If some guy is dead you're not expecting him to board to continue.

thick merlin
#

it works correct though.of what i have seen..

#

should this part _x in _heli

#

be in bractes?

#

()

#

*brackets

granite sky
#

Doesn't need to be.

thick merlin
#

does the first part need them?

granite sky
#

and/or have lower precedence than other binary commands.

#

No, !alive _x is fine but it looks odd to some people.

#

however !(_x in _heli) would need brackets.

#

unary commands are higher precedence than binary commands.

thick merlin
#

Thnak you.

#

! = is?

granite sky
#

what?

thick merlin
#

!(alive _x)

ornate whale
# thick merlin ! = is?

It is a negation. Not alive. !alive means return true, if the unit is not alive.
alive _x --> is _x alive?
!alive _x --> is _x not alive?

thick merlin
#

means is alive?

fallen locust
#

It gets retarded pritty quick

thick merlin
#

np.getting a lil mixed up..

#

i got it thanks.

fallen locust
#

try it ;)

thick merlin
#

Appreciate you blokes patience

#

πŸ‘πŸ»

ornate whale
#

Also I think that uisleep 1 could be replaced with sleep 1. But I don't want to confuse u even more. πŸ˜„

thick merlin
#

np.i was unsure of that.i thought i read that uisleep was better

granite sky
#

yeah uiSleep is a common cargo cult.

thick merlin
#

sleep 1; // waits for 1 second in-game, 4 IRL seconds (1 / 0.25)
uiSleep 1; // waits for 1 IRL second

granite sky
#

uiSleep is for stuff that should delay in real time rather than simulation time. Primarily UI, hence the name. If you're wondering whether you should use it for something, think what you want to happen when the game's paused in SP.

thick merlin
#

np.again thanks

#

so pretty much all the scripts i have posted should be sleep and not uisleep?

granite sky
#

That would be the general rule.

#

waits for 1 second in-game, 4 IRL seconds
This is not true, because setTimeMultiplier doesn't affect simulation time.

ornate whale
#

If u used the uisleep 1 then the condition would be checked once a second even if you paused the game with escape button. But when the game is paused, you don't need to check it, because no unit would enter or leave a vehicled during that time. Basically, the uisleep timer never stops, and the sleep timer stops when the game is paused.

queen cargo
#

im used to retarded shit ... hell i wrote XMedSys after like one and a half month practice in SQF