#arma3_scripting

1 messages · Page 15 of 1

glad fable
#

ah, might need to use type

glad fable
copper raven
#

look into the config

glad fable
#

yes?

copper raven
#

i assume you're doing it from the fired EH, so getNumber (configOf _projectile >> "searchForThisInTheConfig")

#

in CfgAmmo

glad fable
#

Ah

#

That's the ticket, thanks

drifting sky
#

does deleteVehicle on a unit trigger a killed event?

warm hedge
#

No

stable dune
#

Answering myself, but is there a workaround to reload the event, I mean the groups have no enemies detected -> I want to change my time.
and when the event is true, I want to change the time as well.

drifting sky
#

Is there a command to remove map objects... say I wanted to remove all map objects within a certain radius of a point. Possible?

warm hedge
#

You can hide instead

drifting sky
#

will ai be able to navigate as though those hidden objects weren't there?

warm hedge
#

I don't think so

drifting sky
#

so the objects are still there as far as the ai is concerned?

warm hedge
#

Hidden objects are hidden for everyone and almost every perspective I think

granite sky
#

The answer for that is probably quite complicated. On one Altis test I removed a bridge, and vehicles attempted to drive over it as though the bridge was still there. However, the collision-lookahead didn't trigger and so in some cases vehicles could cross the ground underneath when they couldn't cross the actual bridge :P

drifting sky
#

Is there a generic point light source object?

drifting sky
#

There's no global light point, only local ones?

warm hedge
#

Yes. So you need to make light for every clients

drifting sky
#

What's a name of a big flag pole object I can put bluefor or opfor flag textures on?

warm hedge
#

Flag_Red_F or such?

drifting sky
#

I don't know what I'm looking for. I'm seeing reference to swapping flag textures. But I'm not seeing to what kind of object that is applied.

#

I just realized there's a search bar in the object tree in eden.

winter briar
#

there is a way to know when player is running ?

#

would be cool like IsRunning player

warm hedge
drifting sky
#

Is there a quick way to loop through all object instances of a specific class?

drifting sky
#

Say I want to loop through all instances of "WarfareBDepot".

little raptor
#

Depends on the object simulation

#

If it's a house no

#

If it's a soldier or PhysX entity yes

#

Simple Objects too

drifting sky
#

It's just a building. Is there no way to just get an array with all the instances of a specific class?

little raptor
#

You can use nearestObjects or nearObjects but they're slow

#

Also they don't give you exact class match

#

So you need a typeOf check in the loop

drifting sky
#

position is irrelevant, just want all instances of a class

little raptor
#

I know. There's nothing else

#

If all of them are mission objs you can use allMissionObjects

#

But that's slow too

drifting sky
#

I guess I could just collect all the id's of objects as they are created on the server and pass them to the clients. Are the ids definitely going to be the same on every machine?

#

Is this safe to do? _depo = "WarfareBDepot" createVehicle _safe_pos; all_bunkers = all_bunkers + [_depo]; later: publicVariable "all_bunkers";

little raptor
proven charm
#

i have a strange crash problem with the extension version function that I can't figure out. the code causes buffer over run error when it leaves the function. Code: https://pastebin.com/XfpN5DHQ

#

i have used that code in EXEs before without problems

little raptor
#

How large would that be?

#

I mean the appended string

#

I think the extension version's buffer is most likely small, maybe even less than 16 bytes

#

Check outputSize first

still forum
#

Why do you need to sort same as in inventory?

#

You mean magazine repacking?

still forum
proven charm
#

ok thx, I will keep eye on the outputSize. I ignored that

ripe hemlock
#

I'm currently working on a script that is meant to attach something to the player model and update the thing's position each frame. I'm aware that attachTo would make this easier, but I need precise location in all positions, and it gets a little screwy when the player aims very high or low. I'm currently using selectionPosition to do this, and it's working just fine. Unfortunately, every time the script runs selectionPosition (so, each frame) it dumps an error into the report file.

specifically, I'm running something like this:
selectionPosition [player, "proxy:\a3\characters_f\proxies\weapon.001", 0, true, "FirstPoint"];
it returns the appropriate position array, but also dumps this into the rpt file:
No point in selection proxy:\a3\characters_f\proxies\weapon.001.

Is this a bug, or am I not using this command right? (Even though, at the end of the day, the whole thing still works to spec)

little raptor
#

player selectionPosition ["proxy:\a3\characters_f\proxies\weapon.001", 1]

rough summit
#
    vehicle player addEventHandler ["Fired", {
        params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
        
        if (_weapon == "SmokeLauncher") then {
            systemChat format ["%1", getPosATL _projectile];
            
            while {!isNull _projectile} do {
                private _nearMissiles = (getPosATL _projectile) nearObjects ["MissileBase", 30];

                if (_nearMissiles findIf {!isNull _x} != -1) then {
                    {
                        systemChat format ["Missile %1 intercepted", typeOf _x];
                        private _manualControlCheck = getNumber (configFile >> "CfgAmmo" >> typeOf _x >> "manualControl") == 1;
                        private _lockCheck = getNumber (configFile >> "CfgAmmo" >> typeOf _x >> "weaponLockSystem") > 0;

                        if (_manualControlCheck || _lockCheck) then {
                            private _missileVectorUp = vectorUp _x;
                            private _missileVectorDir = vectorDir _x;
                            private _xDirRandom = random 0.25 - 0.125;
                            private _yDirRandom =  random 0.25 - 0.125;
                            private _zDirRandom = random [0.05, 0.015, 0.025];

                            _x setVectorDirAndUp [[_missileVectorDir # 1 - _xDirRandom, _missileVectorDir # 1 - _yDirRandom, _missileVectorDir # 2 - _zDirRandom], [_xDirRandom, _yDirRandom, 1]];
                        };
                    } forEach _nearMissiles;
                };
            };
        };
    }];

Why _nearMissiles always empty?

ripe hemlock
#

It's not just with the proxy, either. I tried using "spine", and it gave the same error, but also returned a position of [0,0,0], which I doubt is correct

little raptor
ripe hemlock
#

I was copy/pasting them straight out of a return from selectionNames, to be safe

little raptor
rough summit
little raptor
#

it keeps logging to rpt which slows it down significantly (~0.5 ms for that command, which is totally unacceptable)

#

even if it doesn't exist, it shouldn't log

#

@ripe hemlock make a ticket

ripe hemlock
# little raptor selectionNames of LOD 1?

I just used this:
_sel = (player selectionNames 1) #28; player selectionPosition [_sel,1];
with _sel == "proxy:\a3\characters_f\proxies\weapon.001", and it correctly returned position, but also put the entry in the rpt as it's been doing

#

Alright, I'll put in the ticket. Thanks! 😄

gritty parrot
#

I wonder: How can you make an accurate weather forecast? OvercastForecast does only give a value, I cannot find out what it takes to start raining actually or to stop. How does the game handle weather?

little raptor
#

your while is just running in one frame up to 10000 iterations and wasting CPU time (lowering FPS)

rough summit
little raptor
#

then why do you put a while there? blobdoggoshruggoogly

rough summit
#

im exectuing via debug console with [] spawn {"EH HERE"}

little raptor
#

wat?

#

EH CODE IS UNSCHEDULED

rough summit
#

Lol

little raptor
#

that spawn is not part of the EH code

#

_bla addEH ["EH", {this is EH code, and it runs unscheduled}]

ripe hemlock
#

I think that you can use spawn to run some code in scheduled environment, even if it's in an EH. You just need to make sure that it only gets called if it's not already spawned and running

rough summit
little raptor
#

yes

rough summit
#

And..It still didn't work 😄

#
    vehicle player addEventHandler ["Fired", {
        params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
        
        if (_weapon == "SmokeLauncher") then {
            systemChat format ["%1", getPosATL _projectile];
            
            [_projectile] spawn {
                params ["_projectile"];

                while {!isNull _projectile} do {
                    private _nearMissiles = (getPosATL _projectile) nearObjects ["MissileCore", 30];

                    systemChat "Check";
                    if (_nearMissiles findIf {!isNull _x} != 0) then {
                        {
                            systemChat format ["Missile %1 intercepted", typeOf _x];
                            private _manualControlCheck = getNumber (configFile >> "CfgAmmo" >> typeOf _x >> "manualControl") == 1;
                            private _lockCheck = getNumber (configFile >> "CfgAmmo" >> typeOf _x >> "weaponLockSystem") > 0;

                            if (_manualControlCheck || _lockCheck) then {
                                private _missileVectorUp = vectorUp _x;
                                private _missileVectorDir = vectorDir _x;
                                private _xDirRandom = random 0.25 - 0.125;
                                private _yDirRandom =  random 0.25 - 0.125;
                                private _zDirRandom = random [0.05, 0.015, 0.025];

                                _x setVectorDirAndUp [[_missileVectorDir # 1 - _xDirRandom, _missileVectorDir # 1 - _yDirRandom, _missileVectorDir # 2 - _zDirRandom], [_xDirRandom, _yDirRandom, 1]];
                            };
                        } forEach _nearMissiles;
                    };

                    sleep 0.25;

                };
            };
        };
    }];
still forum
little raptor
rough summit
#

Thats why i didn't put 0.25 sleep previosly.
Yes, over water

little raptor
#

nearObjects needs AGL pos

#

you're providing ATL

#

so it would never work over water anyway

winter rose
#

are you…

#

suggesting…

#

getPos? 😛

rough summit
#

Hm

#

Idk how handle missiles then

little raptor
#

second reduce the sleep time to 0.01

#

there's still no guarantee that it will work in a real scenario

#

because of how scheduler works

rough summit
#

Dont work anyway

lyric portal
#

How can I make the Blackfish Gunship orbit some area

#

Because I’ve been trying different things and it keeps diving down

warm hedge
#

You can try Loiter waypoint

lyric portal
#

Yeah it’s not orbiting unfortunately. Counterclockwise, set altitude and radius.

#

It just keeps doing weird stuff

hallow mortar
#

Try setting it to Careless. AI pilots have some funny ideas about the appropriate way to respond to spotting the enemy.

lyric portal
#

Alright. I'll try it again thanks

gritty parrot
# little raptor you can't afaik

I managed to do it by working around it. Still limited prognosis of rain though, overcast alone does not seem to cut it, allthough an overcast of >= 0.5 is needed for rain

naive needle
#

Here is the example, but I got it to work now , by putting attachments/weapons first into the array and at the end the magazines

still forum
#

I think you missed this changelog entry

Tweaked: Inventory UI listboxes now have the class names of the item inside lbData (previously only magazines had them) - FT-T163668
Ah you want not only classname but the specific magazine ammo 🤔

#

Well no. Thats easy.
Find all magazines with the same classname, and sort by ammo count.
Magazines with same ammo count are combined into one entry, and otherwise the more full magazines will be at the top

#

you can iterate through the entries in the inventory UI.
And find where the first magazine of that type is, now you have a sorted list of magazines, and know where the first of that list is

naive needle
#
params [["_container",0],["_unit",player]];

if(_container < 1 || _container > 3) exitWith {[]};
_container = _container + 2; // Make it support getUnitLoadout select
private _items = (((getUnitLoadout _unit) select _container) select 1);
_DisplayNameArray = [];
_itemsNew = [];

{
    _ClassName = (_x select 0);
    if (_ClassName isEqualType []) then {
        _ClassName = (_ClassName select 0);
    };
    
    _configName = _ClassName call A3SClient_fnc_util_gear_getConfigNameByClassName;
    _itemDisplayName = getText (configFile >> _configName >> _ClassName >> "displayName");
    
    if (_configName == "CfgMagazines") then {
        _DisplayNameArray pushBack [_itemDisplayName,_forEachIndex];
    } else {
        _itemsNew pushBack _x;
    };
    
} forEach _items;

//Sort Magazines
_DisplayNameArray sort true;

{
    _itemsNew pushBack (_items select (_x select 1)); 
} forEach _DisplayNameArray ;

_itemsNew
#

This one works perfectly so far

south swan
#

doesn't actually account for item displayNames, but whatever, they're not meaningful in the use case

naive needle
#

yea I changed it to the way how dedmen advised and it works better. Before the Magazines weren't sorted in terms of Bullet Counts

#
_itemControl = _this select 0;
_InventoryControlIndex = _this select 1;
_MagazineClassname = _this select 2;

private _MagazinesInContainer = switch (ctrlIDC _itemControl) do {
    case 633: {magazinesAmmoCargo  uniformContainer player}; //Uniform
    case 638: {magazinesAmmoCargo  vestContainer player}; //Vest
    case 619: {magazinesAmmoCargo  backpackContainer player}; //Backpack
    default {[]};
};
if (_MagazinesInContainer isEqualTo[]) exitWith {};

// Looking for the Control Index of the Magazines
_MagazineControlIndex = -1;
for "_i" from 0 to _InventoryControlIndex step 1 do {
    _ClassName = (_itemControl lbData _i);

    if (_ClassName isEqualTo _MagazineClassname) then {
        _MagazineControlIndex = _MagazineControlIndex + 1;
    };
};

if (_MagazineControlIndex isEqualTo -1) exitWith {};

// Filter Magazines by classname
private _MagazinesFilterd = [];
{ 
    if ((_x select 0) isEqualTo _MagazineClassname) then {
        _MagazinesFilterd pushBackUnique _x;
    };
} forEach _MagazinesInContainer;

// Sort Magazines
_MagazinesFilterd sort false;

_SelectedMagazine = _MagazinesFilterd select _MagazineControlIndex;
#

@still forum ty meowheart

winter briar
#

is possible to detect when mouse button 4 or 5 are pressed?

winter briar
#

didnt tried

#

ye that work

#

ty

runic quest
#

Excuse me, may I ask, how to tell when the client connects to the server?

#

about BE RCON player#79 connected

#

I want to judge the client to join the server through the code

#

Does anyone know how to do this

ripe hemlock
#

I don't know, either, but are you wanting to know from the client's side, or the server's side? I think it'd probably be slightly different

inner swallow
#

If I give an artillery unit a fire mission via doArtilleryFire, how can I check if it has finished its fire mission? i.e. when all rounds have been fired.

runic quest
#

@ripe hemlock Server knows it

#

I want to let the server know at the same time when the client connects to the server

little raptor
inner swallow
#

ooh

#

let me check

runic quest
#

@little raptor I tried initplayerserver.sqf, but when the client connects to the server, there is no log output. It only outputs the log after I select the lineup to join the game

little raptor
#

yes, which is why I said playerConnected event handler

#

not initPlayerServer

runic quest
#

So which sqf file should I put playerConnected event handler in?

little raptor
#

initServer.sqf

#

not sure how it's different

runic quest
#

tks bro

#

let me try it

inner swallow
#

(returned false as long as it was firing)

little raptor
#

thanks. will add to the wiki

inner swallow
#

nope, this is correct

little raptor
#

ok, thanks!

inner swallow
#

I was chaining move-wait-fire-move-wait-rearm-move-wait-fire-move-etc, so needed to wait for the script to stop for the rounds to be fired otherwise it was moving ahead before firing or something

#

first i tried using waypoints but i think the way i was doing it was incorrect

#

so it was just queuing up waypoints and running out of sync with the script

#

thus resorted to doMove + moveToCompleted then doArtilleryFire + unitReady etc.

inner swallow
brazen lagoon
#

can you add items to dead units?

winter rose
#

I think so

brazen lagoon
#

yeah its just not as simple as using addItem

#

but not really a big deal

pseudo ridge
#

On 2.10 can i swap the diagonal of a terrain quad? This would help me to better edit the terrain.

winter rose
#

I'd wager "no"

pseudo ridge
#

I just asked to be sure.

winter rose
#

as it would imply a modification of the 3D model itself, but again it is from my minimal knowledge of the topic
(and I saw no commands for it either)

runic quest
#

Is there any code to identify the unique client computer ID?

#

As long as the client uses this computer, no matter what steam number he switches, is there an ID that uniquely identifies this computer?

pseudo ridge
#

clientOwner return this ID on clients

#

owner _object can be run server side and return the ID of the machine that is hosting the object

granite sky
#

If you mean persistent hardware IDs then I'm pretty sure Arma doesn't have access to that.

#

Not even sure if steam has those.

faint oasis
#

Hi, is there a way to get the weapon position ? Because i tried

onEachFrame {
    _gspos = (ASLToAGL (eyePos player));
    teste setPos (_gspos vectorAdd ((player weaponDirection (currentWeapon player)) vectorMultiply 1));
};

And it is working but not correctly. Actually it's more like the "eyePos" than the weapon pos.

ripe hemlock
# runic quest As long as the client uses this computer, no matter what steam number he switche...

If you're looking to assign "permanent IDs" to players on your server, and all of your players are using a mod you are distributing, it might work to just save a randomly generated value into their profileNamespace (on their end), and then have a script run when they join the server that saves that value publicly from profileNamespace into their object namespace, at which point it should be accessible to the server for checking stuff

ripe hemlock
#

Be warned, though, selectionPosition currently logs an error, even if it finds the position properly. I was just talking about that here, last night, and submitted a ticket on it. It still works fine, but can add to load if it's a per-frame thing

hallow mortar
# ripe hemlock If you're looking to assign "permanent IDs" to players on your server, and all o...

profileNamespace is associated with a particular Arma 3 profile, and it's easy to change profile. Given that their Steam ID (which is not user-changeable) is not good enough because they could change Steam accounts entirely, it seems unlikely that relying on the relatively throwaway A3 profile is going to be solid enough either.
I've got a feeling they're trying to do hardware bans, and I've also got a feeling that isn't going to be possible.

faint oasis
ripe hemlock
faint oasis
#

Oh i need to replace "(relevant weapon proxy)" by what i put before because otherwise it doesn't work

ripe hemlock
#

Yeah, sorry. I didn't mention that that was just my own explanatory filler 😄

faint oasis
runic quest
#

I want to disable the keys of the keyboard when the client connects to the server, how can I do that?

#

in OnUserConnected

barren basin
#

Trying to figure out why this just makes the target naked instead of also equipping the uniform and bandages. This is for MP```params ["_target", "_player"];

if !(isPlayer _target) exitWith {};

{
removeAllAssignedItems player;
removeAllItems player;
removeAllContainers player;
removeGoggles player;
removeHeadgear player;
removeAllWeapons player;
_target forceAddUniform "vn_o_uniform_nva_army_01_01";
_target addItem "vn_o_item_firstaidkit";
_target addItem "vn_o_item_firstaidkit";
_target addItem "vn_o_item_firstaidkit";
_target addItem "vn_o_item_firstaidkit";

} remoteExec ["call", _target];```

faint oasis
ripe hemlock
#

There's a really good chunk of code in here almost a year back that Leopard20 posted up. It basically lets you find the positions of memory points in the models of weapon attachments, and then convert them into a world position. I might be able to dig it up if you're interested

runic quest
#

@faint oasis it not work man

#

I want to disable when client connects to server

faint oasis
runic quest
#

initServer.sqf

faint oasis
#

this is why

runic quest
#

andOnUserConnected

faint oasis
#

yeah

#

try to remote exec the client with this command

copper raven
#

why not just use player init?

runic quest
#

Because there are many cheaters who can open the console to cheat externally, they don't need to enter the game, they only need to select the faction interface

faint oasis
hallow mortar
#

If cheaters are such a big problem that you're trying to add a custom hardware ban system, maybe you should be looking at things like enabling BattlEye on your server and implementing remoteExec (and mod) whitelists

ocean folio
runic quest
#

Cheaters can create unlimited vehicles in the character lineup interface via createvehicle

ocean folio
#

I get the impression you are trying to stop them from typing things into a cheat console in another application

runic quest
#

yes i want to disable their keyboards when they connect to the server, judge the corresponding fields on mysql so that they go to the server

hallow mortar
#

Controlling the computer outside of Arma is not possible and would be a giant security problem if it was possible

ocean folio
#

If any application had the ability to block access to your peripherals globally, that would be a bigger issue than cheaters

runic quest
#

They will create a console when connecting to the server and enter a code in the character selection faction.

ocean folio
#

That console will be in a different application will it not?

#

A totally separate executable?

#

Even if it was in ArmA tbh I don’t know if you could lock them out of it somehow

runic quest
#

No, I think they might call the console to execute code by pressing the corresponding key when connecting to the server, but the console should be created via _ctrl, so if I can disable it when they connect, I don't think they can cheat

ocean folio
#

I’d have to know more about ArmA cheats to tell you if that would work or not, but my money is on no

runic quest
#

I don't know if executing code on the server can disable their keyboard

ocean folio
#

Executing code on the server won’t be able to stop them from doing anything

#

It would have to be on their client

hallow mortar
#

You can't do anything to them until they've actually connected, even with remoteExec. Because, you know, they're not connected.

#

I really think you should be looking at dedicated security options such as BattlEye and mod whitelisting to prevent people connecting with the tools to do this.

ocean folio
#

^

runic quest
#

i use OnUserConnected and getUserInfocan get their uid name client id etc.

#

BattlEye can't do anything... As long as the console is open, the cheater can enter infinitely different codes

ocean folio
#

I’m curious what you are trying to set up that needs this level of automated security. Even if I was making a life server expecting to be full 24/7 I would just use the things Nikko mentioned, and have a reliable team to manually handle anything that gets through

ocean folio
hallow mortar
#

I'm somewhat dubious of the idea that you can open the console while in the process of connecting without the use of mods or external tools

runic quest
#

Before they passRscDisplayInventoryAfter tampering with the code behind to execute, I found a way to deal with it, using bis_fnc_initdisplay to judge. But the cheaters are updated and I don't know how they cheat. . . My scripts.txt doesn't even have any logs

ocean folio
#

If you have actually found an exploit like that in vanilla ArmA, and you can reliably replicate it, I’d make a note to Bohemia and they would probably look into getting it fixed pretty quick

runic quest
#

They have an external tool to inject the launcher, but it can't get around the keyboard callout, so I wonder if it can be disabled

ocean folio
#

Also how often are you expecting to see this exploit that it’s this big a deal?

runic quest
#

There is a person who sells cheats in our country, he makes everything and sells others, he updated the injector with a new version this time, so I can't start

ocean folio
#

Sounds like a job for manual moderation on your server

runic quest
#

The cheater could only call out the plugin when he was connected to the server locally, but he can now use the plugin when connecting to the server to the character selection interface

hallow mortar
#

Report him to BI (and BattlEye maybe?). They can take a look at it, figure out how it's done, and hopefully block it.

runic quest
#

Yes, there is no way. I added a field to mysql to determine whether the player can enter the server

copper raven
#

then just kick them if theyre not in the list on connect?

#

or pw protect the server? 😄 i don't get it

ocean folio
#

I feel like you are kinda tunnel visioned right now

runic quest
#

But that doesn't stop cheaters I guess, so I've been looking for if I can disable keyboard output when the client connects to the server

ripe hemlock
#

Well that just goes back, you could only possibly tell Arma to ignore keyboard input, but you can't tell their computer to do so

runic quest
#

i use OnUserConnected and Determine whether the player's UID is in the database, if not, trigger servercommand #kick

ocean folio
#

This is the third time you’ve said that

hallow mortar
runic quest
#

Is there any way to contact BE?

hallow mortar
runic quest
#

@hallow mortar TKS man

tough abyss
#

@ocean folio You can also use BattlEyes builtin filter lists

#

Which can be setup with Regex Expressions.

#

To detect and immediately kick / ban for violations

#

AFAIK I think BattlEye still works with them...

#

Why this isn't on the BattlEye FAQ is beyond me..

worthy fox
#

is it possible to have an array of marker names or a random NameCity for getMarkerPos to look for?

#

example 'B_CTRG_soldier_M_medic_F' createUnit [getmarkerPos 'PatientSpawn', _group1,'pat1=this; dostop pat1'];

#

I'm trying to have an AI unit or group spawn via an addAction at a random location on a map

past wagon
#

does linkItem not work on dead players?

copper raven
#

assignItem maybe

past wagon
#

nah, that requires it to be inside inventory

#

I found a workaround, though

copper raven
#

so add it?

past wagon
#

indeed

stable dune
#

Good morning,
If i want blufor shoot to independent do I need change friendly status or can I keep them friendly to another and do like this?

if (isServer) then {
    [] spawn {
        while {true/*for testing*/} do {
          private _units = units independent;
                If !(_units isEqualTo []) then {
                    private _allUnits = units blufor;
                    private _unit = selectRandom _units; 
                    {
                  "Unit exists"  remoteExec ["systemChat ", -2];
                ( str(_unit))  remoteExec ["systemChat ", -2];
                        _x doWatch _unit;
                        _x doTarget _unit;
                        waitUntil {_x aimedAtTarget [_unit] > 0};
                        _x forceWeaponFire [primaryWeapon _x, "fullAuto"];
                    } forEach _allUnits;
                } else {
                  "No unit"  remoteExec ["systemChat ", -2];
                };
            uiSleep 0.5;
        };
    };
};

this far i got now

This is not working properly, so I need some help here.
Thanks

#

Both are ai , so don't effect to players

granite sky
#

Seems like it'd be far easier to change the friend status?

#

Unless you have a good reason not to.

stable dune
#

Well, just want this for certain area, like if there is 1 city where ai shooting (blufor against independent) and rest of mission they are friends

ripe hemlock
#

You could set them to side Civi, maybe (just the ones you want acting differently) and have side Civi be hostile to those you want them shooting at

stable dune
#

Okey, i will try this out. Thanks.
Can I do that via trigger like change if side x , change hostile, inthislist

ripe hemlock
#

I would think that you could do it, but I don't know. I'm only familiar with this trick from Zeusing games, not from the scripting side

tough abyss
#

It will reduce lookup time

#

You could also use a hashmap to contain all the "Minor cities" then the "Major cities"

#

If you were to do it as an array it would look something like this.
[["Kavala", "Perigos"],["Some smaller town etc"]];

#

I've done something similar for Draw3D to get map positions of towns

#

then just use SelectRandom after selecting the appropriate nested index

harsh vine
#

so do have to call that same script every time i spawn in civilian units?

copper raven
#

run it once at init if you have preplaced civilian units, then just add the event handler to the ones you spawn on the fly

harsh vine
#

ok thank you

past wagon
#

I have a script that enables a ppEffect for a player while they are inside a certain zone.

This is the script: https://sqfbin.com/hejivetojijifutateqo
It works perfectly.
*please note that the spawn in the script is not unnecessary, I just removed the part that it pertains to, as it is irrelevant.

I am trying to make it so that players wearing certain goggles will receive a less intense version of the effect. These are the two scripts that I have tried:
https://sqfbin.com/ofukojodekoyonanapiq, https://sqfbin.com/qusobopifuyexekupulo

Neither of them work. With the first one, no effects are shown at all. With the second one, it always shows the same intensity (regardless of goggles), but an intensity that neither of the adjustments should set it to; I think it's the default intensity for the effect.

I know I'm probably not fully understanding how these commands work, but the wiki pages for them are vague and lack many examples or notes. Does anyone know what I should do differently to accomplish my goal?

little raptor
#

That's why the 1st one doesn't work

past wagon
little raptor
#

I'm not sure what's wrong with the second

#

I counted the effect args but they weren't the same

past wagon
#

hmm

little raptor
#

(or I counted wrong)

past wagon
#

well, if the first one works then I'll use it

coarse dragon
#

hey im using spawn BIS_fnc_dynamicText;

but i was wondering how would i get it to be higher up on the screen?

this is part of the full code

</t>",-1,-1,45,1,0,789] spawn BIS_fnc_dynamicText;

little raptor
#

Where exactly do you want it to be?

coarse dragon
#

they make the text go off to the side of the screen

little raptor
#

Ok but where do you want it?

inner swallow
little raptor
#

yeah I expected so

coarse dragon
#
[mine setdamage 1]; && [mine1 setdamage 1]; && [mine2 setdamage 1];

how wrong is this code?

granite sky
#

very

#

specify exactly what you're trying to do.

coarse dragon
#

blow up 3 AT mines via a trigger when a civ enters it

granite sky
#

and this is just supposed to be the trigger action code?

coarse dragon
#

ya

#

mine setdamage 1; works on its own.
but cant get all 3 to go off

granite sky
#

just mine setDamage 1; mine1 setDamage 1; mine2 setDamage 1;

coarse dragon
#

i done that, but it didnt work 😦

granite sky
#

well, adding arbitrary syntax won't help you :P

#

Try running that from the debug console and see what happens.

sharp grotto
#

You could also do

{
    _x setdamage 1;
}foreach [mine, mine1, mine2]
coarse dragon
#

Strange it doesn't work

#

The mines won't blow up

winter rose
#

how did you setup these mines?

#

also use a hint to make sure your code is run.

#

(or a systemChat, I'm not picky)

#

@coarse dragon^@coarse dragon^@coarse dragon^@coarse dragon^@coarse dragon

south swan
#

inb4 non-scripted variant of mines

coarse dragon
#

Gave em a name. And plopped the code in a trigger.

But I tested the same thing out with one and it went off with the trigger

winter rose
#

1/ not telling us how you placed these mines
2/ not telling us what is the difference of setup: just mine setDamage 1 works then?

coarse dragon
#

Yea

#

Placed em as object 😖

winter rose
#

the code above (from John Jordan & El'Rabito) being correct, your issue is elsewhere then

coarse dragon
#

It's set up for a civilian to blow em up

winter rose
#

cool

coarse dragon
#

It wasn't because I set a timer up wrong.. 22 instead of 2 meowsweats

past wagon
#

I am creating a RscStructuredText control and setting its text. I need to set the control to be the right size to fit the text. How can I calculate that based on the text?

winter rose
#

getTextWidth is a thing, but for simpler text

past wagon
#

ah

#

yeah I was looking for a command like that

#

thanks

winter rose
open fractal
#

what is the purpose of BIS_fnc_vectorDirAndUpRelative?

open fractal
#
Returns vectorDirAndUp of object 1 relative to object 2
#

this is what I'm confused about

#

what is a relative vectorDirAndUp?

winter rose
#

like… relative to the other
like relative direction, if a guy is turned to 90° and the other is 45°, the result is… hmmm… well something that is not 90°

granite sky
#

In world space, [0,1,0] is north. In object space, [0,1,0] is forward (IIRC)

open fractal
#

I think I understand now, thanks. I was confused by the implementation in this context https://forums.bohemia.net/forums/topic/215442-solved-point-one-object-at-another-bis_fnc_vectordiranduprelative/
I'm looking to "point" one object at another object's position with vectorDirAndUp. How would I go about that?

granite sky
#

Not with that function :P

#

_obj vectorFromTo _targetObj is a good starting point.

#

That gives you your desired vectorDir, and then you just have to fix your vectorUp.

#

Which this works for in most contexts:
_vecUp = _vecDir vectorCrossProduct [0,0,1] vectorCrossProduct _vecDir

open fractal
#

that seems to work very well, thank you

#

my brain, however, is having a crisis

#

brb going back to geometry class

granite sky
#

It's quite possible that you can get away with specifying vecUp as [0,0,1]. Depends whether (and how) Arma orthogonalizes the inputs internally.

#

Even this assumes that Arma normalizes the result. I'd be very surprised if it doesn't.

#

(_vecDir vectorCrossProduct [0,0,1] won't be a unit vector unless they're already orthogonal)

past wagon
#

anyone know why <t valign='bottom'> isnt working?

past wagon
#

yikes

#

thanks, Mr. Google

unique sundial
distant oyster
#

okay in sqf but how about in the config? it does not seem to apply to custom CT_STRUCTURED_TEXT controls

drifting sky
#

Does "if" or "switch" count as an exitable scope with "exitWith"?

granite sky
#

exitWith always exits the current scope. Whatever the last curly bracket is, basically.

copper raven
little raptor
#

as long as you return a bool

copper raven
#

well yeah, but you can't outright do it like with other scopes is what i meant

drifting sky
#

What's the deal with playActionNow? With actions such as "FastL", they seem to sometimes move, but other times seem to get stuck on something or rubber-band back to where they started. Is there any way to avoid that?

faint oasis
#

Hi, can we get the "direction" of a selection like "selectionPosition" ?

drifting sky
#

Where can I get a list of AI features, i.e., ones to be used with "enableAIFeature"?

warm hedge
winter rose
#

the BIKI?? pikachusurprised

drifting sky
#

Are these the only 2 features??? "AwareFormationSoft"
"CombatFormationSoft"

warm hedge
#

Which I don't really know what they do

winter rose
#

it is the "sub-formation" iirc

drifting sky
#

There is no list of ai features that I can see

winter rose
#

there is, linked

#

"see disableAI"

#

use enableAI/disableAI, no need for that obscure enableAIFeature alternate syntax

drifting sky
#

Neither of these is listed in the list on disableAI "AwareFormationSoft"
"CombatFormationSoft"

winter rose
#

WHAT IS IT THAT YOU WANT

warm hedge
#

Because are for enableAIFeature

faint oasis
drifting sky
#

Are the only two possible values for enableAIFeature, "AwareFormationSoft" and "CombatFormationSoft"?

warm hedge
#

So BIKI says

drifting sky
#

Why is it being compared to enableAI and disableAI if it doesn't contain the same list of possible string values?

winter rose
#

you won't answer, hey?

drifting sky
#

I want to know what enableAIFeature is for, and if it has the same purpose as enableAI and disableAI.

winter rose
#

its secondary syntax is the same as the non-*feature
otherwise it is an entirely different command with its main syntax

#

rrread the doc

drifting sky
#

So it's secondary syntax is an entirely different purpose?

warm hedge
#

Yes

winter rose
#

as written

drifting sky
#

actually it doesn't explicitly say that

#

and you guys are giving me grief for idiotic language in the wiki.

winter rose
#

I give you grief for not stating your goal

#

First

warm hedge
winter rose
#

Second, for dodging the questions

and while you have the nose on the page, you wonder "what are the possible values"

you can admit all this can be frustrating from the outside

drifting sky
#

So what is the effect of enabling or disabling "AwareFormationSoft" or "CombatFormationSoft"?

winter rose
#

are you doing something in particular, or asking random questions about commands? knowing would help

drifting sky
#

I'm trying to track down every possible reason why AI would refuse a move order.

winter rose
#

mods

drifting sky
#

sorry, a doMove command

#

Or rather, every possible reason they would hesitate or refuse a domove command.

winter rose
#

or an inaccessible destination

drifting sky
#

Is there a way to check if the destination is inaccessible?

winter rose
#

barely, unreliably

drifting sky
#

Is there any way to adjust a destination such that it is sure to be accessible?

warm hedge
winter rose
#

not really

drifting sky
#

Is inaccessible destination related to my other question, about certain actions performed with playActionNow resulting in rubber-banding motion?

#

i.e., unit snapping back to its starting position after the animation is played.

#

that happens only some of the time

winter rose
#

I don't get the connection between the two and playActionNow 🤔

drifting sky
#

My hypothesis to explain the rubber-banding motion is that the position they end up in at the end of a playActionNow command might be inaccessible.

#

Am I right in suspecting that could result in visually apparent rubber-banding?

winter rose
#

I'd wager "no".

#

playMoveNow or playActionNow?

drifting sky
#

I've been using playActionNow.

winter rose
#

also: why bother with pathfinding if you make it walk

drifting sky
#

what's the difference between playMoveNow and playActionNow?

drifting sky
winter rose
drifting sky
#

These questions were only related in these ways. In the case of domove, the unit fails to move for reasons unknown to me. In the case of playActionNow, sometimes the unit fails to move while the animation is playing or once the animation has finished playing, rubber-bands back to its starting position. In both cases I wonder if there is a common culprit that could explain the undesired behaviour, an inaccessible destination.

#

In the latter case, I'm suspecting the engine will now allow a unit to end up in an inaccessible location via playActionNow, even though no pathfinding was used to get there, because the unit would then become stuck in a position from which it cannot navigate.

#

But I don't know how inflexible the ai pathfinding is, so I don't know if this is enough to explain the playActionNow problem.

#

Is there any command which could give me a reasonably good idea of whether a position is too close to or within the geometry of an object to be navigable?

#

perhaps a way to test for collision with map objects against a sphere of some radius?

winter rose
#

if you move the AI, it will be moved, period
pathfinding only occurs when a move order is given

#

regarding positions, nearest(Terrain)Objects and sizeOf

#

but something tells me you are taking the problem by the wrong end

drifting sky
#

in the case of playActionNow

winter rose
#

test in singleplayer

drifting sky
#

I have been.

winter rose
#

then IDK
test without any mods
test in VR
test in usual conditions

drifting sky
#

only mods are CUP, CBA, and JSRS

winter rose
#

still

#

also, what is the cursed location
also, what is the code you use
also, is the unit moving then saying "can't get there"

drifting sky
#

In the case of playactionnow, there doesn't seem to be anything special about the position, except maybe it's not aligned with some terrain cell resolution??? They don't say anything. Here's an example of code: _unit playActionNow (selectRandom ["EvasiveLeft", "EvasiveRight"]);

#

There's a sleep command right after that so there should be some grace period before anything else could be interfering.

winter rose
#

no no, one issue at a time
the doMove thing, all the rest is solving attempt noise

boreal parcel
#

this is the correct way to add 10 of these magazines yes? if so it seems to be only adding 1.
_vehicle addMagazineTurret ["rhs_mag_400rnd_127x99_SLAP_mag_Tracer_Red", [0], 10]

#

if not, how would I go about adding 10 without copy/pasting this line 10 times?

hallow mortar
#

No, addMagazineTurret adds 1 mag, and the number is the number of rounds in that magazine (up to config max)

warm hedge
#

BIKI says the last 10 is ammocount

boreal parcel
#

oh

warm hedge
#

for "_i" from 1 to 10 do {}; to loop

boreal parcel
#

ammocount like bullets in the mag?

warm hedge
#

Ye

boreal parcel
#

aww, I was hoping that was the built in method so I wouldnt have to loop

#

big sad

#

one last thing then

warm hedge
#

Why's a loop a concern?

hallow mortar
#

Such a thing is possible with the addMagazines and addMagazineCargo commands, but unfortunately those are only for infantry magazines, not vehicle weapons

boreal parcel
#

its not really, I guess I would be slightly worried about any effect on performance as the vehicle/s may be respawning frequently or there may be many of them

#

plus I'm going to be doing this for a few different vehicles

hallow mortar
#

10 addMagazines won't cause a noticeable performance impact, and even if it did it would only be a very tiny spike at the moment it happened - no permanent effect

boreal parcel
#

also one more thing, I would also like to remove the default mags, is there a way to grab how many mags the vehicle has of this type? or would it even matter if I just loop more times than there is mags?
_vehicle removeMagazineTurret ["rhs_mag_400rnd_127x99_mag_Tracer_Red", [0]];

#

would it error at all if say there is 5 mags but i loop removeMagazineTurret 20 times

hallow mortar
#

removeMagazinesTurret

boreal parcel
#

ah thanks

#

alright works perfect, thanks

hallow mortar
#

Does anyone have any ideas on how to hide the markers for terrain features such as churches, public transit etc.? I figured they would be covered by Location commands but they don't seem to match any of the types.

tough abyss
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
warm hedge
hallow mortar
#

That's unfortunate

warm hedge
#

You want to make an empty map am I right?

hallow mortar
#

No, not completely empty. I just want to hide some of the more detailed markers because you're not supposed to have perfect intel on the area. I've got rid of names (except the Piorun marker in the NW of Livonia for some reason, doesn't seem to actually be any of the hill/mountain types) and I wanted to take out the local utility stuff too. It's not a big deal but it would've been cool, and useful in the future if I ever wanted to hide a church without confusing people.

maiden juniper
#

looking for some advice. Ive made a recruit ai script that delivers the ai via para drop from a chopper. when creating the unit i have to assign it to a group other then the players so the group is not local, otherwise some commands wont work on it. at the end of the script i add the unit to the players group like this

[_unit] join (_pGroup); 

this works about 80% to 90% of the time. for the life of me, i can't figure out why it fails sometimes. i went a step further and added a check with a while loop like this

while {(group _unit) != _pGroup} do 
{
    diag_log format ["RECRUIT AI SCRIPT. _unit = %1, _pGroup = %2",_unit,_pGroup];
    [_unit] join (_pGroup); 
    uiSleep 0.5;
};

this produces the same results.
i can see in the rpt that it runs once per unit so to me that would mean the check worked, and the unit joined the group, but in game the unit has not joined.
I'm left scratching my head. any insight here would be greatly appreciated.

hallow mortar
#

when creating the unit i have to assign it to a group other then the players so the group is not local, otherwise some commands wont work on it
This sounds like it could/should be solved through the power of remoteExec rather than relying on automatic locality assignment.
Also, the () around _pGroup aren't necessary - it's just a single variable, there's no need to worry about it being evaluated in the wrong order.
In my experience, group joining can sometimes get stuck in a halfway state for basically mystery reasons. If it's a serious problem in your case, you might have to try bruteforce solutions such as repeating the join command. Or.... create them in the intended group to begin with, and use remoteExec to target them with any LA/LE commands.

maiden juniper
tough abyss
#

@maiden juniper Any particular reason for using uiSleep instead of sleep?

meager granite
#

I wonder why Push To Talk (caps) key doesn't work when there is a dialog open but Voice Over Net (x2 caps) does?

unique sundial
#

repro?

meager granite
#
  1. createDialog "RscDisplayEmpty";
  2. Hold Caps Lock - no VON
  3. Double press Caps Lock = VON works
    with default controls
distant oyster
quiet gazelle
#

is the marked set of brackets necessary?

warm hedge
#

No. But it won't make it slower or faster or whatever. Do what you prefer

quiet gazelle
#

thanks

unique sundial
distant oyster
#

wont be at my pc for a while, tis the best i can do rn

unique sundial
unique sundial
maiden juniper
hallow mortar
# maiden juniper the script is ran server sided via remoteExec. I'm assuming my problem is this m...

Yes, I figured the script would be on the server (though it probably doesn't need to be unless you're using SE commands). What I mean is that you can use remoteExec again to target the unit's locality. The locality parameter of remoteExec accepts units, and if you pass a unit the command will automatically be sent to wherever the unit is local. Example:

_unit = createUnit [ ... ];
[_unit] remoteExec ["desa_fnc_unitLocalStuff",_unit];```
manic sigil
#

Is there a way to force AI to report status? Or otherwise clear the little red 'wounded' box on the group tray after they've been healed?

little raptor
manic sigil
#

Yeah, automating it.

little raptor
#

try rejoining them, see what happens

#

it can refresh many things

#
[_unit] joinSilent group _unit
#

not sure about wounded status

manic sigil
#

Hrn. Might be worth a try.

#

That does seem to do the trick, though I'll have to monitor and see if it screws with anything else.

little raptor
#

also you shouldn't apply that to the leader

#

that code acts like "return to formation"

manic sigil
#

It's for vehicle AI crewmembers, which for most of the vics I'm testing is minimum two, besides the player.

#

It it's a problem, it's not really a big enough issue to hassle over, just a QOL for my peace of mind 😛

quiet gazelle
#

inPolygon seems to be inconsistent about whether the corners of a polygon are inside it or outside
is that something i should somehow report?

#

for example [2012.38,5538.97,0] inPolygon [[2008,5544,0],[2012.38,5538.97,0],[2008,5540,0]]; returns false while [2008,5540,0] inPolygon [[2008,5544,0],[2008,5540,0],[2012.38,5538.97,0]]; returns true

little raptor
granite sky
#

No chance of that working the way you want it to. Too much FP involved :P

little raptor
#

being a vertex is irrelevant

#

since you're checking triangles you can write your own inTriangle check to support vertices

#

or just use in if you want exact matches

#
_vertex in _polygon || {_vertex inPolygon _polygon}
#

but since you're using floats that's not needed, unless you're deliberately passing vertices

granite sky
#

Won't work if a point is exactly on a line rather than a vertex though.

little raptor
#

yeah

#

like I said:

if you want exact matches

granite sky
#

The reason is that these algorithms work by comparing which side of each line a point is on, and that's never perfect with floating point. You have to adjust with epsilons.

quiet gazelle
little raptor
#

I still don't see why you're deliberately passing vertices blobdoggoshruggoogly

quiet gazelle
#

otherwise i've already written my own test, i just stumbled upon inPolygon and found it to be like 10 times faster

#

can't elaborate further, i gotta go now

smoky rune
#

Are there any limitations or differences how missionProfileNamespace works compared to profileNamespace?

#

I just want to swap profileNamespace calls with missionProfileNamespace and see if it works out, as profile namespace gets pretty bloated when many mission instances store their info there

hallow mortar
#

As far as I know, that's basically what it's for

unique sundial
quiet gazelle
# little raptor I still don't see why you're deliberately passing vertices <:blobdoggoshruggoogl...

i'm generating triangles to cover holes left after deforming terrain to put in trenches.
during that process i check if a newly generated triangle intersects with other triangles to see if it's invalid.
for that i've written a triangle intersection check which triggers if triangles intersect, but doesn't trigger if they touch.
currently that check checks intersection of the lines making up the triangles as well as checking if the points of either triangle lie inside the other.

into that function i feed triangles that (depending on the case) touch corners.

quiet gazelle
drowsy geyser
#

hey, i have some part of a script that does not work as i want, the below should attach a lightpoint to the bullets and make the lightpoint visible to my firend but for some reason he cant see my bullets and i cant see his bullets
it should look like this:
https://www.veed.io/view/dd7ed2a9-68f6-48da-8366-ea12e95d53cb

0 = [150] spawn {      
params ["_speed"];      
_bullet = "B_9x21_Ball" createVehicle position Drone1;      
_bullet setPosATL (Drone1 modelToWorld[0,0.2,-0.12]);      
_dir = (getCameraViewDirection Drone1);      
_bullet setVelocity ((getCameraViewDirection Drone1) vectorMultiply _speed);    
_bullet setShotParents [drone1P, drone1P];   

[Drone1,["laserShot", 1000, 1]] remoteExec ["say3d",0];  
  
_tracerColor = selectRandom [[1,1,1],[1,0,0],[1,0,1],[1,1,0],[0.5,0.5,1],[0,1,0]];   
_light = "#lightPoint" createVehicle (getPosVisual _bullet);
_light attachTo [_bullet,[0,0,0]];

[_light, 300] remoteExec ["setLightIntensity", 0];  
[_light, [0,0,0]] remoteExec ["setLightAmbient", 0];
[_light, _tracerColor] remoteExec ["setLightColor", 0]; 
[_light, true] remoteExec ["setLightUseFlare", 0];
[_light, true] remoteExec ["setLightDayLight", 0]; 
[_light, 0.1] remoteExec ["setLightFlareSize", 0]; 
[_light, 300] remoteExec ["setLightFlareMaxDistance", 0]; 
   
[_light,_bullet] spawn {   
    params ["_light","_bullet"];   
    waitUntil {isNull _bullet};   
    detach _light;   
    deleteVehicle _light;
    };
};
copper raven
#

you should be using createVehicleLocal for them aswell

drowsy geyser
#

okay i will test it

sudden bear
#

Hello everyone, I am totally new in the programming on ARMA 3, however I am particularly interested in it in order to fix some bug. Indeed I try to understand the functioning of the AI especially with regard to the use or not of certain weapon and ammunition. Let me explain, the AI does not allow the use of FAB bombs (and any other type of unguided bomb) in all RHS vehicles except ONE, the Mi-24P not the V version P only and only this vehicle not even the SU-25. My question is: Why? Why does AI deprive this firepower? (It’s not as if she didn’t know how to use no guided bombs, she throws the Mk82 very well). And if anyone can figure it out, can anyone teach me how to solve it? Thank you very much for any answer 😉

little raptor
#

in general, AI can't use scripted vehicle stuff (unless they specifically scripted that part too)

sudden bear
little raptor
#

idk blobdoggoshruggoogly
it depends what the problem is, and if you have the skills necessary (SQF scripting or config making) to fix it

granite sky
#

Strongly recommend Advanced Developer Tools for config browsing.

#

Vanilla config browser is suffering.

drowsy geyser
little raptor
#

you need to remoteExec the whole code

#

a code that creates the light

#

attaches it
sets its properties

drowsy geyser
#

how? please tell me xD

little raptor
#

First make a function

#

do you know how to do that?

drowsy geyser
#

unfortunatly no

little raptor
#

that's the easiest way

#

from what I see you only need 1 parameter for your function: the projectile

#

but I think projectiles are local thonk

#

anyway, for now just try sending the projectile over but I don't think it works

#
//fn_attachLightToBullet.sqf
params ["_bullet"];
_tracerColor = selectRandom [[1,1,1],[1,0,0],[1,0,1],[1,1,0],[0.5,0.5,1],[0,1,0]];   
_light = "#lightPoint" createVehicleLocal (ASLtoAGL getPosWorld _bullet);
_light attachTo [_bullet,[0,0,0]];

[_light, 300] remoteExec ["setLightIntensity", 0];  
[_light, [0,0,0]] remoteExec ["setLightAmbient", 0];
[_light, _tracerColor] remoteExec ["setLightColor", 0]; 
[_light, true] remoteExec ["setLightUseFlare", 0];
[_light, true] remoteExec ["setLightDayLight", 0]; 
[_light, 0.1] remoteExec ["setLightFlareSize", 0]; 
[_light, 300] remoteExec ["setLightFlareMaxDistance", 0]; 
waitUntil {isNull _bullet};   
detach _light;   
deleteVehicle _light;
#
[_bullet] remoteExec ["TAG_fnc_attachLightToBullet"]
#

also plz stop using getPos and position...

tough abyss
#

running ASLtoAGL on a world position is odd too

#

should use getPosASL _bullet if you're going to use ASLtoAGL

#

then again for something like a bullet I guess the difference is relatively minimal

#

and why doing remoteExecs with a locally created vehicle meowsweats

copper raven
#

can just pass the position itself (nevermind, didn't see that you're attaching)

#

and remoteExecs shouldn't be there yeah

little raptor
little raptor
#

because it doesn't have a land contact

upper siren
#

if I want to clear the inventory of a vehicle do I need to run clearItemCargo, clearMagazineCargo, clearWeaponCargo and clearBackpackCargo?

sharp grotto
#

or maybe better

    clearWeaponCargoGlobal _vehicleObject;
    clearMagazineCargoGlobal _vehicleObject;
    clearItemCargoGlobal _vehicleObject;
    clearBackpackCargoGlobal _vehicleObject;
#

That's what i use for MP

upper siren
#

ah yeah, using the global version is probably best 😄

#

😄

#

thanks!

faint oasis
#

Hi, can i get a position from the "vectordir and vectorup" ? like that :

_vectordir = vectorDir _unit; 
_newpos = ((getpos _unit) vectorAdd (_vectordir vectorMultiply 15));

Because the vectorDir seems to be only for some "axis" but not all and the vectorup seems to be for some others axis but not all.

little raptor
#
  1. are you using getPos intentionally?
  2. what do you mean "get a position from the "vectordir and vectorup""? it makes no sense
faint oasis
#

like a turret

#

and yeah i'm using getpos intentionally actually

little raptor
faint oasis
little raptor
#

e.g. 10 meters to the right of unit, 1 meter up, etc.?

faint oasis
#

in front of the direction

little raptor
#

vectorModelToWorld

faint oasis
#

yeah but more like that :

_gspos = (player modelToWorld (player selectionPosition "proxy:\a3\characters_f\proxies\pistol.001"));
_gvector = (player weaponDirection (currentWeapon player));
_gpos = (_gspos vectorAdd (_gvector vectorMultiply 30));

Because i checked the function "vectorModelToWord" but you need to have an object. Actually i have a position and a direction i got with BIS_fnc_transformVectorDirAndUp

little raptor
#

I don't know what you mean

#

tell me exactly what you want to do

faint oasis
#

I put a "particlesource" and i want to control the particle velocity to fit to the "direction" i got with "BIS_fnc_transformVectorDirAndUp". Sorry for my bad explanations 🙂

little raptor
#

I'm still not sure if I understand what you mean. but you can use several vectorMultiplys or matrices:

_fnc_vectorModelToWorld = {
  params ["_vec", "_vy", "_vz"];
  private _vx = _vy vectorCrossProduct _vz;
  private _transform = matrixTranspose [_vx, _vy, _vz];
  flatten (_transform matrixMultiply _vec);
};
#

usage:

[_myvector, vectorDir _veh, vectorUp _veh] call _fnc_vectorModelToWorld 
#

it does the same thing as vectorModelToWorld except no object is needed

faint oasis
#

_myvector is what ?

little raptor
#

is that what you want?

little raptor
#

similar to _obj vectorModelToWorld _myvector

faint oasis
#

oh ok so _myvector is the same thing for "BIS_fnc_transformVectorDirAndUp" and the vectordir and vectorup is what i have so i will try and tell you then 😄 Thank you

little raptor
#

wat? no

faint oasis
little raptor
#

_vy is dir
_vz is up
_myvector is a vector in "model space"

faint oasis
#

yeah but i can put [0,0,0]

#

i will try and tell you

little raptor
#

for what?

faint oasis
#

for "_myvector"

little raptor
#

it will give you [0,0,0] back

faint oasis
#

but the "vectordir" and "vectorup" is what i got with the BIS_fnc_transformVectorDirAndUp right ?

little raptor
#

a zero vector is the same in all spaces

little raptor
#

that function transforms a vector in model space, defined with two perpendicular axes dir and up, into world space

faint oasis
#

but actually i don't have model

little raptor
#

you don't need a model
you just need a vectorDir and vectorUp

faint oasis
#

the result i got is from a "vectordir" and "vectorup" generate with the BIS_fnc_transformVectorDirAndUp

#

ok but the "_myvector" is not needed because the "vectordir" and "vectorup" are already generated with the function "BIS_fnc_transformVectorDirAndUp"

little raptor
#

...

#

BIS_fnc_transformVectorDirAndUp gives you two vectors

#

a dir and an up

little raptor
faint oasis
polar bramble
#

How do I do make a string array a function parameter?

peak pond
#

My mod uses a postInit CfgFunctions attribute to run a certain function at mission start. However, I noticed it is even running (it plays a sound) at the main menu mission when the game starts. How can I detect and abort in this case? I only want this code to run in an "actual misson", not on main menu.

open hollow
#

how i can clear all cargo from a vehicle? i mean weapons, mags and all that... im trying to use clearItemCargo but it dont seem to work

open fractal
#

it'll be passed as _this

polar bramble
open hollow
#

damn

#

yea, lol

polar bramble
#

So there isn’t a way to make sure there doesn’t get parsed some junk like an array of five objects into this?

open fractal
#

what's the issue?

tough abyss
#

if you want to validate that the array contains only strings you will have to do so yourself manually

#

i.e.

if !(_stringArray isEqualTypeAll "") exitWith {};
peak pond
elfin comet
#

I feel like I'm somewhat close to what I'm going for but it doesn't seem to be waiting for me to be close to the designated marker.

waitUntil { ({alive _x && (((getPosASL _x) distance (getMarkerPos "SADmark2")) <= 50)} count allPlayers) > 0 };```
I just want it to wait until there is at least one alive player within 50m of `SADmark2`.
#

Sorry, scratch that. It is waiting now, because I initially had the < as >. small mistake on that. But the new problem being is that the above statement never becomes true.

elfin comet
#

ooo, combined with an arrayIntersect could work.

#

something like counting between the two should work for what I need.

open fractal
#
sleep 0.5;
_alivePlayers = allPlayers select {alive _x};
count (_alivePlayers inAreaArray _yourAreaParams) > 0
#
sleep 0.5;
allPlayers findIf {alive _x && (_x distance getMarkerPos "SADmark2") < 50)} > -1
#

these are the options I can come up with

#

i think inAreaArray is more efficient

south swan
#

also, getMarkerPos returns 0 height, so distance-ing with getPosASL may never even work if the marker is on high enough hill :3

elfin comet
#

Shoot, thats right.

open fractal
#

also if you're crazy about optimization you can store the marker position to a global variable and reference that instead

#

probably negligible but I like to keep things neat in loops 🙂

tough abyss
#
private _markerPos = getMarkerPos "SADmark2";
waitUntil { sleep 0.5; (_markerPos nearEntities ["CAManBase", 50]) findIf {alive _x} > -1 };
#

@faint oasis It converts model space vectors to world space vectors. Simple as that.

#

Models are in a different coordinate space compared to world space.

#

Bit like how blender has several types of coordinates like Local and Global global being the reference point for all objects in the world and local being local to that object and model.

#

It's more commonly called Local space vs Global space.

#

Models are local to the models Global refers to the reference point of the entire world.

open hollow
#

i want to change all radios from selected units in 3den but it aint working

{
if ( "TFAR_anprc152" in items _x) then {
_x unassignItem "TFAR_anprc152";  
_x removeItem "TFAR_anprc152"; 
 _x  addItem "TFAR_fadak";
_x assignitem "TFAR_fadak";
}; 
} forEach (get3DENSelected "object")

any ideas on how to do it?

tough abyss
#

In Eden or in game?

open hollow
#

3den

tough abyss
#

Before the game starts?

open hollow
#

yea

tough abyss
#

Is the TFAR radios actually named the above?

open hollow
#

yes

#

oh, isnt listed on items, just removed the conditions and it worked

tough abyss
#

First rule of debugging.

open hollow
#

wait, it didnt lol

tough abyss
#

SystemChat format ["%1",_somevar"];

#

Stick it in each line see what comes out.

open hollow
#

when save and load it changes wtf

tough abyss
#

If that doesn't work diag_log format ["%1",_somevar"];

#

And look in your RPT

open fractal
#

diag_log does the string conversion itself iirc

#

diag_log _somevar

#

regardless you can just use str

tough abyss
#

@open fractal Oh it does now?

#

Well in that case if you need more than one var @open hollow then use format["%1","%2",_var1,_var2]; etc

elfin comet
winter rose
#

diag_log [_var1, _var2] can also work

tough abyss
#
format ["%1 %2",var1,var2];
tough abyss
elfin comet
#

I just want to make sure I'm not insane.

There isn't anything in this that would cause a helicopter to just hover instead of land. Right?

It seems like it just hovers just after deleting the Loiter WP. This behavior happens regardless of if it is a scripted "Land" WP or even just a Move WP.

It just hovers...menacingly

https://sqfbin.com/uqinomukiquxoyuxefif

open fractal
#

I don't know but is there a reason why you use getposasl with distance instead of just inputting the object

#

Also getPosAGL isn't real @elfin comet

#

the command simply does not exist

elfin comet
open fractal
#

Isn't getting the position just to use in distance redundant?

meager granite
#
Although the event is global, on clients (non-server) and applied to remote vehicles, it will fire only if the vehicle is closer than about 6 km from the camera, otherwise it will fire later as soon as camera and vehicle are close to each other, alongside [[isEngineOn]] state change.

Can a native English speaker proofread this please? Adding a note to "Engine" event handler on wiki.

elfin comet
#

Helps me be able to read it as reference for later projects.

open fractal
#

actually I changed my mind

#

give me one second

meager granite
#
Although the event is global, on clients (non-server) and applied to remote vehicles, it will fire only if the vehicle is closer than about 6 km from the camera. It will fire later than the actual engine state change, as soon as camera and vehicle are close to each other, alongside [[isEngineOn]] flag change.
```tweaked
open fractal
#

Although the event is global, when on (non-server) clients and applied to remote vehicles it will fire only when the vehicle is closer than about 6km from the camera. Otherwise, it will fire alongside the isEngineOn state change as soon as the camera and vehicle are close to each other.

#

I like yours

open fractal
meager granite
#

Thanks

open fractal
#

yw

shadow canopy
#

in the testing i had done they where always the same

open fractal
#

have you tested a gunner in a vehicle?

shadow canopy
#

no, only as infantry shooting as infantry

#

I take it then one will give the gunner and the other the vehicle?

open fractal
#

potentially. I think the "killed" handler differentiates those, I might be wrong

shadow canopy
#

ah it is, source is now the vic, and instigator is the infantry unit in turret. Dang I was kind of hoping this could give me the projectile somehow so I could get impact velocity

open fractal
#

Have you tested the hitpart projectile handler?

meager granite
#

Gonna try to request a command to check if variables reference same array or hashmap, I wonder which command name to suggest? Thinking about:

<Anything> isSameRef <Anything>
```Any thoughts?
pulsar bluff
#

For ghosthawk helicopter door gunner killing a target... Source = ghosthawk, instigator = door gunner

#

The weapon/vehicle, vs who pulled the trigger

smoky rune
#

Is there any way to force mission to load missionProfileNamespace?
I noticed that it's not loaded on the first run of the mission on the cold game start, isMissionProfileNamespaceLoaded returns false. So, any missionProfileNamespace getVariable calls will return nothing making loading previous save impossible.

pulsar bluff
#

I have this at the top of the init

#

I've been told its unnecessary (i guess setVariable also creates the file)

#
if (!isMissionProfileNamespaceLoaded) then {
    saveMissionProfileNamespace;
#

_exists = (missionProfileNamespace getVariable ['QS_var',[]]) isNotEqualTo [];

#

i also have this in description.ext, so it doesnt create a new file each time I change the mission file name (versioning)

#

missionGroup = "ApexFramework";

smoky rune
pulsar bluff
#

hmm, i use it to create the file initially, but I'm not the right guy to answer this question

smoky rune
#

anyway, i will check it
looks like a bug, to be honest - I can get any info from missionProfileNamespace on second and other runs, but cold start of the mission always returns nothing

meager granite
#

Aren't we talking about game start and not mission start so missionProfileNamespaces aren't applicable?

smoky rune
#

I'm trying to read missionProfileNamespace variables on the first run of the mission on the first run of the game in initServer.sqf.

#

basically cold start of the game - start steam, start game, join the lobby etc
when you return to the lobby and try to run mission again without closing the game (return to lobby - start again) - everything works as it should

meager granite
#

Thought you meant at the start of Arma 3 itself

pulsar bluff
#

@smoky rune you could check to see if simply having missionGroup = "whatever'; creates the file

#

or setVariable

smoky rune
#

file is already there

pulsar bluff
#

my guess is setVariable creates the file too

#

it likely checks the "isLoaded" internally

smoky rune
#

I noticed this strange behaviour today - despite having existing file, it simply does not load it on the first run of the mission when game is just started (isMissionProfileNamespaceLoaded returns false)
so I return to lobby and start mission again without leaving the game entirely - it finally notices that file exists and loads data from it (isMissionProfileNamespaceLoaded returns true, getVariable calls returns actual data)

#

I will try to reproduce it in the virtual reality sample mission

unique sundial
smoky rune
#

Yes, I have a .vars file for a mission, game loads it only on second run
Yeah, I'm working on it - If it is reproducable, I will create a ticket in bug tracker with the sample mission attached

meager granite
#

Tried it on a live server, isMissionProfileNamespaceLoaded returns false (as there was no .vars file for the mission), missionProfileNamespace returns valid namespace.

#

All works as it should

#

As soon as you save the mission profile namespace, isMissionProfileNamespaceLoaded starts returning true, including on next join after game restart

meager granite
# unique sundial what is the use case?

The use is to cut down on item by item array comparisons that isEqualTo does, when I simply need to know if a variable now holds a different array (it was remade at some point). Eventually I just redesigned the my code to avoid costly each frame checks on large arrays but having reference comparison would've helped.

meager granite
unique sundial
elfin comet
# elfin comet I just want to make sure I'm not insane. There isn't anything in this that woul...

Even after now double checking to make sure I'm using arguments that exist, I still have no idea what would be causing the helicopter to not land despite using the same script path as the Land WP that comes with the editor. Is there a different way to make a helicopter land at a specific spot? I know about land, but iirc, you can't pass a location to that.

https://sqfbin.com/japocibahehijogohicu

A separate thing that I'm also looking for an answer to is with regards to line 29. I need it to check if either the trigger area (LZarea) is empty or if the helicopter that the group that is referenced as _this in the script is piloting is full. Currently it just immediately completes. Figured I'd try to check if any alive players in the trigger aren't in a vehicle and have it take off when everyone is in. Not quit playing out as I don't think I'm referencing the contents in the trigger correctly.

smoky rune
meager granite
#

Actually, are there any implementation differences between isEqualTo and isNotEqualTo apart from one being negative of another? Doesn't seem so.

meager granite
# unique sundial so basically you need isNotTheSame so to speak

In my use case knowing if an array at a variable was another array, regardless of its contents, was enough. isEqualTo/isNotEqualTo work but they still iterated through arrays if it wasn't same array referenced, which I wanted to avoid to save a bit of each frame performance.

smoky rune
#

this happens in the original mission, still haven't encountered same behaviour in repro mission, but encountered another issue that's seems somehow tied to this

meager granite
#

Did a test to see what happens with mission profile namespace on a fresh game start:

onEachFrame {
    diag_log [diag_frameno, time, getClientState, isMissionProfileNamespaceLoaded, missionProfileNamespace];
};
```results for having no `.vars` file for the mission, `missionProfileNamespace` is there all the time, `isMissionProfileNamespaceLoaded` is `false`

14:11:08 [26545,0,"GAME LOADED",false,Namespace]
14:11:08 [26546,0,"GAME LOADED",false,Namespace]
14:11:08 [26547,0,"BRIEFING SHOWN",false,Namespace]
14:11:08 [26548,0,"BRIEFING READ",false,Namespace]
14:11:08 [26549,0.017,"BRIEFING READ",false,Namespace]
14:11:08 [26550,0.04,"BRIEFING READ",false,Namespace]
14:11:08 [26552,0.073,"BRIEFING READ",false,Namespace]
14:11:08 [26553,0.107,"BRIEFING READ",false,Namespace]
```results when there is .vars file for the mission

14:09:45 [24689,0,"GAME LOADED",false,Namespace]
14:09:45 [24690,0,"GAME LOADED",false,Namespace]
14:09:45 [24691,0,"BRIEFING SHOWN",true,Namespace]
14:09:45 [24692,0,"BRIEFING READ",true,Namespace]
14:09:45 [24693,0.052,"BRIEFING READ",true,Namespace]
14:09:45 [24694,0.102,"BRIEFING READ",true,Namespace]
14:09:45 [24696,0.153,"BRIEFING READ",true,Namespace]
#

Tested on listen server

#

I guess you'll need to wait until getClientStateNumber > 8

smoky rune
#

yas

#

I've successfully reproduced the issue in the isolated environment

smoky rune
meager granite
#
14:18:59 [47419,0,"GAME LOADED",true,Namespace]
14:18:59 [47420,0,"GAME LOADED",true,Namespace]
14:18:59 [47421,0,"BRIEFING SHOWN",true,Namespace]
14:18:59 [47422,0,"BRIEFING READ",true,Namespace]
14:18:59 [47423,0.01,"BRIEFING READ",true,Namespace]
14:18:59 [47424,0.023,"BRIEFING READ",true,Namespace]
14:18:59 [47426,0.036,"BRIEFING READ",true,Namespace]
```on a second mission start
#

Now isMissionProfileNamespaceLoaded is true right away

#

So yeah, isMissionProfileNamespaceLoaded seems to be useless to tell if you can start reading from the namespace, have to check client state number.

#
14:22:14 [62856,0,"GAME LOADED",true,Namespace,321]
14:22:14 [62857,0,"GAME LOADED",true,Namespace,321]
14:22:14 [62858,0,"BRIEFING SHOWN",false,Namespace,<null>]
14:22:14 [62859,0,"BRIEFING SHOWN",false,Namespace,<null>]
```when starting different mission without `.vars` file after one which had it
#

So yeah, getClientStateNumber > 8 is the way to go

#

That 321 is missionProfileNamespace contents from previous mission which turns to nil once actual mission namespace is loaded

smoky rune
#

I noticed another anomalous behaviour (seems to be tied to this issue) - any missionProfileNamespace setVariable call in initServer does nothing, variables can't make it's way into vars file in that case
I will upload repro soon

smoky rune
#

Ok, brb

smoky rune
#

Steps to reproduce issue #1:

  1. Start game.
  2. Start listen server with mission via 3DEN or mpmissions way.
  3. Start mission.
  4. Call call TEST_fnc_saveServer - this will call the saveMissionProfileNamespace and put it's content into systemChat bar;
  5. Close the game entirely.
  6. Do steps 1-3 again.
  7. 1 Expected: isMissionProfileNamespaceLoaded: true, allVariables missionProfileNamespace returns all stored variables
  8. 2 Actual: isMissionProfileNamespaceLoaded: false, allVariables missionProfileNamespacereturns empty array or just callnum, callstring

Steps to reproduce issue #2:

  1. Start game.
  2. Start listen server with mission via 3DEN or mpmissions way.
  3. Start mission.
  4. Call call TEST_fnc_saveServer - this will call the saveMissionProfileNamespace and put it's content into systemChat bar;
  5. 1 Expected: allVariables missionProfileNamespace returns all stored variables - serverID, callnum, callstring, initservernum, initserverstring
  6. 2 Actual: allVariables missionProfileNamespace returns some of the stored variables - callnum, callstring , the ones that were saved via simple call, not initServer one
unique sundial
#

Could you please create a ticket

#

this is going to get lost here

smoky rune
#

Yeah, I'm doing it right now 😉

unique sundial
#

Well, initServer is executed before init.sqf, and missionprofilenamespace is guaranteed to be available in init.sqf there are no other guarantees @smoky rune as of yet

#

'''The missionProfileNamespace variables are loaded at the start of a mission, before 'init.sqf' is executed'''

#

looks a little ambiguous

#

I am looking into possibility to move it earlier

smoky rune
unique sundial
#

if there are no side effects would probably make sense to load it as soon as possible

smoky rune
#

I am looking into possibility to move it earlier
it would be good, so profileNamespace and missionProfileNamespace would work more similar to each other, allowing to simply swap profileNamespace calls with missionProfileNamespace ones

#

atm stable version of my mission uses profileNamespace and it looks like it loads way before initServer

elfin comet
unique sundial
#

@smoky rune ok moving it before initfunctions seems to work fine for both cases

smoky rune
#

Thank you!
I hope that A3 will receive some patch in the coming months so this new solution will be included there 😄

unique sundial
#

Yeah I'm pushing it for hotfix candidate as it is simple enough fix, we should have caught it during dev stage but since it is new feature it doesnt go to profiling and there is a lack of testing on dev

unique sundial
shadow canopy
#

afik

shadow canopy
winter rose
meager granite
#

Seems to be triggering if camera is closed than ~6300 meters or something

#

On Altis

#

Might be different depending on island size? Not sure

winter rose
meager granite
#

Yes

winter rose
#

I can't find any further criticism, carry on :p

proven charm
#

i have this problem with my DLL that it depends on two other DLLs but even they are all in same arma mod folder arma can't find the two other DLLs. any fix for this? (other than putting the two DLLs to arma main folder)

little raptor
#

Why would Arma be able to find them?

#

You said your DLL depends on them

proven charm
#

they are in same folder

little raptor
#

So? Are you exporting the RV functions from those too?

proven charm
#

no they are nuget DLLs

little raptor
#

Then why would Arma be able to find them? blobdoggoshruggoogly

#

You have to load them yourself

proven charm
#

they get loaded if I put them in arma main folder

#

they contain class depencies

little raptor
#

I know, but when you don't put them next to the exe you have to load them yourself

proven charm
#

how?

proven charm
#

ok thx

#

no luck there, have you got this working in c++ @little raptor ?

little raptor
#

Well in C++ you just use LoadLibrary and then GetProcAddress to get the functions you need
But class dependencies like in C# are probably not solvable like that

proven charm
#

true

little raptor
#

Can you just release a self contained lib?

proven charm
#

what's that? thonk

little raptor
#

Something that has all dependencies in itself thonk

proven charm
#

right

proven charm
#

I think that maybe for exes only

little raptor
proven charm
#

have to try that one

little raptor
dreamy kestrel
#

Q: re: lineIntersects and variations... if we're talking about two units, I gather I would want to invoke lineIntersectsSurfaces and lineIntersectsObjs. For positions, using eyePos for either unit, literally until one sees the whites in the other's eyes.

What are the two objects to ignore? For now I am assuming that is the units involved in the LOS determination, at least based on one example. Although in another example, that is objNull, so I'm not really sure the intent there, and naming them ignoreObj is not especially descriptive.

https://community.bistudio.com/wiki/lineIntersectsSurfaces#Examples
https://community.bistudio.com/wiki/lineIntersectsObjs#Examples

Thank you...

little raptor
#

so no object is ignored

dreamy kestrel
#

so to clarify, yes, I gather objNull has the expected outcome; would potentially include either or both units, yes?
so it seems like the best practice there is to exclude both units, passing them as args.

granite sky
#

There are plenty of *Intersects* uses that are not LoS checks.

dreamy kestrel
little raptor
dreamy kestrel
#

Could I get some clarification what this means. Would the objects include ambient life for instance? i.e. missing a LOS because he got a bug in his eye or such...

1 - CF_ONLY_WATER
2 - CF_NEAREST_CONTACT
4 - CF_ONLY_STATIC
8 - CF_ONLY_DYNAMIC
16 - CF_FIRST_CONTACT
32 - CF_ALL_OBJECTS (Usable only with CF_FIRST_CONTACT and it will check one contact per object)

Basically if there is some structure, building, wall, container, whatever, another unit, blocking... that's what I want in the results.

little raptor
#

idk what lineIntersectsObjs checks, but I assume it's VIEW

#

and no, ambient animals have no VIEW LOD afaik

#

(also bugs are not animals)

dreamy kestrel
#

IDK what that means "view" vis-a-vis the flags options... Ah I 🙈 ... just curious, since it mentions 'static' versus 'dynamic'. But I guess we're talking about things like spill bunds or what have you being static, one example.

little raptor
dreamy kestrel
little raptor
#

it's the most complete command among all intersect commands

dreamy kestrel
#

sounds good. thanks for the info, sir.

manic sigil
#

Alright, I give.

I have a function that's causing me a lot of grief.

Server executes a priming function that creates this trigger, server side only:

MikeCrewTrg = createTrigger ["EmptyDetector", [16298,8205,0], true]; 

MikeCrewTrg setTriggerArea [7,7,0,false,3]; 

MikeCrewTrg setTriggerActivation ["ANYPLAYER","PRESENT",true]; 

MikeCrewTrg setTriggerStatements ["this","[list MikeCrewTrg,""MIKE""] call SRD_fnc_spawnCrew",""]; 

I know that part works, and has worked in the recent past.

SRD_fnc_spawnCrew is where the screwyness begins.

Params ["_vehicleInZone","_whereParked"]; 

private _vehicleInZone = _vehicleInZone#0; 

If (_vehicleInZone iskindOf "Man") exitWith {};  
 
{removeAllWeapons _x; moveOut _x; deleteVehicle _x} foreach (crew _vehicleInZone select {!isPlayer _x AND !Alive _x}); 
 
[_vehicleInZone] remoteExec ["createVehicleCrew",driver _vehicleInZone];  
 
{   
 _x setDamage 0; 
 _x setUnconscious false;  
 _x setVariable ["srd_downed", false, true];  
 _x setCaptive false; 
 _x setSkill 1; 
 _x allowDammage true; 
 [_x] call srd_fnc_AIRevival; 
} foreach crew _vehicleInZone; 

systemChat "SpawnCrew Engaged!"; 

The crew is created now, but none of the followon actions are obeyed, unless I manually call the function locally.

I know _whereParked is unused, it was for a prior implementation that I ended up ditching but may revisit.

granite sky
#

timing

manic sigil
#

Think it needs a sleep?

granite sky
#

The remoteExec runs well after the following code.

#

You can't sleep. It's unscheduled.

manic sigil
#

Well, yeah, I'd have to change it to Spawned instead of Called, but that's a minor detail.

granite sky
#

You could change that function to remoteExec from the trigger where the driver is local.

little raptor
granite sky
#

And then you don't need to remoteExec the createVehicleCrew.

#

Probably still need a short sleep after the delete spam though

#

deleteVehicle doesn't happen instantly, IIRC.

manic sigil
#

Weirdly, that works fine; dead bodies are immediately replaced, at least in testing so far.

granite sky
#

That's because remoteExec is delayed.

manic sigil
#

I tinkered with changing to a remoteExec, but couldn't get the reference quite right. Would something like ["spawn",thisList] be the idea?

granite sky
#

The spawnCrew function itself should take a vehicle as a parameter, and then you'll know the locality when you call it.

#

you'll need a bit more code in the trigger statement but it'll make more sense :P

manic sigil
#

Ah, that seems to have worked it out 🙂

Funny, it worked fine-ish until today. Bluh.

winter rose
proven charm
#

MSBuild.ILMerge.Task (nuget) in case some one needs it

drifting portal
#

is there a way to know that a terrain building was damaged by a player?

drifting portal
#

how would I use to know that a player did damage the building and not an AI?

little raptor
#

when they fire add an Explode event handler to the projectiles

#

or Hit

#

(or was it hitPart? thonk )

#

to detected what they hit

#

if the building changes afterwards they destroyed it

drifting portal
#

I would assume hitpart needs to be added to every terrain building

little raptor
drifting portal
#

got a bit confused lol

#

let me check the new EHs then

#

so I'm not really sure about the behaviour of the new EHs

#

if they fire frag munitions, hitpart will still trigger once right?

little raptor
#

can you even destroy a building with frag grenades? thonk

drifting portal
#

Tank FRAG rounds

little raptor
#

yeah there's an EH for that SubmunitionCreated

drifting portal
#

alright so now a player fires a projectile at a building
and I have hitpart on their projectile and buildingchanged EH in the mission,
So in order to coordinate the detection of a building being turned into a ruin, do I need to spawn a variable or something with a sleep interval so that buildingChanged can catch the fact the its the player who fired?

little raptor
#

it most likely will be destroyed in the same frame

drifting portal
#

oh alright

little raptor
#

I guess projectile EH triggers first

#

then buildingChanged

#

so you can simply check time when it was hit vs time when it was destroyed

drifting portal
#

and how much should be the duration for the check?

little raptor
#

0

#

should be equal

drifting portal
#

alright

little raptor
#

(if it's destroyed in the same frame)

drifting portal
#

yeah that has to be tested by me

#

buildingchanged needs to be added to each client to make this work right?

little raptor
#

yes

#

tho not sure what to do about the projectile thonk

#

projectiles are local

drifting portal
#

yeah that's why I brought the need to add buildingchanged to every player locally

#

I don't think its a good idea to have projectiles checked by the server

little raptor
#

what does it have to do with the projectile?

drifting portal
#

since projectile is calculated locally on the instigator, I would assume buildingchanged needs to be local to the instigator, so the whole system needs to be local in short

#

well now we come to another situation, lol
if two players fire at the same building, it might be counted as destroyed twice?

#

we can set a variable on the buildings itself to check if someone destroyed it earlier than the other in the short time frame, but to make that variable public, I would assume it would have a delay

little raptor
granite sky
#

buildingChanged always fires on the server, I think.

#

Not sure how reliable it is anywhere else.

little raptor
#

when a building is destroyed report it to the server

little raptor
winter rose
#

no "HandleDamage" on buildings?

drifting portal
#

yeah but say two player fire, we might face a situation where it duplicates the building being destroyed twice?

little raptor
#

plus it won't work anyway

#

due to streaming

granite sky
#

oh, you're trying to figure out who destroyed the building :P

little raptor
#

the server is handling the kills

drifting portal
#

I have a 15 buildings destroyed limit, so if they both fire won't that be 2/15?

little raptor
#

if someone already took the kill it won't register it twice

little raptor
drifting portal
#

hmm, so I do already have a buildingChanged on the server, do I need to add it to the client?

little raptor
#

wat? those EHs are on the client

#

kill records are on the server

#

client kills and reports it to the server

#

server registers

drifting portal
#

so who should handle buildingChanged?

#

clients or server?

little raptor
#

client

#

you just do a remoteExec to tell the server

#
[getObjectID _building, _killer] remoteExecCall ["My_fnc_buildingDest", 2]
#

and that function has a hashmap of all destroyed IDs

#
params ["_buildingID", "_killer"];
if (_buildingID in alreadyDestroyed) exitWith {"don't count it twice"};
alreadyDestroyed set [_buildingID, _killer];
[_kiiler, -100] call my_fnc_addRating;
drifting portal
#

well Its only 15 buildings max (and then the mission fails) so is it possible to use setVariable to simplify everything?

little raptor
#

on what?

drifting portal
#
_building setvariable ["BuildingIsDestroyed", true ,true];

which we can use to check if the variable is true or undefined on the building object, and then decide whether to add it as a causality or not

little raptor
#

so you'd rather broadcast something to everyone instead of handling it in one place...?

#

which btw by the time the message gets there it's too late

#

also as I said already, terrain objects are streamed

drifting portal
#

setVariable on the server then?

#

or same problem?

little raptor
#

the game keeps "deleting" them and then "recreates" them (they're not actually deleted tho)

#

so your vars will be lost

drifting portal
#

oh alright

#

So to recap:

-BuildingChanged EH added on every client
-FiredMan EH added on every client, which adds hitpart to every projectile the player fires, it stores time as a variable to do the following check
-BuildingChanged checks if isRuin is true when the time the hitpart activated on client is equal to time the building changed at.
-Check if building object id is in the destroyed buildings hashmap then
-Increment a public variable in the BuildingChanged script to notify all the players afterwards about the number of destroyed buildings.
little raptor
#

-Check if building object id is in the destroyed buildings hashmap then
that is server's job

#

-Increment a public variable in the BuildingChanged script to notify all the players afterwards about the number of destroyed buildings.
no. server does that

drifting portal
#

so to last steps handled on the server, got it

#

one last thing, hitpart for both explosive/non-explosive projectiles

#

right?

little raptor
#

afaik yes

#

but not grenades

drifting portal
#

because of fragmentation or?

little raptor
#

because they don't "hit" something

#

they just explode with timer

drifting portal
#

best way to check if something is a grenade through config?

little raptor
#

simulation

drifting portal
#

Alright thanks a lot

little raptor
#

might be better

boreal parcel
#

hey could anyone help me out with this? I am trying to convert a halo jump script to be able to be used on a dedicated server.

The following doesnt work in the init of the server
ghst_halo = this addAction ["<t color='#00ffff'>Solo Halo</t> ", "scripts\ghst_halo.sqf", [false,600,70], 5, true, true, "","alive _target"];
So I am converting it to remoteExec
ghst_halo = this addAction ["<t color='#00ffff'>Halo</t>", {[[[false,4000,70], 5, true, true, "","alive _target"],"scripts\ghst_halo.sqf"] remoteExec ["execVM",2]}];
However now the selection variables have changed and I am slightly confused, it asks for these

_host = _this select 0;
_caller = _this select 1; // 6
_id = _this select 2;
_params = _this select 3;
_typehalo = _params select 0;//true for all group, false for player only.
_althalo = _params select 1;//altitude of halo jump
_altchute = _params select 2;//altitude for autochute deployment

However when changing to remote exec, the _params it is looking for become arg 0 instead of 3, im not sure what the host/caller/id is or how its gotten.

Am I setting up this remoteExec wrong? should I be throwing the entire addaction into the remote exec rather than the remoteExec into the addaction or something like that?

little raptor
#

Am I setting up this remoteExec wrong?
yes. the original script ~~had no parameters. ~~ used the action parameters

you can't just randomly remoteExec a script. it depends what it does

boreal parcel
#

hmm, alright makes sense, so the params in the first addaction after the [false, 600, 70] are for the addaction not the script?

#

I guess the _id is the addactions return value

little raptor
#

?

#

action arguments are _this

#

[_this, "scripts\ghst_halo.sqf"] remoteExec ["execVM",2]

#

but again you shouldn't randomly remoteExec things

#

you should read the script and figure out what part is not working

boreal parcel
#

ah, I should pastebin that sorry

boreal parcel
little raptor
boreal parcel
little raptor
boreal parcel
#

the systemChat?

little raptor
#

and this line

[_caller] spawn bis_fnc_halo;
little raptor
#

the systemChat one should be local anyway

little raptor
#

sounds like that function is from A2?

boreal parcel
boreal parcel
little raptor
#

yes you just throw the player in the air 🤣

boreal parcel
#

ah, with setPosASL?

little raptor
#

yes

boreal parcel
#

it doesnt output any systemChat either

little raptor
#

like I said don't remoteExec it

boreal parcel
#

im not, I am running this addaction
ghst_halo = this addAction ["<t color='#00ffff'>Solo Halo</t> ", "scripts\ghst_halo.sqf", [false,600,70], 5, true, true, "","alive _target"];

little raptor
#

added where?

boreal parcel
#

in the init of a laptop object

little raptor
#

the action appears fine?

boreal parcel
#

yep. pops up teal colored

little raptor
#

but no hint or anything when you activate the action?

boreal parcel
#

nope, no hint, no system message

#

nothing logged in the rpt either

little raptor
#

there's nothing wrong with the script itself

#

do you have a debug console?