#arma3_scripting

1 messages Β· Page 609 of 1

ebon citrus
#

@astral dawn what is the purpose?

#

you might be chasing a rainbow

#

so you have journal data, where is that data? Server or client?

#

(client, as in a connecting client)

#

(server, as in the host, with interface or not)

#

and does this need to run in MP or SP environment?

astral dawn
#

@astral dawn what is the purpose?
I have described it above in my message which describes the in-game notepad with notes (it's like... an GUI edit box). Notes are added by in-game events, and such events might happen quite often, so I can't save client's notepad data on each such event.

ebon citrus
#

"save"?

#

ok, so you want to save the data client-side?

astral dawn
#

"save" = I want to saveProfileNamespace that data, that variable

#

yes

ebon citrus
#

are you sure you want to do that?

astral dawn
#

If client is self-hosting or plays in SP it's only way 🀷

ebon citrus
#

also, im not sure of these note's validity, but there is a note there Variables are also saved when the game is quit.

#

but why do you need to save so much data?

#

this fights against all reason

#

12MB of text is MASSIVE

astral dawn
#

no, 12MB is not text of the note

#

it's size of profilenamespace (vars.arma3profile file), because it also stores save game data (state of the game world)

ebon citrus
#

what are you saving then?

astral dawn
#

what are you saving then?
state of the game world

ebon citrus
#

take a look here

astral dawn
#

no, it's a GTA-like save game thing

ebon citrus
#

a what now?

astral dawn
#

like... like they do in Antistasi or Overthrow

ebon citrus
#

dont play either one of those

#

so you want to save ONLY some specific things?

astral dawn
#

yes. But when you do saveProfileNamespace it saves whole profileNamespace.

ebon citrus
#

yes?

#

It also saves it on quit

#

and you shouldn't save mission variables into profile namespace

astral dawn
ebon citrus
#

what?

astral dawn
#

Don't remember much though

ebon citrus
#

ok, so this is ONLY dedicated server?

#

then save the data on the server

astral dawn
#

ok, so this is ONLY dedicated server?
No, I never said that my mission is only for dedicated server... it can be run on DS, self-host, or in SP

ebon citrus
#

...

#

are you sure you want to do that?

astral dawn
#

do what?

ebon citrus
#

do all three at once?

astral dawn
#

it's done 🀷

ebon citrus
#

because all three of them are basically completely different beasts

astral dawn
#

almost same πŸ˜„

ebon citrus
#

i wish

astral dawn
#

not much difference really. Only respawn is not working in SP

ebon citrus
#

ok, well, profilenamespace is saved on quit

#

just so you know

astral dawn
#

yay \o/

#

thanks

ebon citrus
#

and loaded when the profile is loaded

#

what youre doing sounds really weird and destructive, but i guess that's what arma modding is about

tame lion
#

Question for anyone that is familiar with ACE arsenal. Is there a global variable that tracks what unit is currently being modified in an ACE arsenal?

ebon citrus
#

just keep an eye on those variables, might piss off some people with massive file-sizes

#

@tame lion player

#

XD

tame lion
#

but you can also open up an arsenal on a remote unit through their scripting

ebon citrus
#

i see

#

that's a different thing which you didnt mention, probably

#

open up their script and see?

tame lion
#

something like a current_arsenal_unit or to that affect

astral dawn
#

just keep an eye on those variables, might piss off some people with massive file-sizes
I made an extension for file i/o for this case 🀷 But I still want to support saving to profileNamespace.
And save game data isn't so huge really. BI's format to binarize things adds very much wasted space.

ebon citrus
#

have you tried ace discord?

astral dawn
#

hmm for what exactly?

ebon citrus
#

speaking to crown

astral dawn
#

don't recall that name unfortunately, but what should I talk to them about?

#

ohh is wiki down... right now 😦

ebon citrus
#

i was talking to crownmedic, not you

astral dawn
#

sorry πŸ˜„

hollow thistle
#

ace_arsenal_center

tame lion
#

just found that through some magic lol

#

ace has a discord?

astral dawn
#

they have Slack

ebon citrus
#

i dont know, these days everyone has a discord or something

cold glacier
#

Failing that, how about hooking the 'onDestroy' event of one of the UI elements?

#

Maybe something like that will work.

#

(Just speculating, can't test right now :( )

astral dawn
#

No I haven't. Nica has found that profileNamespace should work on closing the game though. Which seems to be the case for editor at least.

cold glacier
#

Ah, yeah, that should do it as long as it's not a crash. Could also offer the player an explicit save option, so they can choose to lag while profile namespace saves if they want.

#

(Also - 12MB is a pretty sizeable vars file!)

astral dawn
#

12MB per save, we had to limit it to 4 saves per profile

primal marten
#

Hey guys. I want players to respawn with their loadout they built during briefing and I am trying to use the following script. However when i try and test it on mp (hosting local to test) it doesnt work, any answer?

initPlayerLocal.sqf

[missionNamespace, "arsenalClosed", {
player setVariable ["Saved_Loadout",getUnitLoadout player];
hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{

    0 = [_this select 0] spawn {

        params [["_player",objNull,[objNull]]];
            waitUntil {sleep .2; alive _player};
            _player setUnitLoadout (_player getVariable ["Saved_Loadout",[]]);

    };
warm hedge
#

Because dead player and respawned player isn't equal so Saved_Loadout after the respawn contains nothing

primal marten
#

Ok and thanks Polpox, so being a scripting idiot how do I fix? Do I need to define player UID?

(love your mods by the way for screenshots! And excited by the new wounded animations mod)

warm hedge
#

I think just declaring as global variable, which won't shared with other players?

And excited by the new wounded animations mod
Uh?

primal marten
#

How do I do that?

warm hedge
#

Just dosqf Saved_Loadout = getUnitLoadout player;?

primal marten
#

So just add that at the top of the script?

warm hedge
#

What?

#
player setVariable ["Saved_Loadout",getUnitLoadout player];```Instead of this, and replace this one too```sqf
_player setUnitLoadout (_player getVariable ["Saved_Loadout",[]]);```, you know how it goes
primal marten
#

Ah ok think I got it thanks will try

thorn cape
#

I made MP mission, dead players becomes spectators.
How to finish the mission for spectators after the end of the game?

I use this on a trigger in activation:
["Spectators_red_win",true,true] remoteExec ["BIS_fnc_endMission", civilian];

And this in desctiption:
class CfgDebriefing { class Spectators_red_win { title = "MISSION COMPLETED"; subtitle = ""; description = "BLUFOR LOST"; }; };

What's wrong?

primal marten
#

@warm hedge This doesnt work, again assume i am beinf stupid

["InitializePlayer", [player]] call BIS_fnc_dynamicGroups;
player execVM "Scripts\fn_ratings.sqf";
[missionNamespace, "arsenalClosed", {
Saved_Loadout = getUnitLoadout player;
hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{

    0 = [_this select 0] spawn {
    
        params [["_player",objNull,[objNull]]];
            waitUntil {sleep .2; alive _player};
            Saved_Loadout = getUnitLoadout player;
            
    };

}];

warm hedge
#

Why you redefine it after respawning?

primal marten
#

I am merely copying and pasting a script i found on BI that is meant to allow the fixing of loadouts. I am not a scripting wiz at all.

warm hedge
#
[missionNamespace, "arsenalClosed", {
    Saved_Loadout = getUnitLoadout player;
    hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;

player addEventHandler ["Respawn",{
    0 = (_this select 0) spawn {
        waitUntil {sleep .2; alive _this};
        _this setUnitLoadout Saved_Loadout;
    };
}];```Will do, not tested
loud python
#

@ebon citrus Didn't see your message until now because you @pinged someone else

#

thanks for the link, I will have a look at it πŸ˜„

primal marten
#

I get undefined variable in saved loadout error

warm hedge
#

Did you closed Arsenal ever?

primal marten
#

yes i close the arsenal

copper raven
#

Because dead player and respawned player isn't equal so Saved_Loadout after the respawn contains nothing
it does contain the same value corpse had
yes i close the arsenal
did the hint pop up at all?

still forum
#

@astral dawn

Is there a client-side event handler which runs on client and is triggered when client disconnects from server or goes back to game menu in a SP mission?
CBA, displayClosed EH on main mission display.
Or... just do it like DayZ, redirect the "Abort" button in the pause menu.

wet shadow
#

I am looking to color some VR cubes to my liking. However the standard wiki merthod

_block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];

only colors one side of the cube. Any tips on how to do a complete repaint of all six sides?

copper raven
#

1st parameter in the array is the selection index

wet shadow
#

Thats what I thought as well but its not the case, or at least changing the selection does not solve the issue
Nvm forgot to change the rvmat for each selection, problem solved

primal marten
#

Fixed it thanks @warm hedge

#

@copper raven thanks also I was using ACe arsenal hence my fatal flaw!

vague geode
#

Is it possible to force retract a jet's gear in the 3Ditor? I am trying to make pictures of the jets loadouts by turning them upside down and opening all the bomb bays etc. and it just looks odd when the gear is down (or rather up in this case but you know, outside the vehicle)...

digital hollow
#

@vague geode spawn it in the air at altitude

vague geode
#

@digital hollow But then it's moving meaning it is very hard to get a usable scrennshot. I am trying to take those pictures to use them in a loadout selection. I know that you can open and close all the bays with the animateBay-command but I don't know how to make the jet retract the gear. It does't have to work automatic in any way, shape or form (I also use the animateBay-command in the console by hand). As I said I am only trying to take pictures of the loadout in the VR environment/map.

digital hollow
#

Use the Splendid CameraTM to actually take the picture, it can freeze time by default

short sparrow
#

Hi, is there any way to simulate the load of a human player connected to the server? I want to measure performance for a mission of 70-90 players.

spark turret
#

Fps?

fair drum
#

how would i go about limiting the amount of kits active on CfgRespawnInventory?

#

edit: I'm a dumb dumb, take a look at BIS_fnc_addRespawnInventory for anyone else wondering

ebon citrus
#

@short sparrow no

#

There are too many variables to take into account to simulate

#

It would be cool if BI would make a profiling client for servers that just does some lightweight stuff without running the hevay logic and interface

spark turret
#

Oh you meant simulate, i thought measure lol

spark turret
#

is it possible to do a raycast detecting ground in arma?

still forum
#

lineIntersects should be able to do that

copper needle
#

Im new to SQF and need to apply a HandleDamage EH to all vehicles on an MP server. What should I look into for this?

spark turret
#

remoteExec, addEventhandler, setVariable (?)

ebon citrus
#

@spark turret why the setvariable?

#

Just remoteExec is fine

#

And ofcourse, addevenhandler

tribal trellis
#

Is there a way to get a loadout from a unit and then use that data to add the loadout to a crate?

ebon citrus
#

You can also use getunitloadout and iterate through it and add items

#

But i dont get why you would want to do this

tribal trellis
#

I was thinking using getUnitLoadout and then the array returned from that, adding that into a crate

#

It's for a quartermaster system I'm messing around with

ebon citrus
#

You cant add it directly, no

tribal trellis
#

It takes a loadout from a unit (so I can dynamically edit the loadouts, if I need to)

#

Rather than hard-coded loadouts

ebon citrus
#

But what is your goal?

#

To set a loadout to a player?

#

One you can edit?

#

Just getunitloadout and setunitloadout

#

You can use the return from getunitloadout to set the loadout of another unit

tribal trellis
#

Yeah I know that much, that's what I had before

ebon citrus
#

But why does it need to be in a box?

#

Dont get me wrong, feel free to do it

#

I just mean that yiu might be going further than the ocean to fish

tribal trellis
#

I'm just messing around with stuff, it doesn't necessarily need to be but trying out different methods

#

Or at least thinking of different methods

ebon citrus
#

Sounds cool

#

Have fun

sacred turret
#

does anyone knows the difference between enableFatigue and enableStamina?

young current
orchid stone
#

does the EH created with addPublicVariableEventHandler fire in single player?

ebon citrus
#

did you read the notes?

#

This EH works only in Multiplayer environment

orchid stone
#

but if i missed it, and you would be so kind to help me with where you found the info, that would help me

#

ah i see, so i did miss it

#

thanks for your help πŸ™‚

fair drum
#

so messing around with the OPTRE corvette at around 10km in the air when I place my units inside and the games starts, the game goes WOH you are mad high, better make you act like you are freefalling

#

might have to make a teleporter instead

ebon citrus
#

@fair drum The game acts weird if you spawn units in air (not on the ground) so youre better off having your stuff on the ground and then teleport it to the corvette

fair drum
#

trying to use #include correctly in my description.ext so far I have:

#include "\config\CfgRoles.hpp"

I get an error that it cannot be found though the files are located in that path. and the folder containing config is the mission root folder

#

I also tried:

#include "config\CfgRoles.hpp"

and

#include "..\config\CfgRoles.hpp"
hollow thistle
#

#include "config\CfgRoles.hpp" should work, ensure the file exists.

fair drum
#

I figured out the problem, had issues with the file to be copied when it meets with the other file

tame lion
#

another question regarding ACE Arsenal. I think I've stumbled across a bug possibly when creating a limited arsenal. Here is the concept: I'm allowing my players to start with a very limited arsenal, and over time they will be able to purchase upgrades for this arsenal to add more items. The scripting seems to work, however I am getting one problem with the arsenal interface. The compatible mags tab is not populating all mags that are compatible with the currently selected weapons like normal. Another issue is that all the grenades and explosives are showing up in the all mags tab. Magazines are still compatible if taken from this tab, so it's not a config issue.

fair drum
#

did you add the allowed list by hand or did you use the script that ace provides to copy all the loadouts of every unit placed

tame lion
#

I added it by hand

#

I'm trying a new method now that doesn't involve using ace_arsenal_fnc_addVirtualItems. Instead I am just using ace_arsenal_fnc_removeBox and then ace_arsenal_fnc_initBox using CBA_fnc_execNextFrame to add it back on the next frame. This will only happen whenever the players upgrade their arsenal

fair drum
#

Ah well then I'm not too familiar with ace arsenal scripting. All I know is that the one time I tried to do a limited arsenal with the loadout finding script provided, it didn't add everything I needed.

tame lion
#

well that didn't work, so now I'm gonna try this bit of coding.


            [_arsenal_box, true, true] call ace_arsenal_fnc_removeVirtualItems;
            [_arsenal_box, _array_to_add, true] call ace_arsenal_fnc_addVirtualItems;```
fair drum
#

you can't go wrong with removing everything then adding the new thing back

tame lion
#

you would think lol

fair drum
#

you could be right on the bug issue. sometimes it misses stuff

tame lion
#

I know I've made something similar work before in the past. I made a series of scripts that allowed players to have a "favorites" arsenal that only contained items they have favorited in it, allowing them to not have to sort through a ton of other items. That worked and allowed for compatible mags, so IDK why this isn't working the same way.

fair drum
#

Anyone know if onPlayerRespawn.sqf is fired AFTER the spawn location is selected? Need to see how much scripting I have to do as far as finding a squad leader and spawning on his location in a drop pod. If it fires after, that would be nice as I can just make the squad leader a spawn point.

tame lion
#

taken from description.ext on wiki:

respawnOnStart

Respawn player when he joins the game. Available only for INSTANT and BASE respawn types.

respawnOnStart = -1; // Default: 0

    -1 - Dont respawn on start. Don't run respawn script on start.
     0 - Dont respawn on start. Run respawn script on start.
     1 - Respawn on start. Run respawn script on start.```
#

that might answer your question?

fair drum
#

that's a different command

#

thats for initial mission start for that player

tame lion
#

oh i gotcha now that I looked at it, lol

#

well there is one way you could test:
place a simple systemChat in the file and see when it pops up, before or after

fair drum
#

good point

#

the answer is that it fires after, excellent

fair drum
#

mk after a few more failures, i'm still trying to figure out how to create a vehicle 10000 meters above a player... so far I have

"vehicle" createVehicle (getposATL player)

but I'm not sure how to add 10000 to the z axis on the corresponding [x,y,z]

#

I think I might have created the worst way possible of doing this:

private _podStart = [
    (getPosASL player) select 0,
    (getPosASL player) select 1,
    ((getPosASL player) select 2) + 10000
]

anyone got a more efficient way lol

ebon citrus
#

addvector

#

sorry, vectorAdd

#

@fair drum ^

fair drum
#

i see now. guess that only works with arrays of 3 values. what if i had a 6 number array and want to add to the 5th number easily?

digital hollow
#

array set [index, value]

ebon citrus
#

@fair drum false, it works with vectors with 2 or 3 elements

copper needle
#

where can find a list like ["face_hub","neck","head","pelvis","spine1","spine2","spine3","body","arms","hands","legs","body"] but for vehicles?

fair drum
#

which command will allow me to check the helmet slot?

warm hedge
#

headgear

ebon citrus
copper needle
#

Thanks Nica

#

Would anyone happen to know what causes vehicles to explode?

#

like the names of what have to take a certain amount of damage

fair drum
#

depends if you have ace cookoff/ammo racking

#

typically its just hull damage

#

but with acecookoff you can have hull, ammo, and sometimes fuel damage

#

anyone know what the weapon "throw" and "put" is? I see it show up in various scripts

astral dawn
#

it's when you throw or put something, like throw a grenade, put a mine

fair drum
#

Why would I list that in my CfgRespawnInventory?

ebon citrus
#

@fair drum leave it out and see what happens

fair drum
#

I already did and notice nothing. I'm still able to throw and place stuff with all the grenades and stuff in the inventory. Was just wondering why the generator script for cfgrespawninventory adds it to everything.

velvet merlin
#

is a decent BI function to disable a center screen info message? like when an important character has died to information the player about it

copper needle
#

What is the selection name of the hull on a vehicle? In the config it says it is "palivo" but the same is said for the HitFuel

young current
#

@copper needle for what purpose?

copper needle
#

Testing to see if the Hit selection is equal to the hull

young current
#

There is no universal selection naming

#

BI vanilla stuff is quite consistent

#

But modded things can be anything

copper needle
#

I am staying vanilla

young current
#

Usually there is a hitHull hit point if I recall correctly

copper needle
#

Ive tried that and it just doesn't seem like the correct name

#

It identifies the hull with that when using setHitPointDamage but not when finding if the place hit is equal to the hit selection

#

but HitHull does not detect the right thing

#

Would you happen to know where the hull is on an offroad?

ebon citrus
#

@copper needle firegeometry?

#

Visual geometry and firegeometry are different things

copper needle
#

What do you mean?

#

I need to be able to shoot at the hull to test the selection name so I need to figure out where the hull is. Does that help?

ebon citrus
#

Have you tried looking for the right selection in firegeometry?

#

No you dont

copper needle
#

What is firegeometry? Sorry Im very new to this

ebon citrus
#

Take a look here

#

You can get the selection aimed at far easier

#

Viewgeometry is usually complex

#

Simulating physics for this complex geometry is not always wise

#

So the firegeometry is like a more simplified version of the viewgeometry that is used for bullet collisions and such

copper needle
#

Is there no easier way to find out what the selection name of the hull is? Is it not listed somewhere?

ebon citrus
#

It's in the firegeometry LOD

#

Did you not read what i said

#

Here

#

I dont understand what youre trying to do

#

Maybe that would help

#

Would you care to explain?

#

"hit_engine","hit_fuel","hit_hull" seem to be the hull selections for the firegeometry

copper needle
#

Sorry Im not trying to be rude I'm just confused. My goal is to detect when the hull is shot so that a HandleDamage EH can make sure that the hull does not go about 0.89 to avoid it exploding

ebon citrus
#

Excluding wheels, glass etc.

copper needle
#

Ill try all that thank you!

ebon citrus
#

Hitengine going to red doesnt make it blow up

#

Hitfuel and hithull can

#

If i remember correctly

#

But those are not the health points @copper needle

#

You want to use this @copper needle

#

Why not just check if the engine hitpoints drop

#

?

#

Or hull

#

Trough the command i provided above

#

Honestly, i'm on my phone right now, so i cant do examples

#

Im just saying, the way i would do this

copper needle
#

I think I understand what you mean. Let me give it a go

ebon citrus
#

Yeah, do what you need

#

I need to sleep

#

I've been past 24 hours up now

copper needle
#

Jesus Christ. Well take care. I really appreciate the help!

#

Using getHitPointDamage got it to work perfectly thank you!

#

How would I add a HandleDamage EH to any vehicle that gets created in a multiplayer mission?

copper raven
#

CBA XEH

ebon citrus
#

If youre going to mod it, you might aswell add it to the init of a vehicle baseclass

#

Just make sure to add checks for when it should be triggered

#

Otherwise you might have it trigger in the main menu

humble harbor
#

I have a question. I'm still learning all the syntax and stuff (I'm used to C#) and I saw that for a method to return a value there's no explicit return statement.

I noticed that if I try to return inside a foreach loop it actually does not break out the loop nor the method itself, and it keeps on iterating.

Is there a way to explicitly return?

tame portal
#

The last statement of a function returns the value

#

If you want to do a loop personally I'd save the value you want to return in a variable and then after the loop just do _myVar

humble harbor
#

So I'm forced to initialize the return variable at the beginning and modify it accordingly during the execution?

#

yeah exactly okay hahah

tame portal
#

Yeah iirc

#

Inside your loop you can do if (myBreakoutCondition) exitWith { _returnVar = ... }

#

I don't know if for loops can return directly

#

apparently if statements can, so you are able to do things like _myVar = if () then { 1 } else { 2 }

queen cargo
#

@humble harbor (and somewhat @tame portal) to return a value from inside a loop, use https://community.bistudio.com/wiki/breakOut alt syntax

private _fnc = 
{
  scopename "myScope";
  for "_i" from 0 to 1000 do
  {
    false breakOut "myScope"; // Break out of the context named "myScope", returning false
    systemChat str _i; // is ignored as we broke out above
  };
  true
};
systemChat "Result:";
systemChat str ([] call _fnc);```
humble harbor
#

apparently if statements can, so you are able to do things like _myVar = if () then { 1 } else { 2 }
@tame portal

Wow that's odd

#

Okay thank you allπŸ‘ŒπŸΌ @tame portal @queen cargo

tame portal
#

@queen cargo I just wish there was a return statement

queen cargo
#
#define RETURN(VAL) (VAL) breakOut "function"

fnc_my_func = { scopeName "function";
  // ...
  RET(5);
};

there ya go

#

as alternative, use some SQF-replacement language

#

Nou made one
i did too
and some other guy i forgot the name of and possibly plenty others too

tame portal
#

well atleast enscript has it natively

#

although enscript is also making some weird decisions about what's ok and what's not lol

narrow furnace
#

hello everyone. i broke my mind, how can i kick players from lobby without starting mission using sqf? EventHandlers as OnPlayerConnect not working in lobby connections. and i cant get list of lobby players using allPlayers or #userlist? i need this for whitelist check.

#

and how to kick client with message using only server side code?

crude vigil
#

@narrow furnace Is this what you are looking for? onUserConnected
https://community.bistudio.com/wiki/server.cfg#Arma_server_only
https://community.bistudio.com/wiki/ArmA:_Server_Side_Scripting

onPlayerConnected is a mission event handler and is an event that works upon loading a mission, hence it cannot work on lobby connection.
Now I don't know how servers handle things but I would say that this section will most likely help you achieve what you are trying. Especially onUserConnected event.

drowsy axle
#

Could someone link me to how WaitUntil has changes, as I'm using some 2013 code about ballistic tracers, and the WaitUntil is returning nil?

young current
#

could be the code is broken some other way

narrow furnace
drowsy axle
#

could be the code is broken some other way
@young current of course, but I heard something about WaitUntil changing that broke the normal way, or used way, of WaitUntil.

young current
#

maybe this then

#

bi wiki is your friend in these cases

drowsy axle
#

Indeed, what page is this?

drowsy axle
#

Thank you.

fair drum
#

I've noticed that sometimes when a player dies, he gets ejected from the group and doesn't get put back in on respawn. What's the exact rules for this?

crude vigil
#

@fair drum Scripted or one of respawn templates?

modern moon
#

Is there a command or a function to put every object created with createVehicle on the ground like the 3DEN Editor already does?

fair drum
#

Might need to rephrase your question. Are you looking to place every single vehicle possible or what. createVehicle should already place things on the ground if you give it a [x,y] position and leave out the z

spark turret
#

Car SetposAtl getPos x,y,0

turbid zenith
#

Heya all, I am looking for a script that let's me define what loadout each player spawns with.
Let's say I have a .sqf file with the loadout, and I want to use it on a player (unit) with a variable name p1.
Any advice or links that could be of use?

spark turret
#

setUnitLoadout

#

if you put that into the onPlayerRespawn.sqf it will reequip all respawning players.

#

or you can just call it from anywhere to reequip whenever you want

turbid zenith
#

Thank you peepoThumb

fair drum
#

alternatively, look up cfgRespawnInventories and cfgRoles

spark rose
#

Hey all. In the following code i receive a "generic error in expression" ```sqf
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; // UAV/UGV player operated road kill
if (isNull _instigator) then {_instigator = _killer}; // player driven vehicle road kill
if (side _instigator == west && side _killed == Civilian) then
format ["Killed By %1", name _instigator] remoteExec ["hint"];
spawn FNC_record_civilian_death;
}];

#

game says first line, but not sure why

ebon citrus
#

@spark rose what is this? spawn FNC_record_civilian_death;

#

also, your error is here: if (side _instigator == west && side _killed == Civilian) then format ["Killed By %1", name _instigator] remoteExec ["hint"];

#

you need closing brackets

#

and opening ones

#

can just have an if-then

spark rose
#

largely overthought function to track civilian deaths using a global variable

ebon citrus
#

if you dont want to pass anything, use [] spawn

spark rose
#

okay roger

#

yeah the function just adds a +1 to a variable count so no need to pass

#

i may re-write to make it less clunky in the future

#

i borrowed it from someone else before i had any idea what i was doing

#

only marginally better now πŸ˜‰

slate cypress
#
_trg setTriggerStatements ["this", 'hint "Waves starting..."; for "_i" from 1 to _attackTime do {sleep (_attackInterval * 60); _group = [getMarkerPos "enemySpawn", resistance, 10] call BIS_fnc_spawnGroup; _waypoint = _group addWaypoint [getMarkerPos "enemyTo", -1]; _waypoint setWaypointType "lambs_danger_rush";', ""];
#

where am I going wrong with this statement

#

The enemies don't end up spawning

#

No errors either

#
_attackTime = 5;
_attackInterval = 1;
#

I have some code before this which spawns an "initial group". That works fine.

#

hint "Waves starting..." runs but the rest doesn't seem to...

humble harbor
#

(unrelated)
I'm confused. Shouldn't a bullet fire a "Deleted" event on impact since it got null?

slate cypress
#

ahh I see

ebon citrus
#

@humble harbor bullets ricochet

#

they dont get deleted on impact always

humble harbor
#

Yeah but at some point they have to, I checked and the event never gets fired

ebon citrus
#

well, it doesnt get deleted then, does it

humble harbor
#

It becomes null but does not fire the event? :/

ebon citrus
#

i know what youre trying to do

#

give me a moment, im digging up the BI-way of doing it

#

BI checks on each frame if the round is Null

#

with BIS_fnc_addStackedEventHandler

slate cypress
#

I made them global but it still didn't work thonk @tough abyss

ebon citrus
#

i'd recommend using missionnamespace, though

#

instead of stacked event handler

#

missioneventhandler

#

sorry

#

@slate cypress show the code

slate cypress
#
if (_this select 1 == officer) then {
    hint "Attack starting...";

    attackTime = 5;
    attackInterval = 1;

    _initialGroup = [getMarkerPos "enemySpawn", resistance, 10] call BIS_fnc_spawnGroup;
    _initialWaypoint = _initialGroup addWaypoint [getMarkerPos "enemyTo", -1];
    _initialWaypoint setWaypointType "MOVE";
    _trg = createTrigger ["EmptyDetector", getMarkerPos "enemyTo"];
    _trg setTriggerArea [250, 250, 0, false, -1];
    _trg setTriggerActivation ["ANYPLAYER", "PRESENT", false];
    _trg setTriggerStatements ["this", 'hint "Waves starting..."; for "_i" from 1 to _attackTime do {sleep (_attackInterval * 60); _group = [getMarkerPos "enemySpawn", resistance, 10] call BIS_fnc_spawnGroup; _waypoint = _group addWaypoint [getMarkerPos "enemyTo", -1]; _waypoint setWaypointType "lambs_danger_rush";', ""];
}
else
{
    hint "You do not have permission to use this command!";
}
#

that is the full contents of the sqf

#

it is called using addAction

ebon citrus
#

what...

slate cypress
#

??

ebon citrus
#

nothing, im reading

#

so the enemy isnt spawning?

slate cypress
#

The initial group is and moving to waypoint

#

The consecutive groups aren't..

#

hint "Waves starting..." runs though

#

So the trigger is defo being activated

crude vigil
#

Why did attackTime become _attackTime in statement, same for other variable...

ebon citrus
#

_attackInterval

#

that variable doesnt exist in the scope

slate cypress
#

oh forgot to change that sigh

crude vigil
#

if you are going to use _myVariable, you need to define them first in that scope

ebon citrus
#

dont worry

#

honest mistake

#

here:

#

πŸ”¨

#

use it at your own discretion

slate cypress
#

πŸ˜†

#

yay arma crashed so i cant test it now

#

gotta restart

#

well actually, it didn't crash but i'm just mostly frozen

astral dawn
#

Haha I'm faster!

crude vigil
#

Mine is seen above :(

astral dawn
#

On my screen mine is above meowhuh

crude vigil
#

I ll give you the place , u added extra info, more worthy! notlikemeow

astral dawn
#

Strange, I thought discord sorts it same for all

spark rose
#

Ouch. I just realized this ```sqf
if (side _killer == (side player) && side _killed == Civilian) then

#

returns a civilian kill whenever you kill anyone

#

😦

winter rose
#

a dead unit is civilian indeed

copper needle
#

Any way to stop secondary explosions on vehicles?

#

Ive tried using setDamage and making the useEffects false but it still causing the secondary explosion

spark rose
#

@winter rose that makes me sad

exotic flax
#

@copper needle afaik does vanilla Arma not have secondary explosions, only ACE. No idea how to disable that, but I believe it is possible.

humble harbor
#

Yeah I think it's the ace cookoff thing

copper needle
#

Im in vanilla Arma 3. When I _unit setDamage [1, false]; it destroys the vehicle and no initial explosion/fire is created. But after about 15-20 seconds an explosion goes off. Im attempting to prevent that explosion

#

Also to removeEventHandler I need to get the index of the event handler I am removing. How do I get that?

crude vigil
copper needle
#

Can anyone provide/point me towards examples of uisleep?

exotic flax
#

@humble harbor are you looking for scripts or configs? Because config stuff can be asked in #arma3_config although it's most likely a memory point in the model and some config stuff for how far it can rotate etc.

humble harbor
#

@exotic flax my bad

copper needle
#

thanks @exotic flax

#

Is there a semicolon missing in if (_hullDamage > 0.9) then {_unit setDamage [1, false];}?

ebon citrus
#

Yes

#

You need to end statements with a semicolon

#

Including an if-then statement

copper needle
#

So like _noExplode = if (_hullDamage > 0.9) then {_unit setDamage [1, false];}; _delV = if (_tDamage == 1) then {uiSleep 10; deleteVehicle _unit;};

#

?

ebon citrus
#

@copper needle what are you doing with the return value?

#

And yes, like that

copper needle
#

Was originally going to use it but no longer needed. They have been changed to just if statements

#

if (_tDamage == 1) then {uiSleep 10; deleteVehicle _unit;}; In this line Im trying to get the script to wait 10 seconds and then delete a vehicle. Am I using uiSleep correctly?

#

At the moment Im getting "Error Generic Error in Expression"

robust hollow
#

you need to execute it in a scheduled environment (spawn/execvm)

copper needle
#

I dont understand what that means. Could you provide an example?

robust hollow
#

if (_tDamage == 1) then {_unit spawn {uiSleep 10; deleteVehicle _this};};

#

or you would spawn the function that snippet is from so it would wait for the unit to delete before proceeding.

copper needle
#

That worked perfectly. Thank you!

ebon citrus
astral dawn
#

unknown direction
it always has a specific direction, or vector dir and up at least meowhuh
setPos the object in the direction that it's facing
do you mean moving it 'forward' where it is facing even if it's facint up-east for instance? meowhuh

#

I guess that's what you mean yeah

#

Check 'worldtomodel' and 'modeltoworld' commands on wiki

#

Also for your case you need to use setPosWorld instead of setPos

copper needle
#

Im trying to use the "Eject" action to eject the whole crew of a vehicle, but in unit action ["eject", vehicle] I don't know how to set the whole crew as the unit. Any ideas?

winter rose
#

use forEach

copper needle
#

Works perfectly thank you!

hallow mortar
#

Can I use format on the title parameter of an addAction in order to insert a wildcard?

warm hedge
#

What exactly you wanted to do? You can use format to addAction's text though

brave jungle
#
switch (VARIABLE) do {
  case (west): {
      _export = 1;
  };
  case ("west"): {
      _export = 1;
  };
  case (east): {
      _export = 0;
  };
  case ("east"): {
      _export = 0;
  };
};

I tried using or as case ((east) or ("east")) : { but its been a while since i've done scripting so perhaps i'm missing a fundamental here.
Wanting to combine it to make my file shorter

warm hedge
#
call {
    if (VARIABLE isEqualTo west or VARIABLE isEqualTo "west") exitWith {
        _export = 1;
    };
    if (VARIABLE isEqualTo east or VARIABLE isEqualTo "east") exitWith {
        _export = 0;
    };
};```?
hallow mortar
#

@warm hedge I want to use a text substitution wildcard (%1) as part of a system that has random generation aspects. If format can be used, then I'm all good.

brave jungle
#

works the same yes

smoky carbon
#

I have a question about (multiplayer) scripting
I'm +- new to arma 3 scripting so idk how to solve that problem.
So my problem is: We are going to launch our server on the 14th, but I need to make some ingame 'powerpoints'/slideshows on screens. It's really confusing for me what I actually have to put in init as code... Globaltexture or just texture, when I test the server in editor, singleplayer then it says: image.something not found

brave jungle
#

have the images in 1024 x 512 (or 2048 x 1024 etc), convert to paa via a3tools. Ensure they work in game. Use setObjectTextureGlobal and depending on the object you're setting, a billboard for example is 0 for the main area, you'll need the correct hiddenselection id. you can then use an addAction on an obj and then either use an .sqf file to add each one or just add each side as an addAction

#

so i.e
laptop has this addAction ["slide 1", {billboard setObjectTextureGlobal [0, "mySlideImage1.paa"}];

smoky carbon
#

So the players who join musn't have the images in their files to see it?

brave jungle
#

No

#

The mission file is enough

#

its the path that matters

#

all scripts presume mission path unless an addon path is given.

#

so mymission.altis, if I have an image in the base (next to the mission.sqm) then I can call upon it ingame just as myimage.paa. If I place it into a folder call img so it becomes mymission.altis >> imgs I'd need to do img\myimage.paa

smoky carbon
#

ok, so is it better to put the actual codes ingame (the laptop etc) or an .sqf file (I just can't work with it :/ )

#

ok

brave jungle
#

Up to you tbh, depends if you care if your inits look "clean"

hallow mortar
#

all scripts presume mission path unless an addon path is given.
It doesn't make any difference in this specific example because it's correct for setObjectTexture, but there are some commands that have to be told the mission file path

brave jungle
#

Yes true

#

Only a few though

smoky carbon
#

'but there are some commands that have to be told the mission file path', ...? such as

hallow mortar
#

playSound3D is the one that comes to mind. There's a couple.

#

None of them are ones you're using in this case though.

smoky carbon
#

okay I thought mandatory

brave jungle
#

you can always use getMissionPath

#

But if you look at the wiki examples on a command you're using it will usually show you, you wont be the first person to encounter a path problem

smoky carbon
#

How can even assure if it's working or not, will it execute noramllly if I test in multiplayer in editor?

brave jungle
#

just remember don't use that C:/blah because thats different on every client

smoky carbon
#

k

brave jungle
#

put it on your server

#

test from your perspective

#

if you see it its working

#

the multiplayer editor button makes you a client and server, so you see everything

smoky carbon
#

ok I hope it'll work otherwise cya inabit

brave jungle
#

πŸ˜„ gl

smoky carbon
#

Thnx

#

so mymission.altis, if I have an image in the base (next to the mission.sqm) then I can call upon it ingame just as myimage.paa. If I place it into a folder call img so it becomes mymission.altis >> imgs I'd need to do img\myimage.paa
@brave jungle wait one last thing πŸ˜… ... My scenario is an MPMission

#

that doesn't involve anything right

brave jungle
#

yeah thats fine

#

the client downloads the mission file

#

when it says receiving mission file

smoky carbon
#

k

ancient wasp
#

Hello everyone. Could someone give me an idea how to handle players that are connecting to a lobby? Unfortunately both onPlayerConnected and its stackable version don't work in the lobby and on a brifieng and also I can't get a list of players by using the allPlayers command in the lobby

crude vigil
ancient wasp
#

@ancient wasp
https://discordapp.com/channels/105462288051380224/105462984087728128/739879496647311452
[Link includes a previous answer of mine to same question in this channel.]
@crude vigil Thank you for your reply. Yes I know this event onUserConnected but seems like it doesn't allow to use any user-defined scripts. When I try to use my function it complains about missing semicolons or something. Seems like it allows to use either kick or ban and that's it

crude vigil
#

What are you trying to do?

ancient wasp
#

I need to call a custom script before I will decide to let a player join or not. A whitelist implementation specific for our server only

crude vigil
#

You cannot do that afaik, that events are not run in such environment where scripting commands work. I doubt you would be able to achieve what you want in lobby.

ancient wasp
#

Are there any ways around? I have just seen this implementation on another server, but I'm unable to ask them how they did it

velvet merlin
#

whats the recommend approach for dead bodies and weaponholders in SP in regards to performance?
just disable simulation when player is not close (ie 50m) or is removal still better?

tame portal
#

@ancient wasp Youd need to implement such checks via RCON

ancient wasp
#

thank you! I go to google

#

@ancient wasp Youd need to implement such checks via RCON
@tame portal Can I use this system in combination with my DLL for example? I just can't find out

spark moon
#

I'm wondering if there is another way to switch rifle's weapon mode other than

player forceWeaponFire [(primaryWeapon player), "FullAuto"]

warm hedge
#

No

spark moon
#

Thanks!

ebon citrus
#

i dont recommend it... but you can use it for example in mission init

warm hedge
#

W-woah, didn't knew that workaround

ebon citrus
#

SwitchWeapon is a bit better for that

humble harbor
#

wow it gets me every time how inconsistent Bohemia is at naming things

odd bison
#

QUESTION. Hello everyone. Is it possible to create a marker as a ring? (Circle with a hole) Thank you.

jovial steeple
#

Does anyone know where I can find the memory points for the Greyhawk's TGP?

humble harbor
#

@jovial steeple what is tgp

jovial steeple
#

The camera/designator thing.

humble harbor
#

@jovial steeple "laserstart" is the gunner camera position, "commanderview" is the gunner camera direction

#

@jovial steeple those names are gonna differ for every other drone because bohemia cannot name things properly

jovial steeple
#

Thanks guys, will look through these. Im trying to attachTo somthing to it.

humble harbor
#

@jovial steeple thingToAttach attachTo [drone, [0,0,0], "laserstart"]

fair drum
#

so I'm trying to get my scripts to be more efficient, rewrote my teleporter script. any way to get _landing variable into the code scope that is in the addaction?

params ["_teleporter","_landing"];

_teleporter addAction [

    "Teleport to " + str _landing,
    {
        params ["_target","_caller"];
        _caller setposASL getposASL _landing;
    }
];
fleet stirrup
#

@fair drum hey there, in the documentation here https://community.bistudio.com/wiki/addAction you can see that there is a parameter called arguments that you can pass it in using. You can then access it using _this select 3 inside your action script

fair drum
#

ah so in total it would be params [_"target","caller","_teleporter,"_landing"]

#

well actually, (_this select 3) select 1

fleet stirrup
#

You could do it in the params as you put there! If you were to do that though you would have to do it like this
params ["_target", "_caller", "_actionID", "_landing"]

#

But I doubt in that case there are any significant differences to the two, I am just used to the C world of printf and python's format strings

solar shore
solar shore
#

Even checked my own cfgSounds

name = "Alarm - Independent";
sound[] = {"A3\Sounds_F\sfx\alarm_independent",1,1};
titles[] = {};
willow hound
#

Try a3/sounds_f_sfx/alarm_Independent.wss.

solar shore
#

Ty, I'll try that

#

Nope, didn't work

#
 0:57:23 Warning Message: Sound a3/sounds_f_sfx/alarm_Independent.wss not found
 0:57:23 Warning Message: Sound a3/sounds_f_sfx/alarm_Independent.wss not found
 0:53:16 Warning Message: Sound a3\sounds_f_sfx\alarm_Independent.wss not found
 0:53:16 Warning Message: Sound a3\sounds_f_sfx\alarm_Independent.wss not found
 0:48:06 Warning Message: Sound A3\Sounds_F\sfx\alarm_Independent.wss not found
 0:48:06 Warning Message: Sound A3\Sounds_F\sfx\alarm_Independent.wss not found
 0:43:56 Warning Message: Sound A3\Sounds_F_sfx\alarm_independent.wss not found
 0:43:56 Warning Message: Sound A3\Sounds_F_sfx\alarm_independent.wss not found
 0:15:42 Warning Message: Sound A3\Sounds_F\sfx\alarm_independent.wss not found
 0:15:42 Warning Message: Sound A3\Sounds_F\sfx\alarm_independent.wss not found
#

Tested these so far

#

Weird thing is, when I test this in the editor:

playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; // alarm
#

It works

fair drum
#

What was the original playsound3d line

#

That you did

solar shore
#
[_target,"A3\Sounds_F\sfx\alarm_independent.wss",50,1] remoteExecCall ["life_fnc_say3D",RCLIENT];
params [
    ["_object",objNull,[objNull]],
    ["_sound","",[""]],
    ["_distance",100,[0]],
    ["_pitch",1,[0]]
];

if (isNull _object || {_sound isEqualTo ""}) exitWith {};
if (_distance < 0) then {_distance = 100};
_object say3D [_sound,_distance,_pitch];
#

Yeah, now I tried it with say3D and it's like no, not found

#
player say3D ["A3\Sounds_F\sfx\alarm_independent.wss",50,1];

This doesn't work

willow hound
#

According to BIKI, say3D needs a classname not a file.

solar shore
#

Ah

#

Right

sacred turret
#

Does the game logic entity works with remoteExec?

solar shore
#

So I basically have to add it to description.ext

#

Thanks

willow hound
#

Even checked my own cfgSounds

name = "Alarm - Independent";
sound[] = {"A3\Sounds_F\sfx\alarm_independent",1,1};
titles[] = {};

@solar shore Why not use this?

solar shore
#

Yeah did something like that in my description.ext now

    class storealarm {
        name = "storealarm";
        sound[] = {"A3\Sounds_F\sfx\alarm_independent.wss", 1.0, 1};
        titles[] = {};
    }
#

Ah nvm

#
player say3D ["Alarm_Independent",50,1];

Would work as well

#

Ty!

#

Don't even need to add it to my description.ext

willow hound
#

@sacred turret What do you mean?

sacred turret
#

I want to add this action for everyone
player addAction ["Arsenal", {["Open", true] call BIS_fnc_arsenal}, {}, 0, false, true, "", "true", -1];
Preferably via game logic remote exec, is that possible?

willow hound
#

Does game logic remote exec mean you want to place down a Game Logic in 3DEN and put that code into its init field?

#

Or are you using mods that extend the Game Logic to include some remote execution?

sacred turret
#

the first one, sorry for the answer delay

willow hound
#

@sacred turret Answered in #arma3_editor, not sure if you noticed.

unreal scroll
#

Is there any way to cache the map markers (or to load it by request before the map load)? We have serious problems with game hanging on map zoom, while drawing map markers. Moving the whole game folder to SSD helps a lot, but doesn't eliminate the problem.

willow hound
#

Not that I know of.
Out of interest, how many map markers do you have?

unreal scroll
willow hound
#

But that's not that many...

ebon citrus
#

@unreal scroll where's the lag?

#

im looking at this video and im not seeing the problem

unreal scroll
#

How do you suppose I'll show how the whole game hangs? πŸ™‚

ebon citrus
#

by recording it?

unreal scroll
#

Hm... Can't imagine how it would help you. You just zoom the map, and it hangs.
If you don't zoom the map, and wait 20-30 s (other OT modders says they need to stare at the sea) - then it works well.

ebon citrus
#

erm...

#

but im not seeing any hanging in this video

unreal scroll
#

You see the map zoom at this video? Then just stop the video and imagine it hangs πŸ™‚ This is how it looks like exactly.

ebon citrus
#

but it doesnt

#

it looks EXACTLY like that?

#

but it hangs

#

so it doesnt happen to everyone?

unreal scroll
#

Absolutely. The game stops to work. It is no more. Crashed. The ex-game.
"so it doesnt happen to everyone?"
Yes, all OT mods.

ebon citrus
#

any scripts?

#

what is OT?

unreal scroll
#

"any scripts?"
???

"what is OT?"
Overthrow

ebon citrus
#

Mods as in modification or moderator?

unreal scroll
#

Rephrase please.

ebon citrus
#

when you say "OT mods" what do you mean?

#

moderators or modifications?

unreal scroll
#

Modifications

ebon citrus
#

so whenever someone is running OT, they get this issue where the game crashes on map zoom?

unreal scroll
#

Right

ebon citrus
#

ok...

#

give me a moment

#

cannot reproduce

unreal scroll
#

How long did you played it? I mean overall time?

ebon citrus
#

about 10 seconds

unreal scroll
#

😁

#

That bug is a bug. It doesn't make the whole mod unplayable. It happens very often on game start, when you open the map. For HDD ~ 30-50%, for SSD for about 5-7%. Maybe it depends on campaign progress (more time = more markers).

ebon citrus
#

ok, then no

#

report it to the mod author's page

unreal scroll
#

Thanks, but I didn't ask where to report about it. I'm working on it, and I need to fix it.

ebon citrus
#

welp, i cant reproduce it, so i dont know how to fix it

#

cant even start

unreal scroll
#

Even if you would seen it, then you would need to dig into the map script.
And if the original mod authors and I wasn't able to fix it, then it is not so simple. But who knows...

exotic flax
#

tbf... showing a video where the issue isn't visible isn't a great bug report...
And I doubt it's Arma specific, just a bad script in a mission or mod...

ebon citrus
#

it's not immediately obvious

exotic flax
#

Although adding a lot of map markers with scripts (especially those with onEachFrame) are FPS killers, so that is probably the issue here as well

ebon citrus
#

i've been playing this for a little while now

#

and no bugs

#

cant reproduce it

unreal scroll
#

"showing a video where the issue isn't visible"
As I said, you'll get nothing from such video, no any specific info. It would looks like the usual zoom in/zoom out, then it hangs. Never on the map draw, but only on markers draw.
Also there are no onEachFrame scripts.

https://github.com/ArmaOverthrow/Overthrow/blob/dev/addons/overthrow_main/functions/player/fn_mapSystem.sqf
https://github.com/ArmaOverthrow/Overthrow/blob/dev/addons/overthrow_main/functions/player/fn_mapHandler.sqf
If there is no such option like map caching, I wonder if there any way to optimize it...

exotic flax
#

@unreal scroll addMissionEventHandler ["Draw3D", { is just as terrible as onEachFrame since it also runs on every frame...

#

same as CBA_fnc_addPerFrameHandler

unreal scroll
#

What could you recommend?

"same as CBA_fnc_addPerFrameHandler"
It can be run not only in every frame, btw. Any time interval.

slate cypress
#

I have some code which creates an area trigger in a given location. It then spawns enemies when the players activate that trigger once. The problem I am having is you can either have the trigger local to the player or global so everyone has a trigger on their machine. The problem with global is that enemies will be spawned several times... The problem with local is that enemies will only be spawned if that specific player activated the trigger (which they may not). Does anyone have a workaround?

exotic flax
#

CBA_fnc_addPerFrameHandler has an argument to set an interval (default 0), which will help a lot.
Although less dynamic markers will be the only real solution

unreal scroll
#

"The problem with global is that enemies will be spawned several times..."
Use remoteexec/remoteexeccall, and run it on a server only.

velvet moss
#

Hi,
I am just dipping my toe into the scripting scene for ARMA and am trying to figure out what is going wrong with our script. The basic idea with it is to allow a Zeus to "hide" a player by double clicking on them, setting them to captive:
https://pastebin.com/aWeFaQ1Y

We are getting the following error and are having a hard time solving it. We want it to work on a multiplayer server:
https://pastebin.com/zxLDSe0e

exotic flax
#

@velvet moss you use double quotes within double quotes

#

this fixes the errors:

this addEventHandler [
    "CuratorObjectDoubleClicked",
    "_player = _this select 1; if(isPlayer (_player)) then {if(captive (_player)) then { [_player,false] remoteExec ['setCaptive']} else { [_player,true] remoteExec ['setCaptive']}}"
];
velvet moss
#

Oh man... I'm gonna be super embarrassed lol

slate cypress
#

@unreal scroll I could do that but it will be the same effect...

#

Every client will end up using remoteExec

#

The server will run it as many times as there are clients

unreal scroll
#

Ah.... Then the simplest workaround: define some variable on first run, and check it.

#

I.e., from my own old scripts:

if (_leader getvariable ["OT_FOBdone",false]) exitWith {};
_leader setvariable ["OT_FOBdone",true,true];
(some code here)

If it is not tied with units/group, then use server setvariable
But it is always better to rewrite the script to make it launch only once.

slate cypress
#

It’s a bit confusing. What is the idea behind doing that?

unreal scroll
#

If the variable was sat, then the script doesn't run. Very simple.

ebon citrus
#

MaxP couldnt reproduce

slate cypress
#

It all starts from addAction which a certain unit can use which will call an sqf file. In that sqf file, it will spawn an initial group of enemies which will move into a town. Once the players arrive at the town (any players since I don’t know exactly who), it will begin spawning waves

#

Oh so it is a debounce

ebon citrus
#

and to answer your question, no, there is no "cache" for markers and i dont know what exactly that would even help and how

#

@slate cypress swap your SQF files and execVM's for functions

#

jsut a tip

#

execVM is good for one-maybe runs and testing

unreal scroll
#

@ebon citrus As I said, thanks for helping.

@slate cypress "(any players since I don’t know exactly who)"
The better way: to execute the script via the action menu once, with remoteexec, then remove the action itself.

ebon citrus
#

but as soon as you have 1 minute to make it a function, i.e. define it, you should

velvet moss
#

Mr. Grezvany13, thank you. That solved all the things.

slate cypress
#

Ah so

#

If I create the trigger on the server side local to the server, will this solve my issue

ebon citrus
#

you can remove the action or leave it and use the hide-on-use

#

if you intend to run it more than once set a condition

slate cypress
#

Since then anyone can activate it, not just the person who used the action

ebon citrus
#

if you dont, hideonuse

unreal scroll
#

@slate cypress "If I create the trigger on the server side local to the server, will this solve my issue"
It is a good thing to create triggers ONLY on a server (except specific cases).

slate cypress
#

Makes sense πŸ™‚

ebon citrus
#

unless you need them to be client side

slate cypress
#

Of course

ebon citrus
#

like for visual or audio effects

#

pretty much that

slate cypress
#

Also regarding defining it as a function, is this better when executing it multiple times?

ebon citrus
#

if a trigger needs to trigger visual or audio effects -> client side
everything else -> server side

#

@slate cypress yes, and more secure

slate cypress
#

Ok thanks for the tip πŸ™‚

ebon citrus
#

execVM compiles and adds the script to the scheduler every time it is called

slate cypress
#

So it’s slower and it’s not always certain when it is run I guess

ebon citrus
#

so not only does it need to recompile it, it also can be changed during runtime

#

which is... ok, for debugging

#

dirty debugging

#

but not so good if youre running an MP mission

#

functions are compiled once

#

yeah, functions you can also choose to either spawn or call

#

if you spawn them, you can add them to the scheduler

#

but by calling them, you can return values from the function

slate cypress
#

Yeah because iirc spawn is pretty much asynchronous

ebon citrus
#

so as soon as you have time, i would recommend you take a look at the cfgFunctions

#

spawn adds the script to the scheduler

slate cypress
#

It doesn’t yield the current thread though right?

ebon citrus
#

it returns the script handle

slate cypress
#

Yeah

ebon citrus
#

same as execVM

#

spawn doesnt compile anything

#

so it's faster

slate cypress
#

So if the function yields and I use call, it will cause the thread to hang until the function has returned something?

ebon citrus
#

"yeilds"?

#

you mean waits, as in sleep?

slate cypress
#

Yeah

ebon citrus
#

cant

#

well, can

#

but if the call is executed from unscheduled environment, then cant

#

youre aware of how the arma 3 scheduler works?

slate cypress
#

I’m not too fond of it

ebon citrus
#

what?

#

it's not a matter of opinion

#

are you aware of it or not?

slate cypress
#

I’m not too fond of it
means I don’t know much about it

ebon citrus
#

this is not interrogation, im just asking

#

ah, i see

#

you should

#

it's arguably the most powerful tool in an arma 3 scripters arsenal

slate cypress
#

Thanks

ebon citrus
#

you've probably used it already

#

just dont know it

slate cypress
#

Done

ebon citrus
#

now you should know the difference between calls and spawns

slate cypress
#

Spawn puts the script into a scheduled environment. Call from a scheduled environment adds it to the scheduler whilst call from an unscheduled environment executes the script in one go without suspending

#

You also can’t sleep in an unscheduled environment but you can sleep in a scheduled environment

#

Sleep times aren’t guaranteed either due to the scheduler refreshing every frame so it depends on the local FPS

ebon citrus
#

call from scheduled environment executes it immediately, not add it to the scheduler

#

it is still executed in scheduled environment, it just doesnt get added as a task

slate cypress
#

Oh

ebon citrus
#

call is like a function call

#

function(arguments) for example

slate cypress
#

Are you able to sleep in that or no

ebon citrus
#

but instead in sqf, you do [arguments] call function;

slate cypress
#

If in a scheduled environment

ebon citrus
#

if it's called from scheduled environment, yes

#

think of them like boxes

#

unschedulked environment is one box

#

everything in it must be completed for every cycle

#

scheduled environment is like a box with multiple boxes in it

#

the scheduler will run as many boxes that it can and then repeat them if they werent finished

#

the scheduler prefers scripts which have been in the queue the longest when it runs

#

when you sleep in a scheduled script, the scheduler doesnt rerun the script again until the sleep is done

#

when the sleep is done, the scheduler continues from where it left off when it next time returns to that specific script

#

so a sleep doesnt pause the scheduler

#

it just makes the scheduler ignore running the script until the sleep has elapsed

#

the scheduler will continue to run other scripts

#

once a script is complete, it will get removed from the scheduler

slate cypress
#

I see

ebon citrus
#

if youve ever used the threading module in python or similar programming languages, this will be easy to understand

#

the scheduler just switches attention between the different "threads"

still forum
ebon citrus
#

this is the type of information I AM looking for

#

thanks dedmen

fair drum
#

interesting. so the difference between sqf and sqs is its length of the execution until suspended?

ebon citrus
#

the difference between sqf and sqs is that sqs is deprecated

tough abyss
#

Is there any kinds of standard in allocating display idd? recently started making GUI and i've been wondering, does everyone just pick a number and hope it doesn't collide with other mods?

astral dawn
#

yeah something like this 😦

#

although I am not sure if you can do that, but if you can, create it with ID = -1 and store the handle in some uinamespace variable

#

that's best way for controls for sure, don't remember if displays can do that

tough abyss
#

it works for displays too. i'm using that method on a mod i'm working on

astral dawn
#

nice, so keep using it I guess

tough abyss
#

I've been thinking if mapping the addon prefix to a number would work

#

since we are already assuming prefixes are unique then mapping them one-to-one to integers would guarantee idds to be unique

astral dawn
#

it would require absolutely every single person creating displays to use this convention

fair drum
#

which marker is the ellipse marker? not finding it in cfgMarkers

ebon citrus
#

too little(few) people are using displays for it to be necessary

patent goblet
#

I want to return the clan tag of player, is there such a script command?

winter rose
#

@patent goblet ^

#

@eager pier pwease prefix your global variables with your tag :)

tough abyss
#

@eager pier i don't understand your algebra very well but wouldn't rotating the camera while it's moving cause conflicting positions? eg. moving left and turning right

#

also shouldn't camSetRelPos use relative position and not ASL?

wind ingot
#

Is there a way for a user to clear specific profileNamespace variables without a specific script? I've opened vars.Arma3Profile and it almost looks like a binarized file, not very easy for a common user to handle.

#

@eager pier Not sure what you mean by jitter, but if you're rounding numbers maybe it's causing the rotation not to be very smooth. (I didn't find any rounding in the script but just a heads up.) Also that uisleep I'm assuming is best solution, not sure what exactly is it purpose but could be causing undesirable delay. I'm aware sleeps is something very volatile in arma scripts.

astral dawn
#

Is there a way for a user to clear specific profileNamespace variables without a specific script? I've opened vars.Arma3Profile and it almost looks like a binarized file, not very easy for a common user to handle.
Yes it's binarized. Code to clear variables there is very simple though

#

Profilenamespace setVariable ["something", nil]

#

SaveProfileNamespace

wind ingot
#

Yeah that's the normal way. I guess there's no easy trick, since all variables are bunched together and not split by addon.

#

Some people are complaining my mod (which I haven't maintained in 2 years) isn't working properly. However I've tested and is working perfectly. I just need to get better feedback and do alternative troubleshooting. I'll suggest the person to create a temp profile with clear variables instead.

crude vigil
#

@eager pier Could it be that you re handling everything in 1 scope , maybe if you split positioning and direction handling in 2 different loops, that maybe fix your problem?
Apart from that, you are aware what you are trying to achieve is somewhat already available, right? Just wanted to notify in case you are not.
https://community.bistudio.com/wiki/camCommand with "manual on" parameter.
Although, I dont remember how exactly the controls of it are..

vague geode
#

Is there a way to edit in-game (user-)actions from the action menu? For example change the condition for an action to appear in the action menu (e.g. the ramp of the Blackfish (Vehicle Transport) has to be open to unload all vehicles) or hide/remove them from the action menu completely to replace them with a custom one?

crude vigil
#

@vague geode Sadly no.

vague geode
#

@crude vigil That is very unfortunate.

I would have liked to make the "Unload all vehicles"-action more realistic by either
only making it appear if the ramp is already open (I would have added an action for that like in the Blackfish (Infantry Transport)) or by
making the action open the ramp first, then ejecting the vehicle and closing the ramp again afterwards...

crude vigil
#

@vague geode we all have such dreams but sadly.... notlikemeowcry

hallow mortar
#

You could probably do something like that with a mod since you could overwrite the vanilla config. But that's a different channel and a much deeper issue.

vague geode
#

Maybe I can suggest that change in a forum or the #game_design-channel although I don't know if that one is intended for such suggestions.

Making that change shouldn't be too hard since the code to open/close the ramp of a Blackfish for example is already there so if I am not mistaken it would be more or less just copy/pasting that code into the "action to be performed"-code of the vehicle transport variant...

ebon citrus
#

@eager pier you use spawn

#

That runs in the scheduler

#

For scheduler related reasons, your code isnt running at 0.05s refresh rates

#

Prefer missionEventHandlers with eachFrame or draw3d

#

Those are ensured to run each frame

#

Unlike spawn

#

ALSO

#

Why in the name of lord are you readding the eventhandlers every cycle (my bad, you arent

#

But still

#

Move the code from the scheduler

#

Specificly, everything in the while-loop

#

Move it into an eachFrame missionEventHandler

timid niche
#

Anyone got a script that checks if you are looking at a window?

wind ingot
#

@timid niche I think there's a function that get the object name of what you're aiming at, and I believe it works on terrain objects too, though windows might be tricky as they are part of a single entity.

copper raven
queen cargo
#
private _i = 0;
private _arr = [1, 2, 3];
_arr findIf
{
  _i = _i + 1;
  if (_i > 3) then { systemChat "Abort Endless Loop" };
  _arr pushBack _x;
  false
}```
could somebody check if this code outputs the "Abort Endless Loop" message?
warm hedge
#

The game crashes

exotic flax
#

same here

Error Max array size would be reached. Current size: 9999999, wanted size: 10000000.

#

well, game doesn't crash, just hangs for a minute and then spams "Abort Endless Loop"

warm hedge
#

Ah

unreal scroll
#

Is it supposed that objectparent command works differently for clients and dedicated?
For on-foor units, on dedicated it always returns the unit itself, but null for client.

crude vigil
#

@eager pier Yes, it would require a change of structure. I do not know much about camCommand apart of its existence but since you are trying to recreate it, maybe you can work on top of it instead of creating it from 0 to match your needs. Just a thought, since I do not know what your purpose is.

I doubt spawn has anything to do with that issue. If it had been an issue, that problem wouldnt only occur solely when you both change position and direction but it would also occur individually(ie, when you change position only or direction only).

queen cargo
#

ohh ... crap ... sorry for that @warm hedge @exotic flax πŸ˜…
there used to be a throw in there but thought i should change that to systemChat to make result reading simpler ... forgot then that the throw should abort the loop

digital hollow
#

Which is faster, generally? < vs <=

still forum
#

neither?

ornate sky
#

Can I capture an Event when the player puts on NVGs, and also how to detect if player has NVGs switched on currently? player hmd returns the NVG classname regardless of whether they are on or not.

hallow mortar
#

that's because hmd is just checking what's in the HMD inventory slot

ornate sky
#

Thanks @hallow mortar. Now is there a way to intercept the "NVG on" event in a way similar to an Event Handler? I want to execute custom code when player puts on his NVGs.

hallow mortar
#

I don't think there's anything for the event specifically. There are a few ways I can think of, though I wouldn't call them optimal:

  1. run a regular loop to check the vision mode. Limitations: loop performance, possible lag between NVG activation and script execution, need to make sure it doesn't execute the code again after the first time it activates per NVG activation

  2. write a UI Event Handler, onKeyDown, that checks the pressed key against the player's NVG actionKey and activates your script if it matches. Limitations: pain in the ass, may not account for all potential bindings

ornate sky
#

Yep, that's what I feared. Thanks for your help. I figured I can use onEachFrame as well, although it might be overkill.

copper raven
#

try this

hallow mortar
#

That would activate when a player picks up NVGs, not when they activate them

ornate sky
#

I think I'll utilize onEachFrame, assuming it's clientside. I don't like it, but the custom code is very short and shouldn't affect performance much, if at all.

sonic thicket
#

Hey everyone, I have a vehicle within Eden that has the Variable name "C7" When I try to hide this vehicle using either;

"this hideObject true;" in the init field
"C7 hideObject true;" from the in game execute field

They still both fail to hide the object whereas the wiki literally states: "Hide entity. Can be used on soldiers and vehicles, also on static objects. "
Source: https://community.bistudio.com/wiki/hideObject

ornate sky
#

SP or MP

hallow mortar
#

the init field should work in either since it's executed on all clients

#

That being said, the editor attributes should have a visibility checkbox which I believe does work

sonic thicket
#

Ill check that out after I've done the current test πŸ™‚

#

Show Model i see

#

now testing

hallow mortar
#

As far as I can see, there isn't anything grammatically wrong with your implementation, so using the attributes checkbox is a workaround rather than a solution. I'd still like to get to the bottom of why yours didn't work but I'm not sure how

sonic thicket
#

I suspected the type of vehicle, tested 2 vehicles since then so it may still be the case but I doubt it is

#

haha hide model doesnt work either

warm hedge
#
  • MODs?
  • Other scripts?
  • What vehicle?
    ^ What mission?
sonic thicket
#

Well, everything is custom so that's going to be a long list

warm hedge
#

Better to test in vanilla so you can make sure something's off on your environment

sonic thicket
#

Something is off with variables, just tested deleteVehicle C7; and it didnt worked. i will continue testing and if i hit a brick wall ill go vanilla, see what happens there

#

Ugh, it is the caching script

hallow mortar
#

Speaking of hideObject scripts, a while ago I discovered that this did not unhide the objects in question on dedi:

[obj_setup1,false] remoteExec ["hideObjectGlobal",2,true];```
(executed from the completion script of a holdAction)
Never figured out why and it's kept bothering me
sonic thicket
#

Thanks for the tips guys πŸ™‚ "Other scripts?" rang a bell and well, guess its time to look for a solution for that now

spark turret
#

NikkoTJ just a wild guess but the unhide command has to be executed on the same machine as hide?

hallow mortar
#

@spark turret hideObjectGlobal is a server-only command and is being executed on the server in both cases

#

to hide, by (if isServer) in init.sqf, and to unhide, by the target parameter of the remoteExec

spark turret
#

Very interesting

#

Did unhide get overwritten by a JIP maybe?

#

You unhide, jip comes and runs init again hiding it?

hallow mortar
#

No. The if isServer in init.sqf means that code is only run when the server runs init.sqf, which only happens once because the server cannot JIP. Also, I verified with someone who was watching at the time that the object never became visible at all.

spark turret
#

Then its a bug and obviously dedmens fault

#

Dedmen pls fix

rain mural
#

This is a dumb question but... How do I get an object inside a script if it was placed in the eden editor with a variable name? I know there is vehicleVarName but that just returns a string. I want the object so I can give it an addAction. Many thanks!

fair drum
#

Not exactly sure if I'm following. You have an object with the name object1 and you want to add a action to just that one? Or do you want to add action to every class type that this object is?

rain mural
#

I simply want to addAction that specific vehicle but I want the object to be accessible via its variable name.

Ghosthawk - helo1

Inside sqf

//_helo1 = fetch ghosthawk here
_helo1 addAction["Whatever", {}];
winter rose
#

helo1, no underscore

rain mural
#

To be honest... That does make sense now that I engage my brain πŸ˜„ Thank you!

queen cargo
#
private _arr = [];
private _cases = {
    case 1: {_arr pushBack "inside 1"; "a"}; 
    _arr pushBack "past case 1";
    case 2: {_arr pushBack "inside 2"; "b"};
    _arr pushBack "past case 2";
    case 3: {_arr pushBack "inside 3"; "c"};
    _arr pushBack "past case 3";
    default {_arr pushBack "inside default"; "default"};
    _arr pushBack "past default";
};
private _res = switch 2 do {
    [] call {
        [] call _cases;
        _arr pushBack "past cases inner"
    };
    _arr pushBack "past cases call outter";
};
_arr pushBack _res;
systemChat str _arr```
result?
ebon citrus
#

Anyone got a script that checks if you are looking at a window?

tough abyss
#

has anyone run into trouble with remoteExec and explosives? I noticed when I call remoteExec with the target arg set to the explosive object it doesn't work

#

this is the exact text in my function (_obj is the explosive) sqf [_obj, [_dir, _up]] remoteExec ["setVectorDirAndUp", _obj] , strangely if i call ```sqf
[_obj, [_dir, _up]] remoteExec ["setVectorDirAndUp", 0]

ebon citrus
#

@tough abyss why do you need to remotexec it?

#

Also, is _obj a unit or an object

#

If it's not a playable unit or a vehicle with a player in driver, the script gets executed on the server

#

But i still dont see why you need remoteexec

#

setVectorDirAndUp has global effect

tough abyss
#

setVectorDirAndUp requires local arg

ebon citrus
#

Yes?

tough abyss
#

so i thought i'd need to run it where the object is local

ebon citrus
#

You can set it on one client/server and it updates to all clients

#

No, you dont

#

If the client knows _obj, it doesnt need to remoteExec

tough abyss
#

the wiki says the argument must be local though?

ebon citrus
#

And since it's a private variable, i assume it does

tough abyss
#

am i not understanding local correctly?

ebon citrus
#

οΏΌaΒ localΒ argument means an argument that is processed on the machine where the command is executed

#

Local argument, global effect

#

Actually bad example

#

But you dont need to remoteexec it

#

Just set it on one client and it does the job

tough abyss
#

alright gotcha

ebon citrus
tough abyss
#

still weird how it works for other objects but not explosives though

ebon citrus
#

Because explosives are not units

#

Just dont use remoteExec for global effects

tough abyss
#

cool thanks

ebon citrus
#

So for example, i dont think you can set vectorDirAndUp of a player from the server

#

Or a player controlled vehicle

#

The "processed locally" doesnt say much

#

What it tells me is that commands will use the return instead of the process

#

Would have to ask dedmen

tough abyss
#

so explosives are ok because they are spawned in by whoever was going to call setVectorDir?

copper raven
#

arg local means for the command to take the effect properly it's arguments must be local to the machine that's executing the command. trying to remoteExec the ammo as the target won't work for the same reason you can't setVariable on an ammo

tough abyss
#

using ammo as the target in remoteExec won't run the command where the ammo is local?

copper raven
#

correct

#

actually now that i think about it, i think ammos in general have issues when you try to setPos etc on the owner machine, its better to just straight up run it on all machines so it syncs properly iirc

rain mural
#

I am receiving a script error saying "scopename" is defined twice but the code still works perfectly fine.
How can I avoid the error? My code looks nearly identical to the wiki. The only difference is I don't have a top level while{true} like the example. Could that be the cause?

EDIT: Upon further inspection, the code doesn't actually work as expected. The if statement works perfectly fine and switching into the scope works but none of the hints or sleep saying what scope the code is in.

scopeName "main";
hint "inside main";
[] spawn {sleep 1; hint ""};
    scopeName "loop";
        hint "inside loop";
        [] spawn {sleep 1; hint ""};
        while {true} do {

            if (player isEqualTo currentPilot objectParent player) then {
                heli1 addAction ["<t color='#FF0000'>Player List", {call fn_openMenu}];
                breakTo "main";
            };
            
        };
copper raven
#

How can I avoid the error?
don't define scopename twice? πŸ˜„

ebon citrus
#

Youre defining the name as "main" and then "loop"

cold glacier
#

The indentation in that block is really misleading.

ebon citrus
#

Sure is

cold glacier
#
scopeName "main";
hint "inside main";
[] spawn {sleep 1; hint ""};
scopeName "loop";
hint "inside loop";
[] spawn {sleep 1; hint ""};
while {true} do {

    if (player isEqualTo currentPilot objectParent player) then {
        heli1 addAction ["<t color='#FF0000'>Player List", {call fn_openMenu}];
        breakTo "main";
    };
};
ebon citrus
#

@rain mural check your brackets

cold glacier
#

That's the correct indentation for that code.

#

You can see the the "inside loop" bit, isn't actually inside, because of the way the brackets are placed.

copper raven
ebon citrus
#

what is fn_openMenu?

#

also, the correct syntax is [arguments] call function;

#

leave the arguments blank array if you dont intend on passing any

cold glacier
#

You can absolutely use call fnc_myThing Nica.

#

Assuming it takes no arguments.

jade abyss
#

also use _var call fnc_myThing

#

It makes no diff.

rain mural
#

The scope indentation didn't copy over into Discord.
The issue I had with having a while{true} is it continuously spawned in an addAction on the helicopter causing MASSIVE frame drops. I only want one addAction to exist on the vehicle not 8 million but I need a constant check to see if the player is a pilot.

Thank you for the feedback and little improvements I can make. Much appreciated! πŸ™‚

ebon citrus
#

add the check into the addaction condition field?

#
condition:
String - (Optional, default "true") script code that must return true for the action to be shown. Special variables passed to the script code are:
_target: Object - the object to which action is attached or, if the object is a unit inside of vehicle, the vehicle
_this: Object - caller person to whom the action is shown (or not shown if condition returns false)
_originalTarget: Object - the original object to which the action is attached, regardless if the object/unit is in a vehicle or not
⚠
condition is evaluated on each frame in non-scheduled environment.
condition is not evaluated if a dialog is open.
If action is added to an object (and not to player) condition will only get evaluated IF player is closer than ~50m to the object surface AND is looking at the object.
If action is added to player, condition is evaluated all the time.```
jade abyss
#

And the reason you post it in here is what? @brisk lagoon

brisk lagoon
#

Sorry I was lost couldn't find it my bad

rain mural
#

I did have a look at that and tried it out with another check but I didn't really know what I was looking at, then I found the things about scopes. I shall try that now, cheers

rain mural
#

I used the condition section and it works. Thank you guys for assisting me!

winter rose
#

Dem peeps are ze bests

rain mural
#

Indubitably!

ebon citrus
#

also, this is the one and only(not really) valid place to use the init field

#

but dont let it get the jump on you

#

the init field is a mysterious fort of many pitfalls and traps

runic pumice
#
    player addEventHandler ["Respawn", {
        player moveInCargo respawnVeh;
    }];
};```
#

how can i set this script up

#

so if respawnVeh's cargo is full

#

it will select respawnVeh2

#

and so forth

cold glacier
#

FYI @rain mural, this would be my implementation (if it helps):

private _fnc_addPlayerListAction = {
    private _actionId = _this addAction [
        "Player List", 
        fn_openMenu, 
        [],
        1.5,
        false,
        true,
        ""
        {
            _this isEqualTo currentPilot vehicle _this
        }
    ];
    _this setVariable ["playerListAction", _actionId];
};

player addEventHandler ["GetInMan", {
    player call _fnc_addPlayerListAction;
}];

player addEventHandler ["GetOutMan", {
    private _actionId = player getVariable ["playerListAction", -1];
    if (_actionId >= 0) then {
        player removeAction _actionId;
    };
}];
#

Disclaimer: Has never been run, may contain syntax errors.

#

It avoids running any extra per-frame checks when the player is out of a vehicle, even if they'd be quite cheap.

#
{
    player moveInCargo _x;
    if !(vehicle player isEqualTo player) exitWith {};
} forEach myListOfRespawnVehicles;

@runic pumice

#

Tries to move player into a vehicle, if the player is in the vehicle, it stops, if not, it keeps looping through and trying vehicles.

rain mural
#

@cold glacier Ah I see. That would seem like a much better way of carrying out the task. Well, it gives you more control over everything.

fair drum
#
_logic = respawnvarname;

_respawn = _logic getvariable ["respawn",[]];
_respawn = _respawn param [0,[],[[],""]];
if (typename _respawn == typename []) then {
   if (count _respawn == 2) then {
      _respawn call bis_fnc_removeRespawnPosition;
   };
};

looking at this script, how did the author know what things you can put in the string after the getVariable? is there a list? secondly, can anyone explain the _respawn params. I know how params normally work, but I haven't seen this syntax

winter rose
#

See param (not paramS) on the wiki

#

@fair drum

rain mural
#

Sorry to be a pain. I have returned :P
My new error is error undefined variable in expression: jc_fnc_openvehiclemenu. I am basically trying to create a dialog menu when the addAction has been used. I have 4 main files (pretty small currently) and I cannot find what the error/undefined variable is and the error isn't very specific (maybe I haven't learnt how to decrypt them yet πŸ˜› )

initPlayerServer.sqf

waitUntil { !isNull player };

waitUntil {!(isNull (findDisplay 46))};

heli1 addAction
    [
        "<t color='#ffe600'>Player List",
        {[player] call JC_fnc_openVehicleMenu},
        nil,
        1.5,
        false,
        false,
        "",
        "player isEqualTo currentPilot objectParent player",
        -1,
        false,
        "",
        ""
    ];

fn_openVehicleMenu.sqf

params ["_player"];

if (!(isNull (findDisplay 693))) exitWith { closeDialog 2;};

createDialog "vehicleMenu";
waitUntil { !(isNull(findDisplay 693)) };
[] spawn JC_fnc_vehicleListRefresh;

fn_vehicleListRefresh.sqf

while { !(isNull(findDisplay 693)) } do {
    {
        lbAdd[1500, name _x];
    } forEach switchableUnits;

    sleep .1;
    lbClear 1500;
};

cfgFunctions.hpp

class cfgFunctions {

    class JC {
        class vehicleMenu {
            class openVehicleMenu {};
            class vehicleListRefresh {};
        };
    };
};

Sorry for the large post

#

root/functions/vehicleMenu

#

My folder structure is:

Mission
functions - folder
vehicleMenu - folder
fn_openVehicleMenu.sqf
fn_vehicleListRefresh.sqf
gui - folder
defines.hpp
vehicleMenu.hpp
initPlayerServer.sqf
mission.sqm

#

I will look at yours now

#

I have another menu that I was working on and the format I used is the exact same and that menu works fine

#

I have them both side-by-side in VSCode

#

I have my functions in separate .sqfs

#

Not in a "grouped" file

#

Other menu I have that works

class cfgFunctions {

    class JC {
        class adminMenu {
            class isAdmin {};
            class openMenu {};
            class playerSelected {};
            class autoRefreshPlayerList {};
            class teleportToPlayer {};
            class healPlayer {};
            class killPlayer {};
            class freezePlayer {};
        };

    };

};

New menu

class cfgFunctions {

    class JC {
        class vehicleMenu {
            class openVehicleMenu {};
            class vehicleListRefresh {};
        };
    };
};
#

I don't get why one works and the other doesn't

#

They are setup the same

#

Folder structure and all

ebon citrus
#

Did i miss something?

rain mural
#

No, they are in Mission Folder\Functions

ebon citrus
#

Then you need to define the path

rain mural
#

I am not arguing that. I am just confused why one version works and the other laid out the exact same does not

#

It baffles me πŸ˜„

#

Yes I meant that

#

Both menus are
root\functions\menu

ebon citrus
#

What are they named?

rain mural
#

My folder structure is:

Mission
functions - folder
vehicleMenu - folder
fn_openVehicleMenu.sqf
fn_vehicleListRefresh.sqf
gui - folder
defines.hpp
vehicleMenu.hpp
initPlayerServer.sqf
mission.sqm

ebon citrus
#

file = "filepath from root";

#

add that before the function class defines

#

most definately

rain mural
#

Right ok. So file refers to the subfolder they are in?

ebon citrus
#

yes

#

the whole path from the root mission folder

#

if they would be in "functions", then use file = "functions";

#

for you, use file = "functions\vehicleMenu";

rain mural
#
class cfgFunctions {

    class JC {
        class vehicleMenu {
            file = "functions\\vehicleMenu";
            class openVehicleMenu {};
            class vehicleListRefresh {};
        };
    };
};
#

Ok fingers are crossed

storm sierra
#

one \ not 2

ebon citrus
#

no double \

#

just one

#

this isnt windows

rain mural
#

I have to escape it as it is in double quotes?

ebon citrus
#

well, it is, but it isnt

#

no, you dont escape it

rain mural
#

Ok

storm sierra
#

You shouldn't need the {} at the end of your class openVehicleMenu, you can just do

class openVehicleMenu;
#

Only reason you'd need it is if you're making a mod with preInit & postInit stuff

ebon citrus
#

you can also write your code into oneline format

#

but you dont

rain mural
#

I am still receiving the same error:

'[player] call |#|JC_fnc_openVehicleMenu'
Error Undefined variable in expression: jc_fnc_openvehiclemenu
storm sierra
#

Not sure if it makes a difference, but put

class cfgFunctions {
    class JC {
       tag = "JC";

cunning crown
#

doesn't change anything

ebon citrus
#

yeah, youre trying to use mod-format

#

really?

#

also, tag is not with ""

#

tag = Nca

cunning crown
#

In this case yeah, but if he changes the value of the tag then yeah, it will make a difference

#

And tag = Nca will be converted to tag = "Nca" by the engine iirc

ebon citrus
#

fair enough

#

wait

#

@rain mural you dont have description.ext?

#

where are you defining this config?

rain mural
#

Trueeeeeee πŸ€¦β€β™‚οΈ

#

Sorry for your time wasted πŸ™„

storm sierra
#

Oof

ebon citrus
#

none at all

#

take this

#

πŸ”¨

#

use it with care

rain mural
#

Ah percussive maintenance on my PC

ebon citrus
#

No... erm... it's intended for you

#

πŸ˜…

rain mural
#

Both would achieve the same goal though πŸ€·β€β™‚οΈ πŸ˜›

ebon citrus
#

i guess, well, be back if you have troubles

rain mural
#

I shall.
At least I can be awarded biggest mug of the year 😏

storm sierra
#

Anyone know why synchronising an object to a module in the editor, and testing synchronizedObjects on the object doesn't show the module,
but testing synchronizedObjects on the module shows the object?

rain mural
#

Funnily enough @ebon citrus, that fixed it πŸ˜„

storm sierra
#

but why does syncing 2 modules together show the other module when you do synchronizedObjects on one of the modules?

ebon citrus
#

weird, let me check

storm sierra
#

I tried to ask in there, but it's quiet atm, xD

ebon citrus
#

XD

dull drum
#

Hi guys.
Can't successfully comprehend some multiplayer / locality issues.
Could use some help if possible.
I have a string of code in my trigger OnActivation: [8, true] remoteExec ["fuelingTimer", 2]; // run function server side
This one string for my serverInit: timer = [] execVM "server\FuelingTimer.sqf";
And these inside my fuelingTimer:

fuelingTimer = {
    params ["_time", "_on"];
    _time = RK_fuel_timer;
    _initTime = _time;
    "booyah!" remoteExec ["systemChat", -2, true]; // broadcast message everywhere except the server

In my comprehension the scheduling and locality should go as follows:

  1. server init, run sqf script
  2. trigger activated: run fuelingTimer function
  3. from inside the fuelingTimer "booyah" should be broadcasted to all machines in MP except the server
    But it fails on the step 3.

If I'll change OnActivation string to [8, true] remoteExec ["fuelingTimer", 0, true] everything runs, but later on messes with while-sleep things inside fuelingTimer which I want to avoid.

ebon citrus
#

@storm sierra what module are you using?

storm sierra
#

Custom module inherited from Module_F

ebon citrus
#

it could be that the module deletes itself after succesfully running?

storm sierra
#

nope, setting the module variable name to D, and testing D while mission runs it shows it as still there

ebon citrus
#

hmnmm

#

i'll take a look in a min

storm sierra
#

I feel like it's an editor/scripting/config question tbh, but only scripting channel is active atm, haha xD

#

tested with same module yes, and they worked fine between each other

#

but not to any other objects

#

from the objects*

#

to the module

ebon citrus
#

@dull drum

#

first of all

storm sierra
#

@dull drum You can't remoteExec fuelingTimer as it's not compiled as a function.

ebon citrus
#

fuelingTimer is a code-block

#

a variable

#

not a function

#

so when you call what i presume is fuelingTimer.sqf

fuelingTimer = {
    params ["_time", "_on"];
    _time = RK_fuel_timer;
    _initTime = _time;
    "booyah!" remoteExec ["systemChat", -2, true]; // broadcast message everywhere except the server```
#

you are just defining a global variable

#

so you need to call the function

#

remoteExecing a variable with some parameters does nothing

#

youre also missing a closing bracket in fuelingTimer.sqf

dull drum
#

that's copypasting issue

ebon citrus
#

[8, true] remoteExec ["fuelingTimer", 2]; // run function server side does nothing

dull drum
#

but it does if I'll change 2 with 0

ebon citrus
#

[[8, true], fuelingTimer] remoteExec ["call", 2]; // run function server side is what youre looking for

#

but fuelingTimer needs to be defined clientside

#

you should maybe take a look at remoteExecCall

#

or define your code as a function