#arma3_scripting

1 messages · Page 766 of 1

shadow sapphire
#
//Blue Trigger 1
    _SectorFIA_1 = createTrigger ["EmptyDetector", markerPos "Sector_1", false];
    _SectorFIA_1 setTriggerActivation ["ANY", "PRESENT", true];
    _SectorFIA_1 setTriggerArea [100, 100, getDir this, true];
    _SectorFIA_1 setTriggerInterval 5;
    _SectorFIA_1 setTriggerStatements [
        toString {East countSide thisList < 0.4*(West countSide thisList);},
        toString {
            DeleteMarker 'Objective_1';
            _Flag = createMarker ['Objective_1', markerPos 'Sector_1'];
            _Flag setMarkerType 'Flag_FIA';
            private _lastOwner = thisTrigger getVariable ['currentOwner', sideUnknown];
            If (_lastOwner == East) then {
                RedZones = RedZones -1;
                PublicVariable 'RedZones';
            };
            thisTrigger setVariable ["currentOwner", West, true];
            BluZones = BluZones +1;
            PublicVariable 'BluZones';
        },""
    ];
};```
#

Sorry, can’t format from phone. Will fix.

The script has been looked at on this channel before. Its goal is to create sectors for control, as I don't like the vanilla sector system and don't know how to modify it.

This script is adding zones appropriately, but it is not deleting zones as intended, which is necessary for my ticket bleed script.

granite sky
#

Aren't they simply different triggers, so _SectorFIA_1 never has currentOwner east and _SectorAAF_1 never has currentOwner west?

shadow sapphire
granite sky
#

You're creating two separate triggers but you need a single toggle variable, right

shadow sapphire
#

Indeed.

granite sky
#

If they're related to a single objective marker name then you could chuck those in a hashmap, maybe

shadow sapphire
#

They are able to communicate about the marker...

granite sky
#

Yeah sadly there's no marker object to put vars on.

shadow sapphire
#

Yeah, they delete and recreate the same marker. Idk why I didn't think of it earlier, My scoring system could literally just count which types of flags are on the map.

granite sky
#

oh, you could go by marker type here, I guess?

#

Assuming that it's static.

shadow sapphire
#

I think so. I've got hd_objective_noShadow which means no one owns the zone, and I've got Flag_Altis and Flag_FIA representing opfor and blufor respectively.

#

They are already deleted and recreated perfectly in game using this script.

granite sky
#

Not sure why you don't just setMarkerType in those triggers.

shadow sapphire
#

Because I didn't know any better. There is likely a more elegant way to do every single portion of this script. I am not a coder.

granite sky
#

hmm, that's pretty good for a non-coder :P

shadow sapphire
#

It's a combination of copy/past/trial/error from the BIS Wiki and then coming here for help when I'm not getting an error to tell me what to do next.

granite sky
#

(this is what coders do)

shadow sapphire
#

Fair enough. Would you have any tips on how to count by marker types?

BRB, going to check on setting the marker type without the deletion and creation. Maybe there is a reason I did it that way.

granite sky
#

There's a JIP bug with changing the same marker multiple times, so that might be a thing. I should probably make a replication case for that.

shadow sapphire
#

Oh! No kidding. Well, that’s good to know.

#

There also appears to be an issue with scope. It’s not working without using the local _Flag tag inside the trigger.

granite sky
#

well, you'd do 'Objective_1' setMarkerType 'Flag_FIA'

#

Markers are a bit odd in SQF because they're not a separate type. They're just a string that can reference a bunch of internal data.

shadow sapphire
#

Setmarkertype is working now. I’m a bit concerned about the JIP bug, and may save this revision for later.

In either case, I think some method of counting flag types MAY be the solution I need, unless what you’re telling me about them being odd strings is an obstacle.

granite sky
#

Where I've seen the JIP bug it was specific to marker colour, so type might be fine.

shadow sapphire
#

That’s good to know! Would greatly reduce the size of my script by cutting two lines forty eight times.

granite sky
#

well, if you have a list of your objective markers, you'd just do something like:

{ markerType _x == "Flag_FIA" } count mytag_objectiveMarkers;
#

If you're actually pasting all this trigger code for every objective then there are definitely better ways to do that :P

shadow sapphire
#

A list?

Oh, trust me, I know there are better ways, I just don’t know them. There is probably a way to get everything I need from thirty lines of code, rather than hundreds of repasted lines.

granite sky
#

Are sector markers ("Sector_1" etc) from the SQM?

#

Like placed in the editor

shadow sapphire
granite sky
#

So first you could make an array of them, like this:

allMapMarkers select { _x find "Sector_" };
#

Oh for fuck's sake, why doesn't this work sometimes

shadow sapphire
#

That is intriguing.

granite sky
#

So then you can forEach over that array to generate your triggers.

#

Generating the objective markers at the same time, and attaching them to the relevant triggers with setVariable.

shadow sapphire
#

I’ve tried something like this before, but I didn’t understand and reverted to what was working for me.

If I COULD get that to work appropriately, then we’d really be saving me some work in the future.

winter rose
granite sky
#

Discord syntax colouring

tranquil jasper
#

"sqf" should be on the same line as ```

#
hint "hello world";
#

"sqf" turns green when it's right, then you're good to go. Also no space ```sqf

shadow sapphire
#

Now I've got this, which works and is, I think, easier to read.

I'm not creative enough to know how to capture the marker types and count them.

If (isServer) then {
    'Sector_1' setMarkerType 'hd_objective_noShadow';

    //Red Trigger 1
    _SectorAAF_1 = createTrigger ["EmptyDetector", markerPos "Sector_1", false];
    _SectorAAF_1 setTriggerActivation ["ANY", "PRESENT", true];
    _SectorAAF_1 setTriggerArea [100, 100, getDir this, true];
    _SectorAAF_1 setTriggerInterval 5;
    _SectorAAF_1 setTriggerStatements [
        toString {West countSide thisList < 0.4(East countSide thisList);},
        toString {'Sector_1' setMarkerType 'Flag_Altis';},""
    ];

    //Blue Trigger 1
    _SectorFIA_1 = createTrigger ["EmptyDetector", markerPos "Sector_1", false];
    _SectorFIA_1 setTriggerActivation ["ANY", "PRESENT", true];
    _SectorFIA_1 setTriggerArea [100, 100, getDir this, true];
    _SectorFIA_1 setTriggerInterval 5;
    _SectorFIA_1 setTriggerStatements [
        toString {East countSide thisList < 0.4(West countSide thisList);},
        toString {'Sector_1' setMarkerType 'Flag_FIA';},""
    ];
};```
shadow sapphire
crude vigil
#

Easier to manage, easier to modify when you want a change.

shadow sapphire
#

I don't even know what layers are.

crude vigil
#

check left hand side on 3den, each folder is called "layer"

shadow sapphire
#

Oh! It's just editor object groups. Cool.

crude vigil
#

every object is listed inside a layer basically. Although not sure if default ones are counted as layers too...

#

but yeah just create a new folder there, then reach to it by calling its name with the command I linked above.

shadow sapphire
#

Defaults appear to be called as layers, but not "returned" as layers. So likely not "counted."

crude vigil
#

No need to categorize anything. No need to remember anything in case of modification. If you are afraid to forget, slip a "Comment" inside the layer too.

#

Once done, hide them, live happily ever after.

granite sky
#

@tranquil jasper I'm aware of that. There's just some discord bug where it decides it's going to ignore it, and you have to rewrite the whole comment from scratch to kick it into life.

tranquil jasper
#

Just keep in mind for locality that you've restricted the trigger to only get created on, and local to, the server

shadow sapphire
tranquil jasper
#

saving some server processing in return for dealing with a lot more locality bullshit

shadow sapphire
shadow sapphire
little raptor
sage heath
#

hey i wonder

#

is there a script that would automatically deploy your parachutes, the moment you exit from a trigger?

#

kinda like a static line, but i cant use ones that are already in game

little raptor
#

what do you mean by static line? thonk

little raptor
sage heath
#

no no, not like that

#

i meant as in, when the player jumps out, the chute automatically deploys, like a static line chute

sage heath
sage heath
#

and no the players do not start in the vehicle passenger seat

#

its on a static plane, inside the cargo bay

drifting portal
#

Ah

sage heath
#

and they simply...walk off

#

yeah see the problem now?

drifting portal
#

Well

sage heath
#

you helped me script this last week if you remember XD

drifting portal
#

You could have a loop that checks every 2.5 seconds or so if their altitude is lower than the aircraft's altitude

#

Then when thats true you deploy the parachute and break the loop

#

But I'm trying to think of a better way

sage heath
#

leopard helped me write a script (or the condition to activate said script) last week, that i think we could replicate, where the moment the player enters a halo animation, the script is exceuted

drifting portal
sage heath
#

(i think) i just need the second part which opens the parachute thats on the players back once that condition is filled

drifting portal
#

But I'm not sure if they will halo jump or will just fall like a stone

sage heath
drifting portal
#

Get the name of the halo jump

sage heath
drifting portal
#

And compare the _anim parameter to it

sage heath
#

also i need to mention: i know very little about scripting, besides the very basic stuff

#

so talk to me like im 5(?)

drifting portal
#

I can only talk to you if you are 4 sorry

sage heath
#

dang

drifting portal
#

You see that _anim?

sage heath
#

yes

drifting portal
#

First jump off the the thing yourself and

#

When the halo animation starts

#

Put in debug

#

animationState player;

#

It should give you the animation name for halo jump

#

Then simply put in the evnt handler an if Statment that checks if _anim == halo jump then the parachute

sage heath
#

again look: like i said i have everything related to the animations handled(ish)

#

i just need to know if you can open a parachute on someones back, with a script

drifting portal
#

That's cringe

#

There is a better way

sage heath
#

ok, go for it

#

this is the eventhandler, leopard wrote, i already have this part

if ("halo" in _this#1) then { script goes here }};```
#

i just need the script goes here, where the parachutes are opened

drifting portal
#
_chute = createVehicle ['Steerable_Parachute_F', position Player, [], 0, 'CAN_COLLIDE'];
player moveInDriver _chute;
sage heath
#

thank you!

#

wait, so question, if the player has a parachute on his back does that, interfere with that?

drifting portal
#

No

sage heath
#

ok perfect

drifting portal
#

It just

#

Spawns a parachute

#

And moves you into its driver seat

#

No matter what backpack you have

sage heath
#

ok neat

#

testing it

drifting portal
sage heath
#

yeah

#

forgot to add a ; to the previous code

#

💀

drifting portal
#

Typical silliness

#

Lol

sage heath
#

ok, didnt spawn the parachutes

#

ok just to make sure, you put this in...initplayerlocal.sqf correct?

sage heath
#

yeah didnt spawn the parachutes

#

bare in mind its working with another event handler thats got the same conditions

drifting portal
#

Try
_chute = createVehicle ['Steerable_Parachute_F', position Player, [], 0, 'CAN_COLLIDE'];
In debug

sage heath
#

heres what the entire file looks like


player setVariable["loadout", getUnitLoadout player];
hint "Selected gear saved!"

}] call CBA_fnc_addEventHandler;

sleep 10;
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_this#0 setVelocity (plane1 vectorModelToWorld [0, -150, -3]);
_this#0 removeEventHandler ["animStateChanged", _thisEventHandler]
}
}];

sleep 10;
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_chute = createVehicle ['CUP_T10_Parachute_backpack', position Player, [], 0, 'CAN_COLLIDE'];
player moveInDriver _chute;
}
}];
drifting portal
sage heath
#

negative, nothing happens

#

i just keep falling

fair drum
#

you want to spawn the chute at [0,0,0] then move it to the player

sage heath
#

and yes i've tried with the base game parachute

sage heath
#

yeah...what do i have to write...exactly?

drifting portal
#
_chute = createVehicle ['Steerable_Parachute_F', [0,0,0], [], 0, 'CAN_COLLIDE'];
_chute setpos (getpos player);
player moveInDriver _chute;
fair drum
#

nope

drifting portal
#

Wait

#

I'm editing on phone

#

1 minute

sage heath
#

yep, trying

drifting portal
#

F

fair drum
#

!quote 5

lyric schoonerBOT
drifting portal
#

I hate ASL i hate ASL

sage heath
#

setposatl or asl?

fair drum
#

doesn't matter. just not setPos

sage heath
lyric schoonerBOT
fair drum
shadow sapphire
#

What is so bad about setPos?

#

There is tons of stuff left in the game that is mostly there just because it didn't exist when crucial scripts were written back in the day, yeah or nah?

fair drum
shadow sapphire
#

Ah, I gotcha.

fair drum
#

unpredictable behavior

drifting portal
#

Yep

sage heath
#

so which flavor of the month should i use here? ATL or ASL?

drifting portal
#

Hypoxic help the guy if you may my fingers are getting flattened

fair drum
sage heath
#

ok? atl i guess?

shadow sapphire
#

I don't want to barge into something here, so I can wait if needed, but would anyone be able to set me on the correct path to understand how to make something basically drain one ticket per second as long as a certain condition is true? My code might already be correct, but I'm not sure of the best way to check the conditions or trigger the function.

While {RedZones < (0.6*BluZones)} do {
  Sleep 1;
  RedTickets = RedTickets - 1;
    PublicVariable 'RedZones';
};```
drifting portal
#

Still confused about the [0, 0,0], had a script that spawned it on player and worked normally hmmm

sage heath
#

yeah, still no

#

tested, and uhhh no chutes

drifting portal
#

What is the debug returning

fair drum
#

just do the chute itself, forget all the other animation stuff.

#

work backwards

#

get the pieces working first, then put it together

sage heath
#

execute this in debug?

drifting portal
sage heath
#

yeah ok now it works

#

ok then back to one of my theories, there are 2 same eventhandlers in one file

#

is that the source of the peroblem?

#

its

player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_this#0 setVelocity (plane1 vectorModelToWorld [0, -150, -3]);
_this#0 removeEventHandler ["animStateChanged", _thisEventHandler]
}
}];

sleep 10;
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_chute = createVehicle ['Steerable_Parachute_F', [0,0,0], [], 0, 'CAN_COLLIDE'];
_chute setposATL (getpos player);
player moveInDriver _chute;
}
}];```
fair drum
#

I don't want to outright give you the answer, but rather show you how to get to the answer

sage heath
#

dog

#

its 0131

#

in the am

#

please

drifting portal
#

No

#

Learn my friend

fair drum
#

so first, check to see if your event handlers are even firing when you want them to

sage heath
#

yes the one above is firing

#

the one below isnt

#

the top one is to simulate inertia from jumping off an aircraft

#

i could feel it, so its working

drifting portal
#

Use systemchat "text"; to confirm

fair drum
#

btw, if you are using setposATL you need to use getPosATL

sage heath
#
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_chute = createVehicle ['Steerable_Parachute_F', [0,0,0], [], 0, 'CAN_COLLIDE'];
_chute setposATL (getpos player);
player moveInDriver _chute;
systemchat "text"
}
}];
``` making sure
drifting portal
#

getposASL must be added!

sage heath
#

ahem

drifting portal
#

Don't look at me like that or I will do silly stuff with cursorobject

#

Anyways

sage heath
#

havent tested, im doing it now

drifting portal
#

It should show in chat

sage heath
#

no

#

ok im leaning towards the 2 event handlers conflicting theory

drifting portal
#

He said it doesn't show text

sage heath
#

the eventhandler never fired

#

(?)

drifting portal
#

Either that or the if Statment is wrong

sage heath
#

leopard wrote it

#

so, it cant be, or highly unlikely

drifting portal
#

Now

#

Try putting the systemchat "text";

#

Above the if Statment

#

But still inside the event handler

#

If it says text in chat, that means the event handler is firing

sage heath
#

so im testing again

drifting portal
sage heath
#

still no

#

OH

#

nvm

#

just re read

drifting portal
#

May I know why you have a huge sleep before each event handler?

#

sleep 10;

sage heath
#

oh that

#

so basically the players starts off already in a halo anim for a brief second

#

before the game goes "wait im on solid ground"

#

so its to prevent the eventhandlers firing off too early

drifting portal
#

10 seconds?

sage heath
#

changed it to 5

sage heath
# drifting portal Above the if Statment

like this?

player addEventHandler ["animStateChanged", {
systemchat "text";
if ("halo" in _this#1) then {
_chute = createVehicle ['Steerable_Parachute_F', [0,0,0], [], 0, 'CAN_COLLIDE'];
_chute setposATL (getposATL player);
player moveInDriver _chute;
}
}];
#

hey if i did this wrong

#

you said above

sage heath
#

ok

drifting portal
#

params ["_unit", "_anim"];

sage heath
#

hey you're not gonna believe this

#

but

#

no system chat

#

but it works

drifting portal
#

And then change the if Statment to ("halo" in _anim)

sage heath
#

somehow

drifting portal
#

I'm as confused as an AI helicopter trying to land on flat plains

fair drum
drifting portal
#

Probably because I have been awake for 22 hours

sage heath
drifting portal
#

You made it so that

sage heath
#

so thats why im here
the first sqf i made to save loadouts, it took me 8.5 hours, i had 200 hours in the game and minimal 3den experience

drifting portal
#

It takes 20 SECONDS to assign the parachute EH

#

Too much

sage heath
#

oh fuck

drifting portal
#

The bruh moment

sage heath
#

i thought they both fire off at 10 seconds not one after the other

drifting portal
#

Lol no worries

drifting portal
sage heath
#

yeah, thats...whats on there

shadow sapphire
sage heath
#

theres a sleep 10; in front of both

#

well

#

3 now

#

point stands

tranquil jasper
#

setPos is fine as long as you understand how it works tbh

fair drum
drifting portal
#

But he wanted to be specific with a starter

#

Can't blame him

shadow sapphire
sage heath
#

ok, NEW PROBLEM, that i kinda saw coming

#

so uhhhhh now with the chute deploying, its crashing into the plane, because it deployed immediately

#

but then, i put sleep in, to delay it, yeah...

#

not allowed

fair drum
#

spawn it

drifting portal
#

He will confuse the parameters

sage heath
#

also, ouch, but not wrong

drifting portal
#

No its pretty common to confuse parameters in spawn

#

Especially with your setup

sage heath
#

ah ok

#

yeah no, have no idea what hypoxic means

fair drum
#
player addEventHandler ["AnimStateChanged", {
    _this spawn {
        params ["_unit", "_anim"];

        if ("halo" in _anim) then {
            sleep 3;

            private _chute = createVehicle ["Steerable_Parachute_F", [0,0,0], [], 0, "NONE"];
            _chute setPosASL (getPosASL _unit);

            _unit moveInDriver _chute;
        };
    };
}];
shadow sapphire
# fair drum spawn it

It's being executed in the server init with [] spawn and is apparently firing, as it's giving me the hint I was seeking.

sage heath
#

ok, testing

shadow sapphire
fair drum
#

sorry

shadow sapphire
#

Nope, my fault.

drifting portal
#

I think it will spawn a parachute after each animation change?

fair drum
#

yes i forgot the if statement, give me a sec

sage heath
#

yeah was about to say

#

i was usually counts to 10

#

to make sure i dont outrun the sleep

fair drum
#

fixed

sage heath
#

then the parachute spawned in my face XD

#

no worries

#

thank you, btw

sage heath
drifting portal
#

learn this too

#

very cool

sage heath
#

yep, everything works

#

thats it, you guys got it

#

thank you!

#

so much

#

ok i was wrong, so minor problem

#

switched the chute to, one from cup

#

its called CUP_T10_Parachute_backpack

#
    _this spawn {
        params ["_unit", "_anim"];

        if ("halo" in _anim) then {
            sleep 3;

            private _chute = createVehicle ["CUP_T10_Parachute_backpack", [0,0,0], [], 0, "NONE"];
            _chute setPosASL (getPosASL _unit);

            _unit moveInDriver _chute;
        };
    };
}];
#

put this in, now its broken

#

fuck

fair drum
#

i bet that's not the class you want

sage heath
#

uhhhh wdym?

fair drum
#

because that is referencing the backpack, not the functional parachute itself. just like steerable_parachute_f is one of the variants of steerable_parachute_blahblah

sage heath
#

oh crap

#

how do you uhhhhh find, the name of the chute?

fair drum
#

I would have to look through CUP's config to see what they have in there. For giggles, just remove the _backpack and try it

sage heath
#

ok

#

honestly, im just looking through the config

#

wait how do you get to cfg backpacks (if theres one)

#

it only shows, vehicles, weapons, ammo and mags

#

nvm, got it

#

just right clicked and find in config viewer

sage heath
fair drum
sage heath
#

fixed btw

fair drum
#

and you also should remove the event handler

sage heath
#

its because i was wearing a t10 already

#

how come?

fair drum
#

you only want it to fire once right? just in case the player ever goes into a halo animation again?

sage heath
#

yeah

#

so jsut this?

        params ["_unit", "_anim"];

        if ("halo" in _anim) then {
            sleep 3;

            private _chute = createVehicle ["CUP_T10_Parachute", [0,0,0], [], 0, "NONE"];
            _chute setPosASL (getPosASL _unit);

            _unit moveInDriver _chute;
        };
    };
#

everything, in total```sleep 3;
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_this#0 setVelocity (plane1 vectorModelToWorld [0, -150, -3]);
_this#0 removeEventHandler ["animStateChanged", _thisEventHandler]
}
}];
_this spawn {
params ["_unit", "_anim"];

    if ("halo" in _anim) then {
        sleep 3;

        private _chute = createVehicle ["CUP_T10_Parachute", [0,0,0], [], 0, "NONE"];
        _chute setPosASL (getPosASL _unit);

        _unit moveInDriver _chute;
    };
};
fair drum
#

technically you could just combine the two handlers into one anyways

sage heath
#

also duplicating parachutes is still a problem

sage heath
fair drum
#

then just add some more delays

sage heath
#

oh i know why

#

no sleep at the top

fair drum
#

I'm just gonna consolidate this into one anyways

sage heath
#

also: undefined variable in expression _thisEventHandler

sage heath
sage heath
fair drum
#

the duplicating parachute thing, are you using CUPs automatic line feature or something?

sage heath
#

no, im just walking off the aircraft

#

without the script, this already wont trigger

#

so its not a problem

fair drum
#

the duplication happens with the base arma parachute too?

sage heath
#

ill try

#

nope

#

prob a mod thing

fair drum
#

then it has something to do with that CUP parachute and backpack

#

it must automatically detect if you are falling and do something itself

#

take the backpacks off of everyone

sage heath
#

already did, and uhhh still an issue

sage heath
#

prob, just a problem with the cup chute

#

found the culprit, that affects the cup chute, it is the backpack, not just one, its any really

#

ok so i feel like im fucking schizo now, cuz i tried with backpack on and its gone

#

prob because you merged the ehs

#

so thank you! you saved my bacon

#

worked PERFECTLY, thanks @fair drum !

modern meteor
#

Hello, I have a bunch of scripts which I would like to convert into a mod. Does anyone know about a manual how to do this?

haughty bone
#

Greetings, I am working on a simple script for a squad to move from waypoint to waypoint. I have it setup like this right now: ```_attackSquad01 setBehaviour "SAFE";

_waypoint01 = _attackSquad01 addWaypoint [_waypointPos01,0];
_waypoint02 = _attackSquad01 addWaypoint [_waypointPos02,0];
_waypoint02 setWaypointType "SAD";``` I basically want them to to switch from Safe/careless to Aware when they arrive at Waypointmarker 1. Is there an way to filter through their set waypoints to see which one they are walking to at the current time?

cold flower
#

On a waypoint by waypont basis

haughty bone
#

that's the thing. I dont spawn in the units until a specific thing is triggered

#

basically its a QRF attack group when my player team gets nearby the objective

haughty bone
haughty bone
lost dock
#

Hi all I am looking for someone to help me set up and script a 24/7 public server and just wondering if this is the right place to do this

lost dock
dry valley
#

trying to find out what is giving me this error, and google wont help me :\ anyone know what DestructionEffects.side means? other than something is wrong with my DE structure or naming

dry valley
#

bin`config.bin/CfgVehicles/DestructionEffects.side'.

ebon citrus
dry valley
#

i guess since mikero packs with haleluja etc its fine, but probably named wrong on something

ebon citrus
dry valley
#

haha

ebon citrus
#

It doesnt stop you from making mistakes

dry valley
#

true

ebon citrus
#

I suppose that's no entry error

#

Somewhere you inherit DestructionEffects inside your cfgvehicles

#

Try inheriting it from outside cfgVehicles

dry valley
#

but isnt it supposed to be redeclared?

#

im like a week old in this so trying to understand everything, you are probably right..

#

ill try

#

thanks!

ebon citrus
#

DestructionEffects is declared inside your vehicle class

#

But i suppose your just inheriting it in cfgVehicles root

#

Dont do that

dry valley
#

aaah ive missunderstood the wiki

#

it makes sense now

ebon citrus
#

Probably not

dry valley
#

i think lol

ebon citrus
#

@dry valley tbh, when in doubt, just check how bi has done it

marsh drift
#

I tried your advice out, but it throws me this error: _vehicle (#)animateSource [_anim,_phase]; ... Error Type Any, ecpected String
Config.cpp

class Eventhandlers: Eventhandlers
class openHatches
{
    TurnIn = "[_this#0, 0] call jzra_sb_fnc_openHatches";
    TurnOut = "[_this#0, 1] call jzra_sb_fnc_openHatches";
};

class CfgFunctions
{
    class jzra_sb
    {
        class scripts
        {
            file = "\jzra_sb\scripts"; 
            class openHatches: lightToggleColl
            {
                file = "\jzra_sb\scripts\fn_openHatches.sqf"; 
            };
        };
    };
};

fn_openHatches.sqf

params ["_vehicle", "_turret", "_phase"];

private _anim = call {
  if (_turret isEqualTo [8]) exitWith {"door_left"};
  if (_turret isEqualTo [2]) exitWith {"hatch_front"};
  if (_turret isEqualTo [7]) exitWith {"door_right"};
  //etc.
};
_vehicle animateSource [_anim, _phase];
little raptor
marsh drift
#

that means? 🤔

little raptor
little raptor
#

your call is wrong

#

that's not what I told you to do

#

this is what I said

marsh drift
#

omg

#

Now its working great. yeah I dont know why I changed the call... 🤦

#

When I get in to the turret, he is already turned out how I change that so he is turned in when entered? Or is this more a config question?

sage heath
#

its way more simple than scripting

marsh drift
#

ou, I have a few more turrets that do not have hatches. the turn in and out is just for standing up or sit down. Here he is throwing the error again. What do I must add to change that? Nr 3 is one of the turrets sqf if (_turret isEqualTo [3]) exitWith {}; I must change smth at the exitWith?

little raptor
#
private _anim = call {
  if (_turret isEqualTo [8]) exitWith {"door_left"};
  if (_turret isEqualTo [2]) exitWith {"hatch_front"};
  if (_turret isEqualTo [7]) exitWith {"door_right"};
  "";
};
#

but idk why you say it's throwing an error because if the other turrets don't have turn in/turn out the function should never be called in the first place

old grotto
#

how can i add more flares to a plane that belongs to a mod

#

?

#

I have a mod of a MIG35 only 30 flares, I want to add more but I don't know how

open fractal
#

put

vehicle player weaponsTurret [-1]
``` in the console and see if the classnames are returned
old grotto
#

I want this to increase to 200, how do I do it?

open fractal
#

this is what you need

#

then you can just addMagazinesTurret

opal zephyr
#

Can you add a marker to a map based on idc? I have a map in my gui, made from CT_MAP_MAIN and I want to draw the position of a unit on it and only it, not drawing it on the main map. Is this possible through idc or something?

Edit: I think I can maybe attempt a seperate method to check if my gui is open and if it is then ill use drawIcon or something to draw the markers. Ill give this a shot

stable musk
#

Anyone know of a way exit the current mission and open a differnt mission with code? It'd be similar to what Arma 1 did for its campaign, with the strategic map sending you to a different mission file

undone dew
#

anyone know why this is giving me Invalid Number in Expression?

        _pos = [_thisTrigger, 25, 50, 0, 0, 0.4, 0] call BIS_fnc_findSafePos;
        _playersInArea = {(_x distance2d _pos) < 1000} count allPlayers;
tranquil jasper
#

where

undone dew
#

at the end

undone dew
#

was just showing where it shows the |#| in the error log, not part of the code

open fractal
#

oh

tranquil jasper
#

put this

systemChat str _pos
```also post next line in script
open fractal
#

also have you tried inAreaArray? probably quicker than distance2d

tranquil jasper
#

if the # was after ; then the error is on the next line

open fractal
#
        _pos = [_thisTrigger, 25, 50, 0, 0, 0.4, 0] call BIS_fnc_findSafePos;
        _playersInArea = count (allPlayers inAreaArray [_pos,1000,1000,0,false]);
undone dew
#

that worked, thx! I guess it was a problem with using distance2d

open fractal
#

@undone dew _thisTrigger isn't the magic variable if you're using it for that btw, that would be thisTrigger without the underscore

undone dew
#

i have "_thisTrigger" in params and pass [thistrigger] as an argument since the triggers are editor-placed, seems to work at least

#

i'm still in the functional > pretty stage of learning scripting lol

open fractal
#

eyess alright

ebon citrus
#

i dont have an emulator on hand, but couldnt i check if a definition _x exists in CfgWeapons by doing

_x isKindOf [_x, configFile >> "CfgWeapons"]```?
tranquil jasper
#

Where are you getting _x from?

#

Also I think it should work

#

but you could also do

isClass (configFile >> "CfgWeapons" >> _x)
#

depending on where _x comes from this might not even be necessary though

ebon citrus
drowsy geyser
#

if i add BIS_fnc_holdActionAdd to an object and remoteExec it to everyone, how would i prevent that more than one player will be able activate the action at time?
example from BIS_fnc_holdActionAdd

[
    _myLaptop,
    "Hack Laptop",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "_this distance _target < 3",
    "_caller distance _target < 3",
    {},
    {},
    { _this call MY_fnc_hackingCompleted },
    {},
    [],
    12,
    0,
    true,
    false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop];
ebon citrus
#

your targets and JIP arguments are probably not what you mean them to be

drowsy geyser
ebon citrus
#

yes, you are right

#

dont mind my comment

#

I didnt realize you could use Object as JIP

#

if you want it that no other person can use it at the same time, you could broadcast a public variable and check that variable in the condition for if the laptop is being hacked

#

use codeStart for setting the variable and codeInterrupted and codeCompleted for unsetting it

#

if you dont want the laptop to be hackable after completion, just dont reset the variable in codeCompleted

#

check your variable in conditionShow

drowsy geyser
#

thank you

ebon citrus
#

you can use and statements there to check distance and your variable

ebon citrus
drowsy geyser
#

an example is alway better for learning 🙂

ebon citrus
#

give me a sec

#

[
    _myLaptop,
    "Hack Laptop",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "_this distance _target < 3 and {!(_target getVariable ['MYTAG_hackInProgress', false])}",
    "_caller distance _target < 3",
    {    
        params ["_target", "_caller", "_actionId", "_arguments"];
        _target setVariable ["MYTAG_hackInProgress", true, true];
    },
    {},
    { 
        params ["_target", "_caller", "_actionId", "_arguments"];
        _this call MY_fnc_hackingCompleted;
        _target setVariable ["MYTAG_hackInProgress", false, true]; //comment this line out if you dont want it to reset!
    },
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        _target setVariable ["MYTAG_hackInProgress", false, true];
    },
    [],
    12,
    0,
    true,
    false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop];```
something like this
#

this is assuming you trust your client

drowsy geyser
#

thank you!

sour drift
#

Any way to set an object to be invisible?

winter rose
#

yes.

#

😁

sour drift
#

Cuz I tried just removing the objects textures to make it "per se" invisible

#

But aint worked for me

sour drift
#

That should do, thanks lad

drifting portal
#

is there a way to createVehicleLocal with "CAN_COLLIDE" placement option?

little raptor
drifting portal
#

i'm trying to place it inside a building

#

it spawns outside it

little raptor
#

then do a setPosXXX

drifting portal
#

cool stuff

#

I would like to also label myself as dumb for not thinking about this and going for more complex nonsense

#

thanks

lapis ivy
#

Hello. I have a condition:

a3a_var_started && (([east,0] call BIS_fnc_respawnTickets) < 1 or ([west,0] call BIS_fnc_respawnTickets) < 1);

And activation

if ([west, 0] call BIS_fnc_respawnTickets <= 0) then { 
    [east, west] 
} else { 
    [west, east] 
} params ["_winner", "_loser"]; 
 
["SideLost", false] remoteExec ["BIS_fnc_endMissionServer", _loser];  
["SideWon"] remoteExec ["BIS_fnc_endMissionServer", _winner];

When checking in a multiplayer game through the editor, everything works, but it does not work on a dedicated server.
All this is specified in the trigger. The trigger has a checkbox "only on the server"

drowsy geyser
sage heath
#

ok this is a little of an easy one, im planning on doing a looping script for a vehicle to automatically refill ammo back to full

#

i put some static aa in the background, shooting invisible drones to simulate flak

#

so i want the vehicles to never run out of ammo/needing me to mother over it

#

and/or use addMagazineTurret and just add like a 1000 boxes of ammo?

little raptor
sage heath
#

yeah tahts what im thinking, but then it does that, only once

little raptor
sage heath
little raptor
sage heath
#

i got the script kinda in my head ish

zsu2 setAmmo 1;``` and so on
sage heath
little raptor
#
[] spawn {
  while {true} do {
    {
      _x setAmmo ["CUP_Vacannon_AZP23_veh", 1e30];
    } forEach [zsu1, zsu2];
    sleep 1;
  };
}
sage heath
#

gotcha, and just making sure, where would i put this?

little raptor
#

you can put that in trigger activation

drowsy geyser
#

you can put this in the init field of the vehicles

this spawn {
    while {sleep 1;true} do {
    waitUntil {!(someAmmo _this)};
    _this setAmmo 1;
      };
};
sage heath
little raptor
little raptor
#

yeah

drowsy geyser
#

maybe setVehicleAmmo?

little raptor
#

unit setAmmo [weaponOrMuzzle, count]

#

and count should be very large

sage heath
#

could i do setVehicleAmmo?

little raptor
#

e.g. 1e30

sage heath
#

its a spaag

little raptor
#

it has no performance cost

sage heath
#

ik but then i'd have to go find the weapon and ammo name for the zsu XD

#

do i?

sage heath
#

where would i find the weapon name? cant seem to find it in the config

little raptor
#

you can always find it in config. but for newbies it's easier to use command to fetch them

#

in this case, currentWeaponTurret

ebon citrus
sage heath
#

in debug cursorObject currentWeaponTurret [0];?

little raptor
#

you can try it

#

better do allTurrets to make sure

sage heath
#

it is, funnily enough, got it "CUP_Vacannon_AZP23_veh"

#

cuz its only got 1 turret

drowsy geyser
sage heath
little raptor
sage heath
#

yeah i shouldn't have slept through math class

little raptor
#

it has nothing to do with math

#

it's floating point notation

sage heath
#

goddammit XD

ebon citrus
# drowsy geyser that would be great, really appreciate your effort.
[
    _myLaptop,
    "Hack Laptop",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "_this distance _target < 3 and {(_target getVariable ['MYTAG_hackInProgress', player]) isEqualTo player}",
    "_caller distance _target < 3 and {(_target getVariable ['MYTAG_hackInProgress', player]) isEqualTo player}",
    {    
        params ["_target", "_caller", "_actionId", "_arguments"];
        _target setVariable ["MYTAG_hackInProgress", player, true];
    },
    {},
    { 
        params ["_target", "_caller", "_actionId", "_arguments"];
        _this call MY_fnc_hackingCompleted;
        _target setVariable ["MYTAG_hackInProgress", nil, true]; //comment this line out if you dont want it to reset!
    },
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        _target setVariable ["MYTAG_hackInProgress", nil, true];
    },
    [],
    12,
    0,
    true,
    false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop];```
sage heath
#

so @little raptor in conclusion here's the entire trigger, to make sure i got everything right

condition
triggerActivated doortrig1; //this is the trigger that starts the intro
on activation
zsu1 enableSimulation true;  //enables sim for the zsu so they dont fire before mission start and not waste ammo
zsu2 enableSimulation true;
zsu3 enableSimulation true;
zsu4 enableSimulation true;
zsu5 enableSimulation true;
zsu6 enableSimulation true;

//your code
[] spawn { 
  while {true} do { 
    { 
      setAmmo ["CUP_Vacannon_AZP23_veh", 1e30]; 
    } forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6]; 
    sleep 1; 
  }; 
} ```
little raptor
#

also syntax highlighting should be sqf

#

idk what you're using (probably cpp?)

sage heath
#
{ 
      _x enablesimulation true; 
    } forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6];```
ebon citrus
#

_x enablesimulation true;

sage heath
#

yeah i only remembered that cuz of old, uhm group project

ebon citrus
#

👍

sage heath
#

never knew there was an sqf highlight XD

drowsy geyser
ebon citrus
sage heath
#

where? before setAmmo?

little raptor
#

yes

sage heath
#
[] spawn { 
  while {true} do { 
    { 
     _x setAmmo ["CUP_Vacannon_AZP23_veh", 1e30]; 
    } forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6]; 
    sleep 1; 
  }; 
} ```
#

yes?

little raptor
#

yeah

sage heath
#

perfect! testing it rn

winter rose
#

hah, we beat Discord's syntax highlighting @little raptor 🏆

sage heath
# little raptor yeah

btw final question with the ammo script written, would this allow for the vic to fire pretty much non stop for...a 2-3 hour op?

little raptor
#

yeah

#

depends on command and obj locality too

#

setAmmo needs local arg

sage heath
#

yeah, so the vehicle now spawns without ammo

little raptor
#

it does? thonk

sage heath
#

yes, 0

#

uhhhhh what do now?

little raptor
#

are you testing that in multiplayer?

sage heath
#

singplayer

#

ill test it in mp

little raptor
#

no need

#

I guess maybe setAmmo doesn't work on turrets? thonk

sage heath
#

ok so in mp

winter rose
sage heath
#

now it spawns with ammo

sage heath
winter rose
#

setMagazineTurretAmmo

sage heath
winter rose
#

Broken when vehicle has multiple magazines of the same type

sage heath
#

imma just do

[] spawn { 
  while {true} do { 
    { 
     _x setVehicleAmmo 1e30]; 
    } forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6]; 
    sleep 1; 
  }; 
} ```
#

would this work? thonk

winter rose
#

why not simply add a fired EH that resets ammo 😑

ebon citrus
sage heath
#

never thought of that, granted i know jackshit about scripting beyond the surface level

winter rose
#

(dw, the "😑" was aimed @ @little raptor 😛)

sage heath
#

ah, fair enough

sage heath
#

ya know, just a quick suggestion from a mission maker, maybe for "arma4" add like a module that simulate flaks/tracers, basically just an invisible module that just fires tracers + sound into the air
idk how appropriate this is to the channel but would do great for immersion

little raptor
#

@sage heath I just tested. looks like 1e30 was too big 🤣

sage heath
little raptor
#

set a smaller value and it'll work

sage heath
ebon citrus
#

no, it's in vanilla

sage heath
#

ah

ebon citrus
#

also "tracers"

sage heath
#

ahhhh wait does taht also play sound?

winter rose
#

ye

sage heath
#

omfg, that solves EVERYTHINGGGGGGG

sage heath
#

hey so quick quiz
for the tracer modules, it needs a weapon and magazine

  1. does this use vehicle weapons/mags?
  2. for weapons i put in CUP_Vacannon_AZP23_vehand for magazines, CUP_2000rnd_23mm_AZP23_M
#

are these correct...?

#

sad and resounding, no after testing

#

awww it only works with infantry weapons...

sage heath
#

or atleast dont know how to set one up

winter rose
#

no worries, this channel is here for you

sage heath
#
_x addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];```
this is my* final version of the reset ammo script
```sqf
_this spawn { 
            while {true} do { 
            { 
                _x setVehicleAmmo 1]; 
            } forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6]; 
            sleep 1; ```
#

im this far (this is only for ai btw, if i needed to mention)

#

(basically lifted from biki)

little raptor
#

like I said use what I wrote first

winter rose
little raptor
#

just change 1e30 to a lower value

winter rose
#

an event handler is code you "attach" to an event, here "fired"
here the code is not costing anything to attach, and only runs when shots are fired 🙂

sage heath
little raptor
sage heath
winter rose
#

no need for sleep no

sage heath
#

deleted sleep

#

how about that?

little raptor
#

just use literally what Lou wrote

winter rose
#

just replace my code's _allTheZSUs with the zsu array

little raptor
#

why'd you change it?

sage heath
#

i didnt? or atleast i thought i didnt, thats just all the zsus

winter rose
#
{
    _x addEventHandler ["Fired", {
        params ["_unit", "", "_muzzle"];
        _unit setAmmo [_muzzle, 10000];
    }];
} forEach _allTheZSUs;
```check the indentation
sage heath
#

wait, so i dont literally just put in "alltheZSUs?" right...?

winter rose
#

replace _allTheZSUs with your array [] of zsus

sage heath
#

yep, gotchaaa

#
{
    _x addEventHandler ["Fired", {
        params ["_unit", "_muzzle"];
        _unit setAmmo [_muzzle, 10000];
    }];
} forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6];```
#

final check

winter rose
#

I reduced params to```sqf
params ["_unit", "", "_muzzle"];

#

and yeah, both versions should work 🙂

sage heath
#

and i put this in a trigger...?

winter rose
#

in e.g initServer.sqf

sage heath
#

ah gotcha

#

ok testingggg

#

HOLY SHIT

#

THATS IT

#

THANK YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

sage heath
winter rose
#

it should not be this much, but if you are concerned about it you can make it run "if _ammo < 100"

sage heath
# winter rose it is run every time they fire
{
    _x addEventHandler ["Fired", {
        params ["_unit", "_muzzle"];
        if _ammo < 100 then {
        _unit setAmmo [_muzzle, 10000];
    }];
} forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6];
};``` this?
winter rose
#

INDENT YOUR COOODE

sage heath
#

w-where...am i missing the indent...?

winter rose
#
{
    _x addEventHandler ["Fired", {
        params ["_unit", "", "_muzzle", "", "_ammo"];
        if _ammo < 100 then {
          _unit setAmmo [_muzzle, 10000]; // HERE
        }; // WHICH MAKES YOU PUT THE SCOPE END HERE
    }];
} forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6];
// NOT HERE
#

also, I fixed the params 😉

sage heath
#

thank you!

sage heath
#

so i made it a string (ammo < 100) then now, it expects a number!

winter rose
#

wait, this one's on me

#

_ammo is string here

#

I didn't check and thought it was the current ammo

sage heath
#

so...what do i change?

#

and no worries 😅

winter rose
#
        params ["_unit", "", "_muzzle"];
        if (_unit ammo _muzzle < 100) then {
          _unit setAmmo [_muzzle, 10000]; // HERE
        }
#

and don't forget if's ()

sage heath
#
{
    _x addEventHandler ["Fired", {
        params ["_unit", "", "_muzzle"];
        if (_unit ammo _muzzle < 100) then {
          _unit setAmmo [_muzzle, 10000]; 
        };
    }];
} forEach [zsu1, zsu2, zsu3, zsu4, zsu5, zsu6];```
#

?

winter rose
#

perhaps 🐮

sage heath
#

alrightttt testing

winter rose
#

yeah 😄

sage heath
#

also just realized, the performance drop i had was because....ace distance view limiter

#

i limited the vd for vehicles to 4000, but it still lagged during the parachute intro, because! parachutes are considered aircrafts 💀

#

oh well thanks lou! ¯_(ツ)_/¯

winter rose
#

glad you got it!

stable musk
#

Is there a way to open a different mission file via a script? I’m trying to something similar to what Arma 1 does for its strategic map, where selecting a waypoint sends you a scenario

sage heath
#

if you’re an admin, use #mission missionname_map

winter rose
stable musk
#

Thx

little raptor
winter rose
#

(if updated every shot)

ebon citrus
#

even when opening a container, it wont return the weaponholder of the ground-tab

#

When you open a container, the container itself is the targetContainer, but the secondarycontainer is empty

#

it is never used

sharp grotto
ebon citrus
#

doesnt return for me

#

only the primary container is ever used

sharp grotto
#

What kind of inventory are you opening ?

ebon citrus
#

a tent

#

i.e. a container

#

defined in cfgVehicles

#

no different from a car

sharp grotto
#

onInventoryOpened EH

params ["_player","_container","_secondaryContainer"];
ebon citrus
#

it's nil for me

#

which is what's causing me a headache

granite sky
#

I assumed it was only supposed to work on bodies?

#

You know how it shows you the dropped weapon as well as the corpse loadout.

little raptor
#

make sure you're calling it by the inventoryOpened EH, not closed

little raptor
ebon citrus
#

just this one variable

#

and when i do it in a controlled environment, it works

#

so something is happening here that im not aware of

#

ill be back soonish

little raptor
ebon citrus
#

player addEventHandler ["inventoryOpened","params['_p1', '_p2', '_p3']; hint str [_p1, _p2, _p3];"];

little raptor
ebon citrus
#

there _p3 is the secondary container as it's meant to be

little raptor
ebon citrus
#

?

ebon citrus
#

no, it's most certainly defined

sharp grotto
#

We do this and it works

player addEventHandler ["InventoryOpened", { _this call ExileClient_object_player_event_onInventoryOpened}];
ebon citrus
#

yes, it works in the script i sent

sharp grotto
ebon citrus
#

but it doesnt work in my script

#

so can you jsut settle down

#

i said im looking into what's causing it

#

this is what i have in my function:

params["_unit", "_container", "_secondaryContainer"];
player setVariable["TOM_currentInventoryOpen", _container, false];



private _override = False;
if (_container isKindOf "Man") then {
    player action ["Gear", _container getVariable ["TOM_deadInventory", objNull]];
    _override = True;
};

TOM_INVENTORY_CONTAINER_OPEN = _container;
TOM_INVENTORY_SECONDARYCONTAINER_OPEN = _secondaryContainer;```
#

and this is how i call my function and define the EH:

player addEventHandler ["inventoryOpened","_this call TOMDayZ_code_fnc_lockSlots"];```
#

TOM_INVENTORY_SECONDARYCONTAINER_OPEN is nil

#

and it's not mentioned anywhere else

#

and i doubt anyone else is going to land on that exact same variablename

#

no idea

#

it magically fixed itself

#

🤷‍♂️

#

the worst part is not that I know I made a mistake somewhere, but not knowing where

ebon citrus
#

Leprechauns and cosmic background radiation

winter rose
#

leprechauns*, dangit 😄

#

leprecon artist 😄

ebon citrus
#

and everything works again

modern meteor
#

Is it possible to call this:
_actionID = player addAction ["Launch rocket",{[] spawn Dr_fnc_predator}];
from a CBA submenu?

#

I tried ["Test", [5], "", -5, {[] spawn Dr_fnc_predator}, "1"] but it does not work.

little raptor
#

what is CBA submenu? thonk

modern meteor
#
MENU_COMMS_3 =
[
    ["Submenu", true],
    ["SpecOps", [2], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""\scripts\SpecOps.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
    ["Refresh", [3], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""\scripts\Refresh.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
    ["Teleport", [4], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5]] execVM ""\scripts\Teleport.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
    ["Test", [5], "", -5, {[] spawn Dr_fnc_predator}, "1"]



];
showCommandingMenu "#USER:MENU_COMMS_3"
};

["Special Menu2","Menu_key2", "Menu Key2", {_this call mymod_fnc_showGameHint2}, "", [DIK_B, [false, false, false]]] call CBA_fnc_addKeybind;```
#

I am only calling sqf files from the menu and those are working fine

little raptor
modern meteor
#

Ok. So I guess there is no way then to call this somehow from the menu, right?

little raptor
#

there is. like I said it has to be string, not code

#

I'm pretty sure I told you what a code is

modern meteor
#

yes

#

in {}

little raptor
#

and what's a string?

modern meteor
#

""

little raptor
modern meteor
#

yes, think so

#

the function sits in a subfolder

#

\scripts\

#

would this work

little raptor
modern meteor
#

""[] spawn \scripts\Dr_fnc_predator"""

little raptor
#

no

little raptor
#

it's a pattern. it has nothing to do with a code

#

and it's not optional

#

you MUST keep it

#

the only part you're allowed to modify is this string:

"[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""\scripts\SpecOps.sqf"""
modern meteor
#

yes

#

understood

#

thats what i did

#

["Test", [5], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5]] execVM ""[] spawn \scripts\Dr_fnc_predator"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"]

#

but not sure where to point to the subfolder

little raptor
modern meteor
#

ok, trying

#

["Test", [5], "", -5, [["expression", "[] spawn Dr_fnc_predator"]]]

#

Not sure why but "Test" does not show up in the menu

#

added "1" now to see if this fixes it

#

Nah, it does not show up in the menu

#

Not sure why

granite sky
#

Don't you need two "1"s

little raptor
#

yeah

little raptor
modern meteor
#

Got this one working

#

["Test", [5], "", -5, [["expression", "[] spawn Dr_fnc_predator"]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],

#

Now i have one more left

#

["Launch rocket from map", [6], "", -5, [["expression", "["Launch",["fromMap"]] spawn Dr_fnc_predator"]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"]

#

Somehow I get an error

#

Thought i've set the brackets correctly

cosmic lichen
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
ember pier
#

Anyone knows if ACE3 Field Rations system is easy to customize (as in replacing food and drink items by adding and removing classnames) or is it a bit more complicated?

tepid vigil
#

Does CBA caching provide any benefits if sqf bytecode is used?

ember pier
#

Username fits btw lol

still forum
#

bytecode still needs to be loaded, its faster but still takes some time

opal zephyr
#

Im trying to draw an icon on the map when the ui is open, ive used plenty of systemchat tests and the code seems to be running on each frame when the ui is open, however the drawIcon line isnt drawing anything... Anyone see something wrong with it?

[] spawn {


    while 
    {
        !(isNull findDisplay 1234)
    }
    do
    {
    

        onEachFrame 
        {
                        
            _selectedIndex = lbCurSel 1500;
            
            if (_selectedIndex != -1) then {
            
            
                _selectedGroup = RobotGroups select _selectedIndex;
            
            
                {
                    ((findDisplay 1234) displayCtrl 1700) drawIcon ["\A3\ui_f\data\map\mapcontrol\Bunker_CA.paa",[1,0,0,1],getPos _x, 24, 24, getDir _x];
                    systemChat (format ["Unit%1",_forEachIndex]);
                } forEach (units _selectedGroup);
            };
        };
    };

};
little raptor
#

And why do you use getPos? nootlikethis

opal zephyr
little raptor
#

It's slow as fuck

opal zephyr
#

Oh, I didnt know that

#

What do you recommend thats faster? I normally use getPosASL or ATL for other stuff

little raptor
#

But here you need the visual version

#

Same goes for getDir

opal zephyr
#

Ok ill try and use both of those, one sec

#

Hmm changing those variables didnt help, the icons still dont display

#

I ditched the onEachFrame stuff as well

little raptor
opal zephyr
#

ok

#

Apart from performance and the proper way of doing things, the issue of the drawIcon not working is separate isnt it?

little raptor
opal zephyr
#

yup

#

This is what it currently looks like:

[] spawn {

    
        onEachFrame
        {
                
            if !(isNull findDisplay 1234) then {
                
                _selectedIndex = lbCurSel 1500;
                
                if (_selectedIndex != -1) then {
                
                
                    _selectedGroup = RobotGroups select _selectedIndex;
                
                
                    {
                        ((findDisplay 1234) displayCtrl 1700) drawIcon ["\A3\ui_f\data\map\mapcontrol\Bunker_CA.paa",[1,0,0,1],getPosVisual  _x, 24, 24, getDirVisual _x];
                        systemChat (format ["Frame%1",diag_frameNo]);
                    } forEach (units _selectedGroup);
                };
            };
        };

};
little raptor
opal zephyr
little raptor
opal zephyr
#

ah ok

little raptor
#

getPosASLVisual or atl

little raptor
opal zephyr
#

Are you referring to idc?

little raptor
#

No

#

Type

#

The problem right now is the control

#

Either it doesn't exist or its type is wrong

opal zephyr
#

Right now I have RscMapControl class in a defines.hpp, its type in there is CT_MAP_MAIN which is defined at the top of the file. And then I have a control.hpp file that contains my custom ui's idd as well as classes for each object in the ui. One of these is my map which has an idc of 1700. The idd of the ui is 1234 btw

little raptor
#

I mean it's probably not defined in the loop

#

systemChat that to be sure

opal zephyr
#

@little raptor Both the display and ctrl show with a systemchat just beneath the drawIcon line

little raptor
opal zephyr
#

_ctrl being my displayctrl right?

little raptor
#

Yes

little raptor
#

I don't see any other reason

#

It should show

#

Maybe try bigger size

opal zephyr
little raptor
#

Not just icon

#

That way if the icon fails at least you get something

opal zephyr
#

oop, ok something shows up now

#

oddly the text does not though...

little raptor
#

Did you increase the size?

#

Also you probably want to scale the icon with map zoom

opal zephyr
#

brought it up from 25 to 100, its absolutely massive though

opal zephyr
little raptor
#

It's nonsense. But sure

opal zephyr
#

Hmm ok so, brining the size back down to 25 makes them appear still, it seems like the lack of text description in the drawIcon line was maybe what was causing the issue...? That being said the text still doesnt appear. I dont need it to but I find it odd nonetheless

little raptor
#

But I text is not necessary at all

#

It's optional

opal zephyr
#

@little raptor
The first line doesnt show anything, the second line shows just the icons... even though the things changed are optional and only refer to text?

((findDisplay 1234) displayCtrl 1700) drawIcon ["\A3\ui_f\data\map\mapcontrol\Bunker_CA.paa",[1,0,0,1],getPosASLVisual  _x, 25, 25, getDirVisual _x];

((findDisplay 1234) displayCtrl 1700) drawIcon ["\A3\ui_f\data\map\mapcontrol\Bunker_CA.paa",[1,0,0,1],getPosASLVisual  _x, 25, 25, getDirVisual _x, "test", 0, 50];
lapis ivy
#

Hello. I have a condition:

a3a_var_started && (([east,0] call BIS_fnc_respawnTickets) < 1 or ([west,0] call BIS_fnc_respawnTickets) < 1);

And activation

if ([west, 0] call BIS_fnc_respawnTickets <= 0) then { 
    [east, west] 
} else { 
    [west, east] 
} params ["_winner", "_loser"]; 
 
["SideLost", false] remoteExec ["BIS_fnc_endMissionServer", _loser];  
["SideWon"] remoteExec ["BIS_fnc_endMissionServer", _winner];

When checking in a multiplayer game through the editor, everything works, but it does not work on a dedicated server.
All this is specified in the trigger. The trigger has a checkbox "only on the server"

opal zephyr
little raptor
lapis ivy
#

I checked.

granite sky
#

endMissonServer remoteExec usage seems wrong?

#

It's supposed to executed on the server, and it's remoteExec'd on clients.

lapis ivy
#

How can I call it then correctly?

#

And is it correct that there are 2 endings for winners and losers? Will it work?

granite sky
#

Seems like you're better off using endMission for custom stuff.

fair drum
#

^

#

endMission is just so much better

granite sky
#

In which case your usage would also be correct, I think :P

elfin comet
#

I'm trying to have sideChat messages play for all connected clients. However, when I run my mission (currently testing as client hosted), I see all messages. Unfortunately, no other connected client can see the messages.

This is what is in my trigger Activation box:

handle = [] execVM "start.sqf";```

This is largely what my script boils down to:
```sqf
sleep 1; //00:01
phalanx sideChat "Attention all Posts";
[phalanx, "Attention all Posts"] remoteExec ["sideChat", -2];
sleep 4; //00:05
phalanx sideChat "As you already know, Red Star Forces have been moving throughout our towns, separating our families, and killing our brothers.";
[phalanx, "As you already know, Red Star Forces have been moving throughout our towns, separating our families, and killing our brothers."] remoteExec ["sideChat", -2];
//...```

I understand that `<object> sideChat "Message";` doesn't fire globally on it's own but even if I set the trigger to fire on everyone instead of just the server, The text doesn't show on their client, depspite their client running the `remoteExec` to make an additional message show up for me.

Is there something that I'm just over looking that would cause the text to not show?
fair drum
#

do all the things have a radio?

#

also, you dont need to do two instances of sidechat

#

you can remoteExec once to all things

elfin comet
#

I'm aware that I don't need both. It used to just be those lines on their own. I plan on going back and removing extranieous lines later when other clients can see the messages.

#

I'll check for radios

tough parrot
#

how do you copy array?

_groupUnitsOut = +_groupUnits;

does not work

fair drum
#

copy to another variable? you just assign it

#
_groupUnitsOut = _groupUnits
tough parrot
#

i don't want the same pointer

fair drum
#

you mean append an array? to add to it?

tough parrot
#

i want to change one without changing the other

open fractal
elfin comet
#

anger is felt.

south swan
granite sky
#

If you want a proper deep copy, which it sounds like you do.

little raptor
#

yeah. +_array working is no question

fair drum
#

all I want is a proper deeper copy
made with a proper deeper copy code
I may be off my load
but I want a proper copy
with a deeper proper code

little raptor
#

if he had _array + [] that would be another story and would depend on the contents of the array

elfin comet
little raptor
#

"in lieu" is incorrect. it should be "in Lou" 😛

elfin comet
tough parrot
#

Is there a way to pass local var into Draw3D EH?

flat eagle
shadow sapphire
#

Anyone know how to make high command work on dedicated servers? Is this a scripting issue or a troubleshooting issue?

I've successfully created the modules, synched them, added units, all of that, but the subordinates are completely unresponsive and I don't understand why.

The subordinate units are perfectly responsive when used on a client hosted server (at least for the host).

tough parrot
shadow sapphire
crude vigil
tough parrot
#

I'm thinking the server owns the groups, given that is the only difference.

tough parrot
#

is unitReady the best way to check whether a createVehicle is finished?

fair drum
#

I would think createVehicle would be finished when it gave you the object as it's return

little raptor
#

as Hypoxic said, objects are always finished when you create them using createVehicle/createSimpleObject

#

there's preloadObject but that's for terrain objects afaik

#

or for use before creating a normal object

shadow sapphire
tough parrot
rose osprey
#

Does anyone know how to hide the cursor in spectator mode or splendid camera (for video purposes)?

rose osprey
#

Thx I'll take a look

brazen lagoon
#

I'm looking for a way to place units in a random house in a marker, but not if there are enemies in that house. is there a best way to do this? I was originally planning on using nearestTerrainObjects or something similar to find all houses in an area and then use select to pick the ones that dont have any enemies within x meters of them, how bad of an idea would this be for something that runs on respawn?

tranquil jasper
#

took me a bit to find but here's something I coded years ago that may help. The code could probably be better but if I remember properly it does work
DE_inBuilding.sqf

[]spawn
{
    while {true} do
    {
        _building = nearestBuilding player;
        _buildBox = boundingBox _building;
        _position = _building worldToModel getPosATL player;
        if (_position select 0 > ((_buildBox select 0) select 0) && {_position select 0 < ((_buildBox select 1) select 0)} && {_position select 1 > ((_buildBox select 0) select 1)} && {_position select 1 < ((_buildBox select 1) select 1)} && {_position select 2 > ((_buildBox select 0) select 2)} && {_position select 2 < ((_buildBox select 1) select 2)}) then
        {
            hintSilent "Player is inside building";
        }else
        {
            hintSilent "Player is not inside building";
        };
    };
};

and I don't see any reason why you shouldn't put this in a respawn EH

brazen lagoon
#

well im not sure if thats what i want

#

but i think i could use that for checking if AI are in buildings

tranquil jasper
#

Just paste that in init.sqf and run around a town for a bit and see if it works how you'd like. I remember there being something weird with bounding boxes in this game usually being much bigger in all axis than the actual model

open fractal
#

your usage of select makes me feel an array of emotions

tranquil jasper
#

I thought I was being slick and taking full advantage of lazy eval, only now do I see that I did it wrong 😒
keep in mind I wrote that 7 years ago when I was but a humble cashier, this would probably look very different if written today by your friendly neighborhood senior dev
if there's one thing I've learned in the following years, it's, if it's working and doesn't need new functionality or refactoring, don't touch it! Hence, dropping it here as-is 😛

south swan
#

ye-ye. "Don't fix what ain't broken" and "premature optimisations is the root of all evil" in the same package

tranquil jasper
#

well it's arguable at what point a lack of readability and maintainability constitutes broken, but eh I made the call (another one of your senior dev's responsibilities!)

south swan
tranquil jasper
#

don't forget new git branch, code review, trying to get a new low score of WTF's from team lead 😛

open fractal
#

i'm looking if the sleek and modern inAreaArray can be used

#

oh arte already said it

open fractal
#

no idea if this is faster

#

but boy howdy that other code could use params

tranquil jasper
open fractal
#

the dark ages of sqf

#

thankfully i never touched it for arma 2

#

those days must've been wild

tranquil jasper
#

I dabbled a little, but thankfully never had to learn too deeply. I used to play a lot of dayz mod, then A3 came out. Eventually tried making missions for my friends, didn't get too far with that but went off the deep end with sqf heh. Never finished a mission for my friend group to play, but I ended up as an employed programmer now so I still consider it a win 😛

open fractal
#

sqf forcing me to optimize code so the game doesn't break is a good teaching tool id say

south swan
#

but damn, checking "building count" times "units count" cases doesn't sound very quick anyways, but sqf DERP_inBuilding = { params ["_objects", "_building"]; private _bbox = 0 boundingBoxReal _building; _bbox params ["_c1", "_c2", "_radius"]; _c1 params ["_x1", "_y1", "_z1"]; _c2 params ["_x2", "_y2", "_z2"]; private _centerModel = (_c1 vectorAdd _c2) vectorMultiply 0.5; private _centerWorld = _building modelToWorld _centerModel; private _dx = abs (_x1 - _x2) / 2; private _dy = abs (_y1 - _y2) / 2; private _dz = abs (_z1 - _z2) / 2; private _angle = getDir _building; _objects inAreaArray [_centerWorld, _dx, _dy, _angle, true, _dz]; }; [allUnits, _building] call DERP_inBuilding
this seems to take like 0.07-0.09 ms per building with 205 units on map (in VR with single building and some infantry), so checking like a hundred buildings on the spawn seems kinda viable?
And allUnits select {_x distance _building < _radius} is like 0.42 ms (wtf?).
allUnits select {side _x isEqualTo playerSide} is like 0.38 ms on my machine. Holy hell, it's slow.

#

and switching to _objects inAreaArray [_centerWorld, _radius, _radius] in the functions seems to save like 0.01-0.02 ms on my machine

#

and allUnits findIf {_building distance _x < _radius} is like 0.28 ms. Them sqf/engine implementations sure do defy expectations 🤦‍♂️ Looks like i have some code to change

south swan
tough parrot
#

i wonder whether commands like allUnits are just refs or computed on the spot. math like that should be in nanoseconds.

south swan
#

well, missionNamespace getVariable "aaaa" is 0.0011 ms on my machine, just aaaa is 0.0007. I'd bet a dollar the engine/SQF boundary is the most hungry part at this point

tough parrot
#

i'm guessing namespace vars are in a hashmap

still forum
tough parrot
still forum
#

well its cheap, copying out of the lists every group has, but its still not a direct copy from one list

ebon citrus
#

anyone have any experience with extdb3?

vague geode
#

Is there any way to insert a clickable Link (URL) into a diary record?

PS: <a href='http://arma3.com'>Arma 3</a> doesn't work.

ebon citrus
#

how would i parse a string like this into an array, when my string are missing quotes
"[1,[[qU/FN5XEfbg7pKRJZt9ei0],[l5+17gktM3gq2oyqVAfX44]]"

#

parseSimpleArray is no good in this case

ebon citrus
#

and what would i even be looking for?

little raptor
ebon citrus
#

there could be any number of them and they could be changing

little raptor
ebon citrus
#

no, i just made sure it was clear

little raptor
#

You have to pair them dynamically yourself

ebon citrus
#

i dont know how to do that

little raptor
# ebon citrus i dont know how to do that

It's very simple
Find all [s and ]s using 1 regex expression so that they're in order, then iterate over them
When you encounter a [ pushback its position into an array
When you encounter a ] pop back the last [ position and use it with the ] to make the string (using select)

ebon citrus
#

to clarify, i dont know regex

#

and if i did, i would look for [ with 22 non-[ or ] characters in row and then an ending ]

little raptor
#

Actually what I said was a bit oversimplified

#

I forgot the ,s... meowsweats

ebon citrus
#

and then replace it with the same text but add quotes inside the brackets

#

all the strings are 22 digits

#

i forgot to say that

little raptor
ebon citrus
#

overengineered solution

#

indexing through a string in sqf is not exactly what im looking for

#

maybe in python, but not in sqf

#

imagine if find had a regex-match

#

\[[^\[\]]{22}]

#

there's the regex i came up with

#

should be good enough

#

so i'll just iterate regex find and cut until i have no more hits

#

actually, just this is even ebtter : [^\[\]]{22}

#

wait, i dont even need to iterate

#

because regexfind pulls them into an array for me

#

all of the hits

#

now isnt this splendid

ebon citrus
elfin comet
#

Unrelated to that though...

Below is what I currently use to select spawn points. Is there something I can add to ensure that all selected points are unique?

_point1 = floor random count pointPool;
_point2 = floor random count pointPool;
_point3 = floor random count pointPool;

_sp1 = pointPool select _point1;
_sp2 = pointPool select _point2;
_sp3 = pointPool select _point3;```
#

I suppose this should work...but there is probably a better way to do it

_point1 = floor random count pointPool;
_point2 = floor random count pointPool;
while {_point2 == _point1} do {
    _point2 = floor random count pointPool;
};
_point3 = floor random count pointPool;
while {_point3 == _point1 || _point3 == _point2} do {
    _point3 = floor random count pointPool;
};```
little raptor
#
_pool = pointPool;
_point1 = selectRandom _pool;
_pool = _pool - [_point1]

You can also use deleteAt but make sure you copy the array

elfin comet
#

Then just append them back on at the end of the script if I want to still use them later?