#arma3_scripting

1 messages · Page 652 of 1

little raptor
#

so you mean hold action?

#

press space and hold until that "circle" completes

steep nova
#

yes

little raptor
#

I don't know why you called it "revive task" I was confused! 😄

steep nova
#

only thing i could think of that had it

#

Thank you

dusky pier
#

Have a one more question, is possible to make AI's static? (not allow them to move from their spawn positions)

cosmic lichen
#

or disableSimulation

#

depends on what you need exactly

dusky pier
#

@cosmic lichen thank you!

#

@cosmic lichen tryed this, but my ai's still changing their positions, idk - maybe i doing something wrong

_unit = _model createUnit [_upos,_ai_grup,""];
        
        _unit disableAI "MOVE";

        {    _unit enableAI _x;    } forEach ["TARGET","AUTOTARGET","ANIM","FSM"];

        _unit allowDamage true;
        _unit setunitpos "middle";
        _unit forcespeed -1;
        _unit setCombatMode "GREEN";
        _unit setBehaviour "STEALTH";

        {    _unit setSkill [_x,_skills];    } forEach ["aimingAccuracy","aimingShake","aimingSpeed","courage","reloadSpeed","spotDistance","spotTime","general"];
        
        _unit addWeapon _weapon;

        _magType = selectRandom (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));

        for "_i" from 1 to _magCount step 1 do {
            _unit addMagazine _magType;
        };

        _unit disableConversation true;
        _unit setDamage 0.01;
        _unit setDir(random 360);
eager prawn
#

I'd like to limit the AR-2 darter so that people cannot control it or view the feed when they are X meters away from it (can't fly drone infinite range basically).

I've figured out how to do the X distance, etc - could anyone provide some ideas on how to forcibly disconnect the user from the UAV control/video?

little raptor
# eager prawn I'd like to limit the AR-2 darter so that people cannot control it or view the f...

you could run a loop:

while {alive _uav} do {//loop only if UAV is still alive
if (isUAVConnected _uav) then {  //is UAV connected?
  _controllers = UAVControl _uav; //get UAV controllers
  for "_i" from 0 to count _controllers - 1 step 2 do { //controllers are in this format: [unit1, vehicleRole, unit2, vehicleRole]; unit is every other element (even indices)
    _unit = _controllers select _i;
    if (_unit distance _uav > _maxDist) then {
      _unit connectTerminalToUAV objNull; //disconnect the unit
    };
  };
};

sleep 1;
};
dusky pier
#

@little raptor all works fine now, thank you a lot!

little raptor
#

np

eager prawn
#

I'll give that a go! I'll need to do a ton of tweaking, because I'm trying to setup a whole pairing process so that each person has their own individual drone. But that's a real good baseline to start off of

#

thanks

#

Pairing process is using this

little raptor
eager prawn
#

I mean this

heady berry
#

Is there a way to adjust a unit's blood level within ace 3? I can't seem to find anything about it

little raptor
heady berry
#

Blood volume, exactly. My bad

#

Thanks

dreamy kestrel
#

Is it possible to obtain the Cfg elements from a dialog when it loads, given the ctrl in its load event handler, let's say. I want to review Cartesian elements, for instance. thanks...

grim wing
#

how can I get the name of a weapon (not the calssname) through debug console?

#

nvm got it

#

getText (configFile >> "CfgWeapons" >> (currentWeapon player) >> "displayName");

dreamy kestrel
#

huh is it similar for dialogs? controls? if I have _ctrl, then getText (configFile >> (typeName _ctrl) >> "x"), something like that?

winter rose
#

not typeName
depends on what you want

little raptor
#

you can save it using setVariable

digital vine
#

Is there a way to do this within the zeus menu, whilst in server?

dreamy kestrel
#

@winter rose I want to query some of its attributes, ^^, x, y, etc

#

so far I havegetNumber (configFile >> ctrlClassName _ctrl >> "x") but it is yielding 0. or could I just say getNumber (_ctrl >> "x")?

#

ah ok thanks @little raptor, sorted it out I think, getNumber (_config >> "x")

distant oyster
# dreamy kestrel so far I have`getNumber (configFile >> ctrlClassName _ctrl >> "x")` but it is yi...

if you don't have the config as param at hand you can also do

getNumber (missionConfigFile >> "YourDisplayName" >> "controls" >> "ControlName" >> "x")
``` substitute `missionConfigFile` with `configFile` if you are working with a mod/the main game and `controls` with `controlsBackground` (or even `objects`) when wanting to access controls in those subclasses and if the control is part of a controlsgroup you also have to access that config first: `... "controls" >> "ControlsGroupName" >> "controls" >> "YourControl"`
slate cypress
#

I can’t remember if vanilla Zeus has the functionality but I’d expect not.

little raptor
distant oyster
digital vine
drifting girder
#

I remember trying to look around for a script involving disguising as enemy soldiers, but apparently bohemia does not allow you to pick up enemy uniforms. Is a "disguise script" not possible?

warm hedge
#

forceAddUniform?

#

This won't prevent you from get shot from enemies, so use other scripts such as setCaptive will do?

drifting girder
#

forceAddUniform sounds it should work combined with setCaptive. thank you!

kind pilot
fresh wyvern
#

Hi again and thanks for pointing me in the right direction.
I still don't understand where I go wrong with this script.
What is it that needs til be fixed for the script to spawn in a "I_LT_01_AA_F" with desert camo net?

_veh="I_LT_01_AA_F"createVehicle(player modelToWorld [-8,0,0]);
_animSources = (configProperties [configOf _veh >> "configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "AnimationSources" >> "showCamonetHull", "isclass _x && {getText(_x >> "showCamonetHull") != ''}", true]) apply {configName _x};
_veh= animateSource ["showCamonetHull", 1, true];
_textures = (configProperties [configOf _veh >> configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "TextureSources" >> "Indep_03", "isclass _x && {getText(_x >> "Indep_03") != ''}", true]) apply {configName _x};
_veh= _textures ["Indep_03", 1, true];

Path to _animSources:

configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "AnimationSources" >> "showCamonetHull"

Path to _textures

configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "TextureSources" >> "Indep_03"
warm hedge
#

Quite confusing

  1. What the last line supposed to do?
  2. Why you use configProperties to get the name when you already knew the name, and you didn't even used the returned value?
fresh wyvern
#

I am a bit new to this. It's like learning a new language.

warm hedge
#
  1. That is not how to use animateSource or such
#

Gimm bit gotta post the good read

fair drum
#

is it okay to make switch do files for mission flow? its got to read through everything until it finds a suitable case right?

slate cypress
fresh wyvern
# warm hedge https://community.bistudio.com/wiki/BIS_fnc_initVehicle

I really want to make the script work.

I've now tried these script (and variations of them) but I am not getting the script to spawn in a "I_LT_01_AA_F" with desert camo net. What is it that needs til be fixed for the script to work?

_veh = "I_LT_01_AA_F" createVehicle(player modelToWorld [-8,0,0]);
_animSources = (configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "AnimationSources" >> "showCamonetHull") != ''}", true]) apply {configName _x};
_vehicle animateSource ["showcamonethull", 1, true];
_textures = (configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "TextureSources" >> "Indep_03") != ''}", true]) apply {configName _x};
_vehicle textures ["showcamonethull", 1, true];
_veh="I_LT_01_AA_F"createVehicle(player modelToWorld [-8,0,0]);
_veh=[vehicle player, false, ["showcamonethull", 1]] call BIS_fnc_initVehicle;
_veh=[vehicle player, false, ["Indep_03", 1]] call BIS_fnc_initVehicle;
little raptor
#

@fresh wyvern ```sqf
not cpp/c/etc.

fresh wyvern
little raptor
#

since the highlighting is messed up

#

_animSources = (configfile >> "CfgVehicles" >> "I_LT_01_AA_F" >> "AnimationSources" >> "showCamonetHull") != ''}", true]) apply {configName _x};
what on earth is this?

#

what I said in here
#arma3_scripting message
was to show you how to get the anim sources.
When you know what it is, all you have to do is use:

_vehicle animateSource [_anim, 1, true];
fresh wyvern
little raptor
#

in your case:

_vehicle animateSource ["showCamonetHull", 1, true];
fresh wyvern
final storm
#

is hash faster then select?

royal spruce
#

any way to trigger a .sqf file on all units with a certain prefix in their name?

fair drum
#

And are you going to be using the classes for the prefix or the unit role?

royal spruce
#

im probably going to be spawning new units, and ill be using the internal unit name's prefix, in my case DSA_ since im using spooks & anomalies

#

however it is acceptable if i cant spawn new units

fair drum
#

Also taking note of the inheritance line

#

@royal spruce

royal spruce
#

ill take a looksie at it soon, thanks

ripe sapphire
#

hi guys, i opened BIS' animals module and the first 2 lines are these:

_logic = _this param [0,objnull,[objnull]];
_activated = _this param [2,true,[true]];

how do i find out what is contained in the _this variable?

exotic flax
#

It contains a logic (since a module is attached to one), and a boolean to know if it should be active.
All additional info is attached to the logic

ripe sapphire
#

yes how do i find out what they are?

#

from config viewer?

#

that _this variable is an array that contains at least 3 items right?

verbal saddle
#

the _this variable contains all the data that is passed to the function when it's called.

#

So technically _this could be anything, which is why it uses the param command to make sure the correct items are being passed to the function.

ripe sapphire
#

how to know what data was passed to the function by the animals module?

exotic flax
#

that script IS the module

verbal saddle
ripe sapphire
#

for example i put down animals module, what happens is that module runs the following

[value,value,value] call BIS_fnc_moduleAnimals;

right?
i want to know those values

exotic flax
#

_logic is a Game Logic (a simple object)
_activated is a boolean

That's it

verbal saddle
#

If your writing in the function that it calls then you can use the _this variable.
If your writing in the function that calls the BIS_fnc_moduleAnimals function then you can access them directly.
If your not doing either then you can only access them if they are defined globally within the function.

ripe sapphire
#

like those are the 1st and 3rd value right

exotic flax
#

it's obviously not used, so doesn't matter

verbal saddle
#

For modules usually the 2nd item is an array of units.

ripe sapphire
#

well i gues... but what i mean is i want to find the code that explains what the module passes to the function

exotic flax
#

Applies to Zeus Modules only:

// Argument 0 is module logic.
_logic = param [0,objNull,[objNull]];
// Argument 1 is list of affected units (affected by value selected in the 'class Units' argument))
_units = param [1,[],[[]]];
// True when the module was activated, false when it is deactivated (i.e., synced triggers are no longer active)
_activated = param [2,true,[true]];
ripe sapphire
exotic flax
#

already gave that answer 3 times 🤷‍♂️

#

all modules work the same (except for 3den modules, those are complicated), and it's nothing more than an object, an array and a boolean

#

what is done with it is inside the module script, no other magic happens there

little raptor
final storm
#

Thanks

quick peak
#

Hey, I have a script that replaces wrecks with working vehicles of the same type but works mostly on the cursorObject command, in conditions and in addAction too. Will the action work only on the wreckage of the person using the action, or also on the wrecks that other people are looking at?

noble pond
#

if the action is assigned in a script ranby all players like init.sqf yes it will do stuff for each client

#

however you need to be careful that its not running the same script across all clients every single time somebody uses the action, otherwise you will duplicate the vehicle once for every player on the server regardless of where they are

#

you only want it to do stuff for whoever actually used it

#

if the action is placed directly on an object all players will be able to trigger it until the action is removed or the object deleted

still forum
still forum
exotic flax
cosmic lichen
#

Filling module pages is kinda pointless, they are all more or less the same.

timid niche
#

When using createDisplay the display underneath hides until the newly created display is destroyed.
Anyone know why this would happen?

exotic flax
#

because you can only have 1 display at a time, so it will close the previous one

#

createDialog will allow you to stack UI's

timid niche
#

Fairly sure createDialog closes the display underneath?

exotic flax
#

but will open the previous one again when closed, where displays will just close

#

cutRsc is also possible, but will only show stuff and won't allow you to use your mouse on it

unique sundial
#

hides it maybe, dont think it closes it as dialog could be created as child of display underneath and that would cause crash

timid niche
#

Well I am attempting to create a dialog/display on top of a dialog without hiding/closing the one underneath.
Normally createDisplay works, but for some reason it seems to hide the dialog underneath.

unique sundial
#

create those as controls on top of controls for the same dialog

exotic flax
#

Personally I use createDialog to open a base and switch the Control Groups based on the content I want to present.
But it really depends on what you're trying to build

unique sundial
#

you can make dynamic windows only they will be conrols you can hide show

ornate horizon
#

Hey guys, I need some help modding.

warm hedge
#

Just ask the question

ornate horizon
#

Well, do I recompile like this? PBO manager won't work rn...

#

damn I can't post an image

warm hedge
#

meowfacepalm PBO Manager is a super notorious software. At least you should use Addon Builder, preferably PBOProject

ornate horizon
#

I think it's handled

#

thanks for your efforts

warm hedge
ornate horizon
#

aaa

warm hedge
#

No. Use imgur

ornate horizon
#

here

warm hedge
#

...Where?

winter rose
austere granite
#

(Im just aving a giggle tbh)

ornate horizon
#

there

#

@winter rose ^

warm hedge
#

And yes, what's the issue?

ornate horizon
#

Well, it's solved.

warm hedge
#

...??

ornate horizon
#

It was an issue of which address to use/what to check Ig but

#

that was just my anxiety

#

I get anxiety flushes, not necessarily attacks, from this type of stuff.

#

Idk what to call them

winter rose
#

anxiety rush is a good description I guess

ornate horizon
#

yea

#

like my name?

#

I think I just needed tp.bikey for my bunghole.pbo

#

yep

#

IT HAPPENED NEVERMIND

exotic flax
#

Looks like a broken or corrupt mod

tough abyss
#

Hmmm would sniper {_x reveal} forEach unit thisList; work

#

if placed in a trigger that has opfor present as the trigger condition

exotic flax
#

That line of code most certainly not, but the idea would

tough abyss
#

how would it be written then

exotic flax
#

Something like

{
   sniper reveal _x;
   // or
   sniper reveal [_x, 4];
} forEach this list;
tough abyss
#

whats the 4 for?

exotic flax
#

See wiki page of reveal

tough abyss
#

oh facepalm right knowledge level

#

@exotic flax thanks wasnt too far off the mark with my code jsut in the wrong order

#

hmmm would while {'triggerName' Activated} do { sniper reveal [_x, 4];} forEach List 'triggerName';} cause the snipers knowledge of the target to remain at 4?

#

if i placed in a second trigger that was server only and non repeating

winter rose
#

thislist, btw?

tough abyss
#

better (updated)

random loom
#

How would I go about getting all soldier/vehicle classnames?

#

Excluding uniforms, backpacks, and such.

tough abyss
#

huzzah i now have a script for sniper support

random loom
drifting sky
#

arma2, is there any way to make field hospital tents invulnerable to being crushed by vehicles?

drifting sky
#

already used allowDamage. It appears to protect against everything except being ran over by vehicles.

winter rose
#

ouch. well then I don't know, sorry

drifting sky
#

at least this is the case for the field hosptial. don't know about other kinds of objects

winter rose
#

in the editor?

exotic flax
#

enableSimulation?

drifting sky
#

field hospital is placed in the editor, and it's init line is this allowdamage false

#

i'll try enableSimulation

#

just tried enablesimulation. Didn't work. However, I did discover that allowdomage does prevent ME from running over the tent in SP. However, I've definitely seen the ai run over and destroy the tent in MP. Weird.

little raptor
drifting sky
#

everything is local to my machine, in fact I'm playing by myself at the moment.

#

and I'm the server

little raptor
#

well you can try the handleDamage event handler too

dreamy kestrel
#

Hello, Q: concerning LISTNBOX, what does control lnbSetValue [[row, column], value] do?
Is it setting a value "behind" the row/column in question? or is it actually affecting the shown content?

little raptor
#

or as you put it they're "behind" the text

ocean folio
#

the tooltip on the init fields has me scared. Just to be clear it is called ON every machine for every player that joins while the script is running, not it is called on every machine every time a player joins in progress.

#

right?

exotic flax
#

indeed

ocean folio
#

ok I can stop sweating now, thanks

exotic flax
#

so if you put player setDamage 1; in the init field of an object, it will kill ALL player every time someone joins 🤣

ocean folio
#

lmao that is nasty

#

and also, am I able to edit properties of entire groups by referencing the group's variable name?

#

like using this in a trigger pmcs enableAI "Move";

#

pmcs being the name of the group

#

it appears not

#

would also help if I set the trigger activation -_-

little raptor
ocean folio
#

the wiki says nothing about whether it does or doesn't work for entire groups

little raptor
#

the wiki lists the supported data type for each parameter

ocean folio
#

Object being any specific instance of a class?

little raptor
noble pond
#

enableAI only works on single units

#

if you want to apply it to the entire squad you could do a foreach

#

its easy to get an array of units in a group using units command

ocean folio
#

ill look into foreach

#

and groupname

little raptor
#

the group itself

#

as a variable

noble pond
#

yes

little raptor
ocean folio
#

I see the edit

ocean folio
#

ok I dont think I fully grasp this still

#

{this enableAI "Move"} forEach units pmcs;

noble pond
#

thegroup itself is a datatype

ocean folio
#

it might be the this

#

oh

noble pond
#

and inside forEach you use _x

ocean folio
#

well theres one part of it

noble pond
#

_x gets swapped for whatever element in the array that is being ran

#

theres a group command to get the group data from an object

ocean folio
#

and do I need to use group to specify

noble pond
#

you will replace pmcs with the group variable

little raptor
#

pmcs was a group

noble pond
#

oh it was/

#

ok

ocean folio
#

yeah, the group variable is pmcs

#

as it was in the group's attribute menu

noble pond
#

yes ok, so just use _x inside the foreach

little raptor
#

it also works with objects

#

e.g. units player

noble pond
#

wasn't even aware of that

#

although these days its a bit hard for me to stay up to speed with every little command in the game

ocean folio
#

lol yeah I'm not even gonna try

#

making missions is fun

#

but I dont have that level of dedication

#

stuff like Java sure I will learn all that but Arma... language? meh

#

sweet, it works

#

thanks for the help guys

gloomy musk
#

Hi! I was hoping I could get some help understanding the addMagazineTurret command. Basically, I'm trying to set ammo on the CUP Tunguskas so that they only have 1 AA missile. The problem is, their default magazine comes with 8. So from what I understand, I should be able to run:
_this addMagazineTurret ["CUP_8RND_9M311_Tunguska_M",[0,1]];
and it would only set them to one missile. However this seems to not do anything at all and I'm not sure if I'm fully understanding the syntax.

little raptor
# gloomy musk Hi! I was hoping I could get some help understanding the addMagazineTurret comma...

that command simply adds the magazine. It doesn't necessarily load it.
Are you sure the syntax is the only thing you don't understand? For example what is _this?
Are you sure the turret path you provided ([0,1]) is correct?
And you didn't provide any ammo count. It's the third element in the array (i.e [magClass, TurretPath, AmmoCnt])
To actually load the magazine, first you have to remove the current magazine, then load the new one.
There's also this command but it's semi-broken:
https://community.bistudio.com/wiki/setMagazineTurretAmmo

scarlet flume
#

any one help me really quick, i just want some practice,
i want to make a mission where the players will have to kill a target then move to the mission end zone, how to i set it so that the mission end is not availble untill the target is dead and how to see the mission end to require all players in the zone to finish the mission
what script do i use to keep the mission finished disable untill the target is killed?

winter rose
#

I suppose you use a trigger? Otherwise "make end mission unavailable" is quite simple, just do not call it

scarlet flume
#

what code do i use to keep it disable untill the target is killed

winter rose
#

conditions : this && not alive theTargetToKill

scarlet flume
#

thenks

daring trout
#

G´day gentlemen! I have a little waitUntil issue i cant get around... Its pretty simple: An unit has to move to a position specified like this: ```sqf
nearestArray = nearestLocations [position vip, ["nameCity","nameVillage", "Hill"], 10000];
nearestPos = nearestArray select 2;

nextpos = getpos nearestPos;

vip doMove nextpos;(yes, i know that the last step isnt necessary... 🙂 ) Then i´d like to put a simple waitUntil thingy:sqf
waitUntil {vip distance nextpos < 100}; Aaaaand its ***generic error in expression***. I dont understand why... All the data right up until the waituntil line are fine ( *[x,y,z] coords and sutff....*), even if i trysqf
vip distance nextpos``` in console, a simple number appears... But that waitUntil just aint doing its job. Any suggestion? Thanks!!

still forum
#

did you read the whole error

daring trout
#

yup....

still forum
#

it probably says "cannot suspend" because you are in a unscheduled script which, cannot suspend

#

how is your script executed?

daring trout
#

i tried both, excVM-ing, remoteExec-ing and right in the debug console in Eden.... Its not running from init or initServer or anything...

#

error: ´waitUntil {vip distance nextpos l#l < 100}; ´ Error Generic error in expression. Both from Exec and debug console...

still forum
#

Ah

#

l#l
shows where the problem is

#

its probably trying to compare array (nextpos) to number. which it can't

#

It should tell you that in the error message though

#

waitUntil {(vip distance nextpos) < 100};

daring trout
#

Trouble being... the nextpos var is a neat [x,y,z] ...

#

So there is no reason why the distance shouldn't fire...

cosmic lichen
#

< has higher precedence than binary command

warm hedge
#

Define put together?

#

Define why you removed your post?

daring trout
#

oh thanks! It runs now! But... still a little issue... The vip unit stays still.... He simply wont move. Why? I mean.... the code is so simple... ```sqf
nearestArray = nearestLocations [position vip, ["nameCity","nameVillage"], 10000];

nearestPos = nearestArray select 2;

nextpos = getpos nearestPos;

vip doMove nextpos;``` I get no errors. the destinations are set correctly (checked through console....) But why does the guy stay still??

#

Even after some time has elapsed.... not one single step

still forum
#

how far is the position away?

#

if its too close it might already think it arrived at target

storm arch
#
 if (airdrop distance [3184.07,12914.4,0] <= 3) then {deleteVehicle parachute};
 if (airdrop distance [3197.91,12899,0] <= 3) then {deleteVehicle parachute};```
daring trout
#

2.9km @still forum

storm arch
#

@warm hedge I thought I figured it out, but I didnt

#

I set all location to one global variable, but it isn't looking for an array?

#

Is there a simple way of compiling the three locations?

warm hedge
#

What is airdrop?

storm arch
#

"C_supplyCrate_F"

warm hedge
#

You meaning it is a string or an object?

storm arch
#

object

warm hedge
#

Okay, so... your question, is kinda confusing for me. Can you elaborate?

storm arch
#

I have three if statements doing the same thing can I compile them to check all three in one statement?

warm hedge
#

I assume the airdrop drops from the sky, and if airdrop nearly lands, you wanted to remove the parachute right?

storm arch
#

yes

warm hedge
#

Then you can simplify the script with justsqf if (getPosATL airdrop#2 <= 3) then {deleteVehicle parachute};

spark turret
#

i forgot again how to test if a variable is a certain type.
it was something along the lines of

 _bool = (_myVar isKindOf []) //true if myvar is an array```
warm hedge
#

typeName

spark turret
#

aha, thank you

#

not the method i had in mind, but it does the trick

winter rose
#

isEqualType

spark turret
#

ah thats it

#

trying to write my first FSM now

warm hedge
#

disableAI?

#

Simply sqf this disableAI "NVG"

spark turret
#

any easy way to shuffle an array?

spark turret
#

cool. wonder why i didnt find that one lol

finite sail
#

BIS_fnc_midweekBeer, perhaps? 🙂

queen junco
#

quick question: I'd like to remove a BIS_fnc_holdActionAdd with a BIS_fnc_holdActionRemove. Where do I find the action ID assigned by the BIS_fnc_holdActionAdd?

still forum
#

its returned by holdActionAdd

#

_myId = ... call BIS_fnc_holdActionAdd

drifting sky
#

A2OA: What do the "endurance" and "general" ai skills actually do?

queen junco
# still forum its returned by holdActionAdd

I get that, but as the wiki for the holdActionRemove says I need to enter a number(the ID) which means I need to see it somehow. Do I just run the script and use a hint to show it?

still forum
#

You store the ID in a variable

#

and use the variable that you stored it in

queen junco
#
[
    _myLaptop,                                // Object the action is attached to
    "Hack Laptop",                                // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",      // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",            // Progress icon shown on screen
    "_this distance _target < 3",                        // Condition for the action to be shown
    "_caller distance _target < 3",                        // Condition for the action to progress
    {},                                    // Code executed when action starts
    {},                                    // Code executed on every progress tick
    { _this call MY_fnc_hackingCompleted },                        // Code executed on completion
    {},                                    // Code executed on interrupted
    [],                                    // Arguments passed to the scripts as _this select 3
    12,                                    // Action duration [s]
    0,                                    // Priority
    true,                                    // Remove on completion
    false                                               // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop];                            // MP compatible implementation

Using this as an example. I dont know where the 10 comes from in the holdActionRemove. I might be stupid but as the command wants me to enter a value I dont have I feel pretty retarded.

[ player,10 ] call BIS_fnc_holdActionRemove;
still forum
#

you can't get the return value of that remoteExec

#

where do you remvoe the action?

#

in hackingCOmpleted function?

queen junco
#

yea, but I run it in a separate .sqf - as from my experience - it only works for the _caller if I do it via the holdAction

still forum
#

seperate .sqf means what?

queen junco
#

I add the holdAction via a execVM in a .sqf I than execute a seperate execVM for the code complete.

still forum
#

but why execVM?
if you're already calling _this call MY_fnc_hackingCompleted?

queen junco
#

It does look weird. But if I put the removeAction in the code domplete it only works for the _caller

still forum
#

ah every player gets the action?

queen junco
#

yea, and once it completes it should be removed for everyone

still forum
#

Move your hold action adding into a function via CfgFunctions.
inside that function, store the actionId from holdActionAdd in a variable

#

the remoteExec your function, not the holdActionAdd

#

then to remove, you make a second function that uses your variable

#

and then again you remoteExec your second function to everyone

queen junco
#

Okay, will try it out

#

thanks a lot ^^

void gust
#

Tying my hand at scripting for the first time. Following a tutorial, but I can not even make a simple hit message work. I have made a init.sqf file in my mission file but nothing is happening. Any help?

little raptor
# queen junco Okay, will try it out

An example of what Dedmen said:

[_myLaptop] remoteExec ["MY_fnc_addAction", [0, -2] select isDedicated, true];

fn_addAction.sqf:

params ["_myLaptop"];
_actionID = [
    _myLaptop,                                // Object the action is attached to
    "Hack Laptop",                                // Title of the action
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",      // Idle icon shown on screen
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",            // Progress icon shown on screen
    "_this distance _target < 3",                        // Condition for the action to be shown
    "_caller distance _target < 3",                        // Condition for the action to progress
    {},                                    // Code executed when action starts
    {},                                    // Code executed on every progress tick
    { [_this#0] remoteExec ["MY_fnc_removeAction", [0, -2] select isDedicated, true]; _this call MY_fnc_hackingCompleted },                        // Code executed on completion
    {},                                    // Code executed on interrupted
    [],                                    // Arguments passed to the scripts as _this select 3
    12,                                    // Action duration [s]
    0,                                    // Priority
    true,                                    // Remove on completion
    false                                               // Show in unconscious state
] call BIS_fnc_holdActionAdd;

_myLaptop setVariable ["MY_action_ID", _actionID]; //store the ID locally

fn_removeAction.sqf:

params ["_myLaptop"];
[_myLaptop, _myLaptop getVariable ["MY_action_ID", -1]] call BIS_fnc_holdActionRemove;
void gust
#

Dummy of the day award goes to.... Fatboy! I never actually saved the file on notepad++, so it never worked.

#

Got a little ahead of my self than got lost. Thanks for the time, I am sure ill be back with more questions later lol.

fresh wyvern
little raptor
finite sail
fresh wyvern
little raptor
finite sail
#

checking that now

#

confirmed, doesnt work on dismounted infantry

little raptor
#

@fresh wyvern ☝️

finite sail
fresh wyvern
#

So you can't have this look Item_NVGogglesB_gry_F, but without the night vision function? (standard and therminal, but no NV)

little raptor
#

In v2.02 you can attach a fake nvg model to your head

#

and have it follow the head bone

#

but that won't even have the TI

finite sail
#

might be able to make the nvg look so horrible its essentially unusable

fresh wyvern
#

Nice one x)

finite sail
#

disclamer.. user has no experience in pp efects

hallow mortar
#

feel like you could also figure out some way to construct an event handler that detects the "NVG on" action and uses action to immediately turn them off again

little raptor
#

construct an event handler
users can't make them

#

at least not reliably

#

you could use the keybinding (KeyDown)

#

but again not reliable

finite sail
#

but tbh, if it came to ruining something like that, I'd be looking to rework the story, not the equipment

hallow mortar
finite sail
little raptor
#

I quoted the wrong part

#

I mean you cant make an event handler

hallow mortar
#

..........I don't mean a new type of event handler

#

I mean figure out which of the existing types you can use to make an EH that does it

little raptor
#

you could use the keybinding (KeyDown)
but again not reliable

fresh wyvern
#

Is it possible to scrip an item to look like an other?

hallow mortar
#

AnimStateChanged might be able to do it if there's a universal NVG animation name

little raptor
#

and even if they did, they'd use gestures (actions), which again do not have EHs

hallow mortar
#

remind me again why the KeyDown option is not reliable

finite sail
#

users might change te key

hallow mortar
#

you can get the key they've bound it to

little raptor
#

One reason is key combos

#

E.g. you can't return something like ctrl+Middle mouse button

#

which is what I use for NVG

finite sail
#

default is N, but thatsnot a toggle it's a multi daytime> nvg> TI

little raptor
#

but my point still stands

you can't return something like ctrl+Middle mouse button

#

All numbers in SQF are floats and those are only precise up to 6...7 digits.
486539264 + 19 == 486539264 + 20
-> true
The DIK codes for 'LCtrl + R' and 'LCtrl + T' are indistinguishable.

#

one of the notes on that page

willow hound
#

Could str them and compare that

hallow mortar
fresh wyvern
queen cargo
hallow mortar
#

I didn't mean the part about using floats, I meant why make a key registration system that ends up having two different key combinations register as the same thing

#

On the original topic, I reckon you could use a keyUp EH, ignore which key it returns and just use currentVisionMode to check whether the vision mode was set to NV. But crippling the NVGs through PP effects is probably the better route.

finite sail
#

wouldnt the end effect be dependent on users selecyed graphics options?

hallow mortar
#

I don't think the ColorCorrections PP type is affected by graphics options, so you could just wipe out the contrast and brightness and basically make a black screen

fresh wyvern
#

Is there a way to set a value to indefinite?
Setting the number 10 underneath to value -1 does not work.

this addItemCargo ["Integrated_NVG_F", 10]; 
exotic flax
#

add Virtual Arsenal to the object

#

it's not possible to set something to unlimited

fresh wyvern
#

Ok, thank you.
(Item isn't available in arsenal..)

exotic flax
#

you could use an event handler on the object, and refill it after someone took an item out

fresh wyvern
#

Cool how?

exotic flax
fresh wyvern
heady quiver
#

or maybe have an example?

exotic flax
heady quiver
#

Niceeeeee

#

Thanks dude was looking for that

fresh wyvern
#

Anyone who know how to combine these two scripts so that they work with the warlords add on?

class CfgWLRequisitionPresets
{
    class A3DefaultAll
    {
        class EAST
        {
            class Vehicles
            {
                class I_LT_01_AA_F
                {
                    cost = 3000;
                    requirements[] = {};
                };
            };
        };
    };
};
[
    _veh,
    ["Indep_03",1], 
    ["showTools",0,"showCamonetHull",1,"showBags",0,"showSLATHull",0]
] call BIS_fnc_initVehicle;
fair drum
#

so which parachute class do i use on big vehicles (apc's and such)?

crude vigil
fair drum
#

lol i guess i need to use many more parachutes, 1 doesn't cut it and it just slams into the ground lol

crude vigil
#

Doubt that is possible but u could maybe temporarily reduce mass of your vehicle... I dont really know what a paradrop considers during.... paradropping

fair drum
#

hmm... what if i attached the vehicle to the parachute instead of the parachute to the vehicle? let me try that

crude vigil
#

ah, if it uses attachto, then yeah u probably got confused with that I believe

fair drum
#

yup thats what it was. you have to attach the vehicle to the parachute instead of vis versa

heady quiver
#

Anyone good with scripting triggers or alive checks?

cosmic lichen
#

@heady quiver What's the question?

warm swallow
#

I concur

heady quiver
#

So im creating a task right, and with that tasks comes a radio tower and i wanna check the 'alive' status on that object and update the task if needed.

warm swallow
#

couldn't you just check it's destruction state?

heady quiver
#

uhm

#

how do i do that xD

cosmic lichen
#

Do you spawn this tower yourself or do you use an existing one on the map?

heady quiver
#

I want if the tower is destroyed update the task.

#

I spawn it randomly

#

objective = "Land_TTowerBig_2_F" createVehicle _player_circle;

cosmic lichen
#

MyTower = createVehicle....

#

!alive MyTower

#

Does that help?

heady quiver
#

that works?

cosmic lichen
#

sure why not

heady quiver
#

Doesn't the code run once and stops?

cosmic lichen
#

yes

heady quiver
#

Then it wont work right

cosmic lichen
#

Did you check the wiki?

heady quiver
#

Its runs creates tower also checks state right after the creation and thats it

#

Dont i need a while loop?

warm swallow
#

what if you used BuildingChanged

heady quiver
#

Got an example?

warm swallow
#

addMissionEventHandler ["BuildingChanged", {
params ["_previousObject", "_newObject", "_isRuin"];
}];
wiki

cosmic lichen
#

Wait

#

Where is the "anyone good at triggers" part?

heady quiver
#

Well..

warm swallow
#

lol

heady quiver
#

I was wondering if needed to create a trigger with that tower to check state.

warm swallow
#

you shouldn't need to

#

if you add a handler

#

right?

heady quiver
#

Mmmm

cosmic lichen
#

You can use the handler, waitUntil, while or a trigger

#

your decision (handler is most efficient)

warm swallow
#

i concur

crude vigil
#

If like most of new starters, u re not afraid of eventhandlers and the risk of them biting you...

heady quiver
#

How would:

addMissionEventHandler ["BuildingChanged", {
params ["_previousObject", "_newObject", "_isRuin"];
}];

This look like if i used:

objective = "Land_TTowerBig_2_F" createVehicle _player_circle;

warm swallow
#

wait are you just using this as an objective to destroy a tower? I'm sure there are plenty of premade scripts via googl

heady quiver
#

Well not really that

warm swallow
#

ohk

heady quiver
#

More dynamic but thats another convo

warm swallow
#

lolk

heady quiver
#

But not sure what to do with

addMissionEventHandler ["BuildingChanged", {
params ["_previousObject", "_newObject", "_isRuin"];
}];

#

`
// Create object (like tower etc)
objective = "Land_TTowerBig_2_F" createVehicle _player_circle;

// TODO: CHECK IF OBJECTIVE (TOWER IS ALIVE)

// Update task
["task1", "SUCCEEDED"] call BIS_fnc_taskSetState;
`

#

This is what i got lol

acoustic pulsar
#

Hey guys a friend of mine started to mod an exile server, but now were stucked on one specific thing.. maybe one of you guys got an answer for that. some time players got stuck in combat mode and all the other features like repairing/lock a vehicle, food/drink/hp bar freezes or stop working for him until he reconnects to the server. We didnt find any answer for that..

warm swallow
#

I would check the debug console and see if you come across any errors while playing...

#

@heady quiver sorry im not too sure how to help you im fairly new with scripting myslef so

heady quiver
#

no worry

#

was worth asking 😄

#

xD

warm swallow
#

yea

#

i also have a question lol

#

we teach each other

heady quiver
#

sup

cosmic lichen
#
MyTower = "Land_TTowerBig_2_F" createVehicle _player_circle;
addMissionEventHandler ["BuildingChanged", {
    params ["_previousObject", "_newObject", "_isRuin"];
    if (_previousObject isEqualTo MyTower && _isRuin) then
    {
      ["task1", "SUCCEEDED"] call BIS_fnc_taskSetState;
    };
    removeMissionEventHandler ["BuildingChanged", _thisEventHandler];
}];```
heady quiver
#

oh damn

cosmic lichen
#

is it a single player mission or MP?

heady quiver
#

MP

warm swallow
#

In my multiplayer mission, I want generators to randomly spawn across the map, but in predefined locations. Like a place markers down and get generators to spawn on the model right, but I only want like 3 or 4 to spawn every mission, just in different spots, which keeps the mission new and poppin.

A) Is this possible within SQF?

B) How would I go abouts it. I was contemplating using SelectRandom with the array of generators, but would that keep them from spawning in the mission?

Thanks

#

also @cosmic lichen that looks right bro nice

cosmic lichen
#

I updated the code to remove the EH

#

Also, I am not 100% sure about locality since EH is local, and create vehicle global.

heady quiver
#

damn

#

it works lol

warm swallow
#

@heady quiver epic bro

heady quiver
#

@cosmic lichen My hero

#

@warm swallow I think you can make a map area for example get like 4 random radius positions in that area marker and spawn vehicle (generator) right?

cosmic lichen
#
for "_i" from 0 to (floor random 4) /*[1,3] call BIS_fnc_randomInt; works too*/ do
{
  createVehicle selectRandom [generators]
};```
@warm swallow Something like this. This is not valid code though
warm swallow
#

i would be afriad that they spawn somewhere i dont want lol, like in a wall or outside a playable area

#

@cosmic lichen could you explain the first line?

cosmic lichen
#

I thought you have predefined positions

warm hedge
#

for is to execute same code for multiple times

cosmic lichen
#

@warm swallow Have you checked the biki?

warm swallow
#

yea, maybe like 20 or so positions where they could spawn, but then they only spawn at like 3

cosmic lichen
#

(floor random 4) put that into the debug console. It should be clear what it does then

warm swallow
#

yea

#

ok

#

thanks, ill try that out!

heady quiver
#

@cosmic lichen You know how to generate a random string?

cosmic lichen
#

Define random.

heady quiver
#

like length of 10 al random

warm swallow
#

ay im a noob does this go in the init file?

heady quiver
#

letters

cosmic lichen
warm swallow
#

where do i put the code, sory

cosmic lichen
#

initServer.sqf preferably

warm swallow
#

alright

heady quiver
#

Happy

warm swallow
#

yes

cosmic lichen
heady quiver
#

You can also add execVM"filename.sqf"; to that init file and make your code in that filename.sqf too keep it clean.

#

if im not wrong.

#

@cosmic lichen yea but thats array i mean more like

#

_rNumber = random 1;

#

but then for letters.

cosmic lichen
#

selectRandom is your friend

warm swallow
#

im a serious poo at scripting, do you guys have any suggestions or guides? I've looked through the biki a lot, and im not like getting it

cosmic lichen
heady quiver
#

@cosmic lichen assuming he was expanding ^^

exotic flax
#

Q: I would like to execute code on a client from a server-side mod, is that possible?
Do I have use publicVariable to make the code available on the clients, or can I just remoteExec the code on each client?
PS. I want to add event handlers on all clients, while the code is on the server only.

warm hedge
#

Just remoteExec?

cosmic lichen
#

If the mod is server side, then the client does not know the code

#

Just use remoteExec from the server to the client

warm swallow
#

also @cosmic lichen would I spawn the generators in the editor, and control which ones spawn in the mission, or put down markers where they could spawn and do it that way?

cosmic lichen
#

Whatever is easier for you.

warm swallow
#

ok

cosmic lichen
#

I usually try to separate Editor / Scripts whenever possible

warm swallow
#

i really appreciate all the help

cosmic lichen
#

If you have 3den Enhanced installed you can pre-place the generators, select them all and select "Copy Positions to Clipboard" then paste those into an sqf file

#

Quickest way I believe

warm swallow
#

i do

dusk badger
#

Need help to clarify something:
createVehicle is to spawn an object and createUnit is for a AI Unit right?

cosmic lichen
#

yes

heady quiver
#

private _rNumber = random 1000; this generates a random number between 1 and 1000 right?

cosmic lichen
#

1 (inclusive) but never 1000

dusk badger
#

Thanks @cosmic lichen

cosmic lichen
#

but you wanna floor the number when using it with for

heady quiver
#

its just so i can randomize the task

wind hedge
#

Guys, is there an EH that fires when trying to open/close doors? I want to check if player has the inventory item "keys" and if so the door unlocks

warm hedge
#

No

warm swallow
#

ooooof

heady quiver
#

@cosmic lichen last question of the night, my creating task BIS_fnc_taskCreate expects a string but i want that random generated number in that string area bit how would i do it?

#

cuz it wont accept a int

#

private _rNumber = random 1000; into private _myTask = [groupOfPlayers, "HERERANDOM", [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate;

cosmic lichen
#

Check the wiki format

cosmic lichen
#

Or, detect all doors in the AO and lock/unlock them depending on whether the player has the key

heady quiver
#

private _myTask = [groupOfPlayers, format(formatString,_rNumber), [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate; like this? @cosmic lichen

cosmic lichen
#

No, read the format page carefully

heady quiver
#

Mmmm

#

private _myTask = [groupOfPlayers, toString _rNumber, [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate;

#

Maybe i just need to sleep xD

cosmic lichen
#

toString is not doing what you think, at all..

heady quiver
#

Cant think anymore.

cosmic lichen
#

Just read the examples on formatpage. Your first code was close

#

but the syntax is simply wrong

heady quiver
#
  • staring hard at screen *
#

hold up

#

private _myTask = [groupOfPlayers, format("%1",_rNumber), [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate;

cosmic lichen
#

almost..

heady quiver
#

FUCK..

#

I really thought i had it

cosmic lichen
#

I am starting to think that the examples are wrong on the biki

heady quiver
#

What did i do wrong?

cosmic lichen
#

haha

#

Nice try 😉

heady quiver
#

he he he

#

example 1 is what i have

#

even example 2

#

i dont get it

#

ohhh

#

private _myTask = [groupOfPlayers, format["%1",_rNumber], [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate;

cosmic lichen
#

thank god

heady quiver
#

THANK GOODNESS

cosmic lichen
#

now

#
format ["task_%1", _rNumber];
heady quiver
#

private _myTask = [groupOfPlayers, format["task_%1",_rNumber], [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate;

#

jeez this took way too long

#

But then again its 02:06 in Amsterdam

#

i need sleep.

cosmic lichen
#

Same here 🙂

heady quiver
#

I appreciate the time and help @cosmic lichen

cosmic lichen
#

yw

heady quiver
#

Goodnight all!

cosmic lichen
#

I started clearning up the biki page just because of you T_T

heady quiver
#

why xD

#

What did you do

#

or change

heady quiver
#

^^

#

Anyway goodnight

cosmic lichen
#

gn8

tender fossil
#

I guess this is wrong? I'm trying to add an element into an array inside a dynamically formed global variable

_skillWest = format ["WFBE_CL_VAR_SKILL_WEST_REQUESTID_%1", _skillWestRequestID];

    missionNamespace setVariable [format ["WFBE_CL_VAR_SKILL_WEST_REQUESTID_%1", _skillWestRequestID], _skillWest set [count _skillWest, _skillWestRequestIDplayerSkill]];
little raptor
tender fossil
#

Fixing those issues you mentioned now

#
_skillWest = missionNamespace getVariable format ["WFBE_CL_VAR_SKILL_WEST_REQUESTID_%1", _skillWestRequestID];

Better now? @little raptor 🙂

little raptor
#

no

tender fossil
#

Haha

#

I'm too used to strongly typed languages, I want a nagging mommy IDE to take care of wrong types of variables notlikemeowcry 😆

warm swallow
#

so im using markers as spawn locations right. Is there a way to change what orientation the spawned object is?

exotic flax
#

change the orientation of the marker

#

although not sure if the respawn framework follows that 🤔

warm swallow
#

yeaaaaaa

#

that does seem like the obvious answer, ill try it thanks

#

also @cosmic lichen solution to my prob.. not perfect but solution nonetheless. Place markers where you want spawn locations to be. right click object > Select Spawn Location. then click the corresponding object

fluid void
#

Not sure if this is the right place to ask, but I'm having a bit of trouble using cameras to render to texture. Whenever I use

_camera cameraEffect ["Internal", "BACK", "myrendersurface"];

or

_camera cameraEffect ["Terminate", "BACK", "myrendersurface"];

it also closes the Zeus/Spectator camera as well, any way to get around this?

drifting sky
#

A2OA: I'm making a custom cover system. How do I force an ai unit to stop shooting and to move to a position?

agile pumice
#

I'm trying to calculate a difference between a projectile's hit location on an object and a specific memory point (on a building's door handle), but the value changes depending on which door I'm shooting at.

last_pos = [0,0,0];
            [_projectile] spawn {
                _projectile = _this select 0;
                while {alive _projectile} do
                {
                    last_pos = getPosATL _projectile;
                    sleep 0.01;
                };
            };
            
            _bulletLandPos = _projectile worldToModel (getpos _building);
            _memPoint = (_doorArr select 1) select 4;
            _memPointPos = _building selectionPosition [_memPoint, "Memory"];
            hint format ["%1\n%2\n%3", _bulletLandPos, _memPointPos, _bulletLandPos distance _memPointPos];
#

on one door, the impact hints between 4 and 5, and on another its between 11 and 12

agile pumice
#

getposvisual?

little raptor
#

no

#

no getPos variant

#

at all

agile pumice
#

I was already on the page, deciding which to use

little raptor
#

now compare that to worldToModel and you'll understand

agile pumice
#
last_pos = ASLToAGL getPosASL _projectile;
_bulletLandPos = _projectile worldToModel (ASLToAGL getPosASL _building);```
``worldtomodel: position: Array - world position, format PositionAGL or Position2D``
#

assuming I'm right in converting the position to AGL this way, its not fixing the problem

agile pumice
#

it just passes the memorypoint for the handle

little raptor
#

you should use building

#

@agile pumice ```sqf
_bulletLandPos = _building worldToModel (ASLToAGL getPosASL _projectile);

agile pumice
#

what about last_pos then?

little raptor
#

you don't use it

agile pumice
#

I think I accidentally removed it from one of the calculations by mistake

#

_bulletLandPos = _building worldToModel last_pos; maybe

little raptor
#

yeah that

#

I was gonna type it now

agile pumice
#

okay, so now the values are similar but they're like 4000+

#

the x for _bulletLandPos is 4000 for some reason

drifting sky
#

I tried forcing unit to move by setting combatmode to blue. tried a bunch of other things as well. Can't seem to get them to do it at all. Can they not navigate amongst bushes?

agile pumice
#

but it should be worldToModel so that doesn't make sense

drifting sky
#

They're not going to any position I've selected. In fact they don't seem to even be trying.

little raptor
#

check its value

#

I bet it's still [0,0,0]

little raptor
agile pumice
#

yeah it is 0,0,0

drifting sky
#

domove

#

also tried moveto

little raptor
# agile pumice yeah it is 0,0,0

that's obvious
because:

  1. you're using a scheduled code
  2. you set the initial value to [0,0,0] (while it should at least be the projectile's initial position)
little raptor
#

at least in A3

drifting sky
#

i did dostop and then domove

little raptor
#

doStop, sleep 0.01, moveTo

#

try that

#

@agile pumice also, store the variable in the projectile's namespace

#

you don't have to make a global variable

agile pumice
#

it didn't hint 0,0,0 that tme

little raptor
#

what time??

agile pumice
#

when the hint was in the while block

#

I didnt think a local variable could be updated when used inside a spawn block

little raptor
#

@agile pumice ```sqf
_projectile = _this select 0;
_lastPos = ASLToAGL getPosASL _projectile
while {alive _projectile} do
{
_lastPos = ASLToAGL getPosASL _projectile;
sleep 0.001;
};
_bulletLandPos = _building worldToModel _lastPos;
_memPoint = (_doorArr select 1) select 4;
_memPointPos = _building selectionPosition [_memPoint, "Memory"];
hint format ["%1\n%2\n%3", _bulletLandPos, _memPointPos, _bulletLandPos distance _memPointPos];

#

because you're doing it all wrong

#

I didn't notice it

agile pumice
#

all inside that spawn block?

little raptor
#

yes

drifting sky
#

well, dostop sleep and then domove, kind of sort of looks like they're moving toward the position. But it's hard to tell. They never get very close to the position. I also notice that movetocompleted and movetofailed never appear to trigger.

little raptor
drifting sky
#

what about movetocompleted

little raptor
#

if you had A3 you'd have better ways to check

little raptor
agile pumice
#

okay, it seems to work

#

thanks for the help

#
_building = _doorArr select 0;
            [_projectile,_doorArr] spawn {
                _projectile = _this select 0;
                _doorArr = _this select 1;
                _building = _doorArr select 0;
                _lastPos = ASLToAGL getPosASL _projectile;
                while {alive _projectile} do
                {
                    _lastPos = ASLToAGL getPosASL _projectile;
                    sleep 0.001;
                };
                _bulletLandPos = _building worldToModel _lastPos;
                _memPoint = (_doorArr select 1) select 4;
                _memPointPos = _building selectionPosition [_memPoint, "Memory"];
                _distance = _bulletLandPos distance _memPointPos;
                //hint format ["%1\n%2\n%3", _bulletLandPos, _memPointPos, _distance];
                if (_distance < 0.5) then {
                    _doorArr call saf_fnc_breachOpenDoor;
                };
            };
little raptor
#

np

drifting sky
#

is it possible to get the ai to move in a direction instead of toward a point?

little raptor
#

wdym?

drifting sky
#

well, trying to get them to move to an exact point seems to be pretty much not working at all.

little raptor
#

@agile pumice btw I still recommend unscheduled code. like eachFrame EH

drifting sky
#

So i wondered if you could just get them to move in a direction instead

little raptor
#

you can disable their AI "MOVE" fsm

#

and play the move animation on them

#

and adjust their direction in a loop

#

using setVectorDir

#

not setDir

fair drum
#

the animation is probably going to be choppy as heck though on the loop. might need a loop accurate to the 0.001 mark and timings don't work that exact. i tried messing with the walk animation before and if you call it a single time, it last i think 4.88x seconds

drifting sky
#

is there a built in way to get the average recent velocity of a unit?

drifting sky
#

nearestobjects over 10 meters, vs. lineIntersects 10 meters. Which do you think is less expensive?

winter rose
#

velocity or speed over time?

little raptor
#

nearestobjects over 10 meters, vs. lineIntersects 10 meters. Which do you think is less expensive?
what do either have to do with the "average recent velocity of a unit"?

finite sail
#

and... we're back.... electricity is back on in the Tank house

heady quiver
#

Does anyone know how i can access a private var from within a addMissionEventHandler ?

finite sail
#

if its private somewhere else... there is no way

heady quiver
#

[_taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;

#

private _rndNmb = floor (random [600,800,1000]); private _taskName = format["task_%1", _rndNmb];

#

mmm

finite sail
#

is the variable in the same scope as the call?

#

that's the oly way this can work

heady quiver
#

So i got this right:

addMissionEventHandler ["BuildingChanged", { params ["_previousObject", "_newObject", "_isRuin"]; if (_previousObject isEqualTo objective && _isRuin) then { [_taskName, "SUCCEEDED"] call BIS_fnc_taskSetState; }; }];

But he can't access the _taskName

finite sail
#

_taskname needs to be in the same scope, or privated in a lower scope

heady quiver
#

Mmmm

finite sail
#

is there a reason _taskname has to be local?

heady quiver
#

Not really

finite sail
#

make it a global then... taskname woud seem to be the sort of thing that should be global, or maybe even public

heady quiver
#

How would i do that exactly?

finite sail
#

take away the underscore

heady quiver
#

Ah, _ means local ?

#

Kinda new to this

finite sail
#

yep

heady quiver
#

Ah make sense now

finite sail
#

🙂

heady quiver
#

Lets check if it works

finite sail
#

we were all new once

#

even Leopard

heady quiver
#

Hehe

#

Does private also need to go?

finite sail
#

yes, if you privated the variable somewhere, remove that

heady quiver
#

Damnnnnnnnnnn boi

#

It works

finite sail
#

wow... my speeling is shcoking today

#

more tea, i think

heady quiver
#

Haha

#

Coffee mate

finite sail
#

nah, coffee is for heathens and americans... im neither lol

heady quiver
#

😢

finite sail
#

civilised people drink tea

#

🙂

heady quiver
#

I dont know civiised i do know civilised

#

😉

finite sail
#

or, indeed, civilized lol

heady quiver
#

Well that too

#

xD

finite sail
#

hehe

odd bison
#

Hello I am working on WarMachine game mode. I would like to ask you for help.
How to make object semitransparent and in one color (green, red…). Thank you

heady quiver
#

You mean like a area?

#

or like a object as in a building?

odd bison
#

I would like to have the object (fortification) visible before placing, to know where it will be placed.

heady quiver
#

aaah

#

Thats a hard one

odd bison
#

Here is the code where i want to use it

f1=[ player, //target "+ Sandbags barricade high", //title "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", //idleIcon "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", //progressIcon "player==leader player && coolDown==false", //conditionShow "true", //conditionProgress {hint"Sandbags barricade will be build 2m in front of you";}, //codeStart { //VISIBLE OBJECT - SEMITRANSPARENT, ONE COLOR - how to do it? //USE COMMANDS createVehicle, attachTo... }, //codeProgress { _posZ = getPosAtl player; _bag = createVehicle ["Land_SandbagBarricade_01_hole_F", (player getRelPos [1.8, 0]), [], 0, "CAN_COLLIDE"]; //1.6 _bag setDir (getDir player); _bag setPos [(getPos _bag select 0),(getPos _bag select 1),(_posZ select 2)]; fort1 = 1; hint""; [1] spawn wrm_fnc_V2coolDown; systemChat "fortification built"; }, //codeCompleted { //delete semitransparent object //USE COMMANDS detach, deleteVehicle }, //codeInterrupted [], //arguments 6, //duration 0.3, //priority false, //removeCompleted false //showUnconscious ] call BIS_fnc_holdActionAdd;

fair drum
#

I don't know off hand but I would look at the old becti game mode cause that has something that you want in it.

heady quiver
#

Guys simple question i wanna wrap my code into a function and call it manually how would i do this?

#

functionName = { // Code here };

Just wrap it in here?

finite sail
#

old post, but it covers most of it

#

but yes, your method will work

heady quiver
#

Mmmm

#

I did wrap it in that and added into the init.sqf so i can add multiple functions in there but not sure how i would call

finite sail
#

what you are doing is known as an inline function

#

call functionName

heady quiver
#

Im stupid i tried that but i realised i didnt restart the game

#

-.--

#

Works now xD

finite sail
#

yes, need to restart so the init is reread

heady quiver
#

Btw

#

Do other people have access to these files when i make a mp game for my friends?

finite sail
#

you can recompile the function without restarting from inside the debug menu > functions

heady quiver
#

Ah good to know

#

For example i got this code where i have a trigger on a laptop that executes a piece of code.

finite sail
#

you might want to make yourself familiar with locality

#

if you're doing MP stuff

#

your function, for example, if its made in init.sqf, then all players and server will have it

#

is useful

#

for me, if it aint a missing semicolon or just bad logic, it's locality thats breaking stuff in MP

heady quiver
#

Mmmm yea.

#

I had some problems with local vs mp already

#

with arsenal spawning

finite sail
#

hehe welcome to my world

heady quiver
#

addAction ["Start a new mission", { call createDestroyMission; }];

i want something like this but this doesn't seem to be the right syntax

odd bison
#

virtual arsenal and addAction are local. You have to run it on all clients. use remote exec

verbal saddle
heady quiver
#

Yea i fixed it

verbal saddle
#

Although it is recommended to add the action to an object other then the players object, or else the condition will be checked every frame.

heady quiver
#

I created a white board in the map and added this to its init:

this addAction ["Search &amp; Destroy", {call createDestroyMission}];

Seems right?

verbal saddle
#

Yes, although because you've not included any of the optional items in the array the action will be usable for up to 50 meters away.

heady quiver
#

oh shit

#

Dont want that

verbal saddle
#

And it lists all the optional parameters for the addAction command

heady quiver
#

this addAction ["Search &amp; Destroy", { call createDestroyMission; systemchat "Target has been found." },nil,1.5,true,true,"","true",3,false,"",""];

#

Got it 🙂

#

3 meters interaction

finite sail
#

might want to add a cursorobject clause, so the action only appears when player is looking at the object

verbal saddle
#

The action is added to the object, so that's already done by the engine.

finite sail
#

ah right.. most of my addactions are on the player

heady quiver
#

Btw i got this random number gen but its not exactly what i want

#

rndNmb = floor (random [1,9999,9999]); what is this doing xD?

#

i just want a number between 1 - 9999

finite sail
#

rndNmb = ceil (random 9999)

#

floor might return zero

#

unlikely, but might

heady quiver
#

thats what i was looking for

finite sail
#

your script is choosing 1 of those 3 numbers at random

heady quiver
#

ceil (random 9999) this works

#

Ah.

willow hound
#

When should floor return 0 when the lowest input is 1?

finite sail
#

its going to return 9999 2 times out of 3 and 1 the rest

willow hound
#

No.

#
random[min, mid, max]
finite sail
#

oh yes... well spotted

willow hound
#

random != selectRandom

finite sail
#

*nods

heady quiver
#
  • stares *
#

Btw

#

Does one know how to get the actual name from an object?

objective = format["%1",object] createVehicle _player_circle;

#

i didnt name it but for example Land_TTowerBig_2_F this is the code name but i want like the title of that item

#

hint format ["Name is: %1", objective]; <-- this returns the name of the p3d file...

winter rose
#

why do you need it?
you would have to set vehicleVarName

heady quiver
#

Well i want the task name to be something like: Destroy the namehere

#

so i need the actual name of the tower i created not the file name

finite sail
#

getText (configFile >> "cfgVehicles" >> _type >> "displayName"

heady quiver
#

wowow

finite sail
#

where _type is the classname

winter rose
#
format ["Destroy the %1.", getText (configFile >> "cfgVehicles" >> typeOf objective >> "displayName")];
heady quiver
#

Mmm this works but something is off with my code

#

it always says 'radio tower' even tho sometimes a generator spawns

#

forget that

#

it works ty ty

#

Btw what editor you guys use for sqf files?

winter rose
#

VSCode

#

(with SQF plugins)

finite sail
#

^^^ _this ^^^

heady quiver
#

i seee..

#

You guys know anything about task icons?

odd bison
#

scroll down

heady quiver
#

hot damn

heady quiver
#

Is there a way to obtain all tasks?

Edit: currenttask player isequalto tasknull check if player has task if so he can't ask for another one (this works) but i want to check if bluefor has tasks at all

odd bison
#

Check if any player on side west has any task. If yes, then _haveTasks=true;

_haveTasks = false; _blueBoys=[]; {if(side _x==west) then (_blueBoys pushBackUnique _x;)} forEach allPlayers; {if (count (_x call BIS_fnc_tasksUnit) != 0) then {_haveTasks=true;};} forEach _blueBoys;

heady quiver
#

Nice

#

Im gonna check it now

#

Think we missing a )

#

Actually what im really looking for is if BlueFor has any uncompleted tasks

cosmic lichen
#

then (_blueB there is a brace missing

#

But why loop through them twice?

#

Just put this into one loop

heady quiver
#

Mmmm

#

Can't i just do something like count(player call BIS_fnc_tasksUnit) ?

#

but with a filter or something

#

i just wanna know if bluefor has has an active task (only 1 allowed at the time)

cosmic lichen
#

Well

#

Why check this afterward

#

Just prevent them from taking more than 1 task at a time

heady quiver
#

it will be at the beginning of the function

#

yea

#

thats the idea

#

at the beginning of my function createDestroyMission i wanna check if they already have one active

#

any mission

cosmic lichen
#

When you assign the first task, you know the task ID right?

heady quiver
#

yes *

cosmic lichen
#

So when they try to assign another task, just check the status of the previously added task

heady quiver
#

Actually

#

i wont know the ID

cosmic lichen
#

Why not?

heady quiver
#

Because its locally created who ever interacts with the board

#

private _myTask = [west, taskName, [_description, _title, _waypoint], objNull, true, 0, true, "destroy"] call BIS_fnc_taskCreate;

cosmic lichen
#

missionNamespace setVariable ["CurrentTask", "taskID", true];

heady quiver
#

Mmm

#

Isn't there a like a global function for getLastCreatedTask or something xD

cosmic lichen
#

no

#

You need 3 lines of code to find that out

#

//Create task id
//Create task with task ID
//Store task ID globally

//Get task ID
//Check if task with task ID is done
// If yes, create new task, else do nothing

heady quiver
#

`
// Create task ID globally
lastCreatedMission setVariable ["CurrentTask", taskName, true];

// Set random task location
[taskName, _player_circle] call BIS_fnc_taskSetDestination;

// Check if task last task is done
if(format['%1', taskName] call BIS_fnc_taskCompleted){
// Return task is done
};
`

#

Would this work?

#

oh no

#

wait how would i get the taskID globally?

#

`
// Create task ID globally
lastCreatedMission setVariable ["CurrentTask", taskName, true];

    // Set random task location
    [taskName, _player_circle] call BIS_fnc_taskSetDestination;

    // Check if task last task is done
    if(format['%1', getVariable "lastCreatedMission"] call BIS_fnc_taskCompleted){
        // Task is done
    };

`

#

If i named it CurrentTask i can get it back like this right?

if(format['%1', getVariable "CurrentTask"] call BIS_fnc_taskCompleted){ // Task is done };

#

@cosmic lichen

#

Please help xD

cosmic lichen
#

Read setVariable documentation first

heady quiver
#

i did and i set my the global var but it saying im missing stuff

#

;

cosmic lichen
#

you did read it, but you did not understand it.

heady quiver
#

Well you didnt say that

cosmic lichen
#

check the examples and the syntax

heady quiver
#

xD

#

missionNamespace setVariable ["CurrentTask", format['%1', taskName]];

#

hint CurrentTask;

#

Now its stored yea?

cosmic lichen
#

why format?

heady quiver
#

it can take var right away?

#

missionNamespace setVariable ["CurrentTask", taskName];

cosmic lichen
#

What data type is taskName?

heady quiver
#

taskName = format["task_%1", rndNmb];

cosmic lichen
#

yeah, and what data type is that?

heady quiver
#

str

cosmic lichen
#

right, string

#

format['%1', taskName]];
So why format here?

heady quiver
#

me stupid?

cosmic lichen
#

I just want you to reflect. Don't write things you don't understand

heady quiver
#

xD

#

I see.

#

So this is step one then?

// Set task globally missionNamespace setVariable ["CurrentTask", taskName]; hint CurrentTask;

cosmic lichen
#

If it works

heady quiver
#

Reserved var

#

_myCurrentTask setVariable ["CurrentTask", taskName, true]; <-- error undefinded var, do i need to declare it first somewhere above?

cosmic lichen
#

what does setVariable expect on the left side?

heady quiver
#

wait i got it

#

missionNamespace setVariable ["currentTaskOn", taskName]; hint currentTaskOn;

#

This works

#

now

#

I dont know.

#

// Set task globally missionNamespace setVariable ["currentTaskOn", taskName];

Im assuming this is set now but can't seem to retrieve the value

cosmic lichen
#

getVariable

heady quiver
#

Yea

#

getVariable "currentTaskOn";

#

Doesn't seem to like that

winter rose
#

missionNamespace

heady quiver
#

hint missionNamespace getVariable "currentTaskOn"; ?

winter rose
#

()

heady quiver
#

o

#

m

#

g

#

finally xD

#

Any reason why it needs () ?

#

So i can remember for next time

winter rose
#

yes, operators precedence

#

it does (hint missionNamespace) getVariable "currentTaskOn"

heady quiver
#

🤔

cosmic lichen
heady quiver
#

hint (missionNamespace getVariable "currentTaskOn"); _completed = "CURRENTTASKIDHERE" call BIS_fnc_taskCompleted;

#

Final moment

#

How would i merge these two

cosmic lichen
#

hint (missionNames_completed = "CURRENTTASKIDHERE" call BIS_fnc_taskCompleted;pace getVariable "currentTaskOn"); Merged 😛

heady quiver
#

😢

cosmic lichen
#
private _currentTask = missionNamespace getVariable "currentTaskOn";
private _isTaskDone = _currentTask call BIS_fnc_tasKCompleted;```
#

private _isTaskDone = (missionNamespace getVariable "currentTaskOn") call BIS_fnc_tasKCompleted; Which is less ledigable

#

There is one more thing though, the alternative syntax of getVariable which involves a default value

#
private _currentTask = missionNamespace getVariable ["currentTaskOn",""];
if (_currentTask isEqualTo "") exitWith {hint "Task ID does not exist!"};
private _isTaskDone = _currentTask call BIS_fnc_tasKCompleted;
heady quiver
#

uhm

#

But if _currentTask does not exist you can't call it in next line ye?

cosmic lichen
#

Technically you can, but good catch

#

fixed

heady quiver
#

aah oke but one problem

#

oh no wait

#

`
private _currentTask = missionNamespace getVariable ["currentTaskOn",""];
if (_currentTask isEqualTo "") exitWith {
// Create mission
};

  // Task exists (Check for complete)
 private _isTaskDone = _currentTask call BIS_fnc_taskCompleted;

`

#

Im gonna take a short 15m break need some food and fresh air xD

#

brb.

heady quiver
#

@cosmic lichen

if (_currentTask isEqualTo "") exitWith { // Cant find any mission };

Is there also something isNotEqualTo ?

winter rose
#

otherwise, if !(_currentTask isEqualTo "") exitWith {

#

or != ""

heady quiver
#

Ty bud

#

Im getting slowly to what i want xD

#

What is the in-game message again instead of hint?

#

chatmessage or something?

winter rose
#

systemChat

heady quiver
#

Ah yea

#

if !(_currentTask isEqualTo "") then { private _isTaskDone = _currentTask call BIS_fnc_tasKCompleted; if(_isTaskDone == false) then{ systemChat "Please complete your current task before starting a new one."; // It needs to stop here completely }; };

#

How do i completely stop the code at a certain point?

winter rose
#

```sqf plz 🙃

#

(see pinned message)

heady quiver
#

aaah

#

Edited

winter rose
#

three ` followed by one sqf then line return

heady quiver
#

i dont know why but im so confused sometimes im thinking of PHP a lot

#

mmm

#

Not sure what you mean by that 🤔

#

// Check for mission and if mission is completed if !(_currentTask isEqualTo "") then { private _isTaskDone = _currentTask call BIS_fnc_taskCompleted; if(_isTaskDone == false) then { systemChat "Please complete your current task before starting a new one."; // Exit here completely dont run next code }; };

#

Can you show?

winter rose
#

```sqf
// Check for mission and if mission is completed
if !(_currentTask isEqualTo "") then {
```

=

// Check for mission and if mission is completed
         if !(_currentTask isEqualTo "") then {
heady quiver
#

Doesnt seem to work

tough abyss
#

Hi
One question about objects
If we put a variable name on an object in Eden Editor
We surely can get it through missionNamespace getVariable["variable_name", objNull] ?

tough abyss
#

I'm doing that and in server-side: the script doesnt success to get the object

#

Is that because of special states of the object (as simulation, simple object) ?

winter rose
#

nope
where did you name it?

tough abyss
#

in variable name attribute, eden editor

winter rose
#

and trying to access it in game, not in editor?

tough abyss
#

oh nevermind, was using wrong local variable when fetching object with getVariable

#

😦

winter rose
#

🔨 agrrrrrr è.é

heady quiver
#

xD Lou im still not sure what you meant

tough abyss
#

but at least you answered my question about simple objects and getVariable

#

🙂

winter rose
#

no worries 😉

winter rose
heady quiver
#

`

     // Check for mission and if mission is completed
     if !(_currentTask isEqualTo "") then {
         private _isTaskDone = _currentTask call BIS_fnc_taskCompleted;
         if(_isTaskDone == false) then {
            systemChat "Please complete your current task before starting a new one.";
            // Exit here completely dont run next code
         };
     };

`

winter rose
#
 // Check for mission and if mission is completed
if !(_currentTask isEqualTo "") then {
  private _isTaskDone = _currentTask call BIS_fnc_taskCompleted;
  if (!_isTaskDone) then {
    systemChat "Please complete your current task before starting a new one.";
    // Exit here completely dont run next code
  };
};
heady quiver
#

Uh what changed xD?

winter rose
#

nothing, just color display

#

I am asking you to use that since the beginning :p

willow hound
heady quiver
#

ha ha 😢

#

Still need to know how to force exit it

#

The thing is the code above is checking for some task status and everything below that is a createMissionFunction so i dont want it to go further if the task is not completed

willow hound
#

exitWith is commonly used; for loops, an assortment of break commands is coming; and there's also terminate.

heady quiver
#

would be true if i wasnt already in another if statement

#

i can't exitWith inside that

winter rose
#
if (!_isTaskDone) then { hint "buhbye" } ELSE { hint "oooh, task completed" };
heady quiver
#

Alright problem is _currentTask can be empty then it should keep going, if _currentTask is not empty check if that task is complete if so then just keep going if not then stop right away and give message