#arma3_scripting

1 messages ยท Page 509 of 1

devout stag
#

@slim oyster in order for us to be cba conpliant, you're going to have to use cba statemachine in the headless module anyway ๐Ÿ˜›

tough abyss
#

But you can create and move it to position on server then remoteExec the unit reference to player and selectPlayer into that unit locally on players pc

devout stag
#

Plus it's much better at preventing memory leaks

frigid raven
#

@tough abyss I see. Thanks for the insight

iron sand
#

I have a memory leak in my head ๐Ÿค•

slim oyster
#

Honey whiskey usually helps with those

astral tendon
#

Is there a way to get the vehicle init? like the one we put in the editor?

languid tundra
#

Just use remoteExecCall with target 0 and JIP true and you got your vehicle init.

astral tendon
#

how?

languid tundra
#

Wait are you asking how to do a vehicle init on the fly or how to get the one you set in the editor?

astral tendon
#

Read the vehicle Init that was set in the editor

languid tundra
#

Pretty sure it's not possible, but why would you need that anyway?

astral tendon
#

To get the missions maker custom sethings

#

Like, locked seats, textures, animations, them aplie on the new vehicle created

#

basicly I already have a custom respawn system

languid tundra
#

You could write a function that should be used by the mission maker, when he wants to make part of his code in the init line compatible with your respawn system.

astral tendon
#

Im trying to make as automated as possible

#

requiring less imput of the mission maker

languid tundra
#

Well, but what you want is not possible, so you will have to look for an alternative

tough abyss
#

@astral tendon You can probably include unbinarised mission sqm into description ext and browse it like it was config, but it is a lot of hassle for nothing

tender root
#

I have the following problem:
I want to check whether a unit is ffv. Not in a ffv turret, but really - weapon in hands, ready to shoot - firing from vehicle. Until now I just iterated fullCrew and checked if the personTurret for the given unit is true.

This worked fine so far but now I realized that this is not the full solution, because slots which can turn out like the loader or commander of a tank and can also ffv when turned out also have personTurret = true. So I tried using isTurnedOut to catch if the unit actually is ffv at the moment. This worked fine for the before mentioned slots, but for ffv only slots (like the ones on the cargo bed of the pickup) not so much, because they always return false for isTurnedOut.

I also thought about checking the currently available weapons and compare them with the primary / secondary weapon, but haven't found a way to get those (weapons to switch to) yet.

Does anyone have an idea how to make this work?

Thanks in advance ๐Ÿ˜„

astral tendon
#

yeah, I was trying to play around with that but no juice

#

there is a class Attributes/init in the mission.sqm, I did not figured how to read that

still forum
#

the mission maker can include the mission.sqm in a description.ext and then you can read it with missionConfigFile

slim oyster
#

#include a mission.sqm with a billion placed objects all with a ton of attributes ๐Ÿ˜ƒ

languid tundra
#

and unbinarized ...

astral tendon
#

any exemple for the missionConfigFile?

tough abyss
#

type utils 2 in debug console

#

select mission config from dropdown menu

#

you can see all attributes

#

and browse to the one you want

#

then copy path and voila

astral tendon
#

I stoped at MissionSQM/Mission/Entities/

#

because they are named item0,item1

#

and so on

#

how to do a foreach on they?

languid tundra
#

BIS_fnc_returnChildren

astral tendon
#
[ (missionConfigFile >> "MissionSQM" >> "Mission" >> "Entities"), 0, false, false ] call BIS_fnc_returnChildren;

returns nothing

#

toughm there is a was then to seach elements inside that item0?

#

my apc is the Item44

#

inside class Attributes there is name="APC_Test";

#
        class Item44
        {
            dataType="Object";
            class PositionInfo
            {
                position[]={23905.676,5.7293777,18337.158};
                angles[]={-0,4.7084274,0};
            };
            side="Empty";
            flags=4;
            class Attributes
            {
                init="call{[this, 3, 999] spawn TG_fnc_vehicleRespawn;" \n "this setObjectTexture [0, ""#(rgb,8,8,3)color(1,0,0,1)""];" \n "this animate [""HideTurret"",1];" \n "systemChat (str _this);}";
                name="APC_Test";
                textures="Sand";
            };
            id=113;
            type="B_APC_Wheeled_01_cannon_F";
            class CustomAttributes
#

here is a exemple

#

so how do I seach for it?

languid tundra
#

Hmm, not sure why BIS_fnc_returnChildren doesn't work. What about a for-loop using _config select _i and count _config to iterate over the items?

#

or there is also configClasses, which might work with forEach or findIf refering to your last question.

quartz oracle
#

is there any way i can automaticly (by an ai/bot) shot an artillery or morser shot to a players location if they're on there position for too long (except if they are on there spawn) for an anti camp mechanic ( for every side ) ?

languid tundra
#

commandArtilleryFire or doArtilleryFire will do the job for you

quartz oracle
#

is there a efficient way to check if the player is camping (my idee is to log the player pos every minute and compare it with the old position ) but is there an better way ?

slim oyster
#

@astral tendon I think you will have a much better time if you rely on the mission makers creating their own templates, that way you can grab info like the init of a unit within the 3den space with just a simple get3denattribute "init" . You can grab and compile all the information for a group/object and spawn it later by calling a spawn function that takes that compiled info as a param

astral dawn
#

I guess it's fine. Just check the distance between current position and previous position every XXX seconds you like. @quartz oracle

languid tundra
#

Or collect a few in an array and replace the oldest by the newest. You can calculate the standard deviation for instance ๐Ÿ˜„

astral tendon
#

Like this? APC_Test get3DENAttribute "init";

#

returns a empty array

astral dawn
#

Calculating std dev based on two samples is the same as I have suggested ๐Ÿค”

slim oyster
#

@astral tendon Are you in the editor or in a mission?

languid tundra
#

I meant a few more than just two. You don't do statistics with two data points ๐Ÿ˜‰

astral tendon
#

In mission

slim oyster
#

Sadly those commands dont work outside of the editor. What I am suggesting if that you create array templates within the editor using those commands and spawning them via a function in mission

astral tendon
#

"(missionConfigFile >> 'MissionSQM' >> 'Mission' >> 'Entities'>> _x) type == "B_APC_Wheeled_01_cannon_F";" configClasses (missionConfigFile >> "MissionSQM" >> "Mission" >> "Entities");
#

I done that in a rush

languid tundra
#

configClasses returns configs...

astral tendon
#

I will have to go to work now, but if you guys can message me about this code to keep testing this I would love it

quartz oracle
#

can i just do ```
difference = new player pos - olf player pos

AND
how can i check the distance every  xxx time , just with 
``` while (playerNotOnSpawn) { 
sleep 60;
check distance;
do more stuff;
}```
or is there an better way ?
astral dawn
#

I think it will do for now... make it work first, optimize later

slim oyster
#

Don't you just want to check if the player is within a certain distance over time, not the actual distance?

#

_pos distance _pos2

astral dawn
quartz oracle
#

ok thank

#

and about the loop ? os ot okay like that ?

astral dawn
#
while (alive player) do {
...
};
#

spawn it when player spawns ๐Ÿค”
I mean, there must be some event handler in arma which triggers when player actually spawns... not sure. When it triggers, you spawn this script

quartz oracle
#

can i do it in OnPlayerSpawn.SQF ?

#

but as far as i know there should be an event handler for it

velvet merlin
#

whats a good way to check if an units inside a house these days?

#

lineIntersectsWith upwards and then check whether the unit is within the BoundingBox?

languid tundra
#

Well, even boundingBoxReal isn't really accurate. It's the box you see as Zeus when the item is selected...

#

But lineIntersectsWith is certainly a good way to start.

astral dawn
#

@quartz oracle But you should really investigate these aspects:
If sample rate is small (1 minute) there might be a situation when the player has moved somewhere and back to the previous position, you script will think that the player was actually camping
Therefore you should reduce sample rate and probably do as @languid tundra suggested. Or use some counter 'if player hasn't moved far from his previous place N times in a row', again with a proper sample rate.

#

Also note locality. Probably this script should rather be executed on server, because in the end the server will command artillery? ๐Ÿค”

tough abyss
#
_private = if (_first) then {["_classes"]} else {[]};
private _private;
if (_first) then {_classes = [];};
still forum
#

wtf

tough abyss
#

BIS_fnc_returnChildren

frigid raven
#

When creating a new unit then adding some variables to this unit through setVariable and then using selectPlayer _unit on that created unit - the namespace of _unit is not applied to player right? That's how it looks like atm. That's why I wanna be sure

#

oops false info it seems it does apply the variables

tough abyss
#

No it applies to object of the unit

still forum
#

the namespace of _unit is not applied to player right
no. But player references to _unit
so player getVariable will retrieve the variables

frigid raven
#

Alright - ye just found out after writing sane code again

tough abyss
#

when you selectPlayer into the unit, then you can refer to the unit as player hence player getVariable whatever will work

quartz oracle
#

stupid question -where do i find triggers ?

tough abyss
#

usually between magazine and the grip

quartz oracle
#

not those kind of trigger ... ๐Ÿ˜„

languid tundra
#

lol

quartz oracle
#

somethink that activates if an player goes inside / outside of a secific area

tough abyss
#

They are flag icon in assets in 3den

quartz oracle
tough abyss
#

Press F3 when in eden

quartz oracle
#

was that always there ..?

tough abyss
#

from day 1

quartz oracle
#

i think im blind or someyhink

warped moon
#

(sorry if its the wrong hub)

rancid pecan
#

hello everyone

#
    _playerweapon = currentWeapon player;
    _itemclass = (getText(configFile >> "cfgWeapons" >> _playerweapon >> "displayName"));
    _itemimg = (getText(configFile >> "cfgWeapons" >> _itemclass >> "picture"));
    hint parseText format [" Weapon Image: <img image='%1' size='1'></img>",_itemimg];
#

where is problem ? this weapon image why don't workin ?

#

This code result : ```sqf
Weapon Image:

robust hollow
#
    _playerweapon = currentWeapon player;
    _itemclass = getText(configFile >> "cfgWeapons" >> _playerweapon >> "displayName");
    _itemimg = getText(configFile >> "cfgWeapons" >> _playerweapon >> "picture");
    hint parseText format [" Weapon Image: <img image='%1' />",_itemimg];

try that

#

you're using the weapons display name to get the picture but it still needs to use the classname (_playerweapon).

tough abyss
robust hollow
#

using </img> doesnt prevent the image from being shown. Just tested it.

rancid pecan
#

@robust hollow and @tough abyss thanks it's working

winter rose
#

is there a way to get the rendering resolution? (I know about getResolution)

ruby breach
high marsh
#

maybe read the text from ui? Hacky, but doable?

winter rose
#

I changed my TV (4K now), and I want to know the render resolution (not percentage) as it seems 50% seems a bit blurry, and I don't know why
maybe I should simply put the UI resolution at 1K instead

torpid grail
#

Does anyone know an alternative command to ctrlDelete?

brave rain
#

@still forum Are you the TFAR developer?

#

If anyone is able to help I am trying to make key binds for swapping TFAR frequencies

#

                _channel = (call TFAR_fnc_ActiveLRRadio) call TFAR_fnc_getLRChannel;
                _channel = _channel + 1;
                [(call TFAR_fnc_activeLrRadio), _channel, _freq] call TFAR_fnc_SetChannelFrequency;

_title = "None";

if(playerSide isEqualTo west || playerSide isEqualTo independent) then {

   switch (_freq) do {
        case 33.1: { _title = "Military Arms Corp 1"; };
        case 33.2: { _title = "Military Arms Corp 2"; };
    };

};


["Radio",format ["You are now on %1 %2 frequency.",_title, _freq]] call UPM_fnc_showNotification;```
#

I get the notification working fine but it snot swapping chnanel

ruby breach
#

@brave rain From 5 seconds of Google, either your switch statement is in error, or you're trying to pass _freq as a number when setChannelFrequency requires a string

brave rain
#

I get the notification with both arrays

#

ill try just do it for one channel

ruby breach
#

Is _freq a string or a number? If it's a string, your switch statement is incorrect. If it is a number, it needs to be a string.

#

Based on the fact that you're not changing frequencies, my bet is that it's a number

astral tendon
#

@languid tundra and @slim oyster thanks for the help I got what I need. now I can get the vehicle init in the editor and apply to a new one

#
//test is another vehicle 
_object = str cursorObject;  
_configWithName = ((missionConfigFile >> "MissionSQM" >> "Mission" >> "Entities" ) call BIS_fnc_returnChildren select {getText (_x >> "Attributes" >> "name") == _object});   
_ObjectInitString = getText ((_configWithName select 0) >> "Attributes" >> "init"); 
_Init =  "this = " + (str test)+ ";" + _ObjectInitString; 
call compile _Init; 
#

Still gonna need some enhance. to make it better, but the main objective is done, and also, that is slow at 1.76367 ms

#

and this had to be added at description.ext

class MissionSQM
{
    #include "mission.sqm"
};
winter rose
#

clever!

still forum
#

@brave rain you maybe should've read the rules of TFAR discord before getting banned.
Yes I am the TFAR dev. And I know what's wrong with your code. But if you don't care to read my rules then I don't care to help you either.

brave rain
#

@still forum You're a rude person who really shouldn't have the power he does sorrounding TFAR. Shame on you.

#

I got it working myself from the help of some comptent polite people anyway.

still forum
#

Wow you even sent me a friend request. Did you want to spam via PM too? ๐Ÿคฃ
I'd say I'm known for paying lots of attention to the rules, I don't plan to change that.

brave rain
#

Where did I spam?

open vigil
#

@brave rain I Highly suggest you read the #rules before you are removed.

brave rain
#

@open vigil Which rule have I broken just so I know for next time, I have read through them mate ๐Ÿ˜ƒ

still forum
#

Rule 1 in the messages you just deleted

brave rain
#

Sorry I asked -FM-

open vigil
#

Since you state you've read them, you've obviously not abided by them (I've seen your deleted posts)

#

!quickban @brave rain

lyric schoonerBOT
#

*fires them railguns at @brave rain* ร’_ร“

frigid raven
#

@still forum Who is attacking you? Tell me! I will protect one of my precious sources of SQF knowledge at all cost

still forum
#

noone anymore

frigid raven
#

yea better is that

still forum
#

I have lots of sqf sauce to spare. Just grab a straw

frigid raven
#

Dude...

#

Wrong wording

minor needle
#

would be odd for the game to track that

still forum
#

extension could certainly do it. Never heard of a script command that does

#

there is something for dlc usage time. But that's only in current session I think

#

I have seen people read it from the map screen display

#

but a manual remoteExec ping might be easier

#

yeah but the display is written by engine. no sqf command

#

just diag_ticktime with remoteExec

#

just execute code that answers back to remoteExecutedOwner. Bam. You have a ping pong

#

Though not really reliable. Depends on the fps of both participants and on the stage they are currently at in the frame

#

But I guess 20-30ms difference doesn't matter that much right?

minor needle
#

In some cases thats 100% deviation ๐Ÿ˜…

astral dawn
#

maybe remoteExecCall then? Will it be better? Or it still sits in the same queue as remoteExec on the receiving side?

minor needle
#

And might further be diluted by heavy scripting cause that'll bump execution time, some servers run at like 10 fps on average

still forum
#

same queue no difference

#

at 10fps you are already at 100ms deviation.. Kinda bad. You could also send along diag_fps to compensate for that

astral dawn
#

Well... given that distribution is uniform, you could send the ping 10 times and take minimum value

#

Also it wil be affected by FPS of both computers as I understand

queen cargo
#

to get such a check semi-relyable, one would need to pass local diag_tickTime and get it synced somehow

#

best way in the end though is to just tell BI to give us diag_ms

astral dawn
#

hmm... I know ๐Ÿ˜„ Make a control loop with feedback to make it nullify your ping error... but that's an overkill

queen cargo
#

chances are: you would be best off with a custom extension

still forum
#

I already have ping measurement in TFAR. I store the time when a radio request is made to the server, and log the elapsed time when the result comes back

#

chances are: you would be best off with a custom extension and how do you make that send a ping to a client? You'd need the clients IP

queen cargo
#
ping 123.456.789```
minor needle
#

numbers higher than 255 dont exist in an IP ๐Ÿ˜›

queen cargo
#

though ... probably gets blocked by router ๐Ÿคท so client extensions would be required too

minor needle
#

Seems highly impractical to ask your clients to install an extension just so you can check their latency

still forum
#

Don't see the problem with the remoteExec variant. Just send fps along and maybe substract 1/3rd of frame time

astral dawn
#

What do you need to know the latency for? If only for technical aspects of your scripts, the measured delay by this method will indeed be the perceived latency by your script from your computer to his and back, I mean it will depend on FPS of both machines anyway.

minor needle
#

Suppose you could do that and run a real ping on a server you own and then just approximate the math you gotta do on the return value

#

Theres a big difference between actual latency and perceived

#

Real latency has nothing to do with fps

astral dawn
#

What I mean is, does he need to know only the network latency, or both his game + network + the remote game latency, affected by both engines in this case

minor needle
#

And while I'm not sure how exactly arma works I almost have a suspicion that high latency players drag down the performance of everyone else

peak plover
#

yea

#

if you remonte exec you just save the time it takes

#

same as ping

#
private _players = allUnits select {isPlayer _x};

missionNamespace setVariable ['mission_civ_sent',CBA_missionTime];
{
    //--- runs on the client
    // make sure player exists
    if (isNull player) exitWith {};
    [[player,(diag_fps)],{

        //--- runs on the server
        params ['_unit','_fps'];
        private _sent = missionNamespace getVariable ['mission_civ_sent',0];
        private _ping = CBA_missionTime - _sent;
        _unit setVariable ['unit_civ_fps',_fps];
        _unit setVariable ['unit_civ_ping',_ping];

    }] remoteExec ['call',2];
} remoteExec ['call',_players];

tough abyss
#

You could query BE with extension and get ping from there

#

or get IP and do it with other tools

peak plover
#

If you're adding a custm mod

#

At that point

#

I assume it's a private server for a private community

#

You can manually ban everyone who has high ping

#

Save the hustle

still forum
#

if you wanted to remove high ping you can just use the serverconfig entry for that

peak plover
#

Although

#

It would be interesting

still forum
#

What's neat? The non-fix by BI?

peak plover
#

If someone ran scripts to lag players or just createVehicleLocal to the point that their fps is <10 and then checked the fps on another player who still has normal fps.
Maybe the interpolation or whatever causes lag if there is too much missing or sth

queen cargo
#

at least that explains the constant restarts required by life servers ๐Ÿคท

#

a diag_clearcache command also would have been sufficient if you would ask me (+ the alt syntax obviously)

still forum
#

And this "fix" won't change anything on that. People will need to update their scripts.
And they already chose not to update to parseSimpleArray, so they won't update this time either

queen cargo
#

just give em the regex for it and be done with it

#

though ... not like i care what life dudes do

peak plover
#

Why are you even using compile?

queen cargo
#

maybe i will proof how life missions should be written ... once i get around my own database client extension

#

but fuck sake ... adding a bloody sql connector to c/c++ and get it linked statically is more hazzle then iti s worth it

still forum
#

Just use Intercept. And return arrays directly. No parsing rubbish anywhere.

queen cargo
#

this

#

just that still it requires bloody fucking sql connectors ...

peak plover
#

ahh okay

still forum
#

A database addon was actually something I always thought of as a example use for intercept.
There are some already but none are public afaik

queen cargo
#

unless you use sqlite, that shit is complicated AF for some reason

#

or i am just too stupid

#

probably both

still forum
#

Yeah. Used that too in some project. It's not that nice

frigid raven
#

@queen cargo you aren't me -> therefore not stupid

queen cargo
#

yes and no @tough abyss

still forum
#

I wish people could stop asking me "does it affect this"

#

EVERY compiled script is affected

#

every script compilation is cached

#

so yes.. Of course it does

#

execVM, addAction, eventhandlers. Everything that compiles a string to code

#

I wish they would fix eventhandlers properly. that's maybe 1 or 2 hours of work. tops.

queen cargo
#

just use SQF-VM
no memory leaks yet

#

could add them just for your convenience

#

and sideload it into the game using intercept

still forum
#

Would be bad if it were recycled

#

what if action1 tries to remove itself after it has already been removed. It breaks other actions. That's bad

#

Also unless you know the inner workings, that might not be a memory leak at all.
It might be a map instead of an array internally

queen cargo
#

is that actually a memory leak?

#

meh .. dedmen was faster

still forum
#

I'll check

queen cargo
#

theoretically, yes @tough abyss
practically, no
you no want more caching

#

at least your wish is just granted in a matter of time ...
try to find any documentation about how to connect to any big database without "just link against our connector and use that" and rather with "this is the way the handshake is done and that is how data is received"

still forum
#

You don't want to implement your own database connector really

tough abyss
#

uncached compile is slow, those life database quires will be a drag

queen cargo
#

i do not want to spend hours to link against theirs either

tough abyss
#

they should use parse simple array or fuck off

still forum
#

Should just make a proper implementation with git submodule and a proper cmake script for the linking.
I wrote my own database extension for Arma some years back, it wasn't that hard to get the linking correct.. Though.. I don't know where my source code for that went ๐Ÿค”

queen cargo
#

got linking working once with mysql ... but only dynamic
static linking was out of question completely

still forum
#

well we found some issues, not all of them ^^

queen cargo
#

git submodule also is not really possible iirc (at least for those i tried using)

still forum
#

static linking was out of question completely
Same as dynamic.. But you link mysqlclient.lib instead of libmysql.lib
Quite easy actually

#

Memory leak doesn't explain performance degredation

queen cargo
#

ye ... just that the linker had some problems
it has been quite some time
cannot really remember anymore

still forum
#

those are different things

tough abyss
#

yeah I have static linked C connector for mysql, wasn't straight forward but in the end it worked well

still forum
#

Okey userActions ID's being left is not a memory leak.

queen cargo
#

just a glorious int counter that gets ++ed?

still forum
#

struct useraction {
int id;
}
array<useractions>
int lastUserActionID;

new action
return lastUserActionID++;

delete action
array find useraction where ID=IdIWant

#

Wasn't obvious that Arma does it correctly tho. They do many things wrong ๐Ÿ˜„

astral dawn
#

So do I get it right: I should not disable caching for functions which are event handlers because then they will not be cached, which will make their compilation longer? ๐Ÿ˜ซ

still forum
#

huh?

#

you cannot disable caching for eventhandlers

tough abyss
#

removeallactions doesnt reset counter to 0 <- stupid

still forum
#

@tough abyss no. No condition means empty. And it has a check to skip condition checks if empty

astral dawn
#

i mean myEventHandlerFnc = compile "myEH.sqf"
oh nvm it will compile anyway

still forum
#

<- stupid no. If you reset it. Some idiot with his bad script comes along 5 minutes later, trying to delete his action but he will delete yours

#

That's terrible

#

You have enough space for 3 million actions per object. I don't think that's a problem

tough abyss
#

if you cater for idiots then you might as well work in the mental asylum and not IT

queen cargo
#

as pretty much all popular missions require a server restart all X hours, no, never

still forum
#

@astral dawn depends on how you use it in the eventhandler. But it will all compile anyway yes

queen cargo
#

@tough abyss wrong
it is the general job of the IT to actually make the idiots kings
just try not to hire those same idiots to write the programs

still forum
#

Just think about it. Do you want some idiot to be able to break your stuff by accident?

tough abyss
#

@queen cargo No you cannot prevent idiots doing idiot things

queen cargo
#

there is the old theorem: If your old idiot is not capable of breaking your stuff anymore, get a new one

tough abyss
#

You only waste time and money and make your product restricted and dull

still forum
#

You don't though

queen cargo
#

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning

tough abyss
#

yeah I agree to that @queen cargo

still forum
#

you don't know what other mods someone might use if you are a modder or mission maker. You don't know what other scripts he would use in missions if you are a modder

queen cargo
#

@tough abyss still: you do not end up with "dull" programs
actually, if an idiot is incapable of using your program without consulting your manual, your program is shit

tough abyss
#

though having added and removed action 1000million times is an idiotic thing to do as well

queen cargo
#

because that means everybody is required to consult the manual

still forum
#

Generally. If I remove an action with the ID of an action I added previously. I expect either my action to be removed, or if it was already removed nothing to happen.
No one expects that you delete someone elses action. People use the actionID like a handle. A handle that just points to one specific action

#

A handle doesn't suddenly point to something different

#

Same thing with removeEventhandler. Actually don't know if it has the ID reuse problem, I think it does

tough abyss
#

removeAllEventHandlers resets handler to 0, lemmie check

robust hollow
#

^ this is correct

still forum
#

Eventhandles use the same "nextEventhandlerID" thing like useractions do. That's good atleast.

#

The ID's being reset to 0 is actually an accident kind of.

tough abyss
#

Yes it does, what do you say to the idiot that comes with his handler id and removes EH by accident @still forum ?

still forum
#

I cannot say anything to him because I won't know he deleted it. I will just be staring at my screen in awe with a smoking head wondering how this could've possible every happened

#

the nextHandlerID is stored on the vehicle in addAction, delete and recreate the vehicle you start from 0 again.
with eventhandlers it's stored in the eventhandler type. If you removeAllEventhandlers that type is removed too. And it will be recreated once you create the first handler for that type. That's why the ID is reset.. Not that nice..

#

wat

#

where are my glasses

#

Why do you mix _QS_player and player? Shouldn't you be using the same?

#

Also won't this cause lag until the action shows up? You'll be there looking at the target, and have to wait half a second till the action apears?

tough abyss
#

{(_cursorDistance < 1.9)} you can set the action reach in addAction why do you need to check it separately? If your action has limited radius your action condition will not execute until you are in that radius

austere granite
#

This is why real-time menus are annoying. So much nicer to only hsve to check anything after a button is pressed

queen cargo
#

actually ... the trick is to just get told when an update is available

tough abyss
#

@austere granite I agree, menu ondemand

queen cargo
#

but that is not possible with arma

austere granite
#

Well you could use global vars and then events to set it x39

#

Unless I'm misunderstanding you

still forum
#

You could check some simple things in a PFH and make your own eventhandlers. Like cursorTargetChanged would come to mind here.
And then split the checks up into smaller checks. If the cursorTarget doesn't match, you don't need to recheck until cursorTargetChanged fires again

queen cargo
#

you do @austere granite
essentially, disconnecting the actual "display" and the "code"
allowing you to do M V VM
Model being in this case whatever required, view your dialog (+ the impossible observing layer) and viewmodel just some variables

#

though ... ๐Ÿค” such a framework might be possible with a lot of fancy methods

austere granite
#

I'm more thinking about scripted events like dedmen said

tough abyss
still forum
#

Thinking about actually making a intercept database thingy..
How to make building queries make sense. I'm thinking about this

DB_Cache_InsertQuery = db_prepareQuery 'INSERT INTO positions (name, x, y, z) VALUES (?,?,?,?)';

private _insertQuery = db_copyQuery DB_Cache_InsertQuery; //Such that you can prepare queries that you often reuse, maybe even with values already bound to the query

_insertQuery db_bindValue (name player); //Binds value to next available placeholder
_insertQuery db_bindValueArray (position player); //foreach value {Binds value to next available placeholder}. So this sets x,y and z


private _errorcode = db_queryAsync _insertQuery;
queen cargo
#

if you want to do it, do it proper though ๐Ÿคท
not like this weird "bindvalue" bla

#

also you lack the db connection currently there

still forum
#

Also feels MUCH easier to use than glueing stuff together with format
What do you propose instead of bindValue?

Mh. I could provide the db connection at the queryAsync command, or at the prepareQuery stage ๐Ÿค”
I think providing connection at execution makes more sense

queen cargo
#

can give you a list in a few mins

tough abyss
#

But in general, if you are using action menu, you are not doing yourself a favour, Arma 3 went lightyears ahead of Arma 2 in terms of available commands for making UIs you should abandon that piece of shit no good ancient system for noobs and make your own

queen cargo
#

currently busy at work

still forum
#

Could do it like mysql does _insertQuery db_queryAsync [(name player), (position player)];
like mysql's EXECUTE stmt1 USING 1, 2;

queen cargo
#

that is why i said: do it right or do not do it at all

#

there is not only mysql ๐Ÿ˜‰

tough abyss
#

there is not only mysql true dat

still forum
#

Most people use mysql or sqlite I'd say?
Me doing it that way in scripting doesn't mean you are forced to use mysql in backend.
It's just for convenience. The backend can plug things together to work with any db

tough abyss
#

postgre is as popular

#

you can redo doors with own UI, you can pretty much disable HUD and make own UI for almost everything or make a mod

queen cargo
#
Types:
- DBCONNECTION
- DBSET
- DBCMD

Commands:
- createConnection STRING -> DBCONNECTION
- DBCONNECTION createCommand STRING -> DBCMD
- DBCMD addParameter [Name:STRING, Content:ANY] -> NIL
- execute DBCMD -> SCALAR (Affected records)
- executeQuery -> DBSET
- isReady DBSET -> BOOL
- next DBSET -> NIL
- headers DBSET -> ARRAY (strings)
- row DBSET -> ARRAY

should be sufficient

#

unless i missed out on something

tough abyss
#

might as well invest those 100 hours in learning Enforce

austere granite
#

100 hour time sink wat?

#

but they have fixed some of the worst issues with it (selecting the correct door) for instance

#

Was there an update Im not aware of?

#

I'm confused now

still forum
#

I thought more like "dbvalue" type inside the result set. a value can be string or number or array of values.
And there is a function to turn it to array of script values directly. Like parseSimpleArray would do

queen cargo
#

๐Ÿคท @still forum
both is possible
not really matters
that is just generic enough for all systems

still forum
#

Oh! And i didn't even think about async queries with callbacks!

tough abyss
#

If you gonna do db integration I would think big and plan for a central backend DB and server local DBs to talk to the backend

still forum
#

can you explain that? Don't quite understand

queen cargo
#

technically, there would still be "close connection" etc.
but due to garbage collection, that should not be required (just close as something moves out of scope)

still forum
#

RAII in SQF ๐Ÿ˜„

queen cargo
#

one could go even nitpickier by saying eg. there is no "get row" and rather "DBSET getvalue SCALAR"

tough abyss
#

so that you have all stats and whatnot kept at the central database and all immediate stats related to player playing on a particular server on the local server db. So 100 players on the server have direct quires to local server DB and 100 servers have direct quires to the backend DB

queen cargo
still forum
#

I'd say that's outside of my realm. If people wanna set up big cluster like things they can do that seperately

queen cargo
#

the actual database connection has nothing to do with load balancing btw

#

that is a database side thing

still forum
#

I'd just build the game->database
What you are proposing is game->database->central database
The user can implement the second part himself

tough abyss
#

In MySQL you can have Federated tables but it looks like a huge pain in the ass

still forum
lone oracle
#

Anyone can help?
I create one AI and try to move inside heli. But it isn't working.
Here is code

_man = "B_Competitor_F" createVehicle [10,10,10];
_man moveInCargo [(vehicle player), 3];
_man assignAsCargoIndex [(vehicle player), 3];

still forum
#

use createUnit not createVehicle

lone oracle
#

ahhhhh

#

lol

tough abyss
#

or createAgent

lone oracle
#

oh my god

peak plover
#

dear lord

frigid raven
#

@peak plover what is it my son?

#

@lone oracle I hear you?

tough abyss
#

still in Zeus mode @frigid raven ?

frigid raven
#

๐Ÿ˜„

#

always

quartz oracle
#
    {
    _unit = _this select 0;
    _UnitIsInSpawn = true;
    _OldUnitPos = [9999, 0, 9999];
    while !(_UnitIsInSpawn) do
    {
        _OldUnitPos = _unitPos;
        sleep 30;
        _unitPos = getpos _unit;
        
        if(_unitPos distance2D _OldUnitPos <= 10) do
        {
            AntiCampArti doArtilleryFire [_unitPos, "HE", 1];
            hint "Arti Fire";
        }
        else { hint "no Arti Fire"; }
    };
}];```
there is an error in the first line
```Unknow enum value: "MPRespawn"```
still forum
#

correct

quartz oracle
#

aww sry

#

also theres an error at the while loop

#

type bool, expect code

queen cargo
#

while CODE is expected
you pass while BOOL @quartz oracle

quartz oracle
#

so how too fix it ?

digital hollow
#

Here's the example from biki while {a < b} do {a = a + 1};

queen cargo
#

do it correctly
instead of passing some bool, pass a code type that evaluates your bool ๐Ÿ˜‰

quartz oracle
#

so i have to change ( ) with { } ?

queen cargo
#

it is not a "simple change"
it is important that you realize the difference

#

{} is a code block

#

and returns "roughly" a set of instructions

#

on the other hand () is just to group stuff (like in math esentially)

quartz oracle
#

yeah o know i just dont know (until now) that you have to do { } in while loop (in other languages i used ( ) for while too )

astral tendon
#

Is there a way to get and add vehicle modifications like the cages in the APCs?

still forum
#

add no. They are embedded into the model

astral tendon
#

So, some one have a vehicle editing function handy?

peak plover
#

whadaya wanna do?

#

add a cage?

#

just createVehicle

#

and attachTo

quartz oracle
#
    {
        _OldUnitPos = _unitPos;
        sleep 30;
        _unitPos = getpos _unit;
        
        if(_unitPos distance2D _OldUnitPos <= 10) then
        {
            AntiCampArti doArtilleryFire [_unitPos, "HE", 1];
            hint "Arti Fire";
        }
        else { hint "no Arti Fire"; }
    };```
there is somethink wrong with sleep but i dont know what it says
```Generic error in expression```
i dont know whats wrong and how to fix it
still forum
#

you are probably trying to sleep in unscheduled

#

how do you call that code?

quartz oracle
#

initserver

#

sqf

still forum
#

is the _unitPos variable in third line defined?

quartz oracle
#

not really

still forum
#

Then it's erroring on that.

#

Undefined variable

quartz oracle
#

i added this line _unitPos = getpos _unit; befor the _OldUnitPos = _unitPos; but the error still occurs

still forum
#

Well is _unit defined?

exotic tinsel
#

would someone be willing to point me in the direction of how to do the following
id like to have it so that when a player joins and after they select a role and connect to server, have their map open and the briefing item that i create for their role be open.

still forum
#

just check if all your variables are valid

quartz oracle
#

_unit = _this select 0; hope this is enough (comes befor the while loop)

#

like i said its says the error is in the sleep line

still forum
#

maybe put a [] spawn {} around it

quartz oracle
#

ill try it

#

also the code does massive amount of lag ( low fps ) for me

#
    {
    _unit = _this select 0;
    _UnitIsInSpawn = false;
    _unitPos = getpos _unit;
    _OldUnitPos = [9999, 0, 9999];
    while {!_UnitIsInSpawn} do
    {
        _OldUnitPos = _unitPos;
        [] spawn { sleep 15; };
        _unitPos = getpos _unit;
        
        if(_unitPos distance2D _OldUnitPos <= 10) then
        {
            AntiCampArti doArtilleryFire [_unitPos, "HE", 1];
            hint "Arti Fire";
        }
        else { hint "no Arti Fire"; };
    };
}];```
this code does massive lag
#

and i dont know why, please help

tough abyss
#

@quartz oracle do you know what while do construct does?

quartz oracle
#

yes i think so

tough abyss
#

Tell me

quartz oracle
#

execute the code over and over as long as the condition are right

exotic tinsel
#

any help would be appreciated on how to forcibly open a briefing item on a player client via script

tough abyss
#

So it creates endless loop inside your event handler right?

quartz oracle
#

yep

#

but it should wait 30 sek somewhere in the midle

tough abyss
#

So EH cannot finish its code and since it is unscheduled it will not let any other process start until it is finished

#

See where Iโ€™m getting at?

quartz oracle
#

there is no other code

tough abyss
#

It stops all processes

#

It is blocking call

exotic tinsel
#

@quartz oracle that while will be re fired and keep running every time the player respawns. also you need to wrap your code in the eventhandler in a spawn so you can use a sleep in the while loop so that its not checking every micro second. i would add something to the loop so that it doesnt generate another while loop run everytime the player respawns. you need to have a condition in it to stop it from running on the next time the player respawns.

tough abyss
#

Clever programmers from BI however foresaw this idiotic use and added limit on how many times the loop can run in unscheduled of 10000 iterations so your game gets frozen for 10000 iterations every time EH fires

#

Luckily it only fires on 1 PC - yours, so no damage is done, carry on

queen cargo
#

hint this is not a blocking call hint

exotic tinsel
#

any help would be appreciated on how to forcibly open a briefing item on a player client via script from a server side addon

quartz oracle
#
    {
    _unit = _this select 0;
    _UnitIsInSpawn = false;
    _unitPos = getpos _unit;
    _OldUnitPos = [9999, 0, 9999];
    while {!_UnitIsInSpawn} do
    {
        _OldUnitPos = _unitPos;
        [] spawn { sleep 15; };
        _unitPos = getpos _unit;
        
        if(_unitPos distance2D _OldUnitPos <= 10) then
        {
            AntiCampArti doArtilleryFire [_unitPos, "HE", 1];
            hint "Arti Fire";
        }
        else { hint "no Arti Fire"; };
    };
}];``` there is an sleep
queen cargo
#

you clearly did not understood what spawn is actually doing

tough abyss
#

Thats better you just spawned 10000 scripts

quartz oracle
#

i never said i know what spawn do

#

just said i know what while do

queen cargo
#

but you did understood that it is required for sleep

quartz oracle
#

there is an spawn befor the sleep but i know what zou mean srz

queen cargo
#

a lil research will tell you, that spawn actually is like you tell the engine to run this code later

#

๐Ÿ˜‰

exotic tinsel
#

@quartz oracle

player addMPEventHandler ["MPRespawn", 
{
    [_this select 0] spawn {
        _unit = _this select 0;
        _UnitIsInSpawn = false;
        _unitPos = getpos _unit;
        _OldUnitPos = [9999, 0, 9999];
        while {!_UnitIsInSpawn} do
        {
            _OldUnitPos = _unitPos;            
            _unitPos = getpos _unit;
            
            if(_unitPos distance2D _OldUnitPos <= 10) then
            {
                AntiCampArti doArtilleryFire [_unitPos, "HE", 1];
                hint "Arti Fire";
            }
            else { hint "no Arti Fire"; };
            sleep 1;
        };
    };    
}];
#

any help would be appreciated on how to forcibly open a briefing item on a player client via script from a server side addon

astral dawn
#

can you just open a briefing item on your own computer already?

tough abyss
#

@exotic tinsel you need to open map and hack tasks control

#

Maybe there is a command I wouldnโ€™t swear

#

Look in BI scripts for Apex missions

quartz oracle
#

does someomne know what causes the bug where i cant respawn (the map get shown but not the think where i can change respawn position, loadout and where the repsawn button is ) ?
if someone know what causes this pleas say how i can fix it, thanks

still forum
#

happens randomly. Killing yourself fixes it most of the time

quartz oracle
#

how can i kill myself _

#

?

still forum
#

player setDamage 1.
Executing that code is not so easy though

quartz oracle
#

i cant open menu via esc

still forum
#

Yep.. I have a hotkey to execute scripts.

#

If someone else is on the server and already spawned he can kill you

lost copper
#

@still forum he have problem with code in respawn EH. I try to help him now ๐Ÿ˜… ๐Ÿ‘Œ

quartz oracle
#

@lost copper still happen

#

๐Ÿ˜ฆ

still forum
#

I have that bug too. Without any respawn eh's

#

I'm suspecting MCC mod.

lost copper
#

@quartz oracle send error screen here

quartz oracle
#

the error on the screen had nothink to do with it

lost copper
#

I think you have error with expression in that EH

quartz oracle
#

also i cant send pics here

lost copper
#

You can give link on it.

quartz oracle
#

mcc mod ?

quartz oracle
#
{
    [_this select 0] spawn {
        _unit = _this select 0;
        _UnitIsInSpawn = false;
        _unitPos = getpos _unit;
        _OldUnitPos = [9999, 0, 9999];
        while {!_UnitIsInSpawn} do
        {
            _OldUnitPos = _unitPos; 
            _unitPos = getpos _unit;
            
            if(_unitPos distance _OldUnitPos <= 1000) then
            {
                AntiCampArti doArtilleryFire [_unitPos, "HE", 1];
                hint "Arti Fire";
            }
            else { hint "NO Arti Fire"; };
            sleep 30;
            };
    };    
}];```
this code dont give any errors but still dont work :/ someone know why ?
astral tendon
#
((allMissionObjects "") select {_x isKindOf "Box_C_IDAP_UAV_06_medical_F"}); //73.1429 ms

is there a equivalent with the same result but faster?

high marsh
#

Can you limit it to a radius? If so, try nearObjects instead.

astral tendon
#

Nope, need to check all maps placed objects

high marsh
#

try nearObjects anyways with the radius being the worldsize

astral tendon
#
player nearObjects ["Box_C_IDAP_UAV_06_medical_F", 10000]; //53.5789 ms 
#

meh, still slow

high marsh
#

Yeah I got pretty much the same results. Except even slower.

lost copper
#

Can you analize classes in mission.sqm, @astral tendon?

astral tendon
#

Im sorry?

lost copper
#

Can you find type of vehicle in that class?

astral tendon
#
        class Item44
        {
            dataType="Object";
            class PositionInfo
            {
                position[]={23905.676,5.7293777,18337.158};
                angles[]={0,4.7084274,0};
            };
            side="Empty";
            flags=4;
            class Attributes
            {
                init="call{[this, 3, 999] spawn TG_fnc_vehicleRespawn;" \n "this setObjectTexture [0, ""#(rgb,8,8,3)color(1,0,0,1)""];" \n "this animate [""HideTurret"",1];" \n "}";
                name="APC_Test";
                textures="Sand";
            };
            id=113;
            type="B_APC_Wheeled_01_cannon_F";
#

seems possible

#

but using that code I have posted is also slow

lost copper
#

Hmm

#

Can you checking all classes by "for" cycle?

#

like

for "_i" from 0 to 1000 do {
    if (configFile (fromat ["class Item%1", i]>>type) == "B_APC_Wheeled_01_cannon_F") then {
        //do something
    }
}
#

something like that

astral tendon
#

Nah, cant figure it

high marsh
#

What if there are more or less than 1000 objects? Doesn't make sense to be using for loop

#

also, you could just use getText,

if(getText(configFile >> "type") == "B_APC_Wheeled_01_cannon_F") then 
{

};
astral tendon
#
        _currentObject = _x;
        _actionFarp = ["tg_farpAction", "Repair All", "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\repair_ca.paa", {[_target] spawn TG_fnc_farpAction;}, {true}, {}, [], [0,0,2],10] call ace_interact_menu_fnc_createAction;
        [_x, 0, ["ACE_MainActions"], _actionFarp] call ace_interact_menu_fnc_addActionToObject;

Does anyone knows in ACE the Distance argument for me here is not working (10) and distance still the default of 2(?)?

lost copper
#

@high marsh 1000 is not principal number. for cycle in A3 is very fast and i think, that we can use it for this task ๐Ÿ•ต

queen cargo
high marsh
#

but that's hundreds of useless checks...
unless you were able to get the array length of the object array

#

then there would be no point in using the for loop anyways, because then you can just itterate through the entire array

#
_perf = ["allMissionObjects """" findIf {typeOf _x isEqualTo ""Box_C_IDAP_UAV_06_medical_F""};"] call BIS_fnc_codePerformance;

//13.68 ms

tough abyss
#

@astral tendon allMissionObjects "Box_C_IDAP_UAV_06_medical_F"

high marsh
#

Welp.

#

M242, that's slightly slower. 3 MS.

astral tendon
#

@tough abyss 71.2 ms

queen cargo
#

that is impossible Oo

#

unless BI fucked up in a way that i could not even imagine, that is not possible

still forum
#

nope

high marsh
#

I think that's his entire script.

still forum
#

thats logical

#

wanna figure it out yourself or shall I solve it?

queen cargo
#

allMissionObjects "Box_C_IDAP_UAV_06_medical_F" being slower then allMissionObjects "" findIf {typeOf _x isEqualTo "Box_C_IDAP_UAV_06_medical_F" is logical?

still forum
#

yep

tough abyss
#

Ok enlighten please

queen cargo
#

how on earth is that possible?

still forum
#

allMissionObjects "" does no filtering. Meaning it just copies the array of all objects.
findIf stops at first object that matches.

allMissionObjects "Box_C_IDAP_UAV_06_medical_F" Does filter. It has to iterate through all objects and compare each one, without stopping early once it found the first

#

worst case. findIf stops after the first comparison. And allMissionObjects is always O(n)

astral tendon
#

It also defeats the purpuse if I need to find more than 1 box.

high marsh
#

use apply then

tough abyss
#

Hold on what was the objective, get all objects if that type or one object?

queen cargo
#

actually ... i kinda missed the point that the first only looked for a single entry ... think it is bed time

tough abyss
#

How could it be slower that the one with select

queen cargo
#

simple allocate & copy vs iterate and allocate & copy

high marsh
#

Okie, so allMissionObjects "type" should be used when needing more than one box

#

apply, select, all same perf with it

tough abyss
#

It returns all types and some

digital hollow
#

Would it be more performant to just do that in a CBA class EH and spawn the box afterwards?

iron sand
#

Yes yes yes good good good join my cult

high marsh
#

@digital hollow That's what I was thinking, so that you always have a list of them no matter the situation

tough abyss
#

@astral tendon do both methods return equal amount of results? Could you add count (....) to see how many results are returned to compare?

tough abyss
#

Anyway, back to the allMissionObjects. it is weird that there is no significant improvement over using direct filter, but hey, Arma is Arma. Here are my times for 100 randomly placed objects on Tanoa:

`Result:
7.14286 ms
Cycles:
140/10000
Code:
allMissionObjects "Box_C_IDAP_UAV_06_medical_F"

Result:
7.41481 ms
Cycles:
135/10000
Code:
((allMissionObjects "") select {_x isKindOf "Box_C_IDAP_UAV_06_medical_F"})

Result:
7.38971 ms
Cycles:
136/10000
Code:
((allMissionObjects "") select {typeof _x isEqualTo "Box_C_IDAP_UAV_06_medical_F"})

Result:
0.0385 ms
Cycles:
10000/10000
Code:
entities "Box_C_IDAP_UAV_06_medical_F"`

Basically use entities

slim oyster
#

Been wondering about this @tough abyss, it seems like the use of entities or XEH is always better than allMissionObjects. I believe allMissionObjects detects things that the other two cannot right? That might be the only benefit

quartz oracle
#

is there any good way to check if an player is near his spawn ?

copper raven
#

distance

slim oyster
#

savedplayerposvar = getpos player on a postInit or waituntil, then query player pos again and distance/distance2d to that original pos.

quartz oracle
#

maybe an easear way with triggers or ?

slim oyster
#

player in thislist in a trigger that checks player side presence repeatedly

quartz oracle
#

ok ill try it

#

can i somehow get the name of a player (the ingame name)

astral tendon
#

@tough abyss That seems to be the way to go.

#

Just repeating a question:

        _currentObject = _x;
        _actionFarp = ["tg_farpAction", "Repair All", "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\repair_ca.paa", {[_target] spawn TG_fnc_farpAction;}, {true}, {}, [], [0,0,2],10] call ace_interact_menu_fnc_createAction;
        [_x, 0, ["ACE_MainActions"], _actionFarp] call ace_interact_menu_fnc_addActionToObject;

in ACE the Distance argument for me here is not working (10) and distance still the default of 2(?), am I missing something?

quartz oracle
#

how do i do & in if statements
if(((_unitPos distance _OldUnitPos) + (_OldUnitPos distance _OldOldUnitPos)) / 2 <= 1000) && !(_unit in BlueforSpawnPlayerList) then this is how it looks currently

astral dawn
#

if ( bool && bool) then {}

quartz oracle
#

thanks

astral dawn
astral tendon
#

is the texture global and persistent?

#

@still forum , @peak plover got a code handy for the vehicle modifications

#
            _VehicleModifications = [_thisVehicle,""] call BIS_fnc_exportVehicle;
            _instalVehicleModifications = ("_this = " + (str _newVehicle)+ ";"+_VehicleModifications);
            call compile _instalVehicleModifications;

This is from my vehicle respawn, it takes the modifications from the old vehicle and place in the new one

#

BIS_fnc_exportVehicle get the modifications+code it and then I did that trick to add those modifications to a new vehicle

#

If you guys can, add some notes in the BIS_fnc_exportVehicle about this feature and maybe make a better exemple, it will also help people with my same problem

rancid pecan
#

How to open "ebo" files?

robust hollow
#

you dont, they arent meant to be opened.

astral tendon
#

Is this persistent or need remotexec with JIP?

robust hollow
#

wiki says the effect is global so should be persistent.

#

just need to execute it on the client where the turret is local

astral tendon
#

Got it

astral tendon
#
{  
_object = _x;  
_animationsArry = animationNames _x;  
{_object animateSource [_x,0,true]} forEach _animationsArry;  
} foreach (nearestObjects [player, ["all"], 50]);
``` does not work

```sqf
{ 
_object = _x; 
_animationsArry = animationNames _x; 
{_object animate [_x,0]} forEach _animationsArry; 
} foreach (nearestObjects [player, ["all"], 50]);
```Works
#

why is the biki recomending the use of animateSource if that does not work?

#

and "Door_1_sound_source" is unreliable because some double doors opem only one of they

robust hollow
#

animationNames returns names for use with animate so unless the source name is the same it wont work.

#

double doors may have a source for each door.

astral tendon
#

Is there a way to get those other souces? and also, what is it with animate reliability?

robust hollow
#

i dont know of a command for returning source animation names, however you can see what the available names are in cfgvehicles: configfile >> "CfgVehicles" >> _className >> "AnimationSources"

astral tendon
#

it has stuff in it but how to get all strings sinde each?

robust hollow
#

im not sure what you mean. all the class names from "AnimationSources" ?

astral tendon
#

to make stuff easy for me

{  
_object = _x;  
_animationsArry = animationNames _x;  

    {
    _object animateSource ["Door_1_sound_source",0,1];
    _object animateSource ["Door_2_sound_source",0,1];
    } forEach _animationsArry;  
} foreach (nearestObjects [player, ["all"], 50]);
``` takes 1.74216 ms 
```sqf
{ 
_object = _x; 
_animationsArry = animationNames _x; 
{_object animate [_x,1]} forEach _animationsArry; 
} foreach (nearestObjects [player, ["all"], 50]);
``` takes 1.18182 ms 

animate  is faster, so is there any other reason to use animateSource?
robust hollow
#

it is apparently more efficient and optimized for multiplayer

astral tendon
#

What problens I can run into with animate?

robust hollow
#

idk? animate works fine but animateSource is better for mp scenarios.

tough abyss
still forum
#

Why not ask taro how he did it?

#

He said how he did it

That is why its a hack of the pilot camera rather than some camera object attached to the plane

It's not a camera object.

minor needle
#

I dont see any event handlers for closing the arsenal in a similar fashion to InventoryClosed, is there anything else I can use?

still forum
#

vanilla or ace?

#

do you have cba?

minor needle
#

I would prefer to avoid using cba, but yes

#

And no ace

minor needle
#

Currently on really bad internet, I'll check it out once it loads

#

So only with cba :/ alright, thanks

still forum
#

uh no

#

no cba in there

#
//onArsenal PostClose event
[missionNamespace,"arsenalClosed", {
    <stuff>
}] call bis_fnc_addScriptedEventhandler;
minor needle
#

oh

#

Cool I'll try that

minor needle
#

Ah yea that works, thanks

frigid raven
#

np

quartz oracle
#

where do i have to put scripts so that they get executet for every player, for example ```
player addMPEventHandler ["MPRespawn",
{
[_this select 0] spawn {
_unit = _this select 0;
_UnitIsInSpawn = false;
_unitPos = getpos _unit;
_OldUnitPos = [9999, 0, 9999];
while {!_UnitIsInSpawn} do
{
_OldOldUnitPos = _OldUnitPos;
_OldUnitPos = _unitPos;
sleep 5;
_unitPos = getpos _unit;
_ArtiAmmo = getArtilleryAmmo[AntiCampArti] select 0;

        if((((_unitPos distance _OldUnitPos) + (_OldUnitPos distance _OldOldUnitPos)) / 2 <= 1000)) then
        {
            AntiCampArti doArtilleryFire [_unitPos, _ArtiAmmo, 1];
            hint format [ "%1", name _unit];
        }
        else { };
    };
};    

}];``` i already tried init, initoplayerlocal, initserver

verbal saddle
#

initPlayerLocal.sqf will run on every client when the join the server. How did you add that to your initPlayerLocal?

quartz oracle
#

just pastet th lines in

#

but doesnt work

astral dawn
#

if you want to make one or multiple remote machines execute something, use remoteExec or remoteExecCall

quartz oracle
#

it is just one arti who should fires on all player who are too long on the same position

minor needle
#

MPRespawn doesnt sound like the correct event for that

#

Got another issue myself

#
addMissionEventHandler ["HandleDisconnect", {
    _unit = _this select 0;
    _UID = _this select 2;

    _gear = getUnitLoadout _unit;

    _persistentDB = ["new", _UID] call OO_INIDBI;

    ["write", ["Player Info", "Gear", _gear]] call _persistentDB;
}];
#

Never fires

#

No error message, it just never happens

#

Its in initServer.sqf where it supposedly belongs

quartz oracle
#

i now pastet the code into onPlayerRespawn ```[_this select 0] spawn {
_unit = _this select 0;
_UnitIsInSpawn = false;
_unitPos = getpos _unit;
_OldUnitPos = [9999, 0, 9999];
while {!_UnitIsInSpawn} do
{
_OldOldUnitPos = _OldUnitPos;
_OldUnitPos = _unitPos;
sleep 5;
_unitPos = getpos _unit;
_ArtiAmmo = getArtilleryAmmo[AntiCampArti] select 0;

    if((((_unitPos distance _OldUnitPos) + (_OldUnitPos distance _OldOldUnitPos)) / 2 <= 1000)) then
    {
        AntiCampArti doArtilleryFire [_unitPos, _ArtiAmmo, 1];
        hint format [ "%1", name _unit];
    }
    else { };
        };

};```this code i deletet the event handelr

lone dagger
#

is there a way to rerun the init on an object?

tough abyss
#

That aircraft camera is shite why would anyone want to repeat it?

#

Plane looks like RscPicture at the bottom of the screen

violet warren
#

Is there a maximum length for ropes? I can't seem to create one longer than 100m

cobalt charm
#

Trying to get better at scripting, and wanted to know if the following is possible...
I want to check if 2 array constrains the same things, NO MATTER the order.
So ["1","2","3"]; would be the same as ["3","2","1"] and would return true.
Been trying to use BIS_fnc_areEqual but that also check the order

still forum
#

yes

#

arrayIntersect smth

knotty arrow
#

anyone is using armadev app for visualstudio code?

cobalt charm
#

That wasn't quite it

still forum
cobalt charm
#

It's strings

still forum
#

ACE arsenal is a different arsenal, thus different eventhandler which needs cba

#

I thought using CBA XEH, but turns out not needed in this case

drowsy axle
#

Could someone be very nice and explain event handlers? and yes, I'm looking at the wiki.

#
this addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    
}];``` What is `this` in terms of: if I was to have the player shoot an entity. Would the player or the entity, be `this`?
minor needle
#

Sounds like it needs to be attached to the entity, if you want to avoid that you could use EntityKilled

drowsy axle
#

What about this? sqf allUnits addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; if (_killer isEqualTo player) then { player getVariable ["money", 0]; private _cost = 50; private _balance = _money + _cost; player setVariable ["money", _balance, false]; }; }];

minor needle
#

I'm not sure if thats more effective than simply using a addMissionEventHandler

#

mission event handler with entitykilled simply triggers whenever something is killed, allunits EH will be attached to every single unit

drowsy axle
#

Okay.

#

Why would I be getting: scalar NaN error with _balance: ```sqf
{
_x addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (_killer isEqualTo player) then {
_killer getVariable ["money", 0];
private _cost = 50;
private _balance = _money + _cost;
_killer setVariable ["money", _balance, false];
hint format["%1, has now got a balance of: %2",name _killer,_balance];
};
}];

} forEach allUnits;```

minor needle
#

Whats the false doing there?

drowsy axle
#

making it ~not~ public

robust hollow
#

you never define _money in that event

drowsy axle
#

oh shit....

#

lol

minor needle
#

Oh lol

drowsy axle
#

Would this satisfy it? ```sqf
{
_x addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (_killer isEqualTo player) then {
private _money = _killer getVariable ["money", 0];
private _cost = 50;
private _balance = _money + _cost;
_killer setVariable ["money", _balance, false];
hint format["%1, has now got a balance of: %2",name _killer,_balance];
};
}];

} forEach allUnits;```

leaden summit
#

Hey if I do sqf _closeguys = nearestObjects [player, ["Man"], 50]; is there an easy way to parse out group leaders from the _closeguys array?

drowsy axle
#

OMG.... it works.... fuck yes mate!

#

Thanks a bunch: @minor needle / @robust hollow

minor needle
#

_closeguys = _closeguys - ['B_Soldier_SL_F']; should work?

leaden summit
#

I can't guarantee the classname of the group leader though

minor needle
#

Ah

robust hollow
#
nearestObjects[player, ["Man"], 50] select {_x isEqualTo (leader group _x)};

something like this maybe?

leaden summit
#

Ok cool I see where you're going,

drowsy axle
#

How would EntityKilled and Killed be different @minor needle ? I can see your logic of it's use.

#

nvm

minor needle
#

Killed is an eventhandler you attach to every unit entitykilled is more like a watchdog

drowsy axle
#

Found it

minor needle
#

They both work, and I'm not sure about the performance difference and if it even matters, it just seems like entitykilled is more efficient

#

Also consider _killedSide = (side group _killed);
if (_killedSide == east) then etc. ๐Ÿ˜…

#

I wrote something pretty similar just recently, except with xp and levels instead of money

drowsy axle
#
addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if (_killer isEqualTo player) then {
        private _money = _killer getVariable ["money", 0];
        private _cost = 50.00;
        private _balance = _money + _cost;
        _killer setVariable ["money", _balance, false];
        systemChat format["%1, has killed: %2. Faction has gained: ยฃ%3", name _killer, name _unit, _cost];
        systemChat format["Current Faction Balance is: ยฃ %1",_balance];
    };
    if ((side _unit) isEqualTo west || (side _unit) isEqualTo civilian) then {
        private _money = _killer getVariable ["money", 0];
        private _cost = 100.00;
        private _balance = _money - _cost;
        _killer setVariable ["money", _balance, false];
        systemChat format["%1, has killed: %2. Faction has lost: ยฃ %3", name _killer, name _unit, _cost];
        systemChat format["Current Faction Balance is: ยฃ %1",_balance];
    };
}];```
minor needle
#

You'll wanna check the side on the first if case too otherwise you reward 50 and then subtract 100

drowsy axle
#

hmm. Sometime's it is defining the dead units as Civilian... when they where east.

#

Fixed it by placing the side check first. sqf addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator", "_useEffects"]; if ((side _unit) isEqualTo west || (side _unit) isEqualTo independent) then { private _money = _killer getVariable ["money", 0]; private _cost = 100.00; private _balance = _money - _cost; _killer setVariable ["money", _balance, false]; systemChat format["%1, has killed: %2. Faction has lost: ยฃ %3", name _killer, name _unit, _cost]; systemChat format["Current Faction Balance is: ยฃ %1",_balance]; }; if (_killer isEqualTo player) then { private _money = _killer getVariable ["money", 0]; private _cost = 50.00; private _balance = _money + _cost; _killer setVariable ["money", _balance, false]; systemChat format["%1, has killed: %2. Faction has gained: ยฃ%3", name _killer, name _unit, _cost]; systemChat format["Current Faction Balance is: ยฃ %1",_balance]; }; }];

#

oh wait

#

lol

#

fuck me

vapid drift
#

Are there any invisible objects that are affected by physics?

drowsy axle
#

@vapid drift What do you mean by invisible?

vapid drift
#

not visible by players?

minor needle
#

That would be pretty inefficient by the engine if that existed

drowsy axle
#

Well. you can make texture's hidden, that would be able to be physics

vapid drift
#

So nothing natively then?

drowsy axle
#

no

vapid drift
#

alright, thanks

drowsy axle
#

@minor needle Does this make sense? ```sqf
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
switch (side _unit) do {
case west : {

    };
    case east : {
        
    };
    case independent : {
        
    };
    case civilian : {
        
    };
};

}];```

minor needle
#

Hm no, you dont need to check the side of the killer

#

Only the killed

drowsy axle
#

Ah true.

#

So just above ^

minor needle
#

And probably compare side _unit with side _killer so you dont reward tking

#

Assuming east and west are both playable factions

drowsy axle
#

it's just fool proofing it. ๐Ÿ˜ƒ It's intended as just blufor.

minor needle
#

Ah ๐Ÿ™‚

drowsy axle
#

Might as well do it this way. So it doesn't matter what side the player is on.

#

So... I don't understand.

minor needle
#

What dont you understand?

drowsy axle
#

if (side _killer isEqualTo west) then {};

#

is this what you mean by compare?

minor needle
#

No I mean if (side _killer isEqualTo side _unit) then {};

#

I think the syntax is side group, not sure if just side works too

drowsy axle
#
addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    switch (side _unit) do { 
        case west : {
            if (side _killer isEqualTo side _unit) then {
                private _money = _killer getVariable ["money", 0];
                private _cost = 100.00;
                private _balance = _money - _cost;
                _killer setVariable ["money", _balance, false];
                systemChat format["%1, has killed: %2. Faction has lost: ยฃ %3", name _killer, name _unit, _cost];
                systemChat format["Current Faction Balance is: ยฃ %1",_balance];
            } else {
                private _money = _killer getVariable ["money", 0];
                private _cost = 50.00;
                private _balance = _money + _cost;
                _killer setVariable ["money", _balance, false];
                systemChat format["%1, has killed: %2. Faction has gained: ยฃ%3", name _killer, name _unit, _cost];
                systemChat format["Current Faction Balance is: ยฃ %1",_balance];
            };
        };
        case east : {
            
        };
        case independent : {
            
        };
        case civilian : {
            
        };
    };
}];```
minor needle
#

yea pretty much

drowsy axle
#

Kay.

minor needle
#

Oh also

#

if (isplayer _killer) dont forget that

#

Otherwise you reward the money to every player of the faction for a kill

#

I think

#

Or maybe not, idk

#

Good to have it in anyway otherwise you run unnecessary code on everyone when it only needs to run on one person

drowsy axle
#

Well I want it on each person... as each person kills to add money

#

to the faction

minor needle
#

Then you shouldnt reward money to _killer but faction _killer

#

or side _killer to stick with the syntax

drowsy axle
#

ah right

#

true

#

side _killer doesn't work.

minor needle
#

either side group _killer or faction _killer?

drowsy axle
#

It's faction...

minor needle
#

o yea that works lol

drowsy axle
#

The _balance is sometimes undefined.... wtf man lol

#

Had to `diag_log it: 2:23:20 "Chrystophoros Moraiti, has killed: Abdul-Basir Bahadur. Faction, GUER. has gained: ยฃ50" 2:23:20 "Current Faction Balance is: ยฃ scalar NaN" 2:23:22 "Michalis Lara, has killed: Abdul-Qadir Amin. Faction, GUER. has gained: ยฃ50" 2:23:22 "Current Faction Balance is: ยฃ scalar NaN" 2:23:22 "Michalis Lara, has killed: Idris Nazari. Faction, GUER. has gained: ยฃ50" 2:23:22 "Current Faction Balance is: ยฃ scalar NaN" 2:23:22 "Michalis Lara, has killed: Farid Habibi. Faction, GUER. has gained: ยฃ50" 2:23:22 "Current Faction Balance is: ยฃ scalar NaN"

#

oh that's just me...

#

nvm

minor needle
#

Looks like its always undefined

drowsy axle
#

I didn't change _balance... to _cost

#

fml

minor needle
#

Why _cost?

#

Heres mine if thats any help lol

#

Though I initialize all the variables in an inidbi function

drowsy axle
#

I'm having an issue defining this variable.sqf _money = eastMoney getVariable ["money", 0]; diag_log format["Current Faction Balance is: ยฃ%1",_money];

minor needle
#

The variable needs to be attached to an entity I believe

drowsy axle
#

It is. a Game Logic

minor needle
#

hm

drowsy axle
#

Made it into peeps. let me see

#

Nope

#

Doesn't log anything in the RPT

minor needle
#

,0 ended up giving me "false" in my inidbi, try initializing it with setvariable

#

Just to debug

#

Before you do getvariable

drowsy axle
#
                private _money = eastMoney getVariable ["money", 0];
                private _cost = 50.00;
                private _amount = _money + _cost;
                eastMoney setVariable ["money", _amount, false];
                diag_log format["%1, has killed: %2. Faction, %3. has gained: ยฃ%4", name _killer, name _unit, side _killer, _cost];
                _money = eastMoney getVariable ["money", 0];
                diag_log format["Current Faction Balance is: ยฃ%1",_money];```
#

Why don't I just have the Variable...

#

and define it..

minor needle
#

I have a feeling it assumed a boolean data type if you pass 0 as default since that never worked for me either

drowsy axle
#

maybe.

#
addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    switch (side _unit) do { 
        case west : {
            if (side _killer isEqualTo side _unit) then {
                private _money = westMoney;
                private _cost = 100.00;
                private _amount = _money - _cost;
                westMoney = _amount;
                diag_log format["%1, has killed: %2. Faction, %3. has lost: ยฃ%4", name _killer, name _unit, side _killer, _cost];
                diag_log format["Current Faction Balance is: ยฃ%1",westMoney];
            } else {
                private _money = westMoney;
                private _cost = 50.00;
                private _amount = _money + _cost;
                westMoney = _amount;
                diag_log format["%1, has killed: %2. Faction, %3. has gained: ยฃ%4", name _killer, name _unit, side _killer, _cost];
                diag_log format["Current Faction Balance is: ยฃ%1",westMoney];
            };
        };
        case east : {
            if (side _killer isEqualTo side _unit) then {
                private _money = eastMoney;
                private _cost = 100.00;
                private _amount = _money - _cost;
                eastMoney = _amount;
                diag_log format["%1, has killed: %2. Faction, %3. has lost: ยฃ%4", name _killer, name _unit, side _killer, _cost];
                diag_log format["Current Faction Balance is: ยฃ%1",eastMoney];
            } else {
                private _money = eastMoney;
                private _cost = 50.00;
                private _amount = _money + _cost;
                eastMoney = _amount;
                diag_log format["%1, has killed: %2. Faction, %3. has gained: ยฃ%4", name _killer, name _unit, side _killer, _cost];
                diag_log format["Current Faction Balance is: ยฃ%1",eastMoney];
            };
        };
    };
}];```
minor needle
#

eastMoney is an entity I dont think thats gonna work

#

and westMoney

drowsy axle
#

ffs lol

#

Stil doesnt work.. ๐Ÿ˜ฆ

#

oooo

#

the dead peeps are returning as civilian....

minor needle
#

in your init.sqf try initializing westMoney with westMoney setVariable ["money", 0];

drowsy axle
#

I'm gunna sleep and try again tomorrow. ๐Ÿ˜ƒ

minor needle
#

Might be a good idea

#

Its like 4 am here so I'm not at my brightest either lol

#

Could just give you all my stuff and let you figure out how it works

drowsy axle
#

xD

minor needle
#

We're basically doing the same thing anyway except mine works

#

:x

drowsy axle
#

damn son...

#

mine DID work ๐Ÿ˜›

#

YOU broke it... probably on purpose ๐Ÿ˜‰

minor needle
#

you suddenly figured you wanted the money faction wide and then everything broke and I cant tell u why

drowsy axle
#

oh shit...

#

it's SP...

#

fuck my life

#

That is why

minor needle
#

I dont think that matters

#

If you assign the money to an entity

drowsy axle
#

Well how player SetVariable

#

works

#

and another thing doesn't?

minor needle
#

Whatever game logic you added isn't an MP feature though

drowsy axle
#

true.

#

hmmm

#

anyway, have a good one.

minor needle
#

Yea you too, good luck tomorrow ๐Ÿ˜…

verbal saddle
#

I did some testing and this works all you need is an object/game logic called MoneyLogic to hold the money variables

addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    _sUnit = side group _unit;
    _sKill = side _killer;
    switch (_sKill) do { 
        case west : {
            if (_sUnit isEqualTo west) then {
                private _money = MoneyLogic getVariable ["westMoney",0];
                private _cost = 100;
                private _amount = _money - _cost;
                MoneyLogic setVariable ["westMoney",_amount, true];
            } else {
                private _money = MoneyLogic getVariable ["westMoney",0];
                private _cost = 50;
                private _amount = _money + _cost;
                MoneyLogic setVariable ["westMoney",_amount, true];
            };
        };
        case east : {
            if (_sUnit isEqualTo east) then {
                private _money = MoneyLogic getVariable ["eastMoney",0];
                private _cost = 100;
                private _amount = _money - _cost;
                MoneyLogic setVariable ["eastMoney",_amount, true];
            } else {
                private _money = MoneyLogic getVariable ["eastMoney",0];
                private _cost = 50;
                private _amount = _money + _cost;
                MoneyLogic setVariable ["eastMoney",_amount, true];
            };
        };
    };
    _eastBal = MoneyLogic getVariable ["eastMoney",0];
    _westBal = MoneyLogic getVariable ["westMoney",0];
    systemChat format["Current Faction Balances are: WEST:%1  EAST:%2",_westBal,_eastBal];
}];
radiant needle
#

What is the best way to end a mission on a server without an actual mission complete or mission failed screen

west venture
#

As admin, type #missions to go straight to missions list?

#

It might be a good idea to get an admin tools mod for this sort of thing

radiant needle
#

I was thinking more script wise

#

Basically I'm having a custom end screen using cameras and text and stuff

west venture
#

So it's not actually ending the mission, just going through a cinematic sequence (and then coincidentally ending the mission).
Never touched this before, but it's been possible since OFP, so good luck

radiant needle
#

Well it is ending the mission in the sense that everyone should be booted back to lobby. But currently the only options for BIS_fnc_endMissionServer come up with their own cinematics and WIN or LOSE

frozen knoll
#

just run endMission after your custom screen has displayed what you want it to

#

Local command

radiant needle
#

That still pulls up a "Mission Completed" screen

frozen knoll
#

serverCommand kick then ?

still forum
#

@drowsy axle What is this in terms of: if I was to have the player shoot an entity. Would the player or the entity, be this?
The eventhandler is "Has been killed" not "has just killed someone else". Thus this is the guy that will be killed.
What about this? addEventHandler doesn't take array.
Why would I be getting: scalar NaN error with _balance because _money is undefined.

#

(Oops accidentally pressed enter)
Would this satisfy it? yeah. But _killer setVariable ["money", _balance, false]; the false at the end is useless.
Fixed it by placing the side check first. not really, now you subtract 100 and then add 50. That's the same as adding 100 and subtracting 50.
Otherwise you reward the money to every player of the faction for a kill no.
I have a feeling it assumed a boolean data type if you pass 0 no, but the variable might already be defined as boolean

@radiant needle I think just calling endMission serverside, not the bis fnc.

radiant needle
#

cool manually calling Achilles_fnc_suppressiveFire on a loop with randomized firemode and randomized target selection creates an awesome effect

#

Also full auto M107s are ridiculous

lost copper
#

Hi everyone! How i can add compatibility with JIP into my function? Function is defined in CfgFunctions class.

astral dawn
#

What do you mean? I don't think you need to do anything to make them compatible with JIP executions o_O or am I wrong?

still forum
#

correct. you don't

lost copper
#

Hmm. I have a function, which creates teleport points on the map. It looks like a object with "Land_InfoStand_V1_F" classname and i add actions by addAction function to all of them. So i want to create this objects in postInit, but every JIP player can't see actions on teleports ๐Ÿ˜ซ

astral dawn
#

You are supposed to do addAction to your object on JIP. I mean you should remoteExec your addAction on all computers with a JIP flag.
But I don't quite get what you are currently doing. nvm i think i've got this

lost copper
#

So if i add actions with remoteExec - is it a good idea?

astral dawn
#

That's how you typically do it. Remote exec your addAction globally with a JIP flag.

lost copper
#

Ok, i try to do that. Thank you ๐Ÿ™‚

radiant needle
#

So I have this

                if ((typeName _FireMode) == "ARRAY") then {_FireModeSelect = selectRandom _FireMode} else {_FireModeSelect = _FireMode};
                systemChat (typeName _FireMode);
#

systemChat is ARRAY

#

but yet _FireModeSelect is undefined

#

when I systemChat _FireMode I get [0,1,1,2,2,2] which is correct

robust hollow
#
_FireModeSelect = if ((typeName _FireMode) == "ARRAY") then {selectRandom _FireMode} else {_FireMode};

try that

radiant needle
#

That seems to work, thanks

peak plover
#
[] isEqualType []
#

@robust hollow

#

use the proper way

robust hollow
#

I'm just fixing the problem before optimizing anything, seems easier to see mistakes that way instead of trying to tell optimization apart from what fixed the script ๐Ÿคท

peak plover
#

It's not even optimizing, it's using an out dated method

#

just do it the right way

#

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

astral dawn
#

Is there some vehicle seat ID which works both with driver, gunner, turret, cargo seats? assignAs..., moveIn... commands are not convenient to work with, because cargo have their ID, turrets have their path, also driver and gunner are special >_< Maybe I am missing something?

drowsy axle
#

Thank you @verbal saddle

ruby breach
#

You could also do ```sqf
//Ignore this, I'm retarded
//[_FireMode, selectRandom _FireMode] select (_FireMode isEqualType []);

verbal saddle
#

๐Ÿ‘

still forum
#

But that will only work if firemod is array

#

and then.. it doesn't really make sense to select at all does it?

ruby breach
#

Personal preference over an if-then-else to see if it's an array or not an array

still forum
#

Yeah.. But this only works if it is an array

#

It's syntax error if not

ruby breach
#

Ahhh, my bad. Didn't realize the selectRandom ran even if not chosen. My dumb

#

What I get for only checking halfway before posting

still forum
#

you could wrap code and do call.. but that's probably worse than the if

tough abyss
#

If i close a gate, a gate with a single door, and when it is half closed (half done animation) i run this code ```_gateObj animateSource ["Door_1_sound_source",1,true]; //Instantly open the gate
_gateObj animateSource ["Door_1_sound_source",0]; //close the gate

astral dawn
#

Are you allright? @viral canyon

winter rose
#

I wouldn't even blame a catโ€ฆ maybe an octopus ๐Ÿ˜„

viral canyon
#

sorry cat was walking on my keyboard...

winter rose
#

@viral canyon tell us the truthโ€ฆ you host an octopus, don't you?

viral canyon
#

nope one of my gf's cat's comes in my room looking for food at night walks over my keyboard knocks down my cup and everything

winter rose
#

the mixer remains an option

astral dawn
#

As I recall there was a program which can tell if a cat is walking on your keyboard.

winter rose
#

โ˜ yes ๐Ÿ˜„

astral dawn
#

So we can feed it with the string and we will find out if it was a cat or not ๐Ÿค” Sadly the message is gone

neon snow
#

Can we somehow animate turrets via script?

astral dawn
#

What the hell... ๐Ÿคฆ
Executing fullcrew [cursorObject, "", true] on a base game static HMG I get this: [[<NULL-object>,"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],false]] as if it has a driver
Getting value from config configFile >> "cfgVehicles" >> "B_GMG_01_high_F" >> "hasDriver"; I ge 0, like it doesn't have a driver
...

austere granite
#

statics are special like that

#

UAVs too i believe

#
    private _allSeats = fullCrew [_vehicle, "", true];

    if (count _allSeats > 0) then {
        if (unitIsUAV _vehicle) exitWith { }; // -- lol

        _menuOptions pushBack [
            1,
            "Get in",
            { [_this select 0, _this select 1] call FUNC(getInAvailable) },
            { [_this select 0, _this select 1, "ANY"] call FUNC(canEnterSeat) }
        ];

        if !(_isStaticWeapon) then {
            {
                _x params ["_role", "_priority"];
                private _roleName = _role;

                private _seatExists = ({ _x select 1 == _role } count _allSeats) > 0;
                if (_role == "driver") then { // Workaround for some things having a driverSeat, although there isn't actually one
                    _seatExists = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "hasDriver") > 0;
                    if (_vehicle isKindOf "Air") then { _roleName = "pilot"; };
                };

some random code related to that

#

same config lookup in there ๐Ÿ˜ƒ

astral dawn
#

FUNC(getInAvailable) what are you doing here? ๐Ÿ™„

still forum
#

That is what's called a "macro"

#

I guess you meant "what are you doing in there" ?
(Discord doesn't let me edit :U)

astral dawn
#

I meant 'what does this macro expand to' ๐Ÿ˜„

still forum
#

mod_module_fnc_getInAvailable usually

languid tundra
#

or mod_fnc_module_functionName if you want to use BI's function framework ๐Ÿ˜‰

astral dawn
#

thx. thought might be something more interesting

compact maple
#

Hello, how can I set this texture "fresnel" to a vehicle ? thank you
#(ai,64,64,1)Fresnel(1.3,7)

#

mb I figured it out

tough abyss
#

@neon snow yes and no

neon snow
#

I found a way on the forums. The way is to define animations for Maingun and turret with sources "turret_maingun" and "turret_main" and then anims with same selection but user sources. In the config define AnimationSources and it works(just cant define this in turret as it will override defined sources) :

//body="mainturret";
//gun="maingun";
//animationSourceBody="gunnerCameraRotX_source";
//animationSourceGun="gunnerCameraRotY_source";

But what do you mean by yes and no?

tough abyss
#

In UGV you can in a tank you canโ€™t

neon snow
#

I did it in copilot seat in jet, dont know why it works then

young current
#

anyone on the seat?

neon snow
#

Yep

young current
#

AI?

neon snow
#

no, player

young current
#

hmm recalled it did not work for the player

#

maybe it did

neon snow
#

can post turret config if you like

young current
#

well sure. I did mess around with it a year back or so with my walker torso

#

not sure if I ended up using that method tho

neon snow
#

I wanted to add pilotCamera for copilot but since it isnt possible we had to use normal turret

languid tundra
#

Is there a way to draw circles in 3D or is a polygon via drawLine3D the only feasible approach?

tough abyss
#

could always draw icon3d with circle

languid tundra
#

Well, an icon will keep its orientation, which is undesired.

astral dawn
#

If nothing else works you can make multiple icon pictures with different orientations

#

But it'll look ugly, rotations will be in too big steps

nocturne basalt
#

hi guys. is it possible to set a "time to live" value when using createVehicle or createVehicleLocal? I'd like them do be deleted after a period of time and I want to avoid spawning a script thats sleeps before it deletes them if its possible

astral dawn
#

Never heard of such feature. Probably you'll have to rely on some scripted solution.

nocturne basalt
#

yeah ok

astral dawn
#

You can spawn one script which will sleep for 10 seconds or more, then check which vehicles have reached their timeout threshold

#

having one script suspended is fine, having a hundred suspended is probably not so good ๐Ÿคท

languid tundra
#

Would take a lot of pictures to capture all orientations, but you got me an idea. In principle one could place a RscPicture of a filled circle on the screen and resize it accordingly.

nocturne basalt
#

yeah I've done it like that before. I dont like having lots of running scripts like that

#

I spawning footprint objects

languid tundra
#

Wait, ofc

#

You can resize icons as well ๐Ÿ˜„

astral dawn
#

What accuracy of your timeout do you need? Probably 2 minutes or more is going to be fine? If your script is sleeping for 99.999% of your time, its impact is around zero. Probably you can attach other non-frequent checks to such 'timer' script as well if you have them. @nocturne basalt

nocturne basalt
#

Im running a loop that controls walking animations of a bipedal walker. Im spawning cracks in the road for each step. I guess I can store all objects in an array and delete the oldest between each cycle ๐Ÿค”

#

keeping 20 before they are deleted maybe

#

only problem then is if the script is terminated, I will loose track of all the roadcrack objects

astral dawn
#

Wow ๐Ÿ˜„ Probably that's best, yes. If you examine how bullet holes behave in some video games, that's how they work.

#

Good idea. Just have a fixed amount of cracks shared by all walkers?

nocturne basalt
#

hmm.. using a global counter you mean?

languid tundra
#

one that cycles with modulo operation

astral dawn
#

Something like this, yes. You have an array of them. And a counter 'next object to use'. When you take an object, you do counter++ and handle its overflow. Or use the % operator which is the same.

tough abyss
#

@nocturne basalt Just add trigger with timeout

createTrigger ["EmptyDetector", [0,0,0], false] call { _this setTriggerTimeout [TIMEOUT,TIMEOUT,TIMEOUT,false]; _this setTriggerStatements ["true", "deleteVehicle thisTrigger; deleteVehicle CAR", ""] }; 
astral dawn
#

Considering that he needs to spawn cracks on the road for his bipedal walker, maybe he could use the arma's mechanisms of making bomb explosions, bullet holes, etc, just with a custom texture?

tough abyss
#

it is easier to delete from front and add to back

#

_el = arr deleteAt 0; arr pushBack _el;

languid tundra
#

Would be surprised when it's faster than with a cyclic counter, but it's SQF ๐Ÿ˜„

#

Shouldn't be an issue if you put the part in unscheduled.

#

hmm, how about putting the critical part in isNil {} or using CBA_fnc_directCall for more readability?

queen cargo
#

There is no real race conditions in sqf...

languid tundra
#

Are you sure about that?

astral dawn
#

in scheduled there are

languid tundra
#

exactly

astral dawn
#

well from engine's point of view there are not ๐Ÿ˜„ but from my code's there are, so ๐Ÿคท

languid tundra
#

lol

queen cargo
#

Engine is running sqf only in one thread
So yes, no real race conditions

languid tundra
#

But asynchronous programming has many properties that you also have with multithreading...

astral dawn
#

I could argue that there is no race condition in my single core processor because it executes one stream of instructions... race condition is in code, not in in processor itself, I think.
Oh well, I think we've been arguing about schedulers so much lately, I should go to bed.

languid tundra
#

Well, we do have multiple threads when we take multiple clients into account.

astral dawn
#

Indeed, the remote computer is asynchronous to your code.
Synchronization is an interesting topic. As I've learned, in chip design it's even more important. The difference is, in integrated circuits events happen at insane frequency (at clock rate) compared to our typical event rate in our code. So average time between race conditions is much lower, so chip can work for milliseconds and then lock up or smth like that, while our multithreaded code can potentially run for seconds...hours until breaking.

leaden hill
#

can someone please explain why

1 hour real life time isEqualTo 10_mins_scripting || gaming;
languid tundra
#

Is this a question mixed with SQF syntax? ๐Ÿ˜„

winter rose
#

@leaden hill and why when at work, you close your eyes for 5 minutes and only 30s were spent? I assure you, it's all a big plan from corporationsโ€ฆ

#

(my personal theory: I don't see weekends' mornings because they shorten my days off so I get back to work faster)

drowsy axle
#

Hey guys, does anyone know why this won't work?

#

The objects get deleted... but they're not created again.

robust hollow
#
    _x params ["_classname","_position"];

line 76
you dont use _x so its essentially doing _this params ...

ruby breach
#

Also, why set so many broadcasted variables to nil when if you don't do that they're nil anyway? (you're also missing a } there, so that's broken anyway.)

robust hollow
#

yea, that inner foreach would be trying to set objNull as a variable name too.

nocturne basalt
#

@tough abyss oh thats a nice approach. I was thinking.. Since Im spawning footprints on the ground, maybe its better to make a crater from a bomb explosion since it will fade out over time

#

Make a custom bomb with 0 damage, no sound and no explosion effects.

#

Or is it possible to spawn a bomb crater directly instead? ๐Ÿค”

high marsh
#

there are crater statics, not sure what you're looking for in specific.

nocturne basalt
#

I basically need to spawn a crater effect that fades away over time

#

so I cant use createVehicle for that approach

nocturne basalt
#

Seems spawning a bomb is the best way. Not only is it spawning a fadable footprint, but I will get smoke, sounds and shake from it aswell ๐Ÿ˜„ ๐Ÿ‘

thorn saffron
#

How to remove a weapon from a pylon by using a script?

halcyon hornet
#

What's the easiest way to add a check to a script that will turn off a sound if an user selects a user action in a vehicle?

#

Currently have this for a siren:

#

while {alive _vcl} do
{
    while {_vcl getVariable ['siren',0] == 1 && !isNull driver _vcl} do
    {
        if(!isNull driver _vcl) then {    
            _vcl say3D "Siren1";
            sleep 10;
        };
        if(!isNull driver _vcl) then {    
            _vcl say3D "Siren2";
            sleep 4;
        };
        if(!isNull driver _vcl) then {    
            _vcl say3D "Siren3";
            sleep 4;
        };
    };
    sleep 1;
};```
digital jacinth
#

So I am having rather bizarre issue right now. i am getting this error right now

Error in expression <diwako_dui_colors getVariable (assignedTeam player)>
  Error position: <getVariable (assignedTeam player)>
  Error getvariable: Type String, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location

diwako_dui_colors is a string, hence why it errors. However I not written such code anywhere in my mod. assignedTeam is written once in the whole mod and it is this part

private _assignedTeam = assignedTeam _x;
private _color = _colorNameSpace getVariable [_assignedTeam, "#FFFFFF"];
_x setVariable ["diwako_dui_color", _color];

private _compassColor = _colorNameSpace getVariable [(format ["%1_compass", _assignedTeam]), [1,1,1]];
_x setVariable ["diwako_dui_compass_color", _compassColor];
#

it is being read and applied to a control later like this

if (_distance > 3 || {vehicle _unit == vehicle _player || {_unit == _player}}) then {
    _color = + (_unit getVariable ["diwako_dui_compass_color", [1,1,1]]);
};
_color pushBack _fade;
_ctrl ctrlSetTextColor _color;
#

I have no idea how arma coobles together the code that errors, anyone knows what the cause could be?

#

oh yeah, teh variable in question is used in this context

private _colorNameSpace = missionNamespace getVariable format["diwako_dui_color_%1", diwako_dui_colors];

it is for getting the correct namespace during runtime

still forum
#

diwako_dui_colors vs diwako_dui_color ?

digital jacinth
#

diwako_dui_color is nil and does not exist

still forum
#

it doesn't tell you which script file the error is in?

digital jacinth
#

nope

still forum
#

did you check script strings in ui configs?

digital jacinth
#

you mean for example onLoad in RSCs?

still forum
#

ye

digital jacinth
#

these use this "prefix" diwako_dui_Rsc also write a variable into uiNamespace instead

#

oh my god.i just found out why. I think I need an eye check

#

the error only happens when i pause the game to use watchers or the debug console

#

it was in a watcher and i am just an idiot

#

cue the Curb Your Enthusiasm Theme now

tough abyss
#

Add a eventhandler to all vehicles and cancel damage if a projectile is not defined (is equal to "") is what i'm trying now to "fix" Arma bug related to vehicle collision with objects.

astral dawn
#

What bug? @tough abyss Do you mean them colliding with everything?

#

You can attach this one to dammage event handler of units to make then receive no dammmage when some friendly tank decides to drive over them

private _unit = _this select 0; //: Object - Object the event handler is assigned to.
private _source = _this select 3; //: Object - The source unit that caused the 
private _instigator = _this select 6; //: Object - Person who pulled the trigger
if ((side _source == side _unit) && /*(_projectile == "") &&*/ (isNull _instigator)) then
{
    0
};
tough abyss
#

@astral dawn some player are ranting because their vehicles are trowed hundred meters away and explode or explode when they gentlly colide with some objects.

astral dawn
#

Oh yeah, like when someone's connection is bad and your vehicles glitch into each other, failing the whole mission ๐Ÿ˜„

lost copper
#

@astral dawn Arma space programm? ๐Ÿš€

astral dawn
#

@lost copper Why?

tough abyss
#

Year aready Ellon Musk.

#

Because it trow vehicles "into space".

astral dawn
#

Well yes except that everyone instantly dies xD before lithobreaking

tough abyss
#

@astral dawn use isNull _instigator is better than use _projectile == ""?

astral dawn
#

Honestly I don't remember, but i've spent a lot of time to figure out how to filter dammage when a car drives over a "human vehicle" a year ago or so, thought might be useful for you

tough abyss
#

Thanks

still forum
#

hooman

astral dawn
#

I have invented another useless macro:
#define RETURN
It reminds me of home C/C++ ... Gonna use it when I'm about to return something from my function call

still forum
#

Makes it more readable yeah.
ACE/CBA just leave away the semicolon on returns. You know that it has to be a return, cuz otherwise missing semicolon would error

queen cargo
#

i also created that macro but made it actually usable

astral dawn
#

Actually it made me think, maybe it's possible to make a return macro which will behave like the C return? So that it performs an exitWith, but on the nearest call {} block, no matter other if statements or loops?

queen cargo
#

unless one does #disablereturn

#

as it has some overhead

still forum
#

if (true) exitWith {value}

queen cargo
#

breakout

astral dawn
#

But it will break out the current while loop for example, not the most recent call {}

still forum
#

Or use exceptions ^^

astral dawn
#

Yes i've thought of a similar approach but I'd have to include such a header into every myFunc = {__header.hpp__ ... code ...}

queen cargo
#

There is no sorry to not using cfgfunctions

still forum
#

ACE/CBA has that in their compile functions, they just flip one macro and every compiled function get's a header which makes it possible to collect callstacks

astral dawn
#

Is there some workaround for not specifying the whole path in include, and make it work like in C?

queen cargo
#

yes

#

you just do it

astral dawn
#

Of course I could write a batch to copy every .hpp into every folder or something like that

queen cargo
#

#include "../" works was what i wanted to say

astral dawn
#

You mean #include "..\..\MyPreciousDefinitions.hpp", right?

queen cargo
#

for example

#

if you feel funny, you could create a "build" script that uses sqfvm to pre-parse those scripts for you

astral dawn
#

But sqf-vm will also follow arma's rules about #include paths?

queen cargo
#

yup

#

only thing is: you have to tell it where what stuff is

#

explained it once in the discord

astral dawn
#

I could do it like this:
Have one folder with my project
Have a batch that copies my project folder to a 'release' directory, plus finds all .hpp files in it and copies every hpp file into every folder of 'release'. 'release' is then what arma loads up. ...

#

But then SQDev will say 'I can't find these includes!'... oh well why is everything so painful in arma ๐Ÿ˜ฅ

queen cargo
#

mhh? why is sqdev saying that?

astral dawn
#

Well because if I develop my stuff in 'project' folder while the .hpp files are not copied to every directory, it won't be able to #include "myDefinitions" because they are at this point of time at "..\..\..\..\myDefinitions\myDefinitions.hpp", however arma will handle everything fine because I'll give it the 'release' folder where all the "hpp" files I have created are copied everywhere

unborn ether
#

@astral dawn Why not using a fixed location from root instead of bunch of ups from current folder like it is described within missionConfigFile (i suppose that is a mission structure you have)?

astral dawn
#

Do you mean, why don't I put all scripts in the root folder together with all .hpp files?

unborn ether
#

Ehm, no that's definitely not what I've meant

astral dawn
#

Then I misunderstand you

astral dawn
#

Yes I have a mission. Inside mission I have folders like, for example:

  • Location
  • AI
  • Message
    • Message.hpp
      AI and Location might have some other structure inside them. I might want to include Message.hpp inside scripts which are inside Location.
unborn ether
#

He did explain it pretty explicitly

#

You basically can __EXEC it within description.ext and then pick it with whatever SQF or pre-processor after.

#

So it will be like:

...
#include ROOT/hpp/myConfig.hpp
...

Since any variable declared with __EXEC is written to a parsingNamespace. So you can pick it up with __EVAL

#

If im not mistaken it's even gonna be looking like:

#
#include __EVAL(MISSION_ROOT/hpp/myConfig.hpp)
astral dawn
#

Hmm that's a good read, thanks

#

So you suggest that I use not relative #include path, but an absolute?

#

I didn't know that #include can do that. I thought that #include works only with a fixed string-path. I will try it.

#

It says on wiki:

Preprocessor does not support the use of macros for pre-defined file names.

#define path "codestrip.txt"
#include path //this will cause an error

Are you absolutely sure that it will work?

still forum
#

I have never seen that working

#

__EVAL and __EXEC are not preprocessor thingies I think?

#

They are in the config parser, not preprocessor

late gull
#

๐Ÿค”

unborn ether
#

I think because #define has lesser priority, so #include is in priority. Not sure of that now.

#

Gonna try it myself now.

astral dawn
#

Thanks!

unborn ether
#

Yep, it seems #include doesn't like eating __EVAL after it. Pity.

#

So this is only useful for absolute path inside SQF only, my bad.

queen cargo
#

would have surprised me if it was

astral dawn
#

Np, thanks for trying out anyway ๐Ÿ‘

unborn ether
#

Well another sloppy workaround is to include bare mission path itself.

#

But this is where it gets nasty.

astral dawn
#

Yes, then I decide to rename my mission xD
I think my batch file idea is so far the best :p
Or X39 idea just to use the GCC preprocessor

queen cargo
#

๐Ÿคท yup

#

just strip preproc stuff away

#

is actually best solution to all quirks

vapid drift
#

Is there something insanely obvious I'm missing here?

playSound3D ["sounds\hum.ogg", this];```
Because it's not generating any sound. The file is in sounds/hum.ogg. The script is in a transformer object's init line
frozen knoll
#

is the sound defined?

vapid drift
#

Yeah, the sound plays with playSound

#

playSound "TFR_energyHum"

#

Just renamed it for simplicity sake:

class CfgSounds {
    sounds[] = {};

    class TFR_energyHum {
        name="tfr_energyhum";
        sound[] = { "sounds\tfr_energyhum.ogg",1,1.0 };
        titles[] = { 0, "" };
    };
};```

`playSound "TFR_energyHum"` still works, `playSound3D ["sounds\tfr_energyhum.ogg", this];` does not. Tried swapping `this` with `player` just for testing purposes... that doesn't work either
frozen knoll
#

see example 3

astral dawn
frozen knoll
#

@vapid drift

myClient_ROOT = call {
    private "_arr";
    _arr = toArray str missionConfigFile;
    _arr resize (count _arr - 15);
    toString _arr
};
#

you could put that in your init if you dont have something set already

vapid drift
#

ohhh ok, I don't think I've ever encountered this before. Thanks

frozen knoll
#

myClient_ROOT + "tsounds\tfr_energyhum.ogg"

#

so
playSound3D [myClient_ROOT + "tsounds\tfr_energyhum.ogg", this];

vapid drift
#

So something to keep in mind there is that init.sqf is executed AFTER init line on objects but I should still be able to call this from a script

frozen knoll
#

ive had no probs

vapid drift
frozen knoll
#

sorry didnt read above... im guessing your using map placed objects?

vapid drift
#

yeah