#arma3_scripting

1 messages · Page 117 of 1

spiral narwhal
#

I've tried making something like that, to call the desired altis life function but am always getting a "missing ;" error

warm hedge
#

Well

spiral narwhal
#

im going to seek help in the altis life forums, maybe they had this problem before

warm hedge
#

Without checking your code there is nothing we can say other than "fix it yourself"

spiral narwhal
#

this addAction[format ["%1 ($%2)",localize (getText(missionConfigFile >> "Licenses" >> "rebel" >> "displayName")), [(getNumber(missionConfigFile >> "Licenses" >> "rebel" >> "price"))] call life_fnc_numberText],life_fnc_buyLicense,"rebel",0,false,false,"",' !license_civ_rebel && playerSide isEqualTo civilian ',5];

#

now i gathered that life_fnc_buyLicense is the function, and rebel (or whatever would be in that spot) is the desired variable

#

the conditions at the end i have already replicated in my script

#

i've tried a bunch of things like [rebel] call life_fnc_buyLicense; etc and always get that missing error

warm hedge
#

What exactly is your error?

#

What and which, and how it throws missing semicolon?

spiral narwhal
#

missing ; on line X

warm hedge
#

Let me rephrase: elaborate and tell us every text what the error said

meager granite
#

Post entire error message

spiral narwhal
#

so i've done some tweaking and made some progress 😄 still have errors though smiledoge

#

at least now i have called my desired function

meager granite
#

addAction sends lots of data into the function, not just "rebel"

#

And that is a string being sent, not a variable

#

addAction argument parameter gets sent into the function as _this select 3 along other addAction related stuff

#

So if you want to emulate call to life_fnc_buyLicense as if it was done from addAction, you'll need to do something like:

[player, player, -1, "rebel"] call life_fnc_buyLicense;
marsh moat
#

Can someone help me try to figure out what this error is? The script works regardless of this error. Just it pops up every time I activate it and is kinda annoying.

call{this addAction ["Reset Targets",
{
{
_x animate ["terc", 0];
} forEach shootingTargets6; titleText ["Sniper Course Has Been Reset","PLAIN", 0.5];
playSound "FD_Finish_F" }]};

Error Undefined Variable in expression: _x

I have 7 other scripts set up exactly like this. The ONLY difference is "forEach shootingTargets<number>" and "["<station> Has Been Reset...]" otherwise everything is set up identically. The trigger this runs out of has the exact same call for everything (different variable names for all the targets as well) . All others work perfectly fine without this pop up.

warm hedge
#

What is shootingTargets6?

marsh moat
#

I just shut my computer off for the night. However I will get that tomorrow after I get off work.

warm hedge
#

Glad you can still decide you want to go bed

pulsar bluff
#

is there a set descent velocity for parachutes

#

not the steerable ones

little raptor
#

setVelocity doesn't work on them?

meager granite
#

Speaking of parachute, I was wondering if we could get a command to force parachute to fold as if it landed? Engine logic for it far from ideal, why no let mods\script correct it?

pulsar bluff
#

with wind it becomes a challenge

little raptor
#

use setVelocityTransformation

pulsar bluff
#

IE, drop a crate in front of a player no sooner than 10 seconds after the para is created

#

so 10 second flight time, calc the in-air spawn pos

#

given wind and a ??? descent rate

little raptor
pulsar bluff
#

haha

little raptor
#

assuming wind doesn't change, you can use an equation to caculate the descent rate (which is roughly constant) so calculating the position will be easy

#
_velocity = wind vectorMultiply 0.5 vectorAdd [0,0,-2];
_spawnPos = _targetPos vectorDiff (_velocity vectorMultiply 10);
#

and then you can just move the chute every frame:

_chute setVelocityTransformation [
  _spawnPos,
  _targetPos,
  _velocity,
  _velocity,
  [0,1,0],
  [0,1,0],
  [0,0,1],
  [0,0,1],
  (time - _startTime) / 10
];
pulsar bluff
#

❤️

hallow mortar
# little raptor setVelocity doesn't work on them?

I think the question was not is there a "set descent velocity" [command] but is there a [descent velocity that has been set].

Can't check to see if it's specified in config right now, but I've got a feeling that parachutes have actual flight models and so it's controlled by that, same as a plane's glide behaviour

upper remnant
#

I have a beginner question that I can't quite figure out, I have a script using some ace functions

            [1,[], {hint "Dismantled"}, {hint "Failed!"}, "Dismantling"] call ace_common_fnc_progressBar;
        },{true},{}] call ace_interact_menu_fnc_createAction;

["land_stakes", 0, ["ACE_MainActions"], clearObstacle] call ace_interact_menu_fnc_addActionToClass;```
but for the life of  me I can't figure out how to reference the object it's activated on? (if that makes sense) where I have hint "Dismantled", I wanted to use deleteVehicle this. It works when I don't use ace_common_fnc_progressbar, so I assume it's something to do with it being nested?
#

I tried forEach but that didn't work

little raptor
#

see this

dim elk
#

So, I'm trying to make a squad like rally point system for my group. I just can't figure out how to get it done. I want it to be done via ace self interact. The player must be a group leader and each time one is placed the old one is replace. Having an issue creating an actual function. I'm quite unfamiliar with c++ but have good knowledge of java so some things make sense and some don't at all.

https://paste.ofcode.org/3933z3rxrZi52zK7gikWFmS
It is 2 seperate files as seen by the comment in the code

#

Paste from config_makers, just don't know where exactly to put this

little raptor
#

that's not C++

dim elk
#

thought arma was c++

little raptor
#

no

dim elk
#

Oh my bad

#

regardless, still got an issue of how to structure it all

little raptor
dim elk
#

Done

hallow mortar
#

The internal language for the game engine is some kind of C flavour, but the languages we use are Arma config (aesthetically C++ like but not actually) and SQF, a proprietary intermediary language specifically for Arma scripting

little raptor
#

anyway you don't really need a config for this. are you trying to make a mod for all missions?

upper remnant
dim elk
#

Yeah, I want it as a pbo just so it doesn't need to set up for every new mission

#

All I'll want to do is just have to set up the actual teleport to the object in game, but the whole mechanism to put the rally down I wanna do through a standalone mod

little raptor
#

to make a function you should use CfgFunctions

#

something like this:

class CfgFunctions
{
  class DSQN
  {
    class Category
    {
      file = "DSQN_RallyPoint\functions";
      class spawnRallyPoint {};
    };
  };
};
#

then put fn_spawnRallyPoint.sqf in a folder called functions inside your mod folder

#

the function name will be: DSQN_fnc_spawnRallyPoint so in the action statement you should use "[_player] call DSQN_fnc_spawnRallyPoint";

dim elk
#

I see, jesus its so much easier figuring it out with someone who understands it lol

#

I'll give it a test there now so.

dim elk
#

I just couldn't figure out CfgFunctions, since it just sends me to the library

#

Ah, creating an addon.

#

How come file doesn't actually specify which fnc file its calling?

hallow mortar
#

Given the right folder/class structure, the game will automatically detect function files with matching names

little raptor
#

it's set automatically if you use that structure

dim elk
#

Oh that's cool, so the prefix im assuming i'd change to fnc instead of fn?

#

for the file ^

little raptor
#

you could also do it like this:

class CfgFunctions
{
  class DSQN
  {
    class Category
    {
      class spawnRallyPoint {
        file = "DSQN_RallyPoint\functions\fn_spawnRallyPoint.sqf";
      };
    };
  };
};
hallow mortar
#

No, the file must be prefixed with fn_ for detection

dim elk
#

I see. Does the Category class HAVE to be category. Sorry for the questions, just want to make sure I kinda understand it

little raptor
#

no

#

you can change it to whatever you want

#

it doesn't really make a difference

dim elk
#

So it's just, there?

little raptor
#

yeah. it allows you to structure your functions

dim elk
#

Gotcha

#

Alright, gonna go off and try to use it

hallow mortar
#

If you don't specify a folder with the file = "..."; property, then the category name is used for automatically determining the file path. Otherwise it's just for tidiness

dim elk
#

Suppose its a good habit to get into keeping things organised

upper remnant
#
        {
        params ["_obj"];
        [25, _obj, 
        {
            params ["_obj"]; 
            deleteVehicle _obj; 

        }, {hint "Failed!"}, "Dismantling"] call ace_common_fnc_progressBar;
        },{true},{}] call ace_interact_menu_fnc_createAction;

["hedgeHog", 0, ["ACE_MainActions"], clearObstacleHedgehog] call ace_interact_menu_fnc_addActionToClass;```
last beginner question (hopefully) for now, if instead of wanting to do just individual class names, can I use "hedge" in str _obj where "hedgeHog" is?
little raptor
#

no

#

there is no _obj there as far as I see

#

and even if there was, it should be typeOf _obj not str

#

but perhaps you should explain in more detail what you're trying to do

upper remnant
#

sorry I copy and pasted all of it, then removed the context to it accidentally

hallow mortar
#

The ACE function itself is already doing a typeOf check against the string classname you provide. You can't make a custom condition code, that function only goes by classname

#

You could make some config lookup code to make a list of classes with "hedge" in them (note this may also catch foliage hedges), and then do the ACE function for each of those classes

upper remnant
#

that's ok, I was just trying to be a little bit more efficient but I can see now it's only by classname

#

cos there's like 4-5 hedgehogs, instead of having the same element 4-5 times to enable all types to be cleared

#

thank you for the help.

dim elk
#

    if(isNil {Misc_Backpackheap getVariable "RALLYPOINT1"}) then
    {
        RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
    }else{
        deleteVehicle RALLYPOINT1;
    sleep 3;
    RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
    }

So I'm trying to make my fn_spawnRallyPoint to check if the object already exists, and depending on that it'd either do one or the other. Found this on the forums saying it could help do that for me, but when I run it nothing happens.

#

My understanding is that the if condition is checking if Misc_Backpackheap object by variable name RALLYPOINT1 exists

#

I do have a hint statement just before the first line so i know it is in fact calling the function

#

also I am testing this on local host server to check if it works on MP

little raptor
dim elk
#

Ok so I'd need to also set a varname when spawning the object in I suppose

#

    if(isNil {Misc_Backpackheap getVariable "RALLYPOINT1"}) then
    {
        ADDED A HINT1 HERE
        RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
    }else{
        deleteVehicle RALLYPOINT1;
    sleep 3;
    RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
    }

I also added a hint here, it shows as activating, but nothing spawns

little raptor
#

your code makes zero sense to me

dim elk
#

Fair enough

#

I just searched on wiki for 'how to check if object already exists'

#

Only result I found

#

Essentially I want the function, on activation, to check if the object already exists, if it does not, then it will create it, if it does exist it will delete the one placed previously and create a new one. This would be all done on the group leaders location

little raptor
#

what type of object is it?

dim elk
#

its from cup, just a pile of military style backpacks

little raptor
#

you sure the class name is correct?

dim elk
#

Yes

#

Double checked aswell

#

Could it have anything to do with the fact I'm testing on a local host server?

little raptor
#
if (isNull (missionNamespace getVariable ["DSQN_backpackHeap", objNull])) then
{
  DSQN_backpackHeap = "Misc_Backpackheap" createVehicle [0,0,0];
};
DSQN_backpackHeap setPosATL getPosATL player;
#

you don't need to delete the object every time

#

just move it

dim elk
#

You, my friend, are amazing

#

So now DSQN_backpackheap is just a class in the function itself or is that the varname too?

little raptor
#

it's just a global var

dim elk
#

Yeah gotcha, my intent is now when this is activated is to also set down the same object on a "respawn_west" marker and then make it a teleporter. So I can just call for this one specifically as DSQN_backpackheap

#

?

#

But with this I should be able to figure it out

#

But again, thanks for taking time to help me out

#

With what I could try figure out myself I wouldn't have gotten this

little raptor
dim elk
#

Well this mod will be for the unit I'm in, the way we set up our respawns in the mission is just on a respawn_west marker at our 'base'. So my intent is that when a TL or whoever places a rally down near the AO that one also spawns back at the main base, I'll add an addaction to the one at base to allow a TP to the one placed in the AO. The way our medical is set up, with serious injury you can fully die quite quickly. So this will force TLs to place a rally down and I, as zeus, won't have to TP people, nor will aviation have to take years to fly people back and forth

#

I understand I could just do a lot of this work on the mission file itself, but with mission files changing so often it'd be easier for me to just make it on a pbo where I don't have to worry about it

sullen trellis
#

_pos = [player, 100, 1000, 2, 0, 0, 0, [[markerPos "blacklist", 250, 500, 45, false]], []] call BIS_fnc_findSafePos; trying to add blacklist marker area but doesnt seem to work

onyx island
#

Guys, I have a question, I'm looking on the wiki for the argument and effect of BIS_fnc_spawnGroup but it's not documented. Is this because there is a pattern in all the BIS_fnc_ functions that I'm not aware of as I'm a newbie, or have they just not documented them?

warm hedge
onyx island
warm hedge
#

BIS_fnc_spawnGroup should be GE

onyx island
warm hedge
#

No

onyx island
#

ok, ty

dim elk
#
private _timeUntilSpawnActive = [180, true] call BIS_fnc_countdown;
        while(_timeUntilSpawnActive < 1) do{
            [DSQN_backpackHeap_Main,["Move to Rally Point",{_this setPosATL "DSQN_backpackHeap"}]] remoteExec ["addAction",0,true];
            private _timeUntilRPDespawn = [600, true] call BIS_fnc_countdown;
                while(_timeUntilRPDespawn < 1) do{
                    deleteVehicle DSQN_backpackHeap; deleteVehicle DSQN_backpackHeap_Main;
        };
    };

Anyone competent able to help me out with how I can set a timer properly here

#

Tried using the BIS_fnc_coundown

#

But not sure how to structure it correcty

#

Giving me an error Type bool, expected code

winter rose
#

your code will never exit this while

#

so: the current error is while (), it's while {}, but
_timeUntilSpawnActive never changes, so the action will be added indefinitely, multiple times per second

dim elk
#

so it count downs to 0, then just constantly repeats the first while loop?

#

meaning the 600 timer keeps getting reset?

winter rose
#

the _timeUntilSpawnActive is never changed in this code, it will not "countdown" by itself

dim elk
#

So how would I go about getting it to count down. The wiki page for it isn't really helping me out

#

So i need to call it?

#

And in that case, if the timer does go to 0 for _timeUntilSpawnActive, would I be better of using an if statement?

tough abyss
#

Hello all! )
Where can I go to create a role system with premade weapons selection on a server? A bit like the Bad Company server, when you Can only use and see in the arsenal the weapons that are for your role

winter rose
dim elk
#

spawns in 2 objects*

#

The objects spawn in fine, just the addaction and deleting bits aren't working for me

dim elk
#

i tried to have 2 of them but it gave me errors

winter rose
#

ok

stable dune
dim elk
#

i didnt have them seperated in loops

#

i had a sleep, then some code, then sleep again

stable dune
#

What error do you get?

dim elk
#

ill set it up again and show you, give me 2

dim elk
# stable dune What error do you get?
|#|sleep 600;

deleteVehicle DSQN_backpackH...'
Error Suspending not allowed in this context
if (isNull (missionNamespa...'
Error Suspending not allowed in this context
File DSQN_RallyPoint\fnc\fn_spawnRallyPoint.sqf..., line 23

Then the code is:

// Spawns RP at Group Leader

    if (isNull (missionNamespace getVariable ["DSQN_backpackHeap", objNull])) then
    {
  DSQN_backpackHeap = "Misc_Backpackheap" createVehicle [0,0,0];
    };
    DSQN_backpackHeap setPosATL getPosATL player;
    
    sleep 180;

    // Spawns RP at respawn_west marker A.K.A. BLUFOR Spawn

    if (isNull (missionNamespace getVariable ["DSQN_backpackHeap_Main", objNull])) then
    {
  DSQN_backpackHeap_Main = "Misc_Backpackheap" createVehicle [0,0,0];
    };
    DSQN_backpackHeap_Main setPosATL getmarkerpos "respawn_west";

    // Set up the AddAction and the deletion of bags after 10mins

    [DSQN_backpackHeap_Main,["Move to Rally Point",{_this setPosATL "DSQN_backpackHeap"}]] remoteExec ["addAction",0,true];

    sleep 600;

    deleteVehicle DSQN_backpackHeap;
    deleteVehicle DSQN_backpackHeap_Main;

Line 23 is sleep 600

stable dune
dim elk
#

Well, time to learn that now

#

any tips appreciated

manic kettle
dim elk
#

Yeah I got it now

#

cheers

exotic flax
spiral narwhal
tough abyss
tough abyss
#

Tho, even if I respawn them with custom loadouts they'll still be able to change theur weapon in the arsenal 😦

dim elk
tough abyss
# dim elk So you want people to have a loadout glued to them

I want to have roles (grenadier, launcher specialist...) on the server which ensure that as soon as you connect and arrive on the Map, the only weapons available in the arsenal are those that correspond to your role, and prevent you from recovering weapons of other classes if they are left on the ground for example

dim elk
#

It'll take a while

tough abyss
dim elk
#

but you'd have to assign variable names to each guy ingame. Then blacklist certain items for each variable name

tough abyss
tough abyss
dim elk
#

Indeed

tough abyss
#

Thx for the information tho 🙏

winter rose
#

it would also not work per client, but per mission

queen junco
#

Hey, quick question: I am trying to limit a vehicles magazine ammo. After a lot of googleing I figured you cant custom cap a magazine. So I tried with an eventhandler to reset ammo whenever fired and it is above the amount I want to cap (50). I am currently trying it out in editor therfore I am using "this" in the vehicles init. I am not sure why but the hint does not fire. I tried the ammo command on its own, and it works just fine. Any idea what I did wrong?

this addEventHandler ["Fired", {if (this ammo "LIB_2xMG151_FW190" > 50) then {hint "More than 50"} else {hint "Less than 50"}}];
dim elk
# queen junco Hey, quick question: I am trying to limit a vehicles magazine ammo. After a lot ...
class CfgVehicles {
    class MyVehicleClass {
        // ... other vehicle properties ...

        class TransportMagazines {
            // Define the magazines the vehicle carries
            class MyLimitedMagazine {
                magazine = "YourMagazineClass"; // Replace with the actual magazine class
                count = 30; // Replace with your desired magazine capacity
            };

            // Add more magazines if needed
            // class AnotherMagazine {
            //     magazine = "AnotherMagazineClass";
            //     count = 20;
            // };
        };
    };
};

?

hallow mortar
hallow mortar
hallow mortar
queen junco
#

thanks

unreal scroll
#

I want to make a missile strike, but since I have only a V2 missile model (it is not configured to be used as a projectile), I use an B_MBT_01_arty_F SPH to fire at target, then attach the V2 missile vehicle and rotate it accordingly. It works well on local server, but if the carrier projectile spawned on a dedicated server, clients can't see neither projectile or missile, like the latter inherits some projectile settings - because if I spawn the missile on the dedicated server normally, it shows fine.
Is there a way to show the attached missile for players?

opal zephyr
#

Have you modded in the v2 missile model? And if so, is there a reason you dont just make it a projectile

unreal scroll
#

No, I didn't. I'm not so good with configs.
And I have a doubt the projectile could be visible for clients at all. At least all projectile models for artillery which I use are not shown if spawned on dedicated.

opal zephyr
#

what commands are you using? attachTo and setdirandup?

unreal scroll
#
_missile attachTo [_projectile,[0,-5,0]];
[_missile, [-90,0,0]] call OT_fnc_pitchbank;
OT_fnc_pitchbank = {
private ["_dirXTemp","_upXTemp"];
params ["_object","_rotations"];
_rotations params ["_aroundX","_aroundY"];
private _aroundZ = (360 - (_rotations select 2)) - 360;
private _dirX = 0;
private _dirY = 1;
private _dirZ = 0;
private _upX = 0;
private _upY = 0;
private _upZ = 1;
if (_aroundX != 0) then {
    _dirY = cos _aroundX;
    _dirZ = sin _aroundX;
    _upY = -sin _aroundX;
    _upZ = cos _aroundX;
};
if (_aroundY != 0) then {
    _dirX = _dirZ * sin _aroundY;
    _dirZ = _dirZ * cos _aroundY;
    _upX = _upZ * sin _aroundY;
    _upZ = _upZ * cos _aroundY;
};
if (_aroundZ != 0) then {
    _dirXTemp = _dirX;
    _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
    _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
    _upXTemp = _upX;
    _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
    _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
};
private _dir = [_dirX,_dirY,_dirZ];
private _up = [_upX,_upY,_upZ];
_object setVectorDirAndUp [_dir,_up];
};
#

Maybe to create projectiles local to clients, and add a local copy of V2 model?

opal zephyr
#

Have you check to make sure _projectile is valid when you attach it? Also where are those first 2 lines of code executing from

meager granite
#

remote Fired doesn't always have a projectile in there, I don't remember all details but it depends on projectile simulation

#

if its bullets it has fake local projectiles, if its missle it shold be global

#

Basically log your projectile to see what's going on

#

Its probably fake remote projectile, so attachTo doesn't broadcast because it attaches to a local entity

unreal scroll
#

Have you check to make sure _projectile is valid when you attach it? Also where are those first 2 lines of code executing from
I checked all the steps, and I sure all working fine because all projectile end effects work, also I checked the missile body - it is attached to the projectile and moves with it. The first two lines are in the Fired EH.

Its probably fake remote projectile, so attachTo doesn't broadcast because it is attached to a local entity
If I'd take, say, ETA - 10 time, and create a local copies of the projectile just te be shown on clients - can it help?

meager granite
#

createSimpleObject with local flag and attach it on Fired EH

#

There are lots of nuances about Fired EH, locality and such

#

For example it won't fire at all for some types of shots if your camera is too far away from the shooter on non-server clients

unreal scroll
#

Try having local V2 model attached to projectiles on each client
Hm... Thanks, I'll try.

split scarab
#

What am I doing wrong here? I want to punish Blufor by freezing them in place for 2 minutes if they kill a civilian

addMissionEventHandler ["EntityKilled", {
    params ["_killed", "_killer", "_instigator"];
    
    [_killer, _killed] spawn {
        params ["_killer", "_killed"];
        
        if (!(_killed isKindOf "Animal") && side group _killer == blufor && side group _killed == civilian) exitWith {
            _killer globalChat format ["PENALTY! %1 killed a civilian and have been frozen for 2 minutes.", name _killer];
            _killer enableSimulation false;
            sleep 120;
            _killer enableSimulation true;
        };
    };
}];
meager granite
#

Also do your kind of and side checks before spawn'ing a thread

#

this EH spams threads for every single little thing killed in the game

fleet sand
#

Question how do you add custom limited arsenal with custom addaction.
I tryied it like this but it dosent work:

private _pos = player modelToWorld [0,1,0];
private _box = createVehicle ["B_supplyCrate_F",_pos,[],0,"None"];
_box setObjectTexture [0, "#(rgb,8,8,3)color(0,0,0,1)"];
_box addAction ["Open NATO Arsenal",{
    params ["_target","_caller","_id","_args"];

    private _bArray = _args # 0;
    private _iArray = _args # 1;
    private _mArray = _args # 2;
    private _wArray = _args # 3;

    [_target, _bArray, true, false] call BIS_fnc_addVirtualBackpackCargo;
    [_target, _iArray, true, false] call BIS_fnc_addVirtualItemCargo;
    [_target, _mArray, true, false] call BIS_fnc_addVirtualMagazineCargo;
    [_target, _wArray, true, false] call BIS_fnc_addVirtualWeaponCargo;
    ["Open", false] call BIS_fnc_arsenal; 
    

},[_backpackArray,_itemArray,_magazineArray,_weaponArray]];

It only opens empty arsenal. And yea i have arrays filled it would be to big to paste here.

meager granite
#

enableSimulation is local, do a remoteExec or something, kinda bad approach for punishment either way

split scarab
#

Any way to instantly respawn someone? I have a 2 minute respawn timer set, but at the end of the game I'd like to respawn everyone who is dead so I can reveal something on the map

opal zephyr
#

setRespawnTime is a command, I find it kind of janky though

tulip ridge
hallow mortar
fleet sand
spiral narwhal
#

can someone help me understand exitWith?

currently this is the code i have.

if (side player != civilian) exitWith {hint "Only civilians can join the Mujahideen!"};

titleText ["If a hint does not pop-up in the top right, go to Options > Game > and enable Tutorial Hints", "PLAIN DOWN"];

[["Mujahideen", "JoinInfo"], 15, "", 35, "", false, false, false, true] call BIS_fnc_advHint;

Now, ideally I would want that if the first condition isn't met, the script exits with that and ends.

However, it goes through the rest of the script

hallow mortar
#

exitWith should behave exactly like you want it to here.
Is it possible the condition just isn't being met for some reason? Is it displaying the hint it's supposed to show when exiting?

spiral narwhal
hallow mortar
#

So the same condition is also not working somewhere else? That sounds like it is possible the condition isn't being met

granite sky
#

In the snippet you've pasted, if player is side civilian then the second and third lines will not be executed.

spiral narwhal
#

Found the issue. It was actually another condition that was breaking causing the script run through its entirety

agile flower
#

Hello,

Quick and stupid question, getting "Type string expected object" when I try to getpos on the var, but a hint of _spawnObj returns the var name of an eden placed object perfectly

Where am i going wrong please?


fnc_laptopspawn ={
    _laptopNo = param[0];
    _spawnObj = format ["laptopSpawnPos_%1", _laptopNo];
    _spawnpos = getPosATL _spawnObj;
    format ["%1", _spawnpos] remoteExec ["hint", 0];
    laptopOBJ = createVehicle ["Land_Laptop_03_sand_F", _spawnpos, [], 0, "CAN_COLLIDE"];

I know this could be much shorter but have blown it out trying to debug it

granite sky
#

_spawnObj = missionNamespace getVariable format ["laptopSpawnPos_%1", _laptopNo];

#

In your code, _spawnObj is just a string. If you want to use it as a variable name then you need to look it up in missionNamespace.

opal zephyr
#

Does anyone have any experience with uiOnTexture? I want to know if this line of code would create a new display/overwrite the existing one, or it would just make another and id be left with 2 displays.
u2 setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 1024, 1024, _uniqueUIName]];
assuming "_uniqueUIName" was an existing display already created with this method

warm hedge
#

Will create a new one if the instance/name has not created yet

opal zephyr
#

Yes, but it has been already. Simplified it would look like this:

u2 setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 1024, 1024, "Test"]]; 

u2 setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 1024, 1024, "Test"]]; 

I want to know what the second line will do, will it create a second display? Will it just apply the existing one that was created the first time? Will it do something else?

warm hedge
#

Ah think misread your Q

opal zephyr
#

Im finding it impossible to test this because of how displays are returned

warm hedge
#

NNot sure if it will overwrite. Unlikely I'd say

opal zephyr
#

you're guess is it would create an entirely seperate second one?

warm hedge
#

I'm guessing will generate the SAME ui

opal zephyr
#

Alright, thats what I think too and am hoping for. Running into performance issues right now with too many rendered displays

warm hedge
#

It will create a dialog when the name doesn't exist yet. Will reuse if it does

opal zephyr
#

Thankyou for your opinion polpox, I appreciate it!

warm hedge
#

And basically, reuse it, and show the same tex

#

So, as long as you have reason to reuse, the same name should do

agile flower
#

Hello again,

trying to check if there is a player from a specific side in range of an object

if ({_x distance laptopOBJ < 5} count allPlayers > 0) then works

if ({_x distance laptopOBJ < 5} west countside allPlayers > 0) then does not

Error is "Missing )"

Where am I going wrong?

Thanks,

hallow mortar
#
{_x distance laptopOBJ < 5} west```
This is not valid. `west` does not accept any arguments.
agile flower
#

west countSide allPlayers; returns count of players on west.

hallow mortar
#

Yes, that would be functional (albeit not quite what you need) in isolation

#

But you have the condition argument from the other example's count attached to it, which is not a valid combination

#

That { _x ... } is not a thing on its own that you can just put anywhere and get the same result. It was written as an argument - a modifier - for count, to tell it what condition to use when counting. It doesn't work independently and will break things if jammed in where it doesn't fit.

#
// allPlayers includes dead and virtual so collect them differently
private _aliveManPlayers = switchableUnits + playableUnits;
private _filteredBLU = _aliveManPlayers select {side group _x == west};

if (_filteredBLU findIf {_x distance laptopOBJ < 5} > -1) then {
hint "BLU player nearby!";
};```
agile flower
#

Thanks man

marsh moat
# marsh moat Can someone help me try to figure out what this error is? The script works regar...

Condition:

call{this}
Interval: 0.5

On Activation:

nopop = true; shootingTargets6= [target_101, target_12, target_13, target_14, target_15, target_16, target_17, target_18, target_19, target_110, target_111, target_112, target_113, target_114,target_115, target_116, target_117, target_118, target_119, target_120, target_121, target_122, target_123, target_124, target_125];

The trigger referenced above.

meager granite
warm hedge
#

Will that make an _x undefined?

meager granite
#
0 spawn {{_x} forEach [nil]}
``` => ```
11:52:22 Error in expression <0 spawn {{_x} forEach [nil]}>
11:52:22   Error position: <_x} forEach [nil]}>
11:52:22   Error Undefined variable in expression: _x
#
0 spawn {{_x} forEach [thisvardoesnotexist]}
```=>```
11:53:09 Error in expression <0 spawn {{_x} forEach [thisvardoesnotexist]}>
11:53:09   Error position: <_x} forEach [thisvardoesnotexist]}>
11:53:09   Error Undefined variable in expression: _x
11:53:09 Error in expression <0 spawn {{_x} forEach [thisvardoesnotexist]}>
11:53:09   Error position: <thisvardoesnotexist]}>
11:53:09   Error Undefined variable in expression: thisvardoesnotexist
```Double error even
marsh moat
#

So one of the listed target_xxx doesn't exist and that's what throwing the error?

warm hedge
#

Hm then that might be the issue

tough geode
#

Mhh maybe I'm just stupid atm. but was there an easy way to get CfgVehicles class of a place mine. So for APERSBoundingMine_Range_Ammo -> APERSBoundingMine?

meager granite
# marsh moat So one of the listed ``target_xxx`` doesn't exist and that's what throwing the e...
{if(isNil{missionNamespace getVariable _x}) then {diag_log format ["%1 doesn't exist", _x]};} forEach ["target_101", "target_12", "target_13", "target_14", "target_15", "target_16", "target_17", "target_18", "target_19", "target_110", "target_111", "target_112", "target_113", "target_114,target_115", "target_116", "target_117", "target_118", "target_119", "target_120", "target_121", "target_122", "target_123", "target_124", "target_125"];
meager granite
marsh moat
#

Yeah I found the missing target. target_122 had gone under the map and so I didn't see it when I was assigning variables to the targets.

Thanks for the help! I had skimmed over the code for like 2 hours last night trying to figure it out and couldn't because I just thought 122 was there because every other one was in place.

meager granite
#

Mine objects aren't CfgVehicles but CfgAmmo btw

tough geode
#

Running an foreach loop for all mines so I got the object(s). But once placed it's the CfgAmmo class but want the CfgVehicle class to replace them ^^

tough geode
#

Worst case I can do a switch block but thought there should be a better way via config ^^

meager granite
#

Huh, didn't know there are mines in CfgVehicles 🤔

tough geode
#

This command creates objects of the CfgAmmo class named in configFile >> "CfgVehicles" >> _type >> "ammo".
Don't ask me why 😄

meager granite
#

_charge = createMine ["SatchelCharge_F", player, [], 0]; typeOf _charge => SatchelCharge_Remote_Ammo

meager granite
#

It will produce the same mine as you had before, createMine ends up creating CfgAmmo projectile

tough geode
meager granite
#

🤔

tough geode
#

Only way I get addOwnedMine to work is with a script placed mine but maybe i'm missing something ^^

meager granite
#

addOwnedMine works with createVehicle'd mines

#
player addOwnedMine createVehicle ["SatchelCharge_Remote_Ammo", getPos player, [], 0, ""];
#

Properly creates CfgAmmo mine and you have control over it

#

This createMine command looks like some ancient relic, probably of times when createVehicle couldn't create CfgAmmo projectiles or something

tough geode
sullen trellis
#

I found this code somewhere it's very useful for any arma 3 player, it shows the actual live mini map on the side screen , although there is an issue with the line "_mmap ctrlMapAnimAdd [0, 0.05, player];" it wouldnt be perfectly centered to the player.

[] spawn {
disableSerialization;
_mmap = findDisplay 46 ctrlCreate ["RscMapControl", -420];
_mmap ctrlSetPosition [-0.6, 0.4, 0.4, 0.4];
_mmap ctrlCommit 0;
while {true} do {
_mmap ctrlMapAnimAdd [0, 0.05, player];
ctrlMapAnimCommit _mmap;
};
};

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
meager granite
sullen trellis
# meager granite Its missing `ctrlMapSetPosition` which map controls need for map animations to w...

You saved the daysalute ! thanks to you now the code is a peace of treasure anyone can use, this is how it would look like and you can play with position settings:
Side live mini map on player:
[] spawn {
disableSerialization;
_mmap = findDisplay 46 ctrlCreate ["RscMapControl", -420];
_mmap ctrlMapSetPosition [0,0,0.4,0.4];
_mmap ctrlSetPosition [-0.6, 0.4, 0.4, 0.4];
_mmap ctrlCommit 0;
while {true} do {
_mmap ctrlMapAnimAdd [0, 0.05, player];
ctrlMapAnimCommit _mmap;
};
};

You can even enhance this by using the following code to get exact enemy locations on your side mini map just like "call of duty":

[] spawn {
while {true} do {
{ if(!isPlayer _x && side _x != playerSide) then { player reveal [_x,4] } }forEach allUnits;
sleep 10; } };

meager granite
#

I wonder what will happen in such case of a lag:

  • Player 1 is inside a car that is local to them
  • Player 1 is lagging (network dropped) and manages to get out of the car and ran away enough to be unharmed
  • Player 2 still sees Player 1 inside a car and destroys car with a single shot from a rocket launcher
    Will any damage be applied to Player 1 unit one they unlag and their car gets destroyed?
#

I assume there can be two sources of damage towards Player 1 unit:

  • Rocket hit to car propagates some damage to crew
  • Car blows up and kills its crew
#

I guess second source of damage wont happen since car is local to Player 1 and they're outside and far away by the time it dies

#

But what about first case? Will this damage reach player Player 1 once they unlag?

#

Having hard time setting up an experiment for this, can't make one game instance lose connection for the test

livid kraken
#

So I have this code to spawn a tank off a console

this addAction ["Spawn TX-130SS on Pad 2", {_pad1 = getPosASL Spawn_Pad2;_dir = getDir Spawn_Pad2;_veh = createVehicle ["3AS_saber_super",[0,0,0],[],0,"NONE"];_veh setPosASL _pad1;_veh setDir _dir;},nil,7.1,true,true,"","true",5,false,"",""];

I am trying to figure out how to adapt it to spawn a group with two ai that a player can join and then take command of, too 1 man the tank any help would be appreciated

meager granite
livid kraken
#

ok thank you

livid kraken
warm hedge
#

Unrelated at all

meager granite
livid kraken
#

ok

#

this is not working for me I am also very new to arma scripting so I might just not be understanding properly. Would you be able to show me an example?

meager granite
#

Post code

unreal scroll
#

@livid kraken A small addition: I highly recommend to do setDir before setpos, because in some cases turning the vehicle after placing it on the position may cause an unpredictable collision with nearest objects.

livid kraken
# meager granite Post code

This is the only code I have to go off of

this addAction ["Spawn TX-130SS on Pad 2", {_pad1 = getPosASL Spawn_Pad2;_dir = getDir Spawn_Pad2;_veh = createVehicle ["3AS_saber_super",[0,0,0],[],0,"NONE"];_veh setPosASL _pad1;_veh setDir _dir;},nil,7.1,true,true,"","true",5,false,"",""];

meager granite
livid kraken
livid kraken
unreal scroll
#

@meager granite Reporting on latest tests with missiles on dedicated, this works perfectly

// In Fired EH:
if (isDedicated) then {
    [typeof _projectile, getposATL _projectile, velocity _projectile] remoteexeccall ["OT_fnc_createdummy",-2];
} else {
    private _missile = createvehicle ["v2", [0,0,random 1000], [], 0, "CAN_COLLIDE"];
    _missile attachTo [_projectile,[0,-5,0]];
};

// The procedure to run on clients:
OT_fnc_createdummy = {
    params ["_type","_pos","_velocity"];
    private _projectile = _type createvehicleLocal _pos;
    private _missile = "v2" createvehicleLocal [0,0,random 1000];
    _missile allowdamage false;
    _missile attachTo [_projectile,[0,-5,0]];
    [_missile, [-90,0,0]] call OT_fnc_pitchbank;
    _projectile setposATL _pos;
    _projectile setvelocity _velocity; // Attaching on high-velocity projectile is not recommended
    _projectile addEventHandler ["Deleted", {
        params ["_projectile"];
        {deletevehicle _x} foreach (attachedobjects _projectile);
    }];
    _projectile addEventHandler ["Explode", {
        params ["_projectile"];
        {deletevehicle _x} foreach (attachedobjects _projectile);
    }];
    _projectile addEventHandler ["Deflected", {
        params ["_projectile"];
        {deletevehicle _x} foreach (attachedobjects _projectile);
    }];
};

Don't know if all EHs needed, but I wanted to be sure the V2 model removed in any case.
Also, I did'n see any noticeable drift, but if it were, local projectile can be created in the end of flight.
https://youtu.be/ncecBfBWfVE

dusk tulip
#

I’ve been looking into unit capture and unit play for some of my MP missions in the future. Events that I want “on rails” for story purposes. All tutorials I can find are for single player cinematics and pictures ect.

Anyone know of the feasibility for this in mp along with something to get me started?

fathom furnace
#

Mp*

hushed tendon
#

anyone know the reason why I can't find the attachTo function in the files? Trying to read the code. Is it named differently?

meager granite
hushed tendon
#

that would make sense

#

anyway to read those? or they are probably not sqf aren't they?

meager granite
#

No they're binary, compiled, hardcoded

#

What did you want to know about attachTo anyway?

hushed tendon
#

Well I'm working on a fortifications mod similar to the squad building system and trying to work out if arma can handle one of the explacements where I have some sandbags and a 50cal but I need the 50cal to remain in place but be simulated but attachTo rotates the object 90 degrees and seems to disable the simulation

#

also trying to not do any custom objects cause I don't want to and am lazy to learn how that stuff works

meager granite
#

so if you attach a static gun to a building, it will be simulated very slowly

hushed tendon
#

oh I was not aware of that

meager granite
#

as for rotation, there are lots of scripts going around that fix the rotation after attachTo

hushed tendon
#

well I'm trying to keep the static in place and not move so are you aware of any objects that are simulated but don't move?

meager granite
#

Honestly I'm not sure what would be a proper solution to this, probably have enough space for the object to stay properly so you don't have to do any tricks

meager granite
hushed tendon
#

thx I'll give that a try

hushed tendon
#

Always appreciate the help I get from the community

agile flower
#

Hello all,
I have a locality foible and I'd really appreciate if someone could help me untangle it:
I am calling this function on the server using:

[laptopCount, "Func\laptopSpawn.sqf"] remoteExec ["execVM",2];```
laptopCount is a simple incrementing number 1 through 6
```sqf
laptopSpawn.SQF
        _laptopNo = param[0];
    _spawnObj = missionNamespace getVariable format ["laptopSpawnPos_%1", _laptopNo];
    laptopOBJ = createVehicle ["Land_Laptop_03_sand_F", getPosATL _spawnObj, [], 0, "CAN_COLLIDE"];
    [laptopOBJ, 0, ["ACE_MainActions"], CheckIntel1] remoteExec ["ace_interact_menu_fnc_addActionToObject", 0, true];

When I run this code on local host, the ace action is added to the spawned laptop
When I run this code on dedi I do not.
I assume this is because clients are not made aware of the variable name of the laptop and therefore the addActionToObject fails.
Please can someone help me validate this assumption and then how I'd get past it.

granite sky
#

What's CheckIntel1?

agile flower
#

an ace interaction I create in init.sqf

#

wait one

#

CheckIntel1 = [
    "CheckIntel1",  
    "Secure Laptop",  
    "",  
    {   
        params ["_obj"];
        //While actioning
        [1, _obj,  
        {  
            //Success
            params ["_obj"];
            [[side player, _obj], "Func\laptopSecure.sqf"] remoteExec ["execVM",2];            
        },
        {
            hint "Aborted"; 
        },
        //Action bar
        "Securing..."] call ace_common_fnc_progressBar  
    },  
    {true},  
    {},  
    ["_object"],  
    [0,0,0], 100] call ace_interact_menu_fnc_createAction;```
granite sky
#

where do you call that code?

agile flower
#

init.sqf

granite sky
#

ACE documentation isn't sufficient to answer that question. Potential issue is whether the output of createAction can be passed over the network.

#

The sensible way to write this is to write a client-side function that does the addActionToObject call, and remoteExec that instead.

#

Pass laptopObj as a parameter but do everything else on the client side.

#

Maybe there's some other issue though. Did you check the RPT for server-side script errors?

agile flower
granite sky
#

Yes, but you're not using the one you create on the client.

#

You're passing the one created on the server over the network.

agile flower
#

No, I'm using the action I create on the client, I am assigning it to an object over the network.

granite sky
#

In this line, both laptopOBJ and CheckIntel1 are resolved server-side:

[laptopOBJ, 0, ["ACE_MainActions"], CheckIntel1] remoteExec ["ace_interact_menu_fnc_addActionToObject", 0, true];```
agile flower
#

fnc_addActionToObject

#

The action already exists - it must be created before it can be added

granite sky
#

When you put a variable in an array, that's dereferenced immediately and the contents added to the array.

agile flower
#

Gotcha

#

I'm still struggling with that though, as the server is also aware of the action, so it should be conscious of that variable.

granite sky
#

That's the unknown part.

#

I don't know ACE's internals.

#

Question is whether the results of createAction are valid to send over the network.

agile flower
#

As you said, yeah, I'll write a function to add the action and execute that globally.

split scarab
#

I have a mission I've made which seemed to run fine for 4-8 players, but seems to break the server during mission load/briefing screen when we get closer to 10 players. I'm suspecting I have some shitty code that causes too much traffic but I'm not smart enough to figure it out, was wondering what would be the best way to get help sorting it out since it's quite a lot of code?

winter rose
split scarab
#

Hmm, the majority of code is in the init field of a Game Logic object, I'm guessing that's the issue then?

#

I've also got some stuff in initPlayerLocal.sqf

winter rose
#

a game logic object is local only to the server iirc, but maybe there is some heavy remoteExec in there too

split scarab
#

Hmm, wouldn't call it heavy, but there's 12 remoteExec calls, heres a snippet

winter rose
#

indeed, nothing big

split scarab
#

Can I share my initPlayerLocal.sqf as a file? it's 2000 characters too big to send as text :/

#

Or should I just share as snippets

split scarab
fallow pawn
#

Sorry for interrupting any ongoing question, but I never quite understood this:
What are the implications on setting vars on entities with '#' before it's identifier?
As in player setVariable ["#rev", 1, true] used by Arma 3's embeded Revive system.
Or, you know, when you want to create some particle effects you have to use '#particlesource' as the object type.
I realize this two examples may be about different things, but I just never stumbled upon a clear explanation on why to use it.
Does it make any diference whatsoever or it's just a norm I don't know about?

split scarab
#

It's just a bit annoyed about it because we played it and tested with like 7 people previously and I've made very tiny changes since then and suddenly it's not working, it was meant to be a streamed community event for 12 people but it didn't work so we had to cancel

still forum
fallow pawn
#

TY

lunar goblet
#

Hello 🇬amers, I'm trying to write a script that detects if two players with variable names RTO and OFC are next to each other (5 units or so?) and outside of the jury rigged IED script my friend has made I don't really have much right now, if anyone could help me figure this one out it would be greatly appreciated.

still forum
#

where does the script go? in a trigger?

lunar goblet
#

activation condition for a module

#

bottom one here, the request approval

pliant stream
#

yeah it's great until you have to use like any third party library ever and they didn't put the xml documents on their api

spiral narwhal
#

So when i run all these in single player it works fine.

But now i have it running on my MP mission and for some reasons, it's not.

I don't get an error - and the rest of the script works fine


_name = name player;
_message = format ["%1 detonated a suicide bomb", _name];

...


[_message] remoteExecCall ["Hint",0];
#

the function is triggered by the player

fallow pawn
#

Is there a way to emulate Tactical Ping cursor direction?
It doesn't seem to be ray casting weaponDirection nor getCameraViewDirection, since the former points to exact muzzle direction and the latter is restricted to the camera direction, and Tactical Ping seems to follow the middle of the weapon cursor no matter what (even looking away with Freelook or TrackIR).
Also the resulting argument "_this select 1" from a Communication Menu expression ([caller, pos, target, is3D, id]) also seems to follow Tactical Ping cursor direction behaviour.

vapid scarab
#

Where are the unit icons stored? Which pbo specifically or if you could just post the filepath, that would be fine.

#

And before someone says something about checking myself or configs, my arma is corrupted and has to do a full reinstall.

warm hedge
#
[getText (configOf player >> "icon")] call BIS_fnc_textureVehicleIcon;```
`"\A3\ui_f\data\map\vehicleicons\iconMan_ca.paa"`
vapid scarab
#

❤️ Now here's to hoping steam has reinstalled that part by now

fair drum
spiral narwhal
oblique lagoon
#

Does anyone know how to add code section to zeus? I made new clean mission and added admin zeus. I can place the object and open its edit window, but there is no code execution tab.

#

I added "ModuleCuratorSetAttributesObject_F" with code checked and synced to zeus, set its owner to zeus module.

#

sry for the language but as you may notice, theres's no code section

#

@warm hedge may I ask your help

warm hedge
oblique lagoon
granite sky
#

screenToWorld [0.5, 0.5]?

warm hedge
#

No, ping is based on where you aim actually

#

Not going to follow where you freelook

oblique lagoon
#

Ah solved

granite sky
#

hmm. Is the issue that weaponDirection is correct but you need the gun position too, or is weaponDirection not correct?

fallow pawn
#

weaponDirection gives me the exact vector the muzzle is pointing, where Tactical Ping does not quite work like that

warm hedge
#

weaponDirection is where your gun is aiming. Which means fatigue or such are involved

fallow pawn
#

For example, if I'm running (weapon pointing downwards) and I ping a wall 1km from me, the ping will appear on the wall
With weaponDirection the ping would appear at my feet where the gun is pointing

granite sky
#

this is too many cameras :P

#

Sounds more like eyeDirection?

warm hedge
#

Neither

granite sky
#

(which is actually head direction, allegedly)

fallow pawn
#

Through SQF I can account for almost all. The running, being in freelook, the lack of a weapon... everything but fatigue and stamina, which still play a role in the end

warm hedge
#

Yeah it is one of the lacked command I think

fallow pawn
#

Quite a bummer since I'd love to be able to replace the ping HUD element with something else I've already developed

warm hedge
#

Aiming related commands are really needed, at least getter

#

Setters are denied by Bohemians before, after concerns of use in cheats. But who can think this is a valid concern if one can access to SQF already?

sullen sigil
#

request them again now we have sensible bohemians

pulsar bluff
#

camera is better to use than object, since player has more control over their camera than their avatar

#

or screen

fair drum
oblique lagoon
fallow pawn
# pulsar bluff https://community.bistudio.com/wiki/screenToWorld

Hey all! Thanks for all the answers!
Unfortunately I already use all of those in my code to try and achieve the closest possible to Tactical Ping behavior.
I'm not on my PC now, but in the morning I'll paste my code here and see if someone can light my way. Or not.
Nevertheless I'm already in terms with this for months now 😅
Just trying my last resort here with you guys.

Thank you again for helping!

marsh moat
#

Hey it's me again! So I have this script for ACE 3 that was working and now that it's updated it's broke. Can someone help me convert it to vanilla addAction or fix the ace functionality? By it's broke I mean it doesn't even appear as an option for the laptop I have it sitting one when I hold my interact key. I don't understand ace scripting and someone else made this for me but I can't get in contact with them anymore, so I was hoping I can get some help here.

private _action = ["Mission_SpawnTank", "Spawn Car", "", {
params ["_target", "_unit", "_params"];
private _min = 50;
private _max = 500;
private _distance = _min + random (_max - _min);

private _position = _unit getPos [_distance, getDir _unit];
private _vehicle = "B_KEF_UCMC_MRAP" createVehicle _position;
}, {true}, {}, []] call ace_interact_menu_fnc_createAction;

[this, 1, ["ACE_SelfActions"], _action] call ace_interact_menu_fnc_addActionToObject;

granite sky
#

If it's ACE_selfActions, isn't that a self-interact rather than something you'd add to a laptop?

marsh moat
#

You'd think but it wasn't showing there either

granite sky
#

hmm, works for me.

#

Just stuck that code chunk (except with 0 & ACE_MainActions) in the init box for a vehicle and it worked.

marsh moat
#

So this?

private _action = ["Mission_SpawnTank", "Spawn Car", "", {
params ["_target", "_unit", "_params"];
private _min = 50;
private _max = 500;
private _distance = _min + random (_max - _min);

private _position = _unit getPos [_distance, getDir _unit];
private _vehicle = "B_KEF_UCMC_MRAP" createVehicle _position;
}, {true}, {}, []] call ace_interact_menu_fnc_createAction;

[this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;

granite sky
#

Yes.

marsh moat
#

Okay that worked... huh I wonder how it got changed to a SelfAction because I definitely did not make that change and it's worked previously

#

But thank you for the help. Even if it was something really simple I should've been able to figure out myself.

pulsar bluff
#

how do you determine if an object has the potential for fuel cargo?

#

i'd think ((getFuelCargo _obj) > -1) would work, but there are a lot of props which have getFuelCargo _obj // 0

#

nm i guess it is transportFuel = 300;

sharp grotto
granite sky
#

I think ACE has "ace_refuel_fuelCargo" instead, because they zero the vanilla values to remove the actions.

pulsar bluff
#

yea im just looking for a generic getter of "this asset can store fuel"

#

for killed explosion

#

unfortunately im getting fuel explosion when sandbags get destroyed, since BI configure fuel cargo > -1 for many props

meager granite
#
canItStoreFuelHashmapCache getOrDefaultCall [typeOf _vehicle, {getNumber(configOf _vehicle >> "transportFuel") > 0}, true];
````getOrDefaultCall` is perfect for these kind of config checks
fleet sand
#

Quick question how do you create Eagle. Is it like a agent or unit ?
I tried it like this but it dosent work ?

private _pos = player modelToWorld [0,5,0];
private _eagle = createAgent ["Eagle_F",_pos, [], 0, "NONE"];
_eagle setVariable ["BIS_fnc_animalBehaviour_disable", true];
warm hedge
#

Probably camCreate

fleet sand
terse tinsel
#

Hello, I have a question. This script reduces damage and if I wanted to know how to change it, did it increase damage?? this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/15)}];
arma3

warm hedge
terse tinsel
warm hedge
#

/ to divide * to multiply

meager granite
#

Wishing once and once again we had array commands that return operated array so stuff can be written in a single statement AND returned from the function

#

pushBackRet, setRet, appendRet, etc.

warm hedge
#

Do you mean you want both the array and copy of it?

meager granite
#

No, operate the array and return it so another operation can be done with it in the same statement

warm hedge
#

Ah

#
{} forEach (_ary pushBack 0);```Simiar to this concept?
meager granite
#

If pushBack returned _art after adding the 0 then yes

#

Needs a new command though

#

So for example I can build an array of important alive vehicle units (minus FFV and passengers) like this:

allTurrets _this apply {_this turretUnit _x} pushBackRet driver _this select {alive _x};
warm hedge
#

Yeah I get it

#

I honestly never used the return of pushBack or such

meager granite
#

Its useful when you want to store the index elsewhere

#

Like in hashmap for example because it doesn't have indexes or ordering

#

Many applications

#
private _pos_xy = getPosWorld player resizeRet 2;
#

vs

private _pos_xy = getPosWorld player;
_pos_xy resize 2;
```and even 3rd line if you want it returned
#
getPosWorld player setRet [2, 0];
```vs
```sqf
private _pos_xy0 = getPosWorld player;
_pos_xy0 set [2, 0];
_pos_xy0;
terse tinsel
# warm hedge `/` to divide `*` to multiply

so it should look like this? this addEventHandler ["HandleDamage",{
params ["_unit", "_selection", "_damage"];
_curDam = call {
if (_selection == "") exitWith {
damage _unit;
};
(_unit getHit _selection)
};
((_damage-_curDam)*2+_curDam)
}] ;

warm hedge
#

Yes

#

Or rather, you should to try before ask

terse tinsel
meager granite
meager granite
fallow pawn
# fallow pawn Hey all! Thanks for all the answers! Unfortunately I already use all of those in...

Hello there! So this is my code:

    private _weapon = currentWeapon player;
    private _initPos = eyePos player;
    private _weaponDir = player weaponDirection _weapon;
    private _vectorDir = vectorDir player;
    _vectorDir set [2, _weaponDir select 2];

    private _finalDir = [_vectorDir, getCameraViewDirection player] select (_weapon isEqualTo "" || {freeLook || {!isNull objectParent player}});
    private _line = lineIntersectsSurfaces [
        _initPos,
        _initPos vectorAdd (_finalDir vectorMultiply viewDistance),
        vehicle player,
        player
    ];

    if (_line isEqualTo []) exitWith {};

    [_line select 0 select 0] remoteExecCall ["SERGIO_fnc_ping"];
}];```

With this I can almost emulate total Tactical Ping behavior, but not quite, since I'm stuck using a mix of player direction for yaw and weapon direction for pitch.
The latter is where it's at. I don't know any pitch-related position getter other than the exact weapon muzzle vector (`weaponDirection`), which is not optimal.

Thanks for the attention!
thorn saffron
#

Is it possible to use a script to open a box inventory while sitting in a vehicle?
I tried player action ["GEAR",box_1], it works on foot, but not if you are inside a vehicle.

wispy crest
#

Hello! how do i make it so that nobody can die and there is a fail state if everyone is unconscious?

civic monolith
#

do anyone know tfab scripting

granite sky
#

@wispy crest HandleDamage EH. It's fairly tricky.

limber thunder
#

Hi guys,
is there a way to display images in Arma 3 in certain places. Does anyone have an idea how I can do this without using the RSC classes?

granite sky
#

uh, you never need to use the Rsc classes. You can just write your own.

limber thunder
#

what do you mean?

granite sky
#

Have you done any Arma UI coding at all?

limber thunder
#

No, that's the problem

granite sky
#

That is indeed a problem. I don't think there's a good introduction page.

limber thunder
#

I've already done a bit of research but haven't found anything right and what I have found seems a bit too complicated

#

Do you have any ideas where I could start?

granite sky
#

Find someone else's simple UI code and figure out how it fits together tbh.

#

I don't think there's any basic UI guide in the wiki.

glossy pine
#

want to add images to objects (billboards, etc..)? or to UI

granite sky
#

Although I thought that for mods too and I just hadn't found it.

glossy pine
#

what u plan to do add a watermark?

limber thunder
#

I actually want to build my own HUD where I can show different images in certain places

#

If a player dies, for example

granite sky
#

The general principle is that you build the thing with config definitions and then display it with... probably cutRsc for a HUD.

glossy pine
limber thunder
granite sky
#

Ah yeah, that's also an option.

#

(ctrlCreate on display 46)

#

Depends, you can also mix & match config definitions with ctrlCreate. Hardcode some stuff, then create some controls dynamically.

limber thunder
#

It will probably come down to this.
Do I then have to use the RscPicture class?

granite sky
#

If you don't define your own one, probably yes.

#

ctrlCreate does need a class.

glossy pine
#

better to use the one that keep aspect ratio i think

#

so the image doesnt look like shit

#

i dont remember the name

limber thunder
glossy pine
#

RscPictureKeepAspect

granite sky
#

If you're using ctrlCreate then normally you'd use ctrlSetPosition followed by ctrlCommit to place/size it.

granite haven
# limber thunder It will probably come down to this. Do I then have to use the RscPicture class?

For ui you cna do a couple things:

(findDisplay 46) ctrlCreate ["RscStructuredText", 100];
_pic = (findDisplay 46) displayCtrl 100;
_pic ctrlSetPosition [_x, _y, _w, _h];
_pic ctrlSetStructuredText parseText format ["<img image = '%1'></img>", "\ca_picture.paa"];
_pic ctrlCommit 0;
#

option one is probably your go to option

#

this will create a picture wich doesnt stop a player from moving

#

altough im not 100% if it will create a mouse cursor or not

#

but you can probably change its interactability pretty easily

#

option 2 requires you to make predefined classes

#

this is usually something you do for a group menu screen, settings screen, welcome screen, stuff like that

limber thunder
#

Okay, thanks for the help. I'll just try it out a bit

granite haven
#

i recommend you try and find the picture you want to display, then find how to display it on screen, doesnt matter where. as long as you understand its pos on the screen and the coordinates, and then start moving it around to the prefered position on screen

limber thunder
#

Good idea. Thanks again for your help

limber thunder
granite haven
#

class is things like: "RscText", "RscStructuredText", "RscVideo" these are just different classes, depending on what you want to do with your display class

#

what do you mean by location of image?

  • On screen location
  • Folder location
limber thunder
#

I meant folder location

granite haven
#

where ever your mission folder is, can be next to your description.ext

limber thunder
#

Okay with _pic ctrlSetStructuredText parseText format ["<img image = '%1'></img>", "\ca_picture.paa"]; I define that the class "RscStructuredText" should have the format of the following image?

granite haven
#

if i think what ou mean then my answer is yes, and just like you have image = '%1' there is also size = '1'

#

so you can change its size

granite haven
#

or size 0.8 etc

limber thunder
#

Does it not overwrite

_pic ctrlSetPosition [_x, _y, _w, _h];
granite haven
#

well it'll just be the size within the width of the text square im pretty sure.

limber thunder
#

Okay, I'll try that in Arma now

limber thunder
granite haven
#

could be that the image is shown outside of your screen

limber thunder
#

I used the GUIEditor from 3den Enhaced for the position and adopted the position for the X and Y values. Could this be the error or how else can I find out the correct position?

granite haven
#
_pic ctrlSetPosition [((safeZoneX + (safeZoneW / 2)) - ((safeZoneW / 10) / 2)), ((safeZoneY + (safeZoneH / 2)) - ((safeZoneH / 15) / 2)), (safeZoneW / 10), (safeZoneH / 15)];

try this position

#

and also send a copy of your code

#

to see if there is something wrong maybe

limber thunder
#

okay wait

#
(findDisplay 46) ctrlCreate ["RscStructuredText", 100]; 
_pic = (findDisplay 46) displayCtrl 100; 
_pic ctrlSetPosition [((safeZoneX + (safeZoneW / 2)) - ((safeZoneW / 10) / 2)), ((safeZoneY + (safeZoneH / 2)) - ((safeZoneH / 15) / 2)), (safeZoneW / 10), (safeZoneH / 15)];
_pic ctrlSetStructuredText parseText format ["<img size='1' image = '%1'></img>", "briefing.paa"]; 
_pic ctrlCommit 0;
#

I still don't get an error message but nothing is displayed either

granite haven
#

so if its in the root folder do "\briefing.paa"

#

if its in a folder wich is in the root folder do: "\folderName\briefing.paa"

limber thunder
#

I had that at the beginning but then I got the message that the image was not found

granite haven
#

hm what does your directory look like?

#

mission directory

limber thunder
#

mission.sqm, description.ext and some .sqf files

#

nothing special

granite haven
#
_pic ctrlSetStructuredText parseText "<img image='\briefing.paa'/>"; 

try this line

limber thunder
#

okay

granite haven
#

i edited it

limber thunder
#

Still nothing

granite haven
#

gonna quikly finish my raid

#

maybe someone else answers

#

in the meantime

#

okay, died. how are you excecuting the code?

limber thunder
limber thunder
granite haven
#
0 spawn {
    disableSerialization;
    _pic = (findDisplay 46) ctrlCreate ["RscStructuredText", 100];
    _pic ctrlSetStructuredText parseText "<img image='\briefing.paa'/>";
    _pic ctrlSetPosition [((safeZoneX + (safeZoneW / 2)) - ((safeZoneW / 10) / 2)), ((safeZoneY + (safeZoneH / 2)) - ((safeZoneH / 15) / 2)), (safeZoneW / 10), (safeZoneH / 15)];
    _pic ctrlCommit 0;
};

try this in debug console, and does it throw any errors?

limber thunder
#

No error message and nothing is displayed

granite haven
#

hm what i assume is happening is the image is beeing displayed outside of the screen wich is very annoying

#

let me get a screen pos of one of my images and see if your img then mvoes correctly

limber thunder
#

Yes, I think so too. Which value is responsible for this?

granite haven
#

x and y prob

#
0 spawn {
    disableSerialization;
    _blockW = safeZoneW / 1000;
    _blockH = safeZoneH / (1000 / (getResolution # 4));

    _displayW = _blockW * 180;
    _displayH = _blockH * 54;
    _displayX = safeZoneW + safeZoneX - _displayW - (_blockW * 10);
    _displayY = safeZoneH + safeZoneY - _displayH - (_blockH * 50);

    _pic = (findDisplay 46) ctrlCreate ["RscStructuredText", 100];
    _pic ctrlSetStructuredText parseText "<img image='\briefing.paa'/>";
    _pic ctrlSetPosition [_displayX + (_blockW * 88), _displayY + (_blockH * - 30), _blockW * 40, _blockH * 16];
    _pic ctrlCommit 0;
};
#

what does this give? img should be around bottom right

limber thunder
#

Still the same problem. Have you tried it on your system?

granite haven
#

only thing diff is the img

#

ill send a screenshot of what it looks like for me

#

with my img

limber thunder
#

yes

granite haven
#

and the code attached to it

#
waituntil {!isnull (findDisplay 46)};

_blockW = safeZoneW / 1000;
_blockH = safeZoneH / (1000 / (getResolution # 4));

_displayW = _blockW * 180;
_displayH = _blockH * 54;
_displayX = safeZoneW + safeZoneX - _displayW - (_blockW * 10);
_displayY = safeZoneH + safeZoneY - _displayH - (_blockH * 50);
_scale = (0.8 call BIS_fnc_WL2_sub_purchaseMenuGetUIScale);
_start = missionNamespace getVariable "gameStart";


private _ctrlBackgroundTimer = findDisplay 46 ctrlCreate ["RscStructuredText", 4567];
_ctrlBackgroundTimer ctrlSetPosition [_displayX + (_blockW * 88), _displayY + (_blockH * - 30), _blockW * 40, _blockH * 16];
_ctrlBackgroundTimer ctrlSetStructuredText parseText format ["<img size = '%1' color='#ffffff' image='img\timer_ca.paa'></img>", _scale];
_ctrlBackgroundTimer ctrlCommit 0;

private _ctrlTimer = findDisplay 46 ctrlCreate ["RscStructuredText", 45671];
_ctrlTimer ctrlSetPosition [_displayX + (_blockW * 105), _displayY + (_blockH * - 29), _blockW * 90, _blockH * 16];

while {(36000 - (serverTime - _start)) > 0} do {
    _ctrlTimer ctrlSetStructuredText parseText format ["<t size = '%2' color = '#ffffff'>%1</t>", [(36000 - (serverTime - _start)), "HH:MM:SS"] call BIS_fnc_secondsToString, _scale];
    _ctrlTimer ctrlCommit 0;
    sleep 0.5;
};
#

so this is a code wich just displays a clock icon and a countdown timer

#

this is my directory, so in the img folder is the image

#

if you understand this you should be able to make this work for you aswell

#

in theory ofc

limber thunder
#

Okay, I'll try to get this working

#

Thanks for your time. Maybe I'll get somewhere with it

granite haven
#

BIS_fnc_WL2_sub_purchaseMenuGetUIScale:

(_this / (getResolution # 5)) * 0.7
limber thunder
#

Have you defined that?

granite haven
#

yhea

#

its a function

limber thunder
#

okay thanks

fossil jewel
#

How can i make health shared between several components? i've got an awful technical i've made but i want the m2 and the ammo crate to be damaged at the same rate as the truck, so that destroying the truck also destroys the ammo box and the m2.

warm hedge
#

If you want to share the death between the things, Killed EventHandler. If you want to share the damage percentage, HandleDamage

nocturne bluff
#

most have it

dreamy kestrel
dreamy kestrel
dreamy kestrel
#

now trying to also addRating, but I do not see that is having any effect, either.

fnc_setRating = {
  params ['_unit', '_rating'];
  private _delta = _rating - (rating _unit);
  if (_delta > 0) then {
    _unit addRating _delta;
  };
};
meager granite
#

What are yout rying to do anyway?

dreamy kestrel
#

trying to set an AI unit rank. preferrably in a way that is measurable after the fact.

#

it seems like setting the rank, zeroes the rating, regardless. which is odd.

meager granite
dreamy kestrel
#

that 'gets' the rank, yes.
at least in one case, I find the "B_officer_F" class does not seem to specify a default officer rank. so I am trying to set that.
but the rating does not seem to set. maybe I am missing something about the Rating Values (?)

meager granite
dreamy kestrel
#

may not be reading the table right then, i.e. Arma 3 (ca 2015) versus Arma 3...
does rating even serve a purpose then?

#

anyway, I can set the rank, easy enough.

meager granite
#

I don't think it does anything but changes you into an enemy side if you have it below -2000

#

Ancient hardcoded gameplay mechanic

#

Hmm, apparently its used for something else too

warm hedge
#

It is used to tell how good your performance is in the debrief, but... not sure what else we have other than -2000

dreamy kestrel
#

no worries, working with what I got

pulsar bluff
#

rating is used for AI target prioritization

meager granite
pulsar bluff
#

higher rated targets get attacked first

#

“rating” is a dumb term, should be “threat”

#

AI will target negative threat targets on their own side, and prioritize high positive rated targets on enemy sides

sullen trellis
#

I have an MQ_4A UAV which loiters around the map during mission, when a player uses all its ammo the MQ automatically begins to RTB. so far havent found any way to stop the MQ from automatically returning to base. any idea about this?

sudden yacht
#
player addItem "theuniform"; 
player assignItem "theuniform"```, ive tried randomly having it select a uniform and apply it to the player. No error. Does not apply uniforms. Ive also tried other commands such as ForceAddUniform with no luck.  Any ideas? Anyone?
warm hedge
#

Remove quotes

#

theuniform is the variable name you want to use, "theuniform" is just a string

unreal scroll
#

@sudden yacht

player forceAddUniform selectrandom ["U_B_CombatUniform_mcam","U_B_CombatUniform_mcam"];

Unless you need this particular global variable.

sudden yacht
#

i got it, ty i had to use call bis select random for it to work

warm hedge
#

i had to use call bis select random for it to work
Makes no sense

hallow mortar
#

BIS_fnc_selectRandom has no functional difference from selectRandom in this context. selectRandom is strictly "the same but better" and was not the source of the problem.

sudden yacht
#

@warm hedge Thats what i said!

warm hedge
#

?

sudden yacht
#

"i had to use call bis select random for it to work
Makes no sense"

#

🙂

warm hedge
#

Yes because it doesn't

#

Read what WE said again

hallow mortar
#

BIS_fnc_selectRandom vs selectRandom was not why it didn't work. Something else was wrong

fickle socket
#

I have a script which calls this file fn_wpLand.sqf and it is said to be located in A3\functions_f\waypoints\fn_wpLand.sqf but I cant find the folder / file location on my pc. Or is this created / located in the mission folder somehow?

warm hedge
#

Your game already has that

fickle socket
fickle socket
warm hedge
#

It does work very finely for me. What vehicle you want to let land?

fickle socket
#

here's the script. I copied from a youtube video. Im a noob at scripting. I'll post the link to video ```sqf
if (isServer) then {
_nearestUnits = nearestObjects [(getPos ZelenskyysRevenge),["Man","Car"],500];
_nearestTargets = [];
_badGuySide = east;

if((_badGuySide countSide _nearestUnits > 0) AND (ZelenskyysRevenge ammo "BombDemine_01_F" > 0)) then {
{
_unit = _x;
if(side _unit == _badGuySide) then{_nearestTargets = _nearestTargets + [_unit]};
} foreach _nearestUnits;
_targetUnit = selectRandom _nearestTargets;
_wpDroneDrop = (group ZelenskyysRevenge) addWaypoint [getPos _targetUnit, 0];
_wpDroneDrop setWaypointTimeout [2, 2, 2];
_wpDroneDrop setWaypointCompletionRadius 1;
_wpDroneDrop setWaypointType "MOVE";
_wpDroneDrop setWaypointStatements ["true", "execVM 'orkbane.sqf'"];
} else {
_wpDroneDrop = (group ZelenskyysRevenge) addWaypoint [getPos dronebase, 0];
_wpDroneDrop setWaypointType "SCRIPTED";
_wpDroneDrop setWaypointScript "A3\functions_f\waypoints\fn_wpLand.sqf";
};
};```

warm hedge
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

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

What vehicle the groupZelenskyysRevenge has?

fickle socket
#

demining drone civ IDAP

#

the drone lands but not at the position of the dronebase which is an invisible heliport marker

fickle socket
meager granite
#

I love hashmaps 🥲

potent depot
#

Anyone know if there is any way to catch a script error in order to prevent a script from fully crashing? Shame that try-catch doesnt.

#

Or can scriptDone/isNull consider an errored out script completed? It doesn't seem to in my testing.

granite sky
#

hmm. Should do. What's your test?

potent depot
granite sky
#

It's unscheduled.

potent depot
#

well, that would do it.

granite sky
#

Write the script handle to a global variable and check it later.

potent depot
#

But a script handler does indeed show as null if a scheduled scrip errors out?

granite sky
#

Seemed to for me.

potent depot
#

yeah, seems a global var shows a null

#

now if only there was some way to detemine if an error had occured or not

noble comet
#
    _unit addEventHandler ["Killed", {
        params ["_unit", "_killer"];
            deadcounter = deadcounter + 1;

        if(westcounter isEqualTo deadcounter) then {
        
            {
                 deleteVehicle _x;
            } foreach unitarray;     
                   end=false;      
        };
    }];``` Can someone help me i need a wait/sleep above the delete vehicle
potent depot
#

Wrap the executed code in brackets and use spawn to run the code scheduled. Pass the arguments through and then you can add any sleep delays you want. Or you can just use it for the deletevehicle part.

potent depot
granite sky
#

They'll dump into the RPT too. I'm guessing you're doing something weird where you want the errors in realtime for some reason.

noble comet
#

Does also anyone know how to spawn ai on a marker via script

granite sky
potent depot
granite sky
#

It's generally not that hard to write crashproof SQF.

#

When you delete an object, vars referencing it become objNull rather than nil.

potent depot
#

Normally I would agree, but for some reason it always seems to find a way, be it through array lengths changing while iterating and stuff like that. Usually it is due to users connecting/disconnecting and the EHs handing those things updating arrays and ai groups being deleted and such though those become null so it can be handled.

#

And since it occurs separate from the scheduled processing loops, that introduces the possibility of such issues.

#

I still need to find and resolve such issues, but using scriptDone adds some redundancy to prevent the system from failing outright in the meantime for end users

granite haven
#

is there a command like getclientState / getclientStateNumber but then for the server to see if the briefing has ended?

#

or do i just server exec this

errant jasper
#

I think time stays at 0 until the briefing has been clicked past.

#

On the wiki getClientState and getClientStateNumber is explicitly described to also work on dedicated server.

granite haven
fickle socket
# warm hedge It does work very finely for me. What vehicle you want to let land?

this works far better ```sqf
_wpDroneDrop = (group ZelenskyysRevenge) addWaypoint [getPos dronebase, 0];
_wpDroneDrop setWaypointPosition [getPos dronebase, 0];
_wpDroneDrop setWaypointType "MOVE";
sleep 3;
while { alive ZelenskyysRevenge && not unitReady ZelenskyysRevenge } do
{
sleep 1;
};
if (alive ZelenskyysRevenge) then
{
ZelenskyysRevenge land "LAND";
ZelenskyysRevenge setVehicleAmmo 1;
};

dreamy kestrel
little raptor
#

when that group is deleted, the waypoints go with it?
yes
what happens to the remaining units?
what remaining units?

unreal scroll
#

Maybe he meant the bodies?
Typically dead units are in their group for a some period of time (up to minute or so), even if there are no other units alive, after that the group removed by the engine (if not restricted), and "group _body" returns null group.

graceful kelp
#

im working on something, i need some ideas on how i can do something
i have a position, and a bearing shooting off from that position drawing an imaginary line across the map
i need to find the closes point on that imaginary line to me

hallow mortar
#

If BIS_fnc_interpolateVectorConstant can be used to generate an array of positions between two other positions (I think it can, but check), then combining that with BIS_fnc_nearestPosition should do it

tender sable
hardy valve
#

Question -

#

Is it possible to log everything thats happening in the game?

#

Scripts etc..

dreamy kestrel
tender sable
graceful kelp
#

i managed to figure something out, gpt is getting pretty good

#

but it feels like im talking my grandma through debugging

tender sable
graceful kelp
#

gpt tried to do something similar to you, but i had a feeling vectors is what i needed and managed to nudge it that way and got this

// Step 1: Define the Line
_lineStartPos = [1000, 1000, 0];  // Example starting position
_lineBearing = 45;  // Example bearing in degrees

// Step 2: Calculate Line Direction and Normalize
_lineDirection = [sin _lineBearing, cos _lineBearing, 0];
_lineDirection = vectorNormalized _lineDirection;

// Step 3: Define Your Position
_yourPos = position player;  // Example: get your current position

// Step 4: Calculate Closest Point
_diffVector = _yourPos vectorDiff _lineStartPos;
_dotProduct = _diffVector vectorDotProduct _lineDirection;
_closestPoint = _lineStartPos vectorAdd [(_dotProduct * _lineDirection#0), (_dotProduct * _lineDirection#1), 0];
_closestPoint;
#

iv got no idea what im doing with vectors myself but this works

#

its not precise perfect

#

but its good enough to a few points that its dosent matter

granite sky
#

It should be precise perfect. Algorithm is correct.

#

last part could be better written as _lineStartPos vectorAdd (_lineDirection vectorMultiply _dotProduct)

#

It's a common algorithm so it's the sort of thing that GPT is capable of regurgitating.

fair drum
meager granite
#
13:20:05 ---------------------------------------------------------
13:20:05 "Frame 118332: HandleDamageVehicle: rhsusf_m1a1fep_wd"
13:20:05 ["207c0f18080# 1814387: m1a1fep.p3d (rhsusf_m1a1fep_wd)","light_r",1.17593,"B Alpha 1-2:1 (Sa-Matra) (rhs_t80u)","rhs_B_762x54_Ball",35,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","#light_r",true]
```Getting this log for `HandleDamage` on RHS tank. `#light_r` is obviously not a `HitPoints` config class, what is it then?
ivory lake
#

reflector have their own hitpoint stuff

#

engine driven

meager granite
#

I guess this string is built from

getText(configFile >> "CfgVehicles" >> "rhsusf_m1a1fep_wd" >> "Reflectors" >> "Right" >> "hitpoint")
```=>`"Light_R"` ?
ivory lake
#

Yea

#

what gets real fun is there can be two light hitpoints with the same name

meager granite
#

Guess its not documented because hit point name is a semi-recent thing in HandleDamage

cold pagoda
#

Hello! I have a question. I am having trouble destroying the "Land_DragonsTeeth_01_4x2_new_F" dragon teeth and I think they cannot be destroyed. I've looked at "HandleDamage", "MineActivated" and "HitExplosion" Eventhandlers but I'm not entirely sure how MineActivitated and HitExplosion works. HandleDamage didn't work as the damage of the object stayed at 0 and never went up. My goal is to just delete these once explosives charges have been used on them. What I've tried:

this addEventHandler ["HandleDamage", { 
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPoint", "_instigator", "_hitIndex"]; 
 
        if (_damage >= 0) then { 
        deleteVehicle _unit;
    }; 
}];```

```sqf
_projectile addEventHandler ["HitExplosion", { 
    params ["_projectile", "_hitEntity", "_projectileOwner", "_hitSelections"]; 
 
    if (_hitEntity isKindOf "Land_HBarrier_01_line_3m_F") then { 
        hint "Barrier hit by explosion!"; 
        deleteVehicle _hitEntity; 
    } 
}]; 

Any ideas?

ivory lake
#

as setHitpointDamage just finds the first hitpoint with that name and sets the value

meager granite
#

Thank god for setHitIndex/getHitIndex

meager granite
#

You can use Explosion but it doesn't provide much info about kind of explosion so you won't be able to tell a grenade from a satchel charge

#

HitPart is very complicated but you can achieve your destruction through it

#

Speaking of HandleDamage, how come its called for destructible buildings but not for Land_DragonsTeeth_01_4x2_new_F? Both are simuation = "house". What's the trigger for the EH to work? Existence of HitPoints class?

#

Or destrType? 🤔

#

Yeah, guess HandleDamage doest work for destrType = "DestructNo"

cold pagoda
meager granite
#

Grenades, HE shells, anything that has indirect damage

cold pagoda
lofty oriole
meager granite
hardy valve
#

Have a handful of things I'd like to finally fix - Mainly compatibility issues causing some things to be executed multiple times and some mission initialization issues

#

One thing for example the mission I use might have its own initialization script but since its loaded with mods, the missions loading screen ends but the player isnt actually initialized and loaded in yet since all the mods and stuff are loading. I am not familiar with init stuff so I was hoping I could see the process unfold and work from there.

Is it possible to prolong a loading screen?

fair drum
half sapphire
#

hi guys. any ideas why a AI unit would get out of setUnconcious true after a few seconds then back to it.. then stay in the state?

queen cargo
#

@pliant stream its a common problem that most documentations are either not existing or horrible

winter rose
#

mods

half sapphire
# winter rose mods

yupp- dead and hit animations. luckly he was kind enough to provide the variables to disable it on units. thanks!

half sapphire
#

damn it, that wasn't it.

dreamy kestrel
#

Q: if I am assigning driver, cargo, and ordering in, for AI units in a group, do I still need to addVehicle for the group?
and on the flip side, if, for whatever reason, units must eject the vehicle, because it has been disabled, etc, is there any converse to that?

tender sable
tender sable
#

And leaveVehicle might be what you are looking for at group level or moveOut on the unit level

dreamy kestrel
dreamy kestrel
cobalt path
#

Question, I have this in an if statement

(isNull(_uv80 getVariable ["marki_var_strobeLightRight", objNull])) && {isNull(_uv80 getVariable ["marki_var_strobeLightLeft", objNull])} && {isNull(_uv80 getVariable ["marki_var_strobeLightBack", objNull])}

But I want to replace it with "either one" instead of "all of them"

winter rose
#

you can replace & & with ||

cobalt path
#

I understand I need to replace && with || right? But do I need to change syntax?

winter rose
#

nope 🙂

cobalt path
#

Oh

#

Okay thanks

#

So keep it EXACTLY the same but replace with ||

hardy valve
dreamy kestrel
#

Q: bit off topic perhaps, and I'm not sure it is a modeling or config question, but, for an RHS Ural transport vehicle, reporting typeOf, fullCrew roles, and hit points, how does this thing have EIGHT wheels? or is it loosely based on a HEMTT base platform, perhaps?

curious, especially if I am interested in watching wheel damage status, for disruptions, dismount triggers, etc.

[
  "RHS_Ural_Open_MSV_01"
  , ["driver","cargo","cargo","cargo","cargo","cargo","cargo","cargo","cargo","cargo","cargo","turret","turret","turret","turret"]
  , [
    ["hitlfwheel","hitlf2wheel","hitlmwheel","hitlbwheel","hitrfwheel","hitrf2wheel","hitrmwheel","hitrbwheel","hitspare","usespare","hitfuel","hitengine","hitbody","hitglass1","hitglass2","hitglass3","hitglass4","hitrglass","hitlglass","hitglass5","hitglass6","hithull","#l svetlo","#l svetlo","#p svetlo","#p svetlo","#l svetlo","#p svetlo","#searchlight","#l svetlo","#p svetlo","#cabin_light"]
    , ["wheel_1_1_steering","wheel_1_2_steering","wheel_1_3_steering","","wheel_2_1_steering","wheel_2_2_steering","wheel_2_3_steering","","spare1","","hit_fuel","hit_engine","karoserie","glass1","glass2","glass3","glass4","","","","","","l svetlo","l svetlo","p svetlo","p svetlo","l svetlo","p svetlo","searchlight","l svetlo","p svetlo",""]
    , [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
  ]
]
fair drum
cold pagoda
#

So I got this working pretty good! But, I'd like to make it to where only certain classes are able to destroy the object.

this addEventHandler ["Explosion", { 
    params ["_vehicle", "_damage", "_source"];
    if ((_source distance _vehicle) < 10) then {
        deleteVehicle _vehicle; 
    };
}];```

How can I find out what `_source` is?
#

or like, how can I findout what is returned in _source?

granite sky
#

You test it, I guess.

cold pagoda
#

lol yea I get that, but how would I test that? I assume maybe a variable?

granite sky
#

I prefer diag_log. Some people prefer systemChat. They are wrong.

cold pagoda
#
bluh = this addEventHandler ["Explosion", { 
    params ["_vehicle", "_damage", "_source"];
    if ((_source distance _vehicle) < 10) then {
        deleteVehicle _vehicle; 
    };
}];
#

ohhhh

#

lmao I totally could of just done

hint format ["Object: %1", _source]
obtuse crescent
#

hello newbie here.. is there a way to make this artillery unit with unlimited ammo in zeus???
I kinda want to curate a mission with non stop artillery barrage

tough abyss
vapid scarab
#

Hey. Im writing a draw event handler for the map screen. Any one have any reference for what a good runtime for the function is (or rather how long the function runs)?

meager granite
#

Nevermind, thought _source is shot parent. Makes things much easier then.

granite sky
#

what is _source? :P

meager granite
#

Could use an update in wiki

#

I wonder if my recent ticket to fix missing projectiles from HitPart also fixed it for Explosion

granite sky
#

If it's a vehicle explosion then the vehicle instead?

meager granite
#

FuelExplosion its a projectile too, I think you can catch it in HitPart as well

granite sky
#

The one where they go pop when killed, whatever that is :P

meager granite
#

getText(configFile >> "CfgAmmo" >> "FuelExplosionBig" >> "simulation") => "" 🤔

meager granite
#
12:29:43 =========================================================
12:29:43 "Frame 173426: HandleDamageMan: B_Soldier_F (ALIVE=true)"
12:29:43 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",0,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",false]
12:29:43 ---------------------------------------------------------
12:29:43 "Frame 173426: Explosion: B_Soldier_F (ALIVE=true)"
12:29:43 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)",0,"<NULL-object> ()"]
#

(allowDamage false)

meager granite
#

Interesting that this fuel explosion doesn't trigger HitPart but does trigger Explosion

#

SmallSecondary does trigger everything properly and appears in Explosion on dev build (not sure if it doesn't on stable, didn't test yet)

#
12:54:34 #########################################################
12:54:34 "Frame 92661: HitPart: B_Soldier_F"
12:54:34 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","<NULL-object> ()","1814749: empty.p3d (SmallSecondary)",[23513.3,18237,2.23831],[0,0,0],["leftfoot"],[5,2,5,1,"SmallSecondary"],[-0.790335,-0.612675,-0.000232657],0.103592,"a3\data_f\penetration\meat.bisurf",false]
...lots of HitParts...
12:54:34 =========================================================
12:54:34 "Frame 92661: HandleDamageMan: B_Soldier_F (ALIVE=true)"
12:54:34 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",0,"<NULL-object> ()","SmallSecondary",-1,"<NULL-object> ()","",false]
12:54:34 ---------------------------------------------------------
12:54:34 "Frame 92661: Explosion: B_Soldier_F"
12:54:34 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)",0,"1814749: empty.p3d (SmallSecondary)"]
#

You can script-create SmallSecondary though but not FuelExplosion or FuelExplosionBig though

#

Some hardcoded magic again I assume

ivory lake
#

yeah fuel explosion is hard coded, no idea why its missing a simulation tho

#

smallSecondary is only spawned via script (even vanilla) it's one of the killed eventhandlers

pulsar bluff
#

whats the easiest way of determining if an entity is an enterable vehicle

#

right now working with ```sqf
((crew _v) isEqualTo []) && // if false then its obviously a vehicle with crew
{((_v emptyPositions '') isEqualTo 0)} // no empty positions and also empty

warm hedge
#

Enterable, as in? It is a vehicle, not a prop, neither a drone?

pulsar bluff
#

i guess ya

warm hedge
#

Guess checking its config or something is not really better than your solution

hallow mortar
#

unless that also catches drone crew, but I don't know whether that's the case

winter rose
#

I do think so

#

but there also is an isUAV config entry so there is that

hallow mortar
#

There's unitIsUAV command as well. Maybe faster than manual config lookup...maybe?

winter rose
#

ah true, forgot about it 😄 yes will be faster 🙂

gritty parrot
#

Hey guys. I used Atom with the ace package for a while. Now i decided to look around for a new script Editor. What can you recommend?

warm hedge
#

I think I can recommend VSCode

winter rose
fair drum
queen cargo
#

OOS will get enums with next version <3

gritty parrot
queen cargo
#

also some other thingy auto s = "foo"; s = s.append("bar"); //s now contains "foobar" ^^

rough dagger
#

Maybe a weird question but.. is it possible to get AI to throw smoke while running? I can get them to throw smoke while stationary but not while running? Cheers 😄

little raptor
#

You can spawn the smoke manually notlikemeow

rough dagger
#

Hey mate 👋

#

I do a fair bit of that currently too 🙂 but I’m trying to get the AI to secure (with smoke) a position they are running to.. with animations etc

little raptor
#

iirc forceWeaponFire did work while they were running

rough dagger
#
_unit addMagazine "vn_m18_white_mag";
[_unit, "vn_m18_white_Muzzle"] call BIS_fnc_fire;
little raptor
#

Did BIS_fnc_fire use forceWeaponFire? think_turtle

#

I don't remember

rough dagger
#

I don't know, I can check when I'm back on the pc

#

Good steer, thanks, I'll take a closer look there 🙂

manic flame
#

Hi, is there an event of some kind to check if the player has changed weapons? (Between primary and secondary, etc...).

This is for a test script related to radio jamming, in which the player is supposed to equip the spectrum device and it should automatically (no actions involved), execute the jammer code.

Thing is, I cant really see where can I check if the player switched weapons to the jamming device.

#

I took a look at SlotItemChanged but its not really what im looking for.

#

I could probably get away with it by doing a while true type of code, but its not really optimal

unreal scroll
#

There is no "weapon changed" EH in A3, but you can use CBA_fnc_addKeyHandler: add the handler to a needed weapon switch key, and inside it check if the current weapon is what you need.

digital hollow
pale glacier
#

Hey guys
I'm trying to understand how to create this and I need a bit of direction
Arrows show that vehicles have square that marks them as potential targets, without even marking them on my own (CUPs non-radar Apache) via radar or something. They are marked automatically.

I wonder if there's any command that allows this feature to be applied on other air assets like drones.
I've been trying to check several commands here, but no luck and I think I'm looking at the wrong place. Is it even vanila thing or CUPs scripted thing?
https://community.bistudio.com/wiki/reportRemoteTarget

errant iron
pale glacier
molten yacht
#

I'm having trouble with this code.

{ if (locked _x == 0) then
 {setVariable  ["haveTransport",true,true];}
} forEach synchronizedObjects thisTrigger;```
#

It says "expected Boolean and got nothing" or thereabouts

#

I'd like to check each synchronized vehicles for when they lockpick them

fair drum
#

You don't have a name space to set the variable to

#

_x setVariable ["haveTransport", true, true]

molten yacht
#

Okay

#

Fixed that, still says "Type Nothing, expected Bool"

#
{ if (locked _x == 0) then
 {missionNamespace setVariable ["haveTransport",true,true];}
} forEach synchronizedObjects thisTrigger;```
#

(updated Code)

fair drum
#

Check to see what synch'd objects returns.

unreal scroll
#

I suppose

missionNamespace setVariable ["haveTransport",true]
fair drum
#

Also, you can use the object's namespace with _x if you wish

molten yacht
#

It's a little baffling I guess

#

It's a simple trigger with like 2 cars synced to it

fair drum
#

Yeah but what does it actually return.

#

Oh it's locked _x == 0

molten yacht
#

?

#

yeah if locked is 0 on _x, we want it to run the trigger

#

if any of the vics are unlocked?

#

I'm getting the sense that ForEach doesn't work so well with Trigger conditions

fair drum
#

If the synchronized objects is empty, locked will fail because you didn't give anything

molten yacht
#

Right, but we did sync items

#

we're just gonna add eventhandlers to the vehicles

#

seems simpler

hardy valve
cold pagoda
# meager granite Beware though it will destroy it with ANY explosion

Thank you for the idea! I finished my project for now:

this addEventHandler ["Explosion", { 
    params ["_vehicle", "_damage", "_source"];

    minestring = str _source;
    minevalue = (minestring regexFind ["satchel|rhsusf_m112x1_e|rhsusf_m112x4_e"]) select 0 select 0 select 0;

    if (!isNil "minevalue") then {
        if ((minevalue find "rhsusf_m112x1_e" >= 0) || (minevalue find "rhsusf_m112x4_e" >= 0)) then {
            if ((_source distance _vehicle) < 5) then {
                deleteVehicle _vehicle;
            };
        };
        if (minevalue find "satchel" >= 0) then {
            if ((_source distance _vehicle) < 10) then {
                deleteVehicle _vehicle;
            };
        };
    };
}];```

This will only delete the dragon teeth depending on the type of mine used to get around ingeneral explosion handler!
obtuse crypt
#

Does anyone have an idea how to remove faces voices and insignia from Ace 3 Arsenal?

fair drum
sullen trellis
crystal iron
#

anyone have a shop/shop menu script with an example for each object like vehicles, weapons and items im new to scripting so a heads up on where to paste would help i use VSC for scripting

obtuse crescent
terse tinsel
#

do you know any script that disables sprint for AI?

winter rose
#

limitSpeed I believe

terse tinsel
terse tinsel
winter rose
#

ah crap yes :D mb, old ways die hard 😄
glad you found it 🙂

terse tinsel
#

🙂

kindred zephyr
#

🙂

dreamy kestrel
#

Q: I have a use case for an AI group to be given a 'move to' waypoint. the raw case is, they may be on foot, so literally marching to said WP. that's easy.

the more elaborate second and a half of the use case is, the group may be ordered into a vehicle. assuming once they have all loaded, should I delay the waypoint until they have all loaded? i.e. so driver does not take off without them.

the half use case after that is, when the vehicle asset is disabled within thresholds for any reason, I want for the group to dismount and continue on foot.

with either of these cases, negotiating the space between ordering in and/or leaving the asset, and their actually negotiating that request.

so the underlying question beneath all this is, disposition towards waypoints in general. or would it just be simpler to regroup the units and issue fresh 'move to' waypoint?

winter rose
#

the group may be ordered into a vehicle. assuming once they have all loaded, should I delay the waypoint until they have all loaded? i.e. so driver does not take off without them.
if AIs, they will wait until the vehicle is optimally loaded (filled || everyone on board) then go

#

the half use case after that is, when the vehicle asset is disabled within thresholds for any reason, I want for the group to dismount and continue on foot.
they will

dreamy kestrel
#

hmm okay, so if I understand correctly, best to defer until all in, then send the waypoint.

winter rose
#

(I might be wrong, AI is not a science but more like magic 😄)

dreamy kestrel
#

understood fair enough. will tinker with it. thanks...

fickle socket
opal zephyr
#

Does anyone know if the player object exists while in the respawn screen?
Like would this return true if the player has died and is waiting for a respawn time waitUntil {!isNull player};?

#

hmm.. it seems to think the player still exists

winter rose
#

alive player = false if null, false if dead

opal zephyr
#

Smart Lou 😂

surreal gorge
#

aight guys, im stuck. I want this piece of script to check if other teams have more than the min player count (_minPC) before allowing the purchase of a vehicle class, but this is just telling me not enough still when there are more than enough. any ideas? heres my example

        _sideWest = west countSide allPlayers;
        _sideEast = east countSide allPlayers;
        _sideGuer = independent countSide allPlayers;
        _pilotArray = ["B_Plane_Fighter_01_Stealth_F"];
        _minPC = 1;

        if (_class in _pilotArray && ((_sideWest <= _minPC && playerSide != west) || (_sideEast <= _minPC && playerSide != east) || (_sideGuer <= _minPC && playerSide != independent))) exitWith 
        {
            hint "Not enough players on at least one opposing team to buy a jet!";
            playSound "FD_CP_Not_Clear_F";
        _price = -1;
        };```
#

oh maybe its the ORs...i'll have to rethink it

#

i think i needed >= so it is false when enough people are on and it passes to the rest of script

meager granite
#

If just one then yes, you need to swap for >= check

surreal gorge
#

i think i figured out my error, i didn't have anyone on indie when i tried so of course its true && true - it was working as intended.

#

oopsies

meager granite
#

Why does removeBackpack creates a ground weapon holder? 🤔

#
addMissionEventHandler ["EntityCreated", {diag_log ["EntityCreated", _this, typeOf _this]}];
removeBackpack player;
```=>

12:16:48 ["EntityCreated",2afbba3eb00# 1823200: dummyweapon.p3d,"GroundWeaponHolder"]

#

Only if you have a backpack, but still

fair drum
#

how long does the weapon holder last?

#

does it get deleted quickly after?

meager granite
#

Yeah, deletes the same frame

#

Still weird

fair drum
#

I wonder if its because of the separate container that the player uses as the backpack needs to be emptied, so they have it create a ground weapon holder, store the stuff in it, then delete it. does the holder have any items that frame?

meager granite
thorn saffron
#

Is there a way to easily get the max range at with gunfire from a particular gun is heard? I'm looking at the configs now but it's a mess of sound shaders and sound sets, and it's not something standardized I think. I want to make a solution that will work for any and all weapons.

meager granite
thorn saffron
meager granite
#

You need to get soundTypeIndex from muzzle, then pick index from weapons's sounds, go into that subclass, walk through each shader, select max range.

#

Should pretty easy

#

Also cache it in hashmaps so you don't have to do it each time

#

By weapon-muzzle pair or something like that

thorn saffron
#

Good point on caching the results.

fair drum
#

there a command to detect if a player is transmitting voice? vanilla.

winter rose
#

I don't think so, you may get it by hooking on UI but that would be janky

fair drum
#

off to request a EH for it lol

meager granite
meager granite
#

even if you have VON toggled but player is transmitting nothing, it will be -1, otherwise >= 0

umbral oyster
#

gameValueToJson this will work in A3?

chrome hinge
#

greetings, im trying to use test addEventHandler ["Fired",{params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; if (_this select 1 == "launch_NLAW_F") then { "guidedlauncher" setMarkerPos getPos _unit; };}]; To move a marker at place where guided launcher is fired. How can i include a list of launcher classnames to look for instead of using one classname?

winter rose
little raptor
hallow mortar
# chrome hinge greetings, im trying to use `test addEventHandler ["Fired",{params ["_unit", "_w...

If you've done that params then you don't need to use _this select 1, you can use _weapon since you've already given it that nice tidy variable name with params.

You can use in to find out whether a string (e.g. the weapon classname) is in an array of strings (e.g. a list of classnames), but beware it's case-sensitive. You can sort out the case-sensitivity by forcing everything to be lowercase. So:

if ((toLower _weapon) in (["array", "Of", "classNames"] apply {toLower _x})) then {
  // do stuff
};```
umbral oyster
hallow mortar
little raptor
still forum
hallow mortar
little raptor
#

should leave it as it is

#

it doesn't throw error tho. worst case scenario, the returned string is corrupted

#

yeah it gets corrupted

#

toLowerANSI "AФ" returns "a��"

hallow mortar
#

Interesting

fervent wyvern
#

hi, how can i play a custom sound for just one player on a server?

chrome hinge
stray flame
#

quick question
whats the best way to teleport something
I want a thing to teleport to a point when trigger goes on
havin issues with setPos

winter rose
opal zephyr
#

Hello, im getting this error while using uiOnTexture. It seems to only happen on a server when a client renders a display that was already rendering

#

my gpu is not running out of memory, and my ram isnt either

#

Its dumping this over and over into the rpt file

#

maybe its my pagefile?? Weird tho since I have plenty of ram

granite sky
#

@opal zephyr Dedmen might be interested.

opal zephyr
#

increasing pagefile fixed it lol

granite sky
#

Windows always uses the pagefile when something's allocated and not used yet.

still forum
opal zephyr
#

So am I just stressing it too hard that its running out of memory or something? Is there a solution to prevent hard crashes for people who might not have a lot of memory or a pagefile? Like creating a buffer that loads things individually for example

winter rose
stray flame
#

I want to teleport a target

#

from point A

#

To grid B

#

at the time of a trigger

winter rose
#

setPosATL = Above Terrain Level
setPosASL = Above Sea Level

stray flame
#

ah

#

I'll try ATL

granite sky
#

@opal zephyr Nah, I think that's just how default textures work in D3D11. When you allocate space on the GPU, it also allocates "backing memory" in case of a task switch.

#

So fundamentally you need a good chunk of pagefile.

tepid vigil
#

Hey, is createHashMapObject currently broken on stable or is there something that I don't get? The following code (directly copy pasted from one of the biki examples) errors,

_self set ["MyVehicle", _newVehicle]; -> error type string, expected number

private _temporaryVehicle = [
    ["#create", {
        params ["_vehicleType", "_vehiclePos", "_lifetimeSeconds"]; // handle constructor arguments
        private _newVehicle = _vehicleType createVehicle _vehiclePos;
        _self set ["MyVehicle", _newVehicle]; // Store the vehicle inside the object for later

        // because _self is passed as parameter, it will be referenced by the spawned script until it ends.
        [_lifetimeSeconds, _self] spawn { params ["_lifetimeSeconds", "_self"]; sleep _lifetimeSeconds; };
    }],
    ["#delete", {
        deleteVehicle (_self get "MyVehicle"); // delete the vehicle when we go away
    }],
    ["MyVehicle", objNull] // placeholder, this is not needed
];

// create a temporary RoadCone, at player position, that will delete itself after 5 seconds.
createHashMapObject [_temporaryVehicle, ["RoadCone_F", getPos player, 5]];
still forum
tender sable
opal zephyr
#

Im using this line of code _screen = createSimpleObject ["J3FF_screenTest", AGLTOASL positionCameraToWorld [0,0,0], true]; to create a simple object, later in the same scope I delete it with deleteVehicle _screen. However some/all of the objects dont actually delete... Does anyone have any guess as to why? I cant replicate it when using the console

sage flume
#

I'm fiddling with a mission and I'm getting a "mapsize" error. I know this is vague but I don't know what to include.

opal zephyr
#

is it a black error that pops up on screen? If so, screenshot it and send it

sage flume
#

can I up a /rpt file for you somewhere?

#

might make more sense

opal zephyr
#

normally the error that pops up on screen is pretty specific

sage flume
#

ok.....

little raptor
opal zephyr
sage flume
little raptor
opal zephyr
# sage flume https://i.imgur.com/XZyhjIM.jpg

ya thats pretty specific, it means the variable is undefined, like it says. So somewhere in your fiddling you have either removed where it gets defined or re-ordered it so that it happens after

little raptor
sage flume
opal zephyr
opal zephyr
sage flume
#

ok, well, all I know is how to remove/replace something that is aready there to change something in th emission but scripting, el losto!

opal zephyr
#

How many scripts are there?

sage flume
#

Easier way to answer that is, it is the Pilgrimage mission. I have been playing for many years but sometimes I like to just tweak (simple) things

opal zephyr
#

I have no idea what the pilgrimage mission is

sage flume
#

Your game preference? MP or SP?

opal zephyr
#

I pretty much just mod nowadays

sage flume
#

Wish I couldhmmyes

opal zephyr
#

if there wasnt many scripts it would be easy to find the problem

sage flume
#

It's quite extensive actually

#

the mission part is quite small but all the scripts go on forever

opal zephyr
#

Alright. If there is a preinit somewhere in the files then maybe the variable is cba based and defined through the menus

little raptor
#
arr = [];
{
   ...
   arr pushBack _screen;
   deleteVehicle _screen;
} forEach...
opal zephyr
#

Alright

little raptor
opal zephyr
#

ok I verified with a counter after deleteVehicle. out of 260 loops, it only reaches the end the FIRST 160 times, after that it doesnt

opal zephyr
#

Its getting stuck in the waitUntil {!isNull (findDisplay _uniqueUIName)}; section

warm hedge
#

Stuck as in?

formal nymph
#

_selectLoot = selectRandom _lootPool;

_triggerPos = getPos damLoot1;

_lootPos = _triggerPos vectorAdd [0, 0, 1];

_spawnedLoot = createVehicle [_selectLoot, _lootPos, [], 0, "NONE"];

hint format ["Loot spawned: %1", _selectedLoot];```

I'm trying to make a single item spawn within this large array of items in the same position as a trigger I have placed on the ground, but this error pops up and no item spawns at all, but my hint shows "Loot spawned: any".
I may need some help.
sage flume
#

@opal zephyr would you be interested in looking at a mod that I find would be cool

opal zephyr
warm hedge
#

Then you're misunderstanding something

opal zephyr
sage flume
#

just asking if you want to make it...from scratch

tender sable
opal zephyr
warm hedge
#

Not sure about your intention there, is it ui2tex attempt?

opal zephyr
formal nymph
warm hedge
tender sable
#

the only thing I didn't understand is why vectorAdd? so it appears 1m above ground? what happens if you just eliminate or comment out _lootpos and just use _triggerpos? unsure about the zeus thing

opal zephyr
#

here is how its created:

_uniformString = (toLower (uniform _unit)) regexReplace ["[^a-z0-9]","x"];
private _uniqueUIName = format["%1_%2_%3", getObjectID _unit, _forEachIndex, _uniformString];
warm hedge
#

One thing is it is a case sensitive to pick a display using unique name

#

But as you might already guessed I don't think that's a case

opal zephyr
#

Its stored in a variable in the same scope, and doesnt change before getting to the display creation or find display.

formal nymph
#

i think i know where I messed up

#

Nevermind, still not working lol

hushed tendon
#

There a way to keep an objects texture but change the transparency or alpha channel of the object? So it is slightly see through

astral tendon
#

This needs a note: the waypoint "TR UNLOAD" is broken for vehicle spawned with CreateVehicle, it work with BIS_fnc_spawnVehicle
https://community.bistudio.com/wiki/setWaypointType
Source here and I also tested it: https://forums.bohemia.net/forums/topic/167810-heli-scripted-waypoints-tr-unload-getout-not-working/

meager granite
#

So in short - no. In practice there are rare exceptions

opal zephyr
meager granite
#

To avoid these waitUntils, create your own display that does onLoad so your display is ready right away after ui2texture goes into action (you see the texture in game)

#

To pass arguments I use a hashmap with key being that unique display name

opal zephyr
#

I dont really understand what you mean with the onLoad.. Could you give an example?

#

Dedmen has tried to help with this a little too

meager granite
#

You own custom display's onLoad event defined in the display config

#

It will fire exactly when your ui2texture is seen in game and display is initialized, no need for waitUntils