#arma3_scripting

1 messages · Page 157 of 1

patent goblet
#

Fix will appears in 2.18 patch or use performance branch, fix was pushed there too

frozen seal
#

oh so it's not out yet? The resolution date on the bug appears to be December 2023 o_0

#

oh well

granite sky
#

I suspect it's partial and there's a whole mass of bugs in there.

#

I'll check the RC though.

patent goblet
#

I suggest download current release Candidate and recheck

granite sky
#

huh, might actually be fixed

#

I guess that confirms that hideObject and setDamage 1 on terrain objects really are the same thing :P

#

Also this wasn't even a network sync issue.

#

huh, I subscribed to this back when you opened it.

frozen seal
#

good to know. Though I'm not gonna make my playerbase switch to the RC so the manual activation will have to suffice

#

I swear 60% of zeuses work is to babysit armas jank 😭

#

anyway, thank you everyone

covert oak
#

Has any one else had issues where dofire, commandfire, dotarget, dofire, etc. Only work when the group leader is within short range (i.e. <100m) of the target?

acoustic abyss
#

It's been a while since using missionEventHandlers.
I am trying to waterproof a tank (setWaterLeakiness does not help). So I tried:

_snorkeltank = addMissionEventHandler ["Drowned", {
    params ["_vehicle", "_drowned"];
    if  (_vehicle = mytank && _drowned = TRUE) 
    then {  
            onEachFrame {
                mytank setHitPointDamage ["hitengine", 0]
                }
    }
    else {
        onEachFrame {}
    };
}];

When running this in debug console, I get:

Error position: <= mytank && _drowned = TRUE) then {   
   onEachFrame { 
>
Error Missing )

Where would the closing parenthesis go?

granite sky
#

== not =. You shouldn't be using onEachFrame either, outside test code.

fleet sand
#

it would just be:

private _veh = vehicle player;
_veh setWaterLeakiness 0;
warm hedge
#

setWaterLeakiness does not help you say, but how it does not

leaden flare
#

Sorry yes I did post in the wrong channel. I moved it over to config_makers

warm hedge
#

You answered 0 out of my 3 questions, but sure

acoustic abyss
old owl
#

Didn't Bohemia just add a new command this year or something that allowed vehicles to be buoyant or immune to water damage?

#

Can't for the life of me remember it but I know I am not crazy. Might not be what he is asking tho I suppose.

acoustic abyss
#

I mean it's certainly possible I am not understanding something.

old owl
#

I think that they are correct that you would not need to loop that command and especially not onEachFrame however honestly kind of just knowledgeable regarding that command. Let me see if I can do a little bit of reading on it.

#

Might be able to use getWaterFillPercentage to make it better as not sure the rate it fills but perhaps something like this? My head right now kinda goes to the way I've seen people prevent drowning in the past which is by consistently setting the players oxygen via a loop.

while {surfaceIsWater} do {
  uiSleep 0.1;
  _vehicle setWaterFillPercentage 0;
};
#

Actually maybe doesn't even need to be set more than once?

_vehicle setWaterLeakiness 0;
_vehicle setWaterFillPercentage 0;

#

I should just stop yapping and open my editor but just cba rn haha

meager granite
#

Had a look at it, this indeed stops water leakinees, the number doesn't change

#

But engine still dies underwater

#

Looks like engine death is unrelated to water fill

fleet sand
meager granite
#

Simulation type?

fleet sand
#

for example on Tigris works but on any tank it dosent work.

acoustic abyss
#

Thank you for the investigation guys. I learned something.

fleet sand
meager granite
#
the vehicle is submerged below 'maxFord' for longer than 'waterResistance'
#

Looks like they meant maxFordingDepth

#

which is lower for tigris than for tanks for example

#

So water leakiness is unrelated to engine water damage

#

Probably should add a note to a scripting command

#

I didn't test but maybe leakiness affects how quickly floating vehicle will start drowning?

#

Also crew running out of oxygen?

#

I remember dedmen posted videos with a hummingbird when he made the commands

last cave
#

And if you set allowdamage false for your tank, then it will literally be a submarine on tracks hmmyes

hallow mortar
still forum
#

Things fixed in December, have indeed not been released yet

still forum
magic dust
#

does setShotParents works on rifle bullets? I tried

player addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    [_projectile, [objNull,objNull]]remoteexec ["setShotParents",2];
    [{_gunner=objNull;}]remoteExec ["call",2];
    systemchat str(getShotParents _projectile);
}];

but didnt work, maybe I messed up locality?

proven charm
south swan
#

remoteExec isn't instant, though

#

and [{_gunner=objNull;}]remoteExec ["call",2]; doesn't make sense, tbh

proven charm
#

it doesnt do anything, _gunner is set to null and then the variable is forgotten

south swan
#

just for example. I'd assume a "ping + 1 frame" delay before changes get propagated back from the server at best

#

well, seems to be couple of frames even on localhost

hallow mortar
#

setShotParents doesn't work properly on things like rifle bullets because they aren't global projectiles (i.e. server updates its copy but every machine has its own copy, and those others don't get updated). KK was going to look at it and see if it could be made to sync better, but I don't know if that actually happened in time for 2.18. (#arma3_feedback_tracker message)

still forum
#

There was some change for that. Maybe new parameter in createShot command?

ivory lake
#

theres a createShot command?

winter rose
winter rose
hallow mortar
ivory lake
#

ah I thought it was familar

#

it'd be especially nice if this wasnt server only as imo the main use case is for scripted ammo clientside and having a delay via network lag would make that worse

#

if security is a concern maybe only able to set VEHICLE INSTIGATOR to units local

still forum
#

Uh that's a nice idea, please put on ticket to not forgetto

ivory lake
#

will do

#

done

meager granite
#

Local instigator

#

Vehicle might not be (tank driven by another player)

ivory lake
#

true

minor viper
#

Anyone know how to make an ACE Arsenal interactable from further away? Can't find it in the frameworks bit of the website...

fair drum
minor viper
#

I was thinking with the ace interact if such a thing is possible

#

trying to make an arsenal that everyone can use without having to crowd in close around it

tulip ridge
opal zephyr
#

When using the BIS_fnc_exportEditorPreviews command, many of the items are halfway in the floor, does anyone know how to prevent this without modifying the model?

still forum
#

I'd expect it to use the objects bounding box, based on geometry lod

digital iron
#

I’ve had a really stupid idea and I wonder if it would actually work in theory

#

Could you attach an armoured plate to the front torso of a player

warm hedge
#

Yes

digital iron
#

As a physical object with penetration

#

To get an accurate armour system?

warm hedge
#

accurate armour? I don't even think so. But it can stop or maybe gets penetrated I guess

digital iron
#

By accurate I just mean accurate hit box

#

So that a bullet that hits the physical plate will be stopped but if it hits the guys shoulder or abdomen it will do appropriate damage

#

And then the actual vest could act as shrapnel protection/ Kevlar

warm hedge
#

Well, that means you want to build a system over an Arma damage system?

digital iron
#

As from my knowledge anything with armour hitboxes is either very difficult or impossible

#

So just attaching a physical plate object just in front of the player should work, as I know with ace and pretty sure even in vanilla bullets get slowed down/ do less damage after penetrating an object

warm hedge
#

Sounds like the goal is as complex as rewriting everything

digital iron
#

Literally just make plate object, attach it in front of player

#

Boom

warm hedge
#

Because let's say, Arma 3 human damage model is not that complex. They don't have a hitbox/hitpart only for a shoulder or a hand

digital iron
warm hedge
#

Then your wordings are too much overcomplicated. If you just want to attach a metal plate to a human body, you can

digital iron
#

It’s just that when you have an actual plate object, if the bullet hits the plate object it will either stop or slow down, however if it doesn’t hit the actual plate object it will do normal damage

digital iron
#

My idea is magic floaty armoured plate in front of player (probably aligned with vest itself)

#

When the magic floaty plate object is hit the bullet will slow down or stop

#

It’s mainly motivated by me not liking the fact that the shitty skeleton plate carrier from RHS that’s the size of a literal dinner plate is the best armour in the game

#

Would that work?

warm hedge
#

I don't even know what is the vest you mean, but sounds like what you really want to make is a Mod that mods RHS

digital iron
tulip ridge
#

Yes you can attach an object to a unit and it will block bullets if the bullet hits it; or penetrate the object if the bullet is fast enough, high enough caliber, etc

tulip ridge
#

Yes, because the bullet would be slowed down when if it penetrates though the object

#

Bullet damage is modified by its speed, and hitting a surface slows a bullet down

digital iron
#

Nicee

#

This hopefully shouldn’t be so hard to code

#

Btw are there any mods that add an actual armour plate object or do I have to model it myself?

tulip ridge
#

¯_(ツ)_/¯

#

You could at least just test stuff with vanilla objects, and add model(s) later

digital iron
#

This could be a pretty cool little mod if it works

#

I’m getting ahead of myself but theoretically I could make different materials for Kevlar, steel, amyloids etc

#

Btw this is what I was taking about

#

Btw does disabling simulation effect its penetration?

tulip ridge
#

Yes

digital iron
#

Good to know

#

It is working exactly how I hoped it would!!!

digital iron
#

It works!! I do have one question

#

How to I attach it specifically to the guys torso so it doesn’t just float in front of him

#

Like when he moves I want it to move with his torso

warm hedge
#

Check wiki article. It has a way

digital iron
#

Attach to relative isn’t really working

warm hedge
#

Not attachToRelative. attachTo

digital iron
digital iron
#

Because it’s not really doing that here

#

Like orientation wise

warm hedge
#

As I said attachTo can do it

digital iron
#

How do I make the orientation stay the same?

warm hedge
digital iron
#

Ahh I see what I missed

#

It works! I mean it’s a little scuffed as there’s a delay between the dude ragdolling and the plate moving but other than that it works as intended

#

How does the mod sound? A way to be able to pick different plates (steel, Kevlar, ceramic etc) and have them actually work, where bullets that hit the physical plate will either pass or not. Also allows way more freedom with armour as the plate itself isn’t an actual vest meaning people can make their own custom rigs and still have protection

digital iron
#

Btw @warm hedge why does attaching objects to your hand cause weird things to happen in first person? The most I’ve ever been told is ‘it’s an arma issue’ and then refusing to elaborate

warm hedge
#

"Weird things"?

digital iron
warm hedge
#

?

digital iron
#

From PIR for example

#

When you use attachTo to try and hold an object apparently you can’t fix it?

tulip ridge
tulip ridge
#

Like if you attach a gun in your left hand, you'd see the gun on top of your hand

warm hedge
#

If you mean render "issue", it is what it is. FPP model is always rendered into the first layer

digital iron
#

Is there any way to get around it?

tulip ridge
#

No

#

That's just how the engine renders it

#

I doubt there'd be some "setRenderLayer" command or something added, although that would be cool

true frigate
#

Just trying to work something out, I'm not too good with Arrays but I figured this would be the best way to store them in order to pull the variables later.

Currently, when the Volume EH is triggered, it will update indexes 1 and 2 in playerData - and vice versa.
I've tried to fix this by using the second script (New updatePlayerData), but it returns a generic error and I can't really see why, even after reading the "set" page on the wiki.

playerData = [];

updatePlayerData = { 
    private _playerID = _this select 0; 
    private _volume = _this select 1; 
    private _isSpeaking = this select 2;
    private _index = playerData findIf { _x select 0 == _playerID }; 
    if (_index != -1) then {
        playerData set [_index, [_playerID, _volume, _isSpeaking]]; 
    } else { 
        playerData pushBack [_playerID, _volume, _isSpeaking]; 
    } 
}; 

//Detect Volume Mode
["MyID", "OnSpeakVolume", { 
    _playerID = _this select 0; 
    _volume = _this select 1; 
    [_playerID, _volume, ""] call updatePlayerData; 
 
    // debug message because this shit WILL break 
    systemChat format ["%1 can be heard from %2 meters", _playerID, _volume]; 
}, _playerID] call TFAR_fnc_addEventHandler;

//Detect if Speaking
["MyID", "OnSpeak", {
    _playerID = _this select 0;
    _isSpeaking = _this select 1;
    [_playerID, "", _isSpeaking] call updatePlayerData; 


    systemChat format ["%1 Is currently speaking", _playerID]; 
}, _playerID] call TFAR_fnc_addEventHandler;```
New updatePlayerData
```sqf
updatePlayerData = { 
    private _playerID = _this select 0; 
    private _volume = _this select 1; 
    private _isSpeaking = this select 2;
    private _index = playerData findIf { _x select 0 == _playerID }; 
    if (_index != -1) then {
        playerData set [_index, [_playerID]]; 
        if (_volume != "") then {
            playerData set [1, _volume];
        };
        if (_isSpeaking != "") then {
            playerData set [2, _isSpeaking];
        };
    } else { 
        playerData pushBack [_playerID, _volume, _isSpeaking]; 
    } 
}; ```
#

Sorry for the wall of text, but if anyone has any ideas or can point me to some resource, I'd really appreciate it 🙂

granite sky
#

you have a missing underscore:
private _isSpeaking = this select 2;

true frigate
#

Good spot, apparently the update function is still broken though 😦

granite sky
#

It doesn't actually do anything, so I'm not sure how you define it as broken.

#

If it's generating a script error then paste that.

true frigate
#

Supposedly there's a Generic expression error in if (_volume != "") then {

#

That's what the log is outputting

#

I'm assuming I'm updating something incorrectly

granite sky
#

Second version seems completely wrong but I don't know why it'd generate a generic expression error.

#

Like playerData set [1, _volume]; is incorrect.

true frigate
#

Yeah I guess I'll have to redo it sadly then. The first update variable works, but like I said it just overwrites the other value with ""

granite sky
#

Probably does what you want, but I suspect there's something bad happening with the inputs:

updatePlayerData = {
    params ["_playerID", "_volume", "_isSpeaking"];
    private _index = playerData findIf { _x select 0 == _playerID };
    if (_index != -1) then {
        private _data = playerData select _index; 
        if (_volume != "") then { _data set [1, _volume] };
        if (_isSpeaking != "") then { _data set [2, _isSpeaking] };
    } else { 
        playerData pushBack [_playerID, _volume, _isSpeaking]; 
    };
};
true frigate
#

I think you must be right, just tried using this and it's returning both generic errors at if (_volume != "") and if (_isSpeaking != "").
Volume is a number of either 5, 20 or 60, and isSpeaking is a boolean, but I can't see how those differences would cause that error.

granite sky
#

uh. They certainly will.

#

== and != will throw errors if the type is incorrect.

true frigate
#

Ahhh I didn't know that. My fault man, sorry.

granite sky
#

I assumed they were strings because you were referring to them as strings :P

true frigate
#

Yeah I should've clarified from the start 😅

granite sky
#

You could use isEqualTo and isNotEqualTo instead.

#

or use nil and isNil "_volume"

#

I prefer the latter method but it's a style thing.

true frigate
#

Would that be an issue with how I'm calling the Update function too?
[_playerID, "", _isSpeaking] call updatePlayerData;

granite sky
#

well yes

#

So are you putting strings into playerData as well?

true frigate
#

And I assume that's because "" means a string. Damn

granite sky
#

Assuming that this is the only code that writes it.

#

"" is an empty string. "wibble" is a string with stuff in it.

true frigate
#

Yeah these EH's are the only updates to playerData, would I need to call the function with nil instead, then?

granite sky
#

actually that doesn't quite work because then the last line breaks.

#

you'd have to change it to playerData pushBack _this

true frigate
#

Took me an embarrasingly long time to work out the variable name had to be inside quotation marks

granite sky
#

SQF syntax makes a lot more sense once you understand the language. It's actually very simple which is why a lot of the syntax is wack.

#

like params ["_a", "_b"]; is just a unary command taking an array of strings.

true frigate
#

I'm now calling the function with [_playerID, _volume, nil] call updatePlayerData; and the updater is essentially what you've sent but with if (!isNil "_volume") then { _data set [1, _volume] }; and the final line you've said about.

It's working perfectly, so I'm assuming you've either been doing this for too long or you're some kind of wizard. kek

true frigate
still forum
#

May your SQF skills be sacred

sharp torrent
#
        if not ((group _x) in _excl) then 
            {
            _excl pushBack _x
            }
        }

Fragment of a code [HAL - modified version]...
Testing I managed to get exclude function working, but getting error:
Error Undefined variable in expression: _x
I know that _x is an object, not a group [code will not work if _excl pushBack (group _x).
Help please?

tulip ridge
#

You need to show more of your code, in the sample there, there would be no _x

sharp torrent
#

not updated yet, couple of changes yet to be added

#

forked hal from 2022 version

stable dune
#

Pretty nasty 3267 line code.
"Where is the error line"

sharp torrent
#

lines 145-150

#

group - need to be removed

#

on ljne 147 for it to work

granite sky
#

I think that's only possible if you have a nil in the array.

#

that seems to be the only place where RydHQ_Excluded is used though, so the issue would be outside this giant mass of shit.

sharp torrent
full solstice
#

Hey guys - i was referred to the channel about a question regarding an auto opening for an already equipped parachute when in the freefall animation. Has anyone worked on something like this yet?

granite sky
#

@sharp torrent Add some logging and find out what's actually in the array.

full solstice
tulip ridge
#

There are examples on every wiki page

full solstice
# tulip ridge

0 = this spawn {
waitUntil {getUnitFreefallInfo player};
_this action ["openParachute"];
};

#

that just doesn't look right to me

tulip ridge
#

Because it's not

full solstice
#

_player addEventHandler ["AnimChanged",
{
params ["_unit","_anim"];
if (animationState _player == "freefall") then {
["OpenParachute", player]

    };

}

];

full solstice
#

does this look right from your knowledge?

tulip ridge
#

No, not at all
Why are you adding an event handler to a null object.

If you're using some ai thing, you should definitely not be.

full solstice
#

so i'm on the wiki in the locality section - would it be - isplayer addEventHandler

#

and I'm not using AI - I'm genuinely tryingto learn

fleet sand
feral epoch
#

Hi guys, anyone know a script to visualize cargo boxes on flatbed trucks like in Liberation mode?

fleet sand
feral epoch
#

I'd like to load and unload them in-game

tulip ridge
# full solstice does this look right from your knowledge?

addEventHandler takes an object, you need to give it an object.
In the example for the AnimChanged, it shows how you could add it in a object's init box, since that's what this would be.

You could use an initPlayerLocal.sqf script in your mission. Which would run locally for each player when they join, and then add the event handler to player.

#

_player setBackpackCargo ["parachute", 1];
setBackpackCargo isn't even a command

full solstice
#

this addEventHandler ["AnimChanged", {
params ["_unit", "freefall"];
}];

#

i think i'm just ovethinking all of this now

tulip ridge
#

params is used to create local variables, you can't have the name not start with an underscore. Just leave the name as it is in the example, _anim

full solstice
#

this addEventHandler ["AnimChanged", {
params ["_unit", "_anim"];
}
];
if (pose player == "Freefall") then {
["OpenParachute", player]
};

#

am i getting somewhere? lol

half zephyr
#

one sec I gotta ask chatgpt how to sqf

full solstice
stable dune
manic kettle
#

I mean it's not that far from workable

#

But I recommend starting with more basic sqf tutorials

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
plush jolt
#

looking for some help, i want to detect when a player loots a AI map and add some markers to their map (basically simulate getting markers etc from the stolen map), cant seem to find much on this, would I be better off just sticking a "gather intel" action on the dead soldiers or something?

winter rose
plush jolt
#

oh how did i miss that take is an event option

#

good shout

delicate hedge
#

If i execute attachTo command in object init (so it will be executed on every client on server), does it means like all clients now will calculate the attachTo command and send the results to every other client (because it Global Effect command)? So when there is 100 players on server the attached object will be moved on every client 100 times per frame?

#

So for optimisation its better to execute this command only on server, yes?

warm hedge
#

Only on server or maybe local is better of course. But GE means it is not LE, that does mean the attaching object won't have 100 attached objects in the same time anyways

acoustic abyss
#

I would like to trigger the end of a mission, when all players of side opfor have entered an extraction vehicle. Came up with this:

((units opfor) arrayIntersect (call BIS_fnc_listPlayers)) in (crew _extractVeh);

But this is not giving TRUE. My first troubleshooting question is: can " in " check for multiple units in an array?

#

Ah

#

Does it need looping?

{_x in (crew _extractVeh)} forEach ((units opfor) arrayIntersect (call BIS_fnc_listPlayers));
#

This appears to work in my singleplayer test. Have others used such a check as well in their group/clan/unit missions?

#

Follow-up question: I cannot enter this expression in my trigger condition field. Get a "Condition Type Nothing Expected Bool" error.

warm hedge
#

in the first context checks the array ((units opfor) arrayIntersect (call BIS_fnc_listPlayers)) is in the array (crew _extractVeh) which means - it will never gets true

#
[0,1,2] in [[0,1,2]]; //true
[0,1,2] in [0,1,2]; // false```
acoustic abyss
#

Ah didn't know. But would you know why the looping code throws an error if placed in a trigger?

warm hedge
#

Because arrayIntersect does not return a boolean

acoustic abyss
#

But in does. And this line does return a boolean in the debug console.

warm hedge
#

And urm, your last code also doesn't make sense too

#
{_x in (crew _extractVeh)} forEach ((units opfor) arrayIntersect (call BIS_fnc_listPlayers));```
Which means
```sqf
{code} forEach array;```
Which means `nil`
#

What you really need is findIf

surreal horizon
#

Hi

#

I've made a code to create craters around the map and generate debris

#

since im making a mission with a more post apocalyptic theme

#
[] spawn {
    waitUntil { !isNull player };  

    // Request crater data from the server
    requestCraters = owner player;  // Set the player as the value (or any unique value)
    publicVariable "requestCraters";  // Send the request to the server
    
    // Wait until allCraters is populated by the server
    waitUntil {
        !isNil "allCraters" && {count allCraters > 0}  // Ensure allCraters is received and has data
    };

    [] spawn {
        private _player = player;  // Store the local player object

        // Function to manage crater visibility based on player's distance
        private _manageCraterVisibility = {
            params ["_player", "_craters"];

            // Loop to continuously check crater visibility based on distance
            while {true} do {
                {
                    private _distance = _player distance _x;

                    // Hide crater if it's more than 1200m away
                    if (_distance > 1200) then {
                        _x hideObject true;
                    } else {
                        _x hideObject false;
                    };
                } forEach _craters;

                sleep 3;  // Frequency of distance checks (adjustable)
            };
        };

        // Start managing crater visibility
        [_player, allCraters] call _manageCraterVisibility;
    };
};
#

I'm using this code to hide them and save some performance, but it doesnt seem to save that much, is there anything i can make to get some performance?

#

Tested running on a dedicated server, tried also on local machine, didnt seem so different fps wise

#

the simulation of the craters are also already disabled on their creation code

warm hedge
#

If you really have a reason to run this code, use hideObjectLocal since your code tries to update it globally

#

I really don't see there is a big reason to run this code even, though

surreal horizon
#

Doesnt it save fps at all? Thought if i hid them, the game doesnt have to render so get some fps

warm hedge
#

The game already does it basically

surreal horizon
#

i go from like 80-90 to 20-30, but to be fair i'm using 4k craters in a 4.5kmx8km area

warm hedge
#

I'm not sure what this comparison is. You compare what to what

surreal horizon
#

My fps when playing the map without craters x with

warm hedge
#

Well, are you sure this chunk of code helps at least a bit?

#

Not it should but yes it does increase FPS

surreal horizon
#

without it, it goes to 15fps, it helps a little

#

is there something to do when doing a mission with high amounts of placed objects regarding performance? or it would be best to just change the terrain itself(After getting the creator permission)

warm hedge
surreal horizon
#

Will take a look and do some tests, thanks for the help!!

covert oak
#

Is there a generic check to see if a given muzzle is a grenade launcher? Im working on a script to make a unit fire one and I need it to work for both (for example) the m79 and the m16m203

meager granite
#

But yeah hiding craters won't matter that much as the game already does that outside of object visibility

#

The code is bad because it assumes player never changes. The request up top is also questionable, sends it globally instead to just server. You dont even need any requests anyway, just wait for public variable.

#

And there are much better ways to handle distance checks in bulk rather than checking distance individually

#

Also make sure your craters are simple objects instead of full entities with disabled simulation

meager granite
#

My script checks if weapon can fire explosive ammo. You can cut it down to a specific muzzle search.

acoustic abyss
#

Thank you, but I am now confused about things. I will try to explain.

acoustic abyss
acoustic abyss
# warm hedge What you really need is `findIf`

Second; will FindIf not give me a number (position)? I could use =! to see if there is any match. But either array can have many variations. Will this guarantee that all elements of my array are present in the (crew _extractVeh) array, no matter what order either are in?

#

Sorry I don't mean to attack; you are the only one helping me right now!

#

I guess I am basically asking this:
How can I check if ALL elements of array X, in any order, are in array Y (any order)?

south swan
meager granite
south swan
#
_needles = [1,2];
_haystack = [1,2,3,4,5];
_allNeedlesAreInHaystack = _needles findIf {!(_x in _haystack)} == -1;```
meager granite
#

This can also be done through forEach but its outdated approach and you had it wrong, your line would return true if last element satisfies the condition, disregarding any before the last.

south swan
#

findIf returns -1 if no element satisfies the test condition. When test condition is !(_x in _haystack) - findIf returns -1 if there is no element of _needles that's not present in _haystack

meager granite
surreal horizon
# meager granite Also make sure your craters are simple objects instead of full entities with dis...

Im really new to sqf, and yeah gpt sends a lot of deprecated functions, i use it as a support, had to change a good part of what i asked from it, this code in particular runs client-side, taking the variables that are set in another code and available in the server, its in the onPlayerRespawn and the simulation of them are already disabled, the request variable is a function defined in the init to request the mentioned variables whenever someone spawns in hope of giving a little bit of performance, but its just not enough since the fps gain is only okayish

meager granite
surreal horizon
#

so im actually spamming the request for something that the engine itself already does?

meager granite
#

Yes, and on each respawn since you said you have it on onPlayerRespawn

#

If your server broadcasts allCraters, its already available (at some point after loading) on all clients

#

Another flaw of the script is that it checks against player and not against camera

#

You may have a cutscene or control a drone or spectate some other player and craters will still be visible only around player

#

I'd say to redo the script using inAreaArray but with 4k crates you might end up with freezes even in scheduled environment

#

If you really need your craters hidden separate from engine culling, you'd need to introduce some kind of grid system to narrow down the checks

#

Since craters wont ever move during gameplay its can be really simple

#

In other words, you need to rewrite the whole thing understanding how engine works to try to squeeze some additional performance

surreal horizon
#

but the performance gain would still be minimal or that would actually have an impact?

#

at this point changing the terrain itself seems like the way to go

meager granite
#

If objects are simple objects, it should be minimal to unnoticable

#

You can still try though to see

#

What are these craters anyway? Editor placed? Randomly generated each start?

surreal horizon
#

since i plan to actually put even more objects in the mission(Bases, trenches, checkpoints, etc)

surreal horizon
#

creating a war-torn scenario

#

the idea was to make it dynamic so i could easily switch between terrains and customize them without so much effort

#

i define an area where then its divided by chunks, which craters are then distributed on random positions

meager granite
#

Destroyed buildings that spawn ruins could actually be main performance hitter in your case

#

Try your tests without destructions to see how just the craters affect the performance

#

Make sure they're simple objects (createSimpleObject)

#

There is also a simple object made from vehicle class and simple object made just from the model, iirc they also had some slight performance difference

surreal horizon
#

after the object is destroyed i perform a linesintersect to adjust flying debris and then set them as simple objects, wouldnt it already be doing it?

meager granite
#

Speaking of grid/chunk system to narrow down sets for inAreaArray checks, I wonder what would be the fastest method to do grid/chunk lookup? 🤔

surreal horizon
#
_x enableSimulationGlobal false;
_x allowDamage false;

meager granite
surreal horizon
#

im doing this way inside a for, after adjusting its height

surreal horizon
harsh bloom
#

@marble atlas

// Set Independent (IND) to be hostile to OPFOR
independent setFriend [east, 0];

// Set Independent (IND) to be friendly to BLUFOR
independent setFriend [west, 1];
surreal horizon
meager granite
#

There is a much better way of finding ruins than line checks which are very expensive

south swan
harsh bloom
meager granite
#

Gonna need lots of keys in that hash map though

#

Pointing to same chunks mostly

south swan
#

hence the divide/floor approach to make that stuff discrete 🤷‍♂️

meager granite
#

Yeah maybe simply rounding the coordinates is better, as the main performance hit is elsewhere anyway

#

chunksHashMap get (positionCameraToWorld [0,0,0] select [0,2] vectorMultiply 1/1200 apply {floor _x}) then

#

Oh, there is extra Z

#

GIB resizeRet 😡

south swan
#

is _array select [0,2] a thing yet?

meager granite
#

Yeah, that will work too to have things inline

#

Not sure about 1/1200 for 1200m visibility radius though, chunks will have to overlap so you can get everything in a single chunk

south swan
#

get 300m chunks and load 9 of em 🤷‍♂️

meager granite
#

muh microseconds

#

though with 4k objects it might not be microseconds but worse

meager granite
#

For 1200m radius you'll need to get 2x2 so overlapping chunks gonna have to be 4800x4800

meager granite
acoustic abyss
# meager granite Since you want *all* elements to match the condition, `findIf` is the proper way...

But I am still not 100% on board with Findif . Because the second (array "Y") array will certainly have more elements, so it will certainly return a mismatch.

Expected someone in the BI forumswould ask the same question:
https://forums.bohemia.net/forums/topic/229124-simple-array-comparison/

#

The answer I see is an arrayIntersect *. Pardon

south swan
acoustic abyss
#

(Nested in my case, since that is how I make the first array "X")

meager granite
south swan
surreal horizon
#

Honestly i might end up just messing with the terrain editor since it seems like the more performance saving way and i want to put even more stuff in the map, if you guys want what i have done so far i can send it so you can take a look

acoustic abyss
#

See start of question. My _extractVeh has a driver/pilot.

surreal horizon
#

its an idea i had but i recognize its a really complicated thing for a beginner like me

meager granite
acoustic abyss
#

I will wait until you help Zanga first!

meager granite
#

Having dynamic objects can be performant but it requies knowledge of the engine to do it properly

south swan
surreal horizon
#

but would be a really nice to have a script like that, so you could make any terrain wartorn without needing to change things in terrain building level

warm hedge
surreal horizon
#

i didnt find anything like that searching up

meager granite
surreal horizon
meager granite
warm hedge
surreal horizon
#

and thats just the mission atmosphere part, the rest of it(factions and map population in general) is done by drongos mod, which also consumes some fps but not as much as my scripts xD

meager granite
#
count(((units opfor) arrayIntersect (call BIS_fnc_listPlayers)) - (crew _extractVeh)) == 0;
#

Basically substract all crew members from opfor players, if none are left (all were in crew), means its good

#

findIf way to do it:

(units opfor) arrayIntersect (call BIS_fnc_listPlayers) findIf {!(_x in _extractVeh)} < 0
#

findIf loops until it finds first unit that is not in _extractVeh, then returns its index, if none found it returns -1 thus the < 0 check

acoustic abyss
#

*Have a different outcome?

meager granite
#

Yeah you can also do it like that

#

arrayIntersect or array - array wont work if you need some other condition than equality though

#

That's where forEach and findIf will come into play

#

Say you want all opfor players in extraction vehicle AND have full health

#
(units opfor) arrayIntersect (call BIS_fnc_listPlayers) findIf {!(_x in _extractVeh) || damage _x > 0} < 0
#

To do that with arrayIntersect you'll need to grow your code even more to pre-filter arrays, etc., while findIf does all that in a single line.

south swan
#

(and with performance that would vary from micro-benchmark to micro-benchmark) 🙃

meager granite
surreal horizon
#

even without hiding them as i was doing before

meager granite
#

Might be a good idea to delete some debris or replace them with something simplier

#

There is also setObjectScale which could work on simple objects to have your craters bigger

surreal horizon
#

the size is fine

#

the idea is a rocket barrage in the scenario

#

they dont need to be too big

#

the idea here is to make stalker inspired mission with missions and factions

#

but im using a map that is too untouched, so i wanna to make it more destroyed

#

the map is already heavy so im trying to do everything possible(At least that i can manage to do) to save some performance

#

the craters is an idea to not only make it the map more war-torn for my mission, but also make it available so anyone can make any map like it through using an script/module

#

but its waaay harder than i anticipated

surreal horizon
still forum
#

Thank you for all your efforts! ❤️

surreal horizon
#

I will get there, eventually, maybe xD

west portal
#

How can I hide multiple layers using getMissionLayerEntities? Tried dropping them into an array.

_villagelayers = ["V1_AIwithObjects", "V2_AIwithObjects", "V3_AIwithObjects"];
{
    _x enableSimulation false;
    _x hideObjectGlobal true;
} forEach (getMissionLayerEntities _villagelayers select 0);
meager granite
west portal
#

I'm seeing that layername should be a string, so it should work in theory?

meager granite
#

You need to iterate through your array and feed that into getMissionLayerEntities, that magic _x is that each string item

tough abyss
#

Ok, don't laugh at me but I asked ChatGPT for a script that helP me call for reinforcements, I have followed the steps but I'm not sure that it works haha
anyone who can help me check what I've done wrong?

meager granite
#

what I've done wrong
Using ChatGPT instead of learning SQF yourself

tough abyss
meager granite
#

Start small, try a lot

tough abyss
faint burrow
#

addAction shouldn't be in the script -- this is clear even from the comment in the script itself.

fair drum
#

@tough abyss do you want to learn it? or just have us write you the script. either is fine.

jovial robin
#

i asked chat gpt to make me a 3 min alarm when players use the laptop
// This script delays for 180 seconds (3 minutes), then triggers an alarm sound.

// 3-minute wait (sleep is in seconds)
sleep 180;

// Play alarm sound at a specific position (replace "Alarm" with any valid sound from Arma 3)
playSound3D ["A3\sounds_f\alarms\alarm_triggered_01.wss", player, false, getPos player, 1, 1, 500];

says invailed numbers in epxression

hallow mortar
#

Don't use ChatGPT. It's not good at SQF, and it's very bad for the environment - queries to ChatGPT and other AI services have a massive energy cost.
The code it's given you is wrong in several respects:

  • the file path is almost certainly not a sound file that actually exists
  • it uses getPos player for the sound position. First, you probably don't want the alarm to be played from the player's position; secondly, the sound position parameter requires an ASL position, which getPos is not.

The "invalid number in expression" error is actually not caused by ChatGPT being "wrong" as such, though. That's likely caused by putting the code with comments in an Editor code field. Editor code fields don't go through the preprocessor before being executed, and one of the preprocessor's important functions is to remove comments, because the game won't understand them. So either move this to an external script file which the game will preprocess on loading, or remove the comments.

jovial robin
#

sigh

#

gives me the pefect scipt to make a intel file yet it gets this one wrong

tough abyss
jovial robin
#

really thought gpt would help me with making script that are very hard

fair drum
edgy salmon
#

Can anyone help me figure out whats wrong with this code. It's for a radio asset called radio1? Music tags are good. When i launch the mission it just spools out errors and doesn't run the code

#

The innit from radio1: [] execVM "radio_music.sqf";

hallow mortar
#

Knowing what the errors say would be useful

#

You could make this a lot simpler by using playSound3D or say3D rather than doing constant volume adjustment to simulate 3D position

open hollow
#

im trying to add smokescreen to gunner, so it can be fired from that position, any idea why i have this after i added magazines to the weapon?

#

first time added it works, but after that it keeps in red with that

vital sluice
#

Hello, I'm trying to find out what might be causing this issue. I've added zeus ( https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/pull/376/files ) to A3 Wasteland stratis mission made by @drifting barn, all working fine however now the vendor NPCs have disappeared when the mission is running making it impossible to access their menus, you can see them in the zeus editor though. Not sure what logs are needed but i can share them.

GitHub

to contribute back to the community i prepared everything you need to dynamically create zeus curators in this pull request. this feature is especially nice if you want to do special events on your...

meager granite
acoustic abyss
#

Okay by basically adapting example 1 from both nearestTerrainObjects and setTerrainHeight (adjust objects False) I have reduced 1 minute load time to 35 seconds, for a 8x10 km stretch. The island is approx 30x16 km = 6 times the size. Let's see how it benchmarks...

meager granite
#

What do you mean "from view"? You want to hide it? Make it go underwater? What's the goal?

acoustic abyss
#

I am setting up a "Prologue" coop mission, where the diver players jump off the boat in the middle of the ocean. Real purpose is to create a lobby for players to check mods and networking et cetera.

It's convenient to use the terrain (Kaska island), because it matches the skybox and lighting of the main mission. I will place all mission objects (players and boats) kilometers away from the terrain, so only the outline of the landmass needs to be submerged.

#

That and all the location names visible on the map; but that comes next.

tough abyss
# fair drum give me everything you want it to do

oh man, thanks alot!!
I want to have the ability to spawn reinforces (the units: ["B_UKR_Army_AT_01", "B_UKR_Army_Grenadier_01", "B_UKR_Army_Medic_01", "B_UKR_Army_Team_Leader_01", "B_UKR_Army_Sapeur_01", "B_UKR_Army_Rifleman_01"] )
i want them to either move to my last known location from a spawn point or spawn next to me.
I would like to have the script with infinite spawns
IF possible I would like to spawn a vehicle with units in ( this vehicle: RHS_M2A3_wd )

the problem is that I have 2 more scripts, I know that the one that makes me spawn on a vehicle is working fine but having some issues with the no stamina on LAN. works for my first character but not when I respawn..
I hope you understand, as I said, this is waaay of my area of knowledge haha

And I'm really uncertain about my solution for several init files 😐

meager granite
tough abyss
true frigate
meager granite
#

Never use getPos unless you want a headache (or do one-time use test scripts)

true frigate
#

Huh. I use that a lot, might be the case why some inconsistencies are happening. Thanks 🙂

meager granite
#

AGLS is very unreliable and its better to avoid it

#

Same with setPos btw

acoustic abyss
#

For whomever wanted to know what setTerrainHeight does at large areas...
I tried the following code in a 30x17 km area in the initserver.sqf:

//https://community.bistudio.com/wiki/setTerrainHeight example #1

private _fnc_flattenTerrain =
{
    params ["_start", "_a", "_b", "_h"];
    private _newPositions = [];

    for "_xStep" from 0 to _a do
    {
        for "_yStep" from 0 to _b do
        {
            private _newHeight = _start vectorAdd [_xStep, _yStep, 0];
            _newHeight set [2, _h];
            _newPositions pushBack _newHeight;
        };
    };

    _newPositions;
};

private _desiredTerrainHeight = -40;
private _positionsAndHeights = [getPosWorld _markerBottomLeftCorner, 17000, 30000, _desiredTerrainHeight] call _fnc_flattenTerrain;
setTerrainHeight [_positionsAndHeights, false];
``` Game gave an overflow error and softlocked during editor preview. 
So I reduced scope. Turns out viewDistance 500, maximum weather, and disabling birdsounds using ```enableEnvironment [false, true, 1];``` works great.

One last question-
#

Players can still take their boats and visit the mainland. Even if it takes 5 minutes, I know players will try.

#

Does anyone have an area restriction instant lightning strike script per area that they have used before?

#

All suggestions thanks to Sa-Matra! By the way...

acoustic abyss
#

===
So what I have come up with, is a trigger.
Activation on OpFor (player side) presence. Repeatable. Server only.
onActivation:

[thisList select 0, nil, true] spawn BIS_fnc_moduleLightning;
thisList select 0 setDamage 1;

Problem is that it needs to deactivate first before reactivating. Which might happen if a boat full of players enters the area, and don't all die on the first strike. Has anyone made a robust, tested lightning script?

#

Is there for instance, a player local script I could make, that checks inAreaArray, and has the player initializing a lightning strike on themselves?

warm hedge
#

forEach is one way

meager granite
#

Altis has a cell with 7.5m side for example, no need to add position each meter (default for step)

sage heath
#

so, i've got a problem basically, operation frenchpoint's Peugeot P4 Milan and the PATSAS variant is broken because the mod itself has a feature where its like ammocan where it takes magazines from the vehicle's inventory, problem is, there is no item for the milan missile, and no such item exist according to the document

so uhm

what now lads

gleaming rivet
#

Sigh...
Well, I guess some people just want to watch people's computers burn.

last cave
terse tinsel
#

I have a problem, at the beginning the dynamic simulation for soldiers is set to 200. But when I play the script I want to set it to 1000, when I enter this script "Group" setDynamicSimulationDistance 1000; it doesn't work and activation is still 200, can it be fixed?

winter rose
old owl
little raptor
south swan
little raptor
#

Ew meowsweats

south swan
#

magic strings blobcloseenjoy

terse tinsel
terse tinsel
acoustic abyss
acoustic abyss
last cave
acoustic abyss
#

Thanks 🙂

opal zephyr
#

Does anyone know if there is a command like BIS_fnc_exportEditorPreviews but that creates pictures for inventory use?

last cave
#

I found that shotgun hits can be not intercepted by handledamage. This is the damage list that came to me when I was hit(image). The damage was done from the same unit during 1 frame. Even the lifeState changed consistently during the frame.
only 68 damage bypassed my processing code.
I have an idea where the failure occurred. Exactly 0 damage passed through the body, which is why I died. But this is not

params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; 
diag_log _this;
diag_log [_unit,alive _unit,lifeState _unit,time,diag_tickTime];

if (!alive _unit || !isDamageAllowed _unit) exitwith {};
scopeName "EHScope";

_realDamage = _damage;
_isfalldamage = _projectile isEqualTo "";
_state = lifeState _unit;
_fallenHits= ["hitface", "hithead","hitneck","hitchest"];

//Here my Damage Handling by _context

diag_log _damage; //can be max 0.9 or 0.975 

//Here my handling of a player falling into a non-combat state
//this condition (_damage >= 0.95 && !(_state isEqualTo "INCAPACITATED") && (_context in [0,1]|| _isfalldamage))
// The condition is that the AI ​​is killed in 50% of cases without going into a state INCAPACITATED
//     if (!isplayer _unit && random 1 > 0.5) then {
//            _damage = _realDamage;
//            breakTo "EHScope";  //Lethal damage to AI.
//    };
diag_log _damage;
_damage

The logs definitely show that the last 2 diag_logs did not work for some reason.
Even when the player was alive according to the exitwith condition

Because of this, I'm now thinking about removing shotguns from AI equipment.mad

#
//Now the first 5 lines look like this.
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; 
diag_log _this;
diag_log [_unit,damage _unit,alive _unit,lifeState _unit,time,diag_tickTime];
if (!alive _unit || !isDamageAllowed _unit) exitwith {Diag_log ( "Exitwith " + str damage _unit);Diag_log [!alive _unit , !isDamageAllowed _unit]};

Again, several handlers stopped executing code before the first IF was called

#

Damage on _context = 0 was 0.
Handler cancelled my code execution after diag_log _this.
Then
Damage on _context = 0 was 4.17943.
Handler cancelled my code execution after diag_log _this
Then
I am dead and exitwith triggered on me dead.

#

It looks like the bullet just doesn't disappear and deals a huge amount\count of damage in one frame.

terse tinsel
# south swan

I entered exactly what is selected, I don't want the dynamics to be for a selected group but for everyone, but unfortunately it doesn't work 😦

terse tinsel
last cave
#

omg i find why my unit die!
my condition return

diag_log [_damage >= 0.95 , !(_state isEqualTo "INCAPACITATED") , _context in [0,1], _isfalldamage];
[bool,true,true,false]

#

I wrote one of the variables with an error in “Here my Damage Handling by _context” Because of which _damage was returned as nil due to a missing variable error... I spent 2 hours trying to find 1 stupid letter z at the end of the variable...

daring cave
#

I'm trying to play a sound
playSound3D [getMissionPath "frying_pan_sizzle.ogg", br1, false, getPosASL br1, 1, 1, 20, 0, false];
but I don't want it to be played at sea level and the playsound3d entry on the BI wiki doesn't have a negative option, how do I skip a field in something like this?

playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset, local]

#

I want to skip or leave default soundPosition

#

soundSource has the actual AGL location but soundPosition overrides it

#

I want the other parameters in front of it to be the same

south swan
#

"getPosASL" is not "at sea level". It's "position with height a ltitude measured from sea level"

faint burrow
#

I want to skip or leave default soundPosition
Provide default value.

coarse dragon
#

if i wanted to make Civ's Hostile would i need each one of them have a custom name?

indigo snow
#

It's not immediately bad, but its not good either. Especially if you dont know the possible dangers.

#

Not everyone needs to be a perfect arma scripter but explaining why they might not be the best is something suitable in a channel solely about scripting

acoustic abyss
#

Does entities detect empty objects?

#

Or would 8 allObjects 0 cover all decor objects as well?

last cave
#

what is the problem with objects in the editor select attribute simple object (checkbox)?

#

Ah...

acoustic abyss
#

Almost-. I need all editor objects in area trigger, changed to simple 🙂

#

I tried the following code:

#

This I placed in the onActivation part of a trigger.

{[_x] call BIS_fnc_replaceWithSimpleObject} forEach ((8 allObjects 0) inAreaArray thisTrigger);

It crashed the game with a "Status Access Violation".

last cave
#
(allSimpleObjects []) inAreaArray myTrigger ```
Find all simple obj in area trigger.
acoustic abyss
#

Hm. So for example I have object like "Land_BarrelTrash_F" . It is not simple by default. But I want to change it to simple.
In my test setup, I have about 25 objects.
However I want to make a pretty big scenery with ~150 objects. I don't want to click every menu to check "Set Simple Object".
But maybe that is faster than coding this meowsweats

last cave
#

Why create simple objects during the game if you can create them in advance and hide them until the right moment? It just feels like you're building a sky-high code in your head instead of a simple approach. hmmyes

acoustic abyss
#

Great. So I have placed each (not simple) object already. How do I make them all simple?

last cave
#

Select all objects in editor and change attribute for all selected...

acoustic abyss
#

Ha! I had forgotten you could change attributes of several things at same time in Eden Editor!

#

Do you know the check / getter command for a simple object? To see if it worked.

last cave
last cave
hallow mortar
#

One thing to keep in mind is that setting custom Editor attributes on an object does make it take up more space in the mission.sqm, and when you have a very large number of objects that can stack up a bit. Depending on how big your mission file is otherwise, this may not be particularly important, but sometimes it can be the difference between an acceptable server-to-client transfer time or not.
Applying things to many objects at once is almost always more space-efficient in script than in attributes. e.g.

{
  _x setSkill [...];
} forEach units west;

is a lot smaller than 100+ copies of the entire unit attributes class in the mission.sqm.

fair drum
tough abyss
thin fox
#

there are some examples in it

#

just grab and change the values

fair drum
#

he wants a plug and play. no interest in learning. if you want to do that for him go ahead, but I'm starting to get up so I can do it in a few min if you don't want to.

thin fox
#

oh, so not my problem lol

fading notch
#

Does anyone run a loop or function to add flashlights to spawned (not editor placed) FIA units and if using ai behavior mods, to remove the code from pilots, co pilots and driver units. Thanks in advance

winter rose
fading notch
#

@winter rose ok. I will look at that. Thanks. Have you used it before?

winter rose
fading notch
#

I was wondering how best to use it. As a loop or function

fair drum
#

Modules enhanced has a module for that. Adding flashlights and having them toggle on or off, etc.

Edit... I now see the non editor placed comment. Well feel free to look through and modify the code.

hallow mortar
# fading notch I was wondering how best to use it. As a loop or function

EntityCreated is an Event Handler, which means it automatically activates and runs its associated code whenever that event happens. So there's no need to use a loop with it.
You could use a function; have the EH-creation done by a function, or have the EH call a function. "Loop or function" is a false dichotomy - those are two completely different things that could even be combined (not for this purpose but in theory), not two alternative solutions to the same problem.

fading notch
#

@fair drum thanks. I'd rather not add another dependency if possible.

south swan
#

u wot

fading notch
#

@hallow mortar ok. So running this with init.sqf would be fine?

hallow mortar
#

You might consider initServer.sqf instead, since the server is likely to be where the units are created and where their AI is running, but init.sqf should work.

#

Example:

addMissionEventHandler ["EntityCreated",{
  params ["_entity"];
  if !(_entity isKindOf "CAManBase") exitWith {};
  if !(side group _entity == west) exitWith {}; // for side filtering - use west, east, or independent as appropriate
  _entity addPrimaryWeaponItem "acc_flashlight"; // pretty sure that's the classname
  _entity enableGunLights "ForceOn";
  if (!(isNull objectParent _entity) && {_entity == driver vehicle _entity}) then {
    // disabling AI mod stuff depends on the specific AI mod so that's up to you
  };
}];```
fading notch
#

@hallow mortar thanks. I will definitely try this. Appreciate your help

terse tinsel
tough abyss
fading notch
#

@hallow mortar hey again. If I wanted to narrow the filter more to both side and faction say, IND_FIA, opfor_FIA, I forget the exact names should I make individual if ()then; statements for each or on same lines, and the same question applies for == driver && pilot && co-pilot?

Sry. I am at work on phone so I cannot give better example.

hallow mortar
#

For faction instead of side filtering, replace that line with something like this:

if !((toLower faction _entity) in JL_var_flashlightfactions) exitWith {};

and then at the start, before the current first line, add this:

JL_var_flashlightfactions = ["ind_fia_f", "opf_fia_f"];```
(make sure those are the right faction names)
In engine terms, "pilot" and "driver" are the same thing; the person in the seat that controls the vehicle's movement is the "driver", there is no separate `pilot` command. Detecting copilots is more complicated because they aren't really a specific seat type. You could try `gunner` (see example below) but no promises that works for all types of helicopter.
```sqf
... && {_entity in [driver vehicle _entity, gunner vehicle _entity]} then { ...```
#

You can also use typeOf to check whether the unit itself is one of a specific list of classes, but that tends to get pretty fiddly pretty quick, and there are edge cases, like riflemen being the default driver class for carlike vehicles

fading notch
#

@hallow mortar ok thanks. I didn't realize pilot and driver is the same. No biggie about the copilot

faint burrow
#
_faction = faction _entity;

if ((JL_var_flashlightfactions findIf { _x == _faction }) < 0) exitWith { };
_vehicle = objectParent _entity;

_isDriverOrCopilot = (!(isNull _vehicle)) and { (_entity == (driver _vehicle)) or { _entity == (currentPilot _vehicle) } };
hallow mortar
#

That will only detect the copilot if they've already taken control of the vehicle because of the loss of the original pilot, which seems somewhat unlikely given that the entity/vehicle has only just been created

faint burrow
#

OK:

_vehicle = objectParent _entity;

_isDriverOrCopilot = (!(isNull _vehicle)) and {
    (_entity == (driver _vehicle)) or {
        _turretPath = _vehicle unitTurret _entity;

        (getNumber (([_vehicle, _turretPath] call BIS_fnc_turretConfig) >> "isCopilot")) == 1
    }
};
south swan
#

getNumber ([_vehicle, _vehicle unitTurret _entity] call BIS_fnc_turretConfig) wat

faint burrow
#

?

south swan
#

BIS_fnc_turretConfig seems to return config class, what's the meaning of getNumber here?

hallow mortar
#

It [this code, not the BIS function] was probably supposed to get the value of a property within the turret class, but a layer got missed

south swan
#

hence my question

faint burrow
#

Fixed.

last cave
#

Why Ai just run away vs 1 player notlikemeow
The reason is AISkill ["courage",0.1] ???

#

What a terrible player. That they even run away hundreds of meters.

slow brook
#

Anyone have an example value of what getPosATL grabs?

Is it just [x,y,z]

slender turtle
#

So im trying to do a thing where a trigger spawns a grenade (SmokeShellPurple) and a person can pick it up using ace and throw it into a trigger to make the trigger fire.

Haven't be able to figure out how to get the trigger to dectect SmokeShellPurple" to set the stuff off. (Also need to make the trigger delete the grenade and one to detect when its been deleted to spawn another one.)

slender turtle
#

friend of mine is seeing if an event handler works but no luck so far

fair drum
fleet sand
fair drum
#

!quote 5

lyric schoonerBOT
fair drum
#

dang thats not the one lol

slender turtle
fair drum
#

yeah so try your isKindOf example, but with Anybody

fleet sand
fair drum
#

also, consider findIf instead of count

slender turtle
slender turtle
#

im putting it in condition

fair drum
#

standby

slender turtle
fair drum
#

thisList does not detect ammo objects - so you cannot use that method

Legon's method by doing a nearObject check is correct. You can implement it various ways. Pay attention to syntaxes, they will depend on if you need any smoke, vs a specific smoke.

nearestObjects for isKindOf comparison
nearObjects for direct comparison

prefer findIf over count for these frequent checks

either do a inArea check like legion does, with a large radius:

//radius
triggerArea thisTrigger params ["_a", "_b"];
private _maxRadius = _a max _b;
// rest of the check

or if you have a circular trigger, you can get the radius using triggerArea directly and just check if the array is not empty (faster)

slender turtle
#

im trying to use a square trigger that defines a specific area inside a bunker prop

slender turtle
fair drum
#

written for understanding, not for speed, but it will get you what you want.

triggerArea thisTrigger params ["_a", "_b"];
private _objects = thisTrigger nearObjects ["SmokeShellPurple", _a max _b];

_objects findIf {_x inArea thisTrigger} != -1;

and if a square and you want to get crazy, and ensure you are checking those corners, you can use pathags instead of _a max _b

slender turtle
slender turtle
fair drum
#

personally, I would be using a loop instead of a trigger for this amount of custom stuff

slender turtle
#

A loop? ive never herd of those

fair drum
#

you probably have. the scheduled space while loops and waitUntil, etc (you could do unscheduled with framehandlers, but this doesn't seem time sensitive)

#

so you want an area that a person can throw in a smoke, and no matter what smoke, its going to be a purple and at a specific location? is that what I'm getting?

slender turtle
# fair drum so you want an area that a person can throw in a smoke, and no matter what smoke...

Maybe? there are other types of smoke in it. Im working on making this like TVT sport kinda thing. I had made other versions of it previously using the ACE wheel but I figured that using the smoke grenade would make the game go quicker.

Basically I want the purple smoke grenade specifically to be the "ball" and when it gets thrown into a bunker (the "goal) it adds a point based on which goal its in. The smoke grenade is then deleted in order to set off a different trigger which will spawn a new smoke grenade.

The reason for the separate spawning trigger is I need one that will detect if the smoke is not present in-general because they will eventually time out and get deleted by the game so i need a means of making a new one when that happens. So i can couple deleteing the existing one with that to use less overall

#

so what i need to figure out is how to delete the purple smoke grenade with the On Activation and detect if one exists in Condition.

fair drum
#

can only one person have the "ball" to be able to throw it?

slender turtle
#

yes because its spawned via a trigger the grenade auto activates so people cant put it in their inventory and carry it

#

its held via ACE

fair drum
#

ok. so you'll have to save the ball on creation as a missionNamespace variable which you will use to reference. you can also use the class "SmokeShellPurple_Infinite" to get an infinite smoke grenade as well

slender turtle
#

wait thats a thing?

#

i did not know that

fair drum
#

thats a lifetime of 317 years

#

don't think you'll be playing that long

slender turtle
#

so im doing this to make the grenade

_smokePos = getPos Ball_Spawn;
_smoke = "SmokeShellPurple_Infinite" createVehicle _smokePos;

the idea i had was in the goal script it would do this but that isnt working.

 _smoke setPosATL _smokePos;
slender turtle
slender turtle
queen cargo
#

@indigo snow "not good either" ... tbh ... thats bs
scripting is not much different from programming
actually there is no real difference at all

thing is simple: you have to know when to use loops and when to use eg. PFHs
just like with everything

acoustic abyss
#

I'm trying to simulate someone pumping up a fuelbladder.
All it has to do is slowly go up.
As a test case, I've placed the fuel bladder on a water surface (it floats). And applied this:

target_fuelbladder setVelocityTransformation 
[ 
 [4823.07,8645.77,38.45], 
 [4823.07,8645.77,40], 
 [0,0,0], 
 [0,0,0.0516], 
 [1,0.000767902,0], 
 [1,0.000767902,0], 
 [0,0,1], 
 [0,0,1], 
 0.05 
];

The object disappears when I run this, without an error. What am I missing?

#

Classname " StorageBladder_01_fuel_forest_F "

covert oak
#

Alright, I always run into this problem, can someone explain how to fix this? I'm defining an array in the "main" scope of an sqf file, then I need to modify it inside of a loop and have that change edit the parent scope (the sqf main)

example:

_myArray = [1,2,3,4];

[] spawn {
     _myArray pushBack 5;
}
hint _myArray select 4;
>> error, _myArray undefined

I could pass the array to the subFunction like this:

[_myArray] spawn {}

But then the _myArray I'm editing is the subfunction's local copy.

The specific script I'm working on right now is a simple script to respawn AI. I'm going this route because ... reasons.

I'm calling it on multiple groups, so I can't (as easily) just define a global like WR_groupData because as I cann the script for each group it'll get overwritten, and I don't really want to have to add an array for each group to my global array of all groups.

faint burrow
covert oak
faint burrow
#

If this is in the same scope, then it's impossible.

#
_myArray = [1,2,3,4];

_scriptHandle = _myArray spawn {
     _this pushBack 5;
};

waitUntil { scriptDone _scriptHandle };

hint (str (_myArray select 4));
gleaming rivet
#

At the end of the day, bad scripting is bad. Nothing changes it.

#

And it's not a lot of work to fix the problem, they just refuse to actually do anything about it.

proven charm
#

can object roadway lod be disabled?

little raptor
#

No

proven charm
# little raptor No

i wonder why, now you cant make fully passable objects using disableCollisionWith

little raptor
#

well you can make a ticket. it might actually be added (not with disableCollisionWith but maybe with setPhysicsCollisionFlags)

proven charm
little raptor
#

Well that ticket says disableCollisionWith is not working correctly. It doesn't ask for a new feature
But anyway I think I made a ticket for that too

proven charm
#

yea Idk if my comment there makes sense. practically roadway lod is collision

fading notch
#
JL_var_flashlightfactions = ['IND_G_F','OPF_G_F','IND_C_F'];

addMissionEventHandler ["EntityCreated",{
  params ["_entity","_entity_2"];
  
  if !(_entity_2 isKindOf "CAManBase") exitWith {};  
  _vehicle = objectParent _entity_2;

  if (!(isNull _vehicle)) && { (_entity_2 == (driver _vehicle)) || { _entity_2 == (currentPilot _vehicle) }) then { 
    
    _entity_2 setVariable ["TCL_Disabled", True];
    
    };
    
  if !(_entity isKindOf "CAManBase") exitWith {};
      
 _faction = faction _entity;

  if ((JL_var_flashlightfactions findIf { _x == _faction }) < 0) exitWith { };
  
    _entity addPrimaryWeaponItem 'acc_flashlight';
    _entity assignItem 'acc_flashlight';
    _entity enableGunLights 'AUTO';
  
}];
#

I presume each event needs its own block of code. I could be wrong too. this bot is messing with me. I will try to place in SQF

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
faint burrow
hallow mortar
#

If you choose to use two separate EHs, you don't need to do _entity_2. The _entity variable is a private variable, specific to each instance of the EH, and does not conflict with other variables of the same name in different scopes.

#

The code formatting uses a specific character: `
It's at the top left on a UK keyboard, not sure about others. If you can't find it, copy it from the bot's message.

hallow mortar
#

Also, this line:

JL_var_flashlightfactions = ['IND_G_F','OPF_G_F','IND_C_F'];```
is meant to be _right at the start_ - outside the EH entirely. The purpose is to define that array, once, as a global variable that the EH can refer back to when it fires. This is more efficient than redefining the array every time the EH fires.
fading notch
tired cargo
#

Hi guys !

Could anyone suggest me sources, where could I get an information about scripting ( advices, unusual techniques etc. ), which help me to improve my scripting knowledge and skills ? Except BIS forum

#

Maybe YouTube channels

fading notch
#

It depends on what you're looking for. Can you be more specific.?

tired cargo
# fading notch It depends on what you're looking for. Can you be more specific.?

So, I have base scripting skills and I feel confident, but I am looking for something, that could improve my skills. There is something similar when you have achieved something, but want to expand your knowledge, for example, by reading books, or something like that. Something that is not written about in many places, that is, the information is not popular enough, but greatly improves the understanding of scripting

fading notch
#

@tired cargo I get it. Udemy offers free online c++ education videos. Let me know if you find anything. I am always wanting to learn more myself.

tired cargo
sullen marsh
#

I'M USING A WHILE TRUE LOOP IN A SCRIPT GUYS

#

OH SHIT

#

HELP

kindred zephyr
#

game longevity, content stealing, moved on to other games, passed away.

Lots of reason, nothing in concrete

tough abyss
#

Oh gawd, call the police.

#

Anybody messed with the "end game" revive system and restricting the revive to certain roles? (ie. Medics only)

nimble hill
#

To have a bit more substance what the difference between good practice vs. bad practice is heres an example: I made a mission for yesterday, and had my units spawn via a function instead of doing it all in a for loop inside the script. It made the AI spawn probably 50% faster than normal, which is great cuz it can lead to issues with vehicles leaving and such. However I had still put down too many AI so the mission ran like shit until i deleted a bunch of them. Solid basics matter more than finetuning performance in some scripts.

old owl
# tired cargo Hi guys ! Could anyone suggest me sources, where could I get an information abo...

Here is one that a friend and I made to help people who have had an interest in starting SQF for our server. The "Fockers Scripting Guides" are best for getting a handle on how to setup a Eden environment, beginning writing scripts, testing, etc. Killzone Kid tutorials will kind of be going on the assumption you already have a bit of that pre-req knowledge. The scripting commands page is overall just an extremely useful resource to find commands that you may be looking for on how to do stuff (get player heath, etc).

https://docs.google.com/spreadsheets/d/1zI7r5jw-ikiQlnCCkqevThQ4NCC2xufPDaVwOto4dow/edit?gid=0#gid=0

#

The Fockers guides I remember having quite a few typos among other things which were not great but at the time they still really helped me and I feel like do a really good job at getting someone started

edgy dune
faint burrow
#

No, the command can return

[
    ["arifle_MX_ACO_pointer_F", ...],
    ["launch_NLAW_F", ...],
    ["hgun_P07_F", ...]
]

or

[
    ["hgun_P07_F", ...],
    ["arifle_MX_ACO_pointer_F", ...],
    ["launch_NLAW_F", ...]
]
edgy dune
#

ahhh okay

#

ty

tired cargo
tired cargo
fair drum
#

But really sqf is it's own animal. A disgusting, ugly, animal.

little raptor
little raptor
#

e.g. if you write 1 + 2 in math, in SQF you can have 1 plus 2 where plus is a command. There's literally nothing else to SQF. If you understand how to use a calculator properly you already know the SQF syntax

hallow mortar
#

There's literally nothing else to SQF
except for the arcane, twisted secrets of what the commands actually are and what they do

little raptor
#

Well I was talking about the syntax. Not knowing what a command or function does is inherent in all programming languages and you can just read the docs for them

#

But still you do need some programming background to understand stuff (e.g. arrays, strings, etc.)

tired cargo
#

😀

shell kiln
#

Anyone here familiar with ESS? I'm trying to set it up for spawning, but I can't figure out where the line of code used to control enemy variables goes.

#

I've tried checking Google for a setup guide but haven't found anything, and as someone who knows next to nothing on SQF I don't fully understand what the instructions included are saying.

kindred zephyr
#

Hey fellas, long time!

It's there a way to tamper with the gravity of an object or is it necessary to do stuff OEF in order to control/"remove" gravity acceleration with transformations/position setting?

bold comet
#

damn you've been beating that dead horse for days now

#

it's still dead

pallid palm
#

whats ESS ?

#

do you mean EOS

#

ahh ok i see, Try EOS its way better IMO

#

C# is 1 Half step above C he he i'm a guitar player

acoustic abyss
#

I am trying to understand setVelocityTransformation.
As a simple experiment, I am trying to get a VR block to rise 2 meters up within 10 seconds, with this code:

startPos = getPosATL VR_cube;
endPos = startpos vectorAdd [0,0,2];
startVelocity = velocity VR_cube;
endVelocity = startvelocity;
cube_vectorDir = vectorDir VR_cube;
cube_vectorUp = vectorUp VR_cube;
 
t1 = time;
t2 = time + 10;
interval = linearConversion [t1, t2, time, 0, 1];

VR_cube setVelocityTransformation 
[ 
 startPos, 
 endPos, 
 startVelocity, 
 endVelocity, 
 cube_vectorDir, 
 cube_vectorDir, 
 cube_vectorUp, 
 cube_vectorUp, 
 interval 
];

The block is only sitting in front of the player at start. I have no mods loaded.
The result, even if I directly enter the values, is that the object instantly disappears. What am I missing?

south swan
#

it wants ASL positions, not ATL. Mixing those up in VR would put your block 5 meters below the ground

#

and you need to execute setVelocityTransformation every frame while the object moves blobdoggoshruggoogly

acoustic abyss
#

So should I interpret this command as generating a series of frames, without animation?

#

That is, "playing" them.

south swan
#

generating a single "frame" (defined by interval) of a series defined by other parameters, i'd say in those terms

acoustic abyss
#

Also I have changed the first command in my example block to:

startPos = getPosASL VR_cube;

Now nothing happens.
I will wrap it in an eachFrame event handler.

#

I believe I have mimicked Example 2 from the BIKI:

startPos = getPosASL VR_cube;
endPos = startpos vectorAdd [0,0,2];
startVelocity = velocity VR_cube;
endVelocity = startvelocity;
cube_vectorDir = vectorDir VR_cube;
cube_vectorUp = vectorUp VR_cube;
 
t1 = time;
t2 = time + 10;
interval = linearConversion [t1, t2, time, 0, 1];

onEachFrame
{
    VR_cube setVelocityTransformation 
    [ 
     startPos, 
     endPos, 
     startVelocity, 
     endVelocity, 
     cube_vectorDir, 
     cube_vectorDir, 
     cube_vectorUp, 
     cube_vectorUp, 
     interval 
    ];
};

There are no visible effects when running this. And no errors.

#

What's missing?

south swan
#

interval = linearConversion [t1, t2, time, 0, 1]; being inside onEachFrame is missing

#

why would output of setVelocityTransformation change if you don't change any of its arguments between frames?

acoustic abyss
#

Because, I thought, that interval defined the step size. Which if that was the case, should be defined before it is executed.

south swan
#

For continuous movement this command should be executed each frame while changing the interval value.
...
Later inside some on frame event...
_interval = linearConversion [t1, t2, time, 0, 1];
blobdoggoshruggoogly

acoustic abyss
#

Thank you.

#

I assumed that the second argument (endPos in my case) defined the end of the movement. However in my code the object continues indefinitely. What is a convenient way to stop it?

south swan
#

stop applying setVelocityTransformation after the end time 🤷‍♂️
if (time > t2) then {onEachFrame {}}; (or if (time > t2) then {removeMissionEventHandler [_thisEvent, _thisEventHandler]}; if you use more production-ready each frame execution) inside the loop

acoustic abyss
#

So you have to keep track of time manually when executing this? Ok.
Has anyone ever used setVelocity [0, 0, 0]? Or does that give unusual behavior?

south swan
#

wat

#

what can imaginably go wrong with setVelocity [0,0,0]?

acoustic abyss
#

I mean I don't understand why setVelocityTransformation wouldn't stop when you've defined both an endpoint in space, and a stop point in time with the interval. So would setVelocity even have a noticeable effect unless you manually stopped the frame by frame execution loop?

#

Correction: I think I understand that the interval can be changed to whatever scale looks good for the animation. But I don't understand why an endpoint is even a parameter here.

#

Regardless; thanks for the tips!

south swan
#

read that not as "beginning"/"end", but "value at interval 0"/"value at interval 1" 🤷‍♂️

#

the picture at setVelocityTransformation should be more like this, there's no logic to stop below 0 or above 1 blobdoggoshruggoogly

tough abyss
#

I have a script that I think will remove the stamina haha, but it only seems to work for my player unit, and only until I respawn. It doesnt work at all for my friend when playing LAN.
any smart one that can help me with correct script?

proven charm
tough abyss
faint burrow
#

Just rename your initPlayerLocal.sqf.

tribal crane
#

A code block used in a for loop is no different to a code block that is the main body of a function, that couldn't have been the substantive difference that gave you improved performance.

tough abyss
faint burrow
#

Your file has wrong name.

tough abyss
faint burrow
#

No problem.

tired cargo
#

Hi guys!

Is it possible to make mission database ? I mean, each server restart: positions ( players and vehicles ), equipment etc. are saved
Dedicated server

#

This is something simillar as Altis Life

exotic gyro
#

Yes

tired cargo
exotic gyro
# tired cargo Can you suggest the way ?)

You'd have to write it in sqf, probably use a hashmap for players (since the steam ID gets returned as a string) then store all the other stuff in... Eh, an array is fine but hashmaps are nice. Basically, save it all to profilenamespace on the server or the mission namespace then save it periodically

#

Then an init or respawn eh for restoring players

tired cargo
#

Well, thanks, I try it )

fleet sand
manic kettle
#

oh interesting, whats the difference between a database here and a hashmap?

#

I guess its more structured by the looks

hallow mortar
#

A database, in the sense that that article discusses, is just an arrangement of arrays. In engine terms there is no such thing as a database. All you're doing is making arrays in a certain format and manipulating them with array script commands.
A hashmap is its own data type, specifically designed for rapid retrieval from memory based on key searches. All the lookup stuff is done internally by the engine, not by multiple SQF commands, and the data is stored in a way that can be accessed very efficiently regardless of the number of records.

#

If you want to make a large database, and you want it to be SQF rather than handing it off to a dedicated database extension on the server, hashmaps would be the better choice. That stuff about scripted databases exists because hashmaps are a relatively recent addition to the game.

errant iron
#

I'm planning to add some CBA settings to my mission, but I want to make it an optional mod. Would init.sqf / initServer.sqf be sufficient for assigning default values, or is there a conventional way to define those variables if CBA isn't loaded?

(mainly concerned about my defaults overwriting whatever the user sets)

manic kettle
#

if (isClass(configFile >> "CfgPatches" >> "cba_main")) then {do stuff}

errant iron
#

heh, thats fair

#

self-documenting too

#

ooh maybe later i'll add ryan's zombie settings to my mission too

acoustic abyss
#

Had another question with setVelocityTransformation.
Has anyone used this command in a Multiplayer, Dedicated server situation? Are there any extra things to consider?

little raptor
#

e.g. TGC_fnc_addSetting which calls CBA_fnc_addSetting if it exists or just sets the default value if not

errant iron
#

hmm that's nice as well, i'll conditionally call XEH_preInit.sqf from init.sqf as a fallback then

acoustic abyss
#

All the implementations I've found so far in the BI forums and this Discord wrap setVelocityTransformation in an onEachFrame execution (stacked or not). The command is labeled Global in the BIKI. I think this would generate a lot of network traffic. Is ther e a way of making sure this is only local?

#

PS the object is decorative and needs no physics.

graceful kelp
#

has anyone ever made a script that modifieds a guns rpm to counter shitty fps

acoustic abyss
kindred zephyr
kindred zephyr
#

thats vehicle weapons only

graceful kelp
#

yh which is what im working with

acoustic abyss
acoustic abyss
kindred zephyr
#

do a super simple object instead. Although Simple objects should have physx already disables iirc 🤔

hallow mortar
#

Simple objects don't behave with PhysX themselves, but other objects will collide with them, like how static rocks work

acoustic abyss
tulip ridge
#

You can disable physx collisions by setting the mass to 0

acoustic abyss
#

Again with the multiplayer implementation-
Here's my test code:

// Create local object
VR_cube = "Land_VR_Shape_01_cube_1m_F" createVehicleLocal (getPosASL logic_1); 

//Set parameters. Object keeps orientation, only moves up 2 meters in 5 seconds.
startPos = getPosASL VR_cube;
endPos = startpos vectorAdd [0,0,2];
startVelocity = velocity VR_cube;
endVelocity = startvelocity;
cube_vectorDir = vectorDir VR_cube;
cube_vectorUp = vectorUp VR_cube;
 
t1 = time;
t2 = time + 5;

// Execute movement transform
0 spawn 
{
    _moveCubeEH = addMissionEventHandler ["EachFrame", 
    {
        _interval = linearConversion [t1, t2, time, 0, 1];
        VR_cube setVelocityTransformation 
        [ 
         startPos, 
         endPos, 
         startVelocity, 
         endVelocity, 
         cube_vectorDir, 
         cube_vectorDir, 
         cube_vectorUp, 
         cube_vectorUp, 
         _interval 
        ];    
    }];

// Terminate movement
    sleep 5;
    removeMissionEventHandler ["EachFrame", _moveCubeEH];

};

I will be executing this in an editor placed trigger onActivation field.
Should I wrap the spawn code in a remoteExec to make sure there's no network traffic?

hallow mortar
#

No, that's not what remoteExec is used for. remoteExec is actually used to generate network traffic (ideally but not always in a controlled manner) - it instructs other machines to execute the code.

acoustic abyss
#

I guessed that was its primary purpose (it's called remote after all). But I thought that the _targets parameter would let you limit it to separate executions on client machines.
Because the editor trigger is of course already global, right?

#

I want everybody to see the movement at the same time. I just don't want it to generate traffic.

hallow mortar
#

Unless a trigger is set to server-only, it exists as a separate copy on every machine, and its code (condition and activation) will be run locally on every machine.

acoustic abyss
hallow mortar
#

setVelocityTransformation is global effect, meaning other clients will see the results, and global objects won't get desynced between clients. But you're giving it a local-only object, so there's nothing to send; the object doesn't exist on other clients. (A very similar object does, their own local one, but it is a different entity and a reference to it won't work on other clients.)

acoustic abyss
#

Thank you very much for the detailed explanation.

hallow mortar
#

Here's my question: why is it a local-only object? Its position seems to be the same for all clients, and you want it to move at the same time for everyone. Why not use a normal (that is, global) object, instead of creating a local copy for everyone?

acoustic abyss
#

The players are pumping up a fuel bladder object. They will be near/on top of the object. They are also going to be in a pre-made scene with >100 editor placed objects.

I'm trying to limit both unusual Arma physics from collisions, and the performance cost.
My idea is to create the simple (no collisions) object underground, locally, and have it transform up by a meter.

Although this is starting to look like premature optimization :).

hallow mortar
#

Local objects won't stop collision problems, and the performance cost of moving one object with network sync isn't important.
Unless you test it and find the network sync causes noticeably choppy movement, I would suggest just using a global object. It'll be easier, especially for JIP handling.

#

Just make sure when you do things with creating and managing global objects, you're only running the code on one machine (e.g. the server). Otherwise you will end up with many more objects than you want.

acoustic abyss
#

OK. So players will be initiating this "pumping up" with a BIS_fnc_holdActionAdd. Should I then wrap the spawn part of the code-

0 spawn 
{
    _moveCubeEH = addMissionEventHandler ["EachFrame", 
    {  ...
        VR_cube setVelocityTransformation 
...
      ];    
    }];
...
};

in a remoteExec with target parameter 2 ?

hallow mortar
#

Depends how long it's going to take.
If it's going to only be a few seconds, just let the client that did the action handle it. The chances of them disconnecting in those few seconds aren't zero, but I wouldn't worry about it too much.
If it's going to take a while, then I would tell the server to do it, yes - although I would suggest making all of it into a function (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) and remoteExec'ing that. It's more efficient than sending all your code over the network, and handling creation on the server too will save having to broadcast the variable referring to the object.*
* global (scope) variables are not automatically global (network) variables. If you do e.g. vr_cube = createSimpleObject ..., then the object will exist on all machines, but the variable vr_cube will only exist on the machine that did it - accessible in all script scopes, but not for other machines. You'd need to broadcast it to other machines with setVariable or publicVariable - or simply handle it all on one machine and not need it to be either kind of global.

acoustic abyss
#

This is covering a lot of questions.
OK, I will just make this a 1 person thing that takes 10 seconds. And thus execute the code as is, without any variables set locally, or any commands executed on a particular machine.

#

How can I force a (single) destroyed object to remain indefinitely?

#

ie I have setDammage 1 an object at mission start.

winter rose
#

don't delete it?

acoustic abyss
#

OK so even though it starts a few hundred meters away from players, I can be sure it will not be part of garbage management?

thin fox
#

Hello. What is the best way to detect if a value from a variable has changed? I'm planning to use it with CBA_fnc_addPerFrameHandler.I just need some logic guide lol

hallow mortar
acoustic abyss
#

Got it. I just need it to remain in the game until players reach that part of the mission. Then I assume it'll be fine.

#

I'm almost there! I've got the holdAction and the setVelocityTransformation to work(!).
But the object, StorageBladder_01_fuel_forest_F, still collides with players. I have tried setMass 0 and disabling simulation. What's another trick?

little raptor
thin fox
tough abyss
#

i cant remeber work to do this, I need a init.sqf in the same folder as the .pbo ya?

pallid palm
#

yeah yes

#

i have 4 init files in my pbos

tough abyss
#

ah thanks been a min so im trying to recall. here is what I have.

pallid palm
#

all files should be in your pbo file

tough abyss
#

init.sqf execVM "wave_respawn.sqf"; wave_respawn.sqf ```hint "wave_respawn.sqf has been executed!";

#

not in the MPMissions?

#

the .pbo isnt a file on my computer. is only a unreadable text file

pallid palm
#

yeah all files and init should be in the pbo file

tough abyss
#

oh is there some third party extractor?

pallid palm
#

yeah you can pbo your mission from the editer

tough abyss
#

huh. oh wait here

pallid palm
#

send to MPmissions folder

tough abyss
#

H:\SteamLibrary\steamapps\common\Arma 3\MPMissions\StromtheBunker.Altis

pallid palm
#

you need to put all you sqf files in your pbo

tough abyss
#

Right, I explained, that the .pbo is not a file on my computers.

pallid palm
#

hmmm why

tough abyss
#

that is what I am trying to find out by asking people on discord?

pallid palm
#

see you make your mission in the editer then you putt all your files in the mission folder then you pbo it send it to MPMission folder

#

i have like 20 or 30 files in my mission folder the i send it to MPmissions folder and it pbos it

#

having a exturnal pbo i dont think will work

tough abyss
#

thanks help the help but I am not making myself cear enough on what exactly my issue is.

pallid palm
#

whats in your exturnal pbo

tough abyss
#

your not making any sense to me. nothing. I told you three times already the .pbo is not a file on my computer. so nothing can be in it.

pallid palm
#

if its not on your pc how can ArmA 3 read it

tough abyss
#

i mean file as in folder.

fair drum
#

are you looking to make a mod to share your mission? or just share the mission singularly on the workshop

#

if you are just sharing on the workshop as a mission, you don't need a pbo at all (you publish from editor)

pallid palm
#

hmmm i guess im not understanding what hes asking

fair drum
#

the answer that he is looking for is that the init.sqf file needs to be in the mission root folder where the mission.sqm is @tough abyss

pallid palm
#

yes agree

#

i have said that

tough abyss
#

okay so i found the answer, I need a .pbo manager

pallid palm
#

ArmA 3 can pbo also but yes you can use pbomanager

tough abyss
#

what?

pallid palm
#

the editer can pbo missions

tough abyss
#

isnt that just how is saves it?

pallid palm
#

no it saves it as a root mission folder

#

if you export it to MPMissions folder it will pbo it

tough abyss
#

👍

pallid palm
#

cool

#

i open my mission in the editer and check to make sure everythings right then i export it to MPMissions folder and wala its pboed then i can host it as a server and check it again

#

then i can put it on a DED server and check it again

tough abyss
#

due i told you you dont understand what im telling you

pallid palm
#

there is away to test you mission with out pboing it if you set file patching in steam

tough abyss
#

nor do you understand the screenshot I sent

pallid palm
#

it was to small to see

tough abyss
#

the .pbo being created is not the issue.

pallid palm
#

im not sure of the problum your having

#

you have said the pbo is not on your PC that could be your issue

#

i wish i could help you im sorry i dont understand what your asking

#

all i can say is all files must be in your root mission folder before you pbo it

#

you cant have a exturnal pbo thats not on your PC

#

i dont think you can have pbo files in your root mission folder eather

tough abyss
#

what is the mission folder?

pallid palm
#

but im not sure about that, i never had pbo files in my pboed file

tough abyss
#

MPMissions isnt a pbo file

#

so something is fucked with my .pbo

pallid palm
#

no its not is an folder to hold all your pboed filres

tough abyss
#

becuse your saying it should be a folder i can put .sqfs into?

#

okay wait, lets back up

pallid palm
#

yes the MP missions folder holds all your pboed missions

tough abyss
#

for a multiplayer mission. what is the file structure?

pallid palm
#

well there can be many file structures

#

your root missions folder holds all you mission you made in the editer

tough abyss
#

so like MPMissoins/ game1.pbo/ file1.sqf file2.sqf

#

right the Arma3/Missions folder

pallid palm
#

nope all them files should be inside the pbo

tough abyss
#

so game1.pbo/ MPMissions/ file1.sqf file2.sqf?

pallid palm
#

nope

tough abyss
#

explain

pallid palm
#

in your mydocuments is the mission folder

tough abyss
#

can you elaborate alittle more opn that?

pallid palm
#

in that folder should be all the mission you made in the editer

#

in each missions folder should hold all the files for each mission

#

in the mydocuments ArmA3 or other profiles folder theres a missions folder

tough abyss
#

right we talked about it already.

pallid palm
#

ok so each folder in the Missions folder is a diff mission, and in each diff mission folder holds all ther files for each mission

pallid palm
#

cool

tough abyss
#

it doesn't make the .pbo a folder.

pallid palm
#

yes right

tough abyss
#

right thats the issue.

pallid palm
#

cool

#

im so happy i could help you

tough abyss
#

but we already established that.

pallid palm
#

oh no

tough abyss
#

earlier, we established that the issues is the .pbo is not a folder, right so, not sure the next step?

pallid palm
#

you cant have all your mission files as 1 pbo

tough abyss
#

I know that

#

they will save differently, what do you mean?

pallid palm
#

each mission must be pboed as 1 pbo file

fleet sand
#

This is a bit painfull to watch 😄
But here: https://community.bistudio.com/wiki/PBO_File_Format
https://community.bistudio.com/wiki/Mission_Export
So you have 2 MPMissions folder.

  1. Mission folder is inside the Documents the path would look something like this;
    \Documents\Arma 3 - Other Profiles\Legion\mpmissions\Framework.Stratis
    Note: Framework.Stratis at the very end that folder was generated when i saved a mission in mpmissions in eden editor.
    2.Second MpMissions folder is located in the root of your game file path could be something like this:
    D:\Steam\steamapps\common\Arma 3\MPMissions
    Now in this file when you export a mission to multiplayer you will have a pbod mission and this is the file that you put on server.
tough abyss
#

right. how do you get the .pbo to become a file?

#

holy f

pallid palm
#

lol

#

thx Legion

tough abyss
#

really. all that to write some code for it

#

not worth it at all, I remeber a few years back I did this far less complicated it seemd like. thanks anyay

pallid palm
#

pbo is a file

fleet sand
tough abyss
#

i mean, not origianally native to a wondows

#

i cant just wwrite some simple code on a .sqf file

pallid palm
#

if you just use the editer its way easy

tough abyss
#

what do you mean? i am??

fleet sand
pallid palm
#

yeah you can make a simple sqf file but it must be in the mission folder before you pbo it

tough abyss
#

so wait.

#

you put a .pbo inside a .sqf. but out .sqf inside a .pbo

pallid palm
#

no no

tough abyss
#
sleep 1; waitUntil { not isNull player };
hint "Welcome to the Server.";



// This is the action that the player will perform to capture the laptop
[laptop1, "Capture Laptop", "", "", "player distance _target < 3", "call {true}", {}, {
    // This is the code that runs when the action is completed
    laptop1 setVariable ["captured", true]; // Set the laptop as captured
    hint "You have successfully captured the laptop!"; // Display a message to the player
}, {}, [], 10, 0, true, false] call BIS_fnc_holdActionAdd;


addXP = {
    _player = _this select 0;
    _enemy = _this select 1; // Enemy that was killed
    _xpToAdd = 10; // XP value for killing an enemy, can be adjusted

    _currentXP = _player getVariable "XP";
    _newXP = _currentXP + _xpToAdd;
    _player setVariable ["XP", _newXP, true];

    // Show a hint message
    hint format ["You gained %1 XP for eliminating %2", _xpToAdd, name _enemy];

};

// Event handler for killing an enemy
player addEventHandler ["Killed", {
    [player, _this select 1] call addXP; // Pass player and the killed enemy to the function
}];
#

few years ago i wrote this for ann online server

#

it worled fine

pallid palm
#

you put the sqf in the mission folder then you pbo it

tough abyss
#

okay what does "you .pbo it" mean exactly

fleet sand
tough abyss
#

i did that

pallid palm
#

so all the files you need are in the mission folder right

tough abyss
#

MPmissions

#

becuase Legion just said export them

pallid palm
#

no no the mission file in mydocuments

tough abyss
#

what in the actual double fuck

#

great guys. have a great night.

pallid palm
#

yeah you open the mission in the editer

fleet sand
# tough abyss i did that

Ok so when you go in eden editor and when you save a mission it will generate a file; Name.Map
Then you put your sqf files in that folder and make all the changes you want. And when you are done and want to put that mission on the server to play you export mission get the PBO from MPMissions from your root where you install the game and put that file on the server.

pallid palm
#

agree

#

i dont think he understands where his mission folders are

#

i need a beer after all that lol

#

and i dont even drink lol

tough abyss
#

I pointed out where it was twice

tough abyss
tough abyss
#

ok well, I restarted and saved a basically blank map. but in my Arma3/Missions, I dont see the mission I saved in it? strange.

fleet sand
tough abyss
#

SIngleplayer

#

im in the H:\SteamLibrary\steamapps\common\Arma 3\Missions folder

fleet sand
tough abyss
#

wait

#

so, save or export because they are different? But if I export then the .pbo isnt a folder anymore?

#

ya look

#

thats H:\SteamLibrary\steamapps\common\Arma 3\Missions

#

so you have to save it.

pallid palm
#

i making a step by step for you ok m8

tough abyss
#

well look. i am saying the export makes it not a folder anymore.

pallid palm
#

hold on

tough abyss
#

the docs for this is absolutly trash.

pallid palm
#

i making a step by step for you ok m8

#

hold on

#

ok you ready to read

#

ok here it is
1st make a mission in the editer
then save it
this will make a folder in your mydocuments/ArmA 3/your name/missions
lets say the mission is called Attack_city.straits
so then you open the folder in your mydocuments/ArmA 3/your name/missions/Attack_city.straits
this mission will have a .sqm file only
then put any .sqf files or other files in that folder Attack_city.straits
then you go back to the editer and open the mission in the editer
then you go to the upper left and find Export to MaultiPlayer,
this will make the mission into a pbo file Attack_city.straits.pbo
so then exit the editer do not close the game
then go to Quick Start
then at the top chose host server
your mission should be on the map you made your mission on
2x clicke on the mission name bingo all done

tough abyss
#

😮‍💨

#

yaman, thanks but i'll after to come back tomorrow and ask some other people

#

we arent understanding eachother.

pallid palm
#

read that its all there

tough abyss
#

oh my god your right it literally just fix all the issues i was having

#

no i told you, you didnt undestand what im asking for help about

#

we backed up to the missions not MPMissions and from there idk.

#

I explain that when I saved the mission I wasnt seeing it the misisions folder for some reason and its like you skip over the acutal issue i have and tell me to read

pallid palm
#

so its all fixed now ?

tough abyss
#

dude...

#

what in the fuck.

pallid palm
#

you don't have to use the F boom i mean really

#

well i hope someone can help you

#

i think you are looking in the incorrect place for your missions folder its not in usersaved

#

its in missions

tough abyss
meager granite
#

merge doesn't return the hashmap 😡

meager granite
#

... remoteExec [..., [-2, -3]] will that RE to everyone but 2 and 3? 🤔

meager granite
#

Or in other words, it doesn't work, only single negative owner allowed

meager granite
#

When does JIP setObjectTextureGlobal happen in initialisation order? 🤔

granite sky
#

hmm, interesting question of whether for that sort of command the networking just sends the current state of the object, or stores each one as a JIP message.

#

I guess texture state can be local too.

#

Might be able to tell by spamming a bunch of them and checking the JIP queue.

still forum
spare adder
#

Is there a plugin for np++ for arma scripting?

#

Google searching gave me options from 2013-14 and a dead github.

kindred zephyr
#

sqf markup basically

spare adder
#

Is that something built in, or is there a langauge file to download?

haughty plume
#

Is there a way of adding MEDEVAC support for eden editor, for example, unit gets into engagement, one soldier goes down, I could then call in a helicopter to pick him up and take him away?

spare adder
#

Collins, there is a mod that enables medevac, where you load a unit, player or otherwise, it flies out, heals them, and then brings them back.

#

It is designed to work with ACE, and needs to be fixed, but the dev has said it is fine to edit the files as long as you credit them.

spare adder
#

I edited mine though.

haughty plume
#

Ok thanks a lot, will have a look at this!!

spare adder
haughty plume
#

Thanks a lot, tbh I am not too concerned about the healing part, just want a helicopter to land, I load them up and they go

spare adder
#

Okay, the script has the heli turn and fly them back in after it reaches the healing point, so you will just have to adjust that then.

haughty plume
#

Yeah no worries, thanks again!

wise frigate
#

Anyone able to help me out with a script I'm trying to make?
Looking to make a script which returns the following values:

  • Position of a memory point on a Primary Weapons optic
  • Direction of the players rifle.

The point is to attach a PIP camera to said position in a specified direction

kindred zephyr
little raptor
#

@wise frigate this is for muzzle point but you can do the same for optics too

wise frigate
#

Does this also take into account the bank/angle of the rifle or just the point itself?

little raptor
#

It also has the direction

#

_vx vectorMultiply -1 in the last line is the direction in model space (or you can just use weaponDirection)

wise frigate
#

Nice, awesome

#

So i'd just change it out from MuzzlePos to any other memory point?

little raptor
#

muzzlePos is defined in config

#

Its actual mempoint name is something else (zasleh something I guess)

#

But yeah

#

Look in the config to see where the optic mempoint is defined

wise frigate
#

Gotcha, so theoretically I could just add lets say:
OpticEndPoint = "OpticMem"; in the config of said optic and it should work?

little raptor
#

No no it's defined by the weapon config. You just need to look it up

wise frigate
#

Solid, will do, thanks!

tough abyss
#

so I have my init.sqf in the folder with the missions.sqm. still i simple hint it's working.

fair drum
#

I'm sorry, not sure what you are asking with that last sentence.

#

That file structure looks fine.

tough abyss
#

sure, I mean I just started this so I might know be able to ask the right question.

#

the hint "Test"; in the init.sqf isnt displaying when the mission starts.

sharp grotto
#

Make a initplayerlocal.sqf

waitUntil{player == player};
hint "Test";
tough abyss
#

sure tihng I'll try it

#

nah, strange.

faint burrow
#

You should wait mission start:

waitUntil { time > 0 };
tough abyss
#

does it matter if I play it as single or multiplayer?

little raptor
#

No. It should work either way

tough abyss
#

what the heck, still nothing? shouldn't be too hard so maybe a deeper issue, although not sure what could've happened?

little raptor
#

Did you close the mission or just restarted?

tough abyss
#

I went back to the enden editor

little raptor
#

What are the contents of your init.sqf file?

tough abyss
#
hint "test";```
little raptor
#

What if you put sleep 2; instead of the waitUntil line?

tough abyss
#

nah nothing, i have sleep 2; hint "test";

proven charm
#

correct mission loaded?

tough abyss
#

yup

sharp grotto
#

I would use both

waitUntil{player == player};
uisleep 5;
hint "test";
systemChat "Test";
little raptor
#

What did you write the code with?

tough abyss
#

Vscode

little raptor
#

Make sure you use NP++ or VSCode and UTF8 encoding

tough abyss
#

and that didnt work either so its not reading that file