#arma3_scripting

1 messages ยท Page 595 of 1

ebon citrus
#

THAT ^^

#

companies want their official discords to stay clean

#

so let's keep it that way

warm venture
#

now im getting script restriction 0 after adding in the filters

#

REEEEEEEEE

#

how does that even make sense

ebon citrus
warm venture
#

the whole point of the filter is so you DONT get blocked out.

ebon citrus
#

it's magic

warm venture
#

Yeah, not battleye filters

#

something else

#

yeahhh imma just run without be filters cause I cant even join otherwise.

ebon citrus
#

yay! Can open and close the bag now and the elements are taken care of. Just need to make the logic to add items into the bag and open bags of other players. Image attached below:
https://imgur.com/a/8qTM0ys

#

dont mind the titles

#

those are fixed already

high silo
#

Any way I can force a AI out a vechile, they wont get out with any waypoints I give them?

uncut rapids
#
moveOut unit;
#

@high silo

high silo
#

Tried that

uncut rapids
#

that doesnt work?

high silo
#

Nope, cos I need to reference the group as the unit doesnt have a variable name

calm bloom
#

hello, guys, have anyone tried to script rotor destruction effect? I have found BIS_fnc_helicopterDamage function that is ingame, but it is using non-existant file "hsim\air_h\data\scripts\main_rotor_destruction.sqf"

uncut rapids
#
_myUnits = group (whateverGroup);
{
moveOut _x;
} forEach _myUnits;

?

#

@high silo

young current
#

@calm bloom that is take on helicopter function

#

nor for Arma 3

high silo
#

Will try it

uncut rapids
#

you have the group set as a variable, correct? if so that should work. It will return all units inside that group and force them out of the vehicle

high silo
#

Yeah I do, will load it up and test it now ๐Ÿ˜„

calm bloom
#

Yep, thanks but ive wondered if anyone dug in howto force the effect that is ingame

high silo
#

Saying Error group: Type Group, expected Object.

#

_myUnits = |#|group (team1);
{
moveOut _x;
} forEach _myUnits;

#

Here @uncut rapids

robust hollow
#

foreach units team1

high silo
#

If I fastrope the AI they get out. Even though the heli is on the ground and the games registed it

robust hollow
#

assuming team1 is a group like one of yesterdays snippets was

high silo
#

You would be correct

#

Worked!

#

Thankyou

#

But now they get straight back in after, even if they have waypoint. So will look into that

uncut rapids
#

ah yeah i completely forgot to use the units comment in my code i sent LOL sorry about that one

#

i literally had the wiki page for the command up and forgot it still LMAO

high silo
#

Any clue why they might auto get back in? Im thinking about allowGetIn false;

uncut rapids
#

as in the AI getting out and automatically switching back to a seat?

high silo
#

They all get forced out, then instantly start loading back into the heli

#

Even if they have a move waypoint

uncut rapids
#

maybe try disembarking the team leader first?

_myUnits = units group (whateverGroup);
moveOut (leader whateverGroup);
{
  if(!leader group == _x) then {
    moveOut _x;
  };
} forEach _myUnits;
high silo
#

I tried [team1] allowGetIn false; It forced one out but everyone else stayed in

#

Will try that ๐Ÿ˜„

uncut rapids
#

maybe lock the helicopter after they disembark?

#

idek why they would get back in so I'm just guessing tbh

robust hollow
#

allowGetIn expects an array of units not an array of groups ๐Ÿค”

high silo
#

That just gave me errors expunged, I tried locking it and it didnt work

_myUnits = group (heli1); 
{ 
moveOut _x; 
} foreach units team1;
heli1 lock true;
uncut rapids
#

wait so what are you trying to do

high silo
#

The helicopter lands, and the AI are unloaded. heli the flys away, but the AI dont listen to waypoints and auto load in when kicked out using that.

uncut rapids
#

cause the script I sent would just make the group leader disembark first and then make the rest disembark

high silo
#

I dont think I have the group variable set, I think I have the leader and the rest just follow him. Atleast thats what the scripts hinting.

#

And thats why [team1] allowGetIn false; only kicked one guy out

uncut rapids
#

so from what i just ran the group leader instructs them to board the vehicle as soon as they get out

high silo
#

Thats same issue im getting

uncut rapids
#
_myUnits = units (team1);
moveOut (leader team1);
{
  if(!(leader (group _x) == _x)) then {
    moveOut _x;
  };
} forEach _myUnits;
_myUnits allowGetIn false;

just worked for me

high silo
#

Yup

#

Worked for me too

uncut rapids
#

just if you want to allow them into vehicles again you have to do _myUnits allowGetIn true;

high silo
#

Brilliant, idk why he ordered them back in after

uncut rapids
#

AI makes absolutely zero sense

#

makes scripting a nightmare

high silo
#

Couldn't agree more

neon crane
#

https://prnt.sc/t1roy3
For some reason it tells me there's missing something in line 5.

this is supposed to show me when a Civilian has been killed.

addMissionEventHandler ["EntityKilled", {
        params["_killed", "_killer"];
}];

        if(isPlayer _killer)then{
            if(_killed (side _unit) == civilian) then {
            
            _killed_Name = "";
            [[format["%1  Killed  %2 ", name player,_killed_Name]]remoteExec["systemChat"]];

            }
        }```
robust hollow
#

that entire if statement is outside of the eventhandler code

#

you close the event code on line 3

neon crane
#

so move all that in between 2 and 3

robust hollow
#

yea. }]; goes after the code you want to execute on the event

neon crane
#

now it says Line 1 missing )

#
addMissionEventHandler ["EntityKilled", {
        params["_killed", "_killer"];
                     
            if(isPlayer _killer)then{
            if(_killed (side _unit) == civilian) then {
            
            _killed_Name = "";
            [[format["%1  Killed  %2 ", name player,_killed_Name]]remoteExec["systemChat"]];

            }
        }
}];```
robust hollow
#

the error shows the position where the issue is

#

_killed (side _unit) thats wrong, though it isnt line 1

warm venture
#
if (!(_building isKindOf "House_F") && !(_building typeOf "Land_BarGate_F") && !(_building typeOf "Land_ConcreteWall_01_l_gate_F") exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
if (((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) == _building) && (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops")))) exitWith {
    hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))];
};
if ((typeOf _building) == _vaultHouse && (nearestObject [_pos,"Land_Dome_Big_F"]) getVariable ["locked",true]) exitWith {hint localize "STR_ISTR_Bolt_Exploit"};
if (isNil "life_boltcutter_uses") then {life_boltcutter_uses = 0;};

if(!(typeOf _building == "Land_ConcreteWall_01_l_gate_F") && !(typeOf _building == "Land_BarGate_F")) then {
    _doors = FETCH_CONFIG2(getNumber,"CfgVehicles",(typeOf _building),"numberOfDoors");
    _door = 0;
    //Find the nearest door
    for "_i" from 1 to _doors do {
        _selPos = _building selectionPosition format ["Door_%1_trigger",_i];
        _worldSpace = _building modelToWorld _selPos;
            if (player distance _worldSpace < 2) exitWith {_door = _i;};
    };
    if (_door isEqualTo 0) exitWith {hint localize "STR_Cop_NotaDoor"}; //Not near a door to be broken into.
    if ((_building getVariable [format ["bis_disabled_Door_%1",_door],0]) isEqualTo 0) exitWith {hint localize "STR_House_Raid_DoorUnlocked"};
} else {
    _building setVariable["boltcut", true];
};
#

Does this look fine? It's not working properly.

robust hollow
#

try this @neon crane

addMissionEventHandler ["EntityKilled", {
        params["_killed", "_killer"];
        
        if (isPlayer _killer && {side _killed == civilian}) then {
            [format["%1  Killed  %2 ", name player,name _killed ]]remoteExec["systemChat"];
        };
}];
neon crane
#

aight

robust hollow
#

@warm venture define "not working properly"

warm venture
#

Alright

#

so im trying to make it to where you can use boltcutters on bar gates and concrete gates

outer fjord
#

Can people in a ragdoll state not be effected by SetVelocityModelSpace?

robust hollow
#

@warm venture linter says [1,3]:error:Parenthesis "(" not closed

neon crane
warm venture
#

What is the 1,3?

robust hollow
#

line 1 column 3

#

the first if statement condition has an opening ( but no closing )

neon crane
#

https://prnt.sc/t1rs3q
Okay, but this should show the players name.
@neon crane And this shows every killed unit, not just civilians

robust hollow
#

so you want format["%1 Killed %2 ",name _killer,name _killed]?

neon crane
#

it still says the units name, not mine shrug

robust hollow
#

is the unit not your player?

neon crane
#

MP

#

its for my milsim, with other players

#

and i want to log if they killed civilians

exotic flax
#

if in MP it will always return profileName

#

aka the name of player, not of the unit itself

neon crane
#

soo uhm

#

name profileName?

robust hollow
#

no

exotic flax
#

no, name _killer will simply return the same as profileName _killer in MP

neon crane
#

oh

#

how can i get the players name then?

warm venture
#

My stuff still isnt working :/

robust hollow
#

name _killer

exotic flax
#

but only when you run the mission in multiplayer

neon crane
#

Oh facepalm
I'm in singleplayer eden

exotic flax
#

and please... have the wiki open on a second screen or with ALT-TAB, and read the descriptions, syntaxes and examples of the commands/functions... it will tell you everything you need to know...

neon crane
#

well i have the wiki open

#

but apparently on the wrong pages

lyric badge
#

Guys, If i wanted to make certain doors to be opened by Blufor only ( Police Station ). How can it be done ?

warm venture
#

trigger

#

I have all my pd doors open automatically when cops get near and they are holding a keycard.

neon crane
#

Okay. I made it like that now, that it would send 2 different messages when either a civilian or a blufor was killed. Though it just replies with Player friendly fired civilian

And Player killed the civilian Blufor

addMissionEventHandler ["EntityKilled", {
        params["_killed", "_killer"];
        
        if (isPlayer _killer && {side _killed == civilian}) then {
            [format["%1  Killed the civilian  %2 ", name player,name _killed ]]remoteExec["systemChat"];
        };
        if (isPlayer _killer && {side _killed == west}) then {
            [format["%1 friendly Fired  %2 ", name _killer,name _killed ]]remoteExec["systemChat"];
        };
}];```
warm venture
#

What is arma scripted in? Lua or C? @robust hollow

robust hollow
#

sqf?

#

or u mean the actual game

#

like, engine level?

warm venture
#

yes but isnt sqf lua or c?

robust hollow
#

sqf is sqf

warm venture
#

cant find a sqf validator anywhere

exotic flax
#

for which IDE?

warm venture
#

im just using notepad++

warm venture
#

What do these run in?

#

what IDE

#

or should I just get/use atom

robust hollow
#

the first works in a fair few, the second i use in vscode, the third idk

#

i used the first to check ur code

exotic flax
robust hollow
#

but just on its own, no ide

#

i think he might mean for linting

exotic flax
#

I don't think there isn't any IDE linting (yet)

warm venture
#
if (isNull _building) exitWith {};
if (!(_building isKindOf "House_F") && !(_building typeOf "Land_BarGate_F") && !(_building typeOf "Land_ConcreteWall_01_l_gate_F")) exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
if (((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) == _building) && (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops")))) exitWith {
    hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))];
};
if ((typeOf _building) == _vaultHouse && (nearestObject [_pos,"Land_Dome_Big_F"]) getVariable ["locked",true]) exitWith {hint localize "STR_ISTR_Bolt_Exploit"};
if (isNil "life_boltcutter_uses") then {life_boltcutter_uses = 0;};

if(!(typeOf _building == "Land_ConcreteWall_01_l_gate_F") && !(typeOf _building == "Land_BarGate_F")) then {
    _doors = FETCH_CONFIG2(getNumber,"CfgVehicles",(typeOf _building),"numberOfDoors");
    _door = 0;
    //Find the nearest door
    for "_i" from 1 to _doors do {
        _selPos = _building selectionPosition format ["Door_%1_trigger",_i];
        _worldSpace = _building modelToWorld _selPos;
            if (player distance _worldSpace < 2) exitWith {_door = _i;};
    };
    if (_door isEqualTo 0) exitWith {hint localize "STR_Cop_NotaDoor"}; //Not near a door to be broken into.
    if ((_building getVariable [format ["bis_disabled_Door_%1",_door],0]) isEqualTo 0) exitWith {hint localize "STR_House_Raid_DoorUnlocked"};
} else {
    _building setVariable["boltcut", true];
};

if ((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) == _building) then {
    [[1,2],"STR_ISTR_Bolt_AlertFed",true,[]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
} else {
    [0,"STR_ISTR_Bolt_AlertHouse",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
};
#

cause theres something wrong in here

exotic flax
#

although SQFvm is extremely powerful (and up-to-date)

warm venture
#

and im not sure what

#

and my internet is being horrible rn so its gonna take an hour to download atom ๐Ÿ™„

lyric badge
#

@warm venture Can this be done with an already made map ? E.g Altis

warm venture
#

Thats what im running

exotic flax
#

programming 101: make sure your code is readable... that will make debugging a lot easier

warm venture
#

This is all stock altis life.

robust hollow
#
[2,57]:error:can't interpret statement (missing ;?): <Variable(_building)> <Keyword(typeOf)> <String("Land_BarGate_F")>
[2,97]:error:can't interpret statement (missing ;?): <Variable(_building)> <Keyword(typeOf)> <String("Land_ConcreteWall_01_l_gate_F")>```
exotic flax
#

if you have problems with a life framework, ask questions there...

robust hollow
#

_building typeOf "Land_BarGate_F" --> typeOf _building == "Land_BarGate_F"

warm venture
#

omg

exotic flax
#

like... 90% of that code is BS for us, and the amount of framework specific stuff is too much for us to debug for you

warm venture
#

idk how i didnt catch that.

robust hollow
#

script errors should tell you this

warm venture
#

client side errors?

robust hollow
#

yea

lyric badge
#

Sorry i really didn't get you. WDYM by "stock" altis life

warm venture
#

What it comes with.

#

thx connor ill try it.

lyric badge
#

aha i see. Thanks for your time buddy

warm venture
#

talking about the keycard thing?

#

I had to make custom scripts for doing that.

#

its like 5 lines.

lyric badge
#

And the custom scripts were used on an already placed buildings ?

warm venture
#

No but you could

#

if you know the door numbers

lyric badge
#

To make it clear. rn i am designing my map using Mapbuilder. i was working on the police station and i want the Blufor only ( Police ) to have the ability to interact with certain doors. Is this made using the mission or scripting the building it self before finalizing the map in TB ?

warm venture
#

if you mean scrolling and opening I dont think its possible but maybe..

lyric badge
#

yes

warm venture
#

I have scripts setup so it automatically opens when you get near

exotic flax
#

simply lock the door(s) by default, unless a cop gets close to it

lyric badge
#

How can that be done ?

warm venture
#

building1 setVariable["bis_disabled_Door_1",1,true];

#

replace the first 1 with the door number

lyric badge
#

aha. So i should place the Police Station in the mission. Not in the map it self. ( To access and script it easily ). Right ?

warm venture
#

in eden editor, put down the building

#

like the office building

#

then by the doors it will have a door number.

lyric badge
#

Yup exactly. I was gonna place them in Mapbuilder and then try to script them. which i think isn't possible

warm venture
#

by mapbuilder do you mean eden

lyric badge
#

No

warm venture
#

Not sure what Mapbuilder is

#

were talking arma 3 right?

lyric badge
#

There is a program used for designing the map. It saves the coordinates and some info of the object you placed on your terrain. After that you export the coordinated etc. as a form of txt file to Terrain Builder

#

coordination *

warm venture
#

I know how to do with eden editor thats all

lyric badge
#

You don't use any other tools ?

robust hollow
#

you dont need to for mission editing

#

not the same as making a map

warm venture
#

How do you run the linter in atom..?

robust hollow
warm venture
#
if (!(_building isKindOf "House_F") && !(typeOf _building == "Land_ConcreteWall_01_l_gate_F")) exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
#

So can anyone think of why this is giving the hint? the building is typeOf "Land_ConcreteWall_01_l_gate_F"

#

getting that with linter for whatever reason.

tiny wadi
#

When i setup a slider action, similiar to a buttons action in a dialog, do I need the prefix 'on' for the event handler?

warm venture
#

I'm trying to make it so you can bolt cut a fence gate

#

Its the concrete one with vertical bars. The issue is that when I try to get the cursorTarget, it usually grabs the object behind it because it goes through the bars..

robust hollow
#

@warm venture i dont use atom so cant really help you there. as far as the script goes, add log lines through the file so see what the type of building actually is and what line the script is exiting on and what conditions it isnt satisfying.

warm venture
#

is there a way to fix that..?

robust hollow
#

try cursorObject instead

warm venture
#

its picking up the pier behind it

robust hollow
#

even when you do it with cursorObject?

warm venture
#

Yeah.

#

picking up Land_Pier

robust hollow
#

could always check if the player is within x distance of an object with that classname.

warm venture
#

Right..r

#

but

#

I have an idea..

warm venture
#

@robust hollow Epic! it works. Anyway, any idea why this doesnt work? [player,"weed"] remoteExec ["life_fnc_say3D",RANY];

#

trying to play a sound from a source to nearby players, and no im not using player in the script, im using an object

robust hollow
#

based on that snippet alone, no. most likely causes i can think of are a bad object, incorrect sound class, quiet sound or RANY macro not defined.
u need to play around with it a bit and see what works to isolate what doesnt.

carmine sand
#

Is there a way to make hidden selection textures / set object textures visible only for as example blufor? I mean, that only blufor can see this texture edit and opfor cant see the texture change/edit like its original.

plain current
carmine sand
#

@plain current ok thank you, ill give it a try ๐Ÿ‘. To explain for what its needed is, need to do some kind of buildings & units stealth for one faction (so for the oponent it has to be stealth in visual) and the other faction needs to see their own buildings (so they can still walk in these) and units.

warm venture
#

[_speaker,"jailbreak"] remoteExec ["life_fnc_say3D",RANY];

#

still cant figure out why this isnt playing a sound for everyone

winter rose
#

because L*fe ๐Ÿ˜„

warm venture
#

?

#

because its arma?

#

got it

high marsh
#

no, life.

warm venture
#

basically nothing works properly in arma

warm hedge
#

arma3_x64.exe works really fine for me

robust hollow
#

i never have any issues i didnt cause myself ๐Ÿ™‚

warm venture
#

cause vaulting through doors/walls is normal eh

high marsh
#

the geometry kinda pushes you out of doing that

winter rose
#

all I accept are vanilla bug reports ๐Ÿ˜„

warm venture
#

so whats the point of setting a building's doors to "locked" if it doesnt actually lock them?

#

just lets them be opened no problem

high marsh
#

look something similar to this?

house1 setVariable ['bis_disabled_Door_1',1,true]
warm venture
#

No

winter rose
#

@warm venture are such enterable buildings Vanilla?

warm venture
#

Setting the door states to closed

#

vanilla buildings added in editor yes.

#

military offices

high marsh
#

"setting them to closed" I am assuming this is in eden yes?

warm venture
#

Setting them to locked in eden

#

not closed

winter rose
#

I suppose closed & locked

#

you can report this kind of issues on the feedback tracker

#

with the list of concerned classnames

warm venture
#

so is there a reason why this wouldnt be working

warm hedge
#

Nobody knows what l*fe_fnc_say3D so we can say nothing

winter rose
#

maybe because RANY or RCLIENT are server-side variables only, IDK

warm venture
#

is life a swear word or something

robust hollow
#

yes

warm venture
#

you keep starring out the i

robust hollow
#

read my message from before, there arent too many things that can go wrong with that

warm venture
#

... maybe cause i didnt have #include "..\..\script_macros.hpp" in the file where rclient is defined.

robust hollow
#

which i indirectly mentioned before ๐Ÿ˜ฆ

warm venture
#

I fixed it in that file

#

but not this one

#

assumed it was already in there but i guess not

winter rose
#

bad game, bad

robust hollow
#

what doors wernt locking on the military office? they are all locked for me.

warm venture
#

None of them locked. They were locked in editor but could just scroll and open them ingame

winter rose
#

try the game without mods, then come back ๐Ÿ™„
a locked door cannot be opened in-game (without scripting)

warm venture
#

No mods

#

no client side mods*

winter rose
#

ยฏ_(ใƒ„)_/ยฏ

ebon citrus
#

@warm venture are any server side scripts running that could unlock the doors?

#

Or amything on the client that could be responcible for it?

#

Because if it works in the editor scenario, but stops working on your l*fe server, then wouldnt that mean that something in the scenario/server is disabling the lock on those doors, no?

#

Yet another reason why you should ask altis l*fe related questions on their special server

#

There's maybe someone there who knows about the quirks of the framework

high marsh
#

I can't help but laugh every time I see l*fe

warm venture
#

yeah would be pretty crazy

#

if only they would respond

ebon citrus
#

Idk, make your own framework with cardgames and professionals, then

high marsh
#

*blackjack and ladies of the night

ebon citrus
#

Bad word

warm venture
#

uh oh

winter rose
#

let's say it's in the very grey area @high marsh

warm venture
#

whats the best ide for sqf coding/linting

#

cause im getting an error in atom sqf linter

C:\Users\jflee\.atom\packages\linter\lib\linter-registry.js:154 [Linter] Error running SQFlint Error: '~' is not recognized as an internal or external command,
operable program or batch file.
    at ChildProcess.<anonymous> (C:\Users\jflee\.atom\packages\linter-sqf\node_modules\sb-exec\lib\index.js:56:20)
    at ChildProcess.emit (events.js:194:13)
    at maybeClose (internal/child_process.js:998:16)
    at Socket.<anonymous> (internal/child_process.js:403:11)
    at Socket.emit (events.js:194:13)
    at Pipe.<anonymous> (net.js:593:12)
winter rose
#

VSCode is nice

high marsh
#

atom also has highlighting

winter rose
warm venture
#

yeah but I cant get the linting to work in atom @high marsh

#

every time I save it I get that error

brave jungle
#

Atom is broken right now haha

#

multi cursor is broken too

#

I went back to 1.47

high marsh
#

ยฏ_(ใƒ„)_/ยฏ

cold pebble
#

sublime text ^_^

high marsh
#

^ good too

#

pref really

warm venture
#

so if I have a "while" loop, is the code stuck in there until its exited?

#

because I want to change the variable thae is being checked by the while after a certain amount of time.

winter rose
#

the variable is checked every loop

#

but the loop won't exit mid-code if the variable changes

exotic flax
#

the while loop runs till it fails ๐Ÿค”

while {
   // as long as this returns TRUE
   a < b
} do {
   // execute the following code
   a = a + 1
};
warm venture
#

so for instance

#
while{_pd getVariable["jailbreak", false]} do {
  if(!(_pd getVariable["jailbreak"])) exitWith{};
    [_speaker1, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
    [_speaker2, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
    uisleep 5.2;
};
#

I want this to run, but I want to change "jailbreak" to false after 5 minutes or 120seconds

winter rose
#
_pd getVariable["jailbreak"] // is incorrect
#

and re-checking inside makes no sense

warm venture
#

It works fine for me

#

that parts true.

winter rose
#

Syntax: varspace getVariable [name, defaultValue]

and defaultValue is not optional.

warm venture
#

varspace getVariable name

winter rose
#

name: String

warm venture
#

Anything or Nothing if the variable doesn't exist

#

it works for what im trying to do so im keeping it

winter rose
#

๐Ÿคฆโ€โ™‚๏ธ

warm venture
#

if it aint broke dont fix it.

winter rose
#

it is broken

#

but sure, keep wrong code

warm venture
#

then why does it work as intended?

exotic flax
#

it's broken because it obviously doesn't work ๐Ÿค”

warm venture
#

yes it does? @exotic flax

still forum
#

Dude. You come here to get help, get told what you did wrong, and now state "I don't want any help"

warm venture
#

it works just fine.

still forum
#

Either you ask for help and accept it, or leave.

#

Your code is wrong.

#

And the if/exitWith is useless.

warm venture
#

yep already removed that

#

lol

#

if (player getVariable "restrained") exitWith {hint localize "STR_NOTF_isrestrained";}; this is part of L*fE and works fine. Its literally how all of the variables are checked in this framework.

still forum
#

...

#

Yes because that code is correct

#

and its different than yours

#

Yours is wrong and useless.
That snippet you posted is neither (might be useless, but can't say without context)

warm venture
#

if (!(_unit getVariable ["Escorting",false])) exitWith {}; //He's not being Escorted.

#

ok

#

so this whole time yall were talking about the part I didnt have questions about

still forum
#

well your question was already answered

exotic flax
#
  1. exitWith does NOT work within a while/do loop
  2. getVariable either needs a string (name of var) or array (name of var AND default)
warm venture
#

thank you. @exotic flax

still forum
#

but if we let you have your mistakes, you'll someday come back with the issues caused by that and waste more time

exotic flax
#

already told you that before though...

warm venture
#

then what would be ideal way of exiting the while after 5 minutes

exotic flax
#

since your while checks for "jailbreak", simply set it to TRUE

#

after 5min that is

warm venture
#

in a different script..

#

because it wont work in this one

#

because its stuck in the while until its not true anymore.

#

right?

exotic flax
#

yup

#

at least... sort of

warm venture
#

just seems like a lot of work

winter rose
#

you can add another boolean flag

like ```sqf
mustCheck = true;
while { mustCheck && { stuff getVariable ["stuff", false] } } do {

};

// and somewhere else
mustCheck = false;

exotic flax
#

if it was easy everyone could do it ๐Ÿคฃ

warm venture
#

learned that after 5 yrs of java

#

#kms

winter rose
#

exitWith does NOT work within a while/do loop

oh ._.

warm venture
#

?

high marsh
#

wont exit within while {true} do { } loop

warm venture
#

yeah we already crossed that line about 10m ago

ebon citrus
#

sqf is easy, especially due to the ammount of documentation and support โค๏ธ

#

Not without its quirks, though

high marsh
#
_blah = 0 spawn {
  while{blahblah} do {
    
  };
};
terminate _blah;

maybe?

ebon citrus
#

This is only my personal opinion, but you usually want to avoid having a ton of while-loops

warm venture
#

its..probably fact

ebon citrus
#

In my entire inventory code, there is not a single while-loop. I just despise them having worked in an unthreaded environment once

high marsh
#

how do you handle changes in inventory then? Handlers?

ebon citrus
#

Sqf, though, is "threaded"

#

The scheduler will run each task at it's time

#

But this doesnt mean that you should fill the scheduler with while-checks

warm venture
#

would be so much more convenient having everything in one file..

ebon citrus
#

Handlers and actions @high marsh

#

Handlers are mostly for selecting elements, actions are responsible for updates

high marsh
#

I'm not sure exactly how handlers work with SQF and their engine functions. But I'm sure it's still running waiting to catch

carmine sand
#

@ebon citrus whats the best way to safe server perfomance in scripts? Like you do?

ebon citrus
#

Less is more

exotic flax
#

would be so much more convenient having everything in one file..
That is just bad programming...

warm venture
#

@high marsh so [] spawn { instead of while

#

?

high marsh
#

No

ebon citrus
#

@high marsh probably engine-side instead of scheduler

#

Atleast i hope so

#

Handlers could also be implemented in a trigger-style

still forum
#

But I'm sure it's still running waiting to catch
no

high marsh
#

how then

ebon citrus
#

As in, an action happens and all registered handlers get called

still forum
#

event happens, eventhandler gets executed

warm venture
#

since spawn is run async it seems and while is sync

still forum
#

and while is sync
no

#

while is a loop, spawn is not

#

they are completely different things

ebon citrus
#

Spawn creates a task in the scheduler

#

The scheduler will run that task once it gets to it

warm venture
#

so im basically stuck doing [] remoteExec["l*fe_fnc_pdJailbreakTimer"];

ebon citrus
#

From my experience, a while loop will be run once inside the scheduler each time the scheduler returns to the task, as long as the condition is true

#

That's...

#

Seems excessive

warm venture
#

exactly my point

#

would be so much more convenient having everything in one file..
@warm venture

ebon citrus
#

What is fn_pdJailbreakTimer.sqf?

warm venture
#

the new file I have to make to cancel the while.

ebon citrus
#

No...

warm venture
#

thats..what yall said

ebon citrus
#

You dont need to make a whole new function to set one variable ๐Ÿ˜…

warm venture
#

would sure hope not.

#

but I dont see any other way.

exotic flax
#

depends on the context, and how often you need that function ๐Ÿค”

ebon citrus
#

It looks like not often

warm venture
#
private _pd = missionNamespace getVariable "kavpd";
_speaker1 = missionNamespace getVariable "pdSpeaker";
_speaker2 = missionNamespace getVariable "pdSpeaker2";

_pd setVariable["jailbreak", true];

while{_pd getVariable["jailbreak", false]} do {
    [_speaker1, "siren", 250, 1] remoteExecCall ["l*fe_fnc_say3D", RCLIENT];
    [_speaker2, "siren", 250, 1] remoteExecCall ["l*fe_fnc_say3D", RCLIENT];

    uisleep 5.4;
};
#

Need it to exit the while after 5 minutes, then not let it run again for 20 minutes

ebon citrus
#

Logic

#

Im having a hard time getting in my head this whole thing

#

So you want an addition to your script that involves breaking out of a jail?

warm venture
#

This is all it needs to really do... it plays the sound file every 5.4 seconds until the variable is no longer true

#

then it locks the doors

#

or needs to

#
while{_pd getVariable["jailbreak", false]} do {
    [_speaker1, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];
    [_speaker2, "siren", 250, 1] remoteExecCall ["life_fnc_say3D", RCLIENT];

    uisleep 5.4;
};

uisleep 120;
// lock doors
#

thats what it really needs to do

#

but it doesnt work that way

exotic flax
#

I hope you are aware that this is a discussion/support channel, not a "please write my code" channel...
Because I really got the feeling we're writing the next L*fe framework, without getting paid for it ๐Ÿค”

warm venture
#

lol..

#

i guess its really that difficult to answer a simple question

#

dont want to help - dont

ebon citrus
#

dont be toxic...

exotic flax
#

if it was easy everyone could do it ๐Ÿคฃ
@exotic flax

ebon citrus
#

people are here to help

warm venture
#

ME being toxic?

#

im trying to get help

ebon citrus
#

not to write your code for you

warm venture
#

and get nothing but sarcasm

ebon citrus
#

i do not insinuate that you ARE, i am saying dont go there

warm venture
#

from ppl with complexes

ebon citrus
#

the problem is that you dont really know what you want and what you have

warm venture
#

I know exactly what I want

ebon citrus
#

there is a lot of context involved in Tonic's stuff that needs to be known/explained

#

or you need to take your script OUT of that context to make it understandable

still forum
#

_pd spawn {sleep 60*5; _this setVariable["jailbreak", false]}

warm venture
#

so cause spawn is running on _pd, it makes _this reference _pd instead of the file itself

ebon citrus
#

_this is the arguments passed to spawn

#

in this context _this is equal to _pd

warm venture
#

Yea

ebon citrus
#

here's also an example of using params which is useful when you are calling/spawnning/executing something with multiple arguments. Take a look at example 1 on how it works in practise:
https://community.bistudio.com/wiki/params

#

just a side note

warm venture
#

yeah im using params in some of my other stuff

#

thx tho

ebon citrus
#

great

still forum
#

format["%1"] thats invalid

warm venture
#

oh boy.

#

forget i posted that

still forum
#

Reminds me of ACE slack

warm venture
#

private _building = missionNamespace getVariable _buildingName; there.

still forum
#

or rather r/armadev reddit.
with gems like

if (!alive OpforFlgCarrier) then
{
    (_ui displayCtrl 1007) ctrlSettext format ["Dropped"];
}else
    {
        (_ui displayCtrl 1007) ctrlSettext format ["%1",name OpforFlgCarrier];
    };

or

publicVariable "timelimit","ctfscorelimit","CaptureScore","CTFicons","Icon_Distance";
warm venture
#

if its wrong why does it work then

#

serious question im wondering

#

thats why i never changed it since last year when I made it. It worked

still forum
#

it doesn't work ยฏ_(ใƒ„)_/ยฏ

warm venture
#

so im hallucinating the doors on my building opening/closing

still forum
#

the format ["%1"] you posted is invalid, it doesn't work

#

but what you posted will fall back to default value, maybe thats what makes it work

#

just one part of your code being wrong and not doing anything, doesn't mean that the rest is also broken

#

your code can be 99% broken, but still have two lines of code that work

#

Doesn't mean that its "not wrong"

warm venture
#

so is the new one better

still forum
#

well that one line of code doesn't have errors

#

no visible errors

winter rose
#

please code with "Show Script Errors" flag in the launcher, too

exotic flax
#

please code with "Show Script Errors" flag in the launcher, too
Perhaps add that to "Introduction_to_Arma_Scripting" on the wiki in a large blinking box at the top of the page ๐Ÿค”

ebon citrus
#

server errors show up in rpt

exotic flax
#

client errors also show up in rpt, but 99% of the time the client will also freak out

ebon citrus
#

yeah, i've rarely had cases where the client wont start throwing gang-signs and black boxes at me

exotic flax
#

and seeing an error directly on screen makes more sense than trying to explain someone to check log files (which they sometimes also disable)

ebon citrus
#

and the error message also tells you exaclty WHEN the error occured

#

so that gives a hint

#

you can connect your actions to the error easily

winter rose
#

I also know that

An error in SQF will purely and simply halt the current script
is not true

still forum
#

not for all errors, for some probably

winter rose
#

for example, an undeclared variable will throw an error but not stop the script
I am bringing the topic in #community_wiki to fix this note, for those who are interested

modern adder
#

I've noticed that I cannot choose my custom interaction menu options when in a vehicle, but I can when on the ground.

#

I've defined them within config.cpp, like so

class CfgVehicles 
{
    class Man;
    class CAManBase: Man 
    {
        class ACE_SelfActions 
        {
            class skipSong
            {
                displayName = "Skip song";
                condition = "((leader (group player) == player) or !isMultiplayer) and (!(group player getVariable ['XIM_bMusicStopped', false]))";
                exceptions[] = {};
                statement = "[player] call XIM_fncPlayNext";
            };
            class stopMusic
            {
                displayName = "Stop music";
                condition = "((leader (group player) == player) or !isMultiplayer) and (!(group player getVariable ['XIM_bMusicStopped', false]))";
                exceptions[] = {};
                statement = "[] call XIM_fncStopMusic";
            };
            class startMusic
            {
                displayName = "Start music";
                condition = "((leader (group player) == player) or !isMultiplayer) and (group player getVariable ['XIM_bMusicStopped', false])";
                exceptions[] = {};
                statement = "[] call XIM_fncStartMusic";
            };
        };
    };
};
#

This is using ACE's interaction menu framework

winter rose
#

```cpp if you want ๐Ÿ˜‰

modern adder
#

cheers

warm venture
#

whats the difference between setVariable ["bis_disabled_Door_1", 1, true]; and setVariable ["locked", true, true];

robust hollow
#

the first hides the action, the second is a life var i think

ebon citrus
#

does onPlayerKilled.sqf execute globally, locally to where the player is local or on server?

warm venture
#

locally

ebon citrus
#

which locally?

#

locally where the player is local or on server?

warm venture
#

actually

slender schooner
#

is there any way to make a variable on a player accessible from other players when it is set via myVar = "value";

ebon citrus
#

setVariable

#

and make it public

slender schooner
#

i know setVariable, but the problem is, that the value cannot be changed wtih the simple way anymore (myVar = "new Value";)

#

thats why i m asking

ebon citrus
#

it can be changed with setvariable

#

i dont see the issue

warm venture
#
player addEventHandler ["Killed", {_this call life_fnc_onPlayerKilled}];
ebon citrus
#

and yes, you can make public variables

warm venture
#

it adds the eventhandler to the player

#

so i think its local to the player on player side..

winter rose
#

@slender schooner publicVariable if you want

slender schooner
#

the problem i m facing is, that i want to be able to access a players hunger and thirst in Life, and all the code used to change it is written with the simple form

ebon citrus
#

Lou, can you say is onPlayerKilled.sqf is local to server or player or global?

winter rose
#

local to the killed unit iirc

ebon citrus
#

hunger and thirst should all be a local variable on server

#

if you make those variables public, you might face a lot of network congestion

#

depending on how often you update them

warm venture
#

w0w i was right about something

#

gotta take note of this it wont happen again

ebon citrus
#

that's the thing, Lou

#

can we add locality of scripts to the event scripts page?

winter rose
#

@warm venture the more you learn, the more you are prone toโ€ฆ "not be wrong" ^^

ebon citrus
#

ask questions and learn, yeah

slender schooner
#

yea, i figured that out also, guess i ll try to make a callback function that gives the asking admin the needed info hmmm

ebon citrus
#

always best

#

public variables are something that gets fired at players whenever they update(?)

#

and it also means that anyone can edit those values

slender schooner
#

publicVariable needs reinitialisation on each change

#

and i suspect that they then overwrite EVERY players hunger/thirst

ebon citrus
#

i honestly dont know

#

i never used them

#

i never had to

slender schooner
#

so its a hivemind hunger/thirst system

#

would be funny tho, you drink, everyones thirst goes up

ebon citrus
#

youre always best off using the player-objects namespace for that kind of stuff on server

#

and update it to client when necessary

slender schooner
#

yea

ebon citrus
#

like if you have a food-meter, update the position of that meter/animation when it crosses a threshold

#

no need to update it constantly

slender schooner
#

ofcourse

ebon citrus
#

server will keep track of when it needs to be updated

winter rose
#

can we add locality of scripts to the event scripts page?
@ebon citrus sure thing! I thought about that last month. all we need isโ€ฆ data ๐Ÿ™‚

ebon citrus
#

yeah, i guessed so much

#

i can try to start documenting them when i get back from lapland

slender schooner
#

i think life checks constantly every second if you crossed a certain threshold and then if you do, updates the values

ebon citrus
#

wasteful

slender schooner
#

as i said, i think

ebon citrus
#

๐Ÿคทโ€โ™‚๏ธ

#

i dont do l*fe

slender schooner
#

uiSleep 1;
is, basically a 1 second sleep, no?

#

but with the difference that it also work when you dont focus on the game, no?

ebon citrus
#

@winter rose initPlayerServer.sqf is executed server side and requires remote execution. Is there an alternative to detect a player-login, or will i just have to write my own script to detect player-spawn. Basically i want to add an EH on server-side to the player when they are loaded (controlling a unit)

#

so is there an alternative/workaround to initPlayerServer.sqf that doesnt involve remoteExec?

ebon citrus
#

perfect

winter rose
#

stahp ninja'ing meeeh ๐Ÿ˜„

ebon citrus
#

just what i was looking for

slender schooner
#

that moment when you want to click the link, and someone sends a message, so you instead click the emote

exotic flax
#

you may click the emote as well if you'd like ๐Ÿ˜‰

winter rose
#

@ebon citrus note that you won't have the player unit, since it's on connection

ebon citrus
#

solves the problem

#

i'll jsut spawn a task that waitsUntil that is a unit

winter rose
#

yep (or the player disconnects)

ebon citrus
#

yeah, that one aswell

#

need to garbage-collect

#

almost forgot about that one and wouldve had a memory-leak

winter rose
#

a tiny rare one, but unfortunately one nonetheless

ebon citrus
#

i did my garbage collection btw on the groundweaponholders

#

easier than assumed

exotic flax
#

although wouldn't an EH attached to a player be required to be on the client?

still forum
#

@modern adder I think in a vehicle, you get the vehicles self actions instead of the Man's.

ebon citrus
#

might need some edge-case logic still, but the main stuff is easy

#

then jsut check if the locality is server

#

MPKilled, if it works, does just what i need it to

#

MPHit is also great, as i can manage health server-side

#

fill me in with objections, please

#

but MPKilled is what im eyeballing for now

#

btw, what's up with not being able to open backpacks of dead units?

#

i know it can be done through the default arma 3 inventory

#

but as it stands, i need to add that option to each killed unit with a backpack as an action

#

and when/if the backpack is removed, remove the action on all clients

#

pain...

exotic flax
#

it's because the unit itself doesn't have any inventory when dead, however there is a placeholder item placed "under" the body which gets accessed

winter rose
#

really? ๐Ÿค” I thought bodies became "crates"

ebon citrus
#

im sure they do

#

because they have primary weapons etc.

#

you cant set a primary weapon for a vehicle*

#

can you?

#

idk, but the item blops in their hands nicely

#

same with backpacks

exotic flax
#

in Zeus I always see the dead body and a placeholder "crate" which has an inventory (could be primary weapon only though, although I always thought its the full inventory)

ebon citrus
#

and i need to handle the unit as a unit and not as vehicle inventory

#

it's primary

#

it gets dropped into a simulated weapon holder

#

you can pick up the weapon and add it back to the unit's inventory aswell

#

if you set it as the unit's primary, it will float in the air if the unit is ragdolled

exotic flax
#

although using getLoadout on a dead unit still works ๐Ÿค”

ebon citrus
#

sure does

#

im using it

#

and im lovin' it

exotic flax
#

I hate that function ๐Ÿคฃ

ebon citrus
#

it's a mess of arrays

#

but meh

#

it works

modern adder
#

Hmm, ok. How would I add the interaction to the vehicle as well then?

high marsh
#

I mean since it's always in the same order you can nit pick what you want

still forum
#

also add self interact for car

#

or maybe there's something wrong with your condition?

ebon citrus
#

@high marsh which is an amazing feature of getLoadout

#

but some of the nesting is weird

#

and i wish sqf had hashmaps/dictionaries

exotic flax
#

@modern adder do the options show up, but can't execute them, or do they simply don't show up?

high marsh
#

the nested ones being mag lists?

exotic flax
ebon citrus
#

I have a function to handle the array for me

#

๐Ÿค“

winter rose
#

How dare you

ebon citrus
#

Tough l*fe

#

๐Ÿ˜Ž

exotic flax
#

I have macro's to quickly generate full loadouts ๐Ÿ˜›

modern adder
#

Don't show at all

#

How do I add a self interact for the car too? What would it look like in a config.cpp?

exotic flax
#

Self (Type 1 / ACE_SelfActions) Something the user would do to themselves or to their vehicle (eg. Put in ear plugs / Check mounted Static Weaponโ€™s ammo)

#

although you might want to check the documentation regarding the condition and statement; since player might not be available

#

The simplest action is just a condition and statement. The code to these are passed [_target, _player, _actionParams]. _player is ace_player; _target is the object being interacted with; and the 3rd argument is the optional action parameters (default []).

modern adder
#

Oh, so it's possible in the vehicle player isn't available and that's why it isn't working?

exotic flax
#

I believe the condition is triggered by the vehicle, and therefor there's no local player

modern adder
#

I see

#

That would make a lot of sense

slender schooner
#

if i now want to execute a function on a player and receive a callback, how would i do that?

exotic flax
#

however using _player is should return "you" as a player

modern adder
#

Alright, cheers

#
_return = [] call fncYourFunction;```
slender schooner
#

i mean, yea, thats the way you do it locally, but i want to do it remotely

modern adder
#

Of course, the function must actually return a value, else _return will just be code

#

Oh, I don't think you can

slender schooner
#
responseFnc = {
    name player;
};
modern adder
#

But our solution to that was to use publicvariableserver

slender schooner
#

like this, i want to execute this on a player, and get his name

modern adder
#

You send the variable via publicvariable server, then set up a public variable event handler

#

Event handler will recieve the broadcasted variable

exotic flax
#

remoteExec ๐Ÿค”

modern adder
#

I don't think remoteExec can return a value

slender schooner
#

does remoteExec give back a value to the one executing the remoteexec?

still forum
#

public variable also can't

#

does remoteExec give back a value to the one executing the remoteexec?
if you think about it, thats not possible

slender schooner
#

i tried that, but it didnt want to give me the name

modern adder
#

Of course public variable can

still forum
#

you can remoteExec the value back

modern adder
#

That's the very purpose of it

#

To send a variable

still forum
#

Of course public variable can
no it can't.

#

publicVariable is one way, just as remoteExec

#

you can do a one-way message back to original sender. With remoteExec or a PVEH

exotic flax
#

you could put something in missionNamespace (request), catch that on server, do something, put result in missionNamespace (response), catch that on client

slender schooner
still forum
#

remoteExec has remoteExecutedOwner

#

which has the clientID of the sender, so you can directly reply back to them

modern adder
#

Or send it directly to the server in case there are multiple clients also doing the same thing

exotic flax
#

Arma-IPC is born ๐Ÿคฃ

modern adder
#

via publicvariableserver

slender schooner
#

my brain is just like spleens_imgonnakillyourfamily right now

#

so, the remoteExec gives the remote player the id of the one who sent the remoteExec to them, right?

still forum
#

Or send it directly to the server in case there are multiple clients also doing the same thing
yes
via publicvariableserver
no. With what you said above multiple clients would overwrite eachothers variables.

#

but remoteExec would be completely safe

#

and remoteExec was built to replace that, so just use it.

modern adder
#

Shouldn't do

#

Not with an event handler

#

Won't they all run in seperate threads?

still forum
#

Won't they all run in seperate threads?
There is only one thread

slender schooner
#

at this point, remote exec would be my safest bet, as i tried so many things before

modern adder
#

Sorry, I meant different scopes

slender schooner
#

the public variable is one variable that is set on the server and broadcasted to every player

#

so, editing it, edits it for every player, ofcourse only as soon as it is broadcasted again via publicVariable

still forum
#

Here this is what I use

{
    str [name player, diag_fps] remoteExec ["systemChat", remoteExecutedOwner];
} remoteExec ["call", otherPlayerName];
#

send request to a player, and he replies back by systemChat'ing the reply to my chat

#

and broadcasted to every player
you can use publicVariableClient, but for that you need to know which client it came from

modern adder
#

Which you can have the client send

still forum
#

but why, if remoteExec has it integrated

slender schooner
#

okay, so, trying to understand this code:
on line 2 it calls the function remoteExec which calls systemchat on the person that called it on the remote player with the parameters "name player" and "diag_fps"

still forum
#

with the parameters "name player" and "diag_fps"
no

slender schooner
#

systemchat in this case is a function that accepts those two parameters, right?

still forum
#

with the parameter "[playername, 2312]"

#

systemchat in this case is a function that accepts those two parameters, right?
no systemChat accepts one parameter, a string

slender schooner
#

with the parameter "[playername, 2312]"
yea, thats what i meant

#

oh, i see

#

and what is that diag_fps for then?

still forum
#

grabs the fps

#

the above script will log the target players fps, in MY chat

slender schooner
#

but isnt that useless then if systemchat only accepts one parameter?

still forum
#

what?

#

no?

#

the parameter is a single string

#

with the parameter "[playername, 2312]"

slender schooner
#

no wait, i think i missunderstand a bit the code there

ebon citrus
#

str [name player, diag_fps]

#

see str

slender schooner
#

so the str in front makes it a concatenated string

ebon citrus
#

it converts the array to a string

slender schooner
#

i see

still forum
#

without the concatenated

slender schooner
#

now it makes sense

#

this is gonna be hell to be programmed into my admintool

ebon citrus
#

not at all

slender schooner
#

but, now i finally have a way to do it

ebon citrus
#

remoteExec is rather simple as soon as you can get your head around it

slender schooner
#

well, i need to write a function for the displaying the info in it that it gets

ebon citrus
#

it's the BE filters and CfgRemoteExec that's nice

slender schooner
#

yea

ebon citrus
#

you familiar with controls and dialogs?

slender schooner
#

i hope that i can remoteExec my functions in Life just like that, without having to open an exploitable point

#

yea, a bit

ebon citrus
#

yeah, no

#

no way

slender schooner
#

gonna have to look closer into the remoteExec and CfgRemoteExec

ebon citrus
#

it's a lot of work to make your code unexploitable with remoteExec

#

that's why you avoid it as much as possible

slender schooner
#

yea

ebon citrus
#

well, I avoid it

slender schooner
#

tbf, i dont really care a lot about hackers

ebon citrus
#

up to you

slender schooner
#

if i spot one, i ban him

ebon citrus
#

then i suggest whitelisting your server

slender schooner
#

nah

ebon citrus
#

you wont keep a dedicated scripter/hacker out by banning them

slender schooner
#

i mean, if you look around a bit, and with the use of my now being created admintool, i ll see if someone cheats in no time

ebon citrus
#

or... you dont

#

i dont mean to discredit you

#

but youre talking about people who somehow dedicate their time to being essentially a bully

#

some of thema re very good at it

slender schooner
#

if someone really has so much boredom to cheat on our server, then meh

#

i know

ebon citrus
#

but that's enough of those people

slender schooner
#

but most of them are just some children that bought a 500โ‚ฌ script from some shady site, and cry when you ban them

ebon citrus
#

๐Ÿคทโ€โ™‚๏ธ

slender schooner
#

anyways, thanks for the help

#

i love the arma community for this

exotic flax
#

back to running bought scripts on random servers ๐Ÿ˜ˆ

slender schooner
#

oof

winter rose
#

(there is BIS_fnc_getServerVariable too)

slender schooner
#

thats also maybe a solution, but i would need something that basically instantly gives me the answer back

#

and cant be overwritten by another admin doing the same thing at the same time with another player

#

but i ll keep that in mind if i ever need it

still forum
#

and cant be overwritten by another admin doing the same thing at the same time with another player
remoteExec :3

#

TFAR uses the remoteExec scheme above to get unique ID's for players radios

exotic tinsel
#

is there a full proof way to prevent player and ai callouts in group chat? if so can some one point me to some info.

surreal peak
#

@exotic tinsel

slender schooner
#

@still forum thank you a thousand times, i now am able to get variables from other players

#

finally

dusky pier
#

is possible to somehow optimize mission.sqm (playeable units)?

warm hedge
#

Optimize at what?

dusky pier
#

when i disable simulation on them - fps 60.
When enable - 30

exotic tinsel
#

unfortunately it doesn't seem to be working. I have this in the initPlayerLocal.sqf in a desperate attempt to turn them off. I also have in the server profile autoReport = 0; They still to happen from time to time. its odd.

player disableAI "AUTOTARGET";
0 fadeRadio 0;
enableRadio false;
enableSentences false; 
surreal peak
#

dont spawn ai in until they are needed is one optimisation

dusky pier
#

is possible to somehow enable simulation when player loaded?

warm hedge
#

In Multiplayer?

dusky pier
surreal peak
warm hedge
#

You meaning I'm true?

dusky pier
#

@surreal peak i tryed this, but don't changed anything

surreal peak
#

did u give my first link a read?

dusky pier
#

reading ๐Ÿ™‚

tough abyss
#

hi

winter rose
#

how do i make the ai stay in different positions if they are in the same squad

to keep units at their spot, you can use

{ doStop _x } forEach units _myGroup;
tough abyss
#

where do i enter that

winter rose
#

that, or "simply" doStop this in their init field, only if this is not an MP mission

tough abyss
#

where do i enter that though?

carmine sand
#

@tough abyss doubleclick to the soldier, and write in the Init line

doStop this

As Lou Montana told, if its not a MultiPlayer Mission

tough abyss
#

its a scenario mission

winter rose
#

never to be multiplayer?

tough abyss
#

do i have to play mp?

winter rose
#

I ask because using init fields is not a good thing for MP

tough abyss
#

Ok

winter rose
#

if it is and only will be a single player mission, use the init field

flat elbow
#

is there a command that i can use in script to know how much is the server under "load"?

winter rose
#

maybe diag_fps

flat elbow
#

doesn't it only print the FPS of the game? i think the server does not have any fps in it?

#

i mean it doesn't have anything but a console

exotic flax
#

#monitor ?

winter rose
#

^

flat elbow
#

you can use that in scripts?

still forum
#

server has fps

winter rose
still forum
#

monitor won't let the script know how the fps are

#

monitor only prints to chat

flat elbow
#

basically my idea is to know how much the server and each client is under "pressure" so on big PvE maps i can hand-off the AI elaboration to the clients and free up the server

still forum
#

more pressure -> lower fps

exotic flax
flat elbow
#

is there also a way that you know of, to know the "connection quality" of the clients? I think if the client have high ping it would make the whole server desync right?

still forum
#

I think if the client have high ping it would make the whole server desync right?
no think_turtle

#

there is a server.cfg entry to auto kick on bad ping

ebon citrus
#

Howdy

tame portal
#

๐Ÿค 

ebon citrus
#

@flat elbow take a look at headless clients

slender schooner
#

okay, i m back with another issue

#

i m feeling more and more like I AM the issue

#

When i try to execute

{  
    str [life_hunger] remoteExec ["systemChat", remoteExecutedOwner];  
} remoteExec ["call", civ_1]; 

the RPT log shows me this error
2020/06/18, 16:54:26 Scripting command 'call' is not allowed to be remotely executed

#

the thing is, i actually allow everyone to use call in the cfgRemoteExec.hpp
F(call,ANYONE)

#

am i doing something wrong here?

winter rose
#

so many to list!

#
[str life_hunger] remoteExec ["systemChat", civ_1]; // why not that?
slender schooner
#

this shows your life_hunger to the other player

#

the code itself works, but there is something that says that i m not allowed to use call remotely

winter rose
#

it seems a conf issue yes

still forum
#

yeah something bad with CfgRemoteExec

#

maybe "BIS_fnc_call" works

#

instead of "call"

exotic flax
#
class CfgRemoteExec {
   class Commands {
      mode = 2; // set to 1 to whitelist only
      class call { allowedTargets = 0; }
   };
   class Functions {
      mode = 2; // set to 1 to whitelist only
      class BIS_fnc_call { allowedTargets = 0; }
   }
};

This should allow both

slender schooner
#

you know what

#

i effing hate myself now

#

not even morphine can help me anymore

#

the problem is, that i put the call allowing into the functions part

#

stupid question now, if i use command that isnt whitelisted in the remoteexec, but i whitelist the function, will it still work?

#

like, i use the "call" in a function that is actually allowed

#

will it work or not?

still forum
#

, if i use command that isnt whitelisted in the remoteexec, but i whitelist the function, will it still work?
if you remoteExec the function yes

winter rose
#

Thanks, @still forum & @exotic flax, I had a genuine good laugh ๐Ÿ˜‚

exotic flax
#

emote spam, but in a supportive way ๐Ÿ˜‰

slender schooner
#

so, if it whitelist this function without whitelisting the "call"

function1 = {
    { 
        str [life_hunger] remoteExec ["systemChat", remoteExecutedOwner]; 
    } remoteExec ["call", test1]; 
};

this should work?

exotic flax
#

no, you need to whitelist the functions/commands you want to remoteExec

slender schooner
#

~~very supportive SadOkayCat ~~

exotic flax
#

so in that example systemChat and call

slender schooner
#

i see

still forum
#

you are still remoteExec'ing "call" which is blocked
you can remoteExec "function1" tho

#

but function1 needs to exist on the target

slender schooner
#

i see i see

#

good to know

#

so i basically have to open a security hole on that point

still forum
#

if you make your own script function, and whitelist that, no

slender schooner
#

guess i ll find a workaround to that sometime

#

yea

ebon citrus
#

And embed it in a mod

slender schooner
#

thats what i was thinking about right now

ebon citrus
#

And have a key for that lod

#

Mod*

slender schooner
#

well, euh......

still forum
#

or put in mission file ยฏ_(ใƒ„)_/ยฏ

ebon citrus
#

Own function -> in a mod -> signed

slender schooner
#

i think thats a bit too high for me tbh

ebon citrus
#

Is pretty much the safest

slender schooner
#

its a bit overkill tho

ebon citrus
#

Mission-file security is dubious

#

You'll have to mess around with BE filters then

slender schooner
#

yea

ebon citrus
#

Be filters are always good to have for open missions

#

But tedious to configure

slender schooner
#

i know

#

i looked briefly over it and was amazed at how much stuff you can do, but taken aback by how much stuff you can do

ebon citrus
#

Yeah

#

It's good ro focus on them once your mission is done

slender schooner
#

yea

ebon citrus
#

And if security is actually a concern

#

If youre whitelisted etc. It might not be worth it

#

If you trust your players

slender schooner
#

the server will be open later

#

no whitelist

ebon citrus
#

What are you even making?

slender schooner
#

we dont have a playerbase yet, so that would be rather useless

#

tanoa life

#

mostly to train myself in scripting

#

but also for the fun at working on it

ebon citrus
#

๐Ÿ˜‘

#

Not the best place to start

slender schooner
#

i know, its quite badly written, but i just like the gamemode a lot

ebon citrus
#

Not that

#

I mean youre taking in a lot at once, things you dont yet understand and you have to know and youll just learn bad practises

slender schooner
#

i know i know

rancid basalt
#

Start with Hello World, lol.

ebon citrus
#

Ehhh

#

Yeah

#

Start with basic stuff

slender schooner
#

i NEVER EVER made a hello world script

ebon citrus
#

Singleplayer missions

slender schooner
#

like, never

ebon citrus
#

Then addons

#

Then multiplayer stuff

exotic flax
#
hint format["%1 %2", "Hello", "World"];
ebon citrus
#

๐Ÿคฎ

slender schooner
#

i know how hello world scripts work, but i dont want to ever make one

ebon citrus
#

Arrogance

slender schooner
#

nah

ebon citrus
#

Pride is one of the 7 sins, you know

slender schooner
#

i make scripts that show different text than hello world

ebon citrus
#

My favorites are: "yes", "hello" and "ielhbefphnrjdufkkw"

#

Lorem ipsum is also a solid one

slender schooner
#

my favorite is "bruh"

ebon citrus
#

Different generations, i guess

rancid basalt
#

Hello world is usually the first few lines of code you try when first learning a new language. In usual programming, it teaches variables as well as input/output. For Arma, it was just a joke, lol

ebon citrus
#

systemChat > hint

#

Fight me in a way which does not involve flaming ir trolling/toxicity and does not display explicit violence or gore

slender schooner
#

why should i flame you?

ebon citrus
#

I said dont flame

slender schooner
#

i think the same

ebon citrus
#

Anyways, im just used to using systemChat as a debug tool

slender schooner
#

*fight

ebon citrus
#

To know where the code is running

slender schooner
#

i sometimes use systemchat and sometimes hint

#

BUT

ebon citrus
#

Where it's entering

slender schooner
#

i prefer systemchat tho

ebon citrus
#

And peint out some values along the way

#

If the text is too long copyToClipboard does the job

exotic flax
#
if (alive player && (player getVariable "state") isEqualTo "toxic") then {
   player call BIS_fnc_๐Ÿ”จ ;
};
slender schooner
#

IT WORKS

still forum
#

thats syntax error tho

#
if (alive player && (player getVariable "state") isEqualTo "toxic") then {
   player call (missionNamespace getVariable "BIS_fnc_๐Ÿ”จ");
};

you want that

jade abyss
#
if(alive player && (player getVariable "state") isEqualTo "toxic")then
{
   player call (missionNamespace getVariable "BIS_fnc_๐Ÿ”จ");
};```
*fixed
exotic flax
#

programming languages without emoji support is soooo 2001...

flat elbow
#

@ebon citrus yea i can use HC but my idea was to leverage user's computational power and not a HC, that's where my concerns come from

jade abyss
#

๐Ÿค” ( โœ๏ธ @exotic flax ) ๐Ÿ‘‰ ๐Ÿ”จ @exotic flax

slender schooner
#

if (dead) then hammer?

flat elbow
#

it is not 100% clear to me what happens when you handoff the AI to a client, do the server hang waiting for data to be processed by the client? how much bandwidth does it take? would ping spikes make everyone desync? if the client disconnects, what happens to the AI? etc.

still forum
#

do the server hang waiting for data to be processed by the client?
no
how much bandwidth does it take?
some
would ping spikes make everyone desync?
The AI would look like it lags
if the client disconnects, what happens to the AI?
moved back to server
etc.
gub.

exotic flax
#

๐Ÿค” ๐Ÿšซ โœ๏ธ ๐Ÿ‘จ ๐Ÿ‘‰ ๐Ÿ”จ ๐Ÿ‘จ ๐Ÿ‘ˆ ๐Ÿ”จ ๐Ÿต

flat elbow
#

thanks for the insight dedmen, so i guess i should trash the idea of a distrubited AI?

#

without a way to know how well is the connection of the client, i can't prevent the AI from lagging

jade abyss
#

if (dead) then hammer?
@slender schooner ๐Ÿ”จ == banhammer

#

remoteExecCall-Loop meowtrash

still forum
#

so i guess i should trash the idea of a distrubited AI?
huh? no. why? its good

#

i can't prevent the AI from lagging
yeah well... thats rare tho

jade abyss
#

Send a msg to the client, he sends the answer back -> ~Ping ๐Ÿ˜‚

slender schooner
flat elbow
#

my idea was to weight the FPS of every client and then remove the ones that have either a high ping or are desynched or have too narrow bandwidth but for what i understood i don't have a way to know the latter part

#

so if for example one client starts to desync, or his ping increase, i can take the control of the AI back and distribute it to other clients

jade abyss
#

I wasn't fully kidding before, Fluffy

flat elbow
#

mmh yea i can use remotexec to see how long it takes to get the message back, but that would not tell me if someone is desynching or not

jade abyss
#

send remoteExecCall from Server, note time, wait for answer from Client, check timediff.

#

Desync is another topic

carmine sand
#

Desync was in OFP times a big problem tbh ๐Ÿ˜‚

jade abyss
#

Yeps

ebon citrus
#

desync is still a problem

#

whenever server is lagging

flat elbow
#

i see the server desynching even when i play it now lol

jade abyss
#

But, tbf... the internet was worse back then.

ebon citrus
#

โคด๏ธ

winter rose
#

I remember playing with 800ms on 56k ๐Ÿ‘ด

carmine sand
#

Ye you shot him and he was teleporting and you were dead ๐Ÿ˜‚

ebon citrus
#

but these days the spread is bigger

#

i can have 1000/1000 and my friend will have 12mbs

tough abyss
#

Does getDammage work if I am trying to get a unit's ACE damage?

jade abyss
#

Dual ISDN @winter rose - BUT: I had the best ping, just my downloads ๐Ÿฆ† ed hard

tough abyss
#

Or does it only work with vanilla arma?

flat elbow
#

do you remember the cars going straight out of the road and then gets teleported back in another position while you were on the turret?

jade abyss
#

Of course

ebon citrus
#

still a thing

#

desync is not gone

#

you cant make it "gone"

#

it's jsut... better

#

with ebtter internet standards

#

but if the driver is lagging/desynced, the car will go wild

flat elbow
#

now it happens rarely to that level

ebon citrus
#

better internet

#

better servers

#

better pc's

flat elbow
#

better engine

ebon citrus
#

better game-engine

flat elbow
#

i remember my PC on his knees when i used A2OA

exotic flax
#

although; new engine, more stuff to send around, more data used, same problems as before ๐Ÿคฃ

flat elbow
#

and it was the most powerful PC money can buy back then

ebon citrus
#

less data in relation

exotic flax
#

IF all players would have better internet, which isn't the case

plain current
#

If you have a decent spec'd server and don't rape the network with setvar/pubvar/remexec, desync is quite rare even with +150 players

ebon citrus
#

yeah

#

we had an event just on tuesday and it went just fine even on my dev-server

flat elbow
#

well for the ping my idea is to send a remotexec setvar command to the clients that will contain the current tick and the remotexec will set on the player a variable as an array with 1st element the time it received and 2nd element the time it's wrinting the info and then the server will get that info and subtract the two to get an idea about how long it takes for the client

plain current
#

The biggest problem really is mod makers not caring about the network traffic or how many script threads they generate. Many do network calls every time you get in/out of vehicles and spawn a thread for every vehicle. When you have 100s of vehicles your server is gonna start lagging quite quickly. Vanilla servers can handle +100 players easily without HC.

flat elbow
#

i thought the AI was the biggest performance wreck for a server?

ebon citrus
#

send a timestamp to the client from the server

plain current
#

That as well

ebon citrus
#

when you receive the timestamp compare it to current timestamp

plain current
#

You could probably read the ping through rcon or memory

ebon citrus
#

that's your ping

#

well, ping for remoteexec

#

opr the method youre using

exotic flax
#

AI is killing CPU, and therefor server FPS
public variables are killing network traffic

flat elbow
#

i can merge the two things, as if the client is overloaded, the remotexec will take more time too, maybe

#

ie if i spawn it, i can also see how busy the scheduler is

plain current
#

You could try pubVar'ing the serverTime and compare compare the sent time to the arrival time, then you only need to send stuff 1-way instead of 2

flat elbow
#

yes but that would introduce another issue, that i have to send the pubvar to all the players at the same time

#

which i think is a bandwidth spike

plain current
#

You could use publicVariableClient for sending to individual client or publicVariableServer for sending to server, you could also use setVariable or remoteExec, i just used pubVar as an example

ebon citrus
#

what will backpack _object return if _object has no backpack?

#

answer: empty string

#

also

#

i figured out my backpack issue

#

i dont need to delete the action when i can just add this to the condition field ((backpack _originalTarget) !='')

#

and with this, i dont even need to detect when the unit dies: ((backpack _originalTarget) !='') && (!alive _originalTarget)

#

so no need for event handlers or remoteExec

#

here's the whole script to add the "open backpack" action back to a unit. Just call it in the unit's init-field:

params["_unit"];

_classname = backpack _unit;
_backpackName = getText(configFile >> (_classname call Nca_fnc_getConfig) >> _className >> "displayName");

_unit addAction
[
    format ["Open %1",_backpackName],    // title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
        _caller action ["gear", unitBackpack _target];
    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    false,        //hideonuse
    "",            // shortcut
    "((backpack _originalTarget) !='') && (!alive _originalTarget)",     // condition
    2.95,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];```
#

@still forum anything you think could be improved?

still forum
#

nu

ebon citrus
#

nice

#

it's far simpler than what i was expecting

hollow thistle
#

use private _var

ebon citrus
#

does it change anything important?

#

isnt _ basically private?

hollow thistle
#

no, good practice.

ebon citrus
#

never done it if i dont need to init a variable before use in another namespace

hollow thistle
#

isnt _ basically private?
not exaclty, you can still overwrite variables from upper scope.

ebon citrus
#

accidentally?