#arma3_scripting

1 messages · Page 487 of 1

drowsy axle
#

What do you mean?>

#

Ik about CfgFunctions but what specifically is better than just a normal var

tough abyss
#

You have infinite loop spawning infinite scripts

#

In playerInitLocal

#

That will soon deplete Arma of all resources

drowsy axle
#

The sqf [] spawn { [ ["VR SYSTEM","Welcome to Wave Defence! Contact your Instructor to get your Loadout!",0] ] spawn BIS_fnc_EXP_camp_playSubtitles; while {CAP_WaitingWave} do { [ ["VR SYSTEM","Waiting to start the Next Wave. Contact your Instructor!",0], ["VR SYSTEM","Waiting to start the Next Wave.. Contact your Instructor!",4], ["VR SYSTEM","Waiting to start the Next Wave... Contact your Instructor!",8] ] spawn BIS_fnc_EXP_camp_playSubtitles; }; };?

tough abyss
#

While loop

#

When it runs, if it runs, it spawns millions of scripts

#

Very quickly

#

Maybe you forgot to add sleep to it

drowsy axle
#

0 4 8 are timers between each title

tough abyss
#

I don’t see any timers

meager heart
#

better just delete that thingy, make function for those messages and call it from your main loop on the server

tough abyss
#

I see while true spawn

#

That is non stop spawning shit

tough abyss
#

You spawn that function

#

You can put elephant in it

#

It returns almost immediately and spawns another

#

And so on

#

Spawn returns handle immediately

#

It doesn’t wait for script to finish

drowsy axle
#

Would that help?? idu ```sqf
[
["VR SYSTEM","Welcome to Wave Defence! Contact your Instructor to get your Loadout!",0]
] spawn BIS_fnc_EXP_camp_playSubtitles;

if (CAP_WaitingWave) then {
[
["VR SYSTEM","Waiting to start the Next Wave. Contact your Instructor!",0],
["VR SYSTEM","Waiting to start the Next Wave.. Contact your Instructor!",4],
["VR SYSTEM","Waiting to start the Next Wave... Contact your Instructor!",8]
] spawn BIS_fnc_EXP_camp_playSubtitles;
};```

tough abyss
#

No

ruby breach
#

Nope

drowsy axle
#

Actually

tough abyss
#

You don’t understand what I’m saying

drowsy axle
#

Updated

#

I don't need it to repeat.

#

I think three times is enough to prompt the player to know what to do.

tough abyss
#

Don’t put it in a loop if you don’t want repetition

drowsy axle
#

I did want repetition.

#

But if it causes those issues, then I can just deal with it thwice.

frigid raven
#

getPlayerUID has troubles with player references? I made a remoteExec with player as an argument. Now params ["_player"]; getPlayerUID _player; returns an unexpected result. Read the doc but could not really realise if it is a problem or not

ruby breach
#

What is the "unexpected result"

drowsy axle
#

@frigid raven Why not use _this lose the params

tough abyss
#

What remote exec look like

drowsy axle
#

If the remoteExec passes Player, then isn't it _this?

ruby breach
#

Cap, that BIS function already has repetition built into it. No need to try and loop it

frigid raven
#

wait a sec if I do

{_x} forEach allPlayers

is _x == player ?

drowsy axle
#

Yes

frigid raven
#

uh ok

drowsy axle
#

allPlayer (as stated above includes HC)

ruby breach
#

Players and headless clients

frigid raven
#

thought it wouldnt have the UID property applied or something

tough abyss
#

Some _x might be player

ruby breach
#

wouldnt have the UID property applied wat

drowsy axle
#
{_x} forEach allPlayers && isPlayer;```
ruby breach
#

Lolno

tough abyss
#

IsPlayer is Boolean you cannot add Boolean to array

rotund cypress
#

{ _x; true; } count allPlayers select isPlayer

#

If I recall correctly

#

That is if I understand what you want to do

tough abyss
#

That code won’t run

drowsy axle
#
{
if !(_x isEqualTo isPlayer) exitWith{};
_x ..blah..
} forEach allPlayers;```
ruby breach
#

allPlayers select {isPlayer _x};

tough abyss
#

= is assignment not equality

drowsy axle
#

fuk me lol

#

soz

#

brainfart

rotund cypress
#

@ruby breach he still needs to do something with the array though so I guess thats why he wants to use a loop

tough abyss
#

🤦‍♂️ I’m outta here, see ya

drowsy axle
#

bai @tough abyss

ruby breach
#

I'm not sure what xetra is trying to do with the list of players. I know Cap doesn't need a loop because he's using a BIS function with a built in loop/delay system

drowsy axle
#

@ruby breach I sorted that out. But thanks.

meager heart
#

maybe he just likes loops

rotund cypress
#

Also I think doing sqf { isPlayer _x } count allPlayers works to

#

And I think its faster

meager heart
#

no

ruby breach
#

no

frigid raven
#

no (i dont understand shit)

drowsy axle
#
allUnits addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
        sleep 2.5;
        deleteVehicle _unit;
}];``` Does this work @meager heart
meager heart
#

no

ruby breach
#

count doesn't return an array of objects

rotund cypress
#

I mean count can return array no?

ruby breach
#

It just returns a number

rotund cypress
#

Ok maybe you need to use apply with it then

drowsy axle
#

updated

ruby breach
#

allPlayers apply {isPlayer _x} would just be an array of booleans

rotund cypress
#

No I meant using count and apply

#

No I'm thinking of append actually

#

Just ignore me, I just stumbled in here. A couple of months since I did SQF. 😄

meager heart
#

@drowsy axle dude, b4 you will use any command or function, just check wiki in case you forgot something/trying it for the first time, you will save so much time...

drowsy axle
#

Okay. I will

unborn ether
#

@drowsy axle allUnits is an array, and suspension is not allowed in unscheduled, EVH code is unscheduled.

frigid raven
#

jeez conor mcgregor is a douche

#

hope khabibs wins this

unborn ether
#

@drowsy axle And if you want to make a cleanup for dead bodies, you can use built-in cleaner Corpse & wreck management in description.ext or otherwise go thru allDeadMen with server-sided script.

meager heart
frigid raven
#

using exitWith in a forEach works like a continue ?

#

in terms of java tho

#

or other languages that use continue in loops to skip to the next iteration

drowsy axle
#

ExitWith exits the forEach. For the passed value

#

So...

frigid raven
#

so it continues with the next aye?

drowsy axle
#
{
   _playerName = name _x;
   if (player vehicle IsEqualTo "Tank") ExitWith{hint format["%1 has a Tank",_playerName]};
   hint format["%1 has a Something",_playerName];
} forEach allUnits;```
austere granite
#

whats ===

#

whats "Tank"

drowsy axle
#

It's a fucking example @austere granite chill

frigid raven
#

xD

#

_playerName = name _x; omg u made it global

#

wtf

#

l2code

#

missing private

austere granite
#

there is no continue

frigid raven
#

ffs

austere granite
#

you'd want an extra scope

drowsy axle
#

having _playerName is local

frigid raven
#

_>

drowsy axle
#

having private _playerName makes it unable to change outside of the scope.

austere granite
#

I don't know java, but I know some python which I guess is mostly the same anyway

frigid raven
#

lies

austere granite
#

And there isn't a continue

#

srry bb

frigid raven
#

@austere granite got it - gonna use exitWith as mentioned by @drowsy axle

#

thx

austere granite
#

That's not the continue though

frigid raven
#

yea but it does what I want actually

austere granite
#

That will BREAK it, not continue with the next element

drowsy axle
#

@frigid raven the forEach isn't stopped.

austere granite
#

so you... dont? want continue

frigid raven
#

oh

austere granite
#

yes it is

drowsy axle
#

It continues.

frigid raven
#

what?

austere granite
#

no it doesnt

frigid raven
#

ok I gonna sit this out first

#

😄

meager heart
#

🍿

drowsy axle
#

It diverts the if ()

austere granite
#

you don't need to sit it out. exitWith exits the current scope. a forEach is one scope, using exitWith will cancel the entire forEach loop

#

it is NOT a continue like capwell is claiming

drowsy axle
#

@austere granite proof?

meager heart
#

LOL

austere granite
#

Okay i can start up my game and proof it to you, if you promise to buy me some internet beer

#

I can't be arsed to boot up arma lel

frigid raven
#

but every element in forEach casts a scope?

austere granite
#

It doesnt

frigid raven
#

😮

#

Midnight is activated

#

let's wait for his word

#

🥁

meager heart
#

3

#

2

drowsy axle
#

I thought it was in it's own scope as well

meager heart
#

1

austere granite
#
{ if (_forEachIndex == 0) exitWith { } } forEach [1, 2, 3]
high marsh
#

exitWith will exit current scope unless it returns true, which it'll create a new scope

austere granite
#

will run it once, not 3 times

frigid raven
#

so... when I return true it will work like a continue?

drowsy axle
#

What are you trying to do @frigid raven

#

because the ExitWith will work.. without a forEach

frigid raven
#

having a forEach over allPlayers - want to skip the loop if a player is not logged in (checking a variable)

drowsy axle
#

logged in as admin?

frigid raven
#

Problem is that I dont want the code to be executed if the player hasnt logged in

#

no I tried some login feature with CBA Hashes

#

just scripting tryouts

drowsy axle
#

ah right

#

I haven't looked at CBA

frigid raven
#

doesnt matter for this issue

meager heart
frigid raven
#

Having 3 players where 2 are logged in I want the forEach code just execute for the 2 logged in ones

#

ok forget about the logged in

#

2 players are cool

#

one is not

#

only run code for the cool ones

#

while forEaching over allPlayers

#

YEA I could filter the cool ones and make a forEach over this set

#

but I just wanna see if tehre is a continue thingie for loops

austere granite
#
{
    call {
        if !(_x getVariable ["cool", false]) exitWith { };
        // -- Do stuff for cool people
    }
} forEach allUnits;
#

a more continue like thing would be breakTo

frigid raven
#

well ppl said exitWith will not do that

austere granite
#
{
    scopeName "continue";
    call {
        if !(_x getVariable ["cool", false]) then { breakTo "continue" };
        // -- Do stuff for cool people
    }

} forEach allUnits;
#

exitWith will break the current scope

#

you see how there's a call?

#

Meaning it's an extra scope

frigid raven
#

ah

#

well could not catch taht - am a greenhorn

drowsy axle
#
{
    scopeName "continue";
    call {
        if !(_x getVariable ["cool", false]) then { breakTo "continue" };
        hint "You are cool";
    }
    hint "You are NOT cool";
} forEach allUnits;```
frigid raven
#

woah labeled loops jeez

austere granite
#

no

#

that is incorrect

#

I'll let you figureo ut why

drowsy axle
#

Well if it's incorrect it doesn't do what you said

austere granite
#

It's a thing for you, to figureo ut why that edit you did is wrong

drowsy axle
#

What does Break mean?

#

taken from: https://community.bistudio.com/wiki/breakTo ```sqf

scopeName "main";
while {true} do {
scopeName "loop1";
while {true} do {
scopeName "loop2";
if (condition1) then {breakTo "main"}; // Breaks all scopes and return to "main"
if (condition2) then {breakOut "loop2"}; // Breaks scope named "loop2"
sleep 1;
};
sleep 1;
};```

austere granite
#

edit still wrong though

drowsy axle
#

idc

austere granite
#

you do, because you're spreading disinfo

#

YOU ARE FAKE NEWS

drowsy axle
#

lol

frigid raven
#

🍿

drowsy axle
#
{
    scopeName "continue";
    call {
        if !(_x getVariable ["cool", false]) then { breakTo "continue" };
        hint "You are cool";
    };;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    hint "You are NOT cool";
} forEach allUnits;``` is this a better edit?
austere granite
#

So... a guy is cool,then that call is done... and what is it going to do? Going to tell him he's NOT cool

drowsy axle
#

forEach person who is cool. Is told he is cool.
forEach person who is NOT cool. Is told he is NOT cool.

austere granite
#

incorrect

drowsy axle
#

Is that not how that works?

austere granite
#

Cool people are also told they are not cool

drowsy axle
#

Why?

ruby breach
#

Realistically, nobody is told anything because you're not broadcasting anything

austere granite
#

kek

drowsy axle
#

xD

frigid raven
#

@ruby breach woah Smartie McFly appeared

austere granite
#

Because you're breaking to the scope, meaning it'll just continue

#

in the scope of continue, then the first thing there is going to be telling <nobody> that they are not cool

drowsy axle
#
{
    scopeName "continue";
    call {
        if !(_x getVariable ["cool", false]) then { breakTo "continue" };
        hq globalChat "You are cool";
    };;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    hq globalChat "You are NOT cool";
} forEach allUnits;```
ruby breach
#

What even started this conversation anyway.

frigid raven
#

me

#

always me

ruby breach
#

Someone trying to use exitWith in a forEach?

frigid raven
#

yea some idiot

#

dunno his name tho

drowsy axle
#

😛

austere granite
#

Extra was asking about a continue like thing in forEach loops

frigid raven
#

IM NOT CALLED EXTRA

drowsy axle
#

X11 is a better name tbh

meager heart
#

extra11 yes /s

drowsy axle
#

but it conflicts with @queen cargo

frigid raven
#

yep

drowsy axle
#

are you two clones?

queen cargo
#

mhh?

frigid raven
#

left the room

queen cargo
#

X39 is actually not conflicting in any way

austere granite
#
for x in allUnits:
    if not x.cool:
        continue
    
    print("You are cool")
#

that basically

drowsy axle
#

Okay I get that

#
    if not x.!cool:
        continue
    
    print("You are NOT cool")```
austere granite
#

i give up

drowsy axle
#

It would have to be a separate thing

austere granite
#

I've had too much to drink to try and explain things to Brainletwell

queen cargo
#

X39 is derived from my former nick Killer-X39
the Killer- part was dropped when it got popular with what i call "child culture" ... originally, it came from the first online game i ever played Breeed where you could play as literal killer robot online
Killer was the job to be done and X39 just the first 3 literals i hit on my keyboard

ruby breach
#

Lazy man's way of doing it: ```sqf
{
if !(skipThisIterationBool) then { };
} forEach [list]

drowsy axle
#
{
    scopeName "COOL";
    call {
        if !(_x getVariable ["cool", false]) then { breakTo "COOL" };
        hq globalChat "You are cool";
    };
} forEach allUnits;

{
    scopeName "NOTCOOL";
    call {
        if (_x getVariable ["cool", false]) then { breakTo "NOTCOOL" };
        hq globalChat "You are NOT cool";
    };
} forEach allUnits;
austere granite
#

oh boi

#

I need commys picture with the player in player thing

drowsy axle
#

lol

#

So what am I failing to grasp?

ruby breach
#

Cleaner solution would be to filter your list prior to even doing the loop

austere granite
#
{
    hint "Hi Capwell how are you doing?";
} forEach (allUnits select { _x getVariable ["brainlet", false]})
#

sick edit

meager heart
#

bulli edit

austere granite
#

the edit was becaus ei forgot the actual select thing, not because bulli

#

I would never mess up a bulli

meager heart
#

oh... ok

#

sick edit...

drowsy axle
#

Who is this pointed at?

#

Are you telling @meager heart "Hi Capwell how are you doing?"

#

bc no variable is set

meager heart
#

ok... i will probably leave o/

ornate ridge
#

silly question but how would one script an information pop up when a player loads into a mission?

halcyon crypt
#

you know, there is a project around that allows you to use continue and makes SQF a whole lot saner to work with

#

(in case anyone is going to try it out or bitch about the code, use the rewrite branch)

#

^^

queen cargo
#

why write in SQF at all if you just could use some different language @halcyon crypt

halcyon crypt
#

this isn't my work but it started out in SQF as a proof of concept

#

moving to an actual transpiler is the idea at some point

queen cargo
#

🤷 OOS could use some love ... thing is: nobody really uses those things sadly ...
otherwise, OOS nowadays would be kinda bug-free and feature-complete

halcyon crypt
#

I guess they have similar goals but they both do their thing in different ways

queen cargo
#

result still will be the same

#

at max 4 people using that, where 3 are developing it and that single other one just randomly discovered it

halcyon crypt
#

😛

unborn ether
#

Started with scripting, continued with bullying each other, now ending up measuring dicks.

halcyon crypt
#

who's measuring dicks now?

unborn ether
#

escapes thru the window

queen cargo
#

Though.. Probably will make what @halcyon crypt posted runable on sqf-vm soon ™

halcyon crypt
#

I already threw in the idea to use sqf-vm as an out-of-arma transpiler until there's a real one ^^

#

so +1 😃

#

with some modifications I guess because it's not really for outputting files is it?

queen cargo
#

You could output files already using the correct cmd parameters Plus the > operator (bash or power shell)

#

But there is no dedicates save to file method

halcyon crypt
#

nah that's fine

queen cargo
#

Though... Just like arma, it Supports extensions perfectly fine

#

Thus a normal file writing extension could do the Trick too

halcyon crypt
#

nah redirecting it to a file would be my use case anyway

queen cargo
#

Talking about swfvm usage

#

Sqf-vm Supports extensions (callextension)

halcyon crypt
#

heh, perfect (automated) testing environment

queen cargo
#

One of its usecases 😂😂

#

To get that sqf++ project running, I just need to know what commands are not supported in current head

halcyon crypt
#

what do you mean exactly?

#

all of A3's commands are supported by default

#

no configs or anything

#

it basically translates getPos(player()) to getPos player

#

SQF commands will be namespaced at some point though

queen cargo
#

Talking about sqf-vm

snow pecan
#

don't mind my lackey

#

he's had too much to drink

queen cargo
#

Sqf-vm does not provides All commands in arma yet

tough abyss
#

And it never will

halcyon crypt
#

gotcha, misread 😃

queen cargo
#

@tough abyss if it is only me developing, yes, never

tough abyss
#

Not because of that

#

getPos player what will it return?

#

Or worldName

queen cargo
#

Whatever the Player Position is

#

Stuff like worldname would require just a single command right now as it literally is some Spot where the proper Config Path is resolved

tough abyss
#

It won’t make sense

queen cargo
#

Getposasl would require map data, more complicated

tough abyss
#

Some commands need game engine

#

You need to add game engine too, don’t cut corners

#

And don’t forget time, date and setWind

queen cargo
#

No need for actual engine is the fun Part
Visual frontend is enough

#

Simulation not needed at All

#

With a visual frontend being optional (just like currently Config validation is) it also would still be able to use on non gui machines

#

And that is with the assumption that the ui is drawn at All

tough abyss
#

At some point you have to ask yourself what is it good for and then just develop it in that direction if you have limited resources

#

And drop the fancy useless crap

queen cargo
#

As I said
Single Person developing means sqf-vm will never reach all commands in arma

#

But right now it has 10% coverage

tough abyss
#

I can see people needing for development of extensions and unit testing it is actually quite useful

#

Dunno what else you can do with it that would beat firing arma

queen cargo
#

Ever have been in train having a horrible Laptop with you not capable of running arma properly?

tough abyss
#

This is like 5 ppl in the world have this problem

#

Can confirm am a person and have had this kind of situation

#

Unless you are on deadline developing for one of the life servers 😂

queen cargo
#

Already happened to me multiple times @tough abyss 😂😂 At conference same game

tough abyss
#

it's not an every day situation, but occasionally I'm away from my desktop for a while, but still like to be able to try a thing or two

queen cargo
#

Biggest plus though is indepth debugging capabilities without the need to run arma at All

#

Current snapshot of sqf-vm gets shipped with a debugger executable

#

You can try it if you want 🙈😂

tough abyss
#

Debugging?

#

I passed that, do it in my head

queen cargo
#

Feel free to test it

#

The sqf-vm needs to be run with -s though

meager heart
#

-s Splendid mode 👌

queen cargo
#

--server actually
But good Suggestionen @meager heart🤔

meager heart
#

at max 4 people using that, where 3 are developing it and that single other one just randomly discovered it
That one was forced to use it!11 and he kinda likes it now... 😔

ornate ridge
#

silly question but how would one script an information pop up when a player loads into a mission

meager heart
ornate ridge
#

tried that, didnt seem to work, but i'll give it another go

meager heart
#
player spawn {
    private _result = ["Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage;
    if (_result) then {
        _this call BIS_fnc_neutralizeUnit
    } else {
        ["endDefault", false] call BIS_fnc_endMission
    };
};
``` into ^ debug console @ornate ridge
cobalt ridge
#

Hey there, im rather new to scripting. can anyone help me translate a Dialog hpp script and use it as cutrsc? the script I found online locks the players movements

frigid raven
#

good morning buds

sturdy cape
#

As i see theres some skilled guys online right now ill ask my little question here again.

I made a vehicle claim /locking addon.
Everything works except one thing.
When accessing a groundholder next to a locked vehicle you can access the inventory through the left list menu selecting container.any ideas?

#

"Locking"the inventory being done by find/closedisplay

still forum
#

@drowsy axle https://discordapp.com/channels/105462288051380224/105462984087728128/492435196407447552 0xDEAD means arma killed itself manually because of something. Would be nice if you could've screenshotted the actually useful error popup. Instead of the "Arma crashed" window with 0 useful information whatsoever.
too many virtual blocks requested == Out of Memory.

https://discordapp.com/channels/105462288051380224/105462984087728128/492450688878772227 Because params is more readable.

@frigid raven https://discordapp.com/channels/105462288051380224/105462984087728128/492450931070468127 No. Only one of them.

@drowsy axle https://discordapp.com/channels/105462288051380224/105462984087728128/492450958324793354 No it isn't.

@rotund cypress https://discordapp.com/channels/105462288051380224/105462984087728128/492451465403695105 no you don't.
(allPlayers select {isPlayer _x})

@frigid raven https://discordapp.com/channels/105462288051380224/105462984087728128/492468209077846016
no forEach doesn't care about what exitWith returns.. at all.. I don't know where @high marsh got that idea?
Just use a normal if statement.
https://discordapp.com/channels/105462288051380224/105462984087728128/492469414596444162 it will. It will exit the call'ed scope.

Man soo much dumb shit overnight.. You want a continue command? I can make you one !!!!111!!1

@halcyon crypt https://discordapp.com/channels/105462288051380224/105462984087728128/492495324712140820 have you ever tried all of Arma's commands? Even Arma itself doesn't support some of it's SQF commands.

tough abyss
still forum
#

Doesn't work as he already explained yesterday

tough abyss
#

Or if you are making a mod, just mod out the action

still forum
#

Also doesn't work.

tough abyss
#

Why it doesn’t work with EH?

still forum
#

He wants to lock the vehicle. Which works fine with InvOpened EH.
But if you open a ground holder next to the vehicle. InvOpened fires for the groundHolder.. But that one isn't locked so it's fine.
But now when the inventory screen is open you can switch to vehicle on the left side panel. And the EH doesn't fire again

#

so you just opened a inventory that you are allowed to open. And switched over to the inventory that you are not supposed to be able to access.

tough abyss
#

EH returns 2 WHs

#

Just check both

still forum
#

My only idea is modifying the Inventory display code. To run code when you click the button to switch to vehicle

#

I would guess he already tried that if he said that he tried the EH out and it didn't work for him

#

I expect people to read the wiki before asking 😄

#

But we all know every well that, that doesn't work usually

tough abyss
#

No he didn’t I’m sure, it should work, the second wh was added not long ago

hollow thistle
#

It's still a bit shitty if you will be denied from opening inventory of container if locked vehicle is near.

fringe yoke
#

You'd add an EH to the Crate button or whatever the text is, so it would close when they switched

tough abyss
#

Second wh is usually objNull. If you are close to another container it will be that container. When EH is firing you can override opening, so you check if any container belongs to locked vehicle, if yes —> override

#

@hollow thistle you have to be literally next to vehicle in reach of vehicle inventory

#

There is also nearestSupplies command I think?

#

Vehicle inventory should be in it when you are close

frigid raven
#

When testing my mission on the ingame host (not 3DEN) should it behave like on a dedicated server? Because some things to work on the host way which do not when I deploy on the dedicated

tough abyss
#

On hosted server host player is the server hence it cannot be like on dedicated when no player is server

frigid raven
#

u sure? thought only on 3DEN preview player == server

tough abyss
#

Yes I’m sure

frigid raven
tough abyss
#

Brb, writing an email

inner swallow
#

@frigid raven Eden multiplayer preview and hosted server is the same thing

#

When you click multiplayer preview it shows you the server hosting screen next

frigid raven
#

ffs I hate that - cant figure out dedicated probs that way always have to deploy the mission and restart server

#

painz

inner swallow
#

What?

frigid raven
#

what

#

I mean in preview all works fine - on dedicated it doesnt. It is a pain to figure out the problem on dedicated and test the fixes because you've to redeploy the mission all the time

inner swallow
#

Ah

#

Well... Like I said once before, implement it with the appropriate distinction in locality

#

For example, if (isServer) then { //stuff}; will work properly both places

#

Commands on the wiki usually tell you whether a command takes global or local arguments, and if it had global or local effects

#

That should indicate where to run what

#

But yeah, apart from that you have to reupload the mission, which is annoying indeed.

tough abyss
#

You can have mission unpboed locally and tweak it, just need server restart unless you have patching enabled. It is doable though a little less convenient than Eden, but if you keep in mind the differences you can do it all in Eden and just test on dedi

sturdy cape
#

@tough abyss thats exactly what i am doing for the locking of the vehicles inv.the problem is that players can work around this by acessing a groundholder next to a locked veh and selecting the. Container in the left list in the gear dialog

tough abyss
#

I explained how you can tackle this

sturdy cape
#

Ah sorry just got the notification for your mention,answered but the chat itself didnt load yet.now i see.mobile connections🙄

frigid raven
#

@inner swallow I never used isServer yet. I can't figure out what usecase I need it. I split my scripts into client and server side and keep them in different folders. When I have to run a script on both client and server I just use remoteExec with the specific flag tho

tough abyss
#

Your init scripts run on every client including server this is why you need the condition such as isServer or isDedicated or local

frigid raven
#

initPlayerLocal.sqf will run on the server, too?

tough abyss
#

No for dedicated yes for hosted

frigid raven
#

I have initServer and initPLayerLocal

#

I dont use init.sqf

tough abyss
#

And yes if you are a host it will run on server which is you

frigid raven
#

yea I am aware of that

tough abyss
#

This is why you are having problems? You init server and init player local both run on your pc when you are host?

inner swallow
#

i'm assuming the code in initServer isn't being duplicated in initPlayerLocal?

#

at least, i'm hoping so 😄

tough abyss
#

Both int player local and init server are artificial constructs they are not called by the engine only init.sqf and init.sqs are true init scripts

errant jasper
#

If it is not working on dedicated, then one reason could be stuff in initPlayerLocal.sqf that should be in initServer.sqf

tough abyss
#

The other two are called from other scripts

inner swallow
#

hmm?

#

what do you mean M242?

tough abyss
#

Just what I wrote

inner swallow
#

yes but what is the point of writing it? initServer and initPlayerLocal run without any additional input

still forum
#

Both int player local and init server are artificial constructs they are not called by the engine only init.sqf and init.sqs are true init scripts
huh? Who calls initPlayerLocal then?

inner swallow
#

yeah exactly ^

tough abyss
#

Some script

inner swallow
#

init.sqf runs at the end, after initServer and initPlayerLocal

#

and it's perfectly fine to use the two separate ones

#

in fact it's probably a better idea to do that

#

cleaner

#

but one has to be sure that one is making proper assumptions of what can run on the server what can run on the client

tough abyss
#

Both called from initFunctions.sqf

still forum
tough abyss
#

A well asked question contains 89% of the answer

still forum
#

adwetch na waprosui.
Don't have russian keyboard here. That's what I learned in school. "The answer is in the question"

peak plover
#

Hi

#

Can someone help me find flaws or better ways of doing a money system

#

I wanna make the money into a global and public variable <UID>_money

#

If money changes, it will run a function on the server to change it

#

So, what if I wanna buy something

#

I buy a rifle, it runs remote executes a function to check the money and then reduces money and remote executes a function back on the client

#

I feel like this might have problems, like it makes too much traffic

still forum
#

Doesn't sound like too much traffic

#

think about how often transactions happen

peak plover
#

hmm

#

I imagine ~20 clients trying to transact ~10 times in the span of 15 seconds

#

so 13 transactions a second average?

#

Would there be any issues with this?

#

Like response from server would take long

#

etc

#

Any alternatives?

still forum
#

I can't think of a alternative besides handling money clientside

tough abyss
#

What are you building, a stock exchange?

frigid raven
#

How to disable the respawn button in the options menu via script?

#

cant find something like disableRespawn or such

#

I found snippets like

while {true} do {
_ctrl = (findDisplay 49) displayCtrl 1010;

_ctrl ctrlEnable false;

};

from 2013

#

hope there is a more hipster way already

peak plover
#

Just money for killing and buying weapons @tough abyss

#

Similar to cs

robust hollow
#

doing it in a loop is a waste of time really.

respawnButton = 0; in the description.ext should do it.

In a script you could do something like this

//description.ext
onPauseScript="script.sqf";

//script.sqf
((_this select 0) displayCtrl 1010) ctrlEnable false;
frigid raven
#

There is no normal EH possible?

robust hollow
#

onPauseScript is the eh

frigid raven
#

yea

#

but I like to have my EHs tidy in one file

#

and not scatted here and there (description.ext)

robust hollow
#

not for this i dont think so

still forum
#

CBA XEH could do it

#

but there is no script EH I think

frigid raven
#

okay

#

gonna try that then

sturdy cape
#

@tough abyss Reading into the Things you mentioned. Could i check for parentobject also? Or does editing the existing event handler to check for the nearsupplies also more sense?

tough abyss
#

@sturdy cape second weaponholder object returned by InventoryOpened if not null is the second container you see in inventory menu and can exchange with as well. If it is null you only have one weapon holder your inventory is connected to. If you go overriding event handler route you don’t need nearSupplies

young spade
#

AI UGL Ammo Swap

I can manually swap the ammo in an AI Grenadier's Weapon by opening an AI Grenadier's backpack and swapping the ammo in the UGL itself. He then fires the correct ammo.

Could someone offer a pseudo-code to writing this as a script -- eventually an addAction?!

Magazines Object returns an array of available magazines. There are just so many functions for someone who doesn't have years of experience with Arma scripting. ;0)

@still forum moved it here and clarified the query ;0)

tough abyss
#

So for some reason ctrlAddEventHandler isn't working, I looked at it, and it's returning -1, which should mean that it failed. Could someone help me with this?
Code is:

_return = _selectButton ctrlAddEventHandler ["onButtonClick", 
{
diag_log "It works!";
}];

diag_log format["%1", _return];
still forum
#

I don't see any clarification on the query. My questions still stand

#

What do you want to do? replace the magazine in the UGL or in his inventory

young spade
#

@still forum

I would like to replace the ammo in the weapon from the ammo in the AI inventory (i.e. if he has it, he can now fire it).

tough abyss
#

There is no EH onButtonClick for scripted EH

#

what

#

There is ButtonClick

#

Check the wiki FFS

#

The wiki

#

Literally says to use onButtonClick

#

You lie

#

Add an event handler (User Interface Event Handlers) to the given control

#

Oh it's in another one

#

ctrlSetEventHandler says what I need

still forum
#

replace the ammo in the weapon from the ammo in the AI inventory You mean make him reload that ammo? @young spade

tough abyss
#

but ctrlAddEventHandler doesnt say it

#

It says there in an orange box

#

Only blind cannot see

#

Ok im blind then

still forum
tough abyss
#

ctrlAddEventHandler doesn’t say onButtonClick either

#

But it has a link to EH page with all EHs and it says it right there

#

I don’t know the reason BI decided to make these names differ, probably to keep Arma consistently inconsistent, but it sure is confusing to people that do not like wiki

young spade
#

@still forum
Thank you - I shall have a look at those refs. Much appreciated.

meager heart
tough abyss
#

You're an hour late.

meager heart
#

your reading kung fu is weak 👺

shadow sapphire
#

I'm not understanding this phenomenon. Cannons one through four are NATO Scorchers with NATO crews. Cannons five through eight are CSAT Sochors with CSAT crews. First of all, I discovered that while both cannons one and five would agree to fire at an empty target:

Cannon1 doartilleryfire [getpos Dummy, "32Rnd_155mm_Mo_shells", 2];

Cannon5 doartilleryfire [getpos Dummy, "32Rnd_155mm_Mo_shells_O", 2];```

They would refuse to fire at each other:

```SQF
Cannon1 doartilleryfire [getpos Cannon5 , "32Rnd_155mm_Mo_shells", 2];

Cannon5 doartilleryfire [getpos Cannon1 , "32Rnd_155mm_Mo_shells_O", 2];```

I could not decipher the reason, but I did find a solution in alternative syntax. This would work:

```SQF
Cannon1 doartilleryfire [Cannon5 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];

Cannon5 doartilleryfire [Cannon1 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];```

While this would not work:

```SQF
Cannon1 doartilleryfire [Cannon5 getpos [0, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];

Cannon5 doartilleryfire [Cannon1 getpos [0, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];```
#

What's more bizarre is that in all cases where they refused to carry out their fire mission, the NATO cannon one would always fire off one round, while the CSAT cannon five would refuse to fire completely.

Regardless, after finding this solution, I began attempting to have eight cannons fire upon each other with this block:

Cannon1 doartilleryfire [Cannon5 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];

Cannon2 doartilleryfire [Cannon6 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];

Cannon3 doartilleryfire [Cannon7 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];

Cannon4 doartilleryfire [Cannon8 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells", 32];

Cannon5 doartilleryfire [Cannon1 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells_O", 32];

Cannon6 doartilleryfire [Cannon2 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells_O", 32];

Cannon7 doartilleryfire [Cannon3 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells_O", 32];

Cannon8 doartilleryfire [Cannon4 getpos [1, 0 + random 360], "32Rnd_155mm_Mo_shells_O", 32];```

Cannons one through five fired correctly, but three CSAT cannons animate a little bit, but then refuse to fire. Could anyone explain this or a solution to it?

I was originally conducting this experiment to see if artillery could be suppressed during a fire mission. The answer is no, they can not be suppressed during a fire mission conducted as described above.
meager heart
#

maybe inRangeOfArtillery will helps, also 0 + random 360 > random 360

shadow sapphire
#

Well, the artillery pieces are all exactly two kilometers from their target. How might I apply inRangeOfArtillery?

I don't understand your tip on use of random.

meager heart
#

inRangeOfArtillery > Returns true if all given units are able to fire at given position with given magazineType

shadow sapphire
#

Interesting, so it doesn't just tell you range, but if the target is valid at all?

meager heart
#

position, not target

ruby breach
#

I don't understand your tip on use of random a random number plus zero is just the random number

shadow sapphire
#

Roger. Good tip, I think there was a typo, haha.

meager heart
#

228 + 0 = ?

shadow sapphire
#

No, that makes sense, but 0 + random 360 > random 360 means zero plus random three sixty is greater than random three sixty, so I couldn't figure out what you meant.

ruby breach
#

The > in that sentence was intended to be interpreted as "change X to Y"

shadow sapphire
#

Makes sense, I've just never heard of or seen that.

queen cargo
#

--> for next time 😛

meager heart
#

random - value from 0 (inclusive) to x (not inclusive)

queen cargo
#

technically though ... 0 + random <NUMBER> is way slower then just using random <NUMBER>

shadow sapphire
#

Sounds good. I've already changed it in my experiment.

meager heart
#

it's the same as 0 + <random number>

queen cargo
#

yes
just that in SQF nothing gets optimized away

#

so you waste a full command cycles for personal style

unborn ether
#

GroundWeaponHolder GroundWeaponHolder_Scripted WeaponHolderSimulated WeaponHolderSimulated_single <- did i miss some of them here? thanks.

meager heart
#

Weapon_Empty

tough abyss
#

––> is c++ operator

still forum
#

no it's not

austere hawk
#

i-- ?

still forum
#

i--?i-->1:i--<1

tough abyss
#

It is

#

while (i ––> 0) ...

still forum
#

No..

#

––> is c++ operator wrong.
––> is c++ operators right.

meager heart
dusky pier
#

hello, is possible to get UI control type by script?

still forum
#

yes

#

Config commands

#

you need to know their config path tho

#

If they are config UI's...

dusky pier
#

i don't have this controls in config

#

i create them by ctrlCreate

still forum
#

turns out CTRL+F works 😄

dusky pier
#

@still forum thank you men!

meager heart
#

to get default/all control types ^

tough abyss
#

You should remember those by heart now!

meager heart
errant herald
#

can anyone help me out with the owner command for a script im working on

#

im getting an undefined variable when i use the setowner command

peak plover
#

post the portion of the script where you use owner

#

```sqf
// code here
```

#

copy paste that ^

#
// code here
errant herald
#

'''sqf
private ["_Veh", "_playerVeh"];
_Veh = _this select 0;
_playerVeh = _this select 1;
_playerVeh setowner (owner _tr_Vehuck);
'''

#

whoops

peak plover
#

` < not > '

errant herald
#

`

#
private ["_Veh", "_playerVeh"];
_Veh = _this select 0;
_playerVeh = _this select 1;
_playerVeh setowner (owner _tr_Vehuck);
#

ah

peak plover
#

_tr_Vehuck is undefined

#

It as never given a value

errant herald
#

ok i see

#

how would one define _tr_Vehuck

peak plover
#

_tr_Vehuck = <value>

errant herald
#

can it be any value?

peak plover
#

yes

errant herald
#

the value is the clientID?

#

so why dont i just use the value instead of defining _tr_Vehuck as a value

peak plover
#

if you want to use owner <value> then the value has to be a type

#

Bear in mind

errant herald
#

oh ok

peak plover
#

Owner only works when it's ran on the server

errant herald
#

yes

#

I know

#

its for a multiplayer server

peak plover
#

I mean, it only runs on servers

#

clients will fail

errant herald
#

Now, I'm a bit confused

peak plover
#

You can run the following on all clients and server

private _owner = owner myObject;
#

On normal clients it would always be 0

#

On the actual server machine

errant herald
#

i see

peak plover
#

It would return an actual owner

errant herald
#

well i just a owner

#

cause im trying to run an animation

#

via event handlers

#

and it needs to set an owner

#

if i get out of the vehicle

#

and back in it

peak plover
#

setOwner also only works if you run it on the server

errant herald
#

the event handler wont work

meager heart
#

also

private ["_Veh", "_playerVeh"];
_Veh = _this select 0;
_playerVeh = _this select 1;
``` ->
```sqf
params ["_veh", "_playerVeh"];
```👌
errant herald
#

so i dont need all that

peak plover
#

yes

errant herald
#

replace all that with that one line

#

ok

#
params ["_veh", "_playerVeh"];
_tr_Vehuck = "12"
_playerVeh setowner (owner _tr_Vehuck);
#

this looks right?

loud python
#

Hey, here's a really stupid question

#

are there objects that just don't work with synchronizedObjects?

#

I'm trying to use an invisible wall to fake interaction with a door

#

more precisely, I want to teleport players up the to the roof of a tanoa building

#

but synchronizedObjects returns an empty array [] 🤔

#

Even more interestingly, calling synchronizedObjects on the game logic entity it's synchronized to returns an array containing the invisible wall

#

any ideas how I could fix that or achieve something similar?

tough abyss
#

No it is not right, owner takes object not string

errant herald
#

ah huh

#

im still getting an error

#

which is not surprising

loud python
#

How are the chances the game just hates us all?

errant herald
#

its just not our day

loud python
#

maybe 😐

#

YESSS

#

it works now

#

now I only need to make it work in MP

knotty arrow
#

any way to get all items on a tree view ?

brave spire
#

hello, got a question, is a https://community.bistudio.com/wiki/BIS_fnc_customGPSvideo actually working? i´m getting an error that RSC layer name cannot be empty string when i call it, in A3 the function is written a little bit different then in A2, the only parameter for it is just a path to video

knotty arrow
#

do u have the gps layer opened?

brave spire
#

yes

#

i remember that it was working in A3 alpha, as it was the last time i was using this, but now it doesn´t work

knotty arrow
#

here u have the code

#

of the script

#

maybe can help u

#

any way to get all items on a tree view without do 300 loops?

dusky pier
#

hello, i have listBox filled data, but part of rows out of slider range. Is possible to change lb SliderRange?

dusky pier
#

@meager heart when i use on filled listbox - i take [0,0]

meager heart
#

list box != slider...

#

also don't remember who was that (was so long time ago, almost like... 10 hours), but he said something about CTRL+F and it kinda helps in some cases

dusky pier
#

ok, discord not needed, just all the time press CTRL+F 😃 i was searching solution, but not find. That why i ask for help here.

meager heart
#

🤷

still forum
#

I mean CTRL+F on the Arma wiki

dusky pier
#

i don't ask about slider i ask about slider in listBox. But for now i find solution

tough abyss
#

You mean your listbox content overflows so scrollbars appear? Resize list box with ctrlSetPosition

still forum
#

He means a slider in a listbox

#

You know slider.. That thing to select a number between 0 and 1
I guess as an element in the listbox

tough abyss
#

I have not a slightest clue what they want tbh

still forum
#

Yeah not that sure either.. i don't ask about slider i ask about slider 🤔

meager heart
#

type slider expected slider not a slider

tough abyss
#

I guess a screenshot of the problem would help

meager heart
still forum
#

He already solved the problem anyway. But he doesn't tell us how

gray thistle
#

is there a way to create a unit into a vehicle?

#

without placing them near it?

still forum
#

doesn't matter where the unit is

#

it teleports it into vehicle

#

look at "See also" for other slots

#

for AI you might want to assignAsCargo first

tough abyss
#

You can use CARGO placement

#

"CARGO" - The unit will be created in cargo of the group's vehicle, regardless of the passed position. If group has no vehicle or there is no cargo space available, the unit will be placed according to "NONE".

gray thistle
#

eh alright thought i could spare one step ^^

#

and sadly CARGO is not the solution for my needs but still thanks though

frigid raven
#

hey everyone

queen cargo
#

hey pal

tough abyss
#

#offtopic_greetings

still forum
#

hey ntsc

tough abyss
#

#offtopic_broadcast_standards

winter rose
#

#offtopic_fakechannelnames

frigid raven
#

@dusky pier I see you typing for about 5min now... what is this craziness

dusky pier
#

@still forum , sorry was afk. I just added another listbox with ctrlTypes and added on this list EH , if i select in listbox with types - another list display all controls with that type. Got this https://imgur.com/a/EyY7BNi

#

@frigid raven just my bad English and nothing else 😄

frigid raven
#

@dusky pier 🦌

drowsy axle
#

Which wiki page shows all parent classes for LandVehicle etc

#

nevermind found it

#

I'd like to find the child classes. How could I change this around?

#
fnc_printParents =
{
    disableSerialization;
    if (!isClass _this) exitWith {hint "Argument is not a config Class"};
    
    private _parents = [];
    
    while {!isNull _this} do
    {
        _parents pushBack configName _this;  
        _this = inheritsFrom _this;
    };
    
    reverse _parents;
    
    private _tv = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscTree", -1];
    _tv ctrlSetPosition [0,0,1,1];
    _tv ctrlSetBackgroundColor [0,0,0,0.5];
    _tv ctrlCommit 0;
    
    private _path = [];
    {
        _tv tvAdd [_path, _x];
        _path pushBack 0;
    } 
    forEach _parents;
    
    tvExpandAll _tv;
};

(configFile >> "CfgVehicles" >> "ALL") call fnc_printParents;```
queen cargo
#

finding all child classes theoretically would require to iterate through literally all child classes of those in the same layer as the parent class

regal kraken
#

Hmm arma's format command looks very primitive 😕 guess if you want any C style formatting you'd do your own magic with round and other functions; or even write that all into a minilibrary if you really need that so much

#

wonder what happens if I just let it puke out floats like those created by random()

tough abyss
#

varis if you want C++ try Intercept

#

When you learn different language and it doesn’t look like c, what do you do?

regal kraken
#

Complain loudly of course! 😁

#

Strangely most languages look like C - even PERL reminds you of C a lot when I write it

meager heart
#

google lolcode

regal kraken
#

@tough abyss Intercept looks interesting though often an overkill I guess... all I want to do is write server side debug logs for now 😁

frigid raven
#

@tough abyss not learn the language

#

I tried myself on ELISP - since I use emacs and haskell

#

Fun but... not very motivating somehow 😄

tough abyss
#

In sqf once you realise there are only 3 types of commands and the type of argument should match, there is nothing else to it

queen cargo
#

🤷‍♂️🤷‍♂️ If there is a method for it use it @drowsy axle

drowsy axle
rocky mortar
#

hi, anyone knows how lbdrop event works ?

#

lddrag event seems ok, but lbdrop is not handle

tough abyss
#

Fired on: Drag & drop operation finished.

rocky mortar
#

?

#

when i drop it do nothing

#

the event is not called

knotty mantle
#

What is the best way to get the position on the floor of a building? I am using 'BIS_fnc_buildingPositions' and create a groundweaponholder on that position. But it is below the floor level on the actual ground. Is there a way to circumvent that?

#

Thought about ASL/AGL conversion but that didnt solve it either. Just adding a certain height makes weapons floating or still under the floor for different buildings...

meager heart
#

just setPosATL for your weapon holder, maybe

knotty mantle
#

that is looking quite good. Thanks

rocky mortar
#

ok just fix the wiki for lbdrop

meager heart
#
player spawn {
    private _buildings = (_this nearObjects ["Building", 100]) apply {_x buildingPos -1} select {count _x > 0}; 
    private _posList = selectRandom _buildings;
    private _holder = "WeaponHolderSimulated" createVehicle [0, 0, 0];
    _holder addWeaponCargoGlobal ["launch_MRAWS_green_rail_F", 1];        
    _holder addMagazineCargoGlobal ["MRAWS_HEAT_F", 1];
    _holder setPosATL (_posList select 0); 
};
```this ^ https://gyazo.com/40c349db1a96664d02655e1d8ef6cadf
#

@knotty mantle

unborn ether
#

@rocky mortar Drag&Drop EVH are weird sometimes. There was a situation where I couldn't fire LBDrag even if listbox is canDrag = 1;.

rocky mortar
#

: //

#

it seems to be relative to control groups that act like layers

#

when a control is inside a control group, lbdrop can be fire only at control group level

#

i dont know how to retrive that this specific control should be the destination only from the cursor pos

meager heart
#

controls groups weirdness © (always there) 🤷

rocky mortar
#

:X

unborn ether
#

So far I didn't find how to grab controls by mouse pos.

#

Besides adding a damn MouseEnter over every possible control, which also doesn't always trigger for some reasons.

tough abyss
#

Nice fix, it basically said the same thing only without link

late gull
#

Guys!

#

😊

#

It's possible add inventory to wrecks?

unborn ether
#

Wreck is also a vehicle, if it has storage on it - it will be accessible.

late gull
#

ahh so I just add cargo global and done

#

Ty

unborn ether
#

No you just don't add cargo global, vehicle should have inventory storage.

high marsh
#

Ehhh ..no?

#

Wrecks are props, no configured inventory

unborn ether
#

Props are still a part of CfgVehicles and if you make maximumLoad? > 0 then it should have a gear, #arma3_config knows it better tho.

#

Anyways forget about vanilla wrecks.

high marsh
#

I was talking purely in the context of vanilla wrecks. The opposite could he the case for mods.

unborn ether
#

Still you can use addAction for that purpose, create a WeaponHolder below a player on use and fill it instead.

frigid raven
#

        class Intel {
            file = "Intel\Server";
            class showIntelProgress {};
            class addRandomIntelItem {};
            class updateIntelProgress {};
        }
        class Intel {
            file = "Intel\Client";
            class deliverIntel {};
            class initIntelmaster {};
        }

I want to have two separate folders but keep the parent class name. Is it possible that way? Or do I have to rename them to like Intel_Server and Intel_Client ?

meager heart
#

I want to have two separate folders but keep the parent class name
like that, maybe >

class Intel {
    class showIntelProgress {file = "Intel\Server\showIntelProgress.sqf";};
    class addRandomIntelItem {file = "Intel\Server\addRandomIntelItem.sqf";};
    class updateIntelProgress {file = "Intel\Server\updateIntelProgress.sqf";};
    class deliverIntel {file = "Intel\Client\deliverIntel.sqf";};
    class initIntelmaster {file = "Intel\Client\initIntelmaster.sqf";};
};
```check the files names ^ @frigid raven
frigid raven
#

Yea I see but well I stay with the other approach just naming the parent Intel_Client etc. I think

#

works as well

meager heart
#

up2u

golden storm
#

Hello guys, so i have a little issue, so i have an MP Mission for a dedicated server, thing is i wana put an intro video (i know how to) but thing is i just want it to be shown to players at the start not JIP or if possible players that join within the first 30 or 60 seconds, is it possible?

winter rose
#

serverTime, no?

still forum
#

no

#

players that join within the first 30 or 60 seconds

#

I'm like... 99% sure he means after missionStart.

#

Not after last server restart

#

Also serverTime has sync problems... Which overcomplicates everything

winter rose
#

so time usage would be server-side
oh, and I realised just now that serverTime was about restart, and not a synchronised time

meager heart
#

didJIP + read variable... (variable was set on the server after mission start) 100%
but just time also should work 👌

winter rose
#

well, isn't time starting at zero for JIP players too?

meager heart
#

yep ^

winter rose
#

so server-side:

sleep 60;
DontShowIntro = true;
publicVariable "DontShowIntro";```
and client-side:
```sqf
if (not isNil "DontShowIntro") exitWith {};```
meager heart
#

yeah, something like that

golden storm
#

Hmmm so trying to solve the aforementioned intro problem [he] came up with this:

Init.sqf:

if (isServer) then {
    [] spawn {
        sleep 60;
        DontShowIntro = true;
        publicVariable "DontShowIntro";
    };
}
if (hasInterface && isNil "DontShowIntro") then {
    intro_video = [] execVM "intro.sqf";
    waitUntil {scriptDone intro_video};
};

Intro.sqf:

cutText ["","BLACK FADED",2];
0 fadeSound 0;
0 fadeMusic 0;
enableEnvironment false;
enableRadio false;
intro_done = false;
sleep 2;

private _video = ["video\intromedio.ogv"] spawn BIS_fnc_playVideo;
sleep 5;
waitUntil {scriptDone _video};

cutText ["","BLACK FADED",4];
enableEnvironment true;
enableRadio true;
12 fadeSound 1;
12 fadeMusic 1;

sleep 4;

cutText ["","BLACK IN",2];
sleep 4;

intro_done = true;
#

Yet it will still not play the intro video, anyone has any idea?

#

I'm guessing it has to do with this part:

cutText ["","BLACK FADED",4];
enableEnvironment true;
enableRadio true;
12 fadeSound 1;
12 fadeMusic 1;

sleep 4;

cutText ["","BLACK IN",2];
sleep 4;

intro_done = true;
#

but im not sure

golden storm
#

No? 😢

unborn ether
#
if (isServer) then {
    [] spawn {
        sleep 60;
        DontShowIntro = true;
        publicVariable "DontShowIntro";
    };
}

Is missing ; at the end of isServer part - syntax error. Secondary, be sure that sleep 60 means that one minute after post-init is passed - you disable showing your intro since

if (hasInterface && isNil "DontShowIntro") then {...}

Is telling that. I'm not sure anybody will be fast enough to join to actually see some intro.

meager heart
#
//--- initServer.sqf
[] spawn {
    sleep 60;
    missionNamespace setVariable ["var_skipIntro", true, true];
};

//--- initPlayerLocal.sqf
[] spawn {
    if (missionNamespace getVariable ["var_skipIntro", false]) exitWith {};
    cutText ["","BLACK FADED", 2];
    enableEnvironment false;
    enableRadio false;
    0 fadeSound 0;
    0 fadeMusic 0;
    sleep 2;

    ["video\intromedio.ogv"] call BIS_fnc_playVideo;
    cutText ["","BLACK FADED", 4];
    enableEnvironment true;
    enableRadio true;
    12 fadeSound 1;
    12 fadeMusic 1;

    sleep 4;
    cutText ["","BLACK IN", 2];
};
```something in that direction, maybe ^ @golden storm 😃
late gull
#
 8:51:48 Suspending not allowed in this context
 8:51:48 Error in expression <1s;
_object setVariable ["effects",[]];
sleep (4 + random 20);
};>
 8:51:48   Error position: <sleep (4 + random 20);
};>
 8:51:48   Error Generic error in expression
[] spawn {
    "test_EmptyObjectForBubbles" createVehicle [0,0,0];
};
#

🤷

#

the game get stuck at this point

#

Should i open an issue? or wut?

high marsh
#

You can't have suspension in unscheduled environment. The error says it all @late gull

late gull
#

what about spawn?

high marsh
#

That's not what it's throwing errors for

#

spawn will send the code to scheduled enviroent

#

in your spawn code there is no suspension

late gull
#

i think these are internal erros from that bubbles

high marsh
#

I don't think so, it would give which script was throwing errors. I don't think you have the entire error pasted

late gull
#

mate, just run that code

#

you will get the same

high marsh
#

mate, which script is the error coming from?

late gull
#
[] spawn {
    "test_EmptyObjectForBubbles" createVehicle [0,0,0];
};
#

no script, just run that in console xD

high marsh
#

I think it might be a invalid way of creating the object, it doesn't seem to be properly working with createVehicle yes. Submit a ticket if you feel 🤷 @late gull

late gull
#

oki, ty

frigid raven
#

Good day beloved ppl with knowledge I gonna drain

still forum
#

@late gull Some mod has an init eventhandler on that. And it's bugged.

#

there is no "internal code" that can throw "internal errors" inside createVehicle

#

it's an engine command

#

throws knowledge at @frigid raven's head and severely injures him

frigid raven
#

knowledge was very effective

high marsh
#

@still forum I'm able to reproduce with vanilla?

still forum
#

Then it's the "vanilla" mod

meager heart
#

😃

high marsh
#

🤔

tough abyss
#

Can confirm, vanilla Arma, latest update, same error when creating the "test_EmptyObjectForBubbles" vehicle.

meager heart
#

afaik after this > "Tweaked: When test_EmptyObjectForBubbles, test_EmptyObjectForFireBig and test_EmptyObjectForSmoke are deleted, all their emitters are now deleted automatically"
that thingy broken ^

#

(sitrep v1.72)

#

was using this test_EmptyObjectForSmoke after that disaster ^ and was no issues 😃

#

so... no bubbles anymore...

high marsh
#

Heh,
is it possible to reference local client when passing code to remoteExec?

#
[format["%1",player isEqualTo objNull]] remoteExec["hint",_owner];

Returns true,
_owner is just clientOwner from playerConnected EH

still forum
#

clientOwner should return the local ownerID

high marsh
#

I need object reference like player gives me, remoteExec is targeting the correct player just fine.

still forum
#

when passing code to remoteExec yes

#

just pass code

#

which your example doesn't

meager heart
#

also clientOwner and _owner param from the playerConnected eh is the same...

high marsh
#

correct, player does not have a valid object reference though. That is what I am saying

#

Yes, slide dick I am using pc eh

still forum
#

you can iterate through allPlayers

#

and find the one with matching ownerID

high marsh
#

Eh. Such hacky.

meager heart
#

@high marsh you started seeing dicks too often in places where is none... i hope you're fine and still not on the dark side 💐

high marsh
#

@meager heart okay, slight tick.

#
if(isServer) then
{
  removeAllMissionEventHandlers "HandleDisconnect";
  removeAllMissionEventHandlers "PlayerConnected";
  addMissionEventHandler["HandleDisconnect",
  {
    params["_unit","_id","_uid","_name"];
    profileNamespace setVariable[_uid,getUnitLoadout _unit];
    saveProfileNamespace;
    diag_log format["%1: %2",_name,profileNamespace getVariable _uid];
  }];
  addMissionEventHandler["PlayerConnected",
  {
    params["_id","_uid","_name","_jip","_owner"];
    diag_log format["%1: %2",_name,profileNamespace getVariable _uid];
    {
      if(clientOwner isEqualTo _owner) then
      {
        [_x,profileNamespace getVariable _uid] remoteExec["setUnitLoadout",_owner];
      };
    } forEach allPlayers;
  }];
};

No dice

#

Data from rpt:

"Bryce: [[""arifle_AK12_GL_F"","""","""","""",[""30Rnd_762x39_Mag_F"",10],[],""""],[],[],[""U_B_CombatUniform_mcam"",[]],[],[],"""","""",[],["""","""","""","""","""",""""]]"
 Mission id: 797973cdff8b483c11a4bc7e809873c67f8eab8a
"__SERVER__: <null>"
"Bryce: [[""arifle_AK12_GL_F"","""","""","""",[""30Rnd_762x39_Mag_F"",14],[],""""],[],[],[""U_B_CombatUniform_mcam"",[]],[],[],"""","""",[],["""","""","""","""","""",""""]]"
Unaccessible
"Bryce: [[""arifle_AK12_GL_F"","""","""","""",[""30Rnd_762x39_Mag_F"",14],[],""""],[],[],[""U_B_CombatUniform_mcam"",[]],[],[],"""","""",[],["""","""","""","""","""",""""]]"
meager heart
#

ggwp

tough abyss
#

@meager heart clientOwner could be different from _owner, some weird behaviour on hosted, see note on biki

gleaming cedar
#

How to make an AI throw a chemlight_red?

still forum
#

make it play the throw animation and spawn a chemlight infront of it

unborn ether
#

clientOwner could be different from _owner, some weird behaviour on hosted, see note on biki where? never met that behaviour

tough abyss
#

forceWeaponFire with "ChemlightRedMuzzle"

still forum
#

clientOwner could be different from _owner, some weird behaviour on hosted Well... It should be

#

on hosted clientOwner returns the server's id

#

and _owner is the ID of the connected player

#

if they are the same then something is seriously wrong

#

@high marsh on PlayerConnected the player object might not exist yet

#

might be better to use respawn eh

tough abyss
#

The object exists but it is not player yet

frigid raven
#

I have an issue when using the Respawn event. I have a marker on the map called prison. I want my player to get ported there on respawn.
_player setPos (getPos prison);

Using this snippet. Debugging it shows me:

14:17:26 (0:00:05) DPL.PRISON - DEBUG! old_pos: [10,10,0]
14:17:26 (0:00:05) DPL.PRISON - DEBUG! new_pos: [12049.5,12604.3,0]

Tells me that I am using this command a bit too soon. What would be your clean approach to handle this situation?

#

Because the player is not send to the new_pos I forget to say

still forum
#

"too soon" ? what does that mean?

#

You mean something else is porting it back after you port it?

frigid raven
#

No. I respawn and the logic runs successfully and also the debug msg appear to be right - so getPos on player actually yields the position of the prison but the spawned player is still on his old position

#

Running the same script in the debug console after spawn it finally works

#

Gives me the hint of a timed dependency when setting the player position within a Respawn Event

frigid raven
#

or wait...

still forum
#

Well just spawn your script and sleep one or two seconds?

frigid raven
#

The param _unit... is it the new spawned player reference or the dead one?

#

because the scnd param _corpse is refererring to the corpse tho. Therefore I thought _unit is the new spawned one hmpf

#

ah k I think I got it

#

I have overwritten the _unit param by the Respawn event with player as I called my EH script

#

therefore it still referred to the "old" player before the respawn

astral tendon
#

Is that true that Agents consume less performacy than normal units? and is there any prof of it and documentation?

still forum
#

Agents have less AI stuff

#

so yes.

tough abyss
#

@frigid raven pass position as the return value of the Respawn EH, it will spawn unit there, no need to setpos

#

Yes to agents consuming less

astral tendon
#

the exemple returns a error

still forum
#

any details on that "a error"?

#

The example is quite old SoldierWB could be a Arma/Arma 2 thing

astral tendon
#

Its says generic error

#

agent = createAgent ["B_G_Soldier_F", position player, [], 0, "FORM"];

#

also makes a generic error but creates the agent

#
createAgent ["B_G_Soldier_F", position player, [], 0, "FORM"]; 

Making it like this stop the error

#

and it returns Agent 0xf97760c0

still forum
#

So..
createAgent ["B_G_Soldier_F", position player, [], 0, "FORM"];
doesn't work,
But
createAgent ["B_G_Soldier_F", position player, [], 0, "FORM"]; works fine?

#

🤔

astral tendon
#

no, i removed the "agent ="

still forum
#

Well duh

astral tendon
#

seems like i cant name the Agent 0xf97760c0

still forum
#

it doesn't throw generic error

#

It should throw reserved variable error

astral tendon
#

yeah, thats right

#
agent47 = createAgent ["B_G_Soldier_F", position player, [], 0, "FORM"]; 

it works.

#

can you change the exemple?

still forum
#

I will ye

tough abyss
#

WTF!? Congrats on discovering the error 👍

#

Might as well update it with A3 class, Dedmen

still forum
#

what error?

#

that someone forgot a _ at the example?

#

It's just an example and it still works like that. It shows you how the command can be used

tough abyss
#

It throws error therefore it has error

#

You probably forgot when once upon a time you were learning sqf.

#

Nothing is worse than an example that doesn’t work

still forum
#

No I don't

#

before I was learning SQF I understood the basics and knew what a variable assignment is

#

It's really not that hard ^^

late gull
#

is there a way to check in the debug console or somewhere in game if my function it's listed and compiled?

still forum
#

yes

#

put it into the watch field on the bottom

late gull
#

pls dont say using [] spawn :p

still forum
#

I... didn't...

late gull
#

haha nice

still forum
#

functions are just variables

#

just check if the variable is defined

late gull
#

oki ty

drowsy axle
#

What abilities does cfgFunctions have over a "variable" function?

still forum
#

none

#

cfgFunctions are also "variable" function

#

there are no non-variable functions

drowsy axle
#

I know that

#

"" what to define what I was talking about

still forum
#

cfgFunctions is just a list of files that the game should compile

#

instead of doing it manually

drowsy axle
#

Right.

#

mission.sqm > description.ext > init.sqf > ... Is that correct?

still forum
#

what?

drowsy axle
#

In terms of load order

still forum
#

no

#

preInit > mission.sqm > init.sqf > postInit

#

no idea what you mean with loadorder of description.ext?

#

do you mean scripts or objects or what?

drowsy axle
#

Well i'm assuming that the description.ext is ran before init.sqf

still forum
#

It's a config

#

it can't "run"

drowsy axle
#

Right.

#

Read first?

still forum
#

same as mission.sqm. it's also just a config

#

yeah.

drowsy axle
#

Okay.

still forum
#

mission.sqm is read first. Then description.ext

drowsy axle
#

I might switch over to cfgFunctions.

still forum
#

that's a good idea

drowsy axle
#

😛

still forum
#

easier to keep everything organized

drowsy axle
#

Yeah it is. But it "was" unnecessary when my scripts wouldn't work.

meager granite
#

What would be the best way to preload script-selected images as soon as possible? As far as I remember trying to display non-loaded images on UI makes title display disappear until they load.

#

Preload on different display, wait a little then create main display which should display these?

#

Speaking about title displays here.

#

Looking for ideas or experiences with this.

tough abyss
#

preloadTitleRsc?

meager granite
#

I assume it preloads config-defined assets only, I need to preload script-selected images, I can't have all possible images mentioned in the config from start.

still forum
#

in the past people just displayed it offscreen to preload it

meager granite
#

Yeah that's what I'm going to do, I wonder if preloading images like this on different title display will not cause my target title display to disappear until images are loaded.

frigid raven
#

I just saw a vid on youtube where sb. had a smartphone item and was taking pictures with it. Can these picture held as items? Like giving to another player and he can look at it? Or like storing them in the actions of a computer prop to view them there? Just having ideas...

late gull
#

hmm maybe something with Leaflets

runic surge
#

I am trying to convert local rotation to global rotation and it is proving far more difficult than I thought it would be

#

if I manually rotate an object along it's own x axis by 90 degrees, how would I be able to calculate the same global value that it would create?

#

for example, say I am trying to rotate 100 different objects with their own random x, y, and z rotations by 90 degrees on each of their own individual axis

frigid raven
#

@late gull yea that'll do

#

I had an idea where there is a "ghost" camerman that cannot be seen that takes pictures if your unit's run through a trigger

#

And I wanted those pictures to be seen by the players

#

hypothetically that would be possible?

late gull
#

🤔

tough abyss
#

With custom extension probably

frigid raven
#

meh alright

meager heart
#

clientOwner could be different from _owner, some weird behaviour on hosted, see note on biki

On hosted server there could be some inconsistency between clientOwner, owner and object creator id, especially in missions started from save. On the dedicated server this command however works reliably.
```can't see here something about `clientOwner` `owner` vs  player connected eh _owner param ^ @tough abyss
#

also i thought we was talking about dedicated only...

meager heart
#
addMissionEventHandler ["PlayerConnected", {
    diag_log _this;
    diag_log clientOwner;
}];
21:34:47 [2,"76561198045255537","sldt1ck",false,2]
21:34:47 2
#

local host ^

#

on hosted clientOwner returns the server's id and _owner is the ID of the connected player if they are the same then something is seriously wrong 🤷

still forum
#

hosted

#

Read that as dedicated

tough abyss
#

Have you tried to load from save?

#

And do you know what is object creator ID and how it works?

meager heart
#

nope about save... 😃

frigid raven
#

Ok ehm I have a new confusion here

high marsh
#

No confusion allowed

frigid raven
#
player setVariable ["logged", true];

[player] remoteExec [{_player getVariable "logged"}, 2] // returns false

#

it's is a bit trimmed and not semantically right because params etc. is missing

hollow thistle
#

player setVariable ["logged", true, true];

frigid raven
#

In fact I just wanna know if a player object when used as argument on a server side call - is it's variable state delivered as well?

#

oh

#

gonna read for that now

hollow thistle
#

it is local without third param.

frigid raven
#

What is actually happening with public true?

#

does it deliver the variables state when used as argument?

#

just curious

hollow thistle
tough abyss
#

Public variables are also persistent

#

RemoteExec is not by default

#

I’d ban the use of public variables

#

There is nothing remoteExec cannot do

#

But is more flexible and secure

runic surge
#

Does anyone know if it would be possible to directly rotate an object on it's own local axis?
Like in eden you can toggle between local and global coord space for the translation/rotation widgets

meager heart
#

local and global axis do not exist, what you have in eden is when widgets > X points to the east aka "global" or X points to the right of the object aka "local"... 😃

#

and yes it is possible to rotate any "editor placed" object...

#

@runic surge

runic surge
#

local and global axis do not exist, what you have in eden is when widgets > X points to the east aka "global" or X points to the right of the object aka "local"
that's what I mean
and yes it is possible to rotate any "editor placed" object...
yeah but I'm trying to rotate and object relative to itself

#

where [0, 0, 0] would be it's default 'local' position, and [90, 0, 0] would rotate it along it's own x axis by 90 degrees

#

I am trying to do what the widget does (e.g. rotating the object 90 degrees on its x axis) but through scripting and for multiple objects

#

also setVectorDirAndUp works relative to world rotation like all the other rotation related commands

meager heart
#

maybe just setVectorDirAndUp or vectorDir + setVectorDir

#

also setVectorDirAndUp works relative to world rotation like all the other rotation related commands

#

yes "like all the other rotation related commands"

#

did you tried just getDir and setDir ?

runic surge
#

those work for the Z axis which I could use to align the rotation to world space rotation and then maybe reset the orientation after I have changed what I needed to but I haven't tried that just yet

#

wait nvm that wouldn't work

#

not sure what I was thinking there

meager heart
#
_object setVectorDir [sin 45, cos 45, 1];
//--- the same as 
_object setDir 45;
runic surge
#

right

#

I understand what setDir does

meager heart
#

also we have BIS_fnc_vectorDirAndUpRelative that is vectorDirAndUp of object A relative to object B...

tough abyss
#

Pretty good

runic surge
#

also we have BIS_fnc_vectorDirAndUpRelative that is vectorDirAndUp of object A relative to object B...
I am attempting to set the relative rotation with 1 object and combining the returned value with the values that are supposed to pitch the object forward still just rotates along the global x axis

#

I'm not sure what your getting at but I'm trying to rotate the object on an axis that stays aligned to the object

#

also that is interesting @tough abyss

runic surge
#
Before Rot: 13.928, 343.723, 197.378
After  Rot: 288.941, 16.661, 197.012

This is before and after manually rotating the x axis 90 degrees with the widget and local coord space toggled on

#

I am simply trying to find out if this is possible to accomplish with just scripting

loud spruce
#

Does anyone know of any methods of detecting people that spoof UIDs? Had a bunch of people coming on my server recently and spoofing their UIDs to other players or admins and breaking everything

#

The obvious solution would be to check GUIDs, but I haven't found any way of doing so with scripts

#

Also have issues with the same cheaters coming and sending vehicles flying with no script logs whatsoever as it's apparently a "memory editing" cheat

#

Any script related solutions that can be used to detect this?

runic surge
#

_x setVectorUp [cos (getDir _x + 90), -sin (getDir _x + 90), 1 / (tan 90)];
I think this might work

#

nvm it is only partially right

frigid raven
#

hello my beloved brothers

dusk sage
#

Fetch their uid server side & crosscheck with what they report @loud spruce

queen cargo
compact maple
#

@queen cargo what can it be used for ?

queen cargo
#

it is a simple promise system for networking

compact maple
#

thank you

coral lynx
#

Don't use private kiddos, it gives cancer 😄

tough abyss
#

Maybe there is more context to that

coral lynx
#

Just to clarify - that dude use global vars everywhere.

#

Context is now known to you 😄

tough abyss
#

What has global to do with private?

coral lynx
#

You just have to see the code itself, pity can't show it now

#

there you go

queen cargo
#

@coral lynx depending on the usecase, that might actually be correct
though... i doubt that you never would have the need for private variables at all

#

but when not including magic variables, there are plenty of usecases where you can live without them entirely

#

just that the mentality he has ... is complete and utter bs

tough abyss
#

Apart from some weird avoidance of spaces between command and arguments I don’t see anything extraordinary, and he does use private. Now let’s have a look at your code. @coral lynx

queen cargo
#

everytime i see some arma life code ... something dies inside of me ... so horrible by design

tough abyss
#

You didn’t see original DayZ mod code?

queen cargo
#

things i never want to see: life code, dayz code, my old XMedSys code

#

probably when arma 4 launches

meager heart
#

someone is working on arma 4 cherno cti framework atm... so...