#arma3_scripting

1 messages Β· Page 20 of 1

open fractal
#

the game doesn't know what _crate is because it doesn't know what _this is.

#

this script is not intended for object inits, it's probably designed to be set up as a function

vernal venture
#

_this is the object calling the script, which is clearly what I'm doing wrong, and I have no idea what the correct format is to relay that info.

open fractal
#

_this is an undefined variable in this case. It's nothing

#

this without the underscore is the object that the init belongs to

#

this select 0 is wrong anyway

#

this is the object, not an array

#
_crate = this;
open fractal
vernal venture
#

That script is in my scripts folder, and I'm looking to call it in a spawner module and a couple pre-spawned object inits.

vernal venture
#

Yes, I know

open fractal
#

can you share how you're calling it?

vernal venture
#

Tried execVM "scripts\fillCrate.sqf"; and some variations of [this] execVM "scripts\fillCrate.sqf";

open fractal
vernal venture
#

Yeah, it returns true.

open fractal
#
[this] execVM "scripts\fillCrate.sqf";
``` should work in the crate's init
#
if ("B" in [_x splitString "_" select 0]) then
``` what is this for?
vernal venture
#

My guess is it's checking that the item isn't a unit? Found this through google.

#

And yeah, it still says crate is undefined.

open fractal
#

I think backpacks work with additemcargo though

copper raven
#

no

#

unless something changed

open fractal
#

I definitely could be wrong

south swan
#

i'm slow and should read to the end of convo before commenting, sorry πŸ€¦β€β™‚οΈ

copper raven
#

it's better to check if a class exists in cfgVehicles

#

if you're running mods fx

south swan
#

or if it has "isBackpack == 1"

copper raven
#

not guaranteed it will be B prefixed

vernal venture
#

I could probably take it out entirely, since I'm running this on a vehicle spawner

copper raven
#

but in the code, _items never changes, and it doesn't have anything with a B, so why check it?

vernal venture
#

To know which command to use to load the item?

open fractal
#

dependent on vanilla naming convention

copper raven
#

both of those ifs are redundant, they always run the same code

#

unless you pasted that list for testing

vernal venture
#

No, I pulled that off of google and changed the list to my items. Supposedly in 2018, that script worked to load an object's inventory.

copper raven
#

in that particular case, you can get rid of the ifs, and only leave the addItemCargoGlobal line

vernal venture
#

That streamlines that, but the call itself still doesn't work.

copper raven
#

you're executing it from an initbox of a crate/vehicle or something?

vernal venture
#

initbox of a helicopter
And I'll be doing the respawn module too, which I think has to change [this] to [_newVh]? But neither seem to work

copper raven
#

initbox of a helicopter
code?

vernal venture
open fractal
#
//for init:
//  this call tag_your_function
//  this execVM "path\toScript.sqf"

if !isServer exitWith {}; //exit if not server (prevent repeated clearing and adding + JIP)
private _crate = _this;
private _items = [
    ["ACE_quikclot", 5],
    ["ACE_elasticBandage", 5]
]; //list items

private _backpacks = [

]; //list backpacks (leave blank if none)

//clear inventory
clearBackpackCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;

{ _crate addItemCargoGlobal _x } forEach _items; //add items 
{ _crate addBackpackCargoGlobal _x } forEach _backpacks; //add backpacks
#

Here's something a little cleaner and more dynamic

vernal venture
#

Nope.
_crate = |#|this;
Undefined variable in this and _crate

copper raven
#

well

#

you're running a different code from what you sent

open fractal
#

yeah

copper raven
#

_crate = _this select 0;

open fractal
#

I made that correction without the context of it being a separate file

vernal venture
#

Yeah, we already made that correction

open fractal
copper raven
#

then you didn't save the script

open fractal
#

no the original code is right for a function-as-file

#

my correction applies to pasting directly in init, which is what I thought you were doing

#

use _crate = _this select 0; or the script I posted with the instructions at the top

vernal venture
open fractal
#

there's a sample line for using execVM in the comment at the top

vernal venture
open fractal
#

post your code for calling the script

vernal venture
#

this execVM "scripts\fillCrate.sqf";

open fractal
#

is that line of code anywhere but in an object init box?

vernal venture
#

Nope

open fractal
#

can i see a screenshot of the init box

vernal venture
#

Looks like it IS working, though. Weird. Might restart the whole game, see if it clears up the error.

vernal venture
open fractal
#

yw

meager granite
#

Sounds interesting. Maybe have it return command output as well if possible?

ocean folio
#

do references to groups break if the group changes locality?

peak pond
#

Don't think so, but locality is tricky. Read docs for specific commands and test in multiplayer.

ocean folio
#

that makes my life so much easier

#

so much less to worry about

sudden yacht
#

I was looking at suppression and how it works in game against AI. How come weapon sway affected when a player gets hit and not NPC's???

granite sky
#

Suppression certainly affects their ability to shoot straight either way.

sudden yacht
#

@granite sky yeah.. but they are not effected by bleeding.. players are... and suppression only works for a few seconds before the ai recovers. Just seems a bit unfair if you ask me.

wind hedge
#

Will "getRelPos" work with a marker? something like sqf private _rdmDir = random 360; private _spawnPos = "Marker_1" getRelPos [50,_rdmDir];

meager granite
#

left argument is object, so no

#
getMarkerPos "Marker_1" vectorAdd [sin _rdmDir * 50, cos _rdmDir * 50, 0]
```just calculate it yourself
wind hedge
#

Weid... because even markers have a direction...

unique sundial
meager granite
#

I'm only talking about serverCommand usage on server-side, not whatever client types in the chat with hashtag

#

Problem I am myself having, I don't know if server-side ran

password serverCommand "#mission something.Altis"
``` will work because of password or not, I need to know if password is correct so I can be sure that `serverCommand` will change the mission.
unique sundial
#

the event handler will fire either way and return bool. you can also execute a dummy command to know if password works

tough abyss
#

i have a pbo i want to turn into a mod how would i go about doing so?

tough abyss
#

thanks

meager granite
meager granite
#

Not need for it personally, just a thought about possible EH

unique sundial
#

what #missions outputs?

meager granite
#
2022/09/15, 15:01:52 Successfull attempt to execute serverCommand '#mission KingOfTheHill_RHS_by_Sa-Matra_for_CODE4.Altis' by server.
``` in RPT after `#mission` through `PASSWORD serverCommand COMMAND` on server side.
proven charm
#

is there faster alternative to findIf?

still forum
#

it depends

copper raven
proven charm
copper raven
proven charm
#

thx will do some speed tests

#

one problem though, is that it cannot take groups , only units etc

#

im looping groups and getting leader pos for the distance check

copper raven
#

well if it's only leader you care about, you should probably stick to findIf

south swan
#

(_groupsArray apply {leader _x}) inAreaArray [...] πŸ€·β€β™‚οΈ

proven charm
#

apply fast?

south swan
#

try it. I'd say apply or any other in-sqf loop over the array would take way more time than any form of distance-computing in-engine

copper raven
#

depends how many groups you have

#

you can also maybe just keep an array of leaders, and occasionally poll it

winter rose
#

Premature optimisation is the root of all evil β€” Donald Knuth

proven charm
copper raven
#

apply + inAreaArray will be slower than single findIf

#

on average

little raptor
south swan
#

if there are any matches - sounds almost certain πŸ€·β€β™‚οΈ

little raptor
#

I think doing distance check in loop is slower meowsweats

#

I mean if no group is in the "area"

south swan
#

if no group is in the "area" - then findIf passes over the entire array in-SQF and we have 1 loop. If we go with ...apply...inAreaArray - we go over the entire array in-SQF for sure.

copper raven
#

yeah but then also if first group is in the area πŸ˜„

#

i do think inAreaArray is the best

#

but with managed array of leaders, that you keep track of

little raptor
#

yeah it's easier now that we have group EHs

south swan
#

with managed array of leaders that you keep track of you have 3x the code and 5x the failure points πŸ˜›

#

with 6 groups in VR on my machine :
grps findIf {(leader _x) distance player < X} is 0.0028 ms with match on first, 0.0109 with no match
(grps apply {leader _x}) inAreaArray [getPosWorld player, X, X] is 0.0099 with (grps apply {leader _x}) part being 0.0078 of those
If going for "any unit" instead of "group leader":
flatten (grps apply {units _x}) inAreaArray [getPosWorld player, 3, 3] 0.0175 ms
grps findIf {count ((units _x) inAreaArray [getPosWorld player, 3, 3]) > 0} 0.005 - 0.0219 ms (match first/no match)

copper raven
#

yeah so like i said, cache leaders if you want best perf

#

loop is like 90% runtime, and if you have a lot of groups it becomes terrible quick

proven charm
#

🧐

copper raven
#

50 groups

little raptor
#

it's not a fair comparison tho πŸ˜›

#

you're making a new array in every iteration of the loop

copper raven
#

pls add inlineAsm πŸ™ with an assembly parser on top of that, so i can create array constants in peace meowsweats (joke πŸ€” )

still forum
#

notlikemeow I would need to touch the compiler for that

#

Just write assembly manually and pack it as bytecode πŸ˜„

copper raven
#

well yeah i already have πŸ˜„ just saying it would be nice to have it in the game itself meowsweats

proven charm
#

thx for all the ideas, havent got much more speed yet , the milliseconds are so fluctuating.....

#

I suppose you cant combine these two lines? ```sqf
private _eneGroups = _groups select { side _x != _side };

private _enePositions = _eneGroups apply { _x call frontGetGroupPos };

little raptor
#

you can but not sure how much faster it would get

#

and instead of this:
_eneGroups apply { _x call frontGetGroupPos };
you can write
_eneGroups apply frontGetGroupPos;

#

and use _x instead of _this (or params)

#

but again it's not noticeably faster

proven charm
#

writing SQF loop for that probably wouldn't be faster?

dry python
#

anyone know a faster and better working way to block thermals on optics? if you spam the thermal/nightvision command you are able to use the thermal 1 sec.. which makes the script kind of useless.

while {true} do {
    if (currentVisionMode player isEqualTo 2) then {
    cutText ["THERMAL IMAGING OFFLINE", "BLACK", -1];
    waitUntil {currentVisionMode player != 2};
    0 cutFadeOut 0;
    };
};
dry python
#

does it also work with the viper helmets?

trim tree
#

hi there, i am having a bit of trouble with this code:

ugv_1 disableAI "ALL";
ugv_1 EngineOn false;

heli = ugv_1 nearEntities ["Air", 15];

ugv_1 attachTo [heli, [0.2,2,-2]];
ugv_1 setObjectScale 0.8;

The problem is, that the ugv (a vehicle) wont attach because, I assume, the nearEntities returns an array where as I would need an object. But how would I convert the array into a object?

exotic flame
#

Is there a way to set walk to defult on a server ?

granite sky
#

@trim tree Do you want it to attach to the closest air vehicle or is picking one randomly out of the 15m list fine?

delicate lotus
#

I am currently making a jet deathmatch mission where there is a FFA between players and also AI, so player vs player vs AI.
Currently all players are civilian and all AI east.

How can I disable the crossed square / diamond indicating a friendly unit?

pseudo ridge
#

What is this?Server: Object info 4:2647 not found. Can't change owner from 0 to 210907364 Server: Object info 4:2646 not found. Can't change owner from 0 to 210907364 Server: Object info 4:2649 not found. Can't change owner from 0 to 210907364 Server: Object info 4:2648 not found. Can't change owner from 0 to 210907364 Server: Object info 4:2651 not found. Can't change owner from 0 to 210907364 Server: Object info 4:2650 not found. Can't change owner from 0 to 210907364 Server: Object info 4:2653 not found. Can't change owner from 0 to 210907364I probably tried to change the owner of an null object?

vernal mural
#

what is the state-of-the-art way of sending a camera feed on a screen ? JIP compatible ?

winter rose
#

depends

vernal mural
#

Newest way, best practices, etc.

#

But I found what I needed I think

#

I still don't get why render to texture fails when switching to splendid camera, but anyway

#

Not a big deal in my case

crude vigil
orchid plover
#

Is there any way to enable the / chat entry in SP? Whether officially or through a mod. Realized it was gone and working on sth to utilize typing

copper raven
#

you can recreate it though with scripting

#

but why not just play the scenario in mp, player host?

orchid plover
copper raven
#

yes, custom gui

orchid plover
#

ty for the help πŸ˜„

copper raven
#

what do you need chat for though (in sp)? πŸ˜„

orchid plover
# copper raven what do you need chat for though (in sp)? πŸ˜„

that is.. complicated to explain lol. working on a networking project that exists outside of arma's existing server infrastructure, was looking to implement a "global chat" that would work in all scenarios, even if you were by yourself in another mission

basics are done but I was hoping to utilize HandleChat and pass off the entered message, since that's not an option I'll look into GUI for text entry :p

copper raven
#

a custom chat sounds even more proper for what you're trying to do

orchid plover
#

definitely, thanks again for the pointer in the right direction

vernal mural
#

Even re calling the initializing function seems to have no effect

crude vigil
crude vigil
vernal mural
#

I'll try thanks

velvet merlin
#

from my profiling the checkVisibility, and even more so terrainIntersect + lineIntersects are the biggest heavy hitters

#

optimization done already:

  1. only compute for known targets
  2. for targets in field of view
  3. only every 1s (instead per frame) when already known
#

possible improvements:

  • cache stuff on known units (ie class type)
  • avoid isKindOf by caching type (Infantry/StaticWeapon/Tank/Vehicle)
copper raven
# velvet merlin looking for some sqf code optimization advice for unscheduled running 3d target ...

possible improvements:

  • cache stuff on known units (ie class type)
  • avoid isKindOf by caching type (Infantry/StaticWeapon/Tank/Vehicle)
    yeah, you should do that, from a quick look:

{({alive _x} count (crew _unit)) > 0}
findIf instead
ο»Ώ
{(getNumber (configFile/"cfgVehicles"/(typeOf _unit)/"isPlayableLogic")) != 1};
configOf and use >> instead (abit faster than /)
if ((difficultyOption "visionAid" == 0) && {(!([side _unit, playerSide] call BIS_fnc_sideIsFriendly))}) exitWith {};
this should literally be in the _condition?
if (!((_angle <= 90) || (_angle >= 270))) exitWith {};
variables in lines 57-59, can be defined after this exitWith.

                    if (time < ((_unit getVariable ["LIB_UnitIndicatorLastSeen",0]) + 1)) then
                    {
                        _seenVeryRecently = true;
                    }

this can literally be _seenVeryRecently = time < ((_unit getVariable ["LIB_UnitIndicatorLastSeen",0]) + 1);, cut the else and invert i.e., if !_seenVeryRecently then { ... }
same thing in line 96. line 114, you can use a hashmap, infact you should first check the condition at line 122, then decide whether you want to pick a color, or use the unconscious one
not really part of optimization, but you can use exitWith in many places instead, so you don't have to indent as much.

winter rose
#

one less scope indeed please!

south swan
#

also each and any if (condition) then { rest of the script with extra tab} can be painlessly swapped to if (!condition) exitWith {}; rest of the script without an extra tab 🀣 but that's more on code formatting than actual performance

winter rose
#

continue* but yeah ^^

#

1/ make it work
2/ make it readable
3/ make it optimised πŸ˜‰

velvet merlin
#

@copper raven much appreciated πŸ™‡β€β™‚οΈ will share how much % this brought

#

best would be have access to the native unit icon drawn tho 😬

quiet gazelle
#

is there a way to declare a variable without assigning a value?

south swan
#

private "_varname"; is probably the closest thing. But there's barely a usecase for that, i suppose?

quiet gazelle
#

i have a few variables that only get used if certain conditions are met, so far i've just been setting them as empty arrays, thought i could use that there

still forum
#

private _varname = 0; might be fastest.

that is two script instructions only

granite sky
#

If you want to do more than one then private ["_var1", "_var2"] is faster

#

(assuming that you don't need an initial value)

little raptor
#

either way having uninitialized variables is a sign of bad design

#

it's only (sometimes) acceptable with function args

copper raven
#

it has its use cases, it doesn't hurt to initialize though (what Dedmen wrote) even if it's unnecessary

little raptor
#

no. a var that may be uninitialized is not justifiable. you can always do other stuff instead

#

the only thing I can think of is when you store the return of a function that sometimes returns nil when it fails

#

and you can leave the default value of the variable nil anyway

copper raven
#

if a child scope always assigns to x and y, and you need those values in the parent scope, i see no point in initializing them, but just "declaring them" in the parent scope

little raptor
#

that's not the same

copper raven
#

huh?

little raptor
#

I said if it may sometimes be uninited

#

if it is always initied at some point then yes it's fine

copper raven
#

ah i read what you said wrong way then πŸ˜…

little raptor
#

tho I guess in SQF it does make sense think_turtle

#

because I think the more you nest something, the slower newer calls get

granite sky
#

I like nils generally because they throw errors early :P

little raptor
#

so you can just do a isNil check in the outer scope:

private "_var";
if (bla) then {
  if (blabla) then {
    ..
      _var = value;
      // a function call here will be nested several times, so just do it outside
  };
};
if (!isNil "_var") then function;
granite sky
#

Also when you're storing bool flags on objects, true/nil tends to work out much cleaner than true/false.

little raptor
#

if you mean setVariable you can have a default value

copper raven
#

nil throwing errors early? what do you mean by that?

#

in scheduled? yeah

copper raven
#

i wouldn't worry too much about it though

granite sky
#

Reusable function for finding the nearest object in an array to a position or object:

private _fnc_findNearest = {
  params ["_fromPos", "_objects"];
  private _nearest = objNull;
  private _nearDist = 1e6;
  {
    private _dist = _x distance2d _fromPos;
    if (_dist < _nearDist) then { _nearDist = _dist; _nearest = _x }; 
  } forEach _objects;
  _nearest;
};
#

Should be a command for it, but there isn't.

hallow mortar
#

What's the difference between that and BIS_fnc_nearestPosition?

granite sky
#

Other than being a bit quicker? Not a lot hopefully.

mighty bronze
#

Hello, is there anyway to make a m113 faster on water? Thanks

unique sundial
#

Ask the mod creator

warm hedge
#

aka not something you can do in scripting

hallow mortar
#

You can't make it natively faster but you can script an action to give it a temporary velocity boost. It's a little janky but doable

naive needle
#

I think "setUnitFreefallHeight" command is not getting synced with other clients and stays local

#

can someone check ?

peak pond
#

Any way to keep a Logic from getting deleted? I'm trying to use a tree of Logics with a script, but the child Logics sometimes get deleted before the root Logic gets a chance to run its script.

copper raven
granite sky
#

Did you try it? IME sort's pretty awful for large arrays.

copper raven
#

i tested it some time ago

peak pond
#

Yeah something seems to be deleting my Logics... wasn't sure if that's expected. Could potentially be another mod, let me try in vanilla...

naive needle
#

@copper raven but it supposed to change on all computers if I execute it on me for example , right ?

copper raven
#

if you execute it where unit is local, it should properly sync

naive needle
#

Since Im using it on me , it should do that

#

but it dosent

#

player setUnitFreefallHeight 600;

#

and If someone does getUnitFreefallInfo ME it will return back [false,false,100]

copper raven
#

remoteExec it

peak pond
#

Ok, in vanilla testing the logics stick around like I hoped. I think a bug in my own script is deleting them πŸ€¦β€β™‚οΈ

naive needle
#

Where can I report bugs again ?

granite sky
#

apply+sort comes out as slightly worse for me in both 10 and 40 object cases.

#

Code is a bit shorter though:

private _fnc_findNearest = {
  params ["_fromPos", "_objects"];
  private _sortArray = _objects apply { [_fromPos distance2d _x, _x] };
  _sortArray sort true;
  _sortArray select 0 select 1;
};
#

should really be a command that executes 20x faster anyway :P

copper raven
#

ah i was doing it on a very small object pool

#

you're right yeah

cold depot
#

Looking for some help on a script acting differently when local host testing vs Dedicated server testing.

Locally the script works great

on a dedicated server the model never seems to attach to the player then the player seems to get "stuck" in the script forever unable to perform any other menu actions at all.

so far this is what I've been able to been able to gather from my testing:
call BIS_fnc_WL2_sendClientRequest ... this part is working correctly, I'm getting a system chat message back from the correct part of the code.

_h/_offset_tweaked is working correctly in local testing...I get no model and I can't hit spacebar to do anything on a dedicated server.

call BIS_fnc_WL2_hintHandle...other parts of this script are working correctly and I was able to force call it by setting it to TRUE.

I'm stuck on where its broke. On dedicated server, I get no model attached to player, I can't assemble and I can't cancel...just stuck in a forever type loop.

Script link on github:
https://github.com/korbelz/WarlordsReduxMe.altis/blob/main/Functions/client/WL2_orderDefence.sqf

GitHub

Bare metal Warlords Redux with many bug fixes. Core gameplay features extended with added customization. 100% Vanilla, no extra script, add-ons or mods needed. - WarlordsReduxMe.altis/WL2_orderDefe...

copper raven
#

i have no experience with warlords framework, so don't know what the function exactly does

#

put some debug in line 17 and 19, see if both of them run (preferably also print the _asset)

meager granite
#

@unique sundial How feasible it would be to change object destruction type per object instance in the engine? This has been a long going issue where some great objects are borderline useless because how easily they get destroyed, especially since PhysX ragdolls kill everything around them in multiplayer.

#

Specifically a lot of stuff with DestructTent, it looks ugly, very bad for gameplay (you can prone hide under flattened objects)

#

Simple objects don't help here either because destruction type is defined in the model as far as I understand

#

Practical use - have some kind of camo netting that can't be killed at all.

#

Another approach to solve the issue would be a command to disable collision damage that flattens the object

#

Otherwise ENTITY setDestrType STRING with string being something like DestructNo

hallow mortar
unique sundial
# meager granite Otherwise `ENTITY setDestrType STRING` with string being something like `Destruc...

Anything TYPE is a common property for given object class. The object has dynamic properties and static properties. This would be static property and to be able to change it per object it would have to be implemented as dynamic property so on top of more work it would add additional burden on object simulation, so I'd like to avoid this. I'd rather think how to solve a particular problem you are having. So lets hear the concrete scenario so we can see what can be done.

meager granite
unique sundial
meager granite
meager granite
#

Not sure about PhysX bodies though, gonna see how it behaves now

#

Gonna observe more to see if ragdolls bypass this fix or not because previously having any DestructTree and DestructTent objects near dying units in populated multiplayer killed these objects very quickly

unique sundial
#

Ok let us know

drifting portal
#

is it possible to import functions into description.ext from another file?
something like #import OtherClassOfFunctions.ext or something?

drifting portal
#

What should be the extension of the file I'm including? .ext?

copper raven
#

doesn't matter

#

usually people like to use .h or .hpp, so you have syntax highlighting in the ide

drowsy geyser
#

is there a way to disable the horn on a vehicle via script?

warm hedge
#

Remove horn weapon via removeWeapon

hallow mortar
scenic shard
#

how can I send a script I want to trigger as a parameter to another script?

I tried this and sending "scriptname.sqf" and a empty array as params. but it did not work.

params["_script", "_args"];
_args execVM _script;
sharp grotto
#

First, don't use execVM, it's intended for single use only

#

make it a function

#

and then for example

_Number = 69;
_Number call fn_doStuff;
#

or

_Number1 = 69;
_Number2 = 420;
[_Number1,_Number2] call fn_doStuff;
scenic shard
#

ok, this example is likely only gonna run once. but good to know in general. where would I define fn_doStuff ?

scenic shard
#

and how would I actually use it. the intention here is that the missionmaker can add their own script/code as a parameter and have that trigger when my script reach a certain state.

So I want them to be able to just send the name of the their script. or if it can be done using functions in some other way if that is better

little raptor
cosmic hatch
#

Someone willing to help me set up a KP Lib file?

#

Never done it before

trim tree
granite sky
#

The addAction code is remoteExec'ing to the server?

trim tree
#

it is written into the object init

granite sky
#

ugh, object init :/

trim tree
#

it would be no problem tho to call it through init.sqf or similar

granite sky
#

Whatever activation code you have in the addAction will run locally to the player that triggers the action.

#

so simply calling hint "some text" in there will only be seen by the player that triggered the action.

trim tree
#

interesting, alright thanks!

granite sky
#

The object init itself is run everywhere, hence everyone can see the action.

#

This is not always what you want

trim tree
granite sky
#

There are two separate uses of global/local here.

#

A global variable is visible to every script on a particular client, but not necessarily visible on other clients.

#

Indeed, you can have two global vars called heli on different clients with different values.

#

But in this case it should definitely be private _heli

#

because it's short-term usage and you don't want or need it to be visible outside local scope.

trim tree
#

what i am (or currently actually am lol) trying to achieve is to load a UGV into a helicopter and then be able to unload it as well. heli needs to be global (for all clients) because the unload action 1.) requires the orientation of the actual helicopter used and i believe that it is the easiest solution to simply store the variable from the load action instead of trying to figure it out again during unload and 2.) because it may not be the same person unloading the ugv vs who loads it.

#

well, maybe on second though i could use attachedTo to get the heli. that way i wouldnt need to store it πŸ€”

south swan
#

Any helicopter or a transport one that can actually fit the UGV? If second - then vanilla vehicle-in-vehicle transport may work as-is.
If any - would the UGV be attached to the heli model or removed and recreated on unload? If second - then storing the UGV state in a variable on the heli and adding an action to the heli may be the way.

trim tree
#

unfortunately there is no helicopter available to me that can naturally transport it (it clips a little with the one i am using right now), hence im using attachto ^^

#

and no, i want it to be visible

south swan
#

then yes, attachedTo would give the heli. And both actions can be added at the same time, with one only showing up if not attached and other one only showing up if attached

granite sky
#

Conventionally with these things you add the unload action to the heli rather than the object, although maybe that'll work if you can see the thing well enough.

#

much easier logically if you can add both actions to the UGV.

south swan
#

i'd still say shove both actions in the Init of the UGV with inverse show conditions

granite sky
#

Definitely try it that way.

south swan
#

like, ```sqf
this addAction ["memeAttach", {
params ["_target", "_caller", "_actionId", "_arguments"];
_target setPosATL (getPosATL _target vectorAdd [0,0,1]);
[_target, nearestObject [_target, "Air"], true] call BIS_fnc_attachToRelative;
}, [], 0, false, true, "", "isNull attachedTo _target && {nearestObject [_target, ""Air""] distance _target < 15}"];

this addAction ["memeDetach", {
params ["_target", "_caller", "_actionId", "_arguments"];
detach _target;
}, [], 0, false, true, "", "!isNull attachedTo _target"];``` already seems to work close to intended 🀣

trim tree
#

i got it working this way:

loading:

ugv_1 disableAI "ALL";
ugv_1 EngineOn false;

private _heli = nearestObject [ugv_1, "Air"];

if (isNil "_heli") then {hint "Kein Hubschrauber in Reichweite"} else {

ugv_1 attachTo [_heli, [-0.5,1,-2]];

_heli addAction ["Ausladen", "ausladen.sqf"];
removeallactions ugv_1;
hint "UGV eingeladen";
};

unloading

private _heli = attachedTo ugv_1;
private _helialt = getPosATL _heli;
private _helidir = getDir _heli;
if (speed _heli >=5 or (_helialt select 2) >=5) then {hint "Geschwindigkeit muss unter 5Km/h und HΓΆhe unter 5m liegen"} 
    else {
        ugv_1 enableAI "ALL";
        ugv_1 EngineOn true;
        _heli allowDamage false;
        ugv_1 allowDamage false;

        ugv_1 attachTo [_heli, 
[-0.5,-7,-2.5]];
        ugv_1 setDir _helidir;
        detach ugv_1;

        _heli allowDamage true;
        ugv_1 allowDamage true;

        ugv_1 addAction ["Einladen", "einladen.sqf"];
        removeallactions _heli;
        hint "UGV abgeladen";
    };
#

just need to test it in MP

granite sky
#

It won't work correctly in MP because the addActions and removeAllActions are only applying to the client that triggered the previous action.

trim tree
#

so i would need to remoteexec that?

granite sky
#

You should try artemoz's solution first, because it's much simpler if it works well enough.

trim tree
#

i dont really get it though πŸ˜…

granite sky
#

but yes, if you're going to add and remove actions dynamically then you'll need to remoteexec those operations to all clients.

misty raven
#

I'm currently pulling my hair out trying to get this script working.
I'm taking a mod that already exists (with permission from author) and adjusting the scripts so that they can be used while remote controlling an AI. would anybody be able to help me with said script? It's already pretty much written, just need to know what to swap out and change.

#

My uh, scripting knowledge is next to none. I tried swapping
if(driver _this == player)
with
if(driver _this == Alive)
and it threw at least 6 separate errors.

trim tree
stable dune
trim tree
#

if just checking if the driver is still alive you could try ```sqf
if (alive (driver _this))

misty raven
#

Police Lightbars and Sirens, being able to enable them while Remote Controlling an AI in Multiplayer.

misty raven
#

It checks if the driver is a player, which works wonderfully when I myself am driving. but if I remote control AI the options don't appear

stable dune
#

and alive check is

alive player;
misty raven
#

I'm more trying to figure out how to... show the script/action while I'm controlling someone else.

#

["Ivory", "ivory_highbeams", ["High Beams", ""], {
_this = vehicle;
if((typeOf _this find "ivory") < 0) exitWith {};
if(dialog) exitWith {};
if(Alive(_this) AND driver _this == Alive) then {

  if((_this animationPhase "light_lh" == 0 || _this animationPhase "light_rh" == 0) || !isLightOn _this) then {

     addAction["lightOn", _this];

    _this animate["light_lh",1];
    _this animate["light_rh",1];

  } else {

    _this animate["light_lh",0];
    _this animate["light_rh",0];

  };

};

#

Heres an example of a piece of the code itself

copper raven
#

_this = vehicle; that's not valid

misty raven
#

it was player vehicle beforehand I believe

winter rose
#

vehicle player*

copper raven
#

if(Alive(_this) AND driver _this == Alive) then { also this, driver _this == Alive is a a syntax error

misty raven
misty raven
copper raven
#

alive driver _this

boreal parcel
#

is this not possible? I am basically just trying to create all of the vehicles in the array but without hitting each other and exploding, so im pretty much just incrementing the x from the x/y/z array returned from the markerpos

index = 0;
{
    // Current result is saved in variable _x
    _x createVehicle (getMarkerPos "start") select 0 += index * 5;
    index = index + 1;
} forEach [];
trim tree
#

what is += supposed to do?

boreal parcel
#

basically the equivelant of index = index + 1; now that I think about it im not sure if sqf has that

#

I rewrote it instead like so

index = 0;
pos = getMarkerPos "start";
newPos = [];
{
    // Current result is saved in variable _x
    newPos = [(pos select 0) + (index * 5), pos select 1, pos select 2];
    _x createVehicle pos;
    index = index + 1;
} forEach [

and got my wanted result

winter rose
#

yep, no += /= -= *= ++ -- in sqf

boreal parcel
#

big sad

copper raven
misty raven
#

Final Question
_this = vehicle;
what should I replace this with since it's an error?

fair drum
#

remove it completely

#

this phrase says assign something to _this which is a protected variable

misty raven
#

That line tells the game to apply the animations to the object/vehicle the trigger/action was executed from

boreal parcel
misty raven
#
    _this = vehicle;
   if((typeOf _this find "ivory") < 0) exitWith {};
   if(dialog) exitWith {};
   if(Alive(_this) AND alive driver _this) then {
       if(_this animationSourcePhase "turn_left" < 0.5) then {
         _this animateSource ["turn_left",1];

          /*(ivory_indicatorl = true;
          if!(ivory_indicatorr) then {
            [_this,player] spawn ivory_fnc_indicator;
          };*/

       } else {
          //ivory_indicatorl = false;
         _this animateSource ["turn_left",0];
       };
   };
}, {}, [DIK_Q, [false, false, false]]] call CBA_fnc_addKeybind;```
copper raven
misty raven
#

So would removing it still allow the script to work?

misty raven
fair drum
misty raven
#

Now doing that line, would it allow me to execute the script while controlling an AI in the vehicle?

fair drum
#

you are using _this everywhere else. you don't even need that line.

misty raven
#

I've removed the line completely, will let you know if it works

#

I also included the other code sharp told me to use

sullen sigil
#

Should setVelocity be used in any specific circumstances similar to setVelocityTransformation needing to be on each frame? Trying to run player setVelocity [100, 100, 100]; from debug and it's doing zilch

#

I'm not moving at all thonk

#

You're just running player setVelocity [100, 100, 100]; like that as is, right..?

fair drum
sullen sigil
#

Yeah that's what I meant lol

#

I just get killed

#

I set damage allowed to false and do it

#

zilch

misty raven
#

Nope, can't get it to appear when controlling AI :(

fair drum
sullen sigil
#

wait are you running any mods

fair drum
#

but the velocities will depreciate

sullen sigil
#

thinking theres a chance it could be EM (again)

fair drum
#

EM?

sullen sigil
#

enhanced movement

misty raven
#

Enhanced Movement most likely

#

:)

fair drum
#

oh yeah i don't have that running. just ace.

sullen sigil
#

hmmmmmmm

misty raven
#

Hypoxic is there any way I could trouble you to look at the main script and see what's wrong with it? (Like send it to you and you have a super quick look)

sullen sigil
#
player allowDamage false;
_plrPos = getPosASL player;
player setPos (_plrPos vectorAdd [0,0,1]);
player setVelocity [1, 10, 10];```
works but i dont *really* want to have to change the players position before movement if its unavoidable
misty raven
#

I'm unable to figure out what I'm doing wrong

sullen sigil
misty raven
#

Trying to get scripts to show up :(

#

In the add action thingy

sullen sigil
#

are they showing up at all

misty raven
#

I literally will send you $10 as a steam gift card for you to help me fix this

#

Nope, not showing up at all, I'm so lost

sullen sigil
#

show the addaction bit

misty raven
#

I can't find the addaction bit

#

I'm not sure how the original author did this without that line

#

It shows up via scroll wheel menu normally, now it doesn't show up at all. This hurts my smooth brain

sullen sigil
#

are they adding it in a different script

misty raven
#

would createDialog be what I'm looking for?

sullen sigil
#

❓

misty raven
#

I know what that is lmfao
I searched for that in nearly every sqf in here

sullen sigil
#

what about the sqfs you havent searched

misty raven
#

Bingo! Didn't think of that

#

πŸ˜‚

#

I'm still searching at the moment lmfao

#

I butchered this damn script, I'm gonna start over and work from there.

#

I'll send the original so it's easier to work off of

#
    _this = vehicle player;
   if((typeOf _this find "ivory") < 0) exitWith {};
   if(dialog) exitWith {};
   if(driver _this == player && ((_this animationPhase 'lbSystem_top' > 0) OR (_this animationPhase 'lbSystem_front' > 0) OR (_this animationPhase 'lbSystem_back' > 0))) then {
    playSound "ivory_beep2";
     if(_this getVariable 'ani_siren' == 0) then {
        _this setVariable ['ani_lightbar', (_this getVariable "ani_lightbar_todo"), true]; 
        _this setVariable ['ani_siren', (_this getVariable "ani_siren_todo"), true];
      } else {
        _this setVariable ['ani_siren', 0, true];
      };

   };
}, {}, [DIK_R, [false, false, false]]] call CBA_fnc_addKeybind;```
boreal parcel
#

what editor are you using?

misty raven
sullen sigil
#

post it here

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
sullen sigil
#

use this too

misty raven
#

Post... the entire SQF?

boreal parcel
copper raven
#

sqfbin.com

boreal parcel
#

yeah that

misty raven
#

Then just save it and post it here?

copper raven
#

yeah

misty raven
#

I don't think I did that right oops

#

Oh, that works actually

winter rose
#

(I am not reading that - good luck guys)

sullen sigil
#

even i think that doesnt look organised in the slightest

misty raven
#

I didnt make this lmfao.
It's giving me a headache if I stare too long

sullen sigil
#

ngl i would recommend just making it over again

misty raven
#

I may just ditch this project

#

Been a nightmare since I started trying to fix this guys mod

sullen sigil
#

dont worry im still working on my grappling hooks after thinking i was happy with them because it doesnt work as i want it to in both mp and when hitting walls

#

i think its been at least a month since i started

misty raven
#

pretty sure I figured out a way around it.

#
            {
                displayName = "<t color='#ff0000'>Reset Lock/Fast</t>";
                position = "drivewheel";
                radius = 10;
                condition = "alive driver _this";
                statement = "this setobjecttexture [31,'\MeansCars\2011_CVPI\data\radar\pic0.paa']; this setobjecttexture [32,'\MeansCars\2011_CVPI\data\radar\pic0.paa']; this setobjecttexture [33,'\MeansCars\2011_CVPI\data\radar\pic0.paa']; Prevspeed = 0;";
                onlyForplayer = 0;
            };```
#

Does this look right?

violet gull
#

Question: Using the InventoryOpened eventHandler, I only get the information of the player's inventory/container, the ground weaponholder (WeaponHolderSimulated), and inventory of a crate/vehicle if any. My current issue is the ground weapon holder pulled in the params of the eventHandler does not allow me to get info of the actual target body being looted. I'm assuming I'll need to use some code using nearSupplies command but not sure how I can make it more precise if I am amongst several dead bodies/weaponholders.

#

My goal is to pull items, weapons, magazines, uniform, vest, assignedItems, etc. from the body but the WH pulled does not have any of that in it.

#

Do dead bodies have assigned weaponholders that can be pulled?

south swan
violet gull
#

Oh shit nice

tropic vector
#

I have player starting with ambient animations, but they can't interrupt them and just keep dancing. How break free of animations?

violet gull
#
player switchMove "";
tropic vector
violet gull
#

If it's a player you can just globally execute it in the debug window if you have access to it (Has to be enabled in the description.ext though)

tropic vector
#

can i bind it to a timed trigger, like after receiving radio message?

violet gull
#

Is it a singleplayer mission?

tropic vector
#

no, MP

violet gull
#

You can do that then. I'd make a trigger that's "Server Only" and then in the activation of the trigger put something like:

[player,""] remoteExec [ "switchMove" , thisList , true ];

See if that works.

tropic vector
#

yhx, will try now

#

nah, they keep dancing

violet gull
#

Worked for me, make sure the countdown/timer isn't 0 otherwise it'll execute too fast upon loading mission if players in the trigger.

#

Activation dropdown set to Any Player

#

Present

tropic vector
#

ok figured it out, the time on the map before mission start counts too

violet gull
#

Could try setting condition to:

this && time > 1
tropic vector
#

where do I get time? is it triggers countdown time?

violet gull
#

The code I posted basically means the condition is if player is in trigger && (and) the mission time is at least 1 second, the timer should start

tropic vector
#

I have a problem, when exiting the triggers area the character starts to dance again, and this time there is no trigger to stop him )))

violet gull
#

You must have something else spamming a dance animation on them or something then

tropic vector
#

yeah, I created animation in character's attributes

violet gull
#

Probably a mod you're using that forces the unit to play the animation over and over then. You can try getting rid of the animation set and just put this in the init of the unit, if you want them dancing right away:

this switchMove ( selectRandom [ "Acts_Dance_01" , "Acts_Dance_02" ] );
#

That's about all I can help with

tropic vector
#

thank you

winter rose
#

switchMove might need a little delay though

sharp grotto
#

Especially in MP on a loaded server

tropic vector
#

I have 2 variables hostage1 and hostage2, how to make mission end sucessfully after they are present inside a trigger zone? They are blufor.

willow hound
#

You can use this condition for your trigger:

hostage1 in thisList && hostage2 in thisList
tropic vector
#

what about onActivation field?

winter rose
#

see BIS_fnc_endMission

bitter bough
#

Having a slight issue with something, although it's probably because I'm not too good at dealing with HC's and such. Or am executing this incorrectly.

TLDR, Executing a script to keep specific scores to an individual that way they can retrieve prizes. Only issue is, each time someone scores a kill, it seems to apply across all players, and sometimes multiplied by headless client.

addMissionEventHandler ["EntityKilled", {
    params ["_killed", "_killer", "_instigator"];
    if (!isPlayer _killer or _killed isEqualto _killer) exitWith {};
    player execVM "addScore.sqf";    
}];
hallow mortar
#

If the EH is added on all clients, it will fire on all clients whenever an entity is killed. You should add the EH only on the server, and do _killer execVM "addScore.sqf" (make addScore a function though).

bitter bough
#

So calling the eventhandler in the mission init.sqf wasn't a good choice?

hallow mortar
#

init.sqf is executed on all clients, so no, not a good call in this case. Use initServer.sqf instead.

bitter bough
#

absolute legend
Next question is probably more complicated than I anticipate
But how would one just make something a function?

bitter bough
#

Thank ya, shall have a read

pulsar bluff
#

having issues attaching an object to a mortar shell (server shell, server attached object)

#

not done this stuff before, wondering if there is a known reason for this

granite sky
#

Hmm, we attach smoke grenades to mortar shells in Antistasi and it works locally at least. There are locality issues with the Fired EH.

gentle zenith
#

Hey, I've recently revived one of my older mission files after 2 years and we're suddenly experiencing an odd issue that hadn't been a problem before.
Whenever the 'dropdown' box (RscCombo) is clicked, the clients game crashes/closes. This seems to happen more often when there is no data in the dropdown.

Has there been an Arma 3 update in the past 2 years that affected dropdown menus and created an issue for older mission files?

violet gull
#

@pulsar bluff Don't think you can attach objects to projectiles because they are local on all machines or something.

warm hedge
#

Yet I couldn't reproduce that one, but still

gentle zenith
warm hedge
#

If you can provide the game version and the code that reproduce the issue 100%, that's better for devs

devout surge
#

Hello, sry for the inconvenience. But I'm trying to create a solution to a situation and im out of ideas.
I'm looking down to make a small PvP, blufor vs opfor vs independent. Im looking to gave a small briefing. and i need that each one recives a diferent diary.sqf.
is there a way? something i should read for this? The same for the missions, there are 6 diferent missions, but i need that each recives a diferent version(one destroy, one defend and the other steal).

open fractal
devout surge
#

i need that blufor receive one version, opfor another and independent a third one. how do i accomplish that?

open fractal
#
private _diaryText = switch (side player) do 
{
    case west: {loadFile "westDiary.txt"};
    case east: {loadFile "eastDiary.txt"};
    case independent: {loadFile "indepDiary.txt"};
};
``` one of many possibilites
#

you're using createDiaryRecord right?

#

loadFile moment

winter rose
#

Stringtablesss

open fractal
#

help me lou

#

i thought stringtables were just for localization

winter rose
#

yeah, they are
for storing text

#

loadFile reads the file from the disk, not ideal I'd say

ocean folio
#

is there a way to tell who killed a unit after they are already dead?

#

or is that only available in the killed event handler on time of death

boreal parcel
#

any idea whats up with this? according to the wiki it wants a player object < setunitloadout > loadout array

22:02:13 Error in expression <_liberation_arsenal_type) then {
player setUnitLoadout (_loaded_loadout select 1>
22:02:13   Error position: <setUnitLoadout (_loaded_loadout select 1>
22:02:13   Error Type HashMap, expected Bool
open fractal
winter rose
boreal parcel
#

Im unsure what would even want a bool

winter rose
boreal parcel
winter rose
#

the error might be somewhere else, as it talks about a hashmap

copper raven
#

from what im seeing, loadout is index 0, index 1 is some "extended info" stuff, which is a hashmap

boreal parcel
#

the loadout seems to come from ace saved loadouts? I assume that is saved in some player profile vars

_loadouts_data = +(profileNamespace getVariable ["ace_arsenal_saved_loadouts", []]);
private _loaded_loadout = _loadouts_data select (lbCurSel 201);
        if (KP_liberation_ace && KP_liberation_arsenal_type) then {
            player setUnitLoadout (_loaded_loadout select 1); // Line with error
        } else {
            [player, [profileNamespace, _loaded_loadout]] call BIS_fnc_loadInventory;
        };
boreal parcel
#

huh

#

ok so apparently its only erroring with a certain loadout.

This one works fine

"[""Scar"",[[""rhs_weap_SCARH_FDE_LB"",""rhsusf_acc_aac_762sdn6_silencer"",""rhsusf_acc_anpeq15_bk"",""rhsusf_acc_ACOG_RMR_3d"",[""rhs_mag_20Rnd_SCAR_762x51_m61_ap_bk"",20],[],""rhsusf_acc_harris_bipod""],[""launch_MRAWS_olive_F"","""","""","""",[""MRAWS_HEAT_F"",1],[],""""],[],[""rhs_uniform_FROG01_wd"",[[""ACE_CableTie"",2],[""ACE_EarPlugs"",1],[""ACE_EntrenchingTool"",1],[""ACE_IR_Strobe_Item"",1],[""ACE_Flashlight_XL50"",1],[""ACE_key_master"",1],[""ACE_tourniquet"",4],[""ACRE_PRC152"",1],[""ACRE_PRC343"",1]]],[""UK3CB_ANA_B_V_SL_Vest_TAN_03"",[[""ACE_elasticBandage"",30],[""ACE_morphine"",3],[""ACE_epinephrine"",3],[""ACE_splint"",4],[""rhs_mag_an_m8hc"",3,1],[""HandGrenade"",3,1]]],[""UK3CB_CW_US_B_EARLY_B_RIF_2"",[[""rhs_mag_20Rnd_SCAR_762x51_m61_ap_bk"",15,20]]],""rhsusf_lwh_helmet_marpatwd_headset_blk"","""",[""rhsusf_bino_lerca_1200_black"","""","""","""",[],[],""""],[""ItemMap"",""B_UavTerminal"",""ItemRadioAcreFlagged"",""ItemCompass"",""ACE_Altimeter"",""NVGogglesB_blk_F""]]]"

While this one errors

#
23:04:06 "[""Fatass Sniper"",[[[""rhs_weap_t5000"","""","""",""rhsusf_acc_ACOG_RMR"",[""rhs_5Rnd_338lapua_t5000"",5],[],""rhs_acc_harris_swivel""],[""launch_MRAWS_olive_F"","""","""","""",[""MRAWS_HEAT_F"",1],[],""""],[""rhsusf_weap_glock17g4"","""","""","""",[""rhsusf_mag_17Rnd_9x19_JHP"",17],[],""""],[""rhs_uniform_FROG01_wd"",[[""ACE_EntrenchingTool"",1],[""ACE_IR_Strobe_Item"",1],[""ACE_Flashlight_XL50"",1],[""ACE_tourniquet"",4],[""ACE_CableTie"",2],[""ACE_epinephrine"",2],[""ACE_morphine"",4],[""ACE_splint"",1]]],[""rhsusf_spc_rifleman"",[[""ACE_elasticBandage"",30],[""ACE_SpraypaintRed"",2],[""ACE_splint"",2],[""ACE_wirecutter"",1],[""rhs_mag_an_m8hc"",3,1],[""HandGrenade"",2,1]]],[""B_Carryall_oucamo"",[[""ACE_CableTie"",2],[""ACE_bodyBag"",2],[""MineDetector"",1],[""ACE_EarPlugs"",1],[""HandGrenade"",2,1],[""rhsusf_mag_17Rnd_9x19_FMJ"",10,17],[""rhs_5Rnd_338lapua_t5000"",100,5]]],""rhsusf_lwh_helmet_marpatwd_blk_ess"",""G_Aviator"",[""rhsusf_bino_lerca_1200_tan"","""","""","""",[],[],""""],[""ItemMap"",""Ite
#

couldnt log all of it annoyingly enough

#

perhaps its the TFAR radios?

#

im noticing that in index 1 of the second array there is 3 [ brackets while the first array only has 2. Wonder whats going on here

#

it would seem it is Tfar, I need to figure out how to log the entire array without it getting cut off

copper raven
#

just copy it, with copyToClipboard str _array

boreal parcel
#

huh that didnt work before, thanks

copper raven
#

but its going to be what i wrote earlier i think

#

just do this

boreal parcel
#

not a bad idea, not exciting to re-write this script tho either lmao.

#

I dont even see how tfar is changing it

copper raven
#

tfar changing it?

boreal parcel
#

well I can load kits that dont have TFAR radios

#

hmm maybe its not tfar?

#

im noticing the only difference in the loadouts is the one giving an error has this extra index
[["ace_earplugs",true]]

copper raven
#

yes it's what i said, it's the cba extended loadout thing, where it has an extra hashmap

#

just check if count == 2, then pick first one (the loadout), else use as is

boreal parcel
#

ok

devout surge
open fractal
#

I mean, that was just an example of selecting a string with a switch statement. You can use any method of inputting the string (loadfile is unnecessary)

#

but yes initPlayerLocal was the idea

#

you would then use _diaryText in your createDiaryRecord

devout surge
#

ok, i will try and update the result. is there naywere to upload it for future reference? i mean, if i crack it id be happy to give it to the comunity

open fractal
#

you can just make a function that you call from initPlayerLocal

devout surge
jade tendon
copper raven
velvet linden
#

hey this is going to sound really dumb but I have a variable that I want to activate when my vehicle is dead

Eg.
_det = false

if _det then
{
CODE
}

I tried to do an event handler but ultimately didn't work
any ideas?

south swan
#

what do you mean by "activate a variable"?

velvet linden
#

like turn it from false to true

little raptor
little raptor
#

no need for any EH or something

velvet linden
#

alright thanks ill try it

velvet linden
# little raptor `_var = !alive _veh`

hey so i tried it and the code in the if statement is not being deployed

here's what i have so far (vehicle name is akbar2)

_det = !alive akbar2;

if _det then
{
systemChat "DET ON";
private _pos = this;
private _bomb1 = createVehicle ['ammo_Missile_Cruise_01', _pos, [], 0, 'CAN_COLLIDE'];
private _bomb2 = createVehicle ['ammo_Bomb_SDB', _pos, [], 0, 'CAN_COLLIDE'];
private _bomb3 = createVehicle ['Bo_GBU12_LGB', _pos, [], 0, 'CAN_COLLIDE'];
_bomb1 setDamage 1;
_bomb2 setDamage 1;
_bomb3 setDamage 1;
_bomb1 setVelocity [0,0,-2500];
_bomb2 setVelocity [0,0,-2500];
_bomb3 setVelocity [0,0,-2500];
};

south swan
#

because the check runs once, fails, and is never checked again πŸ€·β€β™‚οΈ

velvet linden
#

every few ms

south swan
#

you either waitUntil {sleep 0.5;!alive akbar2} to check every 0.5 seconds. Or move the code from inside the "if" statement into a "Killed" Event Handler of a vehicle πŸ€·β€β™‚οΈ
P.S. or "MPKilled" Event Handler if the vehicle can be driven by players on a server

winter rose
#

every second would be enough

velvet linden
#

i did move it into a event handler and it didnt work but ill try the waitUntill

winter rose
#

this code should work anywhere
as long as you don't use this in the event handler ofc

hallow mortar
#

What's up with doing setDamage 1 on the bombs and then giving them 2500m/s of down velocity? I'm pretty sure the setDamage will cause them to explode before they go anywhere. (and if you're creating them at ground level and/or clipped inside something, you don't need either because they're contact detonated)

little raptor
#

also the "official" way of exploding ammunition is triggerAmmo, not setDamage

#

setDamage doesn't always work

velvet linden
#

ok thanks

velvet linden
hallow mortar
#

It would help to know what code you're using to try to create the EH

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
velvet linden
#

i just moved the code into a EH from an If

hallow mortar
#

There are a lot of small things that can cause code to break and it's not possible to tell which is causing this without seeing the actual code.

velvet linden
#

here she is!


this addEventHandler ["killed", "
   private _bomb1 = createVehicle ['ammo_Missile_Cruise_01', _pos, [], 0, 'CAN_COLLIDE']; 
   private _bomb2 = createVehicle ['ammo_Bomb_SDB', _pos, [], 0, 'CAN_COLLIDE']; 
   private _bomb3 = createVehicle ['Bo_GBU12_LGB', _pos, [], 0, 'CAN_COLLIDE']; 
   _bomb1 setDamage 1; 
   _bomb2 setDamage 1; 
   _bomb3 setDamage 1; 
   _bomb1 setVelocity [0,0,-2500]; 
   _bomb2 setVelocity [0,0,-2500]; 
   _bomb3 setVelocity [0,0,-2500]; 
"];
hallow mortar
#

Your EH is missing {} for the code argument

south swan
#

this is a magic variable that's only accessible inside the Init field of a unit πŸ€·β€β™‚οΈ
private _pos makes it not accessible for other functions as well
To access the unit inside the EH, you use its params: sqf this addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; }]; with _unit being the unit itself.

velvet linden
#

ah

south swan
#

so something like sqf this addEventHandler ["killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; private _pos = _unit; private _bomb1 = createVehicle ['ammo_Missile_Cruise_01', _pos, [], 0, 'CAN_COLLIDE']; private _bomb2 = createVehicle ['ammo_Bomb_SDB', _pos, [], 0, 'CAN_COLLIDE']; private _bomb3 = createVehicle ['Bo_GBU12_LGB', _pos, [], 0, 'CAN_COLLIDE']; _bomb1 setDamage 1; _bomb2 setDamage 1; _bomb3 setDamage 1; _bomb1 setVelocity [0,0,-2500]; _bomb2 setVelocity [0,0,-2500]; _bomb3 setVelocity [0,0,-2500]; }];to preserve the logic

velvet linden
#

ah ok i see now what you mean 😐

#

ok i tested it and it works thanks so much for this and tolerating my stupidity

meager granite
#

instead of setDamage and setVelocity

sacred turret
#

guys is there a better way to do this?:

private _click_pos = [];

openMap true;
onMapSingleClick "_click_pos = _pos;";
onMapSingleClick "";
openMap false;

player setPos _click_pos;

only seems to work with alt click

winter rose
#

it does not work

#

onMapSingleClick does not know about _click_pos

sacred turret
#

I imagined it would be the case, since its private

#

but for some reason it works while holding alt, so figured that was probably something else

#

gonna test making it global

winter rose
#

Alt+Click teleport is an Eden Editor feature πŸ™‚

sacred turret
#

OH

#

now it makes sense

#

πŸ˜…

hallow mortar
#
openMap true;
addMissionEventHandler ["MapSingleClick", {
    params ["_units", "_pos", "_alt", "_shift"];
player setPosATL _pos;
openMap false;
removeMissionEventHandler ["MapSingleClick",_thisEventHandler];
}];```
sacred turret
#

thank you, going to switch to this method

south swan
#

except adding an ability to close the map without teleporting would increase line count by 5 times :3

winter rose
#

no?
just a click EH on the map control should be enough?

sacred turret
#

this is supposed to happen only once, at the beggining of the mission, wouldn't be a problem

leaden ibex
#

Hey there, I was just wondering if something like this is possible.
The server is running ACE and has some server settings that override clients and mission. Would it be possible to change these settings using scripts in the mission file?
For example setting the ace_medical_playerDamageTreshold to 0.75 instead of whatever the server forces.
Was thinking about finding out the namespace these are stored in and trying to overwrite them by executing it on server/all clients.
Anyone any experience with it?

winter rose
leaden ibex
#

I'll ask there too then! Thanks for the info.
But if anyone here experimented with it, let me know too

leaden ibex
copper raven
leaden ibex
velvet merlin
#

can you make the action menu shown longer via sqf (or config means) ?

#

the problem is with holdAction function it fades out due the standard fadeOut/hide time of action menu being 10s

#
class Menu
    hideTime = 60;
    quickMenuDelay = 0.5;
#

this is for the command menu

#

but seems nothing exposed for action menu

#

but seems no way to open/refresh it

boreal parcel
south swan
#

i guess that's a clipboard size limit at some point between the actual code and Discord. Like copypasting stuff into the Notepad allows to move much more data than copypasting from the same debug output into the VSCode 🀣

tropic vector
#

I need a mission failure when a certain helicopter enters trigger area. Currently I have this and it doesn't work
Type lose, activation none,
condition "heli1 in thisList or heli2 in thisList or heli3 in thisList"
on Activation BIS_fnc_endMission

copper raven
winter rose
#

ah ok ^^

hallow mortar
copper raven
#

triggers have an end type or whatever, you can just use that instead

hallow mortar
#

If this is a multiplayer mission you'll also want to remoteExec it

copper raven
#

make sure you make the trigger server only

tropic vector
#

that applies to coop MP vs bots too, right?

copper raven
#

it applies anywhere, this will work in sp and mp

lime frigate
#

Hey there, I'm trying to set up ACE Fortify to be enabled/disabled in my mission.

https://ace3.acemod.org/wiki/framework/fortify-framework.html

There's a chat command for this but I need it to be handled by a trigger. Syncing the modules to a trigger in the editor seems to have no effect with fortify still being available even when the conditions for the trigger had not been met.

There was a settings framework in ACE (https://ace3.acemod.org/wiki/framework/settings-framework.html) which looked promising, however I couldn't find the correct ace-setting for enabling/disabling ACE Fortify. Additionally, it's now deprecated and instead ACE uses CBA settings (https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System#mission-settings). However, when in game all there isn't a CBA setting for enabling / disabling ACE Fortify, just adjusting budgets etc.

Does anyone know of a way for me to send a message as admin through a trigger? Or does anyone know of a different way I could achieve this? Many thanks.

GitHub

Community Base Addons for Arma 3. Contribute to CBATeam/CBA_A3 development by creating an account on GitHub.

boreal parcel
wind hedge
#

Do you guys know if I have a one unit Ai group with this EH: sqf _group addEventHandler ["LeaderChanged", { params ["_group", "_newLeader"]; }];

#

Will the EH still fire when I kill that one leader?

#

I mean, the group is now empty so there is no "_newLeader"

open fractal
#

Might as well test if the wiki doesn't say anything

#

I'd guess objNull

copper raven
#

probably nothing happens, leader only changes if there is someone else in the group who can take over

wind hedge
#

From inside the EH, to delete it, should I do this: sqf player removeEventHandler [_thisEvent, _thisEventHandler];

#

or this: sqf player removeEventHandler _thisEventHandler;

#

PS: I have seen both ways being used and therefore the doubt

open fractal
#

First one

#

where have you seen the second one?

#

_thisEventHandler is the index, a number

winter rose
#

read the doc

wind hedge
winter rose
hallow mortar
drifting portal
#

I spawned a character using createvehicleLocal
I'm trying to execute

character playActionNow 'ThrowPrepare'
#

but its not doing the gesture

#

tried making it play the gesture animations (via switchMove):

['awoppercmstpsgthwrfldnon_start2', "awoppercmstpsgthwrfldnon_throw2","amovpercmstpsraswrfldnon"]

it remains static and doesn't do it too, despite being capable of running other animations

#

is there a way of making it do the throw animation?

#

uh I remembered what Leopard20 taught me

isnil {
    _unit switchMove "move";
    _unit playMoveNow "move";
};
#

that made it work

ocean folio
#

I'm running into an issue with BIS_fnc_wpArtillery. It seems like it gets stuck and just keeps firing or assigning the target after its done

#

or it might just be me, I'm not exactly sure what's happening here

#

oh I'm an idiot and used dumb debug messages

#

lemme start over

#

systemChat "start";  //this gets printed

[(_artyGroups select 0), [4336.15, 3874.5, 0], objNull, 1] call BIS_fnc_wpArtillery;

systemChat "end";  //this never gets reached
open fractal
#

would doArtilleryFire be better?

ocean folio
#

the main reason I didnt use that is because it requires the weapon class name

#

I was hoping not to have to detect what the normal HE ammunition is for whatever artillery piece this is being applied to

ocean folio
#

hmmm... that's useful lmfao.

cosmic prairie
#

So I'm trying to block the use of NVGs and Thermals through a mission event handler, but I'm running into the issue of wanting certain players to be immune to the handler.

Is there way to set it up to where only certain folk are caught in the script? Can I flag them via a boolean in their init?

winter rose
#

you can name them and use this variable, or setVariable a certain value on them

cosmic prairie
#
addEventHandler ["Draw3D", 
{ 
 if ((currentVisionMode player isEqualTo 2)||(currentVisionMode player isEqualTo 1)) then 
 { 
  if (isNil "A3W_thermalOffline") then 
  { 
   "A3W_thermalOffline" cutText ["HELMET SENSORS MALFUNCTIONING", "BLACK", 0.001, false]; 
   A3W_thermalOffline = true; 
  }; 
 } 
 else 
 { 
  if (!isNil "A3W_thermalOffline") then 
  { 
   "A3W_thermalOffline" cutText ["", "PLAIN", 0.001, false]; 
   A3W_thermalOffline = nil; 
  }; 
 }; 
}];
#

This is what I'm working off of right now.

#

If I'm understanding you correctly, I just need to add an and-not statement with the variable names of the immune folk

winter rose
#

for example yes

open fractal
#

why not "VisionModeChanged"?

winter rose
#

cuz it's recent and unknown I bet!

cosmic prairie
#

I'm still in like the partial literacy stage

open fractal
#
player addEventHandler ["VisionModeChanged", {
    params ["_person", "_visionMode", "_TIindex", "_visionModePrev", "_TIindexPrev", "_vehicle", "_turret"];
    player action ["nvGogglesOff", player];
}];
``` crude example of disabling nvg's whenever vision mode is changed
cosmic prairie
#

Will that disable NVGs enabled via helmet too?

open fractal
#

what does that mean

#

like the viper helmet?

cosmic prairie
#

Hang on, trying to not be dumb

#

Yes!

open fractal
#

yeah it's the same thing

#

i think the event handler fires when in a vehicle as well, but "nvGogglesOff" is only for infantry nvg's

#

if i recall correctly ^

cosmic prairie
#

Okay, and this is probably a dumb question but that will fire off if they cycle to thermals as well right?

open fractal
#

yes

#

it will physically take off the nvg's like if the player cycled back to normal vision whenever the player changes vision mode

#

nvg might turn on for like one frame but that doesnt make a difference imo

cosmic prairie
#

Thank you, I was adapting the mission event handler version just based off some really old knowledge. I barely know java, I have zero idea right now how Arma's engine works. I really appreciate the help.

open fractal
#

yw

cosmic prairie
untold copper
cosmic prairie
#

Worked perfectly

untold copper
cosmic prairie
#

So I'm part of an astartes group, and all the space marine helmets have NVGs and Thermals inbuilt, plus constantly having our NVG slot used for various modded equipment

#

For the sake of ambiance and not ruining my night missions for once, I'd like to have everyone but certain key slots be disabled from NVG/Thermal

cosmic prairie
cosmic prairie
untold copper
cosmic prairie
#

It initially was addMissionEventHandler

untold copper
#

Cool. Good to double check.

cosmic prairie
#
addMissionEventHandler ["Draw3D", 
{ 
 if (((currentVisionMode player isEqualTo 2)||(currentVisionMode player isEqualTo 1))!&&(object getVariable String) then 
 { 
  if (isNil "A3W_thermalOffline") then 
  { 
   "A3W_thermalOffline" cutText ["HELMET SENSORS MALFUNCTIONING", "BLACK", 0.001, false]; 
   A3W_thermalOffline = true; 
  }; 
 } 
 else 
 { 
  if (!isNil "A3W_thermalOffline") then 
  { 
   "A3W_thermalOffline" cutText ["", "PLAIN", 0.001, false]; 
   A3W_thermalOffline = nil; 
  }; 
 }; 
}];
#

This is what I was trying to figure out

#

That not-and is me trying to figure out how to check if a variable name returns as nothing

untold copper
cosmic prairie
#

It's essentially just placeholder text

untold copper
cosmic prairie
#

I dont really know how to do that though.

maiden bay
#

is there a way to get a sound to play after this? this addAction ["take down the shield","deletevehicle shield"]; I am wanting it to play a sound of a generator powering down with it deleting the block

#

rather new to scripting, so wouldnt even know where to look in the bi page

untold copper
cosmic prairie
cosmic prairie
untold copper
cosmic prairie
#

Sure, I might come back to it in the future. I just will need a greater understanding of SQF

shut reef
#

Is there a non-ui related alternative to htmlLoad?
I'd like to just get a string from an url

untold copper
maiden bay
#

would that play it to everyone?

open fractal
#

say3D may be easier

#

playSound3D you want to execute only on one machine, say3D you want to execute on every machine

#

either of those options will have everyone hear the sound

untold copper
open fractal
#

playSound3D will work in the addAction function without remoteExec

open fractal
maiden bay
#

so for everyone to hear it would look like playsay3D [getMissionPath "mySound.ogg", player]; ?

open fractal
maiden bay
#

but would everyone hear it?

open fractal
#

yeah, the GE at the top of the page means Global Effect

untold copper
maiden bay
#

cool

open fractal
#
this addAction ["take down the shield",{
    private _terminal = _this # 0;  
    deleteVehicle shield;
    playSound3D [getMissionPath "powerdown.ogg", _terminal];
}];
``` this will work without having to give the shield a variable name i.e. you can paste this in multiple init fields
#

lol i wrote playsay

untold copper
untold copper
open fractal
#

right now

#

im changin it

maiden bay
open fractal
#

do you need a 3D sound in that case if it's the entire map?

maiden bay
#

its only for the people near the terminal which the players should be gathered around

open fractal
#

alright

#

my code will play the sound out of the object

#

as will yours if you replace the player with shield as the sound source

maiden bay
#

so it deletes the terminal instead of the shield, which part should I change to get it to delete the shield?

#

instead of the terminal?

open fractal
#

oh right

#

deletevehicle shield

#

i'll edit the block

shut reef
# untold copper Can you explain what you mean?

I'm trying to pull a string from a url to be used in a script (the url of the game server), but I can only find htmlLoad and that loads it into a control, which would not be necessary in my case

maiden bay
open fractal
#

personally every once in a while I just go to random wiki pages and slap code in the console

#

and go oh, neat

#

there's an intro to scripting on the wiki

untold copper
shut reef
untold copper
shut reef
untold copper
shut reef
#

Hmm, does not seem to be trivial to get text from RscHTML, tho :/

shut reef
boreal parcel
#

could I use setMagazineTurretAmmo to assign an incompatible ammo type to a turret? for instance I want to set the uh60 miniguns to fire 12.7 slap rounds

#

or addMagazineTurret

meager granite
#

no, you need appropriate weapon

copper raven
#

i dont think its a pylonweapon

copper raven
copper raven
copper raven
tropic vector
#

I have 2 blufor hostages, 1 independent scientist and at the start of the mission OPFOR guy kills all of them. Would be nice if he didn't

exotic flax
#

either set them all to civilian (can be done by setting them as captured BEFORE the mission starts), or change the relations between factions (although BLUEFOR vs OPFOR is always hostile)

south swan
exotic flax
#

works, although it could happen that the init is too slow and the OPFOR already starts shooting... seen it before

tropic vector
#

I believe my blufor guys are captive, they seat with hands tied behind their back

#

The independent science guy is supposed to work for OPFOR, it's just OPFOR doesn't have the right science skin

hallow mortar
#

The Editor arsenal (Edit Loadout) also has no side restrictions, you can just take a guy and give him whatever you like

kind cedar
#

During a mission, how would you switch player unit?

#

I was told to us "selectPlayer"

#

use*

#

Is this correct?

warm hedge
#

selectPlayer indeed. What's unclear?

kind cedar
#

The example it, selectPlayer bob;

#

Would I just use selectPlayer on any unit, or do I use "selectPlayer bob;" Do I need to specify the name?

#

Like change "Bob"

#

Or can I just use selectPlayer in the init

warm hedge
#

Either. In this context bob means an unit that bob declares, but you can use any variable that is a valid object

kind cedar
#

Hmmm selectPlayer isnt working in zeus

warm hedge
#

What is the context?

kind cedar
#

Im just trying to switch my Player unit over to another

#

But I would have to use zeus to do it, because its during a mission

#

I would just use "remote control" off of zeus but when you do that you are not able to get in and out of vehicles etc. it wont show the option.

#

Or is there anyway to add a unit to the "team switch"?

copper raven
velvet merlin
#

how does one close the 2d map again in most simple way?

#

tried via closeDialog 12;

velvet merlin
#

ty

boreal parcel
unique sundial
#

modding or set reload coef

boreal parcel
#

alright thank you, ill look into this

acoustic abyss
#

As an aside: I'm trying to have multiple players share a walking intro similar to the opening of the Camp Maxwell hub in the East Wind campaign. But I don't want players to see each other, before switching to their own characters.

Is it possible to script characters to be completely invisible to other players? Or perhaps just 100% invisible?

(Note: of course you can script camera moves. But they look thoroughly unnatural, also zero player input, no walking sounds; less immersive)

#

Is something with selectPlayer and createUnit possible?

hallow mortar
#

You can use hideObject to make the other players invisible for each client

acoustic abyss
#

Doesn't hideObject also disable physics/simulation for target object?

copper raven
#

nope

acoustic abyss
#

Ah: that's hideObjectGlobal and the hideObject module. I'll take a look at this, thank you.

hallow mortar
#

hideObjectGlobal also does not disable physics or simulation

#

It disables collision (so an object that has been hidden can be walked through) but it's still simulated; units and vehicles can move, physics objects will fall if dropped etc

bright robin
#

Hello, jus learnes that atom is going to be dropped, wich text editor similar to atom, or vs code can i use that is open source?

sharp grotto
#

I still use Notepad++ πŸ˜…

hallow mortar
#

You should still be able to use Atom, just no more updates

acoustic abyss
bright robin
hallow mortar
#

It comes with a C/C++ syntax highlighter, and there are SQF ones around (in varying states of up-to-date-ness).
But still, Atom isn't going to delete itself from your computer, it's just not being developed any more

sharp grotto
#

sublime text is also nice

bright robin
#

Well

#

It is because i like how VS code works

#

The closest is atom

#

But it is going donw

hallow mortar
#

I'm not sure how many different ways I can say "you can still use Atom, just no new updates"

exotic flax
#

VSCode seems to work great, for any Arma game and basically any language/framework.
Atom is great for a quick edit, compared to Notepad 🀣

bright robin
bright robin
drifting portal
#

is there a possible way to rotate a model's bone through sqf?

#

(want to rotate a human's head that is spawned through createVehicleLocal)

little raptor
little raptor
drifting portal
little raptor
#

it doesn't apply to your case anyway

#

character models have no animations

drifting portal
#

fair enough

#

I guess i will constantly setdir

little raptor
#

use setVectorDir instead

#

setDir is laggy on non-player units

drifting portal
#

good idea

#

so

#

should I

_dir = getposworld _unit vectorfromto getposworld player;
#

is this how I obtain the proper direction?

little raptor
#

that's one way yeah

drifting portal
#

most efficient one is?

little raptor
#

depends what you want to do

drifting portal
#

because i probably will have it in a draw3d eh

#

since draw3d will work briefly to draw a laser for 5 seconds

#

want the laser to be coming out of the units eyes, so that's why i will set vector too

#

so is the the most efficient to be placed in draw3d?

little raptor
#

want the laser to be coming out of the units eyes, so that's why i will set vector too
why? you can draw the laser from their eyes in their eyeDirection

drifting portal
#

um

#

i want the unit to lock with laser on the player

little raptor
#

they use eyePos and aimPos

#

was there a visual version of aimPos? iirc there was think_turtle

drifting portal
#

so

#

i know how to draw the laser

little raptor
#

I think it was called unitAnimPos or something like that

drifting portal
#

but I'm just concerned about setting the unit direction

little raptor
#

well their heads drift anyway

hallow mortar
#

is there a particular reason you have to use a fake shell of a character instead of just making a real one with createUnit? Then you could just use lookAt

little raptor
#

so even if you set the direction there won't be any guarantee they'll look at you

drifting portal
#

as leo told me, its better to move local units with it

#

else if i create a unit and let the server handle the movement, it might lag

drifting portal
little raptor
#

ok meowsweats

#

so what are you concerned about then?!

drifting portal
#

i know its a bit confusing, just making a bossfight

drifting portal
# little raptor so what are you concerned about then?!

so while I'm drawing the laser using draw3d eh, i would like a good efficient form of setvectordir so that I can constantly set the dir of the laser emitting unit towards the player dir so its as if the unit is looking at the player

#

an efficient form in draw3d eh

coarse dragon
#

How would one get the flashing lights to turn on a modded police vehicle?

little raptor
#
  1. get vector dir from eye of boss to aim pos of player
  2. calculate the cross product with boss dir
coarse dragon
#

A empty police vehicle

little raptor
#
  1. if cross#2 < 0 -> rotate 90 deg CW, else CCW
hallow mortar
little raptor
#

also measure the cos to set the dir instantly if the angle is too low

drifting portal
little raptor
#

vectorCrossProduct

drifting portal
#

yeah he only needs to rotate 2d not 3d btw

little raptor
#

I know

#

I said Z

#

not the whole vector

#

basically Z of cross product is called perp product

#

the other components are a waste but in SQF there's no faster way

smoky verge
#

hey question
I need to set a player side to opfor when he picks up a CSAT terminal
I originally though of just using a trigger stating [player] joinSilent createGroup East;
but that would change every player side
any idea?

little raptor
#
_dirTo = eyePos _boss vectorFromTo aimPos player;
_dirTo set [2, 0];
_dir = vectorDirVisual _boss;
if (_dir vectorCos _dirTo > 0.999) then {
  _boss setVectorDir _dirTo
} else {
  _cross = _dir vectorCrossProduct _dirTo;
  _dir = [_dir, 5 * diag_deltaTime * accTime * ([1, -1] select (_cross#2 > 0))] call BIS_fnc_rotateVector2D;
  _boss setVectorDir _dir
};
#

^^ something like that but not tested @drifting portal

granite sky
#

@smoky verge That wouldn't change every player side unless you executed it on every client.

smoky verge
granite sky
smoky verge
drifting portal
#

(they both have the same behavior)

south swan
#

Leo's one looks like a smoothed over-time rotation πŸ€·β€β™‚οΈ

#

Capped at 5 of whatever the rotation function is using (radians, degrees, whatever) per second

drifting portal
#

yeah but for some reason sometimes the character doesn't rotate when suing leo's method

south swan
#

Hence the "untested" warning

#

Although looks algorithmically sane at first glance. Just make sure you run it every frame (while {true} loop, eachFrame EH, etc)

little raptor
#

I don't remember

drifting portal
#

not really sure as I'm not the best with vectors to be honest.

little raptor
#

oh wait I wrote mine wrong meowsweats

#

change > 0 to < 0

#

also something I'm not 100% sure of is if diag_deltaTime stuff is needed

#

since vectorDirVisual is already visual think_turtle

#

I think if you do it like that it'll become slower

south swan
#

Isn't diag_deltaTime a frame normalization of speed, though?

little raptor
#

speed?

south swan
#

angular velocity

little raptor
#

idk what you mean meowsweats

#

the reason I added diag_deltaTime (which is 1 / diag_fps) is to make sure the rotation looks the same regardless of frame time (FPS)

#

but with vectorDIrVisual the frame time is already taken into account

south swan
#

[_dir, 5 * diag_deltaTime * accTime * ([1, -1] select (_cross#2 > 0))] call BIS_fnc_rotateVector2D; sounds an awful lot like "turn for whatever share/part of 5 degrees (radians) per second matches the time of previous frame"

#

so "turn at 5 whatevers per second independently of FPS". So "normalization"

little raptor
#

well yeah you don't know the current frame time yet meowsweats

south swan
#

close enough until we learn to predict future. Or ArmA3 gets a rock stable framerates. First thing is more likely.

winter rose
#

kill confirmed

drifting portal
south swan
#

it's not "efficient". It's "fluent" and/or "natural"

little raptor
#

it does it smoothly blobdoggoshruggoogly

#

not more efficiently

drifting portal
#

oh

#

I'm more concerned about it being efficient, that boss is floating, so it is really hard to notice if he is being 'snapped' into the direction

little raptor
#

the code itself is pretty much as fast as you can go with SQF tho (setDir one is faster but like I said it's laggy)

little raptor
drifting portal
#
_dirvector = (eyepos boss) vectorFromTo (aimPos target);
boss setVectorDir _dirvector;

I'm using this

#
_laserStart = boss selectionPosition 'pilot';
    {
        _laserStart set [_foreachindex, (_laserStart#_foreachindex) + _x ];
    } forEach [0.013, 0.06 , -0.018];
    _laserStart = boss modelToWorldVisualWorld _laserStart;

is this a good way of finding the eyepos? lol

little raptor
#

eyePos

drifting portal
#

(eyepos is not helping me mark the laser start, because it is a bit right or left or up or down for some reason)

little raptor
#

{
_laserStart set [_foreachindex, (_laserStart#_foreachindex) + _x ];
} forEach [0.013, 0.06 , -0.018];
vectorAdd

drifting portal
little raptor
drifting portal
drifting portal
little raptor
#

then eyePos should work fine blobdoggoshruggoogly

south swan
#

and talking "real" numbers Leo's code is 0.067 ms per iteration on my decade-old CPU blobdoggoshruggoogly

little raptor
little raptor
#

or best case?

south swan
#

the "not close enough" case with more calculations

little raptor
#

so worst case πŸ˜…

south swan
#

0.05 ms for "close enough" with fewer calcs. Literally nothing πŸ€·β€β™‚οΈ

little raptor
#

doesn't sound right

south swan
#

i'm still under impression that transmitting variables between SQF and engine is the time-consuming part here. Actual in-engine number crunching may very well be considered instant

little raptor
#

well yeah

#

but the difference is not right at all

#

the "not close enough case with more calculations" should be 3-4 times slower

#

in my head (and for my CPU): 0.006ms for best case

#

~0.03 ms for worst case (not sure about BIS_fnc_rotateVector2D)

south swan
#

just BIS_fnc_rotateVector2D is 0.01 ms. Literal boss setVectorDir [1,0,0]; is 0.04 ms

little raptor
#

that sounds too slow think_turtle

south swan
#

"boss" being global here as i've literally named a unit that

little raptor
#

I mean boss setVectorDir [1,0,0];

south swan
#

maybe it's being a pawnee involves some extra cals, i don't know

little raptor
#

so yeah it's too slow for you blobdoggoshruggoogly

south swan
#

yep, with an actual human being i get 0.0012 as well

#

note for myself: helicopters are slow to rotate 🀣

little raptor
#

wow my timings are so accurate 🀣

#

0.0052 ms best

#

0.0186 worst

#

I'm a virtual SQF engine now 🀣

#

actually why did I write 0.03 lol
I said 3-4x slower meowsweats. so 0.006 x 3 = 0.018... idk where I got 0.03 from...

drifting portal
#

You are advanced developer tools now

south swan
#

well, we've got from "literally nothing" to 4-10 times faster

drifting portal
little raptor
#

it doesn't

pseudo ridge
#

I create custom bushes like that:_bush = createSimpleObject ["a3\plants_f\bush\b_ficusc1s_f.p3d",_pos];But if a player stay inside those bushes he don't get explosion damage.

#

This not happens with default map bushes, on those you are not protected against explosions.

#

Can i create map-like bushes?

warm hedge
#

I don't think there is a way to place a bush like a terrain placed one

jade tendon
#

any1 know where i can find info about trigger conditions.
Particually, im looking for info on checking all objects in a trigger are not moving.
thnks

warm hedge
#
thisList findIf {velocity _x > 5} == -1```I guess
tropic vector
#

Is there any way to populate the city with random civilians when players are around and delete them after players gone?

stable dune
#

Hey, A friend of mine has made a unit capture an aircraft trajectory and fired with it, it works, only thing ai doesn't do is that it didn't change the range of the turret (machine gun on splitfire z7) so the shooting is different from captured movements. So is there a command to force a specific range or does he need to configure vehicles from a new turret/mg etc to change range?

jade tendon
granite sky
#

velocity returns a vector. You can use speed instead (in km/h not m/s and only counts forward motion), or sometimes better: vectorMagnitude velocity _x

warm hedge
#

Oof yeah, I forgot to array to number conversion yeah. Try what John suggests

jade tendon
#

thank you, now to figure out the rest

little raptor
little raptor
#

But still it doesn't make any sense

#

Penetration is controlled by fireGeometry LOD and its surfaces. So it should still work even if the object is super simple

little raptor
little raptor
stable dune
#

Good to know

worthy igloo
#

how could I make this _allVarsUINamespace = allVariables uiNamespace; copy to clipboard

#

copyToClipboard str _allVarsUINamespace; like this?

still forum
#

yes

worthy igloo
still forum
#

no