#arma3_scripting

1 messages Β· Page 684 of 1

final storm
#
private _newPosr1 = [aozone, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
//create vehicle here
private _newPosr2 = [aozone, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
//spawn box
private _newPosr3 = [aozone, 12, 12, 12, 0, 12, 0] call BIS_fnc_findSafePos;
//and so on
sacred slate
#

cool thx!

fair drum
#

or do a for "_i" from expression

final storm
#

no

undone dew
#

hey guys dumb question, is there a way to say "not in" for trigger conditions, I know ! is the not operator but would saying something like sqf player !in thislist work to check that the player is not in a trigger area?

final storm
#

becuase you want to spawn the vehicle and then find a new location

fair drum
#

oh i just realized hes changing the center each time

undone dew
#

OH gotcha thanks

final storm
#

np

final storm
little raptor
#

what you wrote may always give the same position

final storm
#

Comments?

#

i just didnt write create vehicle stuff

#

Im pretty sure we are both saying the same thing

little raptor
#

right I didn't see them

final storm
#

πŸ™‚

brazen lagoon
#

Anyone ever had a script cause a segfault?

#

and also, anyone ever had success debugging it? lol

#

or I guess the real question here is, has anyone used a limited arsenal script that actually works in multiplayer? The only one I've found makes my server segfault

noble pond
#

which one did you use

#

there is a handful of ways still hanging around that will make the game crash if you pass it the right values

cold pebble
#

I guess it would also fire if the user tries to reload but actually has no spare mags too πŸ€”

digital vine
fervent kettle
#

Can someone tell me the difference between remoteExec and remoteExecCall? Is one "preferred "for MP? Can't get any smarter by reading the wiki.

still forum
noble pond
#

remoteExec = spawn (scheduled environment), remoteExecCall = call, (unscheduled environment)

fervent kettle
#

One more, at least for me, complicated question: How can I (in a MP scenario) get the player who called a trigger? There doesn't seem to be an easy "caller" function

still forum
#

thisList variable contains the units inside the trigger

fervent kettle
#

Forgot that it doesn't have a range. Players can call trigger Alpha, Bravo (all rangeless) etc. via menu. Afterwards a crate spawns (short version) at the callers location

#

I think my 2 main problems are
getting the player who executed the "call" function
(("player" command itself does not work (that easy) on dedicated?))

willow hound
#

player is the way to go; you can not activate a Radio Alpha trigger that is not on your machine.

cosmic lichen
fervent kettle
willow hound
#

Triggers are strictly local. Every machine has its own local instance of a trigger.
Player A activating his Radio Alpha trigger has no influence on the Radio Alpha triggers of other players.
Likewise, if you have a server only Radio Alpha trigger, only the player on the server can see and activate that trigger.

fervent kettle
#

Okay, so adding a trigger Alpha to every player, and player 1 activates it, the box should technically spawn at player 1's location?

willow hound
#

Depends on what code you run on activation πŸ€·β€β™‚οΈ

fervent kettle
#
private _createChest = "B_supplyCrate_F" createVehicle (player getPos [10, getDir player]); 

That's roughly the code. At least to create the chest

#

Running on MP it only gives me FPS drops but no box. Didn`t have time to double check with debugger mode yet

willow hound
#

You mentioned

the box should only be spawned for one player (the caller)
so you should probably use createVehicleLocal instead of createVehicle.

fervent kettle
#

Wouldn't that create the box only on the caller's machine?

willow hound
#

Yes. That's what I assumed you meant by "the box should only be spawned for one player (the caller)" πŸ™ƒ

fervent kettle
#

Sorry, then I was talking gibberish. The box should only spawn at one player's location, but globally for every player, so everyone has access to it.

spark turret
#

remoteexec on server, give player loc as input param

#

also important: if you spawn a crate locally, a server-local heli bugs out trying to airlift it

#

he cant drop it

willow hound
#

Then your code should be fine. The crate might just spawn somewhere else because the createVehicle syntax you're using treats the position argument like so:

position: Position - Desired placement position. If the exact position is occupied, nearest empty position is used.
Other than that I can't think of any reason why it shouldn't work right now.

fervent kettle
willow hound
#

That's suspicious indeed blobdoggoninja

fervent kettle
#

Soo my guess is that I messed up some serverside lines, cause it's working properly in editor.
Will definetely check on that what you told me tho

spark turret
#

checked logs for errors occuring?

#

.rpt

fervent kettle
#

as I said, didn't have time to properly debug yet. Will do that later on πŸ˜„

tidal ferry
#

Hey, quick question

winter rose
#

quick answer

tidal ferry
#

Ha sick

#

So basically

#

I'm looking to get a console made in my mission on the server, that will basically launch another mission on the server when a holdaction is completed (condition is set to either is logged admin, or is 3den MP preview)

#

I'm doing this by using remoteExec with serverCommand

#

However, doesn't seem to be wanting to work

#

Do I need to change anything in mission CfgRemoteExec? Is servercommand restricted for remoteExec?

cosmic lichen
#

If serverCommand is executed on a client, it must be executed from UI context, such as onButtonDown or similar events (see User_Interface_Event_Handlers).

tidal ferry
#

Ahhh, okay

#

Darn, glossed over that part

cosmic lichen
#

Yeah, just a big blue banner πŸ˜›

tidal ferry
#

πŸ˜‚

#

Is there any kind of workaround for it? Or do I just need to learn how to config a big red button to launch a mission?

#

And also, does that still apply if it's executed on server via remoteExec?

cosmic lichen
#

No clue.

#

Should not in fact.

tidal ferry
#

Hrm

#

And also, another question about remoteExec syntax

#

For commands like serverCommand's syntax 2 that have parameters before and after the actual command, such as password serverCommand command

winter rose
#

no. you used all your questions for today, please come back in 23:58 πŸ˜›

tidal ferry
#

What would proper syntax be for remoteExec?

winter rose
#

[password, command] remoteExec ["serverCommand"]

#

…as explained on the page :p

tidal ferry
#

Oh so it's for either side

#

Aaaaa sorry, too much coffee this morning

#

Reading comprehension skills are zero

#

Gotcha, thanks!

winter rose
#

[left arg, right arg]
or
[right arg only]
or
[]

tidal ferry
#

Ohhh okay

tidal ferry
#

:P

#

ADHD be like

#

Love caffeine but I need to know when to stop sometimess

spark turret
#

At a certain point it just increases heartrate and how fast you move you eyes lol

#

I once failed an exam bc i tried to study the night before it. Drank 3 cans of coffee and started having hallucinations

tidal ferry
#

Hahaha

#

Been there before

#

It's the worst when you try to drink coffee thinking it'll help you focus

#

But then it's just jitters galore for 12 hours straight

spark turret
#

Btw, anyone know if a bomb which i spawn automatically gets applied gravity?

cosmic lichen
#

Don't think so.

tidal ferry
#

["passWord","#mission filename.chernarus"] remoteExec ["serverCommand",2] Would this be correct syntax?

spark turret
#

I have a CAS script which spawns some on the ground bc i was to lazy for ballistics; but in theory i could just spawn it under the jet, give velocity of jet and then gravity will apply and make ballistic trajectory right?

cosmic lichen
#

yes

tidal ferry
#

Hmmm, weird, it doesn't seem to be wanting to work

#

May look for a workaround with publicVariable and a server trigger

winter rose
tidal ferry
#

What do you mean?

winter rose
#

nah nvm, got things mixed and was doing something else - please do not consider 😬

tidal ferry
#

Oh oof no worries πŸ˜‚

#

Going to retry the script on the server

#

Question, does it matter if the script is being executed from inside of a holdAction?

cosmic lichen
#

Shouldn't matter

tidal ferry
#

Hmm okay

#

Okay, so basically

#

Script isn't wanting to execute

#

I changed the syntax to use call instead of serverCommand in the hopes it'd streamline it a bit

#

And I also added a little thing that would systemchat the output of serverCommandAvailable "#mission" via remoteexec

#

But it didn't output

#

And it didn't function as intended

#

So hrm

#

Does "password" serverCommand work if there's a logged admin?

#

Oh wait! Huh

#

So I'm in debug console right now, and for some reason

#

I'm executing servercommandavailable "#mission" on server via debug and it's returning false

#

I wonder why

cosmic lichen
#

Because you are not logged in as admin

tidal ferry
#

I was logged in as admin to access debug console

#

And I'm executing this on the server, which is strange

#

Or well, server exec via debug console so idk

tidal ferry
#

Argh, still can't get this to work

#

I tried a work around by having a trigger that would servercommand, which was triggered when a certain publicVariable was broadcast to true

#

But that still didn't do anything

#

It was set to server only as well

#

Any ideas...? Close to giving up on this for now

brazen lagoon
#

@digital vine I think I have, but what was your fix?

fervent kettle
#

@willow hound this is how my trigger creation looks like (weirdly it did not show me Alpha radio on a dedicated today)

_createTriggerAlpha = createTrigger ["EmptyDetector", getPos player, true];
_createTriggerAlpha setTriggerActivation ["ALPHA", "PRESENT", true];
_createTriggerAlpha setTriggerStatements ["this", "execVM '_resupply\createChest.sqf'", ""];
#

Oh wait a dayum second, forgot the =

spark turret
#

You should choose a more intuituve varname, not "createTriggerAlpha". Just a sidenote

winter rose
#

_alphaTrigger could do πŸ™‚

fervent kettle
#

Yep, but wasnt it like the first step is to make it functional? πŸ˜…

winter rose
#

good naming makes brain gooder

#

anyway, what's wrong?

fervent kettle
#

Well, after adding = it drops me a "missing ; on line 2 & 3" πŸ€”

digital vine
brazen lagoon
#

sure, or put it on pastebin

fervent kettle
#

Just to make sure, you dropped that into init.sqf?

cosmic lichen
#

Question is, why even use triggers. You are scripting the whole stuff anyway. Might as well drop the triggers.

cosmic lichen
fervent kettle
fervent kettle
willow hound
#

Does it work with an Editor-placed Radio Alpha trigger?

fervent kettle
#

Yas, it's dropping an error for the trigger creation currently

astral dawn
#

Idea for hashmaps:

  • Ability to add an event handler which is called when hashmap is deleted. Perhaps it might be not stackable.
still forum
#

I love it, but that'd be weird ish think_turtle

#

would need a new addeventhandler command oof

#

ah not stackable.. yeah.. yeah sounds nice

astral dawn
#

or... or... it checks a special entry inside itself πŸ₯³

still forum
#

UH

#

yes :3

#

feedback ticket

astral dawn
#

\o/

#

need to remember my password

still forum
#

needs to explicitly be set via set tho, no createfromarray, because reasons

astral dawn
dreamy kestrel
#

Q: if I am looking for buildings and I know the class name, can I use allSimpleObjects?

astral dawn
still forum
dreamy kestrel
#

hmm, well, a better question is, can I query for buildings, knowing the specific class name, without necessarily needing a target object or position, and radius? i.e. nearestObjects or nearObjects

astral dawn
spark turret
#

buildings can be selected with on of the proximity commadns

#

but it also includes a lot of crap like powerlines and hayballs as "buildings"

#

especially on modded map

cosmic lichen
#

Use house instead of building and nearestObjects

dreamy kestrel
#

I actually do know the class, I do not need to guess building or house. I'm just trying to narrow the field a bit to identify those specific building objects.

digital vine
#

Right guys, me again.....
Trying to get the following working via a radio command Trigger

GroupC130 = CreateGroup West; 
C130Crash = createVehicle ["CUP_B_C103J_GB", [(getMarkerPos "C130Spawn") select 0,(getMarkerPos "C130Spawn") select 1,100], [], 0, "FLY"]; 
C130Pilot = GroupC130 createUnit ["B_Pilot_F", [0,0,1], [], 0, "CAN_COLLIDE"]; 
C130Pilot moveInDriver C130Crash; 
wp1 = GroupC130 addWaypoint [(getmarkerpos "C130Target"), 0]; 
wp1 setWaypointSpeed "NORMAL"; 
wp1 setWaypointType "MOVE";

However, nothing happens, but I cannot see why, can someone enlighten me?

spark turret
#

checked .rpt for errors?

#

also there is a command to spawn a vehicle with crew included

#
_arr =
[
    _spawnPos,      //position
    _dir,               //direction
    _planeClass,            //type
    civilian                //side
] call BIS_fnc_spawnVehicle;
digital vine
#

I'm going to sound incredibly simple right now (probably warranted), what is .rpt?

winter rose
#

!rpt

wicked roostBOT
#
Arma RPT

Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.

To get to your RPT files press Windows+R and enter %localappdata%/Arma 3

Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files

To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.

spark turret
#

.rpt is your best friend when scripting arma. i wish someone would have told me years ago. I used to debug with hint str _myValue. had to run code again and again bc sometimes the hint was gone to fast

digital vine
#

I get the following :

18:27:47 Cannot create non-ai vehicle CUP_B_C103J_GB,
18:27:51 Cannot create non-ai vehicle CUP_B_C103J_GB,

I notice it states 'non-ai'?

spark turret
#

huh that looks wierd

digital vine
#

I see the issue I think...............

#

Turns out I need to check what I type...... CUP_B_C130J_GB instead of CUP_B_C103J_GB

#

Thanks for the .rpt point though!

spark turret
#

np. also take a look at diag_log command

#

very helpful too

digital vine
#

What does that show? πŸ™‚

spark turret
#

it prints strings into the .rpt

#

makes it easier to debug stuff if you can print your values into rpt

#

sqf stepper when @ded_men

past wagon
past wagon
#

thanks

willow hound
#

spawn returns the script handle of the spawned code, so the wiki page is wrong for stating that BIS_fnc_guiMessage should be used with spawn.
Instead, call must be used to get the boolean return value; but call is blocking, meaning your code stops at that call and waits for BIS_fnc_guiMessage to finish and return its result.

#

As such, your variable _message actually contains the script handle of the running instance of BIS_fnc_guiMessage, not the result of it. That's why the if-statements don't work.

#

Something like this should work better:

//Timeout:
[] spawn {
  sleep 10;
  uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];
};
//Call BIS_fnc_guiMessage and wait for result:
private _result = [...] call BIS_fnc_guiMessage;
//Use _result:
if (_result) then { ... } else { ... };
graceful pewter
#

Does anyone know of a blindfolding script or mod?

graceful pewter
#

many thanks

twin garnet
#

For some reason
(_vehicle isKindOf "Boat")
isnt returning anything

anyone know why or if I am using the wrong vehicle type?
I've also tried "Ship" to no avail.

cosmic lichen
#

@twin garnet What vehicle?

#

_vehicle is defined?

spark turret
#

not returning anything looks like an error

#

check .rpt

tidal ferry
#

Anyone know why when I execute serverCommand "#missions" on server, it does nothing?

#

I know it needs UI Context on client to execute

#

But I've got it tied to a server-only trigger and it still won't fire

astral dawn
#

I know it needs UI Context on client to execute
it means you must run it from event handler of some UI element, like on button click

tidal ferry
#

I have it inside of a trigger

#

Trigger is set to only execute on server

#

It executes when a public variable is set to true

astral dawn
#

I have explained what UI context is

tidal ferry
#

Yes, I know that

#

If serverCommand is executed on a client, it must be executed from UI context, such as onButtonDown or similar events (see User_Interface_Event_Handlers).

#

I know if serverCommand is executed on client, it must be UI context

#

What I'm asking is

#

If it's executed on server

#

Does it have to be UI context as well?

astral dawn
#

Ok sorry I might have misunderstood you

tidal ferry
#

Yeah gotcha

#

All g

cosmic lichen
#

Did you actually try if it works from ui context on client side?

tidal ferry
#

Yes, and it did

#

So that's my Plan B

cosmic lichen
#

just create a button. Use setButtonAction and use buttonActivate to fire it

#

takes 5mins and boom

#

You can even create that button off screen

tidal ferry
#

Hmmm...

#

That's a good idea, I'll try that

astral dawn
#

I wonder if it might work if you create a control and delete it and put code into the 'deleted' event handler of the control πŸ€”

#

Anyway I actually don't remember if server command can be executed on server at all!

cosmic lichen
#

It should

#

host = server

tidal ferry
#

I've tried it via the trigger method I mentioned and so far no success

#

No success with remoteExec either

cosmic lichen
#

triggers = no bueno anyway

tidal ferry
#

Very fair

tough abyss
#

Hey so im looking for a command i can put on the init of a helicopter to ensure that it will not be fired on (its a medical helicopter) nor will the people inside be fired on, any help is appreciated

cosmic lichen
#

Or put civilians in there

violet gull
#

Is there a way to check if an EH was removed?

winter rose
#

no

#

unless removeAllEH has been used, in which case the next added id will be 0

tidal ferry
#

Question, is it possible to have remoteExec produce a return value?

winter rose
#

no

tidal ferry
#

Hmmm

winter rose
#

not in the way you think it

cosmic lichen
#

how would that work πŸ˜„

tidal ferry
#

Well, I want to have server query a variable from client profileNamespace

#

To be used in a subsequent remoteExec script (it's complicated)

violet gull
#

It can be done but you need to write 3 functions

cosmic lichen
violet gull
#

Send, receive, and redistribute

cosmic lichen
#

That's all remoteExec can return directly

#

Anything else via extra functions

violet gull
#

FN1 = Ask server for the variable
FN2 = Get variable on server
FN3 = Send result back to requester

#

If trying to ask server for a server-side variable with remoteExec & getVariable

tidal ferry
#

Actually I could probably just use publicVariableServer

#

Yeah I'll go with that

astral dawn
tidal ferry
#

Hmm okay

astral dawn
#

so yeah as people said you should better execute something on client then send the response to server with the data

violet gull
astral dawn
#

oh damn I've watched through the whole animation of your avatar πŸ˜„

digital torrent
#

hello, anyone know where i can find the list of all the arma 3 normal weapon's bullet type that i can use for createvehicle

ex: "R_PG7_F", "M_NLAW_AT_F", "R_PG32V_F", "R_TBG32V_F", "M_TITAN_AT", "M_TITAN_AP", "Bo_GBU12_LGB", "BombCluster_01_Ammo_F"

fair drum
#

the engine will use the one it needs typically, automatically making it _F I believe. I think @little raptor made a post a while ago about how the engine changes to what it needs

#

at least I think it was leo... could be mistaken

broken forge
#

How would I get a function that I created to be called/spawned within an object's init field?

smoky verge
fair drum
broken forge
#

@smoky verge _f stands for futura, and _e stands for expansion

smoky verge
#

oh that makes more sense
because I see it in almost every arma Pbo name

fair drum
#

cause you'd want it preInit then

broken forge
#

it's packed in a pbo

fair drum
#

are you running into an issue where the function doesn't exist by the time the object init field is called?

broken forge
#

@fair drum should I add a param to enable a preInit

#

My function is called via the init.sqf, if on server then it'll be called from the initServer.sqf, then I have the following in an object init field [objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop;

fair drum
#

well what exactly is your problem?

broken forge
#

Well the sound doesn't play, and I don't know why, yet if I use the editor console and execute the command from there it works [objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop;

#

Function called inside the init.sqf or initServer.sqf: ```sqf
[] call SOG_fnc_Soundscape;

#

Then I spawn the following inside the object init: ```sqf
[objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop;

broken forge
#

I've added this to the command, which seems to work: sqf [] spawn { waitUntil { !isNil "objName" }; [objName, "NameOfSFXSound"] spawn SOGAmbientSoundLoop; }; My next question would be how to implement that into the script itself instead of having to incorporate it when adding it to an object init field

fair drum
broken forge
#

@fair drum Could you give me an example?

fair drum
#

then you put in your code that you'd want in that init "box"

broken forge
#

@fair drum I'm still not following, my mind has gone blank, lol

fair drum
broken forge
#

I would like to use object init fields

fair drum
#

oh then I completely missed the goal you are looking for

little raptor
#

This channel is only for Arma scripting. The only channel that is (just barely) related to your question is #offtopic_software

daring parrot
#

My apology, will move this question

little raptor
#

but better ask this question in stackoverflow/superuser or something

daring parrot
#

Thank you for kind suggestion

carmine sand
#

Is there a way possible to make side/faction specific stuff invisible ingame?

As example, lets say a house:
You got a user action and its called "Hide House"

BLUFOR is still able to see it ingame, while OPFOR cant see it ingame

Would be nice if there is any kind of ways to make this happen, but should be MP perfomance/server friendly πŸ˜…

cosmic lichen
#

hideObject, remoteExec, units, east, west. These are some of the commands you wanna use

tough abyss
#

Hey so uh, does anyone happen to know how i can mount say a cheetah turret on a hunter? I would post a picture to show it better but im lacking permissions. If anyone knows please ping me

spark turret
#

you cant merge parts of vehicle a onto vehicle, only through modding

young storm
#

Anyone know stalkers anomalies? The stand alone mod that just adds them, so the teleporter module is it possible to script it so vics can get auto tp'd too?

lean heath
#

Hi, I'm making a little script (I have pretty much no knowledge on SQF just started learning recently)
I'm making a mission for some friends and I want a single script, that when the blufor enters the trigger a squad will spawn on the map marker closet to the trigger that was triggered. This is what I got and it doesnt seem to be working.


_nearestMarker = [allMapMarkers, this] call BIS_fnc_nearestPosition;

group_1 = creategroup independent; 
enemy1 = group_1 createunit ["I_Soldier_SL_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy2 = group_1 createunit ["I_medic_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy3 = group_1 createunit ["I_Soldier_AR_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy4 = group_1 createunit ["I_Soldier_AAR_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy5 = group_1 createunit ["I_Soldier_TL_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy6 = group_1 createunit ["I_Soldier_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy7 = group_1 createunit ["I_Soldier_F",getmarkerpos "_nearestMarker",[],0,"form"];
enemy8 = group_1 createunit ["I_Soldier_LAT_F",getmarkerpos "_nearestMarker",[],0,"form"];

_enemyArray = [enemy1,enemy2,enemy3,enemy4,enemy5,enemy6,enemy7,enemy8];

waitUntil { {player distance _x > 1200} forEach _enemyArray };

{deletevehicle _x} forEach (units group_1);
deleteGroup group_1;

Note if I replace the "_nearestMarker" in each of the enemy lines the script does spawn them but only at 1 marker

willow hound
#

@lean heath Where does this code run from? The On Activation field of a trigger?

lean heath
#

Its in a .sqf file that the trigger runs with this in the activation field: ``` 0 = ["_nearestMarker"] execVM "spawnUnits.sqf";

In my testing I only got it working by giving the marker and actual name in this case outpost_frini instead of _nearestMarker
patent lava
#

that's because it will be searching for a marker named _nearestMarker

#

is there a marker named _nearestMarker?

#

_nearestMarker looks to be a variable, so remove the quotes when passing it to the script:

#
 0 = [_nearestMarker] execVM "spawnUnits.sqf"; 
lean heath
#

ah, okay.

patent lava
#

otherwise it will be seeing _nearestMarker as text, and not take it as a variable

lean heath
#

Understood, I'll try it out

willow hound
#

Havoc is right, but there are more problems.

lean heath
#

Yea I just tried it and it didnt spawn, I assume the errors are in my script?
I did replace "_nearestMarker" with [_nearestMarker]

willow hound
#

this is undefined and also can't be used in the On Activation statement of triggers. As such we have to alter the beginning of the script:

params ["_trigger"];

private _nearestMarker = [allMapMarkers, _trigger] call BIS_fnc_nearestPosition;
```As well as the way we call it in the trigger:
```sqf
[thisTrigger] execVM "spawnUnits.sqf";
#

This script also can't be used with a dedicated server because you try to use player in the waitUntil-statement (while forcing the script to only run on the server in the first line).

lean heath
#

so it works if I name the trigger _trigger, but what if I want multiple triggers to run the same script (Affecting the marker closet to the trigger that calls the script?)

willow hound
#

I have a lovely optimisation for you as well πŸ™‚

private _group = createGroup independent;
private _enemyArray = [];
{
  private _unit = _group createUnit [_x, getMarkerPos _nearestMarker, [], 0, "FORM"];
  _enemyArray pushBack _unit;
} forEach ["I_Soldier_SL_F", "I_medic_F", "I_Soldier_AR_F", "I_Soldier_AAR_F", "I_Soldier_TL_F", "I_Soldier_F", "I_Soldier_F", "I_Soldier_LAT_F"];
tender fossil
#
  • nvm -
winter rose
#

and what "doesn't work"?

carmine sand
tidal ferry
#

Hey, question

#

What's the best method for generating a varname from script?

#

For example

#

I have a script that creates a unit on server every time a player joins (onPlayerConnected eventhandler)

#

And I want the variable name of that created unit to correspond to the machine ID of the player (e.g. unit_17, unit_19, etc.)

#

How would I go about doing that properly?

tidal ferry
#

Yes

winter rose
#
missionNamespace setVariable [format ["unit_%1", owner _unit], _unit];
tidal ferry
#

Hmm okay

winter rose
#

what is wrong? is anything wrong?*

tidal ferry
#

No no just going to try it to see if it works

#

Give me a sec

#

Okay, so would I then need to broadcast that missionNamespace variable to clients?

winter rose
#

if you need it client-side

tidal ferry
#

How would I go about doing that? Just publicvariable or?

winter rose
winter rose
hoary halo
#

Hey there. I'm desperately trying to make a recruitment script similar to hunter 6, meaning you get standing static AIs that you can recruit at a main base, you approach them you get either an addaction/hold action to recruit them, then you can dismiss them whenever you like and they'll stay where you dismissed them. I did not found any similar thing, and looking at hunter 6's files I can't even find a single line referring to how he scripted it. Anyone ever did something similar ? Cheers

#

Oh yeah I did found something tho

tidal ferry
hoary halo
#
MMF_fnc_recruit=
{    params ["_caller"];

    if (_caller== player) then {
MMF_recruitAction=[ player, "Join Group", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"player distance cursorTarget<5 && (cursorTarget getvariable ""MMF_isRecruit"") <1", "playerSide isEqualTo side cursorTarget", {}, {}, { 
[cursorTarget] call MMF_fnc_recruit;
}, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd;
    } else {

    [_caller] join (group player);
    systemChat "Joined group";
    _caller setVariable ["MMF_isRecruit", 1];
dismissAction=_caller addAction ["Dismiss", "[_this select 0] join grpNull; (_this select 0) setVariable [""MMF_isRecruit"", 0]; (_this select 0) removeAction dismissAction;"];
_caller addEventHandler ["Killed", {
                (_this select 0) removeAction dismissAction;
                }];
    };
};
tidal ferry
#

Prolly can't get machineID with it, but oh well

winter rose
tidal ferry
#

I really don't tbh

winter rose
#

then don't? Β―_(ツ)_/Β―

tidal ferry
#

Just figured it might be useful for troubleshooting down the line

#

And yeah fair

#

Might use this too

#

I mean one or the other

#

I'll see which works best

tidal ferry
#

Okay so good news is that setVehicleVarName mostly worked

#

However instead of saying "unit_5", "unit_6" etc.

#

It says "unit_scalar" or "unit_any"

#

Think it has something to do with how I'm providing the string

#
        _unit setVehicleVarName _unitString;
#

Thoughts?

winter rose
#

yep, what is _owner?

tidal ferry
#

It's a param for onPlayerConnected that provides Machine ID of the connecting client

winter rose
#

is it executed server-side?

tidal ferry
#

Yes

#

However I want the variable for the created unit to be recognized globally

winter rose
#

but you don't have the unit yet

tidal ferry
#

No so basically, I created _unit a few lines earlier

#

That is executed on server

#

        _unitString = format ["unit_%1",_owner];
        _unit setVehicleVarName _unitString;
#

Ignore the whack group name

winter rose
#

can you make the smallest repro?

tidal ferry
#

Repro?

winter rose
#

reproduction of the issue
remove all the code that is not linked to the issue, and provide the error-prone code

tidal ferry
#

That's basically it

#

Everything else works fine

winter rose
#

then _tempPos is undefined

tidal ferry
#

The only problem is that the variable name doesn't update properly

#

Ah sorry, yeah that's just the spawn location for the unit

winter rose
#

that's what I mean; remove everything but what you want to test
so basically

addMissionEventHandler ["PlayerConnected",
{
  params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
  private _name = format ["unit_%1", _owner];
  systemChat _name;
  diag_log _name;
}];
```and check the results
tidal ferry
#

Hmm okay

#

Wait

#

Obscenely I think I changed something and it worked

winter rose
#

Armagic

tidal ferry
#

Ayy

#

I changed it to remoteexec globally instead of executing it on server since Biki says it needs to be executed on all machines

#

And then added in params

#

And I think that did it

#

Going to check on dedicated to see if my hopes are dashed

#

But thanks for the help!

#

Hey, one last question, does onPlayerConnected eventhandler execute for everyone including server?

winter rose
#

well IDK, if you are the server I would say you cannot really "connect"?
anyway, server is always 2

tidal ferry
#

Well I mean, does onPlayerConnected fire for server on mission load

winter rose
#

that's what I say, IDK

#

I think initServer.sqf triggers after network creation

#

but you can try and tell us

smoky verge
drifting portal
#

does anyone know how to execute multiple lines of code remotely? (remoteExec)

winter rose
drifting portal
winter rose
#

no

winter rose
#

file location

missionDir.terrain\Functions\myCategory\fn_myFunction.sqf

declaration

class CfgFunctions
{
    class myTag
    {
        class myCategory
        {
            class myFunction {};
        };
    };
};

usage

[] remoteExecCall ["myTag_fnc_myFunction"];
hollow thistle
winter rose
hollow thistle
#

it will work if he will define that on the client/target machine.

winter rose
#

yep.

hollow thistle
#

defined.

winter rose
#

if the code exists as a global variable there

drifting portal
#

I will be using a trigger with Server only

winter rose
#

so don't use that

drifting portal
winter rose
#

yes

drifting portal
# winter rose yes

another simple question, how do I access this directory? ```sqf
"\A3\ui_f\data\map\mapcontrol\taskIconDone_ca.paa"

winter rose
#

@drifting portal ↑

drifting portal
winter rose
#

I don't know, I use PBO Manager πŸ˜„

cosmic lichen
#

yes BankRev

drifting portal
cosmic lichen
#

Should work fine.

#

Any error?

winter rose
#

you can open PBOs, you cannot open EBOs

drifting portal
# cosmic lichen Any error?

Processing music_f_exp_music (53 MB)...
Fail to process music_f_exp_music after 00:00:02.2010672
Failed to convert 1 file(s)

drifting portal
cosmic lichen
#

Verify your Arma 3 Tools files in steam.

drifting portal
#

lets stop speaking here, off-topic

drifting portal
mystic current
#

hello guys. I wanted to know if it is possible to have server and client times async to each other.

#

from what i saw, the daytime gets synced back to server time about 5 secs after a local change.

#

i want to stop that from happening so i can have clients on the server that have daytime, while others have nighttime

hollow thistle
#

you can set in in eachframe, it will work but it's a bit hacky.

past yew
#

I'm working on kp lib so the following question will kindve revolve around that framework and yes I've already inquired on their discord: I'm trying to get players automatically assigned to a group based on the role they select when joining.

hollow thistle
#

And might have some performance impact too.

mystic current
#

well, but its a local script, so the server perf wont drop i guess

hollow thistle
#

yea, client might but i've played an op that did caves being darker like this and it worked just fine.

mystic current
#

i just need dark interiours for underground areas

#

ive played aroung with setAperture, but that literlaly just lowers the gamma, so light sources dont work

hollow thistle
#

they do but they need to be really strong to be visible in daytime.

#

So kinda does not work if you can't change eg. flashlight power.

mystic current
#

hmm. I think the each frame hack is way more smooth

#

since it literaly gives the client all the night time shader settings

drifting portal
#

I want to spawn something 500m away from a player, but I'm not figuring out how to get [x,y] that is 500m away from a player, I'm looking on the internet too, any idea?

drifting portal
amber basalt
#

Hello. I have a little problem in Arma 2 OA 1.64 scripting. I have a custom ammo count which is 1 and the original size of the magazine is 4. However, when I use service point, it goes back to 4. I want to keep it at 1 at all the time. Is this possible? Is there any way?

drifting portal
#
while {true} do 
{
_w = selectRandom [squadleader, themedic, theat];
_s = [0, 360] call BIS_fnc_randomInt;
_l = player getRelPos [500, _s];
_veh = selectRandom ["CUP_I_BTR40_TKG", "CUP_I_Hilux_unarmed_TK", "CUP_I_Hilux_armored_unarmed_TK"] createVehicle _l;
_crew = createVehicleCrew _veh;
systemChat format ["Spawned %1 at %2 to attack %3, driver is %4", [configFile >> "CfgVehicles" >> typeOf _veh] call BIS_fnc_displayName, _s, _w,driver _veh];
driver _veh disableAI "all"; 
driver _veh enableAI "MOVE"; driver _veh enableAI "ANIM"; driver _veh enableAI "PATH";
_crew setSpeedMode "FULL";
//placeholder
while {alive _veh} do {
driver _veh doMove (position _w); //here
// put (sleep 1;) here
if (_w distance _veh < 20) then {
"Bo_GBU12_LGB_MI10" createVehicle (getPos _veh);
};
};
sleep 70;
};

when I do this (notice //here comment) the vehicle driver (_veh driver) doesn't move to the desired entity location, the driver only moves to the desired entity location if I place the move order at //placeholder command, but that means if the desired entity moves the _veh driver won't drive to it, but will drive to its older position, I need the driver to follow the entity, anyone got an idea?
Update : I remembered that when you give AI a "MOVE" command, it will stop a bit and then execute it and since the original code had it execute for every single frame of the game (60 fps so 60 times a second) that made the bot just stand still getting new orders every frame, causing it to stand still trying to execute a command but is given another command anyway, by adding a delay (sleep 1;) it fixed everything, you can see a comment where I placed //sleep 1;

mystic current
#

@hollow thistle yo dude. could you DM me up if you have time?

astral dawn
#

question about hashmaps:
what should I write in params if I am expecting a hashmap argument?
this: params [["_hashmap", createHashmap, [createHashmap]]] ?

#

would make sense if there was a hashmapNull πŸ˜„ although technically it makes no sense because it's not an engine-owned object and it can't get nulled while it's still referenced somewhere

robust hollow
#

thats what ive been doing

astral dawn
#

imagine if we had to createVehicle for params πŸ˜„

drifting portal
#

I'm trying to understand how camSetDir work, but nobody on the internet mentions it, any idea?

robust hollow
drifting portal
robust hollow
#

if you use it with vectorFromTo its pretty straight forward. the first argument would be the camera position, the second would be where you want the camera to look

drifting portal
little raptor
cyan dust
#

Good day, does anyone have experience in writing Expression block for SpawnAI module? It says that passed arguments are 'group', 'module' and 'groupData' but I can't get any of them not by 'this select 0' (undefined this) nor by 'params['group']' (local variable in global space)

little raptor
little raptor
#

local variable in global space

#

it already says what's wrong

cyan dust
cyan dust
cyan dust
#

And another one - is there a way to prevent units from boarding the vehicle when using 'doMove' or 'commandMove'? πŸ€”

little raptor
cyan dust
#

The vehicle is a part of a group, maybe that's why

little raptor
cyan dust
still forum
winter rose
#

Different name
is the confusing part I guess

#

ve vant a standart API, schnell! bitte :p

cosmic lichen
#

standard*

winter rose
#

zat wos for ze pronuncee-ayshun

cosmic lichen
winter rose
#

like I can help on Arma servers πŸ˜‚
still, going πŸ˜‰

dusky pier
#

Hello, is possible to get maximum allowed count units for given side (defined in mission.sqm)?

smoky verge
#

can someone help me creating custom side chat messages?
or at least something that looks like side chat?
according to the biki
https://community.bistudio.com/wiki/sideChat
in order to give it a custom name I need to create a cfgHQidentities
is that done from the from the description.ext?

winter rose
#

my pleasure sir salute

winter rose
smoky verge
#

trying to replicate a player chat message
basically as if a player had sent that message in side chat

#

but in order to do that I'd need the correct name to pop up

winter rose
#

why not use that unit? or is it not existing

smoky verge
#

that was sent by a real player

#

is there a way to send messages as if a specific unit has sent them?

#

I can create an unit with that name if it helps

winter rose
#

you can do that, it's the simplest way

smoky verge
warm hedge
#

Basically yes, it's a wrong code, tho

smoky verge
#

had no doubts

winter rose
#

createGroup
createUnit
sideChat

#

so basically yep

smoky verge
#

can I not place a unit in eden instead of createGroup+CreateUnit?

winter rose
#

yes you can

smoky verge
#

and I guess the name should go in identity?

winter rose
smoky verge
#

the name that goes in _soldier = NAME in the sqf
the NAME should be defined in the unit identity attribute?

dusky pier
winter rose
#

nah np

winter rose
smoky verge
#

yeah, to clarify what I understood.
I need to place down a unit, then go in it attributes, scroll down to the identity tab and name it "john doe"
then I open the sqf and write something similar to
_soldier = john doe
_soldier sideChat "text";

I might have misunderstood something though

winter rose
#

it will be the name shown yes

#

sideChat displays "groupName (personName)"

smoky verge
#

oh wait I need to use the variable name not the identity name right?

#

yeah variable

#

but only the groupName shows up not the person name

copper raven
winter rose
smoky verge
#

so no way to have a name pop up?
I've tried putting the AI in its own group and then renaming the group thanks to CBA so that it includes the name
but it doesn't seem to work neither

winter rose
#

rename the group in the editor maybe?

little raptor
smoky verge
#

yeah that worked

#

its not exactly 1:1, the text is more whiter and it has " at the beginning and the end
but it'll do

sour flint
#

Hey, novice editor here. I'm trying to create my own little runway using the following code, but the objects tilt themselves relative to the ground they're standing on.

_Run1 = createVehicle ["Land_AirstripPlatform_01_F", [6808,2817,0], [], 0, "NONE"];

Is there any way of placing these objects so they're level?

winter rose
spark turret
#

Why does setDir 0 change its up vector?

winter rose
#

that's Arma to you πŸ˜„

#

it sets the object's direction in 2D only, thefore it resets the "vertical" dir

spark turret
#

Ah okay

winter rose
#

you can setVectorUp back to surfaceNormal if needed πŸ™‚

sour flint
#

lovely, thanks. I'll give that a try.

drifting portal
#

sorry for posting images

class CfgFunctions
{
    class camera
    {
        class controls
        {
            class setDir {
            params ["_cameraname", "_degree","_elevation"];
            _p = cos _degree;
            _z = sin _degree;
            _p = _p *5;
            _z = _z * 5;
            _cameraname setDir [_p,_z,_elevation];
            };
        };
    };
};
``` it says (in the image) there is something wrong, what is it?
winter rose
#

yes, you don't write functions in the config πŸ˜‰

drifting portal
#

ouch

winter rose
#

also no need to apologise for posting images, as long as it is related to what you say and it has a description πŸ™‚

drifting portal
#

I placed it in description.ext

winter rose
#

yep

drifting portal
winter rose
drifting portal
winter rose
#

nope, fn_

south gale
#

I want to make an Addaction that kills the player when they do the action on the object
How would I do this?

drifting portal
#

is it a MP or a SP ?

winter rose
#

with addAction and setDamage πŸ™‚

south gale
#

setDamage, thank you
And so what do I set the damage to?
99999?

drifting portal
#

1

#
player setDamage 1;
south gale
#

Alright so
this addAction ["Kill", setDamage 1];?
I doubt it is but I really dont know how to script lol

#

This is just for a prank

drifting portal
#

in the script "slot" you must include the script between {}

#

so

#
this addAction ["Kill",{player setDamage 1;}];
#

you also forgot to add who is going to get damaged ^^ and the semicolon ;

#

btw in case this is a MP mission, this action is going to get added every time a new player join, so say 3 players join, its going to get duplicated 3 times

south gale
#

So what should I do for MP?

drifting portal
#
[this, ["Kill",{player setDamage 1;}]] remoteExec ["addAction"];
#

be sure to put this in init of the object

south gale
#

Yeah, I did that
Thanks!

drifting portal
#

Welcome lol

south gale
#

Final question, is this ACE compatible?

drifting portal
#

yes

south gale
#

Wonderful
Thank you again

#

You wanna see what I did with it?

drifting portal
#

you can't post images here, send dm

south gale
drifting portal
fair drum
#

you remote executed that to the server

#

the server doesn't have a player

#

and the server doesn't have a UI for an action anyways

fair drum
#

you are using an init box

#

just make the action normally

#

and it will fire on every client

#

which is what you want

#

no need to remote exec

#

addActions are local, they need to be fired on every client you want to see it.

winter rose
fair drum
#

@south gale

drifting portal
drifting portal
#

it does

winter rose
#

if you name the function class setDirm {}; in Description.ext, it will look for fn_setDirm.sqf

drifting portal
#

it does

winter rose
#

the function will be declared globally yes, like any BIS function πŸ™‚

fair drum
#

whats the display and control for the inventory opened menu?

copper raven
#

602 i believe

winter rose
fervent kettle
#

How come the server is crashing when this is in my initPlayerLocal.sqf

if (hasInterface && didJIP) then {
    [player,"resupplyTest"] call BIS_fnc_addCommMenuItem;
    hint "player action added";
};
copper raven
#

don't think thats the reason for crashing

fervent kettle
#

that's the only thing I've changed tho. Moved that line from init to initPlayerLocal

copper raven
#

it doesn't make sense

#

also hasInterface is obsolete there

fervent kettle
#

Oh okay, how come?

cold pebble
#

HC's used that to

winter rose
cold pebble
#

So not obsolete

#

πŸ˜›

#

Timing OP pls nerf

winter rose
#

mi

cold pebble
#

Is "resupplyTest" a valid subclass of CfgCommunicationMenu

fervent kettle
cold pebble
#

itemClass: String - CfgCommunicationMenu class

#

doesn't look like it

fervent kettle
#

looking through the web and at other peoples Cfg's, they all have used (probably) user made classes

#
  • the com menu does get added in SP
#

does onPlayerRespawn.sqf get executed when players first spawn, or after first "actual" respawn

brazen lagoon
#

What's the difference between killer and instigator?

winter rose
brazen lagoon
#

ic

#

so you want to use instigator if it's available

winter rose
#

what killed vs who killed πŸ™‚

brazen lagoon
#

right

#

is instigator always there?

winter rose
#

I believe so, but maybe do some tests to be sure
It should be objNull in the case of a fall iirc

tough abyss
#

sorry to interrupt but does anyone know how i can fix my turret ammo being infinite?

#

this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}] ;
this addWeaponTurret ["Rocket_03_AP_Plane_CAS_02_F",[0]];
this addMagazineTurret ["20Rnd_Rocket_03_AP_F",[0]];

#

when i change the 0 value on the magazine or turret itself it just breaks

winter rose
#

remove the event handler

tough abyss
#

thats it?

#

oh yeah

#

cheers

#

now for my next question is there any way to add a object to the turret so say if i turn my turret the object turns with it

winter rose
#

I am not sure, try attachTo

tough abyss
#

nah just seems to attach it to the vehicle itself

#

i shall continue

#

and then curse everyone with shitty technicals

winter rose
foggy hedge
#

What's the best way to get an array of ALL the classnames of items in a specified box?

I've tried playing around with ItemCargo, everyContainer, magazineCargo, weaponCargo but they all only work for their specific type of item and some output as [[classname1,classname2][#itemsClassname1,#itemsClassname2]] while others output as [classname1,classname2], which makes writing a script that runs each of the above commands and returns them all to be difficult because of the slightly different output formats (still possible though, just want to make sure I'm not missing something obvious first before I work on that approach).

Overall purpose is to create faction-based ace arsenals by getting the classnames of all items in each supply box for that faction and then manually combining (and editing anything that wasnt in the boxes like ace medical) the outputted arrays of each box into one array to init the ace arsenal with

frank mango
foggy hedge
#

Huh I wouldn't have expected ALiVE to care about specific items in boxes, interesting. I assume you're referring to the ORBAT tool?

brazen lagoon
#

I'm trying to script something that gives me points on killing enemies, but for some reason the units are claiming to be on the civilian side

#

any idea why this might be?

#

@tough abyss try different attachment points

#

there's a bunch of different ones

foggy hedge
brazen lagoon
#

thats probably it

#

but they're not captive or dead

#

oh duh.

#

its firing after they're killed

#

so ofc it claims they're always civ

frank mango
spark sun
brazen lagoon
#

makes sense

frank mango
#

Dont ask me about getting that acustom ammobox ingame though., as I could never do it with issues. :/

brazen lagoon
#

I think for ammo boxes like that I just made a script that filled it and called that script in a custom init function in description.ext w/ cba

foggy hedge
#

i've never done ALiVE ORBAT, only alive mission making with premade factions, but I've heard that it is cursed.

Thankfully, I just need the classnames of the items so that I can call the Ace arsenal init with them, no custom boxes needed

frank mango
#

Long run, multi missions its great.

#

But one-offs arent worth it tbh

brazen lagoon
#

honestly i think the opposite once you know alive it makes making quick missions way easier

frank mango
foggy hedge
#

Yeah man I love ALiVE and hang around the discord for it, just never felt the need to make a custom faction for it since a ton are already set up

#

anyways slightly off topic yeah

brazen lagoon
#

oh yeah for sure the ORBAT tool is super powerful but its also p tedious

#

if you can find what you need in CFP its probably good enough

frank mango
#

CFP, CUP, ProjOP, 3cb Fac

Any of those tend to be enough tbh.

tough abyss
brazen lagoon
#

1 sec

#

that's what I'm talking about

#

each object you can attachTo has a bunch of memory points

frank mango
#

Are you wanting a player used ammobox/arsenal or is it AI?

Cus player wise, just using ACE arsenal and then exporting it or saving it as a custom comp works. @foggy hedge

brazen lagoon
#

I've been thinking of making an addon that basically ports the gmod weld tool into arma

#

because that sounds incredibly funny to me

frank mango
brazen lagoon
#

well not necessarily

#

you can get offsets between two objects in modelspace and then it would "just" be a matter of doing attachTo with that offset

#

imagine welding one of those emplacement guns into an Mi-6 cargo bay and flying around with a little crappy AC-130

#

oh or putting the ZSU-23-4 turret on something

#

honestly on literally anything, that turret is always a barrel of laughs

brazen lagoon
#

yes! just not limited to only the PLP materials stuff

#

just weld any 2 objects together

foggy hedge
# frank mango Are you wanting a player used ammobox/arsenal or is it AI? Cus player wise, ju...

Used by players, I'm creating a limited ACE arsenal with only faction (and some misc. like medical supplies) gear. As far as I could tell there's no easy way to restrict the ACE arsenal to a specific faction or addon, so I'm creating a whitelisted arsenal.

I've tried getting the classnames of all the gear by placing down every AI from the faction and running a script snippet that copies all their gear, that worked but there's a number of gear not loaded onto the default units (but are in the boxes) that I want to include so here I am

frank mango
frank mango
foggy hedge
frank mango
brazen lagoon
#

@frank mango Yes I plan on it but I have some other things I wanna work on first

frank mango
foggy hedge
foggy hedge
#

also just a quick thing before I take this over to the ALiVE discord for further help but I don't think ORBAT has a crate tool? or at least I cant find it?

frank mango
foggy hedge
#

alright I'll keep trying at it, thanks for the help

frank mango
drifting portal
#

I can't find a way to get an array of editor placed walls (class name "Land_CncWall4_F") I have tried ```sqf
nearestTerrainObjects
nearestObjects
nearObjects

but as I expected they won't help, since their purpose is out of this scope, is there any way to do this? (reason being is I will apply a set of code to these walls using a trigger later on in the mission).
dreamy kestrel
#

Q: not really sure what the purpose of publicVariable is. once you set it do you need to re-set it? or does it publish in a JIP manner with the most up to date variable value?

cosmic lichen
#

@dreamy kestrel

TAG_MyPublicVariable = 0;
TAG_MyPublicVariable = 1;
publicVariable "TAG_MyPublicVariable";    // other clients will receive the "TAG_MyPublicVariable" variable with a 1 value

TAG_MyPublicVariable = 2;                // needs to be broadcast again - synchronisation is not automatic
dreamy kestrel
#

ah ok I see thanks. so resync is necessary.

cosmic lichen
#

Yes

dreamy kestrel
#

so the thing I am confused about, new players connecting will see the most recent synced value, forever and ever more, or until the next publish occurs, yes?

#

shifting gears a bit, Q: I have some "Land_ClutterCutter_small_F" objects in my mission file, using them as proxy objects of a sort. Is there a way to identify their values in the missionNamespace vis-a-vis the vehicles array? what I really need is that (vehicles), but I need each of their names, if possible. by the object itself, if possible.

stable mesa
#

Hi, I'm somewhat new to scripting in arma, normally just use triggers but I want to loop an AI animation when players are in proximity to the AI units and it seems a init.sqf sorta job. Wondering if someone could help me understand what I've done wrong in this script and help correct it?

_animation = this select 1;


while {alive _unit} do
{
    if ({_x distance _unit < 75} count allPlayers > 0) then
    {
        _unit playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
        waituntil {animationState _unit !="AmovPercMstpSnonWnonDnon_exercisePushup"}
};

0 = [] execVM "Anim_AI.sqf";
little raptor
# stable mesa Hi, I'm somewhat new to scripting in arma, normally just use triggers but I want...
  1. how do you execute this

_unit = this select 0;
_animation = this select 1;
completely wrong.

if ({_x distance _unit < 75} count allPlayers > 0) then
{
_unit playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
waituntil {animationState _unit !="AmovPercMstpSnonWnonDnon_exercisePushup"}
missing }

waituntil {animationState _unit !="AmovPercMstpSnonWnonDnon_exercisePushup"}
animStateChanged event handler

0 = [] execVM "Anim_AI.sqf";
why?

stable mesa
#

As stated, very new to init files in arma.

  1. Thought I could call this script in the unit's init
  2. I see
  3. Will fix
  4. Much nicer
  5. Is this entirely unnecessary?
fair drum
vernal venture
#

Anybody know a way to set a TFAR vehicle radio frequency by init? I had hoped something like TFAR_fnc_setChannelFrequency would work, but it doesn't seem to.

sacred slate
#

i like to execute some script, if there are no enemies in 1500km distance, the code should execute, otherwise say, enemies are too close.
i got this so far, i barely manage regex yet.

_enemies = [leader _group(1500)] call BIS_fnc_enemyTargets;
waituntil {!(_enemies isEqualTo ([leader _group(1500)] call BIS_fnc_enemyTargets))};
winter rose
unique sundial
#

_group(1500) what is this javascript?

sacred slate
#

i mean 1500 meters, my intention is to make a fast travel script. it should check if there is no enemy closer as 1500 meters and then execute a setpos.

sacred slate
#

ok so far i got


if (player neartargets < 1500)
 then {

player setPos vspawn;

}else{

    hint "enemies too close for fast travel";    

    };

#

i also got now: if(player distance findNearestEnemy < 1500)

rancid mulch
sacred slate
#

@rancid mulch thx.

#

i have somthing wrong:

if((player distance (player findNearestEnemey player)) < 1500)
 then {

player setPos vspawn;

}else{

    hint "enemies too close for fast travel";    

    };
rancid mulch
#

Is there an error message? If so, share it. Also change < with >

sacred slate
#

error missing )

#

i try it via radio trigger now, not ingame debug console

winter rose
sacred slate
#

sorry i dont get it

#

there is no ) missing. i have sqf highlight in notepad++

cosmic lichen
#

Of course there is one missing.

#

Count ( and count )

sacred slate
#
if((player distance (player findNearestEnemey player))
< 1500)
 then {

player setPos vspawn;

}else{

hint "enemies too close for fast travel";    

    };
#

i am even not sure about that new line

cosmic lichen
#

New line is fine.

sacred slate
#

well now there is one ) missing?

#

i thought they have to get always closed.

cosmic lichen
#

It's fine now

sacred slate
#

its not working

#

still a missing )

cosmic lichen
#

what is findNearestEnemey?

#

ENEMEY?

sacred slate
#

haha

cosmic lichen
#

Yeah, that error is pretty stupid/misleading.

sacred slate
#

the script works now, but at any distance i get the else.

cosmic lichen
#

You need to be careful

#

findNearestEnemy can return objNull if no enemy is nearby

#

and in that case your condition will return false

sacred slate
#

i have no clue how to fix that into the ifelse

#

_unit = player;
_enemySides = _unit call BIS_fnc_enemySides;
_enemies = (_unit neartargets 2000)

cosmic lichen
#
private _closestEnemy = player findNearestEnemy player; //Get nearest enemy
if (isNull _closestEnemy OR {player distance _closestEnemy < 1500}) then .... //If it's null, then proceed with true, if it's not null then also consider the distance
sacred slate
#

thx. but i still fail to apply it πŸ˜„

#
private _closestEnemy = player findNearestEnemey player;
if (isNull _closestEnemy OR {player distance _closestEnemy
< 1500})
 then {

player setPos vspawn;

}else{

hint "enemies too close for fast travel";    

    };
cosmic lichen
#

typo in the command

#

(yes I made it as well)

sacred slate
#

oh boy

#

@cosmic lichen i have no error message now, but also no hint

#

and no setpos eighter πŸ˜„

#

ah my setpos code is not working

winter rose
#

findNearestEnemy works based on group's knowledge of enemy

cosmic lichen
#
private _closestEnemy = player findNearestEnemy player;
systemChat str _closestEnemy;

if (isNull _closestEnemy OR { player distance _closestEnemy > 1500 }) then
{
  systemChat "Teleport";
  player setPos vspawn;
}
else
{
  systemChat "enemies too close for fast travel";    
};

Works for me now

#

also I think you had < > mixed up

#

I am using systemChat so it works in Eden. You can switch back to hint if you like.

sacred slate
#

ok nice many thanks

spark turret
sacred slate
#

great! i will give that a try

spark turret
#

why is my post with the lsit of extensions still not pinned 😠

#

😿

sacred slate
#

@spark turret is there any alternative to visual studio?

spark turret
#

Poseidon, but its not nearly as good

#

why no VSC for you?

cosmic lichen
#

atom, n++, Poseidon is a bit slow

spark turret
#

poseidon freezes with .rpts πŸ˜„

cosmic lichen
#

VSC is probably the best, especially with all the nice extensions

winter rose
#

this one?

cosmic lichen
sacred slate
#

that sounds so microsoftish

cosmic lichen
#

Idc about the name really

spark turret
#

it is in fact by microsof

#

and i got a free 2year license with my corona vaccine \s

cosmic lichen
#

It's also open source which is nice

sacred slate
#

so there is no open source equvivalent for syntax help

#

ah

digital hollow
#

Can anyone recommend examples of adding entries and pages to the commanding menu? BIS_fnc_createmenu

sacred slate
#

ok

#

its not done lol

#

this even works with enemy close:

private _closestEnemy = player findNearestEnemy player;
systemChat str _closestEnemy;

if (isNull _closestEnemy OR { player distance _closestEnemy > 1500 }) then
{
  hint "fast travel";
  fasttravpos = [getMarkerPos "vspawn", 2, 2, 2, 0, 33, 0] call BIS_fnc_findSafePos;
  player setPos fasttravpos;
}
else
{
  hint "enemies too close for fast travel";
};
winter rose
digital hollow
#

Any mods that use it that you would recommend studying?

winter rose
#

negative on my side

dreamy kestrel
#

realizing BIS_fnc_sortBy is extremely powerful. you have an array of elements and want to screen them quickly, not only can you sort them with a callback, but you can also filter them.

fair drum
halcyon oar
#

Does anyone know why this isn't wotking in the civilian presence module?

[_this, selectRandom ["C_man_p_beggar_F_afro","C_Man_casual_1_F_afro","C_Man_casual_5_v2_F_afro","C_man_polo_2_F_afro","C_man_sport_2_F_afro"]] remoteExec ["setIdentity", 0, _this];
tough abyss
#

i once again asking for your scripting support, i tried to wrap my head around im currently trying to attach a rocketpod to the turret of a offroad hmg and make it turn where the gun aims, does anyone know a solution? someone said something about memory points and i legit dont understand

winter rose
halcyon oar
halcyon oar
#

Here's what they do in the wiki

[_this, selectRandom ["TO_C03_Pilot","TO_C03_Medic","TO_C03_Collins","RC_B_HQ"]] remoteExec ["setIdentity", 0, _this];
winter rose
#

yeah well, _this doesn't exist

#

what is the error you get? πŸ™ƒ

fair drum
#

@halcyon oar hover over that civilian presence module box you are putting the code in. what variables does it give you to work with?

halcyon oar
fair drum
halcyon oar
#

I'm sorry πŸ˜…

sacred slate
#

is it technical possible to add a addaction to a item that can be picked up into the inventory? i try to run a script from a smartphone placed in the editor. i like to make it takeable.

austere granite
#

No

fair drum
#

@halcyon oar bro. you had be working on this and you didn't even use the right class names

halcyon oar
#

what? really? I just copied them

fair drum
#

you gave me vehicle class names.

#

are you just wanting their face and skin color changed?

halcyon oar
#

I used the class name of the unit as they do in the wiki

#

But yes, I only want face and skin color

fair drum
#

lets use setFace instead. to avoid BIS's randomization which I cannot disable before the unit is initialized within that module

#

which is messing things up

halcyon oar
#

I'm just baffled because I just did it as the wiki instructs and it doesn't work xD.
With setFace it should be the same way but with the names of the heads right?

fair drum
#

which wiki page were you looking at? setIdentities tells you it needs a cfgIdentities entry, not a vehicle class name

halcyon oar
#

Look where it says code on unit created/deleted

#

On apply random identity

#

I tried with the names of the identities before btw

#

Before you say anything

#

It didin't work

#

I'm starting to think it's some issue on my part

fair drum
#

you just want black faces?

halcyon oar
#

yep

fair drum
#

wait one

fair drum
# halcyon oar yep
if (local _this) then {

    private _faces = [
        "AfricanHead_01",
        "AfricanHead_02",
        "AfricanHead_03"
    ];

    [_this, selectRandom _faces] remoteExec ["setFace", 0, _this];
};
halcyon oar
#

Thanks!

#

I'm going to use that and try another thing as well, thank you very much!

last rain
#
missionNamespace setVariable ["W_ART",0];```
`missionNamespace` not work in **initServer.sqf**?
#

Dedicated server

winter rose
#

it does work

fair drum
#

make that setVariable global

astral dawn
#

maybe your initServer.sqf doesn't run at all

brazen lagoon
#

Where does the "Killed" EH fire? Like, lets say a bunch of units aren't local to the server (run on HCs), would the killed EH still fire on those units when they're killed?

astral dawn
brazen lagoon
#

OK, odd

astral dawn
brazen lagoon
#

I'm not sure honestly, this EH might not be firing is one thing

#

if it is then something is screwy. I'll add some prints and debug

astral dawn
#

Although, it has a 'LOCAL' locality icon on wiki.

brazen lagoon
#

hmm

astral dawn
#

so I might be wrong too

#

anyway, it will not fire on the machine on which you didn't add it

winter rose
# last rain variable not change

if you run that on the server, the variable will be updated on the server
as @fair drum said, use setVariable ["var", value, true] to make it broadcast over the network

sudden bear
#

Hello everyone, sorry I am really a noob at scripting but can someone tell me why :
ammo1 = getArtilleryAmmo [gun1] select 0;
tgt = getMarkerPos "target1";
gun1 doArtilleryFire[tgt ,ammo1, 10];

This don't work ? The artillery shot but not on the target. I use a old video for this : https://www.youtube.com/watch?v=g_hzGXt91Z4&t=299s

#

For explain I have in mind to made a scripted event for a phosphorus artilley shell with the new dlc ... And I also don't know what number to put for this type of shell

willow hound
#

@sudden bear Where does it shoot instead?

sudden bear
#

I don't know but I can assure not on the target

brazen lagoon
#

@astral dawn the issue I'm running into is that when the EH fires, the unit, killer, and instigator all have the side 'UKNOWN'

#

sorry, the unit/killer/instigator's groups are all side unknown

astral dawn
#

does it even return a valid killer object? maybe it's a null object

#

if it's a null object then it has a null group, if it has a null group then its side is unknown

brazen lagoon
#

it might be that yeah

brazen lagoon
#

it works locally but not on a server

brazen lagoon
#

Use normal Killed event handler instead, it gets called only where killed entity is local though. is this actually true

tough abyss
#

Within the editor I know you can make slideshows and make them show on a screen or whiteboard add your own images, but is it possible to just link it to say a google PowerPoint ?

brazen lagoon
#

MP notes: "Killed" and "Hit" eventhandlers are executed where given unit is local.

frank mango
dapper cairn
#

Looking for a way to have a bunch or portable double lights off then upon entering a trigger have them turn on. Anyone have any scripts that could help me

frank mango
dapper cairn
#

....thats way more simple than what i was trying to do

#

ill give it a try in a bit

frank mango
#

Ive used an addAction to turn AA defenses on/off.
then have it call upon a simple script stating (to deactivate)
AA_1 enableSimulation false;
AA_2 enableSimulation false;
AA_3 enableSimulation false;

winter rose
frank mango
#

Using the ingame hide feature linked to a trigger?

winter rose
#

he wants to turn them on/off, not hide them I presume ^^

dapper cairn
#

yeah

#

off to on upon entering a trigger

frank mango
#

triggering the trigger, hides the off and replaces them with the on version?

if it can work like that with lights?

#

if not, then no idea at all

#

Hows this ?

winter rose
winter rose
frank mango
#

Bookmarked

winter rose
#

ze wiki is gud 4 u

frank mango
# winter rose ze wiki is gud 4 u

Despite looking for this a few months ago, and spending a good few hours looking on things like the wiki. I never came across any reference to this. wow

leaden haven
#

Are there any functions for respawnign vehicles that actually respawn abandoned vehicles? The built-in one does not work properly anymore. The code in this game is so outdated.

frank mango
#

and at what distance is something abandoned

leaden haven
#

No players within 500 meters.

frank mango
#

This looks like the best, though I have no idea if the original script can be found anywhere.

fair drum
#

^ that is from 2013

leaden haven
#

That crap script is outdated. It does not work.

fair drum
#

write your own?

frank mango
#

As stated "I have no idea if the original script can be found anywhere"

#

Wasnt suggesting to use it.

#

Hence the "I have no idea if the original script can be found anywhere"

dapper cairn
#

okay so OBJECTNAME switchLight "off"; works but how would I have it do multiple items. Say i have 19 lights named A_1, A_2, all the way to 19, how would i have it tell every light to turn off/on

frank mango
#

So when BLUFOR present within set area,
this execVM "Lights.sqf";

#

@winter rose Would that work?

dapper cairn
#

A_1, A_2, A_3, A_4, A_5, A_6 switchLight "off";

This is what i have except it only turns off the last one in the chain. I mostly need to know what to put so it calls on them all

frank mango
little raptor
#

@dapper cairn ```sqf
for "i" from 1 to 6 do {
(missionNamespace getVariable ["A
" + str _i, objNull]) switchLight "off";
}

#

you can also use individual names:

{
  _x switchLight "off";
} forEach [A_1, A_2, A_3, A_4, A_5, A_6]
frank mango
#

And how would it then turn them on when players got within the distance he needs?

dapper cairn
#

Also please note im brand new to scripting so I have no idea what I am doing and im just winging it as I go

#

That second one worked, so im guessing I do the same but on to turn them on

little raptor
frank mango
little raptor
#
while {true} do {
for "_i" from 1 to 19 do {
  _x = missionNamespace getVariable ["A_" + str _i, objNull];
  _x switchLight (["off","on"] select (player distance _x < 10));
}
sleep 1;
};
dapper cairn
#

@little raptor That second one worked! Thank you very very much its exactly what i was looking for!

little raptor
#

it'll work too

#

I updated the code

frank mango
dark tulip
#

What am I doing wrong here, I can't get the GF_Earplugs to not throw some error

enableDebugConsole = 1;
class cfgMusic
{
tracks[]={};

    class Track01
    {
            name = "";
            sound[] = {"\sounds\Track01.ogg", db+20, 1.0};
    };

};
Author="lilwillie";
loadScreen="pictures\image2.jpg";
class CfgFunctions {
#include "LVR\functions\functions.hpp"
};
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};

frank mango
dark tulip
#

Desription.ext, line 16:'.':'{'encountered instead of '='

#

tried changing to = and things still get errors,

frank mango
#

What do you use for writing your description.ext in?

dark tulip
#

Notepad++

Just changed it to this

enableDebugConsole = 1;
class cfgMusic
{
tracks[]={};

    class Track01
    {
            name = "";
            sound[] = {"\sounds\Track01.ogg", db+20, 1.0};
    };

};
Author="lilwillie";
loadScreen="pictures\image2.jpg";
class CfgFunctions
{
#include "LVR\functions\functions.hpp"
#include GF_Earplugs\GF_Earplugs_HPP.hpp"
};

And it throws that GF earplugs can't be found

frank mango
#

Okay, make sure foldernames are correct

dark tulip
#

This description worked until I removed a line for AIS and then it went fubar

frank mango
#

Does, adding a parent bracket work?

class CfgFunctions
{
{
#include "LVR\functions\functions.hpp"
};
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};
};

dark tulip
#

No, I just tried and it keeps asking for '="

frank mango
#

Okay what did you remove? (I bet you dont have a version of it with the removed item, not removed?)

dark tulip
#

I have a backup, give me a sec

frank mango
dark tulip
#

enableDebugConsole = 1;
class cfgMusic
{
tracks[]={};

    class Track01
    {
            name = "";
            sound[] = {"\sounds\Track01.ogg", db+20, 1.0};
    };

};
Author="lilwillie";
loadScreen="pictures\image2.jpg";
class CfgFunctions {
#include "AIS\cfgFunctions.hpp"
#include "LVR\functions\functions.hpp"

};
#include "AIS\Effects\BarDlg.hpp"
class RscTitles
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};

frank mango
#

class RscTitles
{
#include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};

dark tulip
#

oh crap, I see now

#

Thanks Eagle, trying now

frank mango
#

Okay πŸ™‚

dark tulip
#

Boom, perfect, thank you, I see my mistake once you showed the RscTitles

frank mango
fair drum
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
fair drum
#

but you would use hpp instead

dark tulip
#

@fair drumThanks!

fair drum
#
class RscTitles
{
    #include "GF_Earplugs\GF_Earplugs_HPP.hpp"
};

looks like this

frank mango
#

While we are here, this exists for notepad++ too πŸ™‚

fair drum
#

ewww VS code > np++

frank mango
#

Though, I had no idea about vs having a git plugin

undone dew
#

hey guys, question about ambient animations. I got them working using remoteExec, but in testing they show up in the wrong location when I host the mission in multiplayer and test it with a buddy - I have some wounded units on stretchers that end up a few feet off, just laying on the ground. I tried using setDir and setPos to fix this but it didn't seem to do anything. Any suggestions?

cosmic lichen
#

and set the attachToLogic to false

distant belfry
little raptor
#

you can't just change it to createVehicle

#

find which class names it uses

distant belfry
#

Yeah i tried that and the bridge deck was not there

little raptor
#

you can't just change it to createVehicle

distant belfry
#

its the tanoa bridges so like bridgesea_01_f etc.

#

if that's the classname

little raptor
#

doesn't seem valid to me

distant belfry
#

ah let me check

#

I have a workshop mod that adds the tanoa bridges to eden, logging class of ramp gives me Tanoa_Bridge_Ramp_Up

#

Is there a way to replace the model path versions such as bridgesea_01_f with the eden workshop mod map object Tanoa_Bridge_Ramp_Up?

#

Because according to this there is no classname for bridges

#

I am very new to this sorry

little raptor
#

but it's not defined in vanilla

distant belfry
#

hmmmmm I unpacked the pbo of the mod that makes the bridge pieces objects in Eden and I think I'm fucked lol it's beyond me what to do next

#

I may just have to place the bridge manually

#

Looks incredibly complicated to get the script to generate objects that aren't defined in Eden anyway

#

like splicing two methods together

spark turret
warm hedge
#

You're posting the same link

#

Don't you know, you can edit your post, like this

dim pine
#

its 5 am and i havent slept yet lmao

warm hedge
#

Better do without even lmao'ing

dim pine
#

but when i go into achilles and make an advanced composition, the praetors wanna sit on the ground like this

#

the praetors have been attached with the attachto command

oblique arrow
#

Oki I'm back on working on this again, and still dont have a clue why it doesnt work sippy
The code I've currently got is

laptop init

if (isServer) then {
[
    _respawnlaptop,                                            
    "Move to Command Vic",                                        
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
    "(_this distance _target < 3) && (speed PI_CommanderVeh <= 10)",                        
    "(_caller distance _target < 3) && (speed PI_CommanderVeh <= 10)",                        
    {},                                                    
    {},                                                    
    {_caller setPos(PI_CommanderVeh getRelPos [5,180])},                
    {},                                    
    [],                                                    
    20,                                                    
    0,                                                    
    false,                                                
    false                                                
] remoteExec ["BIS_fnc_holdActionAdd", 0, _respawnlaptop];    
};

and
vic init

if (isServer) then {
missionNamespace setVariable ["PI_CommanderVeh", _commandervic, true];
};

Error I'm getting is
https://prnt.sc/139kiss
(Error Type Any, Expected String, Bool,...) for the remoteExec
If anyone has an idea why it no worky please do tell me so I can get it working and then hopefully never have to touch it again sippy

unique sundial
#

_respawnlaptop nil?

oblique arrow
# unique sundial _respawnlaptop nil?

Added

if (isServer) then {
missionNamespace setVariable ["PI_RespawnLaptop", _respawnlaptop, true];
};

(and replaced _respawnlaptop)
But still the same error

frank mango
dim pine
#

to what? is there anything that I can attach to the plane that the praetors will float on?

frank mango
dim pine
#

init in 3den editor

frank mango
#

Paste what you have in the init.

#

of the plane*

dim pine
#

the plane just has a variable name for the attachto

frank mango
#

So, what has the init with the attachTo 's?