#arma3_scripting

1 messages Β· Page 173 of 1

bold comet
#

i'd really like to read that kind of stuff about arma scripting

terse tinsel
#

Is passible to forcing the player to look in the indicated direction VIA script ? (Camera)

pallid palm
#

forcing hmmm why would you have to force the player cant you just tell them to look there πŸ™‚

terse tinsel
#

Yu can help me witch this ?

pallid palm
#

well i know one thing is theres a nuclear explosion im looking at it for sure

terse tinsel
#

Like cod hehe

terse tinsel
pallid palm
#

you could make them go into like a intro script and set the camera to look there

#

that will force them to look

terse tinsel
pallid palm
#

you dont need to roatate the the camera just make the canera look at that pos

terse tinsel
#

I wesoΕ‚ych Ε›wiΔ…t 😎

pallid palm
#

did you want an Exsample of a cam script i use

terse tinsel
pallid palm
#

ok friend

#

good luck m8

#

i know you will make it work

dusk gust
#

Anyone know what triggers this in server-side RPT?
2024/12/24, 16:04:38 Tried to AccessTargetList for non-local AI group while non-local targeting was disabled! Engine will now enable non-local targeting which will hurt clientside performance.

Never seen it before. Currently on latest profiling branch, so might be related?

still forum
#

It says what triggers it right there

#

Tried to access the target list for a non-local AI group.

#

If you run game with -debug you'll probably get a call stack for it

granite sky
#

For example using knowsAbout or targets on a non-local group.

dusk gust
#

Yeah I feel stupid now, been dealing with Arma since 3 AM x_x. Thanks guys

granite sky
#

Antistasi undercover code breaks that optimisation due to use of knowsAbout. Aiming to sort that out at some point.

pallid palm
#

fixed the map opening for only 1 player when chopper call
fixed the dubble call text
fixed added time limit to open the map if map not opened in 7 seconds script exits

#

thx Dart for your insite

#

Hell Yeah Arma 3 WooHoo

#

lol im a Happy Guy

bold comet
#

so, let's refactor a bunch of crap then

open hollow
#

im reviving part of my project of import ocap data back to arma to do an 3d player

its posible to open a .pbo from the AppData\Local\Arma 3\MPMissionsCache in the editor, or play the mission?

i guess i can run a script to remove all units, triggers and modules after it, so i can run the replay with the editor placed buildings

queen cargo
#

well @bold comet ... writing a proper book-like guide is a damned hard topic

#

a full time project for somebody

#

over the course of like 5 month

#

could produce something useful

#

or complete gibberish

bold comet
#

make it peer reviewed to avoid the gibberish but that's all the more effort

#

i'm not saying it would be easy, i'm saying it would be useful

queen cargo
#

then again, we are where we are now

#

many different people tend to think different about different topics

#

eg.

#

loops or PFEs

bold comet
#

you say that like it's a bad thing

queen cargo
#

some say no PFEs at all
some say no loops at all
and the rest is somewhere inbetween

bold comet
#

you don't consider outsiders like me who like to read civil arguments on the topic

#

which is why i'd like a damn book

tough abyss
#

civil arguments
hahah

queen cargo
#

ye ... no

pallid palm
#

you can, just unpbo the pbo, and put the (unpbo-ed Folder) in your Mydocuments Arma 3 Missions, and play the mission in the editer.

pallid palm
#

btw thats 9 things i got right WooHoo lol

#

and counting πŸ™‚

#

with the help of others ofcorse

round hazel
#

Hey there folks, just need a little help. I'm using 'say3D' with 'remoteExec', which is in a loop, done on trigger activation. I'd like to stop the sound on the triggers deactivation. Any ideas? I've seen say3D returns a value you can delete, but I cannot figure out if I can do it with remoteExec included

open hollow
vapid scarab
#

Looking at that, the object type is #soundonvehicle, and afaik the particle and light source objects have that # at the start of their class, and they are local only objects. If that is the case for #soundonvehicle, then you cant use remoteExec to stop it, because you practically cant pass a local only object to remoteExec

#

Assuming #soundonvehicle is local only, a way around is to create a proxy object, invisible helipad is my go to, attach that proxy object to the object you want to play the sound on, then use say3d on the proxy object. Once you want to stop the sound, run [_proxyObject, 1, false] remoteExec ["setDamage", 0]. Killing the proxy object that the sound is attached to will stop the local #soundonvehicle from playing sound.

round hazel
#

Thank you for responding! I've done a quick and dirty job that works, but with some undesirable results, I'll look into your suggestion tomorrow (It's late for me). Thank you!

sharp rune
#

I dont know how to get the position of a weapons accessory. player selectionPosition weapon something something idk...

tribal crane
#

It's pretty established practice to put variable declarations as close to thier first use.

bold comet
#

grabs popcorn

tribal crane
#

It's more a pity the word private wasn't deprecated in favor of a more advanced syntax for local, e.g.

#

local _a, _b, _c = 123;

versed belfry
#

Hello everyone :D

Another question. In the case below, have I set it up properly so that _moduleInfo parameter wils accept any of the 4 formats of an array that are provided? (The main difference is that the first 2 items in the array can either be a string or an object).

params [
    ["_moduleInfo", [objNull, "", true, false, false, false, true, true], [
        [objNull, objNull, true, true, true, true, true, true],
        [objNull, "", true, true, true, true, true, true],
        ["", objNull, true, true, true, true, true, true],
        ["", "", true, true, true, true, true, true]
    ]],
    ["_unit", objNull, [objNull]],
    ["_mode", "REQUEST", [""]]
];
faint burrow
#

It should be expected data types, not formats.

warm hedge
#

Do _moduleInfo params [...]

versed belfry
versed belfry
warm hedge
#

Am I supposed to understand you understood it or not

versed belfry
#

I understood it yes. I am just surprised and annoyed it didn't occure to me, that's all.

#

Thank you

warm hedge
#

SQF'ing is as gaming as cardgames. You may not realize something until you combine them accidentally play it

versed belfry
#

Fair enough Salute

warm hedge
#

(I implied pretty much I sometimes don't)

real tartan
#

What happen in player dies? Do other players still respawn on his position or do I need to re-add function on respawn?

// initPlayerLocal.sqf
[ playerSide, player, name player ] call BIS_fnc_addRespawnPosition;
proven charm
#

i could be wrong but thats how i have always used them

vapid scarab
spring escarp
#

does anyone know how i can make eden enhanceds hold action activate a trigger or a show/hide module. i can even make it a addaction if thats easier to do i just need a player be able to activate something and a thing appear

faint burrow
#

Try using a global variable.

spring escarp
faint burrow
#

Assign true to a global variable, and then use this value to activate a trigger.

spring escarp
#

wait i think i found a weird ass work around

#

ok yeah it works basically how it works is i have this set up with no special parameters this is set up so that the show/hide module will activate when i delete the trigger then i set the trigger a variable have a seperate deltevehicle the trigger then poof it works

proven charm
#

how do you determine how many players there can be in server? i know there is setting in description.ext but doesnt it also depend on the host's limit and playable players from the editor?

fair drum
#

playable slots are due to playable things

#

but actual slots on the server is server config. so like say 100 playable slots, but only 20 server slots

proven charm
#

but how to get the number?

fair drum
#

or do you want the server limit?

proven charm
#

whichever determines how many players can join

proven charm
#

like the numbers you can see in server browser x / max

drowsy geyser
#
_map = findDisplay 46 ctrlCreate ["RscMapControl", -1];
_map ctrlMapSetPosition [0.87 * safezoneW + safezoneX, 0.09 * safezoneH + safezoneY, 0.09 * safezoneW, 0.12 * safezoneH];   
_map ctrlMapAnimAdd [0, 0.01, getPosWorld player];
ctrlMapAnimCommit _map;

Is it possible to make the control circular?

lunar mountain
#

What does PFE stand for? πŸ˜„

astral bone
#

How would I randomly select a sound to play as long as a mission is loaded? πŸ€”
Play a sound, wait a bit, play another, so on and so on.

#

As if a radio was playing, basically x3

#

I can only think of weird way to do it xD

tribal crane
#

Per Frame Handler Event.

hallow mortar
#

Array of sound names, while true selectRandom from the array and play it

tribal crane
#

a.k.a. the quickest way to kill your frame rate if you don't know what you're doing.

astral bone
#

ah ok, so the while true wont overlap into another mission? (it's from the main menu so x3)

hallow mortar
#

Scripts usually end when the current mission ends

astral bone
#

Alright. And- using playSound3D?

hallow mortar
astral bone
#

waitUntil { soundParams _sound isEqualTo [] };

#

although, if already in a while-

hallow mortar
astral bone
#

maybe ui sleep for 10 seconds or so-

lunar mountain
#

aaahhh

gleaming rivet
#

No, shitty loops would be a faster way to kill your frames. PFEHs are pretty straightforward if you actually plan to do stuff well.

astral bone
#

or maybe 300 seconds-

indigo snow
#

aaaaand we start again πŸ˜„

lunar mountain
#

How about neither? πŸ˜„

#

I mean... it should be pretty rare when you need to use something on every frame. isn't it?

fleet sand
#

Hi gusy quick question. How would i make a puzzle with ace interactions.
Basicly. I have 5 pillars on witch interactions need to be interacted certain way. like they need to interact with pillar 5 then 3 then 4 and so on.
If players didnt interact with correct interaction they would be punished and they need to start again ?

gleaming rivet
#

Let me rephrase that properly -
In making missions? Not really.
In making an addon or a framework that needs to do calculations or check for events all the time, yes, its quite useful.

astral bone
#
    [
        {
            ["InitDummy",["RCHT_Primera_Isla",[4518.87,4419.6,1.86083],343.213,0.75,[13.6039,0],0,0,1110.02,0.3,0,1,0,1]] call bis_fnc_camera;
            setviewdistance 700;
                        ...
        }
    ] call BIS_fnc_initWorldScene;

hmm- this ain't working for some reason-

#

it's loading the scene it seems, from the log file, but then it isn't moving the camera?

fair drum
astral bone
#

wait is it running the script

gleaming rivet
#

And if you've ever taken a course in coding etiquiette or done professional coding: Loops you cannot exit without killing the entire process is literally how you lose your job.

astral bone
#

It seems initIntro nor init are being ran-?

#

might be a better question for scenario now- but idk if that'd be considered- posting in more channel or whatever-

#

soo- why might it not be running init scripts-?

tribal crane
#

That describes almost every application.. ever.

#

e.g. every Windows application is running a bunch of loops that have an iteration per event.

gleaming rivet
#

A loop that contains code that executes within an application; which is non-essential to application function that cannot be exited without application termination is shit coding.

pallid palm
#

where do you execVM this intro

#

or what is your ?

astral bone
#

initIntro.sqf is an event script, called by the game automatically

pallid palm
#

k and

astral bone
#

I- think it was because I used a \ at the start of the scene directory string-??

pallid palm
#

i see yeah that may be it

#

but i execVM my ontro from the init

astral bone
#

well, the main menu only uses intro, not the rest of the senario

pallid palm
#

right so whats not working correct

astral bone
#

it was the fact the senario's introInit wasn't running, and I guess it's b/c it was silently failing to load the mission-

pallid palm
#

oh i see so you have it fixed ?

astral bone
#

we shall see! It loads, but black screen- might know the issue for it tho

pallid palm
#

hmmm

#

well let me know if you got it fixed

astral bone
#

i was incorrect

#

so it's black now-

pallid palm
#

buy the way i put my intro.sqf in my scripts folder and i execVM it from there

astral bone
#

well- this is how the arma maps do it, so- πŸ˜…

#

hmm- so still black- which is weird-

pallid palm
#

well i mean i execVM the intro from the init.sqf

#

so the mission is not loading ?

astral bone
#

it is now

pallid palm
#

ok cool

astral bone
#

but the camera is being funny

pallid palm
#

hmmmm

#

did you want a EXsample of my intro script

astral bone
#

if it has a camera creation, sure x3

#

["InitDummy",["RCHT_Primera_Isla",[4518.87,4419.6,1.86083],343.213,0.75,[13.6039,0],0,0,1110.02,0.3,0,1,0,1]] call bis_fnc_camera;

#

my camera creation

pallid palm
#

wow all that holy

#

my intro is way simple

#

but that looks beond me there

#

is that just locations

astral bone
#

it's the splendid camera params

pallid palm
#

oh ok i see

tribal crane
#

Is "non-essential" critical to the argument though?

pallid palm
#

yeah i dont think i can help you with that sorry

#

my intos are way easy to make and ajust

astral bone
#

do yours have characters?

pallid palm
#

i just command the cam to move around

astral bone
#

a player character

pallid palm
#

no no the camera

#

on the map there a camera in every mission

astral bone
#

wait

#

hmm

pallid palm
#

it that red triangle thing

astral bone
#

wha

pallid palm
#

you can command that camera around to where ever you want

astral bone
#

camera- what you mean by camera

#

game logic object?

pallid palm
#

no no really i create a camera and then i command the cam to move

#

did you want to see my intro.sqf

astral bone
#

accTime is 0 by default it seems

#

why

gleaming rivet
#

E.G. running a unit spawner/location checker within a giant while true loop is inefficient because it clogs the engine and you cannot terminate it without stopping the mission.
Running it within a PFEH set to check maybe every 150 frames is a lot easier.

Anyhow, I don't have the effort to argue with you about it. I'm going back to finishing modelling.

astral bone
#

and I'm thinking that might have messed up the music playing- so-

pallid palm
#

ok what ever you think

fair drum
#

keep in mind, you can't change time acceleration in MP

astral bone
#

this is just the main menu x3

#

oh wait, for the mission sound- DUH

#

missionName == "RCHT_Primera_Isla_Intro" but the name is actually RCHT_Primera_Isla_Intro1

#

it helps if the while loop actually is told to proceed xD

fair drum
#

needs more murder

ripe rock
#

Can someone show me how to make a randomized shoot house, I can make a asset group, is there a script where I can make a spawn point and by a scroll wheel action on the ground randomly spawn one of the different shoot houses.

#

For example I have shoot house a, b, and c, is there a script where it can randomize them and spawn one of them in in one location.

hollow trench
#

What is the best way to do nearestObject on simple objects?

hollow trench
ripe rock
#

Thanks.

#

I’m pretty new to scripting so I’ll try my best

hollow trench
tribal crane
#

Whaa? Clogs what in the engine?

#

The engine keeps a list of scripts that are suspended and can check if a script is ready to run again in a handful of assembler instructions.

#

A sleeping script has practically zero overhead.

#

A PFEH however has to execute a substantial amount of SQF every frame to figure out if it should run.

#

When your script is actually running the only difference is that a sleeping (scheduled) script is interruptable if it is taking up too much time and would otherwise cause frame-rate reductions.

tough abyss
#

Before any rumors are spread.

#

The "substantial amount"

#

is one addition and one less than.

lusty island
#

I am looking for a revive mechanic where all players and ai teammates an only be incapacitated on not killed outright and the ai can revive each other and the players

tribal crane
#

As in:

activateAt = diag_frameNo;

["moo", "onEachFrame", {
if (diag_frameNo >= activateAt) then
{
activateAt = diag_frameNo + 150;

    call my_thing;
};

}] call BIS_fnc_addStackedEventHandler;

?

tough abyss
#

Something like that.

#

CBA and ACE simply wouldn't work in sheduled environment

#

I tried it with AGM

#

And it was shit.

little raptor
tulip ridge
#

What makes it not reccomended?

little raptor
#

Why do you even need it?

tulip ridge
#

Do you mean in this specific use or at all?

little raptor
#

I just meant generally

#

It has its use cases ofc

tulip ridge
#

In that case, if you wanted to get the nearest non-unit object, what would you use instead then?

little raptor
#

nearestObjects

#

I only use nearestObject for getting terrain objects by id

tulip ridge
#

Oh I completely missed the distinction
I thought that was only about nearestObjects

tribal crane
#

Yeah but you know what you're doing.

tough abyss
#

I hope so.

#

I'm trying at least.

sullen marsh
#

You can kill performance just as easily with a while loop as you can with a pfh O_o

tribal crane
#

How? The engine suspends you if you exceed your budget.

#

Every "thread" has a time limit and every frame has a total time limit for scheduled execution.

tough abyss
#

while {true} do {allMissionObjects ""};

sullen marsh
#

that... that applies for both pfhs and loops...

tough abyss
#

0 spawn {while {true} do {allMissionObjects ""}};

tribal crane
#

The engine can't suspend a PFH.

sullen marsh
#

Except it can

tough abyss
#

Nope, it can't

#

PFHs are unsheduled

tribal crane
#

It it could there would be zero difference between a PFH and a loop except in the priority.

sullen marsh
#

bleh, sqf is shit anyway

#

I prefer native code...

tribal crane
#

(If the engine runs out of total time for scripts, your script won't get any time that frame)

#

commy2: that loop has far less impact in scheduled vs unscheduled though. πŸ˜‰

sullen marsh
#

I was incorrect, it seems

#

But in a real enviroment you can still kill performance by using a while true

tribal crane
#

In scheduled if "allMissionObjects" takes too long in a scheduled script it gets run once per frame. In an unscheduled script the game locks up until you hit the loop limiter. πŸ˜‰

sullen marsh
#

Especially if you consider a bunch of other addons using while true

tribal crane
#

while (true) with a sleep in there somewhere is absolutely fine.

sullen marsh
#

because the scheduled enviroment still has to complete before the frame ends

tribal crane
#

The ideal way to do things is sleep in a scheduled environment (lowest overhead for waiting) and then trigger unscheduled code for anything that needs to be atomic.

#

No, the scheduled environment can suspend at any point in SQF, except while actually inside of an engine function like "allMissionObjects".

#

If you do:

1 + 2 + 3

It can suspend between when it added "1 + 2" and when it then added "3".

sullen marsh
#

As in all scripts have to finish in one way or another

#

or be stopped

queen cargo
#

It's pretty established practice to put variable declarations as close to thier first use.
@tribal crane thats BS

queen cargo
#

@gleaming rivet nop, loops are waqy better in frame performance due to how they work

tribal crane
#

The script doesn't have to ever finish, it will run until it sleeps or hits the time limit.

sullen marsh
#

You are not reading what I am typing

tribal crane
#

If you save your game, the execution state gets serialized into the save game file (which is, by the way, how you can see that SQF can be suspended anywhere).

#

Also I'm ignoring the difference between:

while (true) do { sleep 1; ...

and

while (scriptNotSignalledToExit) do { sleep 1; ...

queen cargo
#

feel more like you dont know what youre talking about @sullen marsh (could also just be that you did not used the right words for the message) as it reads out that scheduled env. is the complete oposite from what it is

#

most important thing is: scheduled environment EVERY script command can be suspended after or before its execution

#

not within

#

thats why using callExtension can be extremly cost intensive

sullen marsh
#

Yes I am aware of this...

queen cargo
#

and thats also why it is in theory the only way you can sleep in a non-scheduled environment (which will then however affect your framerate greatly!)

tribal crane
#

The script commands that run other code (call, forEach, etc) can be suspended. They just add stuff to the execution stack (visible in save game files if you derap them).

queen cargo
#

not 100% correct

#

they just also run in a VM env

#

but their actual job

#

also cannot be suspended

tribal crane
#

forEach can't be suspended?

queen cargo
#

the command itself, no

#

but there is already the thing

#

the command itself

split ruin
#

any script way to rearm countermeasures ? πŸ€”

queen cargo
#

but not what it does

warm hedge
#

Countermeasures are magazines. So such commands can do it

queen cargo
#

the value it receives contains code that then is ran

#

however, the forEach command --> no exception in regards of suspendable

#

its execution --> can be suspended

split ruin
#

turns out _vehicle setVehicleAmmo 1 rearms countermeasures too

tribal crane
#

Huh? All it does is push a "forEach" object onto the execution stack and return.

queen cargo
#

yes

#

but that "pushing blabla" cannot be suspended πŸ˜ƒ

#

thus it blocks until it returns

tribal crane
#

Oy, stop splitting hairs. πŸ˜‰

queen cargo
#

it looks like but thats the fundamental point in understanding SQF

queen cargo
#

as that is why a scheduled environment also can affect your framerate even thought it should not

tribal crane
#

And if it does, it will be substantially less than a PFEH (because it will suspend immediately after the first instance of a long running engine command).

vague perch
#

In VBS 3 I have a script called ”Click to Shoot”
It turn off the function where the aim always are in the middle of the screen and I can point with my mouse all over the screen. When I click the left button I shoot where the mouse pointer are located. Have you heard about this function in ARMA?

tough abyss
#

I think we can all agree that shit like allMissionObjects does not belong in a loop or a PFH

warm hedge
#

Do you mean... Aiming Deadzone

vague perch
warm hedge
#

Do you have a reference video/pic I can see

tribal crane
#

Someone posted a PFEH in here that used it, and then exhaustively got properties of pretty much every object it returned.

winter rose
#

it's scriptable by creating a bullet and "throwing" it in direction of the click's 3D pos

queen cargo
#

a solution for that could be btw. some sort of special "XXXXXPart" command
that would be executed like so:

waitUntil{ _result allMissionObjectsPart [nil, "Air]; };
_result```

the command itself would then just check on regular base if it should be suspended and suspend itself by exiting itself with a false whilst _result would always contain a special vartype for progress infos
those then could be used for the next itteration

but ye ... thats magic πŸ˜ƒ
tribal crane
#

Which is why the "everything in PFEH" lore is silly.

#

You could make allMissionObjects interruptable without changing the syntax at all, X39.

queen cargo
#

depends on the SQF "VM"

tough abyss
#

I have no application for whatever that piece of code above is.

queen cargo
#

if it is not supporting pausing a VM stack, then no

tribal crane
#

It's how sleep works.

queen cargo
#

yes, but for sleep you need no progress info

#

long running commands which pause need to exit their own function

tribal crane
#

Yeah, they do.

queen cargo
#

or run in parallel

#

so that the actual VM can proceed in some way

#

with its code

tribal crane
#

They push an object to the execution stack and return.

#

And they never re-enter again.

#

You can see them in the save games; even for "sleep".

queen cargo
#

there are various ways to do that which are WAY to OT but in the end, it all depends on how the SQF "VM" is built

tribal crane
#

Unrap a save game and put a breakpoint on the entry for sleep, you'll see that it comes out and never goes back in. πŸ˜‰

queen cargo
#

well as i said
dont know how its inner is working
thus all can be possible

vague perch
vague perch
tribal crane
#

Yeap, what I'm getting at is that is how it works internally, unless they've changed it since I last looked. πŸ˜‰

warm hedge
#

So, what is your goal? Do you want to use Arma 3 as a virtual shooting range training system or something?

tribal crane
#

There's one interesting exception...

#

configClasses and configProperties aren't done properly; they don't suspend.

#

So you can abuse them to run unscheduled code within a scheduled environment; e.g. have small atomic bits of code that won't suspend, while the outer script will suspend.

south swan
#

you can set floatingZoneArea in your <username>.Arma3Profile to 1 or something (max in-game slider is 0.3) πŸ™ƒ

vague perch
south swan
warm hedge
#

If you're trying to use Arma 3 to use in real life virtual shooting range, you cannot due to EULA

vague perch
# south swan

TXπŸ˜€. I looks better then I expected, but still not full screen. The best have been if the screen could be frozen and then aim all over the screen.

vague perch
south swan
#

full height at least blobdoggoshruggoogly and setting the number to be higher than 1 only seems to increase the vertical size of the aiming box, horizontal stays the same notlikemeow

tough abyss
#

That is even better than spawning a dummy logic with an init eh

#

Nice idea

warm hedge
south swan
#

disregard me, wrong paragraph

vague perch
tribal crane
#

Yeah, there's very little overhead.

still forum
#

Personal use, means you and only you.
Not you and friends.

hollow trench
#

Old code with createvehicle worked good, I am using simpleobjects now because its said to be 43x faster

#

I don't know if looping through all the simple objects and getting the closest is worth it though, if thats the only solution

tough abyss
#

And it works in missions.

#

Now I can in theory port XEH to mission only.

meager granite
#

Doing regular nearestObjects on a small radius is not a big deal

#

Doing it say each frame could also be fine

#

Doing it each frame x100 times (for say 100 objects) will be too much

vague perch
proven charm
#

id go with something like one per second (bad experience with nearestObjects each frame)

hollow trench
#

You are right

#

By the way, are servers limited to 45.4545 FPS? Just getting info for when my boss wakes up because his server won't go any higher than that

vague perch
tribal crane
#

Don't most of them require config level event hooks?

tough abyss
#

There is a fall back for incompatible units

tribal crane
#

Ahh.

tough abyss
#

So the mob can stfu when a weird addon doesn't comply

#

It uses a PFH ; )

tribal crane
#

You don't just tell them to write their own repair .pbo? πŸ˜‰

tough abyss
#

Why not? I made the one in AGM, so someone else can do it this time.

tribal crane
#

Yeah, if you can't write configs/make a .pbo you should just go back to vanilla. grin

tough abyss
#

Or just don't use addons that UBC class AllVehicles just because there is one plane inside that will be used every 3 months.

tribal crane
#

Best one I found was a mod that redefined the voices array and made every single AI speak russian.

tough abyss
#

For some reason, using CUP, RHS and AiA TP, I have now rabbits spawning in the VA.

glossy raft
#

seems reasonable

tough abyss
#

I was debuging init events when suddenly 4 or 5 additional entries appeared in the RPT.

#

I tab back in the game and see rabbits everywhere

#

Troll rabbits

#

It is many times faster

#

But it doesn't pick up CfgAmmo and CfgNonAIVehicles objects

#

It is so much faster that I consider allMissionObjects as bugged.

tribal crane
#

X39: What's the reason for not putting variable declarations near their use? I would say it is one of the few areas of programming style that there isn't disagreement on.

tough abyss
#

basically yes, but entities is way faster

#

Oh, entities "WeaponHolder" doesn't pick up the weapons either

queen cargo
tough abyss
#

You'll have to use allMissionObjects. Entities seems to ignore weapon holders

#

entities "WeaponHolder"
[]
allMissionObjects "WeaponHolder"
[35edc800# 9: dummyweapon_single.p3d]

#

cursorTarget isKindOf "WeaponHolder"
true

#

position player nearEntities 50
[B Alpha 1-1:1 (Gefr. commy2)]

#

Seems like weapon holders aren't "entities"

#

[B Alpha 1-1:1 (Gefr. commy2),3764a400# 10: wpnsbox_f.p3d]
weapon boxes are

#

entities relates to allMissionObjects the same way as nearEntities relates to nearObjects

#

I have no idea what the definition of an entity is though

#

Seems to be soldiers, vehicles, non-map strcutures etc.

#

But not bullets and butterflies

#

Which are in allMissionObjects

queen cargo
#

an entity is an entity

#

"describing the word with itself"

#

in a nutshell

tough abyss
#

thank you for that piece of circular logic.

#

now I'm wiser

#

But know nothing more

queen cargo
#

at least it looks like isnt it like so?
an entity is basically an instance of a logic bound object

#

feeling better now?

tough abyss
#

Why is a butterfly not an entity then?

queen cargo
#

different list

tough abyss
#

So you don't have any definition either, thank you

queen cargo
#

you got multiple lists

#

for performance

#

and the definition is more or less the common one πŸ˜ƒ

tough abyss
#

So how do I know, if say a mine, is an entity or only a "mission object"

queen cargo
#

lemme repeat: every instance which runs on logic on a regular base can be considered as entity

tribal crane
#

Butterflies run logic frequently.

tough abyss
#

There is a logic in the butterflies though and they aren't entities apparently

queen cargo
#

just because you cannot receive them in common way does not means they are non

#

just means getting them is harder

#

or that they are organized "in the cloud"

tough abyss
#

But I want to know which objects are entities. And that before testing it with #logentities or anything like that.

queen cargo
#

shall i repeat myself again?

#

you ask the wrong questions

#

you got the base which is an entity

#

now the question is not are butterflies entities

#

the question is: what kind of are they

tough abyss
#

Is a butterfly an entity?

queen cargo
#

could also be a particle effect (which could also just be an entity depending on its implementation)

tough abyss
#

Is a weapon holder an entity?

queen cargo
#

would consider it as static one

#

if it is is simple checkable

#

if it can be moved

#

via velocity

#

its an living entity

#

as it has movement logic enabled

tough abyss
#

If a weapon holder is an entity. Then why isn't it listed in (entities "") ?

queen cargo
#

because the command does not needs to give you all entities @tough abyss πŸ˜ƒ

tough abyss
#

What does the entity command return then?

queen cargo
#

a range of entities

tough abyss
#

"entities"

vocal chasm
#
Heli1 Say2D "sound1";
sleep 5;
titleCut ["", "BLACK OUT", 0];
enableCamShake true;
addCamShake [5, 20, 25];
"dynamicBlur" ppEffectEnable true;   
"dynamicBlur" ppEffectAdjust [6];   
"dynamicBlur" ppEffectCommit 0;     
"dynamicBlur" ppEffectAdjust [0.0];  
"dynamicBlur" ppEffectCommit 15;  
titleCut ["", "BLACK IN", 10];
Heli1 SetDamage 0.97;
Heli1 AllowDamage False;

if I put this into a .sqf file and put a execVM in a trigger (serverside ticked on) will it then play for all players in a multiplayer mission?

tough abyss
#

So basically "Some entities"

queen cargo
#

which entities are in the list is implementation dependend

#

correct

tough abyss
#

And how do I know which one?

#

Testing?

queen cargo
#

testing, checking the documentation (ohhh wait ...), Reverse Engineering the data

stable dune
queen cargo
#

alternativly: ask BI

stable dune
#

Part heli1 damage and allowDamage part should be executed once, so you could use local heli1 check there

tough abyss
#

So they basically made a command that could return all kinds of lists

#

2/10

queen cargo
#

no, they made a command which returns what you want

#

because the rest you are not supposed to work on

#

or at least not via using that ocmmand

tough abyss
#

Why am I not supposed to work in gwhs ?

#

I disagree with that

queen cargo
#

gwhs?

tough abyss
#

ground weapon holders

queen cargo
#

ahh

#

they are just filtered out

#

you still can receive them dude

tough abyss
#

Sure, but not with entities, which says to me that they are not considered as "entities"

#

I wanna know why.

queen cargo
#

entities "all"

tough abyss
#

I know the answer

#

They habe no idea why

#

entities "all" does not list gwhs

queen cargo
#

tried using the GWHSs classname directly?

tough abyss
#

allMissionObjects "all" does

#

Doesn't work either

queen cargo
#

then the GWHSs are listed on a different list

#

which explains again why entities is faster

tough abyss
#

Thats why I'm asking

#

Yes.

#

But it's like 100 times faster, so...

queen cargo
#

just means you now know how many lists there are a command could check πŸ˜ƒ

tough abyss
#

ammo containers are in entities, only GWHs are not

tribal crane
#

WeaponHolders are simulation=house

#

It's probably just something in the base classes of the internal object that handles simulation=house vs something like thingx

tough abyss
#

That seems to be it.

#

I createVehicle'd a hospital

#

ANd it's not listed in entities

#

So my definition is:

#

An entity is:

dire island
#

I feel like I'm trying to reinvent the wheel, and someone has probably done a better implementation already. I'm trying to upgrade my ACE Medics into ACE Doctors when they're within a certain distance from my ACE Doctors. What I have so far is

    player spawn {
        {
            if ((_x getVariable "ace_medical_medicclass") == 2 && (player getVariable "ace_medical_medicclass") == 1) then {
                player setVariable ["CGEM_hasMedicPerms",true];
                player setVariable ["ace_medical_medicclass",2];
                sleep 10;
                player setVariable ["ace_medical_medicclass",1];
            };
        } forEach (player nearEntities 100);
        sleep 1;
    };
};```
which is running locally (a script execVM'd from initplayerlocal if the character has "_medic" in its vehicleVarName).
It seems to work OK, at least when testing locally, but is there any better way of doing it? Will the above implimentation run into any obvious failure modes?
fleet sand
tribal crane
#

Houses are probably entities. The function name is bad.

fleet sand
#

also you are grabbing all the entities when you just need players

#

that means the AI as well.

dire island
dire island
tough abyss
#
  • a CfgVehicles object that does not belong to the map, is not of type "house" and is not a soldier inside a vehicle.
queen cargo
#

more missleading @tribal crane

fleet sand
dire island
#

like (player nearEntities ["CAManBase",100])?

fleet sand
queen cargo
#

nop @tough abyss
you just think to closeminded and do not specify your entity

#

you talk about a generalized term

fleet sand
#

Also if you are running this code in InitPlayerLocal you dont need spawn becouse InitPlayerLocal is all ready sceduled.

queen cargo
#

and want specialized entities

dire island
#

Yeah, that's kind of what I'm getting at. If I want the medic to lose his doctor permissions when he's not within range of a doctor anymore, you kind of need the sleep 10 there, unless you can think of some smoother implementation. I mean, you could have a longer sleep for each round of spawn, but that would introduce a latency between the doctor showing up and the medic getting granted doctor permissions.

dire island
tough abyss
#

I don't care for general terms. I want to communicate what entities "" and nearEntities actually does.

queen cargo
#

you should start caring about it

#

because that is where your confusion comes from

tough abyss
#

Since there are at least two commands I think it's worth having a definition

#

My confusion comes from "house"s not considered as entities for no apparent reason

queen cargo
#

it is an entity

#

but it is not an entity of that kind you want to receive using entities

hallow mortar
# dire island I feel like I'm trying to reinvent the wheel, and someone has probably done a be...

You have a performance leak in this.
while is executing as fast as it can, potentially multiple times per frame. Every time it runs, it generates a spawn.
The spawn contains a sleep, but spawn is a new separate thread; the while does not wait for the first spawn to complete - it just keeps going. So you are creating thousands of spawn threads, each running separately. That's unnecessary for what you're doing and it's probably clogging the scheduler.

tough abyss
#

My first definition is:
an entity is whatever is returned by entities ""

#

And now I wanna know what these are.

queen cargo
#

which is already invalid

tough abyss
#

So I can use the command safely

#

I disagree.

queen cargo
#

as i said

#

you use a generalized term

#

on an command that is not named nicely

#

to get all items

#

using something that is designed to get not all items

hallow mortar
#

@dire island Try this:

while { true } do {
  if (((player getVariable ["ace_medical_medicclass", 0]) < 1) or (!alive player)) then {
    sleep 10;
    continue;
  };
  private _isNearMedic = (((player nearEntities ["CAManBase", 100]) - [player]) findIf { (_x getVariable ["ace_medical_medicclass", 0] > 1) && !(_x getVariable ["valross_var_upgradedMedic",false]) }) > -1;
  if _isNearMedic then {
    if !(player getVariable ["valross_var_upgradedMedic",false]) then {
      player setVariable ["valross_var_upgradedMedic",true,true];
      player setVariable ["CGEM_hasMedicPerms",true,true];
      player setVariable ["ace_medical_medicclass",2,true];
    };
  } else {
    // safety: don't downgrade "natural" doctors
    if (player getVariable ["valross_var_upgradedMedic",false]) then {
      player setVariable ["CGEM_hasMedicPerms",false,true];
      player setVariable ["ace_medical_medicclass",1,true];
      player setVariable ["valross_var_upgradedMedic",false,true];
    };
  };
  sleep 10;
};```
queen cargo
#

you try to hunt ducks using a stick

hallow mortar
#

Edited: added a safety to stop upgraded medics self-sustaining each other without a real doctor present, and also fixed an error
Edited 2: fixed another error
Edited 3: ok I think we're finally there

queen cargo
#

hf and happy new year πŸ˜ƒ

hallow mortar
#

always keep track of your bracket pairs :U

fleet sand
# hallow mortar <@128969357597474817> Try this: ```sqf while { true } do { if (((player getVar...

why do i feel like this can be shortend:

 
if _isNearMedic then {
    if !(player getVariable ["valross_var_upgradedMedic",false]) then {
      player setVariable ["valross_var_upgradedMedic",true,true];
      player setVariable ["CGEM_hasMedicPerms",true,true];
      player setVariable ["ace_medical_medicclass",2,true];
    };
  } else {
    // safety: don't downgrade "natural" doctors
    if (player getVariable ["valross_var_upgradedMedic",false]) then {
      player setVariable ["CGEM_hasMedicPerms",false,true];
      player setVariable ["ace_medical_medicclass",1,true];
      player setVariable ["valross_var_upgradedMedic",false,true];
    };
  };
tribal crane
#

Why isn't a simulation=house an entity, X39?

tough abyss
#

^ spot the troll

hallow mortar
#

I don't see how.
The number of lines comes mostly from the setVariables. You need all of those, one of them has a different value so can't be included in a forEach, so using a forEach instead of separately-listed setVariables wouldn't save any significant amount of space.

queen cargo
#

@tribal crane it is an entity (never said it was not) but it is not the same as eg. an soldier

#

and entities simply does not checks for houses

#

thats what i try to communicate :]

tribal crane
#

What's the difference between a "bad" function name and a "misleading" function name? Is all the new years alcohol making us argumentative? πŸ˜‰

queen cargo
#

did not yet drunk something
bad function name ==> missleading function name

warm coral
#

im trying to find an efficient way to fire a script using an event handler in a combat zone, relating to combat modes

#

however it seems that combat modes dont apply to player owned squads which (iirc) always stay in aware mode

#

currently i have

#
// initPlayerLocal.sqf
(group _player) addEventHandler ["CombatModeChanged", { 
    params ["_group", "_newMode"];

  if (_newMode == "Combat") then {

    _leader = leader _group;
    _nearestEnemy = _leader findNearestEnemy _leader;
    _factionNearestEnemy = faction _nearestEnemy;

    enemyFaction = "the enemy";

    if (_factionNearestEnemy == "fact1" || "fact2") then {
    enemyFaction = "the said faction";
    };
...
#

but this wont work im guessing due to the issue above and also if it did it would work only on that group specifically

dire island
tough abyss
#

I just see no value in the term "entity" anywhere else, so I use it for the "entities" and "nearEntities" commands, which behave very similar.

queen cargo
#

and thats why it is so important to understand that pretty much everything is an entity
but there are different kinds of entities

tribal crane
#

If you were pointing out that "misleading" is a subset of "bad" and therefore my phrase was imprecise then all I can do is... Ask if you speak German?

queen cargo
#

yes i do

tribal crane
#

πŸ˜‰

fleet sand
hallow mortar
#

AI units in player groups - maybe, test it.
Player units - well players don't have AI behaviour [citation needed], so it might work in the sense that it will return a technically valid result, but I wouldn't expect to get anything useful out of it.

tough abyss
#

If pretty much everything is an entitiy, then the term becomes useless.

tribal crane
#

Yeah, it pretty much is.

warm coral
#

i see

#

that is a shame

#

what i figured does work is

warm coral
#

but yea that doesnt give a lot of compatibility

queen cargo
#

well @tough abyss ... you ask why dog X is not covered by a book for german shepherd

tribal crane
#

I'd hazard a guess that if you made a list of simulation='s that it works for you can predict what it will return.

queen cargo
#

yup

#

most likely

tribal crane
#

There's some internal hierarchy of simulations, too; a "church" seems to be a "building" with extra bits to animate a clock, for instance.

tough abyss
#

Isn't that a script?

tribal crane
#

Nah, there's a special simulation=church that is used for clock towers. It has an extra animation driver with the current time.

#

I've always been tempted to try to make a rotating restaurant. πŸ˜‰

queen cargo
#

most likely just another subset @tribal crane

#

more or less like so:
entity --> house --> church

#

thus this could be found on the entities list
the houses list and the churches list

tribal crane
#

Map objects have them too, via the class= named property in the .p3d, e.g.:

class = church [C:\Development\P\a3\structures_f\civ\BellTowers\BellTower_02_ V1_F.p3d]
class = house [C:\Development\P\a3\structures_f\Bridges\Bridge_01_PathLod_F.p 3d]
class = housesimulated [C:\Development\P\a3\roads_f\Runway\RunwayLights\Flush_Light_green_F.p3d]

little raptor
#

You don't have to loop thru all simple objects. Just the ones in a small radius in front of the bulldozer, so performance will not be impacted noticeably

quaint oyster
#

is there a function similar to sqf firstBackpack _box;
that would work to detect a vest and uniform in a contianer?

#

(goal is to fill specific uniform and vest in a container like i'm doing for backpacks currently.)

#

nvm, "everyContainer" might be what i need.

modern osprey
#

Has anyone used the Intercept mod ? When using this mod, the inventory stops opening. Is there any way to fix this?

little raptor
modern osprey
little raptor
fleet sand
#

Also are you using dedmen Intercept mod or is there other mod named same ?

modern osprey
modern osprey
terse tinsel
#

Is it possible to use the script to make the smoke that spawns already in the air and not just arise from the ground???

terse tinsel
little raptor
little raptor
modern osprey
modern osprey
still forum
#

Take "Intercept minimal dev" from steam workshop.
And the intercept database release from GitHub should be ok

modern osprey
still forum
#

Inventory specifically, could be a InventoryOpened Eventhandler denying the opening.
But intercept minimal, doesn't add any

steady minnow
#

Good day to everyone.Can someone tell me how to make the Eventhandler "AnimDone" work for a specific animation from the unit's animation list (By animation name), rather than any one that is currently playing?

stable dune
dire island
# ripe rock Can someone show me how to make a randomized shoot house, I can make a asset gro...

Depending on your use case, it might be easier to just build the shoothouses you want, build each shoothouse in a separate layer. Hide all shoothouse objects, then use

_activeLayer = selectRandom _layers;
{
    _x hideObjectGlobal False; 
} forEach ((getMissionLayerEntities _activeLayer) select 0);``` to select one random layer out of "House1" and "House2" and un-hide all objects in the chosen layer. Since getMissionLayerEntities includes sub-layers, you could have one layer "Shoothouses", with "House1" and "House2" as sub-layers, and run 
```{
    _x hideObjectGlobal True; 
} forEach ((getMissionLayerEntities "Shoothouses") select 0);``` both at mission start to hide all shoothouses, and after the shoothouse has been ran through in order to reset it.
steady minnow
#

Thank you very much.

stable dune
#
_layers = ["House1", "House2"];
_activeLayer = selectRandom _layers;

missing s

dusk gust
dusk gust
charred monolith
#

Hi !
I'm currently trying to learn about compile and preprocessFileLineNumbers to optimise a bit my scritps, I have a Mission that has multiple .sqf functions, I've looked at the wiki page of both compile and preprocessFileLineNumbers , but I want to use my function on a object in game, how can I call the compiled function ? Where should I compile it ? In one of the Init.sqf file (initServer or initPlayer ?)

still forum
charred monolith
#

Understood, I'll try this. Thank you very much !

real tartan
#

is there a way to check if player have weapon holstered ?

#

checking hasWeapon

faint burrow
trail shale
#

Is there a way to set a fixed view distance in my MP mission for all players ?

trail shale
#

Cause im sure that the config panel where you can execute scripts locally etc. is disabled in MP

faint burrow
trail shale
#

Oh i should just make an init.sqf, thanks

faint burrow
#

initPlayerLocal.sqf

hallow mortar
# trail shale Cause im sure that the config panel where you can execute scripts locally etc. i...

"config panel" -> "debug console"
Whether it's enabled in MP depends on the mission's settings, which you can change in description.ext or the Eden Editor. It can be set, per-mission, to be unavailable, available for everyone, or available only for the admin.
description.ext is not used for scripts, it's used for config. You can use it to make CfgFunctions, which is related to scripting, but that's essentially a list of scripts for quick reference, not the scripts themselves. You'd almost never put an SQF command directly in description.ext.

trail shale
#

Thanks for the help

modern osprey
hallow spear
#

Is there anyway to closedialog by name?

#

I see to make a define, but doesn't that still just reference a number?

little ether
#

Quick question, if I remoteExec an addaction that is placed on a spawned object, do I need to give it 0 so that all players can interact with the spawned item? or would 2 for server work too?

stable dune
little ether
#

Wonderful thankyou

lime rapids
#

what math would one need to do to turn a direction to a position every few metres? been thinking of the math but not really sure how even looking at vectors

tulip ridge
#

What do you mean by "turn a direction to a position every few metres"?

#

Do you mean like, getting the position X meters away from where something is facing?

dusk gust
#

Example 2 might work for you if I understand what you want correctly

lime rapids
#

ignore above im dumb and forgot model to world exists

#

apologies

lyric plover
#

@lime rapids Sorry for the ping but are you still looking for a solution for your problem or can I post my own problem here?

lime rapids
lyric plover
#
_hostage = this;
_hostage disableAI "ALL";
_hostage addAction ["Drag Hostage", {[_this select 0, _this select 1] call dragHostage}];

_hostage setVariable ["isDragged", false, true];
_hostage setVariable ["draggedBy", objNull, true];

dragHostage = {
    params ["_caller", "_hostage"];
    private _isDragged = _hostage getVariable ["isDragged", false];
    if (!_isDragged) then {
        _hostage setVariable ["isDragged", true, true];
        _hostage setVariable ["draggedBy", _caller, true];
        _caller attachTo [_hostage, [0, 2, 0]];
        _hostage addAction ["Undrag Hostage", {
            params ["_caller", "_hostage"];
            _hostage setVariable ["isDragged", false, true];
            _hostage setVariable ["draggedBy", objNull, true];
            detach _hostage;
        detach _caller;
            _hostage removeAction (_this select 2);
        }, _hostage];
    };
};

_hostage addAction ["Insert Hostage into Nearby Vehicle", {
    params ["_hostage", "_caller"];
    private _nearbyVehicles = nearestObjects [_caller, ["Car", "Helicopter"], 10];
    private _teamVehicles = _nearbyVehicles select {side _x == side _caller};
    private _vehicle = _teamVehicles select 0;
    if (!isNil "_vehicle") then {
        _hostage setVariable ["isDragged", false, true];
        _hostage setVariable ["draggedBy", objNull, true];
        detach _hostage;
        _hostage moveInAny _vehicle;
        _actionId = _vehicle addAction ["Force Hostage Out", {
            params ["_caller", "_vehicle", "_actionId"];
            private _hostage = Hostage_1;
            unassignVehicle _hostage;
        _vehicle removeAction (_this select 2);
            _hostage action ["Eject", _vehicle];
        }];
    };
}, [], 1.5, true, true, "", "_this distance _target < 5"];

When I force the NPC to leave the vehicle, the action button for "Force Hostage Out" remains, despite trying to remove it. Any help?

#

The NPC does leave the vehicle for the record.

tulip ridge
#

You can instead do:

private _direction = getDir _someObject;
private _positionASL = getPosASL _someObject vectorAdd [
    sin _direction,
    cos _direction,
    0.02 // For spawning an object, you usually want a bit of extra height to prevent clipping into the terrain
];
lime rapids
tulip ridge
#

Which is why I said modelToWorld is going to be slow if that's what you're using it for

mint forge
#

Hi guys, can I get some help? I play with friends and I am mission maker for us. Me and my brother play on the same network and MY PC i server hosting. We got 7 people and when I try alone in my mission to run animations for AI it works perfect. But when I play with friends the position of AI is somewhere else than when testing and animations look silly. :/

tulip ridge
#

You're probably not playing the animations where the unit(s) are local

mint forge
#

I got trigger on map with "Anyone is in trigger" and in onActivation I got animation stuff like switchMove etc... That is wrong?

tulip ridge
#

Do you have the "Server Only" box checked?

mint forge
#

I do not. Will it help?

tulip ridge
#

Shouldn'tℒ️ make a difference, since that trigger would run on every person's machine, and the units would be local to one of them

mint forge
#

I will look again if it is checked or not. To be sure. πŸ˜„

#

If I have this in unit INIT:
this disableAI "PATH";
dostop this;
[this, "BRIEFING", "ASIS"] call BIS_fnc_ambientAnim;

It makes same thing. Everything works but when I play with friends, the unit is every restart somewhere else. Hosting on my PC where mission is. 😦

faint burrow
#
if (!(local this)) exitWith { };
mint forge
#

Where do I put this?

faint burrow
#

At the beginning, obviously.

mint forge
#

In every trigger spawning animations and in every unit's INIT?

faint burrow
#

The second. We don't know how your triggers are set up.

mint forge
#

When it is BIS_fnc_ambientAnim I got it in unit's INIT and when it is SwitchMove animation type I got trigger placed on map.

faint burrow
mint forge
#

Will look through. Thanks alot. πŸ™‚

faint burrow
lyric plover
proven charm
lyric plover
proven charm
#

yes

lyric plover
#

I'm gonna kill myself this fixed it

#

I need to get myself some glasses because I didn't see this

#

thank you very much

lyric plover
faint burrow
mystic socket
#

I'm borrowing this code from a friend to create a system where the players load a box into a vehicle through ACE to rearm it.

private _cargoHandler = {
    // params are [_item, _vehicle]

    // specifies the vehicles to be used, under variable name in the editor, name the vehicle and change
    // veh below to match, or name the vehicle "veh" and don't change anything.  You can also add more
    // by doing something like [veh1, veh2, veh3]
    private _allowedVehicles = [truck, truck_1, jeep, heli];
    if !(_vehicle in _allowedVehicle) then {
        return;
    };
  
    // specifies the type of box that is used. Change the name in quotes below to whatever class name you want.
    // the class name is the one below the actual name. e.g, a quad bike is B_Quadbike_01_F
    private _className = "VirtualReammoBox_small_F";
    if (typeOf _item != _className) then {
        return;
    };

    // the two above if statements can be combined, I separated them to be clear on what each does


    // had to hunt for where ace stores the loaded cargo, it's here:
    // https://github.com/acemod/ACE3/blob/master/addons/cargo/functions/fnc_loadItem.sqf#L35
    private _cargoItems = (_this # 1) getVariable ["ace_cargo_loaded", []]; // get items currently in the vehicle
    
    private _num = { typeOf _x == _className } count _cargoItems; // get the number of boxes that are the right type

    // if there are more than 2 boxes (change this number to be whatever, but also change how many are removed below if you lower it)
    if (_num >= 1) then {
        [_className, _vehicle, 1] call ace_cargo_fnc_removeCargoItem; // removes 1 box
        _vehicle setVehicleAmmo 1; // set ammo to full
    };
};

//  event name     function to call
["ace_cargoLoaded", _cargoHandler] call CBA_fnc_addEventHandler; // add the event handler```

It's throwing "typeof: Type String, expected Object"

for ```sqf
private _num = { typeOf _x == _className } count _cargoItems; // get the number of boxes that are the right type```
#

What can I fix about this? I don't want to bother that friend more than I have because he made this entire system.

hallow mortar
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
mystic socket
#

Thanks, just fixed it.

faint burrow
#

ChatGPT?

mystic socket
#

How do I fix that error? IDK which is a string. I assume it's _className but I removed the quotes around the part where the box is defined but that broke it.

mystic socket
#

I didn't get this from chatgpt, I asked a friend who's a scripting wizard for how to make this system and he gave me this code for it.

#

I put it in the mission and it threw the error. The system worked outside that though.

hallow mortar
#
 private _num = { typeOf _x == _className } count _cargoItems;

ACE vehicle cargo items can be stored as a "string" rather than as an object reference. If the object is saved as a string, then _x (an element of the _cargoItems array) will be a string sometimes. typeOf doesn't accept strings, it's for getting a string classname from an object reference.
You need to have a way of accounting for both object references and strings.

faint burrow
hallow mortar
faint burrow
#

I guess _cargoItems is already array of strings.

mystic socket
hallow mortar
hallow mortar
mystic socket
#

Awesome. I'll give it a shot.

hallow mortar
# faint burrow Hm, strange decision.

Not really, it's necessary for how ACE works. You can put both unique objects (object reference) and non-unique objects (string) inside vehicle cargo using their system. It has to preserve both types - converting a unique object to string would be bad, while at the same time there's no point storing e.g. spare tyres as unique objects.

mystic socket
faint burrow
#

Debug it.

hallow mortar
hallow spear
#

Also, if do (finddisplay 46) createdisplay "menu", how can i close the display? (Finddisplay 46) closedisplay 0, does not seem to work. Some of my variations end the game

hallow mortar
#

Where you might have a problem is one of the if statements at the start.

if (typeOf _item != _className) then {```
Although ACE can save the cargo items as either string or object reference, what it reports in the `ace_cargoLoaded` event handler is only the string classname, and this code is taking place in that EH. So `_item` here is _already_ the classname of the object that's just been loaded into the cargo, and you're once again trying to use `typeOf` on a string, which doesn't work. So remove `typeOf` here.
#

There's actually another problem with both of those if statements, which is that return is not a valid command in SQF. I assume it's meant to be a placeholder for some actual code that was never put in - but since it's there, it'll cause problems.

faint burrow
#

I would also check the values of _vehicle and _item vars.

hallow mortar
# faint burrow I would also check the values of `_vehicle` and `_item` vars.

We know exactly what they're going to be because they're provided by the EH.
https://github.com/acemod/ACE3/blob/master/addons/cargo/functions/fnc_addCargoItem.sqf
_vehicle is the vehicle (object reference) into which the item has just been loaded.
_item is the classname of the item that's just been loaded into the vehicle.
(The event is called with call so the EH code is running in the same scope as the ACE function and the variables are already defined with those names)

faint burrow
#

So you don't need to use params at the beginning?

mystic socket
#

I don't believe so, I think that's just him explaining how the code works.

faint burrow
#

Have you checked?

hallow mortar
# faint burrow So you don't need to use `params` at the beginning?

https://community.bistudio.com/wiki/Variables#Scopes
When you use call, the called code is executed in the same scope, and existing variables in the parent scope are available to the called code.
At line 45 in the linked ACE function, the EH (which is where this code is executed) is called with call.
It would be good practice to use params in case you want to also use this code with another EH, or in case ACE changes their variable names, but it's not strictly necessary.

mystic socket
#

I honestly can't make heads or tails of what's wrong. The code w/out the modifications here threw the error but still refilled the vehicle's ammo and deleted the box.

#
//Seige's script for rearming vehicles through loading boxes into their cargo.
private _cargoHandler = {
    // params are [_item, _vehicle]

    // specifies the vehicles to be used, under variable name in the editor, name the vehicle and change
    // veh below to match, or name the vehicle "veh" and don't change anything.  You can also add more
    // by doing something like [veh1, veh2, veh3]
    private _allowedVehicles = [truck, truck_1, jeep, heli];
    if !(_vehicle in _allowedVehicle) then {
        return;
    };
  
    // specifies the type of box that is used. Change the name in quotes below to whatever class name you want.
    // the class name is the one below the actual name. e.g, a quad bike is B_Quadbike_01_F
    private _className = "VirtualReammoBox_small_F";
    if (_item != _className) then {
        return;
    };

    // the two above if statements can be combined, I separated them to be clear on what each does


    // had to hunt for where ace stores the loaded cargo, it's here:
    // https://github.com/acemod/ACE3/blob/master/addons/cargo/functions/fnc_loadItem.sqf#L35
    private _cargoItems = (_this # 1) getVariable ["ace_cargo_loaded", []]; // get items currently in the vehicle
    
    private _num = {
    private _type = _x;
    if (_type isEqualType objNull) then {
        _type = typeOf _x;
    };
    _type == _className
    
} count _cargoItems; // get the number of boxes that are the right type

    // if there are more than 2 boxes (change this number to be whatever, but also change how many are removed below if you lower it)
    if (_num >= 1) then {
        [_className, _vehicle, 1] call ace_cargo_fnc_removeCargoItem; // removes 1 box
        _vehicle setVehicleAmmo 1; // set ammo to full
    };
};```
#

That's the code as it stands now, I probably messed something up

lyric plover
# lyric plover ```lua _hostage = this; _hostage disableAI "ALL"; _hostage addAction ["Drag Host...

Yeah so I've made a mistake and I forgot to add remoteexecs wherever they were needed for actions. Can I enclose this whole script in a function that I'd remotely call like this?

pls_run_this = { 
// pretend that code I replied to is here
}; 
 

[this] remoteExec ["pls_run_this",0];

The point of this is to make it work for Zeus on public servers, so that the hostages he spawns can be interacted with by other clients.

#

Also I don't know why I wrote [this] argument.

hallow mortar
# mystic socket ```sqf //Seige's script for rearming vehicles through loading boxes into their c...

So on reading this again, this was definitely supposed to have you replace some bits with your own names/script according to what you need, and not just use the whole thing as-is.
For example, those things at the start are meant to be used for filtering for specific vehicles, which you're not doing. (return still can't be used because it's not a valid SQF command, btw).
Let's strip all that out and get down to the core parts.

mystic socket
#

Oh, derp. I should have realized this. This was my first foray into actual scripting so I didn't notice.

#
    // specifies the vehicles to be used, under variable name in the editor, name the vehicle and change
    // veh below to match, or name the vehicle "veh" and don't change anything.  You can also add more
    // by doing something like [veh1, veh2, veh3]
    private _allowedVehicles = [truck, truck_1, jeep, heli];
    if !(_vehicle in _allowedVehicle) then {
        return;
    };```
#

So remove this?

#

Or when you say "Strip all that out" you mean ignore that?

hallow mortar
#
private _cargoHandler = {
    params ["_item","_vehicle"];
    private _className = "VirtualReammoBox_small_F";
    private _cargoItems = (_this # 1) getVariable ["ace_cargo_loaded", []]; // get items currently in the vehicle
    private _num = {
        private _type = _x;
        if (_type isEqualType objNull) then {
            _type = typeOf _x;
        };
        _type == _className
    } count _cargoItems; // get the number of boxes that are the right type
    // if there are more than 2 boxes (change this number to be whatever, but also change how many are removed below if you lower it)
    if (_num >= 1) then {
        [_className, _vehicle, 1] call ace_cargo_fnc_removeCargoItem; // removes 1 box
        _vehicle setVehicleAmmo 1; // set ammo to full
    };
};```
#

Now there might still be a problem here but at least we're only working with the parts we actually need

mystic socket
#

Gotcha

#

So basically this would refill the ammo for any vehicle the box is put into? Rather than just the ones specified at the first block right?

hallow mortar
#

Currently yes

#

We can add the filtering back later if it's important (and make it actually work)

mystic socket
#

It's not really all that important. I can lock the other vehicles in the editor.

hallow mortar
#

Just to be clear, you do still need the CBA addEventHandler stuff right at the bottom after all this. There wasn't anything wrong with that so I'm just ignoring it for now.

mystic socket
#
["ace_cargoLoaded", _cargoHandler] call CBA_fnc_addEventHandler; // add the event handler```
#

This one right?

hallow mortar
#

Yes

mystic socket
#

Alright. I've got that.

#

So IDK if this is like sqf basics. But I took one coding class in university so I'm kinda having a hard time reading this code.

Is it like creating a function with _cargoHandler, then telling it the variables it's supposed to look for are "_item" and "_vehicle"? Then stuff like _Classname, are defined and just used within that function?

hallow mortar
#

It's creating a function, and telling it to expect two arguments, and telling it to call those two arguments _item and _vehicle, in that order. It doesn't matter what those variables were called in the originating scope, it just matters that they were passed in that order.

#

Let's say you do this:

["myString1", "myString2"] call my_fnc_something;```
In `my_fnc_something`, the magic (auto-generated) variable `_this` will then contain an array, `["myString1", "myString2"]`. By default, `params` looks at the `_this` variable and parses its contents out into the private variables you tell it to, in order.
So if in `my_fnc_something` you do this:
```sqf
params ["_varName", "_someOtherVarName"];

then _varName will contain "myString1" and _someOtherVarName will contain "myString2".

lyric plover
#

Yup, like he said. Params extract the arguments in the order that they're provided with.

mystic socket
#

Gotcha, so when I'm calling CBA_fnc_addEventHandler, the second variable will be telling it to look for the cargo handler thing right? And since that's a built in function it's got the params built in too?

mystic socket
#

If it's not too much. How would you filter the vehicles? For future reference.

faint burrow
hallow mortar
#

So you're doing this:

["ace_cargoLoaded", _cargoHandler] call CBA_fnc_addEventHandler;```
then when ACE does its cargo loading, it does this:
```sqf
["ace_cargoLoaded", [_item, _vehicle]] call CBA_fnc_globalEvent;```
and that means _CBA_ does this:
```sqf
args call _x;

which is basically the same as doing [_item, _vehicle] call _cargoHandler

mystic socket
#

It makes a lot of sense when you unfold each command like that. Thank you!

hallow mortar
# hallow mortar We know exactly what they're going to be because they're provided by the EH. <ht...

I was slightly wrong about this btw.
I was looking at ACE_cargo_fnc_addCargoItem. Everything I said is true for that. But what's actually being used here is ACE_cargo_fnc_loadItem. That function does not flatten down the item to only ever be a string, so _item in our code could actually be either a string or an object.
Fortunately we don't actually use _item for anything here so it doesn't matter.

hallow mortar
# mystic socket If it's not too much. How would you filter the vehicles? For future reference.

There are a few ways to approach it depending on how you want to filter, and how safe you want to be.
A couple of basic options:

    if !(_vehicle in [myVicName1, myVicName2]) exitWith {};
    
    if !(typeOf _vehicle in ["className_1", "className_2"]) exitWith {}; // CASE SENSITIVE!```
The first one has a notable weakness, in that if any of those variable names are _undefined_ (the vehicle never existed, or the variable was overwritten with `nil`) then you'll get a script error. There are ways to make it safer, for example using `getVariable`, which can handle undefined variables, but again it depends exactly what behaviour you need.
mystic socket
#

So the former filters with the variable names from the editor, and the latter filters with the class name right?

hallow mortar
faint burrow
#

Or using findIf and ==.

hallow mortar
#

Really you can construct the list of vehicles to check against using any method for making an array of vehicles. vehicles, nearEntities, etc.

mystic socket
#

I will try that when I get more experience with scripting, that sounds like a good idea.

#

So basically I put either of those at the start of the cargohandler function to filter it right?

hallow mortar
#

After the params, ideally

mystic socket
#

Perfect. Thank you! You've been a ton of help!

lyric plover
#

@hallow mortar Hey, can you help me with my remoteexec question I asked earlier? I want to know if I enclose an entire script within a function, and then call that function using remoteexec, will it work?

#

I'm specifically talking about addAction events and if they will display for the players.

faint burrow
#

If you use addAction in Init field, you don't need to use remoteExec.

lyric plover
#

And the Zeus isn't the server, but one of the connected clients, that decided to take the Zeus slot.

faint burrow
#

Then you need remoteExec.

lyric plover
faint burrow
#

Post a link to your script or the script again.

hallow mortar
# lyric plover <@137672072821211136> Hey, can you help me with my remoteexec question I asked e...

Yes, BUT:
the function must be defined on every machine that's going to receive the remoteExec. Despite their name, global variables (pls_run_this) aren't automatically defined on all machines. "Global" in this sense means "all scripts on this machine".
You'll need to either define it in CfgFunctions (if you control the mission file) or use publicVariable to broadcast the variable before sending the remoteExec.

lyric plover
hallow mortar
#

I wouldn't suggest using Lua syntax highlighting for SQF :U

lyric plover
hallow mortar
#

Yes

lyric plover
#
pls_run_this = { 
 
private _targetObjArray = curatorMouseOver;       
_hostage = _targetObjArray select 1; 
_hostage disableAI "ALL";  
_hostage addAction ["Drag Hostage", {[_this select 0, _this select 1] call dragHostage}];  
  
_hostage setVariable ["isDragged", false, true];  
_hostage setVariable ["draggedBy", objNull, true];  
  
  
  
dragHostage = {  
    params ["_caller", "_hostage"];  
    private _isDragged = _hostage getVariable ["isDragged", false];  
    if (!_isDragged) then {  
        _hostage setVariable ["isDragged", true, true];  
        _hostage setVariable ["draggedBy", _caller, true]; 
  [_caller] joinSilent createGroup (side _hostage); 
        _caller attachTo [_hostage, [0, 2, 0]];  
        _hostage addAction ["Undrag Hostage", {  
            params ["_actionCaller", "_target", "_actionId"];  
            _actionCaller setVariable ["isDragged", false, true];  
            _actionCaller setVariable ["draggedBy", objNull, true];  
            _actionCaller removeAction _actionId;  
   { detach _x } forEach attachedObjects _actionCaller;  
        }, _hostage];  
    };  
};  
#
  
_hostage addAction ["Insert Hostage into Nearby Vehicle", {  
    params ["_hostage", "_caller"];  
    private _nearbyVehicles = nearestObjects [_caller, ["Car", "Helicopter"], 10];  
    private _teamVehicles = _nearbyVehicles select {side _x == side _caller};  
    private _vehicle = _teamVehicles select 0;  
    if (!isNil "_vehicle") then {  
        _hostage setVariable ["isDragged", false, true];  
        _hostage setVariable ["draggedBy", objNull, true];  
        detach _hostage;  
        _hostage moveInAny _vehicle;  
        _actionId = _vehicle addAction ["Force Hostage Out", {  
            params ["_vehicle", "_caller", "_actionId", "_hostage"];  
            unassignVehicle (_this select 3);  
   _vehicle removeAction (_this select 2);  
            (_this select 3 ) action ["Eject", _vehicle];  
        },_hostage];  
    };  
}, [], 1.5, true, true, "", "_this distance _target < 5"]; 
 
deleteVehicle _this;  
 
}; 
 

[this] remoteExec ["pls_run_this",0];
hallow mortar
#

Yeah so you need to publicVariable "pls_run_this" before you do the remoteExec, so it exists on all clients.
You should probably also look into JIP handling for remoteExec. Currently you have none, so pls_run_this won't be executed on clients that join after you place the object.

lyric plover
#

Thanks for reminding me of that.

hallow mortar
#

I don't really have time to go over the contents of your addActions, but you should watch out for locality there too. For example, action IDs are machine-specific and removeAction is local effect, so when someone does an action that's meant to remove itself like that, you need special handling if you want to also remove the action on other machines.
You could probably also have more complex conditions for the actions - like only being able to use them if the hostage isn't already being dragged by someone else, for example.

lyric plover
# hallow mortar I don't really have time to go over the contents of your addActions, but you sho...

I sure could but I felt overwhelmed by just doing what I did, and I had to work for half an hour to fix an issue that was very short, so I'm thinking that I'm not going to do that until I feel comfortable doing so. I'm talking about adding additional layers of complexity, when it comes to dragging conditions for instance.

Wait, so if someone for instance puts the hostage in the car, and the action to take out that hostage appears on the car, will it only appear for the person who inserted the hostage, or also appear for other people?

brittle badge
#

Hey guys, I have a question. How to script other colour's (like a blue background or something else) in a ENVG-II thermal? How I script my own coulering?

hallow mortar
lyric plover
hallow mortar
#

In a word yes, but it's more complicated than that because of JIP and stuff.
I would suggest, instead of doing all this on-the-fly adding and removing, just add all the actions at the start, as part of the initial function that's executed by everyone, and just use the action conditions to determine when they should be shown.
Sorry I can't help further, I really need to get on with some other stuff.

lyric plover
#

You still helped me a lot, thank you.

tough abyss
#

(findDisplay 46) closeDisplay 0 will end the mission. Because you closed the main display.

#

You have to close the dialog you created instead.

#

uiNamespace setVariable ["my_dlgMenu", findDisplay 46 createDisplay "menu"];

#

(uiNamespace getVariable ["my_dlgMenu", displayNull]) closeDisplay 0;

queen marten
#

[getMarkerPos "enemySpawn1", independent, I_L_CriminalGang] remoteExec ["BIS_fnc_spawnGroup", 2, true];
why is this code not working on a trigger that is set to Server only

warm hedge
#

Before making a wild guess, any error messages or how it is not working

queen marten
#

nope

#

not a single one error/warning/notice

warm hedge
#

Not a single what

#

You sure the trigger is even working

queen marten
#

lets find out

#

it does work

#

btw

#

it is being used on a player hosted multiplayer server

warm hedge
#

Then "I_L_CriminalGang" instead of I_L_CriminalGang

queen marten
#

error encountered

#

17:01:21 Error in expression <"_charsType", "_types"];
_chars = _this param [2, [], [[], 0, configFile]];
_cha>
17:01:21 Error position: <param [2, [], [[], 0, configFile]];
_cha>
17:01:21 Error Type String, expected Number,Array,Config entry
17:01:21 File \A3\Functions_F\Spawning\fn_spawnGroup.sqf..., line 42

warm hedge
#

Indeed it does not take a string

queen marten
warm hedge
#

I defined?

queen marten
#

nvm

#

just figured it out

#

heres what worked

#

looterGroup1 = [getMarkerPos "enemySpawn1", independent, (configFile >> "CfgGroups" >> "Indep" >> "IND_L_F" >> "Infantry" >> "I_L_CriminalGang")] call BIS_fnc_spawnGroup;
hallow spear
#

You are the man. Awesome possum thanks a bunch. Works great

crimson lion
#

Anybody familiar with grad persistence? I got it working on local MP and singleplayer, but on my dedi (where I actually need it), running #gradpersistencesave as the logged in admin or manually running [false,0] call grad_persistence_fnc_saveMission with the executeCode module in zeus on the server, but nothing happens. grad_persistence vars are created in my server's profile at dedi.vars.arma3profile, but they are all empty in values, its like the persistence framework isn't exporting anything. Maybe locality issue? I dont know.

junior moat
#

i have this code that is ran when an action on a civilian is done. but for some reason the animations only play for the world host. any clue why?

_detainAction = {
    _unit = _this select 3 select 0;
    removeAllActions _unit;
    [_unit, "ApanPknlMstpSnonWnonDnon_ApanPercMstpSnonWnonDnon"] remoteExec ["switchMove", 2];
    sleep 0.966;
    [_unit, "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"] remoteExec ["switchMove", 2];
    sleep 1;
    [_unit, "AmovPercMstpSsurWnonDnon"] remoteExec ["switchMove", 2];    
};
#

it didnt work without remoteExec and it doesnt work with remoteExec so i have no clue if its a locality issue or not

fair drum
#

even though switchMove is a global command, it has update delays to remote clients. To have an immediate effect on every machine, execute it globally

junior moat
fair drum
#

you are remoting it to the server only

#

with 2

junior moat
#

so do i use 0 instead?

fair drum
#

aye, or leave that arg blank

junior moat
#

alright, ill try that, thank you.

junior moat
#

im also having an issue with this script:

_x addMPEventHandler ["MPKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if (side _killer == west) then {
        removeAllActions _unit;
        [format ["%1 Killed a civilian (%2)", name _killer, name _unit]] remoteExec ["systemChat", 2];
    };
}];

on the host machine, it executes the systemChat command 3 times, but on clients it only does it once. any clue why?

#

Left: Host
Right: Client

round hazel
#

Hey folks, a little bit of code here that needs fixing. I'm at my wits ends, no clue why it's going wrong. The sound should stop playing on the triggers deactivation, but it doesn't, and rather continues to play, with a new sound being played on top if the trigger is exited and then entered again.

I suspect its an issue with the private/public, but not certain

Any ideas?

meager granite
meager granite
#

Triggers are entities, you can store it in its variable

junior moat
#

so do i not need remoteExec? when i didnt have remoteExec, it still showed the message twice for the host.

meager granite
#
thisTrigger setVariable ["proxyMusic", _proxyMusic];
```in the end of activation, then
```sqf
private _proxyMusic = thisTrigger getVariable "proxyMusic";
```to retieve it back into local variable in on deactivation
meager granite
#

If you add it on each machine, it will be sent out everywhere multiple times

junior moat
meager granite
#

MP event handlers are tricky, very niche and easy to mess up

junior moat
#

would it be easier to just use a normal one then?

meager granite
junior moat
#

i want for, when a civilian is killed by a player, for it to send a message in chat saying who killed the civilian.

junior moat
#

i can post the whole function if needed via pastebin

meager granite
junior moat
#

yes, apologies. there is an action to "detain" the civilian as well but that part works fine.

meager granite
#

Make sure to add MPKilled only on one client, preferably server client

#

And show chat locally, don't RE it as MPKilled is executed everywhere already, no need to send anything over the network

junior moat
#

i do that with if (isServer then {//...} correct?

meager granite
#

If its postInit CfgFunctions, then it should be executed everywhere and you'll need to limit MP EH addition to only happen on server

#

So wrapping it into isServer should be enough

junior moat
#

alright, ill try that, thank you for all the help πŸ™

#

interesting, it now shows the message twice for both host and client :/

meager granite
#

You probably added the EH twice

junior moat
#
{
    if ((count units group _x) == 1) then {
        removeAllActions _x;
        _x disableAI "MOVE";
        _x switchMove "ApanPknlMstpSnonWnonDnon_G01";
        _x addAction ["Detain", _detainAction, [_x], 1.5, true, true, "", "", 2];

        if (isServer) then {
            _x addMPEventHandler ["MPKilled", {
                params ["_unit", "_killer", "_instigator", "_useEffects"];
                if (side _killer == west) then {
                    removeAllActions _unit;
                    systemChat format ["%1 Killed a civilian (%2)", name _killer, name _unit]
                    // [format ["%1 Killed a civilian (%2)", name _killer, name _unit]] remoteExec ["systemChat", 2];
                };
            }];
        };
    };
} forEach units civilian;
meager granite
#

Where is this called from?

junior moat
#

inside of a function set to postInit = 1

meager granite
#

Sure you don't call this function again eslewhere?

junior moat
#

let me double check i didnt call it in initServer as well-

#

nope, i dont think so

meager granite
#

Do this, add:

diag_log text format ["!!! %1: Added MPKilled to %2", diag_frameno toFixed 0, _x];
```before `addMPEventHandler` inside `isServer` check
junior moat
#

alrighty

meager granite
#

Also make sure client mission is redownloaded so they have up to date scripts

#

Not sure what kind of setup you have for testing

#

in case client still uses old script without isServer

junior moat
#

im just using a player hosted server as i dont expect to be using a dedicated server for this scenario.

meager granite
#

Should work with dedi too

junior moat
#

getting an error on load now

meager granite
#

Forgot format

junior moat
#

ah lemme add that rq

#

script seems to be working correctly now actually

#

it might have been an issue of the client not getting the updated script

#

thank you for all of the help though! πŸ™

meager granite
#

Check if server has this line only once per unit

merry shard
#

Is there a script to make a door/gate locked for everyone except certain units? Like only the guy with variable name "door_opener" can open it

meager granite
#

Do you mean players by units?

merry shard
#

Yes sorry

#

Basically I (the Zeus in this case) want to walk through a door for cinematic effect but don't want any other players to follow me

#

If it's easier to lock an entire "building" that'd be fine too, since the prop is literally just a wall with a door in it

meager granite
#

Do setVariable for locking depending on player unit

#

I guess you're doing it in Init field?

merry shard
#

I was planning to yeah

meager granite
#

For default BI locking variables:

this spawn {waitUntil{alive player}; _this setVariable["bis_disabled_Door_1ο»Ώ", if(player == door_opener) then {0} else {1}]};ο»Ώ
#

Init field of the object

#

Waits until player loads, then sets locked flag depending on player being door_opener

chrome hinge
#

Anyone know how to script the formation commands like flank and advance? Can formations be further scripted to make custom formations?

Would appreciate a ping with the answer

meager granite
#

#arma3_ai would be the place to ask, I think. Dealing with AI is a major PITA, so be ready for complex stuff.

merry shard
#

aaa more errors, I'll look up the scripts to see if I can learn how to fix it, thank you though!

#

(though if anyone isn't busy this is the error I'm getting)

hallow mortar
merry shard
#

Oh okay, thank you!

meager granite
dusky owl
#
if ((getAssignedCuratorLogic player) isEqualTo (getAssignedCuratorLogic _targetCurator)) then
{
    curatorCamera setPosASL (GVAR(ZeusTPLastPos) select 0);
    curatorCamera setVectorDirAndUp [(GVAR(ZeusTPLastPos) select 1), (GVAR(ZeusTPLastPos) select 2)];
    GVAR(ZeusTPLastUsed) = time;
    hint "b";
    "b"
};

["zen_common_execute", [{
    ["zen_common_execute", [{
        params ["_posASL", "_vectorDir", "_vectorUp"];
        curatorCamera setPosASL _posASL;
        curatorCamera setVectorDirAndUp [_vectorDir, _vectorUp];
    }, [getPosASL curatorCamera, vectorDir curatorCamera, vectorUp curatorCamera]], _this] call CBA_fnc_ownerEvent; // Send up private position for teleport
}, clientOwner], _targetCurator] call CBA_fnc_targetEvent;

GVAR(ZeusTPLastUsed) = time;
"a"
```i get the hint "b" part but i also get the return value "a" rather than "b", am I misunderstanding something?
stable dune
dusky owl
#

basically return b value in the if

dusky owl
stable dune
#

Yes if you want exit from your code if your condition is true.
Then it will exit , and the rest of the code won't be executed.

dusky owl
mint forge
#

Hi guys. Not sure if it is correct channel, but how do I delete unsubscribed mods from steam? I have got subscribed to 70 mods and in my:
G:\SteamLibrary\steamapps\workshop\content\107410

I have 86 probably old mods. :/

pallid palm
#

@junior moat Plus you need to define a few more things i think

#
if (isPlayer _instigator && side group _instigator isEqualTo west &&
side group _unit isNotEqualTo west && _unit isKindOf "man") then {}
#

or what ever you need in there

mint forge
#

I already unsubscribed but the mods are still there.

warm hedge
cerulean hazel
#

Hey :Phen_WAVE:
I am trying to move a 'core object' using setVelocityTransformation in a loop to keep this core object moving towards a pointer object, this is all spawned on the Zeus side with a CBA_A3 Perframehandler; a localVehicle model of a scifi ship is then attached to that core object simulating scifi ships moving in the mission/mod. This works great for the ZEUS client but for other clients the ship/core coreobject appear to move in a very laggy sort of fashion, likes it stuttering.

Here is the weird part, when you zoom in with a binocular or 'eye-ball zoom' it shows up perfectly; see attached videos for visual reference.
see: https://streamable.com/5mnwrg

If you spawn it as ZEUS it work fine regardless of zoom, distance to it or anything. its always smoothly simulated.
see: https://streamable.com/ai0tol [timestamp > 0:19]

all of this is from a dedicated server testing environment with 2 connected clients (players), local testing presented no issues whatsoever

  • I have tried the following commands/functions in many ways to try and work around this issue:
    enableSimulation
    hideObjectglobal
    enableDynamicSimulation
    enableDynamicSimulationSystem
    setFeatureType
  • I have changed the core to a custom unit/vehicle, which have higher render priority but that only fixes the issue at very close ranges
  • I have played around with 12k View distance or 12k Object View Distance, No results

Q: Is there any way to FORCE it to render the ship core object as if I were looking at it while zoomed/binos?

fleet sand
cerulean hazel
fleet sand
cerulean hazel
fleet sand
# cerulean hazel I have tried: - Actual ship model - a core object, red gul can and attached the ...

Quick question about this:

This works great for the ZEUS client but for other clients the ship/core coreobject appear to move in a very laggy sort of fashion, likes it stuttering.
Have you tried to create local vehicle for each player and control it via server.
Basicly
Still haveο»Ώ the server authoritatο»Ώiveο»Ώ on when to stop/start the movement but witο»Ώh each ο»Ώclient havο»Ώing ο»Ώtheir own ο»Ώlocal object ?

flint topaz
#

^ that’s how I’ve done it in the past

#

Works great

cerulean hazel
#

I can rewrite it and try it.. I guess.

cerulean hazel
#

I will give these a try and get back to ya

radiant lark
#

is there any similar handler to onLoad that pops off when the UI element is rendered?

#

onLoad sends a very early signal, not what I'm looking for

open hollow
tulip ridge
radiant lark
#

I put it on the main menu

#

And onLoad is triggered when my arma is still loading the main menu lol

tulip ridge
#

Yes, because that's then the button would be loaded
What do you need it delayed for?

radiant lark
#

Because I modify the button's appearance once displayed

tulip ridge
#

Are you comitting the changes after you make them?

radiant lark
#

Yeah

#

I modify it externally, on an overlay

#

Lemme show you

#

But I think it can be solved with a loop or a waituntil that checks for ctrlShown

#

Its a progressbar that lets you know about mods loading, when it reaches main menu I made my own menu so it can call the GUI back and update the progressbar with a "Join Server" button

flint topaz
pale yew
#

does anyone know how to make a dedicated server ignore errors like no entry for mods

lyric plover
#

In MP how do I make an objective that is visible to everyone, and if someone triggers its completion or failure, make sure that everyone sees the objective status change?

steady minnow
#

Please tell me how to make the sound repeat in this handler after a certain time, during the time when the animation is playing.

(_this # 0) addEventHandler ["AnimChanged", {
    params ["_unit", "_anim"];
        if (_anim in ["krovosos_TurnL", "krovosos_TurnR"]) then {
            _Krovosos say3d "idle_1";
        };
        
}];    
proven charm
#

@steady minnow something like ```sqf
[_unit] spawn
{
params ["_Krovosos"];
for "_i" from 0 to 2 do
{
_Krovosos say3d "idle_1";
sleep 2;
};
};

stable dune
#

I would create a sound source that repeat sfx sound and delete if anim changed, no needed loop/ spawn/ sleep

proven charm
#

didnt know such system existed... πŸ€”

steady minnow
#

Thank you.I need to think about it.

next cove
#

Anybody recall a mod that adds a generic "Sector" module? I often used it to create big trigger areas to quickly dynamically hide/show squads of enemy AI

#

Can't think of what it was for the life of me

mystic socket
#

This is probably a dumb question, is there a way to call a trigger from the editor in a script?

Basically, I want to put a few triggers down in the editor, and then while those are not activated, a timer will go on. Once the timer goes off, a variable gets added to by an amount, and then the timer resets.

I think this is best to do with a while loop, something like this.

While {[trigger is not activated]} do
{ sleep [arbitrary amount of time]
variable += 500};

Is there a way to do this?

sharp rune
#

how do I get the position of a weapon accessory ( as in ASL/AGL or model position )

sharp rune
#

alternatively how do I get the selection positions of an optic or other attachment or something

tulip ridge
sharp rune
#

ah thanks fellas

mystic socket
#

I've been looking into that, this might be another dumb question. I'm looking to put it into a function. Do I pass the trigger names as strings in the params statement?

Likesqf params ["triggerName"]
or

params [triggerName]```
warm hedge
#
triggerActivated triggerName```
mystic socket
#

But like I want to put it in a while loop. Something like

civSaved = {
params ["trigger1","trigger2"]

_this = 0; //Number of civilians evacuated
while {} //Basically while the end trigger hasn't been updated
do
//timer stuff which adds to the civilian evacuated vehicle
};
};```

I'd then call this function at the end which gives a tally of the number of civilians the players bought time for.
#

The while statement would have something like sqf while {!trigerActivated triggerEnd}

Which would be called in Params

warm hedge
#

Your params usage is invalid. You need to remove that line

mystic socket
#

Oh it can just read the names of the triggers without the params line?

warm hedge
#

tldr, params is used NOT to declare a declared variable

#

I tldr'd it because it is complicated to understand the concept of it due to you need to understand scopes, local variables and much more

mystic socket
#

Gotcha

#

So I just put the variable names of the triggers I made in the editor in there right?

warm hedge
#

Yes

mystic socket
#

Awesome. Thank you!

#

I was thinking you'd have to pass the names of the triggers to the function when you called it

#

And Params was what's listening for that

warm hedge
#

There is no listener in RV Engine/SQF. If it is declared globally, which, in this case, they are, can be used everywhere/anywhere

versed trail
#

copyToClipboard is described on the Biki as only working on the server for safety. in that case, who's clipboard does it copy to in multiplayer and would I be able to copy to a clipboard of a client on a dedicated server?

warm hedge
#

It is a local command. What copyToClipboard'd is copied into local computer which executes it. On the other words, you won't be able to transfer somebody's clipboard into one

sharp rune
#

is there an existing empty simple object in the game I can use

warm hedge
#

For what purpose. I don't even think what you think does even exist

sharp rune
#

well I just needed like one single vertex or something to have the position of

warm hedge
#

And, what purpose

sharp rune
#

I want to draw some lines ( drawLine3D )

warm hedge
#

Then just draw using positions? I see no reason to create objects

sharp rune
#

I want to attach one to the player somewhere

warm hedge
#

Then use some hidden objects. Like Sphere

sharp rune
#

what's the class name, or what ever, for that

#

Sign_Sphere10cm_Geometry_F ?

warm hedge
#

Anything can work. Just hideObject it

sharp rune
#

alright, thank you

merry shard
#

For the HoldAction script (I'm using 3den Enhanced though), is _target == "yes"; a valid thing to use for the conditionShow parameter? Or do I only need one equals? Or is that entire thing just totally wrong
(To clarify I have another action that sets the contents of the _target array to the value "yes" so that's why it's there)

warm hedge
#

Depends on what you really wanted to do

#

_target == "yes" should return and error and won't work anyways

merry shard
#

Would it error because of the ==?

warm hedge
#

Because you are comparing an object to a string

merry shard
#

What if I used 1 instead of yes and used the script {_x == 1} count _target > 0;?

warm hedge
#

Again, what you really wanted to achieve?

merry shard
warm hedge
#

And what is "yes"?

merry shard
#

"yes" was just what I used as the variable to put something into the _target array, but I can change it

#

using _target set [0, "yes"];

warm hedge
#

_target in conditionShow is not an array, but an object

merry shard
#

Okay, new and maybe dumb question. When it says passed arguments are _target and _this does it mean I can ONLY use those, or does it just mean that they're able to be used?

warm hedge
#

Latter. I still don't know what you wanted to achieve in the condition

hallow mortar
heady ore
#

I'm looking for a script to make a medic have unlimited first aid kits/bandages, anyone who can help me?

little ether
#

Hey folks,

Any reason the following wouldn't be giving all players on my server an action on the spawned box (_vehicle) to delete it? Tested on server and it appears for no-one, not even the spawning player (which a normal local addAction succesfully does of course).

[_vehicle,"<t color='#00FF00'>Store Box", {_veh = nearestObjects [s1, ["Thing"], 10] select 0; deleteVehicle _veh;}] remoteExec ["addAction",0,true];

It's part of this larger section if that helps;

_pos = [(getPosATL s1) # 0, (getPosATL s1) # 1, (getPosATL s1) #2 + 5];         
_vehicle = createVehicle ["dm_crate1", _pos,[],0,"NONE"];        
{ _x addCuratorEditableObjects [[_vehicle], true] } forEach allCurators;        
_vehicle setDir (getDir s1);    
_pitchbank =  s1 call BIS_fnc_getPitchBank;        
_vehicle setPosWorld (AGLToASL(s1 modelToWorld [2.535254,9.3811,0.253628]));       
[_vehicle, _pitchbank#0, _pitchbank#1] call BIS_fnc_setPitchBank;      
[_vehicle, Hdropship] call BIS_fnc_attachToRelative;   
[_vehicle, true, [0,2,0],0] call ace_dragging_fnc_setDraggable;
[_vehicle, true, [0,2,0],0] call ace_dragging_fnc_setCarryable;
_vehicle addAction ["<t color='#008000'>Tool Box",{}]; 
_vehicle addAction ["<t color='#FF0000'>Unclamp Box", {_veh = nearestObjects [s1, ["Helicopter","Plane","Car","Tank","Thing"], 10] select 0; detach _veh;}]; 
_vehicle addAction ["<t color='#00FF00'>Clamp Box", {_veh = nearestObjects [s1, ["Helicopter","Plane","Car","Tank","Thing"], 10] select 0; [_veh, Hdropship] call BIS_fnc_attachToRelative;}];  
[_vehicle,"<t color='#00FF00'>Store Box", {_veh = nearestObjects [s1, ["Thing"], 10] select 0; deleteVehicle _veh;}] remoteExec ["addAction",0,true]; 
_vehicle addItemCargoGlobal ["tsp_paperclip", 10];     
_vehicle addItemCargoGlobal ["ToolKit", 1];    
_vehicle addItemCargoGlobal ["ACE_wirecutter", 1];    
_vehicle addItemCargoGlobal ["B_UavTerminal", 1];    
_vehicle addItemCargoGlobal ["ACE_surgicalKit", 1];    
_vehicle addItemCargoGlobal ["ACE_EntrenchingTool", 1];    
_vehicle addItemCargoGlobal ["ACE_DefusalKit", 1];    
_vehicle addItemCargoGlobal ["tsp_lockpick", 5];    
}]; ```
faint burrow
little ether
#

I think I see it, another {} encasing all the addAction params?

#

[_vehicle,{"<t color='#00FF00'>Store Box", {_veh = nearestObjects [s1, ["Thing"], 10] select 0; deleteVehicle _veh;}}] remoteExec ["addAction",0,true];?

faint burrow
#

No, use square brackets.

stable dune
little ether
#

So close, thankyou so much!

Addaction I'm familiar with so I wasn't looking at that wiki entry for examples πŸ˜‚ More the fool me huh?

hallow mortar
#

When you're rearranging things into a remoteExec, all the arguments are rearranged, not changed type. The only thing that changes type is the command name becoming a String. Arrays [] remain as arrays, Code {} remains as code, etc. so you would never change [] to {} or vice versa.

steady minnow
#

Can you tell me how to create a condition?If a certain animation is being played, then, for example, a certain sound is being played, repeating itself after, for example, 5 seconds?

steady minnow
#

Π’he sound, I mean.

#

Although the animation is playing all the time

stable dune
#

None sense what I was writing.
But anyway,
Your sound is played once because your event is called once.

steady minnow
#

I want someone to tell me how to write a permanent check to see if the animation is playing, and if it is playing, then the audio file should be played before the animation finishes playing.

faint burrow
#
_unit addEventHandler [
    "AnimChanged",
    {
        params ["_unit", "_anim"];

        if (!(_anim in ["krovosos_Run", "krovosos_Sprint"])) exitWith { };

        localNamespace setVariable ["krovososSoundPlaybackAllowed", true];

        _unit spawn {
            _soundSource = objNull;

            while { localNamespace getVariable ["krovososSoundPlaybackAllowed", false] } do {
                _soundSource = _this say3d "bloodsucker_breath";

                _time = time + 5;

                waitUntil { !(localNamespace getVariable ["krovososSoundPlaybackAllowed", false]) or { time >= _time } };
            };

            if (!(isNull _soundSource)) then {
                deleteVehicle _soundSource;
            };
        };
    }
];
_unit addEventHandler [
    "AnimDone",
    {
        params ["", "_anim"];

        if (_anim in ["krovosos_Run", "krovosos_Sprint"]) then {
            localNamespace setVariable ["krovososSoundPlaybackAllowed", false];
        };
    }
];
real tartan
#

is there SQF function/command to check if object is under layer in editor ?
more specific: if object is under layer in editor which is locked

#

clarify: need to determine if object is under locked layer during mission

#

found getMissionLayerEntities

opal zephyr
#

^thats the only one, plus getMissionLayers. Unfortunately there doesnt seem to be a way to get whether a folder is locked

cerulean hazel
proven charm
#

can you somehow detect if current server is password locked?

uneven magnet
# proven charm can you somehow detect if current server is password locked?

There does not seem to be any scripting solution to check for a password lock. The script would have to be able to access the server's config file because there does not seem to be a way to call the server directly for a variable, only to have the server process information or call other files on the server (generally other sqfs and scripts). I've been digging and this seems to be the ubiquitous answer.

#

If its a server that you own or use you could probably work with the API of your server host if they have one to automatically update a file that WOULD be visible to the mission file, but that's also a lot of work