#arma3_scripting

1 messages ยท Page 668 of 1

potent dirge
#

Thanks I really appreciate

umbral nimbus
#

I'm running a displayeventhandler in a script for keyUp and Keydown. Which change a variable. (and print it in a hint for testing)

However when I check the variable in a loop it hasnt changed.

How do I get the value from the eventhandler back into my script?

#

it's a local variable btw

#

making it a global variable ain't a smart thing to do right?
That's the easy way out

#

actually...now I think of it.
Wouldnt matter for multiplayer. It isn't published over the network with PublicVariable command.

grizzled lagoon
#

If eventhandler is start you can call thรฉ fonction and set argument in the call

#

[_local] call tag_fnc_name;

#

Or spawn...

cyan dust
#

Good day again. Just to make sure - there are no bitwise operations available in SQF? Specifically interested in "if (a & b == a)"

grizzled lagoon
exotic flax
#
if (a && a == b) then {}
``` is valid
#

But bitwise is afaik not available with commands

cyan dust
#

And another one: I see we have multiple options of organizing and accessing the code for execution, from your experience, which is faster/less memory consuming/both in case of planned single use (on, say, init) or multiple uses per game session (hotkeys for example)?

  • store as "MyScript.sqf" and call compileFinal preprocessFileLineNumbers (turn it into function before use)
  • define a function like ASM_fnc_doStuff
  • execVM "MyScript.sqf"
    (the latter must be "slowest" of all, as I suppose)
distant oyster
#

calling once: execVM, compile (very bad for performance and security)
multiple times: compile(Final) once, CfgFunctions does it automatically with some more benefits

exotic flax
#

CfgFunctions is the easiest to manage and good practice unless you need something specific

cyan dust
#

That's what I thought too ๐Ÿ‘ Thank you guys

dusk shadow
#

Anyone know if there's a way to retrieve the layerID of a layer after it's been created?

#

talking about while In 3DEN*

#

or better yet to check which layerID a given entity belongs to

#

I suppose I could just use get3DENLayerEntities and loop until I find the correct layer...

raw haven
#

Can I do a task that is triggered when I talk to an npc?

winter rose
#

yes

raw haven
#

How could I do it, is there a tutorial?

#

I've been looking for about 20min and I can't find anything

dusk shadow
#

@raw haven If there isn't a exact tutorial for what you are looking for then look for tutorials about the subparts of what you are trying to do:

  1. how to "interactions" to "npcs"
  2. how to create and complete tasks with script
raw haven
#

ok Thanks

cerulean cloak
#

Because that way if they get shot at in the water it won't do anything.
And respawning it isn't ideal because then I need to add back a couple of event handlers, ace cargo contents and it's inventory. Plus also copy over any other damage sustained.

potent dirge
#

Hello again, I'm trying to create a vehicle disabled check using canMove and canFire that will trigger a script. I need this check to apply only to vehicles disabled by the player, but I'm not sure what the best way to do it.
I was initially thinking of putting it in a "HitPart" or "HandleDamage" EH, but that might not be best performance wise. Neither would a dedicated script with waitUntil attached to every vehicle.

Any suggestions as to the best place to place such a check?

willow hound
#

EHs are good, don't be scared of them ๐Ÿ™‚

agile pumice
#

how would I use setVelocityTransformation to move an object along a linear path from object a to object b??
Something like this?

  t1 = time; 
      t2 = time + 10;
      onEachFrame
      {
          player setVelocityTransformation
          [
          AGLtoASL (getpos player),
          AGLtoASL (getpos target),
          [0,0,0], 
              [0,0,0], 
              [0,1,0], 
              [0,1,0], 
              [0,0,1], 
              [0,0,1],
          linearConversion [t1, t2, time, 0, 1]
          ];
      };
hollow lantern
#

I'm currently trying to get a chopper to make a nice descend.

waitUntil {(_aircraft distance _destination) < 1000};
[0.5] call _kiDescend;``` 
```sqf
private _kiDescend = 
{
    params["_z1"];
    _v1 = -6;
    _refreshTime = 0.1;
                
    _z2 = getpos _aircraft select 2;
    _v2 = velocity _aircraft select 2;
    _Vel = [];
    _velZ = 0;
    _z = getpos _aircraft select 2;
    while{_z >= _z1} do
    {
        _z = getpos _aircraft select 2;
        _velZ = [_v1,_v2,(_z-_z1)/(_z2-_z1)] call BIS_fnc_lerp;
        _vel = (velocity _aircraft);
        _vel set [2,_velZ];
        _aircraft setVelocity _vel;
        sleep _refreshTime;
    };  
};``` However, somehow the chopper does not really go down to the ground in a nice 45-60 deegres angle. Instead it sometimes occur that the helo does a 50 deegres angle in the air for slowing down and then the script fires and uses this angled position as base which results in the helo going upwards instead of down. 
Is there anything I should adjust to counter-act this?
crude vigil
little raptor
#

getPos shouldn't be used at all

crude vigil
#

there is also just a command named getPosASL , instead of AGLtoASL (getPos...) which you can use

crude vigil
hollow lantern
#

more or less

crude vigil
hollow lantern
#

already tried them, they are not usable in my case. My code above somewhat works, it just has sometimes the issue that the helo banks to the sky (probasbly for slowing down) and then the script fires. It then uses that weird angle as basis which results in the chopper going upwards then down

agile pumice
#

this is my current code:

t1 = time;
t2 = time + 10;
player setDir (player getDir target);
["rabbit_attack", "onEachFrame", {
    if (player distance target > 1.6) then {
        player setVelocityTransformation
        [
            getPosASL player,
            AGLtoASL (target modelToWorld (target selectionPosition "neck")),
            [0,0,0], // fromVelocity
            [0,0,0], // toVelocity
            [0,1,0], // fromVectorDir
            [0,1,0], // toVectorDIr
            [0,0,1], // fromVectorUp
            [0,0,1], // toVectorUp
            linearConversion [t1, t2, time, 0, 1]
        ];
    } else {
        ["rabbit_attack", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
    };
}] call BIS_fnc_addStackedEventHandler;
#

I need to change the

    _nextVectorDir,
    _currentVectorUp,
    _nextVectorUp,

params so the object (in this instance player) faces the target

little raptor
agile pumice
#

it already moves to the target

little raptor
#

then what is the problem?

crude vigil
#

velocity is for mp purposes, command doesnt use it for positioning

#

it is for sync over network

agile pumice
#

the problem is getting the vectordir/vectordirup to face the target

little raptor
#

vectorFromTo

#

you can calculate the vectorup using vectorCrossProduct

agile pumice
#

what vectors do I use for vector1 and vector2 in the syntax?

crude vigil
#

does vectorUp even work for player though? (Unless in vehicle)

little raptor
#

no

#

at least not setVectorUp

#

I don't know about that command

crude vigil
#

I mean it does but upon landing it goes back to normal standing

little raptor
#

but I assumed that was for testing

#

because the code doesn't make sense (moving the player up to some bunny?!)

crude vigil
#

use vectorDir player for vector1 , and the calculation Leopard gave for vector2

crude vigil
agile pumice
#

I think I was just looking for

            vectorDir player,
            vectorDir target,
            vectorUp player,
            vectorUp target,
#

well kind of

crude vigil
#

you want player to look at the direction bunny looks?

agile pumice
#

nah, I just want the rabbit (player) to face the player during the movement

crude vigil
#

wait is rabbit the player?

agile pumice
#

the rabbit (player) ends up looking the direction of the object at the end of the conversion

#

yes

little raptor
agile pumice
#

I am putting together a whimsical easter mission

crude vigil
agile pumice
#

its the vectorup bit that I need to adjust right?

little raptor
#

for next vector direction

agile pumice
#

I did but like I said, the player ended up facing the same direction as the target at the end of the transformation

crude vigil
agile pumice
#

I think I just need player setVectorDir (vector1 vectorFromTo vector2 before the setVelocityTransformation starts

#

player face target
setVelocityTransformation

crude vigil
#

yes you shouldnt do anything dynamically there. (ie. get all your values outside onEachFrame from start and pass them into command)

#

(Unless you know what you are doing)

agile pumice
#

I agree, I think something closer to this is what I'm aiming for:

t1 = time;
t2 = time + 10;
player setDir (player getDir target);
player setVectorDir ((vectorUp player) vectorFromTo (vectorUp target));
["rabbit_attack", "onEachFrame", {
    if (player distance target > 1.6) then {
        player setVelocityTransformation
        [
            getPosASL player,
            AGLtoASL (target modelToWorld (target selectionPosition "neck")),
            [0,0,0], 
            [0,0,0], 
            [0,1,0], 
            [0,1,0], 
            [0,0,1], 
            [0,0,1],
            linearConversion [t1, t2, time, 0, 1]
        ];
    } else {
        ["rabbit_attack", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
    };
}] call BIS_fnc_addStackedEventHandler;
#

though I don't think I should be using vectorUp for the two vectorFromTo objects

crude vigil
#

Well in here, you do not even modify the final vectorDir in setVelocityTransformation value so...

little raptor
#

you're still on this? meowsweats

agile pumice
#

I'm just trying to workout the vectorFromTo command. Do I use _vectorDir = (getpos player) vectorFromTo (getpos target); and then reference _vectorDir for vectorDirTo and vectorDirFrom inside setVelocityTransformation?

#

yes, I don't have a full understanding of the vector commands yet

little raptor
#
t1 = time;
t2 = time + 10;
_p1 = getPosASL player;
_p2 = target modelToWorldWorld (target selectionPosition "neck");
vec2 = _p1 vectorFromTo _p2;
player setVectorDir vec2;
["rabbit_attack", "onEachFrame", {
    if (player distance target > 1.6) then {
        _p1 = getPosASL player;
        _p2 = target modelToWorldWorld (target selectionPosition "neck");
        player setVelocityTransformation
        [
            _p1 ,
            _p2 ,
            [0,0,0], 
            [0,0,0], 
            vec2 , 
            vec2 , 
            [0,0,1], 
            [0,0,1],
            linearConversion [t1, t2, time, 0, 1]
        ];
    } else {
        ["rabbit_attack", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
    };
}] call BIS_fnc_addStackedEventHandler;
#

the vectorups probably need conversion too

agile pumice
#

the thing is, I don't want the vectordir to change mid transformation, which it does when you do vectorFromTo inside the transformation block itself

#

but your code might be the closest possible result to what I was looking for

agile pumice
#

I tested it, the result was what I mentioned

little raptor
#

I updated it just now

agile pumice
#

strange, I tried my own version of that and it was broken =/

little raptor
#

it is broken

agile pumice
#

oh, it was probably because I didn't do
_p1,
_p2,

little raptor
#

no

#
player setVelocityTransformation
        [
            getPosASL player,
            AGLtoASL (target modelToWorld (target selectionPosition "neck")),
            [0,0,0], 
            [0,0,0], 
            [0,1,0], 
            [0,1,0], 
            [0,0,1], 
            [0,0,1],
            linearConversion [t1, t2, time, 0, 1]
        ];
#

your vectors are [0,1,0]

agile pumice
#

sorry, I meant I had
getPosASL player,
AGLtoASL (target modelToWorld (target selectionPosition "neck")),
in place of the
_p1,
_p2,
in the transformation block

little raptor
#

again, that's not the problem

#

it's just a variable

agile pumice
#

I had

t1 = time;
t2 = time + 10;
_p1 = getPosASL player;
_p2 = target modelToWorldWorld (target selectionPosition "neck");
vec2 = _p1 vectorFromTo _p2;
player setVectorDir vec2;
``` outside the transformation block

and had
```sqf
vec2 , 
            vec2 , 

inside the transformation block

little raptor
#

it changes nothing

agile pumice
#

they weren't that the last time I tested

little raptor
#

that's literally your code

agile pumice
#

I didn't paste my last test before using your updated code, It looked like this:

#
t1 = time;
t2 = time + 10;
//_vectorDir = (vectorUp player) vectorFromTo (vectorUp target);
_vectorDir = (getpos player) vectorFromTo (getpos target);
player setVectorDir _vectorDir;
["rabbit_attack", "onEachFrame", {
    if (player distance target > 1.7) then {
        player setVelocityTransformation
        [
            getPosASL player,
            AGLtoASL (target modelToWorld (target selectionPosition "neck")),
            [0,0,0], 
            [0,0,0], 
            _vectorDir, //vectorDirFrom
            _vectorDir, //vectorDirTo
            //[0,1,0], //vectorDirFrom
            //[0,1,0], //vectorDirTo
            [0,0,1], //vectorUpFrom
            [0,0,1], //vectorUpTo
            linearConversion [t1, t2, time, 0, 1]
        ];
    } else {
        ["rabbit_attack", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
    };
}] call BIS_fnc_addStackedEventHandler;

is what I was trying to explain

little raptor
#

_vectorDir is local

agile pumice
#

That would explain why it broke haha

#

I don't think the:

_p1 = getPosASL player;
_p2 = target modelToWorldWorld (target selectionPosition "neck");
vec2 = _p1 vectorFromTo _p2;
player setVectorDir vec2;
``` before the onEachframe is necessary
#

nevermind

#

my monty python spoof mission is near completion

#

I even modified the rabbits to have red eyes and bloody faces

tulip ridge
#

Probably a really dumb question but I'm still fairly new to SQF files, and was wondering if there was anything necessarily wrong with this script? It works fine but I don't know a lot of the convention for sqf files as much as other programming languages.

/*
 * Briefing Script
 * Just edits some markers on the map
 */

openMap [true, false];
// [variable name, marker type, marker text]
_markers = [
  ["task_meetup", "hd_join", "Meetup"],
  ["task_rescue", "hd_unknown", "Rescue"],
  ["task_extract", "hd_pickup", "Extract"]
];

for [{_i=0},{_i<(count _markers)},{_i=_i+1}] do { // Can you have spaces? I tried spacing stuff out but it caused a "missing ;" error
  _markerName = (_markers select _i) select 0; // This + the array at the top can probably be done better
  _markerType = (_markers select _i) select 1;
  _markerText = (_markers select _i) select 2;

  // Move Camera
  mapAnimAdd [1, 0.1, markerPos _markerName];
  mapAnimCommit;
  sleep(1);

  // Edit Marker
  _markerName setMarkerType _markerType;
  _markerName setMarkerColor "colorwest";
  _markerName setMarkerText _markerText;

  // Make marker blink
  [_markerName, 0.5, 3] call BIS_fnc_blinkMarker;
  sleep(3);
};
little raptor
#

you might also want to take a look at params

#

also no need for parenthesis when using sleep

tulip ridge
#

you can just do sleep x?

little raptor
#

yes

tulip ridge
#

alright, and what was wrong with using a for loop?

little raptor
#

that's the slow variant of for

#

you should use for "_i" from 0 to count _markers - 1

#

sqf is not like other languages

tulip ridge
#

I mostly meant like "the standards" of sqf, so like for python, 4 spaces is "standard" for indents. While in others, 2 is "standard"

little raptor
#

there are no such standards in sqf

Indents are simply considered good programming practice (for reading). so you can use whatever you prefer
I personally prefer 4 spaces

tulip ridge
#

I was just using indents as an example

little raptor
#

it contains almost everything you'd need

hollow lantern
#

is there an easy method of getting values for setVectorDirAndUp ? Like e.g. have a person on the ground rotated in a specific way and then having a sort of getVectorDirAndUp command.

little raptor
#

[vectorDir obj, vectorUp obj]

#

if you have an object that's your dir and up

fair drum
#

if i have a script running locally on a vehicle and that driver leaves the game, do I need to restart that script when the locality changes or will it automatically transfer over?

cosmic lichen
#

you can't have a script running on a vehicle

#

it runs on the client or the server.

#

if the vehicle changes its locality you have to make your script detect that and adjust

fair drum
#

yeah thats what i meant. the driver's computer is in ownership of the vehicle

normal epoch
#

never worked with anything more advanced than placing and syncing stuff so how would i set up delayed spawns for groups of units?

fair drum
#

what I like to do it disable simulation, hide them, then reenable them when I want. gives the effect of "spawning" but I placed everything in the editor before hand. can even be fun to create states with FSMs

normal epoch
#

so then via a trigger re-enable them?

fair drum
#

you can if you want

fair drum
tulip ridge
#

How can you get a list all the units in a group? I tried using (units group squadName) join player; but this gave an error saying that it was a group and not a list of objects.

#

I was looking on the wiki and it said that units returns an array of objects so I don't know what I did wrong.

fair drum
#

returns array of units... [unit1,unit2,unit3]

#

so in total

(units squad_1) join player;
tulip ridge
#

ooooh

#

I just included group when I didn't need to, thanks!

dusty whale
#

ropeCreate doesnt work, despite setting enableRopeAttach to true

#

im getting null-object as return

dusty whale
#

im getting an error on this undefined variable _gunner

[_gun] spawn{
  waitUntil {time > 10};
  _group = createGroup [west, true];
  _gunner = ("B_RangeMaster_F" createUnit [position gun, _group]);
  sleep 2;
   _gunner moveInGunner _this#0;
};```
#

_gunner is literally defined just before

fair drum
#

your syntax of createUnit doesn't return anything

dusty whale
#

i see

fair drum
#

if you want a return you HAVE to use group createUnit [type, position, markers, placement, special]

tulip ridge
#

How can you check if all the units in a specific group is in a vehicle? I tried using (units groupName) in heli in the condition [of a waypoint] but it gave a general error.

fair drum
#
units groupName findIf { alive _x && !(_x in heli1) } == -1

even better as it filters out dead units that are in the group but haven't been removed yet

#

so it reads... if a unit is alive, and not in heli1, you will get a value that is the index of that unit in the array (so basically >= 0)

#

so if there are units alive, and none of them are not in heli1, then you get a return value of -1

tulip ridge
#

works like a charm! thanks a bunch

cyan dust
#

Good day. Is there a way to hide/show certain GUI element? I would like to hide some buttons before something is selected in listbox

cosmic lichen
#

ctrlSetFade

heady quiver
#

_pistolConfigs = "((configName (_x)) isKindof ['Pistol', configFile >> 'cfgWeapons']) && (getText (_x >> 'displayName') != '')" configClasses (configFile >> "cfgWeapons");

Is there a way to loop over all the pistols and make a class for each weapon?

#
class pistolNameHere {

};
cosmic lichen
#

A class?

#

You wanna format them as string?

#

Or do you mean like an OO approach?

heady quiver
#

Well its for the shop im using and i dont wanna define all the weapons manually so i just wanna loop over pistols, rifles, attachements etc and just give them all a base price based on what they are.

Example:

class rhsusf_acc_m14_bipod { <-- loop 
  price = 25; <-- default price
  stock = 100;
};
#

Another example:

class cfgHALsStore {
    containerTypes[] = {"LandVehicle", "Air", "Ship"};
    containerRadius = 10;
    currencySymbol = "$";
    sellFactor = 0.5;
    debug = 1;
    
    class categories {
        class launchers {
            displayName = "Rocket Launchers";
            picture = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\secondaryWeapon_ca.paa";
            
            class launch_NLAW_F {
                price = 2500;
                stock = 100;
                description = "<t color='#ff0000'>Where has my beer gone?</t>";
            };
cosmic lichen
#

So you wanna export them so you can put them into a config file?

heady quiver
#

yea

cosmic lichen
#

copyToClipboard

heady quiver
#

or just loop over them all

#

Mmmm

#

No

#

I dont wanan to manually add it

#

i just want all pistols and give them all the same price.

cosmic lichen
#

Here are a few good example on how to mass export (by copying to the clipboard)

#

Then you just paste it into your config file

heady quiver
#

So there is no way to do something like

{
_x {
price = 25; <-- default price
stock = 100;
}

} forEach _pistols

#

?

cosmic lichen
#

No. You cannot add new properties to existing classes

#

Via scripting*

heady quiver
#

damn

heady quiver
#
_pistols = "getnumber (_x >> 'type') isEqualTo 2 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');
{_x} forEach _pistols;

How do i get the class name from a pistol ๐Ÿค”

finite sail
#

morning chaps.. is there a recent all in one config output anywhere?

#

save me switching to diagnostic branch and using the sexy new diag_exportconfig

heady quiver
#
_pistols = "getnumber (_x >> 'type') isEqualTo 2 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');

pistols = [];
{ 

format['%1 { 
 price = 200; 
 stock = 999; 
};', configName _x];

} forEach _pistols;


This almost works but only returns one pistol -.-

heady quiver
#

i figured it

tough abyss
#

does commands like drawPolygon only work on maps? or can i use them for regular displays too?

cosmic lichen
#
_pistolsCfg = "getnumber (_x >> 'type') isEqualTo 2 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons'); 
 
_pistols = "";

{  
 
_pistols = _pistols + configName _x + endl + "{" + endl + "  price = 200;" + endl + "  stock = 999;" + endl + "};" + endl;
} forEach _pistolsCfg;
#

@heady quiver

#
hgun_ACPC2_F
{
  price = 200;
  stock = 999;
};
hgun_ACPC2_snds_F
{
  price = 200;
  stock = 999;
};
hgun_P07_F
{
  price = 200;
  stock = 999;
};```
#

@tough abyss What does the doc say?

heady quiver
#

well thats way better then what i had

#

x)

#

ty revo.

tough abyss
#

this is for drawIcon idk about others


Syntax:
    map drawIcon [texture, color, position, width, height, angle, text, shadow, textSize, font, align]
Parameters:
    map: Control
    texture: String - Icon texture
    color: Array - Text and icon color in format [r,g,b,a]
    position: Position2D, Position3D or Object
    width: Number - Width of the icon (but not the text)
    height: Number - Height of the icon (but not the text)
    angle: Number - Rotation angle of the icon (but not the text)
    text (Optional): String
    shadow (Optional): Number or Boolean - 0 (false): no shadow, 1: shadow (for text), 2 (true): outline (works for text and for icon only if icon angle is 0)
    textSize (Optional): Number - Size of the text in UI units (since Arma 3 v0.72)
    font (Optional): String - (since Arma 3 v0.72)
    align (Optional, default: "right"): String - "left", "right" or "center" (since Arma 3 v0.72)
Return Value:
    Nothing 
cosmic lichen
#

Ever heard of the biki? ๐Ÿ˜‰

tough abyss
#

that's same as drawIcon it seems

#

map is still just a control

cosmic lichen
#

Your question was if it works on a display or only on map control

tough abyss
#

my bad i was using "display" incorrectly

#

yeah i meant a general control, not map specifically

cosmic lichen
#

No, only works for maps.

tough abyss
#

thats a shame

heady quiver
#

One more question:
_pistolsCfg = "getnumber (_x >> 'type') isEqualTo 1 AND getnumber (_x >> 'scope') isEqualTo 2" configClasses (configfile >> 'CfgWeapons');

this returns weapons now but some of those weapons have scopes is there a way to filter that?

#

srifle_DMR_01_ACO_F, srifle_DMR_01_MRCO_F, srifle_DMR_01_SOS_F, srifle_DMR_01_DMS_F <-- retrusn things like this

cosmic lichen
#
_pistolsCfg = "getnumber (_x >> 'type') isEqualTo 1 AND getnumber (_x >> 'scope') isEqualTo 2 AND (configName _x call BIS_fnc_baseWeapon == configName _x" configClasses (configfile >> 'CfgWeapons')
heady quiver
cosmic lichen
#

Can you find the mistake I did ? ๐Ÿ™‚

heady quiver
#

๐Ÿค”

cosmic lichen
#

Do not just copy paste, also read ๐Ÿ™‚

cosmic lichen
#

...

#

Let him think for a moment ๐Ÿ˜„

winter rose
#

๐Ÿ˜

#

2 minutes is enough!!1! ๐Ÿ˜„

cosmic lichen
#

I guess that's the average time ppl can focus on something these days

winter rose
#

sorry, what were we talking about?

cosmic lichen
#
_pistolsCfg = "getnumber (_x >> 'type') isEqualTo 1 AND getnumber (_x >> 'scope') isEqualTo 2 AND (if (isArray (_x >> 'muzzles')) then {configName _x call BIS_fnc_baseWeapon == configName _x} else {true})" configClasses (configfile >> 'CfgWeapons');
#

This is the updated code. We might need to add another check for muzzles, just to be safe

heady quiver
#

UH

cosmic lichen
#

Alright, tested and works meowsweats

heady quiver
#

๐Ÿ˜ฎ

#

thanks ๐Ÿ˜„

heady quiver
#

Is there also a way of getting all magazines? or do i need to loop over each weapon to get the compatible mags?

warm hedge
heady quiver
#

yea so gotta loop over each

#

no way of getting all mags from the game i guess.

warm hedge
#

Excuseme what's the context? Can you explain for the drunk?

#

(I ate some cocktails not a wine)

heady quiver
#

I want all magazines that are currently in the game.

warm hedge
#

Currently in-game, in the terms of configs or in mission?

heady quiver
#

config

warm hedge
#

Do the mostly the same with what R3vo wrote, but for CfgMagazines

heady quiver
#

lmfao i just crashed my game

#
_weaponsCfg = "getnumber (_x >> 'type') isEqualTo 1 AND getnumber (_x >> 'scope') isEqualTo 2 AND (if (isArray (_x >> 'muzzles')) then {configName _x call BIS_fnc_baseWeapon == configName _x} else {true})" configClasses (configfile >> 'CfgWeapons'); 
_weapons = "";  
  
{    
 
 _magazines = [configName _x] call BIS_fnc_compatibleMagazines;
    {
        _weapons = _weapons  + 'class ' + _x + endl + "{" + endl + "  price = 100;" + endl + "  stock = 999;" + endl + "};" + endl;  
    } forEach _magazines;

} forEach _weaponsCfg;

was trying to all mags from that other list

#

๐ŸงŠ

warm hedge
#

Uhh

#

If you just wanted to get every mags ingame you only needed to use configClasses

heady quiver
#

_configs = "true" configClasses (configFile >> "CfgMagazines");

#

like this ?

warm hedge
#

Basically yes. You of course need to adjust the conditions if you wanted to get all personal weapon magazines

heady quiver
#

by personal weapon you mean what he holds?

#

oh no.

#

I think i know what you meant, im getting ammo for vehicles as wel lol

cosmic lichen
#

Yes, config file is a messy place notlikemeow

heady quiver
#

Yea im getting a lot of shit now.

#

mags that are for vehicles, mags without images.

#

even stungrenades that are un useable

#

x)

cosmic lichen
#

BIS_fnc_itemType

#
"getNumber (_x >> 'scope') == 2 && getText (_x >> 'picture') != '' && getText (_x >> 'model') != ''" configClasses (configFile >> "CfgMagazines"
#

Should get you started

heady quiver
#

thats exactly what i needed

#

๐Ÿ˜ฎ

#

Where can i found all the Cfg's ๐Ÿค” cuz i need attachments as wel.

heady quiver
#

is it just me or cant i find alot of information about weapon attachments.

heady quiver
#

Can i call a function i am currently in ?

#

function1 = { call function1 }; for example.

#

i guess i should try before asking

#

๐Ÿคฃ

little raptor
heady quiver
#
// Check if the location is already used before
    if(_location in used_locations) then {
        call createMissionLocations;
    } else {
        used_locations append [_location];
    }
#

The only thing that might inf loop this is the fact that i run out of locations.

little raptor
#

just use pushBack

heady quiver
#

oke changed it

#

x)

#

I got a lil problem btw, if you have some time

#
// Get random location
    _location = call getMissionLocations;
    _location = selectRandom _location;

    // Name
    _marker_name = format['task_%1_time_%2_marker', round random 9999, round time];

    // Create marker
    _markerstr = createMarker [_marker_name, _location]; 
    _markerstr setMarkerType "mil_unknown";
    _markerstr setMarkerColor "colorBLUFOR";

    // Create trigger if player gets close start a mission
    _trg = createTrigger ["EmptyDetector", _location];
    _trg setTriggerArea [600, 600, 50, false];
    _trg setTriggerActivation ["WEST", "PRESENT", false];
    _trg setTriggerStatements ["this", "
        'Bluefor entered the area' remoteExec ['systemChat'];
         
    ", 
    ""]; // Check if bluefor is close, remove marker and call other function

    // Check if the location is already used before
    if(_location in used_locations) then {
        call createMissionLocations;
    } else {
        used_locations pushBack [_location];
    }

i want to delete that marker when a bluefor walks into the area but the problem is this function can be called multiple times.

little raptor
little raptor
heady quiver
#
getMissionLocations = {
    _locations = allMapMarkers;
    _list = [];
    {if(getMarkerType _x == 'ellipse') then {_list pushBack getMarkerPos _x;};} forEach _locations;
    _list
};
little raptor
heady quiver
#

Getting a list of locations based on markers

little raptor
#

ok

wary lichen
#

Hello, how to create player absolute invincible on server? Make it invulnerable to hits from other players in MP?

#
player AddEventHandler ["HandleDamage", {False}];
player allowDammage false; ``` does not work
heady quiver
#

player allowDamage false;

wary lichen
#

but this invincible works when bomb hit player

#

other players can kill me, it looks like my god mode is not exists using player AddEventHandler ["HandleDamage", {False}]; player allowDammage false;

little raptor
wary lichen
#

any ideas?

winter rose
#

also allowDamage has a local effect, remoteExec it

little raptor
#

it has global effect

#

but local args

wary lichen
#

in arma 2*?

wary lichen
winter rose
#

oh, Arma 2

winter rose
little raptor
#

just use:

player AddEventHandler ["HandleDamage", {0}];
wary lichen
#

I try it, but others players can hit me

heady quiver
little raptor
wary lichen
#

on server

little raptor
#

are you the server?

wary lichen
#

my server is dedicated

little raptor
#

then try it locally

#

same goes for allowDamage

#

you shouldn't try either of them on the server

wary lichen
#

I know

#

but how to use on server side this

little raptor
#

it has global effect

#

you don't have to do anything

wary lichen
#

humm

winter rose
little raptor
heady quiver
#

i dont

#

it will call the same function in hope it find a new position

little raptor
#

wat?
"in hope"?!

heady quiver
#

xD

winter rose
#

๐Ÿ’ฅ ๐Ÿ”จ

heady quiver
#

if the pos already exists it needs to find a new one.

#

so i recall the function

little raptor
#

it's not a random process

#

why do you think you have to even do this?

#

just grab a location that is not being used

heady quiver
#

how

#

call getMissionLocations vs used_locations

little raptor
#

make each used_locations markers

#

instead of positions

#

_unused_locations = _locations - used_locations

#

then select random one of unused_locations

heady quiver
#
createMissionLocations = {

    // Unused locations
    _unused_locations = call getMissionLocations - used_locations;

    // Get random location
    _location = selectRandom _unused_locations;

    // Name
    _marker_name = format['task_%1_time_%2_marker', round random 9999, round time];

    // Create marker
    _markerstr = createMarker [_marker_name, _location]; 
    _markerstr setMarkerType "mil_unknown";
    _markerstr setMarkerColor "colorBLUFOR";

    // Create trigger if player gets close start a mission
    _trg = createTrigger ["EmptyDetector", _location];
    _trg setTriggerArea [500, 500, 50, false];
    _trg setTriggerActivation ["WEST", "PRESENT", false];
    _trg setTriggerStatements ["this", "
        'Bluefor entered the area' remoteExec ['systemChat'];
    ", 
    ""]; // Check if bluefor is close, remove marker and call other function

    // Add location to used locations
    used_locations pushBack _location
    
};
wary lichen
little raptor
heady quiver
#

the same

#
getMissionLocations = {
    _locations = allMapMarkers;
    _list = [];
    {if(getMarkerType _x == 'ellipse') then {
        _list pushBack getMarkerPos _x;
        _x setMarkerAlpha 0;
    };} forEach _locations;
    _list
};
little raptor
#

It should use markers

#

as I told you before

heady quiver
#

oh.

#

markernames or the entire object

little raptor
#

what entire object?

#

markers are just strings

#

so just _x

heady quiver
#

ah yea

#
// Used location
used_locations = [];

getMissionLocations = {
    _locations = allMapMarkers;
    _list = [];
    {if(getMarkerType _x == 'ellipse') then {
        _list pushBack _x;
        _x setMarkerAlpha 0;
    };} forEach _locations;
    _list
};
createMissionLocations = {

    // Unused locations
    _unused_locations = call getMissionLocations - used_locations;

    // Get random location
    _marker = selectRandom _unused_locations;
    _marker_pos = getMarkerPos _marker;
    
    // Name
    _marker_name = format['task_%1_time_%2_marker', round random 9999, round time];

    // Create marker
    _markerstr = createMarker [_marker_name, _marker_pos]; 
    _markerstr setMarkerType "mil_unknown";
    _markerstr setMarkerColor "colorBLUFOR";

    // Create trigger if player gets close start a mission
    _trg = createTrigger ["EmptyDetector", _marker_pos];
    _trg setTriggerArea [500, 500, 50, false];
    _trg setTriggerActivation ["WEST", "PRESENT", false];
    _trg setTriggerStatements ["this", "
        'Bluefor entered the area' remoteExec ['systemChat'];
    ", 
    ""]; // Check if bluefor is close, remove marker and call other function

    // Add location to used locations
    used_locations pushBack _marker
    
};
little raptor
heady quiver
#

whats wrong with that

#

I asked before how i could make this and this was the answer i got

#

x)

winter rose
#

gets to the door quickly

heady quiver
#

๐Ÿ˜†

winter rose
#

๐Ÿšช๐Ÿƒโ€โ™‚๏ธโ˜๏ธ

heady quiver
#

I dont see a problem cuz i can;t really never be the same.

#

well.

#

maybe 0.000000000000000000001%

#

But if you have a better option im all ears

little raptor
heady quiver
#

oh?

#

task_id + 1 ?

#

global var.

little raptor
#
format['task_%1_marker', count used_locations];
#

for example

heady quiver
#

๐Ÿค”

#

sounds good to me

#
createMissionLocations = {

    // Unused locations
    _unused_locations = call getMissionLocations - used_locations;

    // Get random location
    _marker = selectRandom _unused_locations;
    _marker_pos = getMarkerPos _marker;

    // Name
    _marker_name = format['task_%1_marker', count used_locations];

    // Create marker
    _markerstr = createMarker [_marker_name, _marker_pos]; 
    _markerstr setMarkerType "mil_unknown";
    _markerstr setMarkerColor "colorBLUFOR";

    // Create trigger if player gets close start a mission
    _trg = createTrigger ["EmptyDetector", _marker_pos];
    _trg setTriggerArea [500, 500, 50, false];
    _trg setTriggerActivation ["WEST", "PRESENT", false];
    _trg setTriggerStatements ["this", "
        'Bluefor entered the area' remoteExec ['systemChat'];
    ", 
    ""]; // Check if bluefor is close, remove marker and call other function

    // Add location to used locations
    used_locations pushBack _marker
    
};
#

Now my main question

#

x)

#

How the F can i remove that marker once a player walks into the area.

little raptor
#

why do you use triggers for that?

heady quiver
#

because once they getting into the area this marker needs to go and a mission spawns.

little raptor
#

I mean do you have a compelling reason not to use loops?

#

also how many triggers could you be dealing with at once?

heady quiver
#

mmm

#
  1. I dont know
  2. once it triggers it should get deleted (i want maximum of 3 triggers at a time)
#

1 at east random location (max: 3)

little raptor
#

well if it's just 3 then I suppose it's fine

#

just use setVariable

#

to associate the marker with the trigger
then getVariable to delete it

heady quiver
#

But how is this gonna work with 3 markers

little raptor
heady quiver
#

Yes, im listening / reading docu

#

lets say i have _myTruck setVariable ["myPublicVariable", 123, true]; doesnt it override when i call the function again?

little raptor
#

in your case it's _trig

#

you're creating a new trigger in every call of that function

#

the variable is stored in the trigger's namespace

#

if you have hundreds of books, can't they all have Page 1?!

#

and each page1 content is different

fair drum
#

when using magazinesAmmo whats the best way to determine which turret it belongs to? the command lumps all magazines info for all turrets into a single array.

willow hound
fair drum
#

oh yeah thats better. i was getting mixed up with all the close names.

heady quiver
#

mytruck is from the docu

#

x)

little raptor
heady quiver
#
createMissionLocations = {

    // Unused locations
    _unused_locations = call getMissionLocations - used_locations;

    // Get random location
    _marker = selectRandom _unused_locations;
    _marker_pos = getMarkerPos _marker;

    // Name
    _marker_name = format['task_%1_marker', count used_locations];

    // Create marker
    _markerstr = createMarker [_marker_name, _marker_pos]; 
    _markerstr setMarkerType "mil_unknown";
    _markerstr setMarkerColor "colorBLUFOR";

    // Create trigger if player gets close start a mission
    _trg = createTrigger ["EmptyDetector", _marker_pos];
    _trg setVariable ["marker", _marker_name, true];
    _trg setTriggerArea [500, 500, 50, false];
    _trg setTriggerActivation ["WEST", "PRESENT", false];
    _trg setTriggerStatements ["this", "
        'Bluefor entered the area' remoteExec ['systemChat'];
    ", 
    ""]; // Check if bluefor is close, remove marker and call other function

    // Add location to used locations
    used_locations pushBack _marker
    
};
#

So i set it like this yes?

little raptor
#

you might want to use a more "sophisticated" name than just "marker"

#

but yeah

#

now just delete it inside the trigger statements

fair drum
#

so I'm going to be calling some things a ton in a spawned loop. would it be better to set those single commands to a function contained within the script and use the function variable instead?

drifting girder
#

would adding a simple statement like if (isMultiplayer && isServer) ensure a script always works on a multiplayer server?

fair drum
willow hound
heady quiver
little raptor
#

thisTrigger getVariable ['current_marker', '']

heady quiver
#

mmm

#

yes

#

finally

#

x)

#

ty mate

fair drum
# willow hound Option 1: ```sqf while {_cond} do { //A lot of code }; ```Option 2: ```sqf whi...

more like

_this spawn {

    while {true} do {

        private _variable = command; 
        private _variable2 = command;
        private _variable3 = command;
        //etc

        sleep 1;
    };
};

//VERSUS

_this spawn {

    private _fnc1 = {command};
    private _fnc2 = {commmand};
    private _fnc3 = {command};
    
    while {true} do {

        private _variable = call _fnc1;
        private _variable2 = call _fnc2;
        private _variable3 = call _fnc3;
        //etc

        sleep 1;
    };
};
willow hound
#

No difference I believe; code is only compiled once and call can be imagined as copy-paste.

fair drum
#

but I just saw your comment that a while loop only compiles once, which is mainly what I was looking for

#

I thought it would be compiled every run

fair drum
#

say I have an array [apple, pear, pear, coconut]. is there a way to detect the repeat of pear? so i can do a if (repeat of pear exists) then {}; statement?

little raptor
#
_cntElement = count _array - count (_array - [_element]);
#

there is also another variant of count:

_cntElement = {_x isEqualTo _element} count _array;
```but it's slower than what I said (but works with array elements)
fair drum
#

might be a little more complicated I think. thinking of how to modify your idea...

_array = [["CUP_20Rnd_TE1_Red_Tracer_120mmSABOT_M256_Cannon_M",[0],20,1.00001e+007,0],["CUP_20Rnd_TE1_Red_Tracer_120mmHE_M256_Cannon_M",[0],20,1.00001e+007,0],["CUP_1200Rnd_TE4_Red_Tracer_762x51_M240_M",[0],1200,1.00001e+007,0],["CUP_100Rnd_TE4_Red_Tracer_127x99_M",[0,0],100,1.00001e+007,0],["CUP_100Rnd_TE4_Red_Tracer_127x99_M",[0,0],100,1.00001e+007,0],["CUP_100Rnd_TE4_Red_Tracer_127x99_M",[0,0],100,1.00001e+007,0],["CUP_100Rnd_TE4_Red_Tracer_127x99_M",[0,0],100,1.00001e+007,0],["CUP_100Rnd_TE4_Red_Tracer_127x99_M",[0,0],100,1.00001e+007,0],["SmokeLauncherMag",[0,0],2,1.00001e+007,0]];

and I want to count how many "CUP_100Rnd_TE4_Red_Tracer_127x99_M" though I won't know what strings the arrays contain since I'm writing it for all vehicles

#

maybe go through every internal array and extract the first element using a forEach. then doing a comparison from there

little raptor
fair drum
#

and here I was, making some 10 lines of code for what you did in one lol

heady quiver
#

Hi leo can i also pass on a setVar on a eventhandler?

dreamy kestrel
#

Q: are there by any chance any functions that can help to compute gradients? in particular, I have a case where I have some thresholds and would like to color them accordingly, i.e.
case 1) [[0, WHITE], [0.25, YELLOW], [0.65, ORANGE], [0.85, RED]]
case 2) [[0, WHITE], [-0.25, YELLOW], [-0.65, ORANGE], [-0.85, RED]] in a negative direction
case 3) [[0, WHITE], [0.25, BLUE], [0.5, GREEN]] in a positive direction
really both 2+3 are a scale of [-1,1], in two separate directions; i.e. case 3, let's say, gradient 0.2 would be a paler blue, 0.9 would be a stronger green, that sort of thing

fair drum
zealous heath
#

Is there a way to script on public zeus nowerdays? Was planning to do a scripted op with a bunch of friends and random players because we don't have enough people

#

(*legally script, I know there's hax but I REALLY don't want to resort to those)

fair drum
#

have you tried voting yourself as admin? I'm not sure if debug comes up when on admin anymore on public zeus.

zealous heath
#

Nope, it doesn't, they removed that with the tank dlc update

fair drum
#

then afaik, nope. if only they loaded up ZEH or something on the public servers so you could at least have an execute box

zealous heath
#

AFAIK?

fair drum
#

as far as i know

zealous heath
#

Ah

#

Welp, thanks anyway

heady quiver
#
    // Spawn HVT (Mission Objective)
    _list = [_location, 30] call getHouseSpawnLocations;
    _group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
    _hvt = units _group;
    _hvt = selectRandom _hvt; // ?? How do i select the first unit from group

    addMissionEventHandler ["EntityKilled", { // ?? Add hvt to handler
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        systemChat 'hi';
        if (_unit == _hvt && local _unit) then {
            [player call BIS_fnc_taskCurrent, "SUCCEEDED"] call BIS_fnc_taskSetState;
            [_mission, 'SUCCEEDED'] call BIS_fnc_taskSetState;
            { player say2D "cp_mission_accomplished_1";  [player, 1500] call HALs_money_fnc_addFunds; } remoteExec ["call"];
            'Mission Completed.' remoteExec ['systemChat'];
            'You have earned $1500.' remoteExec ['systemChat'];
        };
    }];

can anyone help me with this ๐Ÿ˜„

fair drum
#

the first unit in the array or the leader unit?

heady quiver
#

well there is only one in there.

#

so just the first

#

x)

#

i thought _hvt = _hvt select 1

#

but my main problem is the eventhandler

#

But i checked the EventHandler page and it says: args (Optional): Array - additional arguments to be passed to the EH code. Available during code execution via _thisArgs variable. but when i do this it says it expected 2 and i gave 3.

#

๐Ÿ˜•

wispy cave
#

Does ace fire an event when stitching is started?

fair drum
heady quiver
#

i hope, im lost atm

#

x)

#
_group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
_hvt = units _group;
_hvt = selectRandom _hvt; // ?? How do i select the first unit from group
_eh setVariable ["objective", _hvt, true];
_eh = addMissionEventHandler ["EntityKilled", { // ?? Add hvt to handler
      params ["_unit", "_killer", "_instigator", "_useEffects"];
      _hvt = _this getVariable ['objective'];
      if (_unit == _hvt && local _unit) then {
            // DO STUFF HERE IF HE KILLED
     };
}];
#

๐Ÿงน

#

maybe @little raptor knows ^^ ?

fair drum
#

i'm sure he does. be patient. this is an easy fix.

little raptor
fair drum
#

you have a lot more errors than just that BTW

little raptor
#

first of all _eh doesn't exist yet
second of all, _eh is a number
third of all _this is an array
meowsweats

#

just use a global variable

heady quiver
little raptor
#

as usual

fair drum
#

_mission from above doesn't exist from above either

heady quiver
#

like markers

little raptor
#

so?

#

you only need one entity killed event handler

heady quiver
#

per mission yes.

little raptor
#

just save the "tasks" in an array

#

if (_unit in some_var_tasks)

fair drum
#

did you write all this? or are you copying it from somewhere else and trying to make it work for own applications?

little raptor
#

@heady quiver instead of a global event handler like "entityKilled", attach a "killed" event handler to your object

#

another error I didn't notice is that _hvt is an array

fair drum
#

to answer your other question, you need to place the _hvt in the argument section of addmissionevent handler

addMissionEventHandler ["EntityKilled",
    {
        params ["_unit", "_killer", "_instigator", "_useEffects"];

        private _hvt = _thisArgs select 0;

    },
    [_hvt]
];
#

since you are going to use _hvt = units _group select 0 earlier, it makes it into a single string, so you need [] to turn it back into an array for the _thisArgs

heady quiver
#

i see.

#

but now leo showed me the other wa

#

y

#
    _hvt addEventHandler ["Killed", {
        systemChat 'he dead';
    }];
fair drum
#

you can do either. Assigning a killed handler to a unit, or using a entity killed mission handler that checks to see if the unit killed was the unit you want

fair drum
#

im just responding to your full post about how to bring it into the missioneventhandler that you had a question on

heady quiver
#

yea thanks!

#

i mean there are so many ways of doing things x)

#
_group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
_hvt = units _group;
 _hvt = selectRandom _hvt; 

// EventHandler
_hvt addEventHandler ["Killed", {
 systemChat 'he dead';
 }];

This seems to work

fair drum
#

just be careful of locality

heady quiver
#

Yea..

#

Im trying yours now but same thing

#
addMissionEventHandler ["EntityKilled",
    {
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        private _hvt = _thisArgs select 0;

          if (_unit == _hvt && local _unit) then {
              systemChat 'you killed HVT';
          }

    },[_hvt]];
#

3 elements provided, 2 expected.

#

Unless the docu is wrong lol

fair drum
#

oh i know why

#

that 3rd parameter is only in the dev client

#

Since Arma 3 v2.03.147276

heady quiver
#

fuc,

#

k

fair drum
#

i dont think we are at that version yet

heady quiver
#

how would i do it then ๐Ÿค”

fair drum
#

your setVariable method

heady quiver
#

But that didnt work.

little raptor
#

just do what I said

heady quiver
#

you mean the addEvent to object?

#

or the one with the array.

#
    _group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
    _hvt = units _group;
    _hvt = selectRandom _hvt; 

    // EventHandler
    _hvt addEventHandler ["Killed", {
        systemChat 'he dead';
    }];


fair drum
#

that one

heady quiver
#
    // Create group with unit (HVT)
    _group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
    _hvt = units _group;
    _hvt = selectRandom _hvt; 

    // EventHandler
    _killed_eh = _hvt addEventHandler ["Killed", {
        // Do stuff here when dead
    }];

    _killed_eh setVariable ["task_name", _name, true];
#

HELP

winter rose
#

_killed_eh setVariable
NO

#

_killed_eh is a NUMBER @heady quiver

fair drum
#

i think you are over complicating things, but I don't know how you are setting up your tasks.

heady quiver
#

a number?

willow hound
#

0, 1, 2, 3, ...

#

That stuff

heady quiver
#

yea i got that

#

-.-

fair drum
#

yeah, its returning a number, a number you can't do anything with

#

its not like its returning a object, or a logic to point to

#

the number is used for removing event handlers

heady quiver
#

so how would i setVariable to a EH ?

#

oh.

fair drum
#

you don't

willow hound
#

Set it to the unit the EH is attached to

heady quiver
#

aah

#
    // Create group with unit (HVT)
    _group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
    _hvt = units _group;
    _hvt = selectRandom _hvt; 
    _hvt setVariable ["task_name", _name, true];

    // EventHandler
    _hvt addEventHandler ["Killed", {
        // get the variable and compare it with killed unit
        // Do stuff here when dead
    }];

    
#

well i need to retrieve the data now in the EH how do i do that?

winter rose
#

and please```sqf
// turn
_hvt = units _group;
_hvt = selectRandom _hvt;

// into
_hvt = selectRandom units _group;

heady quiver
#

just _this getVariable ['task_name']; ?

fair drum
#

you don't need to make that comparison... the killed is ATTACHED to the unit

heady quiver
#

i meant

#

i need to retrieve the task name

#
    // Create group with unit (HVT)
    _group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
    _hvt = selectRandom units _group;
    _hvt setVariable ["task_name", _name, true];

    // EventHandler
    _hvt addEventHandler ["Killed", {
        // Get the task and finish it
    }];
fair drum
#

well do you know what the task name is that you are going to be retreiving?

#

is that what _name is referring to somewhere above?

heady quiver
#

yea

#

exactly.

fair drum
#

then you pretty much know the rest then. you get the variable from _hvt that contains your name of the task, then you use that name in your taskcompleted setup

heady quiver
#

Yes, but while im in the EH do i use _hvt or _this getVariable ['task_name'];

#

๐Ÿค”

winter rose
fair drum
#

_this select 0 or with params ["_unit", "_killer", "_instigator", "_useEffects"] and then using _unit

winter rose
heady quiver
#

yes

#

but thats not what im asking

winter rose
#

so```sqf
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];

private _taskName = _unit getVariable ["task_name", ""];
// rest of stuff here
}];
```as you can see, params names your arguments already; no need for _this select 0

heady quiver
#

private _taskName = _unit getVariable ["task_name", ""]; <-- this

#

i just needed to know how i could call something like that

winter rose
#

_hvt does not exist in the EH, so it cannot be accessed

heady quiver
#

x)

winter rose
#

if you add an EH to a unit, _unit will be that unit

heady quiver
#

aaah

winter rose
#

โ€ฆsorry if I make it sound obvious but that's how it is ๐Ÿ˜ฌ ๐Ÿ˜„

heady quiver
#

No all good makes sense now.

#

this is MP compatible?

#

As long as that unit exists for all players then it should be fine right

winter rose
#

you don't need to set the variable publicly btw, since you add the EH locally

#

and the MP compatibility will depend on what you will put in that code

crude vigil
#

You create the _hvt and event handler on same place(so same machine is executing this code, so it is yes MP compatible)

heady quiver
#

Here:

startKillMission = {
    params['_location', '_name'];

    // Create task
    _name = format['%1_task',_name];
    private _myTask = [west, _name, ['', 'Eliminate Target', 'kill'], objNull, true, 0, true, "kill"] call BIS_fnc_taskCreate;
    [_name, _location] call BIS_fnc_taskSetDestination;

    // Do mission stuff here
    //[_location, 15] call spawnEnemyUnits;

    // Spawn HVT (Mission Objective)
    _list = [_location, 30] call getHouseSpawnLocations;

    // Create group with unit (HVT)
    _group = [selectRandom _list, east, ['CUP_O_INS_Story_Bardak'], [], [], []] call BIS_fnc_spawnGroup;
    _hvt = selectRandom units _group;
    _hvt setVariable ["task_name", _name, true];

    // EventHandler
    _hvt addEventHandler ["Killed", {
        params ["_unit", "_killer", "_instigator", "_useEffects"];
        private _taskName = _unit getVariable ["task_name", ""];
        [_taskName, 'SUCCEEDED'] call BIS_fnc_taskSetState;
        { player say2D 'cp_mission_accomplished_1';  [player, 1500] call HALs_money_fnc_addFunds; } remoteExec ['call'];
        'Mission Completed.' remoteExec ['systemChat'];
        'You have earned $1500.' remoteExec ['systemChat'];
    }];

};
#

This seems to be working for me.

#

Any suggestions that could be better ^^ ?

winter rose
#

player say2D hmmโ€ฆ where does this script run?

heady quiver
#

on the player.

#

Thats why: remoteExec ['call'];

#

i want all t ohear

#

to hear *

winter rose
#

oh okay (playSound?)

heady quiver
#

yea that makes more sense

#

cuz player is not really saying it

#

x)

#

Alright, awesome thanks for the help guys.

#

๐Ÿ’Œ

fair drum
#

so I want to check performance on this script I wrote as it potentially has many instances depending on how many people sync my module. The performance test built into arma, will it go straight through and not test the spawn'ed part of code? whats the best way to test a loop like this?

https://pastebin.com/CjjvhPyz

winter rose
#

wait

#
if !(local _vehicle) exitwith {
  [[_vehicle, _time], hyp_fnc_runRearm] remoteExec ["call", 0];
};
```โ€ฆ
#

@fair drum ๐Ÿ”จ

#
if !(local _vehicle) exitwith {
  [_vehicle, _time] remoteExec ["hyp_fnc_runRearm", _vehicle];
};
``` ๐Ÿ‘€
fair drum
#

lol probably just me being up at 4am last night. was trying to build in a check to reset the script if ownership of the vehicle changed

winter rose
#

the check should also be done at the top of the while ^^

fair drum
#

i had a check earlier than that which prevents a non local or null vehicle from even reaching that point I believe

winter rose
#

while { sleep _time; alive _vehicle && local _vehicle } then

fair drum
#

okay, noted ๐Ÿ™‚

winter rose
#

you'll be safe that way
but also, if someone disconnects the script is lost

fair drum
#

thats what i was trying to prevent

winter rose
#

it should be the server that sends the function to execute to the current owner - safer that way

fair drum
#

okay ill modify it at the module level to do that (currently the module is set to global)

winter rose
#

ideally:

  • run the function server-side
  • only one script that checks an array
  • added vehicles get into that array
  • null/deleted vehicles get removed
  • the server does a forEach
  • the server remoteExecs said function on the vehicle's owner (with remoteExec ["func", _vehicle])
fair drum
#

okay, shouldn't be too hard of a change (besides doing it for all my previous modules oops lol)

heady quiver
#
    // Add action to objective
    [_objective,                                                            
            "Place Explosive",                                                
            "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa","\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa",                
            "_this distance _target < 30","_caller distance _target < 30",
            {},{},{
                null = [] spawn {
                    '30 seconds before detonation...' remoteExec ['systemChat'];
                    sleep 10;
                    '20 seconds before detonation...' remoteExec ['systemChat'];
                    sleep 10;
                    '10 seconds before detonation...' remoteExec ['systemChat'];
                    sleep 5;
                    { player say2D "Beep_Target"; } remoteExec ["call"];
                    sleep 5;
                    _this allowDamage true;
                    _explosion = 'CUP_IED_V4' createVehicle getPos _this ;
                    _explosion setDamage 100;
                    _this setDamage 100;
                };
            },{
            
        },[],5,0,false,false                                                                    
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _objective];

Question: how can i access _this if im in a spawn function.

fair drum
#
[apple,pear,coconut] spawn {

    params ["_apple", "_pear", "_coconut"];
};

// or

[apple,pear,coconut] spawn {

    _this; //returns [apple,pear,coconut]
};
heady quiver
#

ah so if i pass the created object in there

#

thats still an array tho ๐Ÿค”

fair drum
#

that whole null = is old

#

oh you just want a single object without an array?

heady quiver
#

ye

fair drum
#
salsa spawn {

    _this; //returns salsa
};
heady quiver
#

i see.

#

But what if _this = _this

#

x)

#

because _this in the BIS_fnc_holdActionAdd is that object where the function is on.

fair drum
#
salsa spawn {

    _this spawn {

        _this spawn {

            _this spawn {

                _this; //returns salsa
            };
        };
    };
};
heady quiver
#

what i mean is

#

hold up

#
    // Add action to objective
    [_objective,                                                            
            "Place Explosive",                                                
            "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa","\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa",                
            "_this distance _target < 30","_caller distance _target < 30",
            {},{},{
                object = _this; // <-- this
                null = [] spawn {
                    '30 seconds before detonation...' remoteExec ['systemChat'];
                    sleep 10;
                    '20 seconds before detonation...' remoteExec ['systemChat'];
                    sleep 10;
                    '10 seconds before detonation...' remoteExec ['systemChat'];
                    sleep 5;
                    { player say2D "Beep_Target"; } remoteExec ["call"];
                    sleep 5;
                    _this allowDamage true;
                    _explosion = 'CUP_IED_V4' createVehicle getPos _objective;
                    _explosion setDamage 100;
                    _this setDamage 100;
                };
            },{
            
        },[],5,0,false,false                                                                    
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _objective];
#

oh no.

#

its not _this its target

sacred slate
#

can i assign the repair and rearm capability to a custom vehicle?

fair drum
#

please really look at the wiki page, it's listed as the 11th parameter and it has a huge array of possible values you can use

heady quiver
#

yea will check

#

@fair drum

#

I can do _target but the problem is that i am in that spawn thingy

#

i can do deleteVehicle _target for example outside spawn {}

#
    // Add action to objective
    [_objective,                                                            
            "Place Explosive",                                                
            "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa","\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa",                
            "_this distance _target < 30","_caller distance _target < 30",
            {},{},{
                deleteVehicle _this;  // <-- THIS WORKS
                target spawn {
                    sleep 5;
                    deleteVehicle _this; // <-- THIS DOESNT WORKS
                };
            },{
            
        },[_objective],3,0,false,false                                                                    
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _objective];

fair drum
#
params ["_target", "_caller", "_actionID", "_arguments"];

_target spawn {

    sleep 5;
    deleteVehicle _this;
};
heady quiver
#

ah.

#

ty

fair drum
#

use params. every time if a command gives them. so you don't get unorganized

fair drum
wispy locust
#

Howdy! I am currently working on ACV from scratch got my model ingame and its amphibous and all that, for my armaments i have a 30mm cannon and coaxial machine gun. While on water it won't fire the main gun but the coaxial gun will fire. Any suggestions on how I would get he main gun to fire while its on water? Don't know what script or if i need a certain code to allow for this.

fair drum
#

curious, did you import a config from a previous vehicle then modify it?

wispy locust
#

More or less inherited values from the Badger IFV only thing I ended up changing was armor values. @fair drum

fair drum
past wagon
#

how do I check what side a player is on?

#

i want my code to go something like this:

if player is side Blufor then {
//code code code code code
}
else {
//code code code code code
}
warm hedge
#

side player

past wagon
#

ok

#

can I do:

if side player = blufor then {
  //code code code
}
else {
  //code code code
};
#

@warm hedge

warm hedge
#

= is to declare not to compare, == instead

past wagon
#

ok

past wagon
#

do I need to put the "if" condition inside parenthesis like this:

if (side player == blufor) then {
//code code code
}
else {
//code code code
};

?

#

@warm hedge

warm hedge
#

Well most of the time true

#

If you wondered do or not to do, do

past wagon
#

ok

#

thank you

winter rose
past wagon
#

Im getting a problem with this code. The systemChat and playSound are not working for players on the independent side

waitUntil {!isnull player};

sleep 5;

if (side player == blufor) then {
    systemChat "The Rebels are attacking the APD Headquarters! Guard the transport vehicle!";
    systemChat "Stay inside the blue area around the HQ marked on the map!";
    playSound "FD_Finish_F";
    while { true } do {
        waitUntil { sleep 1; alive player };
        if !(player inArea "APDHeadquarters") then {
                player setDamage 1;
        };
    };
};
else {
    systemChat "You are attacking the APD Headquarters! Steal the transport vehicle and deliver it safely back to the Rebel Base!";
    playSound "FD_Finish_F";
};
winter rose
#

yep

#

if {} ; else

past wagon
#

LOL

winter rose
#

that's why ๐Ÿ˜„

past wagon
#

i just noticed that

winter rose
#

of course, it is valid in SQF, no errors ๐Ÿ˜„

past wagon
#

wait a minute

#

do i just need to get rid of that extra };?

#

its supposed to be like if (boolean) then { shit } else {other shit};, right?

#

ohhh

winter rose
#

it's the ; that stops it

past wagon
#

so there WAS a reason that i forgot to put a ; there

#

silly me

winter rose
#

if you indented properly :U

past wagon
#

lol

winter rose
#
if (condition) then {
  // something
} else {
  // something
};

// or

if (condition) then
{
  // something
}
else
{
  // something
};
past wagon
#

ok

#

oh yeah and heres the other thing

#
_transport = allMissionObjects "B_Truck_01_ammo_F";

{
    while { true } do {
        sleep 1;
        if (_x inArea "RebelBase") then {
                    endMisson "END1";
        };
    };
} forEach _transport;

it is supposed to end the mission when they drive the vehicle inside the zone, but nothing happens

#

i am not sure if I am doing that right tho

winter rose
#

you have exhausted your free support options (1 per week)
to enhance your range of support, please proceed to the Arma supported pack (5$/month)

past wagon
#

lol

winter rose
past wagon
#

uhhh

#

there is only one truck

#

in the mission

winter rose
#

it'sโ€ฆ awful ๐Ÿ˜„

#
_truck = TheTruck;
waitUntil { sleep 1; _truck inArea "RebelBase" };
[] spawn BIS_fnc_endMissionServer;
past wagon
#

ah

#

nice

#

yoink

#
_truck = Transport;
waitUntil { sleep 1; _truck inArea "RebelBase" };
[] spawn BIS_fnc_endMissionServer;
#

ohhh

#

i have to use the variable name

#

i completely forgot that variable names existed

#

when i wrote that

#
_transport = Transport;
waitUntil { sleep 1; _transport inArea "RebelBase" };
[] spawn BIS_fnc_endMissionServer;
#

so that ^ should work? if the truck's variable name is Transport

cosmic lichen
#

Why assign it to a local var if you have a global one already?

past wagon
#

idk

#

but if it works, ill use it

cosmic lichen
#

Just don't name it "Transport"

#

name it "TRIO_Transport"

#

Otherwise chances are high your variable gets overwritten by a mod or somthing

past wagon
#

nah we good

cold pebble
#

Is there a clean way to detect when somebody enters a UAV view? Using CBA if that helps ๐Ÿ‘€

still carbon
#

Please, help us, We're frickin' stuck with this problem. I don't know what we did wrong. The idea is, that a sound should play when trigger is hit.

cosmic lichen
still carbon
#

Wait a sec, I was preparing some screenshots.

#

It does not work. I don't know why exactly.

#

When trigger is activated, the sound does not play. It just gives an error that it couldn't find the sound file.

hallow mortar
#

Because the file path you've provided in description.ext is wrong

#

It points at sound\dialog_0_officer_0.ogg but the actual file isn't in a subfolder called sound

still carbon
#

It still gives me this error

#

The file path is now correct @hallow mortar

#

But it still does not work.

hallow mortar
#

Well now you've put description.ext in the sound folder so it's probably not reading it

#

description.ext always goes in the main mission folder

still carbon
#

OH MY

#

THANK YOU

#

I LOVE YOU

#

IT WORKS

#

God bless you, @hallow mortar

copper hornet
#

Hello! I hope i'm in the right place.. I'm attempting to make a script provide a medical-only arsenal for a gamemode, but i'm not sure how to do so

clever radish
#

nearEntities ["Man", 160];

How do i use NearEntities of "Man" to select all sides but BLUFOR?

warm hedge
#
(nearEntities ["Man", 160]) select {side _x == blufor};```
copper hornet
#

Specifically i'm wondering about how to set it up so the arsenalbox is restricted to the medical items in the misc tab, i'm running ACE fyi

clever radish
warm hedge
#

Ah sorry, but blufor

#

Just do {side _x != blufor};

clever radish
clever radish
copper hornet
#

DM's open

fair drum
copper hornet
potent dirge
#

Afternoon fellas, I have a small problem.
I would like to generate an array containing objects which have only a specific string in their var name (not classname).
E.g. A list of all objects who have 'specItem' in their varname, so objects named 'specItem_1', 'specItem_2', 'specItem3' will be collected into the array, but objects with 'spec_Item', or 'item' will not be collected.

cosmic lichen
#

"string" in "string2"

potent dirge
#

will this work for objects?

cosmic lichen
#

varname is just a string

potent dirge
#

oh okay then

#

for some reason running _isInString = "foo" in "foobar"; in the debug console gives a generic error

cosmic lichen
#

It's not that line

potent dirge
#

I'm sorry but I don't understand

cosmic lichen
#

This line cannot give an error, it's caused by something else.

potent dirge
#

It's the only line in the console, I tested it on a new mission

cosmic lichen
#

Then validate your game files

potent dirge
#

"string" in "string" also does the same thing

cosmic lichen
#

Are you running some really old build or something?

potent dirge
#

No

#

I'll validate and restart and try again

heady quiver
#

Hi, does anyone know how i can keep a map marker on a unit's position even when he moves?

willow hound
#

Works for me, [0.6] spawn TEST_fnc_setOvercast; gave me Overcast: 0.6 in system chat.

warm hedge
#

Or EachFrame type of EH

heady quiver
#

Which one is more efficient?

#

Doesn't have to be spot on, could be maybe every 5 seconds update?

#

Unless its not a problem to keep checking it.

warm hedge
#

If it's not supposed to update every single frame, while is better

heady quiver
#

Thanks ๐Ÿ™‚

#

Also when i have this in my init.sqf : nul = [] execVM "functions\locations.sqf";

There is a function in there called createMissionLocations how can i call that function the the same file? (init.sqf)

warm hedge
#

Just multiple execVMs?

willow hound
#

You can't, define the function properly and you can.

heady quiver
#

this is what i mean.

#

When the mission / server is loaded i want it to execute 3 times that function.

willow hound
#

Define the function using the functions framework and you can do just that.

heady quiver
#

it is..

warm hedge
#

Or, just need to createMissionLocations = {bra bra...}; or sqf createMissionLocations = compile preprocessFileLineNumbers "theFunctionFile.sqf"

heady quiver
#

Wait let me re-explain

#

locations.sqf

createMissionLocations = {
}

warm hedge
#

Yeah... maybe we're not getting what you're meaning

heady quiver
#

the function is there.

#

there are multiple functions in there but the one createMissionLocations is the one i want to call in the init.sqf file .

willow hound
#

You don't know when execVM actually executes the code, so you can't just use the function after your execVM line because it might not be defined yet.

#

Guess you could waitUntil

warm hedge
#

call is better

willow hound
#

Or define your functions properly mad

warm hedge
#

execVM and spawn do execute scripts apparently, but... they're not do their job in THE FRAME. call on the other hand, will do

heady quiver
#

i can call a file?

warm hedge
#

call compile preprocessFileLineNumbers "function.sqf" longer than just an execVM but should work

heady quiver
warm hedge
willow hound
heady quiver
#

yea that would be better but kinda new to that

willow hound
#

Basically you make a happy little CfgFunctions in your description.ext following the specifications described on the wiki page and that's it.

heady quiver
#

But i might make happy little accidents meowsweats

heady quiver
#

^^

#

my man

willow hound
#

We all do, but then we tinker with our code until it works (or ask someone for help)

heady quiver
#

true that

#

i will try

#

ty

velvet merlin
spark turret
#

just teleport your marker on a loop. one to five second intervall is mostly fine, sometimes you even want WAY longer delays. 5 minutes for marking own teams in the AO, so you know roughly where they are, but not immersion breaking precise-realtime

heady quiver
#

at the spawnGroup function it says skillRange: Array of Numbers - (Optional, default []) skill range format [min, max] is it between 0 and 1 ?

#

cuz right now they ai are aimbotting me

fair drum
#

should be 0, 1 yes

heady quiver
#

_group = [_rnd_pos, east, [selectRandom call getEnemyUnitList], [], [], [0.1, 0.4]] call BIS_fnc_spawnGroup;

#

like this ๐Ÿ˜„ ?

spark turret
#

[selectRandom call getEnemyUnitList] what

#

that syntax is wrong.

#

check selectRandom again, then what params the function want

heady quiver
#

mate.

#

the function returns an array.

#

so i select a random unit from that array.

fair drum
#

why are you not naming your functions with fn_ or fnc_?

heady quiver
#

dunno

fair drum
#

so you don't confuse yourself, or others

#

just do bs_fnc_getEnemyUnitList

heady quiver
#

๐Ÿ‘Œ

winter rose
#

oh, a bs function

heady quiver
#

but i was asking about the 0.1 - 0.4 part

#

๐Ÿ˜„

fair drum
#

i was reading through ACE's coding format rules and they use fnc_balls_face

wary lichen
#

Hello, how to globally get all players on server and for example use playMove at him?

#

in arma 2 on dedicated server

cosmic lichen
#

If you can't fall asleep, just watch him painting and talking like he's high

willow hound
wary lichen
#

without call RE, or any things for Multiplayer working?

willow hound
#

According to the documentation we have, those commands should work on every machine, yes.

willow hound
#

I can't tell you how to actually do it because I don't know how remote execution in A2 works (I don't even have A2), but according to https://community.bistudio.com/wiki/playMove, playMove only takes local arguments, meaning you have to execute playMove on the machine which the animated unit is local to.

heady quiver
#
_objective addEventHandler ["EachFrame", {
  private _marker = _this getVariable ["markerCargo", ""]; // ??? cant be _unit
}

has no params how can i get the var ๐Ÿค”

willow hound
heady quiver
#

oh fuck

#

guess gotta use a while loop

#

So if i call a function with a while loop to constantly update the vehicle's position and then couple minutes later i call that function again thats overwrites the other one right

exotic flax
#

Well yes, unless the while loop is still running

heady quiver
#

so lets say i call it, and i start the while loop.

#

i can call the same function and then i got 2 while loops at the same time/

exotic flax
#

Yes

winter rose
fair drum
#

there's more, just left it all out for size

winter rose
#

OK then ๐Ÿ™‚

#

wait, no

fair drum
#

i don't expect anyone to read through mountains when i have a focused thing

winter rose
#

here, you are still creating a single spawn for every vehicle

#

you should go through the array (_syncedEntities), remove dead entities, then remoteExec the thing, in the same thread

#

a.k.a```sqf
[_syncedEntities] spawn {
params ["_syncedEntities"];

while { !(_syncedEntities isEqualTo []) } do
{
_syncedEntities = _syncedEntities select { canMove _x };
{
// do stuff remoteExec ["func", _x];
} forEach _syncedEntities;
};
};

spark turret
#

why the while loop?

#

does _synchedEntites autoupdate <=> reference, not clone?

winter rose
copper raven
#

isNotEqualTo blobcloseenjoy

spark turret
#

isDifferentTo

winter rose
copper raven
#

best command ever made

fair drum
winter rose
#

okie
just use one thread to remote exec, the less threads the bettererest ๐Ÿ˜‰

heady quiver
#
startCargoMission = {
    params['_location', '_name'];
    // Random pos and nearest road
    _rndLocation = [call BIS_fnc_randomPos, 5000] call BIS_fnc_nearestRoad;
    // Create Objective
    _objective = 'CUP_O_Ural_CHDKZ' createVehicle getPos _rndLocation;
    // Create marker
    _marker_name = format['task_%1_marker_cargo', count used_locations];
    _markerstr = createMarker ['Cargo', getPos _rndLocation]; 
    _markerstr setMarkerType "o_unknown";
    _markerstr setMarkerText "Cargo Supply";
    // Set variable
    _objective setVariable ["markerCargo", _marker_name, true];
        
    while{true} do { // while loop
        sleep 1;
        _pos = getPos _objective;
        _markerstr setMarkerPos _pos;
        if(!alive _objective) then {
            // Delete marker here and stop while loop
        }
    };
};

Can anyone help me ^^

fair drum
#

with what in particular

heady quiver
#

it breaks x)

#

the while loop.

fair drum
#

whats the error? always list the error lol

heady quiver
copper raven
#

can't sleep in unscheduled

fair drum
#

oh, its cause you arent in a scheduled environment

heady quiver
#

ohyea.

#

null = [] spawn {} right

fair drum
#

just leave out the null =

#

don't need it on A3

#

but you are going to have to feed _objective, and _markerstr to the spawn

heady quiver
#

holyshit

#

my pc just became a console

#

5 fps

fair drum
#

you forget the sleep?

heady quiver
#

no

#
    while{true} do { // while loop
        [_objective, _markerstr] spawn {
            sleep 1;
            _pos = getPos _objective;
            _markerstr setMarkerPos _pos;
            if(!alive _objective) then {
                // Delete marker here and stop while loop
            }
        }
    };
fair drum
#

you didn't define the params in the spawn scope

#

remember from yesterday?

heady quiver
#

ah

willow hound
#

That's not the main problem ๐Ÿ™‚

copper raven
#

move the while loop into the spawn

#

you're clogging the scheduler with that code

fair drum
#

oh yeah i see that now

#

50 billion spawns

heady quiver
#

lmfao

#

i was wondering why my pc just became a toaster.

rough heart
#

๐Ÿฟ ๐Ÿ‘€

heady quiver
#

๐Ÿ’ฅ

fair drum
#

you can cook popcorn on his pc

heady quiver
#

x)

heady quiver
#

but now i have 2 vars ๐Ÿค”

copper raven
#

so? pass an array instead

heady quiver
#
    [_objective, _markerstr] spawn {
        while{true} do { // while loop
            sleep 1;
            _pos = getPos _objective;
            _markerstr setMarkerPos _pos;
            if(!alive _objective) then {
                // Delete marker here and stop while loop
            }
        };
    }

aren't i doing that here?

copper raven
#

yea, but you're missing params

heady quiver
#
    [_objective, _markerstr] spawn {
        params['_objective', '_markerstr'];
        while{true} do { // while loop
            sleep 1;
            _pos = getPos _objective;
            _markerstr setMarkerPos _pos;
            if(!alive _objective) then {
                // Delete marker here and stop while loop
            }
        };
    }
#

yea works

#

cewl

#

now i just need to exitWith or breakout ๐Ÿค”

copper raven
#

you can move the alive check into while condition, and run code you want after the while loop, essentially same concept

heady quiver
#

Isnt the alive check already in the while?

#

oh

#

you mean

copper raven
#

instead of true i meant

heady quiver
#

just realised what you meant

#

but how ๐Ÿค”

#

problem is

#

that function can be called twice.

#

so 2 trucks.

copper raven
#

yeah, so?

heady quiver
#

that not a problem?

copper raven
#

doesn't change anything

heady quiver
#

oke ocol

#

cool *

#
[_objective, _markerstr] spawn {
  params['_objective', '_markerstr'];
  while{alive _objective} do { // while loop
     sleep 1;
     _pos = getPos _objective;
     _markerstr setMarkerPos _pos;
  };
    deleteMarker _markerstr;
};
#

seems to work

#

uhm

#

Is it possible that i just corrupted my mission lol

surreal peak
little raptor
heady quiver
#

๐Ÿšช ๐Ÿƒโ€โ™‚๏ธ

little raptor
#

nvm

heady quiver
#

Got it working tho.

little raptor
#

I didn't see the setMatkerPos

heady quiver
#

ah ok

#
clearWeaponCargoGlobal _vehicle;
clearMagazineCargoGlobal _vehicle;
clearItemCargoGlobal _vehicle;
clearBackpackCargo _vehicle;

This a good way to remove all items from a vehicle?

willow hound
#

I believe that this is the only way, yes.

willow hound
#

Yea not sure if you've got them all ๐Ÿคทโ€โ™‚๏ธ

fair drum
winter rose
#

that's what the server is for ๐Ÿ™‚

heady quiver
#

addWeapon vs addWeaponGlobal ๐Ÿค”

#

addWeaponGlobal = broken on dedi server.

willow hound
#

?

#

One adds a weapon, one adds a magazine yellowchain

heady quiver
#

Yep

#

edited.

#

x)

#

Weird.

wary lichen
#

how to insert " in text

winter rose
#

""

willow hound
#
systemChat """Hello"", he said."; //"Hello", he said.
winter rose
wary lichen
#

oh thanks

heady quiver
#

guys.

#

I asked before if i could call my 'cargo' function multiple times but that doesnt seem to be the case

heady quiver
winter rose
#

yeah?

#

try
[] call BIS_fnc_randomPos

heady quiver
#

My goal is to spawn cargo vehicles with a marker on the map for them (Which works now) but i can't call it again nothing happends (or atleast not showing on map)

#

Any reason why i can't call it twice or have 2 vehicles drive arround?

winter rose
#

most likely

#

btw you are not using your params at all

heady quiver
willow hound
#

The reason is that you forgot to use your dynamic marker name.

heady quiver
#

omg..

#

๐Ÿšช ๐Ÿƒโ€โ™‚๏ธ

#

ty..

dusky pier
#

Hello, i have a custom grenade, but when i add it to player - he can't use it, need to drop on the ground and take again.
And just after that - grenade is able to use.
When press "F" to change ammo type to grenade - nothing is changes

Is possible to somehow make it able to use without drop to the ground?

tough abyss
#

whats the script to make characters keep nvgs on for pics

dusk shadow
#

Q: Is BIS_fnc_objectVar guaranteed to be the same after restarting the mission?

#

Nvm, it obviously couldn't be with regards to objects created while the mission is running.

willow hound
#

The example shows that the variable is part of the missionNamespace, that's another hint.

dusk shadow
#

Well yeah but I was thinking since stuff placed in the editor is listed and initalized (AFAIK) in the same order each time...

#

if the netID of an object is the same then objectVar would give the same result each time...

#

but yeah

#

dynamic objects screws it all up

willow hound
#

Can always look at the source code of BIS functions

dusk shadow
#

mhm it's netID they are using to build the variable name

potent dirge
#

quick question is there any command to force AI vehicle commander's to use smoke?

fair drum
#

yup, grab the smoke magazine class and use one of the force fire commands

potent dirge
#

okay thanks

pine solstice
#

hello all was wondering if someone could help me. i am editing and intro and i would like to make the text bigger

titleText [" T E S T", "BLACK IN",9999];
exotic flax
#
titleText ["<t size='10'> T E S T</t>", "BLACK IN",9999];
``` try this and increase size when needed
pine solstice
#

that didnt work it shows this

<t size='10'> T E S T</t>
winter rose
#

Arma 2?

#

@pine solstice 9999, false, true]

#

you need to set the isStructuredText flag

exotic flax
#

my fault notlikemeowcry

winter rose
exotic flax
cosmic lichen
#

yes

little raptor
#

swtich? meowsweats

#

all you had to do was look at the syntax highlighting