#arma3_scripting

1 messages Β· Page 762 of 1

granite sky
#

I don't know where you got this idea from but it's wrong.

fair drum
#

player is always the player object itself

versed widget
#

interesting, than i must be wrong

granite sky
#

Now vehicle player is the player object on foot and the vehicle if in a vehicle.

little raptor
#

but that's wrong ofc

granite sky
#

Vehicle names are inherited from commander group or something, so typeof vehicle player is more illuminating.

versed widget
#

i think now i understand, i was using fired instead of firedMan eventhandler lol
because when using fired it triggers for the whole vehicle

#

including the whole crew inside

limpid charm
#

Hi, is it possible to change server parameters dynamically? For example, can i change revive mode from basic to advanced without server restart?

winter rose
#

you would still need to restart the mission

limpid charm
limpid charm
#

i tried missionNamespace setVariable ["paramsArray", _newParams] but looks like it doesn't work

cold flower
#

There's always going to have to be a restart

limpid charm
#

got it, thanks

cold flower
#

Some settings are always going to be initialized upon mission loading

#

Some are applied immediately. Others need restart. Usually you'll get a prompt when it might require restart

limpid charm
#

so i guess everything related to revive system you can not change without restart?

limpid charm
cold flower
#

Don't know. Assume everything requires a restart

#

Just prevents issues in the short term

limpid charm
#

thank you

copper imp
#

How would I go about making a trigger activate a respawn point?

drifting portal
#

I looking for the opposite of addItemCargoGlobal, I basically want to remove an item from the vehicle's cargo, how would I go about that?
||and no I will not use clearItemCargoGlobal because that will remove every item not the item I'm trying to specify||

shut carbon
#

Hey @little raptor , i'm trying to export a config using your Advanced Tools.
I'm using the Print Config utility and for example this configFile >> "CfgVehicles" >> "B_RangeMaster_F", I want to print the properties on the right. The properties extracted halt halfway. Only using Include Inherited I can get all properties, but I don't want all the inherited.

little raptor
drifting portal
shut carbon
#

Didn't know that, thought it was. Ok then, i'll find another way. Thanks.

little raptor
#

instead of SQF-VM

drifting portal
little raptor
modern meteor
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
drifting portal
granite sky
#

As far as I know, the only way to delete items from a container with SQF is to save the contents, clear, and re-add.

#

If you want an AI to take stuff then there's _unit action ["TakeWeapon", ..., although it's probably not reliable knowing AI.

drifting portal
#

thanks

cold mica
#

How to I set relative direction? I have an array of relative directions acquired from getRelDir but I would like to apply these directions relative to an object. Using setDir does apply the directions relatively but they are not facing the correct directions.

little raptor
#

I would like to apply these directions relative to an object

cold mica
#

I see I was being vague, I will write more specific

little raptor
#

you can just add the object dir to the relative dir

#
_absDir = getDir _obj + _relativeDir
cold mica
#

that's what I expected but I think the issue lies in the way I acquired the directions. Here is how I did it:

#

testTent is the object, a tent
testBed_* is a bed within the tent

_bedDirections = [];
_testBeds = [testBed_0,testBed_1,testBed_2,testBed_3,testBed_4,testBed_5,testBed_6,testBed_7];
{
_relativeDir = testTent getRelDir _x;

_bedDirections pushBack _relativeDir;
} forEach _testBeds;

_bedDirections

This returns:
[246.072,220.497,148.742,115.078,299.725,325.008,17.6768,52.5782];

The idea is, I am trying to fill every tent with 8 beds each. Each beds position and direction should be added to arrays that will be used to create more beds in every tent. The position, I have figured out with the help of modelToWorld. However, the direction is not the same as my original testBeds.

little raptor
# cold mica testTent is the object, a tent testBed_* is a bed within the tent ```sqf _bedDir...

well first of all you should use modelToWorldWorld, not modelToWorld
you must always use abs positions. modelToWorld is not abs
second of all, I recommend storing the vectorDir and up instead of just a dir
third of all, in your case you can just do:

_bedDirections = _testBeds apply {testTent getRelDir _x};

to set them:

{
  _x setDir (getDir testTent + _bedDirections#_forEachIndex)
} forEach _testBeds;
#

this looks kinda ugly tho

#

well first of all you should use modelToWorldWorld, not modelToWorld
actually in this case it won't matter

cold mica
#

Performance is not important for this script as it runs once at init

little raptor
#

I never said anything about perf meowhuh

cold mica
#

I assume thats why you recommend abs and vectorDir

little raptor
#

no

#

it's more "correct" that way

little raptor
cold mica
#

understood, I'll get back to you if it doesn't work. Thanks

analog flicker
#

Hello guys pls help me

winter rose
#

never! πŸ˜„

analog flicker
#

How to create missile lancher based on Titan MPRL Compact that would with a radar

#

Player would switch ground target in the radar and missile would fly from launcher to 50m above, than find the ground target and destroy it

winter rose
analog flicker
#

Not a mod i would make it for myself

winter rose
#

that doesn't make any difference, you can make a private mod
just that "scripting" won't be enough here

analog flicker
#

Ok thx

fleet sand
#

Hi guys quick question how do i get the name of a weapon. Not the class name but the actual name ?

winter rose
lapis ivy
#

Hello. Is it possible to link the identifier (nickname) of Team Speak to Arma 3, I want people to have the same nicknames in the game and in Team Speak

open fractal
#

Does TFAR/ACRE not already do that?

lapis ivy
#

I don't know, so I want to know from someone.

#

I think it's possible, but I don't know where to look.

tranquil jasper
#

I'm trying to learn more about RscListNBox but the only dialog I know that has it is the virtual arsenal, so I exported it with utils 2...but it has like a billion controls...

#

that's not a question, I just want to share my misery

tranquil jasper
lyric portal
#

Good day! Ahh, so these go onto the init?

orchid stone
#

Anyone have a better way to randomly reduce an array?

_list = _list select {selectRandom [true,false]}
granite sky
#

If you want the chance per element to be independent then that's about as good as you're going to get. random 1 < 0.5 will do the same thing at about the same speed.

fair drum
orchid stone
#

i like that, pretty clean

orchid stone
clever dagger
#

Hey all πŸ‘‹
I'm trying to get an array of classnames of all playable units in CfgVehicles.
Is there a way I can sort entries that are specifically a playable unit?

granite sky
#

hmm. There's an isMan variable for CfgVehicles but I'm not sure if that strictly equates to playable units.

orchid stone
#

hmm... anyway to setdamage 1 to a building without playing the animation/sounds before it turns into a ruin?

#

guess i can just delete the building and use createsimpleobject

open fractal
#

have you tried this

willow plume
orchid stone
velvet merlin
#

is it recommended/good practice to remove HandleDamage from dead units?

winter rose
winter rose
velvet merlin
#

dead infantry take a few seconds to be no longer simulated i think. havent check yet if HD still triggers or has its internal alive check anyway

proven charm
#

Why does setFeatureType allow only 200 dynamic objects? I'd like to see all the objects from an aircraft

#

within object view distance

winter rose
#

it is to prevent such saturation, so a performance safe-ceiling

proven charm
#

I tested the command but it didn't seem to do anything.....

#

units are visible just the same

ebon citrus
proven charm
#

what about vehicles?

ebon citrus
proven charm
ebon citrus
proven charm
#

in veh init

ebon citrus
proven charm
ebon citrus
#

How far is the tank?

#

1 for that command stands for object render. If you want it to render based on terrain render, then use 2

#

Otherwise the render distance is capped by the object setting

proven charm
ebon citrus
#

And when does it disappear from view?

proven charm
ebon citrus
#

If you want to see it from further than stabdard object view distakce, use fetaure type 2

proven charm
ebon citrus
#

I givr up

cosmic lichen
#

Make sure the command returns true when you execute it

#

There is a engine limit and it also counts map objects etc. So perhaps the command never worked for you.

#

Also, the effect is local. So make sure it's executed on all machines

proven charm
#

i would think the object would be visible by object view distance by default, i guess not then

#

so IDK what that command is really supposed to do

ebon citrus
#

Youre just not reading

proven charm
#

"1 - Object is always visible within object view distance" ?

ebon citrus
#

Read the full doc

proven charm
#

"Enable/disable object as a feature/landmark." -- guess I dont know what that means

ebon citrus
#

Stop trying to be a smartbuttocks and read it

proven charm
#

I read the whole wiki page

ebon citrus
#

Good

#

Now you know what it does

proven charm
#

not really

ebon citrus
#

Ok, read it again

#

Until you do

winter rose
#

bruteforcing knowledge

proven charm
#

umm what does "feature/landmark" really mean?

still forum
#

Continue reading past the first sentence

proven charm
#

lol

halcyon arrow
#

how would I detect if a parachute is open

ebon citrus
#

Parachutes are vehicles

#

The player is placed into the vehicle

#

You can also get the animation stage of the chute, i think

#

But it's open pretty much as soon as you use it

halcyon arrow
#

I'm trying to create a script that opens a parachute at 100m on my server for fresh spawns

#

is that possible?

ebon citrus
#

Spawn a parachute vehicle and place the player in it

#

There are 2 variants in vanilla arma. The steerable and non steerable

#

Both found in cfgVehicles

halcyon arrow
ebon citrus
#

πŸ‘

wary sandal
#

Hello, i've been trying for a while now to animate a train with a couple cargo wagons (nothing complex tho, it's just supposed to go in a straight line on flat terrain) through several ways, but none of them worked out for me. (here's the setup: https://cdn.discordapp.com/attachments/735132698603159562/969193592780365894/unknown.png) I've tried using setVelocity on each of the moving objects but the wagon just goes through the rails at some point. I've also tried incrementing the vector on the axis it's sliding, but it just despawns for some reasons, here the relevant code snippets : ```
// first attempt
hint "Activated";
onEachFrame {
wagon1 setVelocityModelSpace [0, -5, 0];
wagon2 setVelocityModelSpace [0, -5, 0];
};

// second attempt
hint "Activated";
onEachFrame {
wagon1 setPos ([
(getPos wagon1) select 0,
((getPos wagon1) select 1) - 0.01,
(getPosASL wagon1) select 2
]);
};

proven charm
#

isn't there a train mod?

wary sandal
proven charm
#

ok

wary sandal
#

and i don't need something too complex

tough abyss
#

Also i saw in other server like a countdown to mission, mean everyone form every time zone will see HIS current hour but i dk how to do it. How can i make one. For my server. Help

pulsar bluff
#

can "fileExists" be used in mission file?

still forum
#

Yes

modern meteor
#

Hi, is anyone aware of a "custom formation script"? You would basically position you squad AI somewhere around the player -> execute the script to store their location relative to the play -> and when you ask them to return to formation they would keep the relative position to the player while moving

pulsar bluff
#

@still forum i posted my request here

still forum
#

Didn't you already make a FT ticket for that weeks ago?

deep loom
#

@fair drum hey dude. Americana1108 from the Armadevs Reddit. Thanks again for all your help so far.

So continuing the discussion from there. I think I'm going to simplify it as much as I can and use the uniform check just to complete the initial mission and then once that mission is done I'm going to have the players respawn in the AAF uniform. Can I use the isTriggerActivated check in onPlayerRespawn.sqf so I can have them respawn in the AAF uniform if that trigger is active, and have them respawn in the NATO uniform if it's not?

fair drum
deep loom
#

Yeah I spawned in a box and once you pick it up and put on the uniform it fires the trigger and completes the task perfectly.

fair drum
#

then yeah you can do it with a trigger activation check, or a variable you make, or by checking the status of the task itself, etc

deep loom
#

Perfect. I haven't had the chance to try it out cause I'm at work but I didn't know if the respawn SQF was able to call triggers in game or not.

fair drum
#

it functions as a standard sqf file that just so happens to be fired when someone respawns

#

you can also use the "Respawn" event handler too/instead

deep loom
#

Is one better than the other, you think? I also have a mechanic in the mission where when players respawn it skips time forward one hour. I had to get creative with some area triggers for that because the sqf only does stuff locally and wouldn't do the timeSkip at the server level.

fair drum
#

there is a better way, but that will come with time and you'll figure that out on your journey, just get something working for you now.

deep loom
#

Yeah that's my main concern right now. Just get it up and running and refine it as time goes by.

#

Right now I'm just Zeusing the mission for players so I can manually correct anything that messes up.

fair drum
#

but as far as skipping time, where are you putting the time skip?

deep loom
#

I set up a medical cargo house for players to respawn into that is locked by default. I put an area trigger that spans the floor of the "hospital" and when people spawn in it fires the timeSkip trigger and unlocks the door, then I have another area trigger on the outside of the door that closes the door when players walk out so no one can walk into the area by accident. There' a failure state on the mission once the in game clock passes 04:00.

fair drum
#

so you want a time skip when some people are playing and some are respawning? you don't think that will be immersion breaking?

deep loom
#

It is a little, but I don't mind the surreal effect of it. I'm planning on doing a time acceleration for a period of time that would advance one hour very rapidly to make the transition smoother, but for now it gets the job done. It's jarring for players but I kind of like that because it evokes an "Oh shit" reaction even if you're not the one that died.

#

The players have seven in game hours to complete the mission. So the idea was to have respawns as a punishment so they think more carefully.

fair drum
#

well to answer your question about time skipping on server, you can remoteExec the command to the server itself

deep loom
#

Ah okay. Yeah I figured there was somewhere I could write that into I just couldn't figure out where, and I was having trouble finding commands than interact with the player respawning outside of the respawn sqf.

#

If I wanted the punishment to be less immersion breaking I suppose I could increase the time acceleration by 1x every time someone respawned, but I feel like that's more forgiving.

#

Or maybe too hard. I'd have to test it out.

coarse dragon
#

Anyone know of a good guide for capturing a infantry movement data and firing data ect

coarse dragon
#

Been trying to use that. But can't get it to even record

#

Not to mention the movement data and stuff has already been filled in πŸ˜’

fair drum
coarse dragon
#

His download has all the Movedata and stuff filled out already

fair drum
#

thats an example mission. use the functions themselves

shadow canopy
#

when using CBA_fnc_addPerFrameHandler, whats the best way to share data that gets updated every execution. I am trying to get the last position of a projectile when ever it impacts something and currently I just save the position using getVariable and setVariable

still forum
#

inside the _args array

shadow canopy
#

but isnt that always the same value everytime?

still forum
#

yes, it passes the same array everytime

#

which is why you can just put it there and it'll stay there

little raptor
#

whats the best way to share data that gets updated every execution
an array

#
onEachFrame {
  {
    _x params ["_projectile", "_lastPos"];
    // blabla
  } forEach my_projectiles;
};

my_projectiles pushBack [_projectile, getPosWorld _projectile];
shadow canopy
#

Okay I think I understand

shadow canopy
#

I meant the player, should have mentioned that

shadow canopy
#

does that mean in the future arma will allow?

little raptor
little raptor
still forum
#

you can also just reuse the PFH's _args array, instead of making a new one

shadow canopy
#

Okay I will take a stab at that

shadow canopy
#

2.10 gonna be wild

shadow canopy
#

Okay cool that worked, lowkey didnt know the values inside the _args array could change, assumed they where always the same from when the pfh started

spare vector
#

can someone maybe look at my code and see if they see any error in it.....

[] spawn {    
 _spawnPos = [player, 300, (RANDOM 360)] call BIS_fnc_relPos; 
 _spawnPos = [_spawnPos, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;
 isNil {  
    _spawnedVehicleArray = [_spawnPoS, 180, "CFP_O_TBAN_Offroad_Armed_01", EAST] call bis_fnc_spawnvehicle;
    _veh = _spawnedVehicleArray select 0; 
    _veh setDir (_veh getDir vehicle PLAYER); 
    _vehCrewsGroup = _spawnedVehicleArray select 2; 
    _wp = _vehCrewsGroup addWaypoint [getmarkerPos "Alta", 180]; 
    _wp setWaypointType "DESTROY"; 
    _wp setWaypointBehaviour "COMBAT"; 
    _wp setWaypointCombatMode "RED";    
  };   
}; 

open fractal
spare vector
#

reused code from prev.. i am not great at code... should i take that out

little raptor
open fractal
#

can you edit your block with ```sqf highlighting

little raptor
#

if you don't know what something is don't touch it

granite sky
#

DESTROY waypoint with position is maybe not a good idea.

halcyon arrow
#

is there a script that saves vehicles that spawn? I'm using exile mod and trying to have persistent vehicles

open fractal
granite sky
#

Otherwise some other script might start messing with the vehicle before you finished the setup.

#

I'm not sure if it prevents engine interruption or not.

little raptor
granite sky
#

Ideally you do the spawn and setDir before a simulation step.

little raptor
#

preventing engine interaction (no simulation)

little raptor
granite sky
#

Oh, I guess that's why unscheduled loops are capped to 10k iterations :P

little raptor
#

isNil makes it unschd
spawn makes it schd

open fractal
#

mixed up scheduled and unscheduled, disregard

fair drum
#

hmmm very interesting. gonna think of some ways I could impliment that

open fractal
granite sky
#

yeah, saves to [profilename].vars.arma3profile.

#

(with some caveats)

#

If you're dumping data in there then you should be a bit careful about it though.

open fractal
#

e.g. [_classname, _position, _direction,_damage,_ammo] as subarrays

granite sky
#

Make sure your var names are properly unique and ideally don't get orphaned.

halcyon arrow
#

I'm not the best at scripts so is there a script that already exsist?

granite sky
#

Usually the trouble there is that you don't want to save every vehicle.

open fractal
#

probably somewhere but I've found some horrifying sqf code through google searches

halcyon arrow
#

my exile server already spawns vehicles but they disappear on restart, and players lose all their items that were in it.

granite sky
#

Also saving container contents is pretty complex.

halcyon arrow
#

I could've sworn i saw something last night.. but can't find it again

open fractal
#

you could do something like add a "GetIn" event handler to players to assemble an array of vehicles that are actually used

#

then run a fat script before shutdown to get position and inventory data and such for vehicles that are still alive

#

inventories would probably be the most annoying to deal with as john said but i don't see why this can't all be saved and loaded from one big old array

fleet sand
#

Hi guys a quick question how can i recursive call a fnc if i have a fnc that is in folder Fnc. named fn_name.sqf and in description.ext is defined ? do i call it TAG_fn_name anyways or is that not a right thing to do ?

open fractal
#

TAG_fnc_name*

fleet sand
#

Hi guys a question i have a question how can i make a fnc that adds time to timer script that i have code:

params ["_time"];

while{_time > 0} do {
    _time = _time -1;
    hintSilent parseText format ["Safe start:<t color='#FFFFFF'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
    if(_time <= 20) then {
            hintSilent parseText format ["Safe start: <t color='#f0b411'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
    };
        if(_time <= 10) then {
            hintSilent parseText format ["Safe start: <t color='#821919'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
    };
    sleep 1;
};

hintSilent parseText "<t color='#299c14'> Mission is a GO!</t>";
grave jungle
#

Wondering if anyone knows where I can see my mod's custom functions using Splendid Config viewer in-game... I'm trying to test and see if my custom mod's custom code was pre-loaded. I see the mod's icon in the game main screen. Nothing in cfgFuncitons.

#

but my mod includes a cfgFunctions.hpp which defines a class called cfgFunctions and the specific names of the functions i've created.

#

not sure if that's enough detail

coarse dragon
#

rec = [player1, 120, 35, true, 2] spawn HLF_fnc_infUnitcapture;

little raptor
coarse dragon
#

i copied evr

#

everything from the video the person done on it

distant oyster
#

alternatively use the Splendid Functions Viewer, it should be listed there too

distant oyster
open fractal
coarse dragon
#

hum

#

how does one define things again

#

I got all the stuff on the mission folder that he had in the video

fleet sand
distant oyster
open fractal
#
    //[getWeaponCargo,getMagazineCargo,getItemCargo,getBackpackCargo]
    //[[classes],[counts]]       
    {
        _x params ["_classes","_counts"];
        private _idx = _forEachIndex;
     
        {
            private _cargoInput = [_x,(_counts # _forEachIndex)];
            switch _idx do {
                case 0: { _veh addWeaponCargoGlobal _cargoInput };
                case 1: { _veh addMagazineCargoGlobal _cargoInput };
                case 2: { _veh addItemCargoGlobal _cargoInput };
                case 3: { _veh addBackpackCargoGlobal _cargoInput };
            };
        } forEach _classes;
    } forEach _cargoData;
``` let's say hypothetically I'm attempting to create a persistent inventory. I notice that this does not account for things like items within backpacks within the inventory. How would I go about retrieving these?
grave jungle
grave jungle
open fractal
grave jungle
#

that's what I'm dealing with.. but it doesn't show the tag (I'm anticipating it would be "CarpetShark") under cfgFunctions.

grave jungle
open fractal
#

referring to skullblits's issue

coarse dragon
#

ya that did it. but he didnt fire 😦

distant oyster
coarse dragon
#

Maybe it doesn't work with rpgs

open fractal
#

everyContainer meowsweats

#

fear

grave jungle
distant oyster
#

yes

hallow mortar
#

If nearestObjects doesn't find anything matching its parameters, does it return an empty array?

still forum
#

yes, what else?

hallow mortar
#

That's what I assumed, but I wanted to check just in case. Sometimes things return nothing or other strange things.

coarse dragon
#

@open fractal thank you

hallow mortar
#

That being the case, how does this cause an undefined variable: _overrideTarget?

_overrideTarget = objNull;
_overrideTarget = ((nearestObjects [_x,["C_Hatchback_01_Sport_F"],400]) select 0);
if (!isNull _overrideTarget) then {```
distant oyster
hallow mortar
#

According to the nearestObjects page, it's supposed to be fine if the select index is equal to or less than the size of the array

#

(well, returns nil, but not zero divisor)

distant oyster
#
((nearestObjects [_x,["C_Hatchback_01_Sport_F"],400]) params [["_overrideTarget", objNull]];
``` is how i would do it
distant oyster
hallow mortar
#

No. In fact, at the time that I'm getting the error, there definitely is not a hatchback within 400m, so nearestObjects will return an empty array. But select (this is what I meant to say before) is supposed to just return nil if you use an index equal to the size of the array (i.e. index 0 for array size 0) rather than zero divisor.

open fractal
#
_overrideTarget = ((nearestObjects [_x,["C_Hatchback_01_Sport_F"],400]) select 0);
if (!isNil "_overrideTarget") then {
#

wouldn't you want to check for nil rather than null ?

hallow mortar
#

I did originally check for nil and it still gave an undefined variable error. The null stuff was meant to make sure the variable is definitely defined first.

distant oyster
crude vigil
#

If it gave an undefined variable error, then you probably did !isNil _overrideTarget instead of "_overrideTarget"

hallow mortar
# distant oyster no select should throw an error when accessing elements that are not there

Then someone (KK πŸ€”) was not telling the truth on the select wiki page:

Usually when select tries to pick up element out of range, Arma throws "division by zero" error. However there are exceptions. Basically as long as index of element you are selecting is less then or equal to array size, you will get no error.

[] select 0;        // ok, result is nil
[1,2,3] select 3;    // ok, result is nil
[1,2,3] select 4;    // division by zero```
hallow mortar
distant oyster
#

i swear to god KK, I am firing up arma now

open fractal
#

regardless isNull won't work with an undefined variable right?

distant oyster
#

that too

crude vigil
hallow mortar
distant oyster
#

huh KK is right. what a weird behaviour

crude vigil
#

You wont get used to it meowtrash

grave jungle
distant oyster
#

also thank @little raptor for writing that tutorial πŸ˜‰

elfin comet
#

Is there a way that I can put in the debug console in the editor iterate over a particular classname and replace it with something else? KAT Medical updated and added their new stuff to the Advanced ACE Medical and I need to replace the ones already in my mission with the new versions. I would usually just hand place them again but there are, like 80 of them, set in buildings spread through-out a city.

distant oyster
#

there is all3DENEntities

hallow mortar
#

You can multi-select the relevant objects in the left panel, rightclick > attributes and at the top change what type of object it is (or change the inventory for all of them)

#

or open the mission.sqm in a text editor and find & replace the classnames :U

brazen lagoon
#

has anyone ever managed to automatically run tests on PRs for arma sqf?

tough abyss
#

Hey Guys i need help how can i make the script that says the timezone of each member in server and time goes?

brazen lagoon
#

i think i've asked this before but I don't remember if I did

little raptor
#

see:

fleet sand
#

Hi question how can i remoteExecute this line of code ?

hintSilent parseText format ["Safe start:<t color='#FFFFFF'> %1</t>",[(_time/3600), "HH:MM:SS"] call BIS_fnc_timeToString];
little raptor
grave jungle
#

Any ideas on why my custom addon is not finding a script? It's definitely inside the PBO file. I suspect the issue is Addon Name? ..

#

when I browse for the function in the function browser of Eden, I notice that there is no Addon Base

#

but I know that the PBO manager is including a PBOPREFIX of "CarpetShark", because of this:

#

yea, I am probably missing something stupid and fundamental.

grave jungle
#
    myName = "CarpetShark";

    class CarpetShark {
        class scripts {            
            class toggleArsenalPlayerMenu {};
        };
    };
};```
little raptor
#

if you want to keep what you have, you should change your cfgFunctions

grave jungle
#

trying to match file structure with function definitions is hurting my brain

little raptor
#
class cfgFunctions {
    myName = "CarpetShark"; //<- what is that?!

    class CarpetShark {
        class scripts {
            file = "CarpetShark\scripts";         
            class toggleArsenalPlayerMenu {};
        };
    };
};
#

^ that works with your current structure

grave jungle
#

I have no idea what myName is, I picked that up from another tutorial and populated it with my nickname

little raptor
#

well it does nothing

#

remove it

deep loom
#

I'm getting an invalid number in expression error in my respawn script that tries to have the unit respawn in a certain uniform. Can anyone help me out and see what is causing the error?

#

Says the error is on line 5 where the addUniform is but I can't figure out the problem.

#

waitUntil {!isNull player}; unit = player; removeUniform unit; sleep 1; unit addUniform β€œU_I_CombatUniform”; if(true) exitWith{};

distant oyster
#

how are you calling the script? are you running the script scheduled?

deep loom
#

it's in onPlayerRespawn.sqf

#

And it fires off up until the add uniform line. It removes the uniform but then errors out

cold mica
#

remove the last line if(true) exitWith{}; You have no reason to exit unless you are nesting

distant oyster
#

hmm from my test sleep should not be a problem, the respawn event script is scheduled

deep loom
#

I think the problem is pretty definitively on the addUniform line.

#

I even tried forceAddUniform. Got the same thing.

distant oyster
#

try commenting it out then

#

hold on, are those your actual quotes? they should be: "

deep loom
#

God dammit.

#

That's gotta be it.

#

Testing now

#

Yup. That was it. Thank you.

distant oyster
open fractal
rough dagger
#

Hi folks. I have a helicopter with two door guns. I send AI to take both spots. One side is the β€œgunner” spot, and they engage targets at will. The other side is a β€œturret” spot, and they do not engage any targets. Is there a way to make a turret spot another gunner spot using code? Or is there a way to make a turret unit act like a gunner unit?

granite sky
#

Are both AIs in the same group?

#

Just isn't shooting?

rough dagger
rough dagger
#

I am using SOG helis if that makes any diff

granite sky
#

Get in the turret slot yourself and check that you can shoot.

rough dagger
#

Should say .. AI is not in my own group

granite sky
#

I can't say I've noticed AIs being hesitant about shooting from turret positions, although I suppose they might be waiting for the squad leader to assign them a target or something.

rough dagger
#

Ah right maybe .. that’s a good lead .. I will explore that

#

Can a vehicle have more than one gunner do you know? Or is it always just one?

#

Gunner as in β€œgunner”

granite sky
#

Strictly one gunner, I think.

rough dagger
#

Ah I thought so .. thanks

granite sky
#

What combat behaviour and mode are you using? Default aware + yellow?

rough dagger
#

I have not set that .. but another good call

#

In my tests I used a Loach .. the door gunner spot is not the gunner (gunner is co pilot). So if I point the nose at opfor, the CP gunner shoots away (with lethal accuracy). But if I turn so the door gunner can get a shot, they just don’t engage at all. Both door gunner and CP are in the same group.

#

But maybe the group leader is the CP and had not given the order to engage … as I think you are suggesting

granite sky
#

I'm expecting busted config and/or Arma bugs really :P

rough dagger
#

Another test was the UH1D .. right side lights up the enemy, left side does not

granite sky
#

but you'd have to try different behaviours and helis to be sure.

rough dagger
#

Right side is gunner slot left side is a turret

#

I will do more testing ..

granite sky
#

Vanilla ghost hawk has a door gunner on each side, might be an interesting test.

rough dagger
#

Yes!

#

I will do that tomorrow

#

I know that the PF guys are updating the heli configs .. so maybe this is a PF issue, I was only testing with those assets. Should have thrown a vanilla in there too .. good shout

#

Thank you for taking the time to consider my little problem πŸ‘

grave jungle
#

I'm still struggling to get my simple, single script to load from my scratch-built add-on. Anyone have experience with this error message:

#

This is what's in myConfig.cpp / CfgFunctions:

#
    class CarpetShark {
        class scripts {
            file = "CarpetShark\addons\scripts";         
            class toggleArsenalPlayerMenu {};
        };
    };
};```
grave jungle
#

I'm trying to zero in, and I think I have not properly configured the addon's path.

#

if in config, <ROOT> means the game's root directory. The addon path needs to be set manually.

#

Does anyone know how to manually set the addon path? Is that something done during game startup?

#

also .. I have removed the \addons substring

distant oyster
#

You usually use a $PBOPREFIX$ file

grave jungle
#

yea.. I've got that setup now...

distant oyster
#

what does your folder structure look like?

grave jungle
#

maybe I'm packing the pbo wrong

#

sec

#

here it is

distant oyster
#

Drop the @

#

Also are you packing from a P drive?

grave jungle
#

do I pack the addons folder into the PBO?

#

I'm using PBO manager explorer extension

distant oyster
#

yikes

grave jungle
distant oyster
#

I would recommend using mikero's tools or hemtt or even Addon Builder

#

mikero's tools has the added benefit of checking for errors

grave jungle
#

yes, that's good advice for sure. I was really hoping to get this from first principles so I truly understand how it works.

#

I feel like I'm really close too! the namespace shows up in the function browser, as does the TAG, the sub class and the function itself, just the SFQ can't be found

#

so it's got to be a path resolution issue I'm thinking

distant oyster
grave jungle
#

nice is that a working example?

distant oyster
#

this is an example which uses hemtt but should work with mikero's

#

You will find the following $PBOPREFIX$:

x\biki\addons\functions
``` this means that the function from this folder can be loaded with 
```sqf
loadFile "\x\biki\addons\functions\Strings\fn_regexFirstMatch.sqf"
``` for example
grave jungle
#

that's super helpful

distant oyster
#

and to spare you macros:

class CfgFunctions
{
    class BIKI
    {
        class Config
        {
            file = "\x\biki\addons\functions\Config";
            class configDifficultySettings;
        };
``` from https://github.com/arma3/Biki-Mod/blob/main/addons/functions/CfgFunctions.hpp
grave jungle
#

right.. do you understand the "\x" prefix?

#

I think I'm setting the PBO prefix incorrectly

cold mica
#

I have an object I want to throw at a point. I need to get the vector from the object to the point. How would I do that?

This is as far as I have gone:

{
    _closestDropPoint = nearestObject [(getPosATL _x),"Logic"]; // point object will be thrown at
    
    _relativeVector = (vectorDir _closestDropPoint) - (vectorDir _x); // relative vector between object and point ?

    _x setVelocity (_relativeVector vectorMultiply 5); // throw object at point

} forEach _objects;
grave jungle
#

I hear you - use MikeRo or other tools .. that's a good last resort

distant oyster
# grave jungle right.. do you understand the "\x\" prefix?

honestly I have no idea what the original intention was. I just used it because CBA and ACE do the same and I copied their file structure. I didn't link their repos because they are more complex. I now use it to quickly switch between testing and release builds

grave jungle
#

gotcha

#

@distant oyster I'm going to model my folder structure of Biki and I'll report back

distant oyster
#

glhf

grave jungle
#

Do you know what the QPATHOF function does?

distant oyster
#

yeah its short for "Quoted path to file", it takes some predefined macros and assembled them into a string that points to the folder in the addon. i.e. it just expands to \x\name\addons\category\PARAMETER

#

you dont really need it

grave jungle
#

funny story, now I'm getting "Script QPATHOF(Functions)\fn_toggleArsenalPlayerMenu.sqf not found"..

granite sky
distant oyster
grave jungle
#

now I understand your previous comment

#

is there any situation in while the file attribute can be left blank?

distant oyster
#

thats mission exclusive afaik

grave jungle
#

understood

cold mica
granite sky
#

No, their positions.

#

in ASL preferably.

grave jungle
#

here I was trying to remember my high school trig

granite sky
#

I'm not sure what PBOPREFIX files are supposed to do. As far as I can tell, Arma ignores them entirely and just uses the prefix you set on the PBO.

#

If you don't set a prefix, it just doesn't work :P

#

Possibly various addon builders are supposed to use it to set the PBO prefix, but Addon Builder seemed to ignore it.

cold mica
#

Thanks a ton, John. I didnt realize I could just put two points.

grave jungle
#

I'd like to avoid the use of the PBO prefix for this first go around if it's optional. I'm obviously missing something pretty major

#

no matter what I do, I am getting the script not found error. will update when I know more

little raptor
#

If you're using PBO Manager, don't

#

Use Addon Builder

grave jungle
#

ah .. i see

#

took me a minute to parse your text

#

I'll try addon builder next

#

I was thinking I could do this with Sublime and text files

#

and the vanilla PBO manager

little raptor
grave jungle
#

but it's defeating me

#

I imagine having more than 1 module in there

little raptor
grave jungle
#

and when I tried to add the mod locally, I was told that there were no PBO files in the addons directory

#

hmm one sec

drifting sky
#

Does setUnitRecoilCoefficient affect AI? Ai machine gunners tend to fire 99% of their shots uselessly into the sky because of excessive recoil.

grave jungle
#

@little raptor and @distant oyster here's the repo for the simple 1 function mod/addon..

#

I'm getting something wrong. I think it's either the $PBOPREFIX$ or the "file = ..." on line 30 of config.cpp

little raptor
#

Like I said use Addon Builder

#

Also it doesn't use pbo prefix file

#

You have to set it yourself in options

ruby bronze
#

How does one go about adding a reticle to a helicopter that doesn't have one by default? Or just adding a reticle to your screen while in said helicopter, either would work I'm sure

winter rose
#

a mod

ruby bronze
#

Do you know of one that's out there? Or would I need to try making one

winter rose
#

I have no idea, maybe #arma3_config may know more about this πŸ™‚

ruby bronze
#

Good call! I'll ask there, thanks

grave jungle
orchid stone
#

Just double checking...

"#particlesource" createVehicle _x;

will NOT spawn a particle system on client machines right?

#

nvm, for some reason i missed the big blue box on the wiki that says the particle commands are local

grave jungle
#

When I use addon builder, do I choose the ROOT addon folder? or do I choose sub-folders and repeat for each of the mini-addons contained within?

#

man .. "script not found"

#

my life is a disaster right now.

orchid stone
#

try using -packonly (uncheck binarize)

grave jungle
#

no I'm not actually referencing it .. it's more planning for the future. I suppose I could collapse it all into a single set of monolothic folder contents under addons.. just to see

#

somehow this: "file = "\x\CarpetShark\addons\functions\Functions";" is not translating

#

from within CFGFunctions..

#

maybe I should follow a tutorial. Any advice or good youtube videos?

grave jungle
#

Do I need the P drive mounting?

#

oh this second one looks like it's the tits

orchid stone
orchid stone
ebon citrus
drifting portal
#

how do I use this?

#

it seems to have a lot of undefined variables?

#

btw this is my 5th time asking here without getting an answer strangely, would really be appreciated if you reply

warm hedge
#

You need to post your code

drifting portal
#

I'm using

BIS_scriptedMoveEnabled = true;
[this, [getpos this, [0,0,0]]] call BIS_fnc_scriptedMove; // in the init of the unit
warm hedge
#

What is the error?

drifting portal
#

It says rPlaymove is undefined

#

Then RE is undefined

warm hedge
#

Which line?

drifting portal
#

Both line 64

winter rose
#

rPlayMove and RE are Arma 2 MP Framework things

drifting portal
#

Damn

#

The biki page has arma 3 logo on the function

warm hedge
#

Yeah I figured out the same

#

It is there. But broken/won't work

drifting portal
#

Yeah I have noticed when I went through the function tree

#

It said A2OA

winter rose
#

a note shalt be applied for A3

drifting portal
little raptor
little raptor
#

You always build the folder that has config.cpp

stone hornet
#

hey guys, me again, i have been trying to set up ACE medical, however despite having fatal injuries set to never im still being instantly murdered

drifting portal
winter rose
#

yes

drifting portal
pulsar bluff
#

now back to work!

rough dagger
#

Hi again folks, I am trying to get my door gunner to open fire using code, and am using 'forceWeaponFire' as the method. Even though I set the mode to "FullAuto" (and I have checked, this is part of the heli config), the gunner only fires one single shot. Has anyone come across this before?

#
_pilot = currentPilot vehicle player;

if (player == _pilot) then {
    hint "Open Fire";
    _heli = vehicle player;
    _crew = fullCrew _heli;
    _turrets = [];
    {
        if (_x select 1 == "turret") then {
            _turrets pushBack _x;
        };
    } forEach _crew;

    {
        _unit = _x select 0;
        systemChat format ["_unit: %1", _unit];
        _muzzle = currentMuzzle _unit;
        systemChat format ["_muzzle: %1", _muzzle];
        _unit selectWeapon _muzzle;
        _unit forceWeaponFire [_muzzle, "FullAuto"];
    } forEach _turrets;
} else {
    hint "you are not the pilot and have no authority here!";
};
#

(triggered from a CBA keybind)

pulsar bluff
#

you need to put it in a loop

rough dagger
#

gotcha

pulsar bluff
#

oneachframe {forceweaponfire etc}

rough dagger
#

I did wonder .. but I assumed as the mode was fullauto, it would just .. do full auto X)

#

thanks man

pulsar bluff
#

unfortunately not :/

#

there is also the function BIS_fnc_fire

#

look at that too

rough dagger
#

Wilco, thank you

#

is there an equal command to cancel the fire order?

#

like, in this context

pulsar bluff
#

when using the fire commands no, you just have to stop executing the command

#

in script

rough dagger
#

ok mate, awesome!

#

thanks!!

pulsar bluff
#

NP

#

are they just firing or firing at something?

rough dagger
#

kind of both

#

I have a door gunner, which is not the designated gunner, but a turret

#

they will aim at the enemy but rarely fire (this AI is not in my group)

pulsar bluff
#

ah

rough dagger
#

so I am trying to use a keybind to force the gunner to fire .. if they are pointing at enemy, then good hits on target, but if there is no target, they will just shoot, which might be nice for ambient effects (shooting treelines while SOG scrambles for EXFIL etc)

drifting sky
#

Ai do not appear to detect or shoot at invisible targets such as "B_TargetSoldier". Can anybody explain this?

little raptor
#

how do you expect them to go blue-on-blue?

drifting sky
#

no, invisible target has opposite side

little raptor
#

it doesn't

#

B_TargetSoldier is BLUFOR

warm hedge
#

(Which the prefix B_ suggested)

drifting sky
#

I'm sure I'm using the correct side.

warm hedge
#

Which is the actual soldier?

drifting sky
#

when the "real" target is bluefor, I'm creating a "dummy" invisible target on bluefor side.

#

opfor are meant to shoot at it

#

but they neither detect nor shoot at it

little raptor
drifting sky
#

okay?

little raptor
#

create crew for it

drifting sky
#

so, uh can I create an invisible object that requires no crew?

little raptor
#

I don't think so

#

AI don't really engage empty vehicles

drifting sky
#

In arma 2 I could create an invisible target which ai would shoot at. It was of type man i believe.

#

class zeu_Dummy : CAManBase {

#

lifted it from zeu ai

#

However, just putting it in arma 2 and switching out for another model does not seem to work

noble zealot
#

This_ai disableAI "ALL";can increase server FPS?

drifting sky
#

tried giving it the same models used in arma 3's invisible targets

little raptor
#

well a bit

shadow canopy
#

I would like to execute some code while a key is pressed (left click) and then released, I thought BIS_fnc_holdActionAdd would work but I think thats hard coded to use space bar (well whatever action space bar is defaulted to). Tried CBA_fnc_addKeybind but apparently mouse buttons dont work when held. Any suggestions other then trying out https://community.bistudio.com/wiki/inputMouse

little raptor
little raptor
little raptor
shadow canopy
little raptor
#

no

shadow canopy
#

oh wait I see onMouseHolding

little raptor
shadow canopy
#

oh right thats a different holding

#

😦

drifting sky
#

can I use a model directly from a2 in a3?

little raptor
#

Β―_(ツ)_/Β―

#

probably not

#

depends on what the model contains

little raptor
shadow canopy
#

dang

little raptor
#

you have to do that yourself

#

e.g. use modded keybinding

shadow canopy
noble zealot
little raptor
#

add an Activate and Deactivate events
when activated, initiate an each frame loop (e.g. CBA_waitUntilAndExecute)
when deactivated, stop the loop

noble zealot
#

@little raptor but it AI is already with simulation off, disableAI can help to make it consume less CPU power?

shadow canopy
#

Okay I think I understand

shadow canopy
#

I can tell if something has been held if the activated ran, but the deactivated hasnt ran

#

or rather is being held

drifting sky
#

do you know the action for getting the invisible target crew to get into it?

#

driver?

#

gunner?

little raptor
drifting sky
#

I'm doing this in arma 3 right now

#

the a2 version works fine

little raptor
#

createVehicleCrew

digital wasp
#
_stuff = ["stuff","stuff1"]; 
["speaker", "text" selectRandom _stuff] call BIS_fnc_showSubtitle;
``` i need random texts combined with predefined text. would this work?
hallow mortar
#

Almost

digital wasp
#

what should i change

hallow mortar
#

You need either "text" + selectRandom _stuff to combine "text" and a random string, or just selectRandom _stuff to only use a randomly selected string

drifting sky
#

ah it's no use using those built-in invisible targets anyway. They block bullets as well as unit movement.

#

there must be a way of making a proper invisible target though.

bright robin
#

on my way to find how i could do a per player ticket system, somebody passed me this

unit setVariable ["tickets", 3]
broken forge
#

I'm having issues with getting a trigger that is placed in the editor to only fire once when a player enters the trigger. I know this has been covered before, but I've tried everything that I could find and still have had no luck. My trigger has Activation: BLUFOR, Present and for the condition I have sqf player inArea thisTrigger; Then inside the activation I have this: ```sqf
["spawn_0", "site_0", 3, EAST, "East", "OPF_F", "Infantry", ["OIA_InfSquad", "OIA_InfTeam", "OIA_InfAssault", "OIA_InfSquad_Weapons", "OIA_MechInf_Support"]] remoteExec ["jas92_fnc_spawnWave"]; deleteVehicle thisTrigger;

This is what I have for my function: ```sqf
params ["_spawn", "_attack", "_waves", "_side", "_cfgSide", "_cfgFaction", "_cfgUnitType", ["_units", []]];

SpawnEnemies = true;
_wave = 0;

while {SpawnEnemies} do {
    _rdmSquad = _units call BIS_fnc_selectRandom;
    _grp = [getMarkerPos _spawn, _side, (configFile >> "CfgGroups" >> _cfgSide >> _cfgFaction >> _cfgUnitType >> _rdmSquad)] call BIS_fnc_spawnGroup;
    null = [_grp, (getMarkerPos _attack)] call BIS_fnc_taskAttack;
    waitUntil {{alive _x} count (units _grp) == 0};

    _wave = _wave + 1;
    if (_wave < _waves) then { SpawnEnemies = true } else { SpawnEnemies = false };
};

If anyone could help that would be greatly appreciated, thanks.

winter rose
#

and… what's the issue?

broken forge
#

The issue I'm having is that everytime a new player enters the trigger area, another group of ai spawn

winter rose
#

well, yes

  • you did not make the trigger server-only
  • you set the trigger to spawn someone everytime a player enters it
deep loom
winter rose
#

(isn't there a "ANY PLAYER" option?)

broken forge
#

There is an option for any player, and is it really that easy, just set trigger to server only, then in the condition a player in list ?

winter rose
#

not literally that πŸ˜„ but yes

#

isn't there a "ANY PLAYER" trigger option instead of BLUFOR?

broken forge
#

Yep there is an a dropdown in the trigger Activation: "ANY PLAYER"

winter rose
#

if all your players are BLUFOR, just use this

#

(and the default trigger condition, ofc)

hallow mortar
#

The player script command refers specifically to the player of the local client. Since the trigger was not server only, a copy existed on every client, and that copy would activate when that client's player entered the area. All the other copies would remain ready to activate when their client's player arrived.
Setting the trigger to server only, any player, means there's only one copy of the trigger, and that copy will activate when any of the players enters it.

Note: although you just need ANY PLAYER and this as your conditions here, in many cases you can use in thisList instead of inArea thisTrigger for a similar effect.

Local triggers with local conditions can be useful when you have commands with local effect (for example, displaying a hint when the local player enters an area) but you have to be careful.

broken forge
#

So from what I'm gathering I need to set trigger to "ANY PLAYER", condition to "this", serverOnly, and then in the activation field put my remoteExec in?

drowsy geyser
#

hey, how would i know which texture was set for the image?

_randomColor = selectRandom ["images\Blue.paa","images\Brown.paa","images\Green.paa","images\Red.paa","images\Yellow.paa"]; 
image1 setObjectTextureGlobal [0,_randomColor];

i mean if i want something like this:

if (image1 == blue.paa) then {hint "image1 has blue color"}
still forum
winter rose
#

just, why would you remoteExec it to all clients

#

it would run it as many times as there are clients

drowsy geyser
#

but that gives me the path to the whole folder like:
c:\users\xxx\documents\arma 3...
how can i use that in an if then code?

broken forge
#

So I can just use [] spawn jas92_fnc_spawnWave; in the activation field?

winter rose
#

what about your arguments?

broken forge
#

So it would be? ["spawn_0", "site_0", 3, EAST, "East", "OPF_F", "Infantry", ["OIA_InfSquad", "OIA_InfTeam", "OIA_InfAssault", "OIA_InfSquad_Weapons", "OIA_MechInf_Support"] spawn jas92_fnc_spawnWave; deleteVehicle thisTrigger;

winter rose
#

I gueeess

broken forge
#

I'm not quite understanding the question. So if I just need a trigger that is activated when a player enters the area and then spawns my function wouldn't the trigger must need to be setup with activation: "ANY PLAYER" conditon: this and then activated: [] spawn jas92_fnc_spawnWave;this would have the params needed for my function.

winter rose
#

in activated, you put what you want

winter rose
drowsy geyser
winter rose
#

(with an additional ] btw)

still forum
broken forge
#

Thanks for all the help, I'll definitely give it a try once I get home from work today. If it all works then I was overthinking everything way to much, lol

winter rose
drowsy geyser
winter rose
drowsy geyser
winter rose
#

yep
still not recommended πŸ˜„

ebon citrus
#

how likely is it for hashValue to return the same value for the same type of vehicle in 2 different scenarios?

winter rose
#

1 in 10e999 something?

little raptor
ebon citrus
#

ok

#

Because i recorded 2 vehicles with the same hashvalue over server restart

little raptor
#

as Lou pointed out, it depends on netID

ebon citrus
#

both vehicles having been created with createVehicle

#

yep

#

so i just did hashValue _vehicle + hashValue systemTimeUTC to keep track of individuality

#

just to generate a token that is saved for later use

#

this should make sure that it is highly unlikely for 2 vehicles to end up with the same hash value

warm coral
#

i dont understand whats wrong

granite sky
#

Using double double quotes incorrectly probably.

warm coral
#

ohhh thanks gonna try fixing

modern meteor
#

Just posting my question from yesterday again to see if anyone is aware of a "custom formation script"? What I am aiming for is to have a script which allows me to position my AI squad somewhere around the player -> execute the script to store their location relative to the player -> and when I ask them to return to formation they would keep the relative position to the player while moving. For example I could position the AI just in front of me, the script stores the formation and would keep the AI in that formation while the player is moving.

uneven glen
#

is there a way to tell if a script is running in an object init context or a zeus placed objects?

#

this vs _this sort of issue

#

actual question: is it safe / correct to use the object init section in a composition, and how can I ensure it functions for my zeus operators?

open fractal
#

how can I ensure it functions for my zeus operators?
diag_log? diag_activeScripts? systemChat? same way you debug any script

uneven glen
#

if I place the composition in the editor while making the mission, it works.
If I place the composition via zeus in a running mission, it does not work

open fractal
#

did you set this

uneven glen
#

not sure, i'll have to go check

#

no instance of it in the mission, so the default

#

which prevents init, ok, that makes much more sense now

spare vector
#

Can comeone help me change this code so that it spawns a random qty of up to 5 of the planes

[] spawn {    
 _spawnPos = [player, 1500, (RANDOM 360)] call BIS_fnc_relPos; 
 isNil {  
    _spawnedVehicleArray = [_spawnPoS, 180, "sab_fl_bf109e", EAST] call bis_fnc_spawnvehicle;    
    _veh = _spawnedVehicleArray select 0; 
    _veh setPosATL (_spawnPos vectorAdd [0,0,180]); 
    _veh setDir (_veh getDir vehicle PLAYER); 
    _veh setVelocityModelSpace [0,150,0]; 
    _vehCrewsGroup = _spawnedVehicleArray select 2; 
    _wp = _vehCrewsGroup addWaypoint [player, 180]; 
    _wp setWaypointType "DESTROY"; 
 _wp setWaypointLoiterType "CIRCLE_L"; 
    _wp setWaypointLoiterRadius 250; 
    _wp setWaypointBehaviour "COMBAT"; 
    _wp setWaypointCombatMode "RED";    
  };   
}; 
fair drum
spare vector
fair drum
open fractal
spare vector
#

i was asked that yesterday... it was code that i pulled from another mission a friend of mine made

open fractal
#

oh my bad you got a random location

#

all you need is a for loop then you're set

fair drum
open fractal
#

BIS_fnc_relPos is obsolete btw

wary sandal
#

does anyone know why it is returning this error ? I've done everything according to the setVelocityTransformation wiki page. The code : ```hint "Activated";
pos1 = getPosASL wagon1;
pos2 = (getPosASL wagon1) vectorAdd [0, 75, 0];

bob switchMove "ladderCivilUpLoop";

onEachFrame {
wagon1 setVelocityTransformation [pos1, pos2, [0, 0, 0], [0, 0, 0], [0, 1, 0], [0, 1, 0], [0, 0, 1], [0, 0, 1], moveTime bob];
};

#

bob is the player and wagon1 is the object i'm trying to move

fair drum
#

can you translate that error for me? πŸ™‚

wary sandal
#

i thought it would be quite obvious, hold on

#

basically it means error type any, expected array

fair drum
#

ok ty

#

the error must be with pos1 or pos2

#

have you tested their returns?

wary sandal
#

what I just realized is that I'm retrieving the position of the trigger instead of the object

#

i just gotta swap it

#

but i'm not sure it will fix the issue

open fractal
# spare vector Can comeone help me change this code so that it spawns a random qty of up to 5 o...
[] spawn {  
   for "_i" from 0 to (floor random 5) do {
      private _spawnPos = player getRelPos [1500, random 360];
      private _spawnedVehicleArray = [_spawnPoS, 180, "sab_fl_bf109e", EAST] call bis_fnc_spawnvehicle;    
      private _veh = _spawnedVehicleArray select 0; 
      _veh setPosATL (_spawnPos vectorAdd [0,0,180]); 
      _veh setDir (_veh getDir vehicle PLAYER); 
      _veh setVelocityModelSpace [0,150,0]; 
      private _vehCrewsGroup = _spawnedVehicleArray select 2; 
      private _wp = _vehCrewsGroup addWaypoint [player, 180]; 
      _wp setWaypointType "DESTROY"; 
      _wp setWaypointLoiterType "CIRCLE_L"; 
      _wp setWaypointLoiterRadius 250; 
      _wp setWaypointBehaviour "COMBAT"; 
      _wp setWaypointCombatMode "RED";  
   };  
}; 
``` if you need help
fair drum
#

I guess it could also be moveTime

#

if there is no RTM animation playing, will it return something?

wary sandal
#

update: surprisingly enough the issue was indeed the position

little raptor
#

or it's not an object

wary sandal
#

can triggers return positions?

little raptor
wary sandal
#

if it doesn't it would probably explain the problem

wary sandal
little raptor
#

like I said wagon1 was not defined

#

there is no other explanation

fair drum
#

he mentioned his error was expected array got any though

little raptor
#

and become nil

fair drum
#

well it used to be this until he changed it

wary sandal
#

sorry for making it confusing lol @little raptor

little raptor
fair drum
#

well if it was in a trigger, it would have to be thisTrigger anyways

little raptor
#

yeah

fair drum
#

instead of this, so this was still undefined, so yeah I see what you're getting at

wary sandal
#

so that's how you access the trigger?

#

interesting

fair drum
#

thisTrigger, thisList, etc

#

hover over the tooltip and it will say what you can use

modern meteor
spare vector
#

worked like a charm @open fractal thanks

open fractal
#

yw

modern meteor
#

["Primary", [5], "", -5, [["expression", "[units player - [player], execVM ""Primary.sqf"""]], "1", ""]

Getting an error saying Primary.sqf missing when executing the command from the menu. Does anyone know why?

fair drum
#

is the path correct? and does the file exist?

modern meteor
#

yes

fair drum
#

why do you have multiple "" inside each other?

#

you need to use ' instead if you are quoting inside a string

#

or whatever the opposite is that you have, in your case '

granite sky
#

The quotespam is a valid if unreadable alternative.

fair drum
#

very well lol

modern meteor
#

hm i see

fair drum
#

well the problem if it says its missing is either a path issue or an existence issue

#

so make sure you are loaded into your mission and not just a unsaved mission

modern meteor
#

tested with a different file

#

same error

#

the file is definitely there

#

i guess it is something wrong with the code above

fair drum
#

try just executing the file by itself first

modern meteor
#

not exactly sure how to do this

#

i guess from the console?

granite sky
#

What's the context of this code?

fair drum
modern meteor
#

executing a command from a menu

#

which then runs the script

fair drum
#

so its someone elses code then?

modern meteor
#

Leopard was helping me

little raptor
#

just count them

modern meteor
#

let me check again

granite sky
#

yeah there's one missing, but I'm not sure where exactly without the context :P

little raptor
#

and where it is

#

or use VSCode with bracket pair colorization turned on

modern meteor
#

I thought I fixed it now but still getting an error

#

["Primary", [5], "", -5, [["expression", "units player - [player], execVM ""Primary.sqf"""]], "1", ""]

#

This is what I have

#

Thought the brackets are correct now

#

But that doesn't seem to be the case

granite sky
#

If that's a commanding menu entry then the last element should be "0" or "1" for a start.

#

The expression part should actually be an expression, and I'm not sure what you're trying to do in the execVM bit but it isn't valid code.

#

maybe "[units player - [player]] execVM ""Primary.sqf""" if the first parameter to Primary.sqf is supposed to be an array of units.

#

hmm, maybe the "expression" part really is supposed to be just that. Documentation lacking.

modern meteor
#

this is the full code

#

mymod_fnc_showGameHint = {
MENU_COMMS_2 =
[
    ["Submenu", true],
    ["Move", [2], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""CircleStand.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
    ["Sneak", [3], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5], 3] execVM ""Circle.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
    ["Waypoint", [4], "", -5, [["expression", "[units player - [player], screenToWorld [0.5, 0.5]] execVM ""Waypoint.sqf"""]], "1", "CursorOnGround", "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"],
    ["Primary", [5], "", -5, "[units player - [player]] execVM ""Primary.sqf"""

];
showCommandingMenu "#USER:MENU_COMMS_2"
};

["Special Move","move_key", "Move Key", {_this call mymod_fnc_showGameHint}, "", [DIK_U, [false, false, false]]] call CBA_fnc_addKeybind;```
#

but now producing an error and i cant open the menu

#

this is script Primary:

#
if (primaryweapon _x != "") then {_x selectweapon primaryWeapon _x}ο»Ώ};
forEach units group player;

hint "Switching to primary weapon!";```

Not sure if it works as intended because the menu does not open to execute.
#

Basically want to make the AI switch to their primary weapon via the menu

little raptor
#

I suggest you start over

modern meteor
#

but what should this line be?

#

still not clear to me

little raptor
#

everything is already in front of you blobdoggoshruggoogly

modern meteor
#

sorry, i am lost. i thought i followed the suggestions

deep loom
fair drum
deep loom
#

Perfect. Thanks.

mellow scaffold
#

So I have a variable that I am setting/unsetting with missionNamespace setVariable [foo, true, true];, which (AIUI) shoudl broadcast it everywhere eventually. But even minutes later, one of the locations where I'm using it (via missionNamespace getVariable [foo, false];, it stays false. Any idea why that might be? This is in MP, DS and two HCs present.

fair drum
#

foo vs "foo"

mellow scaffold
#

my bad. I am using strings

#

specifically,
missionNamespace setVariable ["SERHAT_active", true, true];
and
private _serhat_active = missionNamespace getVariable ["SERHAT_active", false];

#

These are straight c&p from the mission

granite sky
#

Are you only setting it from one location?

mellow scaffold
#

Yes.

#

The code in the first paste is running in an ACE addaction which is associated with one in-game object.

#

basically a SERHAT object with that action added and nothing else.

granite sky
#

An addAction specific to one client?

mellow scaffold
#

The addition is running in the object's init, but I suspect the actual action-when-triggered might run on a client

granite sky
#

Are you ever setting the variable to anything other than true?

deep loom
mellow scaffold
#

The object is placed editor-side, so I would suspect it to be local to the server.

granite sky
#

@deep loom Nah, skiptime is global effect when executed on the server.

fair drum
mellow scaffold
#

It's basically a toggle, true for "turn on SERHAT" and false for "Turn off SERHAT"

deep loom
#

Roger.

mellow scaffold
#

I am the only player during testing, so it's not racy with multiple people interacting with it

deep loom
#

If I wanted to do a hint message to go with that and I want everyone to see should I still use 2 for that as well?

fair drum
#

[0,-2] select isDedicated

granite sky
#

@mellow scaffold No idea then. Should work.

mellow scaffold
#

I had to stop testing for now since others are using the server. The code worked locally, so I am pretty sure it's some sort of locality issue.

#

I'll do more testing tomorrow and report back

mellow scaffold
#

Intriguing idea.

fair drum
#

just hit the play button again

mellow scaffold
#

With two clients, the var (as seen in the debug console) seems to sync within <1s

#

I -suspect_ the HC is the linchpin here, so I'll dive into that tomorrow.

fair drum
#

I have not. I always just wrote my own intro thingys

#

scratch

#

but for that, like all things UI, I'd probably do that all locally

tidal ferry
#

Hey, important question

#

Are backpack objects, objects?

#

Want to use a trigger that detects when a certain backpack is/is not inside of its area

#

Is this possible?

fair drum
#

yes they are and yes you can

sage heath
#

so im doing an op where the players start off in a c-130 and they parachute out the back, like in immersive halo mod. i got the part where the plane remains stationary until players jump out and then the plane flies off. but, i want the players to basically be flung out the back with some inertia, but i cant figure that part out

#

anyone got any ideas?

fair drum
sage heath
#

they’re leaving themselves

#

they’re standing in the plane which is being attached to an object on the ground

#

they’re not sitting in it

fair drum
sage heath
#

and so the engines are on, plane remains stationary, and simulation is also turned on

sage heath
fair drum
sage heath
#

?

#

wdym

#

so the plane is already in the air, suspended in motion if thats what you mean

#

and when they're ready to jump out, they just walk off the ramp

fair drum
sage heath
#

np its like 4 am so my english is pee pee poo poo

#

so basically speaking heres a timeline of events

  1. players start in the air inside the c-130
  2. ramp opens and they jump off
    2.5 when they jump off, the plane detaches from static object, allowing it to fly away
  3. the players are flung away from the aircraft due to inertia
  4. players land
#

3 is where i need help

#

because, when players jump off the ramp, they just drop like they're in a hot air balloon

sage heath
#

i have seen it done

little raptor
sage heath
#

basically the uhhh idea, came from immersive halo mod, but you need to set everything up before hand on the ground

little raptor
#

Don't the players wonder why the plane doesn't move?! meowsweats

sage heath
#

but i want the set up already done, and players start in the air

#

they cant really see, they're 2000 meters in the air, with clouds

#

and when they jump off, plane starts moving

little raptor
winter rose
#

an Arrowhead mission was like that iirc

little raptor
#

Once they're in halo pose, do a setVelocity which throws then in a vector towards the back of the plane

sage heath
#

oooh

#

interesting

#

sooo how do you go about doing that?

open fractal
#

you can use velocity to get the velocity of the plane itself

little raptor
#

Attached

open fractal
#

but doesn't the plane move after?

#

i think im getting this backwards

sage heath
#

so i put a trigger inside the cargo bay, when all players left, plane is detached and begins flying

open fractal
#

do you want the player to have the velocity of the plane or be thrown out the back

sage heath
#

the players to have...well hard to explain

sage heath
#

basically, when you paradrop in game the actual way you get some inheritted(?) inertia from jumping out said plane, i want to do that

open fractal
#

you could set the velocity of the players to that of the plane as soon as the plane starts moving

sage heath
#

so rip me :p

open fractal
#

it'd be hard to do in an immersive way since you want to have the players jump out with inertia like the plane is moving but it's not

sage heath
#

not necessarily jump out with inertia, but just get the feeling of being flung out is good enough

#

i played in a mission where this is the case

#

and i think leopards method is whats used

#

cuz the moment i walked off the ramp i immediately got flung out the cargo bay

#

it is likely, thats what happened

little raptor
#

For the velocity, you can do

player setVelocity (plane vectorModelToWorld [0, -10, -2])
#

The loop can be:

waitUntil {"halo" in animationState player}
#

God I hate mobile discord

sage heath
#

they really need to make discord ti-84 honestly

#

anyways

#

so where about do i put this in?

little raptor
#

The event handler:

player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_this#0 setVelocity (plane vectorModelToWorld [0, -10, -2]);
_this#0 removeEventHandler ["animStateChanged", _thisEventHandler]
}
}]
#

I'm tired from typing all that on mobile 🀣

sage heath
#

im sorry to hear πŸ˜…

little raptor
#

Then test

sage heath
#

ah

#

ok brb gimme like 5

little raptor
sage heath
#

it'll most likely be plane1

manic sigil
#

@limber crypt thats going to depend on who is doing the talking, and what theyre going to say, and to whom.

I mean, not really, but its good to keep those things in mind.

If youre using the basic chat system, then itll be something along the radioChat lines: https://community.bistudio.com/wiki/sideChat

If you want to do something more subtitle-y or longwinded, Id suggest https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_playSubtitles .

The former will display once, but getting another dialog to trigger after it will require a little configuring in your trigger. The latter has a built in delay mechanic, but requires a bit more setting up itself.

sage heath
#

also, is there i possibility i can beef up the velocity a little bit? still a little weak but it works

sage heath
#

is there which one i need to specifically do?

little raptor
little raptor
#

-2 is downward

sage heath
#

the 0?

little raptor
#

Guess

sage heath
#

upwards?

#

hey you said guess XD

little raptor
#

Right

little raptor
sage heath
#

ah

#

well i tried :p

#

hey i just realized

#

the eventhandlers actually not working...funny thing is, when it starts out the player already starts in halo for about a second, thus, basically completing the event handler before i could get started

cyan valve
#

okay so a fair bit of searching has not gotten me anywhere; I'm trying to run a mission and make my players have super-speed and no fall damage;

I found a couple of scripts that work when I execute them locally through Zeus, but putting them in the unit inits doesn't work, executing them in-game removes them on respawn.

I found another thing to use onPlayerRespawn, but I made a file, put the contents in there, still nothing

I'm going to be honest, I know basically nothing about scripts, the extent of my knowledge is just copy-paste scripts from examples and help from other people

#

is there any easy way to get this set up?

shadow sapphire
cyan valve
#

sure, should I use like a notepad file or just right in a message here?

shadow sapphire
cyan valve
#

awesome

#

allPlayers setAnimSpeedCoef 1.5;
[] spawn {
waitUntil {time > 5};
{
_x removeAllEventHandlers "HandleDamage";
} forEach allUnits;
if (hasInterface) then {
waitUntil {player == player};
waitUntil {alive player};
player addEventHandler ["HandleDamage", {
diag_log text format ["HD: %1", _this];
_type = _this select 4;
if (_type == "") then {
0
} else {
_this call ACE_medical_fnc_handleDamage
};
}];
};
};

#

so that's the full code so far; first part sets speed to 1.5x, seems to work on AI, and works when I apply it directly to a player in multiplayer

#

second, larger part is removing ACE fall damage, same thing

#

if I do a global execute through the debug window or through one of the Zeus execute code modules, both scripts work fine

#

it's just a matter of applying them where they need to be

shadow sapphire
#

Fudge. I can't test this for you, as I don't use ACE. I will have to drop at least that part.

What I meant about showing you how to format here is this:

First, type three of these marks by your tilda key (`). Then type SQF, then hold shift and tap enter. Drop in your code, then do shift and enter again, then do three more of the marks from earlier. If done correctly, your code will look like this...

#
allPlayers setAnimSpeedCoef 1.5;
[] spawn {
    waitUntil {time > 5};
    {
        _x removeAllEventHandlers "HandleDamage";
    } forEach allUnits;
    if (hasInterface) then {
        waitUntil {player == player};
        waitUntil {alive player};
        player addEventHandler ["HandleDamage", {
            diag_log text format ["HD: %1", _this];
            _type = _this select 4;
            if (_type == "") then {
                0
            } else {
                _this call ACE_medical_fnc_handleDamage
            };
        }];
    };
};```
cyan valve
#
allPlayers setAnimSpeedCoef 1.5;
[] spawn {
    waitUntil {time > 5};
    {
        _x removeAllEventHandlers "HandleDamage";
    } forEach allUnits;
    if (hasInterface) then {
        waitUntil {player == player};
        waitUntil {alive player};
        player addEventHandler ["HandleDamage", {
            diag_log text format ["HD: %1", _this];
            _type = _this select 4;
            if (_type == "") then {
                0
            } else {
                _this call ACE_medical_fnc_handleDamage
            };
        }];
    };
};
shadow sapphire
#

Okay, I'm going to look at what I can from this that you gave me.

cyan valve
#

there it is, sorry about that

shadow sapphire
#

Don't apologize, it's hard to know something you haven't been taught.

cyan valve
#

like I said, both scripts work fine when I can apply them properly, I just need to figure out how the best way to do that is, since like I said, it doesn't seem to work through the onPlayerRespawn.sqf, though I may be missing something from that, I'm not really sure

#

wow that's a hell of a run-on

shadow sapphire
#

I'm checking it out now, but the chances I'll be able to help are pretty low, so don't hold your breath or wait on me.

cyan valve
#

that's fine, thank you for trying at the very least

shadow sapphire
#

How are you phrasing all of this when you put it in the player init or onrespawn file?

cyan valve
#

the same way I sent it here in chat, directly copied over from it

shadow sapphire
#

Your problem is that this isn't working at all when called in those ways or that its effects are gone upon respawn?

cyan valve
#

well it doesn't work at all, unless I manually apply it to each entity when I'm actually in multiplayer

#

it doesn't work in the unit init because, presumably, using the respawn method I do it automatically kills and then respawns the character, which stops the scripts

#

but the onPlayerRespawn is supposed to apply the scripts each time someone respawns and it.. doesn't

shadow sapphire
#

Okay, so my simplified version is working when testing on local multiplayer, and survives respawn.

In my onPlayerRespawn.sqf:

WaitUntil {!isNull player};

Player setAnimSpeedCoef 3;
Player removeAllEventHandlers "HandleDamage";
deep loom
#

Will a virtual Zeus affect an allPlayers trigger?

shadow sapphire
#

I don't know anything about ACE medical, and I'm unsure of the rest of your code. If you explain what it does, then I may be able to actually help.

#

Oh, shit, I just realized something. I get what I did wrong.

cyan valve
shadow sapphire
#

I forgot the goal was invulnerability. The super speed is firing just fine, and the rest of your code would be most likely to actually create the invulnerability state.

cyan valve
#

Yeah

#

I don't want full invulnerability

shadow sapphire
#

Okay, gimme a moment to test that.

cyan valve
#

but I want to do a cool thing with the players jumping out of a VTOL without parachutes

#

so I'm trying to remove just fall damage

shadow sapphire
#

Spartan style. I gotcha.

cyan valve
#

Yeah

#

I plan on using the Halo mod if I can convince my unit to let me run a dedicated modlist for this campaign, but I need to prove it'd be interesting by running with what we have first

#

hence trying to script it all manually

#

that's what that code is supposed to do, since ACE has its own fall damage system, and that code works to remove it

#

but trying to get it to work, for each player, and stay around after respawn, that's the tricky part

shadow sapphire
#

How often are the players expected to do the jumps?

You could potentially get by with a script that just made simple invulnerability for the first X seconds of a new spawn and that would save them from fall damage.

The biggest issue here for me is that I don't know anything about ACE Medical scripting, so anything I do may not apply.

cyan valve
#

I don't think that'd work, unfortunately, not without getting them to respawn before the mission; the players usually log in like an hour or two before the op to hang out

#

also, just because I think I'm being dumb; do I need a special kind of file for an .sqf to work?

#

..I think that may be the problem

shadow sapphire
#

You don't need a special kind of file, but what you do need is to make sure the file is file.sqf and NOT file.txt.sqf, so you need to ensure you can see file extensions.

cyan valve
#

yeah, I just remembered that, it's been a while since I've messed around in the mission file

#

let me see if that fixes the issues

#

er, folder

#

OKAY so the super-speed works, and I'm assuming that should work for multiple people, that code?

shadow sapphire
#

This is working for adding super speed and nullifying fall (all) damage temporarily.

WaitUntil {!isNull player};

Player setAnimSpeedCoef 3;
Player removeAllEventHandlers "HandleDamage";
Player allowDamage false;
Sleep 30;
Player allowDamage true;

We may be able to add a catch that temporarily mutes damage while falling or something like that, but this has the unintended consequence of stopping bullet damage during any fall as well. Also, it may not work with ACE Medical.

#

Yeah, it should. The allPlayer thing works. The stuff I gave you is simplified and maybe irrelevant if your old block is now working.

cyan valve
#

well the allPlayers didn't actually work, so I tested your version instead and that got working

shadow sapphire
#

Oh, okay.