#arma3_scripting

1 messages · Page 25 of 1

brazen lagoon
tough abyss
#

Hey I’m tryna come up art work for arma 3 how do I make the turret rotate

hallow mortar
# brazen lagoon like there's this but I don't really understand how you'd script this https://co...

Editor modules:
Synchronise a Support Provider module to a support unit, synchronise a Support Requester module to that Support Provider, and synchronise a playable unit to the Support Requester.
Scripting:
That function you linked replicates that process, but you'll need to create the Provider and Requester modules first (with createUnit for modules, I think) and possibly call their functions too.

hallow mortar
tough abyss
#

Thanks

#

And one more question how do I retract the landing gear and the close the canopy of the plane or jet while mid air

hallow mortar
#

4 options:

  • get in the vehicle and do it yourself
  • put an AI in the vehicle, and attach it to a dummy object on the ground using BIS_fnc_attachToRelative [PROBABLY]
  • with POLPOX's Artwork Supporter installed, put [this] call plp_fnc_simpleAttach in the object's init field
  • use POLPOX's Artwork Supporter to convert the vehicle to a Simple Object, and then use the Simple Object Editor to animate it
valid abyss
#

Does anyone know how i can make this remote execute onto a server? I need a variable to save and load onto a dedicated server.
profileNamespace setVariable ["ARSENAL_savedata", _datatosave];

hallow mortar
#
[profileNamespace,["ARSENAL_savedata", _datatosave]] remoteExec ["setVariable",2]```
#

Bear in mind this will create one variable in the server's profile namespace, named "ARSENAL_savedata", which contains only the latest data saved to it. If you're trying to save separate data for every player, you would want to either create a hashmap on the server and have each player save data to it with their UID as the key, or create separate uniquely-named variables for each player.

valid abyss
#

Thanks

#

I only want to save and load data to and from the server

copper raven
#

should use the mission profile namespace or whatever the new thing is called

kindred zephyr
#

turns out, checking uniqueness in an array index pero each item added is not ideal. Got to loop +300k items in <1min now.

Conclussion: optimization and ideal placement of sorting, do not sort while adding/check for uniqueness while adding in incredibly huge arrays

dreamy kestrel
#

Q: awhile back I found a blurb that claimed objectParent might be faster than attachedTo for purposes of determining is an escorted unit attached to whatever, escort (player), transport vehicle, etc. but I am finding that it returns objnull, whereas attachedTo correctly returns the player? not sure the conditions or parameters of that claim...

dreamy kestrel
#

So then the question is, would attachedto work for purposes of examining 'simple' captive being loaded in a vehicle? i.e. 'moving in' to a vehicle is the same as attaching the unit?

hallow mortar
#

If you want to know if they're in a vehicle, just use in. Or if you don't have a direct reference to the vehicle, vehicle _unit == _unit will return false if they're in any vehicle

dreamy kestrel
#

cool thanks

granite sky
#

@kindred zephyr That's one of the situations where forcing stuff into hashmaps makes sense.

#

Not sure I understand the situation though. You have 300k objects?

kindred zephyr
kindred zephyr
granite sky
#

I mean as a replacement for pushBackUnique.

#

Trouble is that you can't use objects directly as indices.

#

netID works in multiplayer but not SP.

open fractal
#

BIS_fnc_netId and BIS_fnc_objectFromNetId?

kindred zephyr
#

nah, the issue was not really on that relation, but that the iteration itself from the loops got progresivelly slower, but I already fixed it 😄

granite sky
#

I'm curious what your current code is.

inner flicker
#

Anyone know why the command createVehicleCrew (_this select 0) doesn't work with the vehicle respawn module or on the vehicles? Just tried this.

copper raven
#

print _this to see if it actually holds the correct value

inner flicker
#

How do I print _this?

copper raven
#

systemChat str [_this]

inner flicker
#

Do I put that in the init of the respawn module?

copper raven
#

put it where you put the createVehicleCrew

inner flicker
#

I'll try that. Thank you. I'll keep you posted.

#

@copper raven nothing came up,

#

I put it after the createVehicleCrew (_this select 0) command.

#

Vehicle still respawns without crew

#

What is the system chat supposed to show/tell you?

kindred zephyr
# granite sky I'm curious what your current code is.

I get the entries from a range of 0 to 2mil according to context -> check their uniqueness separaterately -> make the variable avialable to clients -> do stuff with the variable.

ITs just a nearesTerrainObjects but specific 3pds and that it, not really complicated but highly ineffective in the original form (from 20 minutes to 2 at most).
Array intersects its to heavy for it to work on such a large array, so I sort and check for closeness back and front each index

copper raven
inner flicker
#

so what else can i do to make my vehicles respawn with ai like they should?

copper raven
#

IDK, i've never used that module

inner flicker
#

well, thank you for your help sharp. i appreciate the attempt.

copper raven
#

are you using this Expression field?

tulip ridge
#
// scripts\door.sqf
params ["_obj", "_target"];
_obj addAction [
    "Open Door",
    {
        params ["_obj", "_target"];
        titleText [nil, "BLACK OUT"];
        playSound3D ["\SWLB_core\sounds\door_open.wss", _obj];
        sleep 3;
        player setDir (getDir _target);
        player setPosASL (getPosASL _target);
        playSound3D ["\SWLB_core\sounds\door_close.wss", _obj];
        titleText [nil, "BLACK IN"];
    }
]

Working on a pretty basic script, basically you pass what object you want the action to be added to, and the variable name of the object you want to be teleported to. Currently, everything works but the teleporting, you just fade to black and come back in the same spot. I have a feeling I'm passing the variable name incorrectly.

south swan
#

inside script knows nothing about the outside _target

#

try sqf // scripts\door.sqf params ["_obj", "_target"]; _obj addAction [ "Open Door", { params ["_obj", "_caller", "_actionID", "_params"]; _params params ["_target"]; titleText [nil, "BLACK OUT"]; playSound3D ["\SWLB_core\sounds\door_open.wss", _obj]; sleep 3; player setDir (getDir _target); player setPosASL (getPosASL _target); playSound3D ["\SWLB_core\sounds\door_close.wss", _obj]; titleText [nil, "BLACK IN"]; }, [_target] ]

tulip ridge
#

Yep, worked like a charm, thanks!
Why is it that _obj works but not _target?

south swan
#

https://community.bistudio.com/wiki/addAction
Game passes some arguments to the action script and the "object which the action is assigned to" happens to be first in that list. And then your params ["_obj", "_target"]; assigns _obj name to it.
The second thing in the list is the unit that activated the addon. So your params ["_obj", "_target"]; assigns the _target name to it. And then teleports the player back to their position :3

tulip ridge
#

Ooooooh

#

Yeah I see that now on the wiki, that makes sense, thanks!

south swan
#

params is no magic, it's just "take whatever was passed to this code/function and assign these names to it"

tulip ridge
#

Yeah, I guess I just missed that addAction "sets its own params" (I know that's not technically correct but I hope that makes sense)

stable dune
#

Hi, Is there any guilde/ example i can define own keybind to action?

copper raven
stable dune
#

Yeah, i think , that. but i do not how to define.
Like if i want right shift button + -

#

I just want get keybind to open GUI

stable dune
#

like in example

// adding event handler
(findDisplay 46) displayAddEventHandler ["keyDown", "_this call functionName_keyDown"];

// function definition
functionName_keyDown = {
    params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
    private _handled = false;

    if (!_shift && !_ctrlKey && !_alt) then {
        if (_dikCode in (actionKeys "NetworkStats")) then {
            systemChat format ["EH fired for %1", _ctrl];
            _handled = true;
        };
    };
    _handled;
};
#

?

copper raven
#

+-

#

you don't need to use the actionKeys

stable dune
#

Awesome, thanks alot

pulsar bluff
#

is there an "allObjects" syntax which is faster than allMissionObjects "weaponholder"

stable dune
# copper raven +-

Yeah, some reason if (_shift && (_this #1) == 12) then {}; doens't work, but i changed it to arrow downif (_shift && (_this #1) == 208) then {}; and that works. Thanks alot for help.

Minus (on main keyboard) Graphics DIK_MINUS 0x0C 12
_ ArrowKeypad DIK_DOWN 0xD0 208 DownArrow on arrow keypad_

south swan
#

_this is not this

#

this is not defined inside the event handler 🤷‍♂️

#

and _this#1 is already named _dikCode

stable dune
south swan
#

and if (_shift && (_this #1) == 12) then {hint "werks";} does hint alright on my machine 🤔

stable dune
#

I do not even have any mods on

south swan
#

are you using main - or numpad one? Numpad minus is 74

stable dune
#

Main

#

Well i must try it again, thanks for testing

south swan
#

strange. Maybe try to systemChat str _dikCode; at some point and see if you get a different return value 🤔

stable dune
scenic shard
#

I have a issue with my mission where some units wont react to hostile presence if the mission is loaded on our dedicated server.

The unit appears with the yellow "empty" color when looking in zeus.

The only think that I changed is put on dynamic simulation and added doStop this; in their init box

#

it works fine when i test in editor

polar belfry
#

if I want to make it so my players pick up an item and they activate a diary record as intel will this line here work
objectParent player == d1;

#

d1 is the object (I use a usb item from a mod)

jade acorn
#

few questions:

  1. What is the name of skipTime variant that automatically plays the "Some time later..." screen? Can't find it on BIKI, I remember someone mentioned it in one post on Forums but I haven't found that one message yet. I'd rather use that function instead of scripting this myself.
  2. Player can change his head/eyes position in vehicle with Ctrl+PgUp/PgDn, can I alter this through a script (so set a certain head position) or is it exclusively player-only thing?
winter rose
polar belfry
#

will my thing work?

#

or will d1 in items player work

warm hedge
#

Neither. d1 in this context is an object, not an item, more specifically, it is just a “weapon holder” not the item itself

hallow mortar
#

You need the classname of the inventory item (DIFFERENT from the classname of the ground-placed object), and then you can check that with either items or magazines

#
  • it will be either items or magazines, not both - the wrong one won't work
polar belfry
#

is there a way to differentiate the objects?

#

in case of 2 usbs

hallow mortar
#

Nope

copper raven
hallow mortar
#

Most inventory items are just "you have x items of type y" and not real persistent things

polar belfry
#

if I put a item on the floor and pick it up is the floor object dead per se

#

maybe I could try !alive

#

sorry if it is stupid

copper raven
#

if they're in seperate holders, you can "differentiate"

warm hedge
#

An item can't be named. You only can name the “weapon holder”

copper raven
#

but if a unit takes them both, then no

south swan
#

"select" and "faster" rarely belong in the same sentence, tbh

polar belfry
#

it worked

#

the moment I picked up the usb from the pc it enabled intel

hallow mortar
#

Nice

polar belfry
#

I think it worked cause in order to put the item from the floor to the inventory it kills the object with "deletevehicle"

copper raven
hallow mortar
#

Virtual holders are usually deleted when they're empty, yes

polar belfry
#

ok then it works as stupid as it may sound

hallow mortar
#

You can also look into things like the Take event handler if you want to do interesting stuff like identifying who specifically took it, or tracking it being taken from a crate with multiple items

jade acorn
#

BIKI states that Hold waypoint can be "skipped" through a trigger or a script command, that command is to just remove that waypoint or is there something else?

polar belfry
#

Will this
[this, ["Pick up knife", {deleteVehicle d2}]] remoteExec ["addAction",0, true];
give only one new action or stack a "Pick up knife" action on the object for each player

#

d2 is a bloody knife from my mods. I use it for a murder mystery op

exotic flame
#

is there a way to prevent selected players to be able do turn vehicle engines on or to drive vehicle ? I mean except setFuel 0 or setHit ["HitEngine", 1].

warm hedge
polar belfry
#

will my line work and show one action across my players or show one action for each player when interacting with the object?

south swan
#

placed where?

hallow mortar
#

It has this so I suspect it's in the init field of the knife object.
Code in init fields is executed on all machines at mission start or when they join the mission, so in this case you do not need to remoteExec - the remoteExec command will be executed by every machine, broadcasting to every other machine, resulting in duplicate actions.

polar belfry
#

oh

#

then how can I make it show the action only once so any player sees only their action on the scrollwheel and not
"Pick up knife"
"Pick up knife"
"Pick up knife"

scenic shard
#

ok, so using doStop this; on a unit will break it on a dedicated server and it shows up as "empty" if you look at it in zeus.

anyone know a workaround for this?

hallow mortar
polar belfry
#

will it work in mp?

hallow mortar
#

Given that:

Code in init fields is executed on all machines at mission start or when they join the mission
why would it not?

polar belfry
#

oh ok

#

I saw this in the addaction wiki page

#

[_object, ["Greetings!", { hint "Hello!"; }]] remoteExec ["addAction"];

#

let's say 10 players join... will they see 10 greeting actions or one each

south swan
#

sigh

#

// create object on the server and add action to the object on every client
if (isServer) then
{
    private _object = "some_obj_class" createVehicle [1234, 1234, 0];
    [_object, ["Greetings!", { hint "Hello!"; }]] remoteExec ["addAction"]; // Note: does not return action id
};```here's the full example
winter rose
#

don't remoteExec it

polar belfry
#

ok

south swan
#

if (isServer) means it'd get executed only once. On the server. 🤷‍♂️

polar belfry
#

will try without remoteexec

#

sorry for the annoyance

#

it works thanks

jade acorn
hallow mortar
#

doStop causing units to appear empty is fairly well-known. Never had it actually break them though - despite appearing empty they still behave normally (other than being stopped).

winter rose
jade acorn
#

I haven't used it since then 😛

south swan
#

ain't gonna change what ain't broken

winter rose
#

think of all the bits that could be saved!

south swan
#

all three of them (literally)

hallow mortar
south swan
#

errors -> broken -> fix it 🤣

hallow mortar
#

I mean before the change. It always needed fixing - it relied on undefined behaviour but no one wanted to fix it because it didn't generate errors and "wasn't broken". Then when BI fixed the undefined behaviour...
I work with the F3 mission framework. Old versions of the framework used that behaviour for their unit marker script, running that check something like once every second or two. We have a large archive of old missions that are now massively irritating to play if you have script errors turned on, because people back then didn't fix what "wasn't broken".
(We also still have some people who complain about BI fixing it...)

south swan
#

Posted on September 20, 2013
Killzone_Kid
In case you have more complex code inside waitUntil loop, to be on the safe side always return boolean at the end of the scope:
if i go somewhat back through the page versions on wiki, though think_turtle

#

and (obviously) no mentions on bool return being mandatory 🤔

copper raven
#

it wasn't UB though was it? if you returned nil, then it would keep checking?

south swan
#

until the code returns true.
nil != true. Is that really UB?

scenic shard
south swan
#

well, akshually think_turtle

hallow mortar
#

Well, this is the change note that fixed it:

Fixed: Using waitUntil with nil made the script enter a state of infinite suspension
That seems fairly undefined

copper raven
#

infinite suspension

south swan
#

what would waitUntil {false}; do?

hallow mortar
#

Fail forever, presumably, but in a safe way

#

Perhaps "undefined" is the wrong word, more like "unintended". I think the point remains; it was always wrong code, it just didn't generate errors

#

If BI considered it worth fixing, it was probably doing something bad internally

scenic shard
#

i spoke too soon, while this spawn {doStop this}; did not bug out my units, it also didn't work as the units did not stay on position.

same issue with disableAi, also did not work on dedi for some reason..

scenic shard
#

ooh, missed that. thank you will try again

scenic shard
#

ok, seems like it is working now, but only sometimes. anything else apart from doStop i should do to make them stay?

the disable path worked fine now, but for these ones it is fine if they start moving after contact

copper raven
#

what's the point of spawn there?

scenic shard
#

for some reason the AI breaks on dedicated server without it

jade acorn
#

but doStop makes units leave the formation and they wont' move with their leader, but they will still look for cover and engage (like search and destroy) enemies, it won't keep them in one place like in case of disabling pathfinding

scenic shard
#

that is fine, but in my case there are no enemies nearby

#

hm, noticed they are in aware stance, would that make them seek cover then?

jade acorn
#

have you tried putting that dostop thing in group's init?

scenic shard
#

no, but in this test case it is on each individual unit

jade acorn
#

Aware shouldn't make them walk around, it just puts them in formation + running speed

#

in Combat behaviour they change positions and stances.

#

if you could please check that dostop thing when placed in group init, as I said I didn't have any issues with AI when I gave their groups this spawn {doStop units _this};.

#

but at the same time I didn't use any AI mods, so maybe this is the case too

scenic shard
#

not sure if ACE changes ai, but i do have lambs as well

scenic shard
jade acorn
#

are you trying to garrison these doStop units? have you tried using lambs garrison module instead?

scenic shard
#

I'm placing them near some sandbags and bunker (manually placed) lambs dont seem to recognize it as something that can be garrisoned

cold mica
#

Is there a way to do setObjectTextureGlobal on a helmet instead of the uniform? It has a hidden selection, I just don't know how to use it.

jade acorn
#

you can't do that to vests and helmets afaik

cold mica
#

So there's no way to retexture them even if they have hidden selections?

jade acorn
#

you can do that through config, but it forces you to make a mod

#

according to some comment from 2014:

Vests and helmets are seperate instances. So far I've only been able to change the texture of the uniform (which is in CfgWeapons), but neither helmet or vest. Using (vest player) isn't going to work either as setobjecttexture takes an object and not a string. *I guess a possibility is to create the helmet / vest seperately, add a texture to it, and then add it to the player. *It's just guessing but worth a try.

#

so you could try but generally speaking and what people/biki say, only uniforms and objects with hiddenselections can be retextured with a command

copper raven
inner flicker
#

@copper raven I'm using the init field for the createvehiclecrew command you told me about. But I also already had crew in the vehicles when I put the code down. I will remove the crew from the vehicles to see if that works.

copper raven
#

the expression one?

#

if yes, it should work

inner flicker
#

So I put that in the expression field and not the init field?

copper raven
#

expression yes

#

init field is ran once at the beginning of the mission

inner flicker
#

Ok. I'll try that then

copper raven
#

expression runs everytime a vehicle respawns

cold mica
#

Unfortunate news. Thanks

inner flicker
#

Ohhhh!!!! Thanks for clarifying that. I will do that and report back

#

Im at work rn, so it wont be for a little bit

chrome hinge
tepid vigil
#

Any other advantages to missionProfilenamespace other than reducing profilenamespace bloat and ability to transfer mission saves between profiles?

lavish stream
frigid oracle
#

how can I spawn a fire effect through script rather than eden?
nvm found create3DENEntity

inner flicker
#

@lavish stream my bad mike, I wasnt aware of the expression field itself in the module and was pretty tired, but I do appreciate the help you and @copper raven have given me. I am at work rn and will have to do this tonight. Question: if I have a vehicle starting in mid flight does that command respawn the vehicle in flight or?

lavish stream
frigid oracle
inner flicker
#

Ok I will try this when I get home.

frigid oracle
#

oh ok ill look at that

frigid oracle
#

Does the event handler HandleDamage work correctly with ace3 'new' medical? Im not sure in my testing as the unit still dies as im trying to prevent its death.

dreamy kestrel
#

I need an event that happens when an object is created, really when a UNIT is created, is that the "EntityCreated" mission event handler? or is it an "Init" event? Key class I think is "CAManBase", i.e. _entity isKindOf "CAManBase"... thanks...

dreamy kestrel
copper raven
frigid oracle
#

Fug, I assume there is no way around that huh? Thank you for the info.

drowsy geyser
#

i have three Editor placed objects and i want them to randomly spawn at predefined positions every 15 seconds.
The code works but when i run it in MP the script does not run simultaneously for every player, is there another way to achive that?

if (isServer) then
{
    _randomObjPos = [
    [7595.75,4005.57,0],
    [7595.97,3993.47,0],
    [7589.42,3999.57,0],
    [7583.47,3993.63,0],
    [7583.51,4005.68,0],
    [7577.25,3999.46,0],
    [7571.52,3993.45,0],
    [7571.37,4005.22,0]];

    while {true} do
    {
    _objPos1 = _randomObjPos select floor random count _randomObjPos;
    _objPos2 = _randomObjPos select floor random count _randomObjPos;
    _objPos3 = _randomObjPos select floor random count _randomObjPos;

    obj1 setPosATL _objPos1;
    obj2 setPosATL _objPos2;
    obj3 setPosATL _objPos3;
    sleep 15;
      };
};
dreamy kestrel
dreamy kestrel
opal zephyr
#

And do the objects spawn every 15 seconds ands its just out of sync between players, or do they spawn at different intervals?

drowsy geyser
#

from init.sqf
they spawn every 15 sec but out of sync between players

granite sky
#

IIRC it depends whether your HandleDamage is installed before or after ACE's.

inner flicker
#

@copper raven @lavish stream ok, so it works, however now theres another issue. I have it so they're on a waypoint system. When they respawn, waypoints non existant

#

Crews there, but they just sit

lavish stream
#

That's just a limitation.

#

Nothing you can do unless you want to script waypoints.

inner flicker
#

Ok, well, progress was made. I'm grateful for that. Could I add waypoints in the expression field along with the createvehiclecrew command?

#

I'm just trying to get it right. Would a trigger work?

west grove
#

is there a way to return a list of all holdActions assigned to an object?

warm hedge
#

Hold Action technically is just a regular action, you should be able to fetch by addAction related commands, if that fits

west grove
#

if i can return them via actionIDs that means the miller in my old man save has no actions assigned. would explain why i cant deliver the quest item

#

heh, i have an idea for a really terrible workaround

#

hah. i'm correct. if i start a new game, miller has 2 hold actions

#

so for some reason, in my savegame the actions are either not (re?) added, or they have been removed

shut reef
#

Can errors in parseSimpleArray not be caught with try-catch or am I doing sth wrong?

warm hedge
#

Code?

shut reef
#

try { private _array = (parseSimpleArray GVAR(itemsInArsenalCustomCategory)); } catch { diag_log "Update failed."; };

#

Works fine when variable is well formed, does never execute catch if not.

#

Same behavior with this:
try { diag_log call compile '["Test]'; } catch {diag_log "nope";};

#

Never gets to the catch part.

shut reef
#

Or does that code work for you?

winter rose
#

no, try-catch is not meant for that.

copper raven
tepid vigil
#

Is there a bug in my code or is ArmaScriptCompiler not compatible with 2.10? The following code throws a syntax error:

private _compatItems = compatibleItems _wpn;
copper raven
#

commands list probably outdated

shut reef
copper raven
#

can't

#

validate the string

tepid vigil
shut reef
copper raven
#

custom code i'm afraid

shut reef
#

ugh 😦

#

thx tho

copper raven
#

what are you trying to parse?

shut reef
#

string of an array of strings

#

List of class names users can input/copy via cba settings

copper raven
#

if it's throwing an error, then that means that the input is invalid

#

so there's no point of validating it

shut reef
#

I know that the string is not valid, I made it invalid to test it

copper raven
#

is it ever invalid then? (without you intentionally making it invalid)

shut reef
#

I was looking for ways to catch user input mistakes

copper raven
#

ah it's user input

shut reef
#

yeah

copper raven
#

but how does the user input the data?

#

just complete array directly?

shut reef
#

yeah. You know the CBA settings editbox?

copper raven
#

well yeah if you want to check it for errors, you basically need to write a parser

#

but it's gonna be really slow in sqf

shut reef
#

Yeah. Wouldn't be much of an issue, they'd not do that multiple times a second xD

#

but I'll think about whether it's wort writing a parser

south swan
#

Sqf parser in sqf. Xzibit.jpg

copper raven
#

i'd personally just let it error

#

if it fails it will return an empty array

#
private _test = parseSimpleArray _data;
if (_test isEqualTo []) then {
  _test = ["some default data"];
};
shut reef
copper raven
#

yes

#

that's what i meant

#

if it fails, it throws an error and returns an empty array

shut reef
#

I'll have to verify that tomorrow, but I think it doesn't continue to execute after the error

copper raven
#

well it should

tough abyss
#

I'm new to arma scripting so I apologize if I sound a little thick.
So I have an arma server and I'm running a client side addon , now I want to overwrite a function in said addon.
The only way I was able to achieve this was by making my own addon and loading it after the initial addon.
Now my questions is: Is there a way to achieve the same result without the player having to download an extra addon?

willow hound
#

No.

tough abyss
#

thank you 👍

little ether
#

Alright lads need some help.

I've had a loadout system I've used for a while when hosting my own small ops locally, essentially doing a bunch of addactions to lockers that give loadouts to players that use them, those addactions just calling loadout sqfs etc etc .... worked perfectly. Now though I'm trying to use it on a dedicated server and it's just not working at all and I was wondering if anyone would be able to help me get it to work on dedicated servers.

Init


_liststoresArray = [stores,stores_1,stores_2,stores_3,stores_4,stores_5];
//_liststoresExtraArray = [storesExtra];
//_listrifleArray = [rifle];
//_liststenArray = [sten];
//_listbrenArray = [bren];

// Stores
{
    _x addAction ["<t color='#A32323'>Field Kit Store</t>", {}, "", 1.5, true, true, "", "true", 5];
    _x addAction ["Commander", "loadouts\Commander.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Section Leader", "loadouts\Section Leader.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Rifleman", "loadouts\Rifleman.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Scout", "loadouts\Scout.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Machine Gunner", "loadouts\Machine Gunner.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Sapper", "loadouts\Sapper.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Medic", "loadouts\Medic.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Aviator", "loadouts\Aviator.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
    _x addAction ["Crewman", "loadouts\Crewman.sqf", "", 1.5, true, true, "", "true", 5];
} forEach _liststoresArray;```
#

Rifleman.sqf

removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;

// Add back compass, watch, and map
    player addWeapon "vn_l1a1_01";
        player addPrimaryWeaponItem "vn_b_l1a1";
    //player addWeapon "vn_m72";
    player addWeapon "vn_hp";
    player linkItem "vn_b_item_compass";
    player linkItem "vn_b_item_watch";
    player linkItem "vn_b_item_map";
    player linkItem "vn_m19_binocs_grn";
    player addBackpack "vn_b_pack_p08_01";
    
// Helmet (randomly selected from list)
    _helmet = selectRandom ["vn_b_boonie_08_02",
                "vn_b_boonie_08_01",
                "vn_b_boonie_07_02",
                "vn_b_boonie_07_01",
                "vn_b_boonie_06_02",
                "vn_b_boonie_06_01"];
    player addHeadgear _helmet;

// Uniform (randomly selected from list)
    _uniform = selectRandom ["vn_b_uniform_aus_01_01",
                "vn_b_uniform_aus_02_01",
                "vn_b_uniform_aus_03_01",
                "vn_b_uniform_aus_04_01",
                "vn_b_uniform_aus_05_01",
                "vn_b_uniform_aus_06_01",
                "vn_b_uniform_aus_07_01",
                "vn_b_uniform_aus_08_01",
                "vn_b_uniform_aus_09_01",
                "vn_b_uniform_aus_10_01"];
    player forceAddUniform _Uniform;

player addVest "vn_b_vest_anzac_01";```
#

Won't post the whole thing but the above are examples

#

The chosen objects that have the addaction assigned to them don't even show the addactions at all

proven charm
#

also the player variable only works on client

#

so your going to need some remoteExec calls or run that code in client, not server

jade acorn
#

can I detect whether a unit is during a ragdoll? I was planning to have a trigger that would activate when target is hit with a car (target has damage disabled so he ragdolls but is still alive)

#

if not possible I'll just make him damageable again and later replace with a brand new alive copy

winter rose
#

perhaps checking animation? I think it equals ""

jade acorn
#

so "incapacitated", alright I'll try it

#

thanks

little ether
proven charm
#

is your Init code in init.sqf file? or init field?

chrome hinge
#

Hi everyone, im trying to learn scripting. Is there something wrong with this line? Im trying to activate it with a trigger.

#

[getMarkerPos "mygroupspawn", WEST, ["US_MGSPlatoon"]] call BIS_fnc_spawnGroup;

#

The trigger itself seems to work, it gives off the sound it was supposed to

proven charm
#

you should probably make _moneyDatabase a global variable instead, it wont work as local. also this seems undefined: private _countMap = count _hashmap;

#

player only works on client

copper raven
#

loop allPlayers

proven charm
copper raven
#

but whats the point of this?

#

of this "bridging" hashmap

#

you're just updating value every 10min, you can just get the value via getVariable normally anytime you want

#

so store it when they're about to disconnect/load it when they join back

tepid vigil
#

Is there a reason as to why CBA_fnc_players works like so:

(allUnits + allDeadMen) select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}

instead of

allPlayers - (entities "HeadlessClient_F");

The latter is way faster when there are units on the map, with 90 units on the map it is ~20x faster

copper raven
#

yes every 10min

#

why?

#

do it at leave/join

proven charm
#

following Sharp's advice you can use this to run code when client leaves the server : sqf addMissionEventHandler ["HandleDisconnect", { params ["_unit", "_id", "_uid", "_name"]; false; // probably good to have false }];

tepid vigil
ancient plaza
#

@copper raven hey would it be possible to sync 2 modules together? One for the createvehiclecrew and th other for the waypoints?

copper raven
#

some notes there

ancient plaza
#

Or would that cancel one over the other?

copper raven
#

i have no idea what you mean by that, what modules?

ancient plaza
#

Vehiclerespawn

tepid vigil
# copper raven some notes there

Could it be added to these notes that cba_fnc_players reliably returns player objects even at mission start, unlike allPlayers

copper raven
#

you can't "link" them

#

just put everything into the same respawn module

proven charm
#

that doesn't work because the local variables wont exist inside the spawn

ancient plaza
#

Ok gotcha. I wasnt sure if you could do that in the expression field.

copper raven
proven charm
#

also you are not updating the money...

ancient plaza
#

Yeah I was just checking because theres only one line for the expression field.

proven charm
#

sorry I don't follow, I see no prints in your code

copper raven
#

lots of errors there, first, getVariable takes two arguments not 1, second, _moneyDatabase, _allPlayers and _money is undefined in the scope you use them, third, you're looping over _allPlayers but are just setting the same hashmap key everytime

sharp grotto
#

Is there any way to check if arma is using .sqfc or .sqf for a function ?
I added some with compileScript (.sqf & .sqfc), but since its documentation is not too great, i asked myself if it's even working for me.

proven charm
#

@granite haven ```sqf

moneyDatabase = createHashMap;

[] spawn {
while {true} do {
sleep 600;

//private _uid = getPlayerUID player; //for later
private _allPlayers = call BIS_fnc_listPlayers;

    //private _countMap = count _hashmap; // for later
    {moneyDatabase set [getPlayerUID _x, _x getVariable ["BIS_WL_funds",0] ]} forEach _allPlayers;
};

};

#

something like that 😃

copper raven
#

plus global variables cannot be private

proven charm
#

edited a bit but not 100% sure if that works

eternal spruce
#

Good morning everyone, I don't know how often this might be asked but I'm new to the game and I realize I can make scenarios in the editor. I've been working on one and I realized that I can animate the doors on some vanilla vehicle so is it possible to make a helicopter door open and close on the GetIn\GetOut command and how would I go about doing so

proven charm
#

still those local variables that wont work inside a spawn. plus other errors

#

you would also need to update them, now u just get the values once

little ether
proven charm
#

yes

#

but then the file never reaches end

#

it will be stuck in the while loop

#

ummm how are you running the file?

#

execVM ?

little ether
proven charm
#

sure

proven charm
little ether
#

Love it, thanks a ton mate I'll give it a good soonish and get back to you ❤️

tulip ridge
#

I'm trying to have a hold action that only displays text to the caller. I tried doing this with titleText and using remoteExec where _caller is local (I also tried with player), but it still shows to other units. (I've tested in SP and MP, both by zeus controlling another unit).

This is the "Code Interrupt" block

if (not (_caller getUnitTrait "Engineer")) then {
  // Only display message if caller is not an engineer
  [["You have no idea what you're looking at, perhaps an engineer will be able to understand it?", "PLAIN DOWN"]] remoteExec ["titleText", _caller];
  // Display titleText message to the unit that called the action
  // Pass arguments with double brackets since titleText expects an array
};

(The comments have been added, they are not in the block itself)

hallow mortar
#

The interrupt code is only executed where the caller is local, so remoteExec is not needed.
However, while you target locality by referencing a unit or object, locality is not exclusive to that object, it's exclusive to the entire machine where that object is local.
So your text will appear to other units if they are also local to the same machine. If you're Zeus controlling the unit, it is now local to your machine - and, in locally-hosted multiplayer, if you're the host, most things are local to your machine (everything if you're the only player). This is unlikely to be a problem in real MP because only one player will be on each machine.

tulip ridge
#

Okay, I was wondering if perhaps it was correct, but just behaving differently because of the method I was testing it

#

Thank you!

tulip ridge
#

How can I check if a variable is an array?
I found isArray but that seems to only take configs as inputs

hallow mortar
#

_variable isEqualType [];

proven charm
tulip ridge
#

Alright, thanks ya guys!

hallow mortar
#

isEqualType would be the preferred way since it's a single command, rather than a command and a string comparison - shorter and tidier to write, and almost certainly slightly faster

copper raven
#

typename is terrible if you want to compare, isEqualType was exactly intended for that purpose (as a replacement to that)

worthy igloo
#

why does hint preprocessFile "core\testVelocity.sqf"; hint the script but
copytoClipboard preprocessFile "core\testVelocity.sqf"; this doesnt copy to clipboard

worthy igloo
winter rose
#

I shalt let you deduce that one 😛

wispy topaz
#

How can I turn this into a loop?
Bravo move position player;
I basically want to make team Bravo constantly follow team Alpha and also have them at a 10-20 meter distance from each other

worthy igloo
tulip ridge
#

How can I remove a specific string from the beginning of another string?
Say I have a variable removeMe that is equal to the string "test", and I have the string "testThat isn't supposed to be there".

Basically:

removeMe = "test";
testString = "testThat isn't supposed to be there";
// some code
newString = "That isn't supposed to be there";
#

I know this is quite a simple task in a lot of other programming languages, but I don't know how to do this in Arma

tulip ridge
#

Oh cool, thanks!

untold copper
brazen lagoon
#

is there a way to create a module without running the function that's defined in config?

untold copper
brazen lagoon
#

spawning a module with createUnit or createAgent

untold copper
brazen lagoon
#

create a module and then set the options on it before calling its init function in a script

brazen lagoon
#

I'm doing something like sqf _amb_placement = createAgent ["ALiVE_amb_civ_placement", _pos, [], 0, "NONE"]; _amb_placement setvariable ["debug", str _debug]; _amb_placement setvariable ["function", missionnamespace getvariable (gettext (configfile >> "cfgvehicles" >> "ALiVE_amb_civ_placement" >> "function"))]; [_amb_placement] call (_amb_placement getVariable "function")

#

(not exactly but this is simpler than posting all of the functions)

#

the problem is if I use createAgent with this classname the module's init runs immediately, before the setVariable calls are done

untold copper
brazen lagoon
#

using this in a script

#

I am asking if you can create a module in script without running its init

#

or, more correctly, delaying its init

untold copper
brazen lagoon
#

that's fine. I think its probably doable if you create an addon

tulip ridge
#

How can you display a cutText layer on top of a titleText?
I've been trying to help a friend, and I thought that cutText just wasn't working, but it's because it was being displayed behind a titleText Black in/out layer

#

Here's his script so far

// Black Screen while quote displays
titleText ["", "BLACK OUT"];
sleep 2;
cutText ["“In examining disease, we gain wisdom about anatomy and physiology and biology. In examining the person with disease, we gain wisdom about life.”  - Oliver W. Sacks", "PLAIN"];
sleep 4;

// Add effects and fade out curtain
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
titleText ["", "BLACK IN", 5]; 

// Info text
[format ["Bekatov, %1.%2.%3", date select 1, date select 2, date select 0]] spawn BIS_fnc_infoText;
sleep 3;
#

Basically, he wants the screen to start out black, then have the quote come in, wait a bit, then apply the blur effect while the screen fades back to normal

#

I tried swapping the cut/title texts, but the black screen doesn't seem to work with the cuttexts

untold copper
tulip ridge
#

I tried using layers, but it still kept displaying underneath the titleText

#

Also setting it to a number that high dropped me to like, <1 fps lol

#

Test if titleText needs the same layer numbers.
titleText doesn't use layers

tulip ridge
untold copper
untold copper
#

OK.

untold copper
# tulip ridge This is it

// Black Screen while quote displays
titleText ["", "BLACK OUT"];
sleep 2;
cutText ["In examining disease, we gain wisdom about anatomy and physiology and biology. In examining the person with disease, we gain wisdom about life.  - Oliver W. Sacks", "PLAIN"];
sleep 4;

// Add effects and fade out curtain
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
titleText ["", "BLACK IN", 5];

// Info text
[
    "Bekatov",
    format
    [
        "Bekatov,
        %1.%2.%3",
        date select 1,
        date select 2,
        date select 0
    ]
] call BIS_fnc_infoText;
sleep 3;
#

Works for me.

tulip ridge
#

Weird, the text doesn't get displayed for me

untold copper
tulip ridge
#

The quote

untold copper
#

Really?
How are you testing it?

tulip ridge
#

Just that code in an init.sqf

#

Only other thing I have running at the start is a script to set up ACE Fortify

untold copper
#

I doubt that's it.

tulip ridge
#

Yeah

untold copper
#

It runs fine on my end.
Although BIS_fnc_infoText shows only for a second.

I'll take another look at it in the afternoon.
Let me know if you solve it.

tulip ridge
#

Will do

mystic delta
#

Is there a list of trigger condition examples out there?

warm hedge
#

Why list?

shut reef
# copper raven if it fails, it throws an error and returns an empty array

It's even weirder than that. It throws an error and sometimes still returns an array. So it kinda salvages what it can parse even when it throws an error.
Which, ironically, makes it entirely useless in this case, cause there is no way to to reliably determine whether it throw an error or not.

outer ocean
#

To Sync waypoints, we use this: synchronizeWaypoint
But what keyword is for the Set Waypoint Activation?

outer ocean
#

If it is, then how to make it work? Because it is the same as the Condition and OnActivation box in the Editor.

#

But not the actual Set WayPoint Activation

warm hedge
#

I don't understand?

drowsy geyser
#

i'm trying to choose a random player but it gives me an error message: undefined variable _randomPlayer
this is my code:

_alivePlayers = allPlayers select {lifeState _x != "INCAPACITATED" && !(_x getVariable ["vestOn",true])};
_randomPlayer = selectRandom _alivePlayers;
_randomPlayer addVest "V_TacVest_blk"; 
_randomPlayer setVariable ["vestOn", true, true];
#

it gives me that error msg, but still adds the vest and sets the variable on true, very wierd

cosmic lichen
#

@drowsy geyser what happens if _alivePlayers is empty?

drowsy geyser
#

You mean if there is no player at all?

south swan
#

you don't getVariable out of the thin air. You need to provide the namespace to it 🤷‍♂️

drowsy geyser
inner flicker
#

Hey I just want to say you guys are doing an awesome job! Have a good rest of the day!💯

south swan
drowsy geyser
#

The code runs in a trg
Trg con:
{vest _x == "V_TacVest_blk" && lifeState _x == "INCAPACITATED"}count allPlayers < 1

south swan
#

which would be 0 if all players are incapacitated, but have no vests. Leading to empty array in the executed code. Leading to _randomPlayer being nil

#

call - run in this thread and wait for return
spawn - start in a separate thread and don't wait for it

drowsy geyser
copper raven
#

assuming that all BIS_fnc_WL2_dataBase does is just update data in some "database", that loop is pointless, _playerMoney never changes

drowsy geyser
copper raven
proven charm
faint oasis
#

Hi, is there a way to hide the "task" icons on a Map Control ?

exotic flame
#

I have a question: is there a way to prematurely stop the fire of a destroyed vehicle ? Can we also change the color of this fire ?

spiral narwhal
#

Hello everyone,

I am trying to figure out a script command to set a headgear texture using setObjectTexture. I've tried using headgear player setObjectTexture [0, "texture"]; but have had no success.

hallow mortar
#

You can't. Headgear doesn't support on-the-fly retexturing

spiral narwhal
hallow mortar
#

Uniforms and backpacks

spiral narwhal
#

thx for the help

hallow mortar
#

Note that uniform textures will be reset if the uniform is removed or changed, or if the unit is opened in the Virtual Arsenal

true frigate
#

Hey! I want to create a script that detects if a player is moving too fast within a certain area, almost like a motion trigger, could anyone think of a way that I could do this?
I'd imagine I'd have to use an EH to detect movement for each player on the server, but I can't quite tell how I would go about something like this.

open fractal
#

I'd just run a loop clientside with the speed command tbh

hallow mortar
#

A non-server-only trigger with the condition as (speed player) > 5 (tune the number) would be fine

true frigate
#

Oh, great! I thought it would be a lot more difficult haha. Thanks! 🙂

true frigate
hallow mortar
#

set the condition in the dropdowns as "any player present", and then in the condition field:

(player in thisList) && {(speed player) > x)}```
true frigate
#

Awesome, I assumed "any player" would just set it off for everyone anyway 😄

hallow mortar
#

The condition from the dropdowns is only used for actually activating the trigger if this is used in the condition field. Otherwise it just sets the conditions for what can appear in thisList

#

You could also set the dropdown conditions as e.g. BLUFOR present if you only wanted it to trigger for BLUFOR players - thisList would contain only BLUFOR units, so player in thisList would only be true if they were BLUFOR

true frigate
#

That's actually really handy to know, thanks a lot! 🙂

granite sky
#

speed player reads 0 for some animation types (sideways? I forget) so vectorMagnitude velocity player is more reliable. Might not matter here though.

true frigate
#

Sorry for the dumb question but my brain isn't working this one out, even with the wiki, for some reason I'm not making sense of it.

if (var == true):
{
  hint "something";
};```
is returning `Error: type if, expected switch.`
I've looked on the wiki for 'if' and 'switch' to see if I can see the difference, I've tried a number of combinations that always end in the same outcome. Another odd thing is that on the wiki, it doesn't show the if statement needing a colon, but I've tried this and it just freaks out. 

I've read up a little on switches and don't fully understand them, from what I can grasp, it seems to be that if something is true/false, you can have two different results, but I don't need one to activate if `var` is false, so I assume an 'if' statement would be acceptable here, apparently not.
Again, really sorry is this is a very amateur sounding question, but I figured I might as well learn it here to avoid this in future 😅
#

You know, I just noticed it. You need to add 'then' after the statement. Like I said, I'm not working at 100% right now LUL

granite sky
#

You get a less obvious error if you just miss the then out. You're getting the version for a bad :

true frigate
#

I had actually tried it with out the colon, it had told me I was missing a semi colon, which I assumed it must have meant I had written it completely wrong.

granite sky
#

It's because you have two data types (if (stuff) becomes an "if" data type) without a command in between. It figures they're the end & start of two lines so you get the missing semicolon error.

true frigate
#

Right, that makes a little sense but I'm going to have to come back to this tomorrow when it's not 1am 😄

#

Thank you for the explanation though 🙂

wispy topaz
#

Trying to make team Bravo follow Alpha using this in an init field and it isnt working
[Bravo, Alpha, 5, 0]; spawn_BIS_fnc_stalk;

#

Never scripted before so I'm clueless on how to make it work

granite sky
#

You have two syntax typos for a start.

#

[Bravo, Alpha, 5, 0] spawn BIS_fnc_stalk; is at least valid code.

granite sky
#

Bravo and Alpha would need to be variables for groups that exist at the time the code is executed.

wispy topaz
open fractal
#

it's confused by the random underscore _ between spawn and BIS_fnc_stalk

inner flicker
#

Anyone know why this script isn't working for the vehicle respawn? CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1));

#

Found this and I put this in the expression field of the vehicle respawn module. But the waypoints dont copy over for some reason.

inner flicker
#

Oh and how do you make the font look like script on here?

hallow mortar
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
inner flicker
#

Awesome! Thanks

#

//test;

#

'''Sqf
//
Hint "good";

hallow mortar
#

The ` key is often found in the top left below ESC

inner flicker
#

Found it. I'm on my phone.

#

Also could you help me figure out why the copyWaypoints command isn't working with the respawn module?

#

I'm trying to figure this out and it's annoying

hallow mortar
#

Someone probably can but not me. I never use the respawn module so I don't know the necessary things

#

A lot of our top scripters are in Europe, where it's currently between 0300 and 0500, so you might have to wait a little before someone comes along

inner flicker
#

It's fine, I'm close, but not close enough to figuring this out

#

I just need to see if I'm missing something or if something else needs to be added

frigid oracle
#

How could I remove an added event handlers on unit death?

Example, I added a Reloaded EH, I want a Killed event handler to remove the Reloaded EH on death if certain condition is not met.
I understand EHs have an index number, im just not sure how to grab the index outside of the eventhandler

granite sky
#

Store it on the unit with setVariable.

frigid oracle
pseudo ridge
#

I tried to draw player path in 3D screen with drawLaser because it's far more visible tthan drawLine3D but after some lasers they start to dissapears like if a limit is reached. Can this limit be changed?

warm hedge
#

What limit? Amount, or distance?

pseudo ridge
#

Distance limit is 1700 meters more or less, number of lasers limit is low. I would need at least to increase number limit.

#

I have many small segments of 15 meters lasers.

#

And when number limit is reached they dissapears in no particular order.

#

Just some of them dissapears, randonly.

#

The good is i have no performance problems with lasers, and it's easy to see.

#

drawLine3D is a bit heavy and hard to see.

warm hedge
#

Sounds really like a hardcoded limit

proven charm
#

when you use _obj attachTo [_pal]; shouldn't the _pal stay on it's original position?

south swan
#

_pal shouldn't get moved when you attach anything to it, if that's your question

#

as in attachTo doesn't move the to object

#

but you can move _pal after you get something attached to it (and attached object would move with it)

proven charm
proven charm
#

actually I meant _obj should stay where it is

south swan
proven charm
#

it doesn't but i have to use that? sorry confused

#

ah you meant it does move?

south swan
#

attachTo doesn't keep left _obj where it was. It moves it to the listed bone/offset of the target (right) object. Defaulting to origin and [0,0,0] offset

proven charm
#

ok got it, thx 🙂

proven charm
#

I'm getting same result with these: ```sqf
_obj attachTo [_pal];

[_obj, _pal, true] call BIS_fnc_attachToRelative;

meager spear
#

Anyone with experience with RHS loading of vehicles script? I am looking some info about rhs_maxCargoMassCoeff

cursive hazel
#

Alright, I am pulling my hair out over this.
I am getting the error _spawnpoint is undefined on the third line by createUnit when running the following script. Why?!

private _getSpawnLocation =
{
    params["_group"];
    private _spawnpoint = _group getVariable "spawnpoint";
    private _spawnpoints = [];
    {    //Loop through every object synced to the respawn point
        if (typeOf _x == "Sign_Arrow_Yellow_F") then
        { _spawnpoints pushBack _x; };
    } forEach synchronizedObjects _spawnpoint;
    selectRandom _spawnpoints
};

private _spawnpoint = [_group] call _getSpawnLocation;
(ALL_INFANTRY_UNITS # _factionNumber # _groupType # _queuedUnit) //Select the correct unit to spawn
createUnit [_spawnpoint, _group, "[this] call _unitInit;"]; //Spawn selected unit
copper raven
#

is that the exact code you have?

cursive hazel
#

No, one sec.

copper raven
cursive hazel
#

That's the code.

copper raven
#

kay

cursive hazel
#

It's slightly rearranged from my script file to only include essentials. That's why I've had to change it a little.
It should now be accurate.

#

Overall layout is identical.

copper raven
#

you're defining _getSpawnLocation after you try to call it though?

#

ah

copper raven
#

well, if you're getting _spawnpoint is undefined that means either _group is undefined, or _group doesn't have "spawnpoint" defined

cursive hazel
#

Both are defined.

copper raven
#

are you sure?

#

if so, then, you're trying selectRandom []

cursive hazel
#

Wait. One sec.

#

Yes.

copper raven
#

where is it saying that it's undefined? synchronizedObjects _spawnpoint or createUnit [_spawnpoint here?

cursive hazel
#

() #createUnit [ . . . ]

copper raven
#

so that means _spawnpoints is always empty (your for loop doesn't add anything into it), thus you run selectRandom [] which is nil

cursive hazel
#

The weird thing is I have done poor-mans-debugging and used hints and it's not undefined.

#

You wanna know the kicker?

#

It spawns the units as expected.

#

But I am getting errors.

copper raven
#

doesn't make any sense

#

[this] call _unitInit; maybe you meant this?

#

because this will always error

#

_unitInit is undefined

cursive hazel
cursive hazel
copper raven
#

it doesn't matter

#

a local variable doesn't carry into that script

cursive hazel
#

Let me check. If that's the case then the error is way off.

#

Debugging SQF is absolutely the worst.

#

Hate it.

copper raven
#

the main syntax returns the created unit, so you can run private _unit = ... createUnit; [_unit] call _unitInit;

cursive hazel
#

I made the _unitInit global and error remains. Not it.

copper raven
#

run systemChat str [_spawnpoint] before the createUnit line

cursive hazel
#

Alright. I just saw something telling.

#

I've used hint for debugging because I am running it in SP (systemChat does not work in SP) and I just now saw that there appears to be some null's mixed into the valid spawnpoints. I've got no idea where the hell they're from . . .

copper raven
#

systemChat does not work in SP
it does though

cursive hazel
#

I thought it did but when I tried it recently it did not.
The chat does not appear for me.

#

Don't know why.

copper raven
#

your ui layout settings are broken maybe

cursive hazel
#

Hm. You're right. I modified my UI layout not long ago.
Weird why it does not show the chat still. I only made the chat window larger.

copper raven
#
    private _spawnpoints = [];
    {    //Loop through every object synced to the respawn point
        if (typeOf _x == "Sign_Arrow_Yellow_F") then
        { _spawnpoints pushBack _x; };
    } forEach synchronizedObjects _spawnpoint;

you can replace this with

private _spawnpoints = synchronizedObjects _spawnpoint select { typeOf _x == "Sign_Arrow_Yellow_F" };
cursive hazel
#

Doesn't it select the first valid?

#

Wait. My bad.

copper raven
#

i didn't include the selectRandom part did i, it means it stays as is

#

what i sent does exactly what your forEach loop does

cursive hazel
#

I saw it now. :P

#

Clever use of select.

cursive hazel
cursive hazel
#

I have now found and solved the underlying issue. It was caused by some spawn point locations not having sub-spawn points configured and I had not created a fall back solution for that yet. Now that is fixed and no more errors. :)
Thank you @copper raven .

copper raven
#

Disconnected

#

so after

#

i remember what you were trying to do

#

what i sent is exactly what you want

contains the unit occupied by player before disconnect

#

wat?

frigid oracle
#

Im running a HandleDamage EH on the server, it tracks values fine and correct with AI and a zeus remote controlling the unit. If a player goes into the lobby slot the EH stops working. Not sure what is the reason for this. I know MPEventHandler syncs globally so I would assume I need to sync HandleDamage manually or something? Im not sure how to do go about that.

hallow mortar
#

You're adding the EH on the server, but handleDamage only fires when the unit is local to the machine the EH is on, and when a player takes over the unit, it becomes local to their machine rather than the server

#

The best way to resolve this would be to add the EH on all machines when they join. You could add it in e.g. init.sqf, or by remoteExecing it from the server with the JIP parameter set to true

frigid oracle
#

how do you remoteexec a EH? I dont feel like I need to convert everything to an Init.sqf as the server is setting up SetVars to track the data, so I can just make those sync globally.

hallow mortar
#

Same way as with any other command. [left arg, right arg] remoteExec ["command",0,true]; -> [_unit,["HandleDamage",{code}]] remoteExec ["addEventHandler",0,true];

Adding it in init.sqf would be the preferred option because it reduces the amount of data that has to be sent over the network.

frigid oracle
#

ah ok, thank you. I wasn't sure if a EH was remoteexecable like that. TBF this script is only ment to be setup at mission start and not during the mission. So im not too worried about data over network

hallow mortar
#

It will be set up during the mission if a player joins after mission start. It's best to reduce network traffic where you can, because although individual parts may seem small, it can add up when you have a lot of players.
There is no need to be afraid of init.sqf, it's not complicated and requires very little effort to use. It's one of the best tools for doing things on mission start.

#

If you are dead-set on remoteExecing, make sure the remoteExec command is only run on the server, otherwise all clients will remoteExec it to each other as well, resulting in duplicate EHs.

copper raven
#

don't remoteexec code

#

there is always a cleaner way

frigid oracle
#

It will only be ran on the server, that is correct.
Im not afraid of init.sqf, I just didn't initially setup the script with it in mind and already am a bit too deep in the weeds without scratching and redoing stuff to fit that mold better. Was mainly hoping for the server to focus on the heavy lifting for this particular script going into it. (pretty much spent my time to rewrite it making it less hard coded.) Def will spend time to polish it even more after a quick fix method.

frigid oracle
copper raven
#

make two functions, one to drive the EH and one to add

frigid oracle
#

wdym by driving the EH?

#

the calculations it performs?

hallow mortar
#

If you already have this EH set up to run on the server, you shouldn't need to redo much at all. The EH code should be largely self-contained (because it has to be) so just cut the part where you add the EH and paste it into init.sqf. That should be like 90% of the work, only some locality touch-ups to finish off.
(And then, if it's a lot of code in the EH, turn it into a function that the EH calls for efficiency)

copper raven
# frigid oracle wdym by driving the EH?
// serverside
_unit remoteExec ["tag_fnc_addMyHandleDamageEventBlabla", 0, true];

// tag_fnc_addMyHandleDamageEventBlabla
params ["_unit"];
_unit addEventHandler ["HandleDamage", { call tag_fnc_onHandleDamage }];
// tag_fnc_onHandleDamage 
params [...];
// do stuff
#

always use a wrapper code for event handlers, as everytime an event runs it's code is recompiled

#

(last time i tested atleast, probably still is the same thing)

frigid oracle
#

oh I see, that makes sense. I didnt know it was recompiled on every fire.

#

another quick question. Is this the best way to call an unscheduled environment in the mission init's?

call compileScript ["scripts\boss\boss.sqf"];
copper raven
#

call an unscheduled environment
what you sent doesn't do that

frigid oracle
#

well if I remembered correctly compileScript is a shorthand for a longer command

copper raven
#

that's not the point

frigid oracle
#

call may not be the right term

copper raven
#

call doesn't force unscheduled execution

frigid oracle
#

create an unscheduled environment may be better phrasing

copper raven
#

to go unscheduled, best way as of now is

isNil _myFnc
frigid oracle
#

i think I should rephrase.
I only know 2 ways to "start" code in an init.

execVM
preprocessFileLineNumbers

I believe compileScript is a shorthand for preprocessFileLineNumbers

copper raven
#

compile(final) preprocessFileLineNumbers to be exact

frigid oracle
#

my question is are those the best and only ways or is there some hidden better method im not aware of

open fractal
#

CfgFunctions?

frigid oracle
#

True, outside of that though.

copper raven
#

if you're in scheduled and need to exec once in unschd, isNil compileScript ["script.sqf"]

#

otherwise execVM

frigid oracle
#

ok I see, that is a useful tidbit of info to write down.

copper raven
#

execVM if from unschd to scheduled, call compileScript ["script.sqf"] is the best if you want to stay in the current environment

#

but i'm talking about things that only ever execute once, otherwise use CfgFunctions (because you're recompiling code for no reason otherwise)

frigid oracle
#

Gotcha

copper raven
#

cfgfunctions is still the best though, unless you're executing some init script then it's okay

blazing zodiac
#

does exitWith reliably exit scripts from the main scope of the script. I've read about issues in the past and am curious if it's robust enough to use for request validation (things like "if (!isServer) exitWith {false;}" that are critical to security

copper raven
#

not main scope, no

#

current scope

#
if true then {
  if true exitWith {};
  // breaks
  hint "test1"; // hint doesn't execute
};
// resume execution
hint "test2"; // prints "test2"
blazing zodiac
#

Yes, of course. I mean specifically exitWith's from the scripts main scope. (exitWith's that SHOULD exit the script)

copper raven
#

depends what you mean with main scope

blazing zodiac
#

I found some old threads this week saying traditionally it couldn't be relied on to exit the script

#

I just mean the upper most scope in the script

copper raven
#

well only if you call exitWith in that exact scope

blazing zodiac
#

I understand that, and that exitWith exits the current scope. I'm concerned about an apparent unreliability I read about vaguely from like 2015

#

I'm curious if there are still issues now or it was fixed

copper raven
#

can you link what you read?

blazing zodiac
#

Or maybe the OP just didn't understand the issue

#

It wasn't anything specific, just something like "of course, there's the reliability issues"

#

which is why I was hoping someone here might have more info. It's totally possible they just didn't understand scopes

copper raven
#

there was something with exitWith not breaking a waitUntil

#

but it was fixed iirc

#

apart from that, i don't know anything else

blazing zodiac
#

ahh, maybe it was that then

#

thanks for the info either way. It seems to be working reliably in my test environment, I just want to make sure it's still working under load

granite sky
#

I use it so heavily that I'm pretty sure it's reliable.

#

And I found a bug in random recently :P

pseudo ridge
#

I use vectorCrossProduct a lot. People here think i'm crazy when i start to use my right hand to predict the new vector direction 🐒

fleet sand
#

Hi i have a question is there a way to add mines to zeus interface. I am using ZEN and Ace as mods and i place AT mines via composition. AT mines are vanilla ones. But they dont show up in zeus interface what so ever. This is the code i have but even this dosent work any tips how to add it to zeus interface?:

{
  _x addCuratorEditableObjects [allUnits,true];
   _x addCuratorEditableObjects [allMines,true];
    _x addCuratorEditableObjects [entities [[],["Logic"], true,true ],true];
  _x addCuratorEditableObjects [vehicles,true];
  _x addCuratorEditableObjects [allMissionObjects "All",true];
 } forEach allCurators;
devout solstice
#

Hello guys! I have a trouble with arma 3 editor and script, so:
I want an explosion to occur when a unit enters a trigger, but I don't know how to get the ammo name. I'm using the Fire Support Plus mod and I need to know the name of the 230mm Mine ammo. I will be grateful for your help

""name of the ammo" createvehicle getMarkerPos "marker_0"

jade acorn
#

what am I supposed to put in place of ABCD in <log record="ABCD">Get to the ABC record</log>? It doesn't take my record name, meanwhile <execute expression='player selectDiarySubject "Profiles:Record0"'></execute> works. Do records have some different name or they shouldn't have spaces or any symbols? So far I couldn't get log to work

copper raven
#

you need to put a record

jade acorn
#

I'll make a fix on biki then, as it says "record name" while "subject name" is the subject name, and "record name" is actually its ID

copper raven
#

or you can run _target addEventHandler ["Fired", { hint typeOf (_this select 6) }]; and fire the vehicle/unit and see it

devout solstice
copper raven
#

config viewer in-game

jade acorn
copper raven
#

try just 0?

#

you said you tried the record id? (the number)

jade acorn
#

I tried just ID in log and it didn't work either

#

so putting any number into log also makes the text white non-linked

copper raven
#

try adding both the subject and the record

jade acorn
#

like <log subject="Hello" record="ABCD">?

inner flicker
#

Anyone know why this script isn't working for the vehicle respawn? CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1));
[9:59 PM]
Found this and I put this in the expression field of the vehicle respawn module. But the waypoints dont copy over for some reason.

jade acorn
inner flicker
#

I've tried swapping the 0 and the 1 and it still doesn't work.

copper raven
inner flicker
#

but this is put into the expression field of the vehicle respawn module

#

i thought i was close to figuring it out

copper raven
#

i don't know if AI keep their waypoints when they die

inner flicker
#

so before the vehicle respawn module broke, they did. but since it's been broke, well, alternatives had to be figured out without using the module

copper raven
#

broke? what do you mean?

inner flicker
#

so the vehicle respawn module, DOES respawn the vehicles, as intended. BUT if you have AI in them initially, the do not respawn, hence all the asking for help here

#

they should respawn with the vehicle. but for some reason, now they don't

#

i seen something about it not working since 1.68 or something like that.

copper raven
#

when the vehicle respawns

#

the old vehicle is deleted right?

inner flicker
#

yes

#

the crew gets respawned with said vehicle

#

but waypoints for whatever reason don't stick

#

even with copyWaypoint

copper raven
#

add systemChat str [group (_this select 1), waypoints group (_this select 1)]

#

into the expression field

inner flicker
#

do i add that by itself and no others?

copper raven
#

doesn't matter

inner flicker
#

ok

#

i will try that give me a few minutes

#

thanks

copper raven
#

it will output something to chat

#

see if the group is actually still there and the waypoints are what you expect

inner flicker
#

ok will do.

#

loading it up now

copper raven
#

im guessing the group no longer exists at the time of the execution of that field, thus copyWaypoints doesn't do anything

inner flicker
#

but its weird because they are there

#

or maybe it should be copyWaypoint

#

without the s

copper raven
#

no

inner flicker
#

oh

#

just trying to thinkOutside the box

#

ok i got a picture of it

#

but how do i show the whole error

#

it says there is an error

copper raven
#

wat error, there should be no error

#

im guessing you forgot a ; somewhere

inner flicker
#

yeah it says that

#

but where?

#

i have it at the end of my string

#

CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1));

#

where would i put the ;?

copper raven
#

that's not the entire code

#

there's no error in there

inner flicker
#

thats where i came across the string

copper raven
#

the code you sent does not have any missing semicolons

#

all i'm trying to say

#

it's elsewhere

#

check rpt

#

!rpt

wicked roostBOT
#
Arma RPT

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

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

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

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

inner flicker
#

Error in expression <ct 0)), waypoints group (_this select 1));>
19:40:43 Error position: <);>
19:40:43 Error Missing ;
19:40:43 Error in expression <ct 0)), waypoints group (_this select 1));>
19:40:43 Error position: <);>
19:40:43 Error Missing ;

copper raven
#

where's that code from?

inner flicker
#

the report

copper raven
#

ct 0)), you don't have any commas in your code

hallow mortar
#

This error is being generated by a different piece of code to the one you've shown us

inner flicker
#

hold on let me use the sqfbin

#

how do i upload the full log?

copper raven
#

hold on let me use the sqfbin

inner flicker
#

I have it copied to the clipboard

#

do i just paste it here?

copper raven
inner flicker
#

already pasted there

copper raven
#

then give us the link? meowsweats

inner flicker
#

ohh lol sorry

#

duh

copper raven
#
19:38:59 Error in expression <systemChat str [group (_this select 0)), waypoints group (_this select 1)>
19:38:59   Error position: <), waypoints group (_this select 1)>
19:38:59   Error Missing ]
19:38:59 Error in expression <systemChat str [group (_this select 0)), waypoints group (_this select 1)>
19:38:59   Error position: <), waypoints group (_this select 1)>
19:38:59   Error Missing ]
#

you missed a ] from the code i gave you

#

CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1)); systemChat str [group (_this select 1), waypoints group (_this select 1)];

#

put this in the expression field

inner flicker
#

ohhh ok

#

wait, why are there 2 select 1's in this string vs this select 0 and this select 1?

#

just curious

#

ok nothing popped up when it loaded in

copper raven
#

i don't know what you were trying to do

#

yeah, you need to destroy the vehicle

#

to make it respawn

inner flicker
#

ok

#

ok it said [<NULL-group>,[]]

copper raven
#

yeah so that's what i said

#

is there a way to not delete the vehicle?

#

check the module settings

inner flicker
#

not that i can see

#

would the Spawn AI options do the trick?

copper raven
#

well then use killed event handler

copper raven
#

"Wreck"

#

do you not have that option?

inner flicker
#

in the respawn module or the spawn ai options module?

copper raven
#

respawn

inner flicker
#

there is preserve, delete and delete with explosion

copper raven
#

okay so

#

make it preserve

inner flicker
#

ok

#

hey, i wanna say thank you for helping me

copper raven
#
params ["_new", "_old"];
createVehicleCrew _new copyWaypoints group _old;
deleteVehicleCrew _old;
deleteVehicle _old;
#

put this in expression field

#

and it should work

inner flicker
#

ok

copper raven
inner flicker
#

it works!!!

#

you're awesome bro

#

if i had nitro, i would gift you something.

#

thank you!

copper raven
#

np

inner flicker
#

that took a minute lol

copper raven
inner flicker
#

hey, its all about learning. oneScript at aTIme

#

again @copper raven thank you so much

sullen sigil
#

is there any way to increase the volume of trigger sound without having to resort to playSound3D meowsweats

copper raven
sullen sigil
#

sadness

#

time to figure out how to use while loops and sleeps properly

#
_thisTrigger = thisTrigger;
_thisTrigger spawn {
//blah
``` seems to be complaining thisTrigger is undefined and yet is in the activation field of it ![thonk](https://cdn.discordapp.com/emojis/700311400152825906.webp?size=128 "thonk")
open fractal
#

oh you did that im goofy

sullen sigil
#

putting it in through the spawn was complaining of a global variable in a local space

open fractal
#
thisTrigger spawn {
  _trigger = _this;
  //...
};

did you do it like this?

sullen sigil
#

i did thisTrigger spawn { and game complained that thisTrigger was a global variable

open fractal
#

can you send the full error

sullen sigil
#

oh its complaining when i pull params through

#

and yes one mo

copper raven
sullen sigil
#

wait i forgot the params bit in my example whoops one moment on that too

copper raven
#

oh its complaining when i pull params through
params ["thisTrigger"]? 😄

sullen sigil
#
thisTrigger spawn {
params["thisTrigger"];
//code go here```
copper raven
#

exactly 😄

sullen sigil
#

do i not need to do that

copper raven
#

you cannot put global identifiers in params

sullen sigil
#

but is thisTrigger not a local variable

copper raven
#

it is, but only engine can do such behavior

open fractal
#

or you can slap an underscore in front of your newly defined variable

#
thisTrigger spawn {
params["_thisTrigger"];
//code go here
#

also problem solved

sullen sigil
#

i realised that half a second before you said it

#

🤦

copper raven
#
for "a" from 0 to 5 do {
  a = 4; // assigns to global 'a'
  hint str a; // prints value of local 'a'
};
#

this is similar to thisTrigger

#

you'd think this would crash the game because a is never 5, but that's not the case

sullen sigil
#

perfect its working now thanks 🙂

copper raven
# copper raven this is similar to `thisTrigger`

you also cannot write into actual thisTrigger, because there is no way to do so (you can only assign to a local variable if it's _ prefixed), thisTrigger = 1337; systemChat str thisTrigger you will still get the trigger handle printing

sullen sigil
#

oh

#

thomk

#

thank you

#

me again

#

i presume BIS_fnc_replaceWithSimpleObject is not to be used to optimise large scale mp scenarios (where localonly is not useful)

winter rose
#

I believe the doc is self-explanatory

worthy igloo
#

if i do private _randomWeapon = selectRandom ["random_gun1","random_gun2"];
how can i make there also be specific ammo for each of the guns

south swan
#

you can private _randomWeaponWithAmmo = selectRandom [["random_gun1", "ammo1"], ["gun2", "ammo2"];. Or you can private _randomWeapon = selectRandom ["random_gun1","random_gun2"]; private _randomMagazine = selectRandom compatibleMagazines _randomWeapon;

pulsar bluff
#

any chance someone here knows the name of the display menu used for Arsenal loadout save/load?

south swan
#

"name"? I believe it uses its own template save/load menu. configFile >> "RscDisplayArsenal" >> "Controls" >> "Template" defined in ui_f,

pulsar bluff
#

hmm thats probably it

#

thank you

worthy igloo
# south swan you can `private _randomWeaponWithAmmo = selectRandom [["random_gun1", "ammo1"],...

if i do ```sqf
ranFnc = {
private _randomWeapon = selectRandom ["random1","random2","random3"];

private _Holder1 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_Holder1 addweaponcargo [_randomWeapon,1];

private _Holder2 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_Holder2 addweaponcargo [_randomWeapon,1];
};

winter rose
#

yeah

#

you make the random once, line 2

#
private _choices = ["random1", "random2", "random3"];

private _holder1 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_holder1 addweaponcargo [selectRandom _choices, 1]; 

private _holder2 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_holder2 addweaponcargo [selectRandom _choices, 1];
```@worthy igloo does this make more sense?
worthy igloo
#

i understand but i thought both ways would of worked

south swan
#

private _randomWeapon = selectRandom ["random1","random2","random3"]; = "select a random value out of 3 and store it as a private variable named _randomWeapon"
_Holder1 addweaponcargo [_randomWeapon,1]; = "add whatever is stored in _randomWeapon variable into _Holder1 inventory"

worthy igloo
south swan
#

compatibleMagazines _Holder1 weaponcargo doesn't make sense.

  1. weaponcargo goes in front of inventory, so weaponCargo _Holder1;
  2. it returns array, to get a weapon from it you select: (weaponCargo _Holder1) select 0;
  3. compatibleMagazines ((weaponCargo _Holder1) select 0) returns array of all compatible magazines for that weapon;
  4. selectRandom (compatibleMagazines ((weaponCargo _Holder1) select 0)) to select a random compatible magazine.
#

with the end result of _Holder1 addMagazineCargo [selectRandom (compatibleMagazines ((weaponCargo _Holder1) select 0)), ceil random 8]; (ceil added as i'm not sure what addMagazineCargo does with non-integer magazine counts)

#

also addMagazineCargoGlobal would be needed if the inventory state should be the same in multiplayer

#

addMagazineCargo seems to round halves to the nearest even number O_o. 0.5 becomes 0, 1.5 and 2.5 become 2, 3.5 and 4.5 become 4... notlikemeow

winter rose
#

lul - tell Dedmen and run away 😄

still forum
#

That sounds correct yes

granite sky
#

It's a legit rounding mode. Called round-to-even or bankers' rounding.

#

Avoids bias when you're accumulating a lot of halves.

sturdy ice
#

Hi I have a question about HCs.

HC1Present = if(isNil "HC1") then {False} else {True};
if (HC1Present && isMultiplayer) then {do stuff on HC1;
  };    
} 
else { do stuff on Sever;
  };
};

Im trying to just run this script on one of two HCs. But I cant figure out a method to detect if it is HC1 or HC2.

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
south swan
#

define "detect if it is HC1 or HC2", please.
"Get network ID of HC1/HC2 from the server to do remoteExec"?
"For the code running on some HC detect which specific HC it's running on"?
Something else?

sturdy ice
#

"For the code running on some HC detect which specific HC it's running on"?

#

this fits

#

I tried smth like this to get a bool but it didnt work

_HC1C = if("HC1" == vehicleVarName player) then {true} else {false};
winter rose
#

o_o
please don't

open fractal
#

returning a bool from an if statement is redundant

_bool = if <condition test> then {true} else {false};

is the same as

_bool = <condition test>;
sturdy ice
#

yeah now i see it lol

south swan
#

well, that code seems to be taken directly from guide :3

sturdy ice
#

yes its from the guide for hcs ^^

winter rose
#

o_o

south swan
#

"HC1" == vehicleVarName player should work (or be close) from what i see in the docs 🤔 Maybe !isNil "HC1" && {HC1 isEqualTo player}. I need to check when i get home

sturdy ice
south swan
sturdy ice
winter rose
#
private _isHC = not isNull (missionNamespace getVariable ["HC1", objNull]) && { player == HC1 };
```no?
sturdy ice
#

i mean this is from me bcs its stupid xD

_HC1C = if("HC1" == vehicleVarName player) then {true} else {false};
winter rose
south swan
#

linked at the relevant wiki page, though

winter rose
#

yeah well

south swan
#

my take is: why even bother actively running any code on HCs when server can run all the logic and remoteExec needed parts 🤷‍♂️

#

also, if i actually read the wiki correctly, HC object seems to be always present, but only returns isPlayer HC == true when actual HC is connected? Need testing. Too much fluff, conflicting information and code based on decisions/problems i know nothing about

sturdy ice
#

i did never tried remoteExec to be honest

#

the HC Object is a entity you can place

dreamy kestrel
#

Q: using CBA to respond to a class "init" event. That is receiving the target object correctly (CBA_fnc_addClassEventHandler).
I am trying to turn that around into a JIP callback. I am pretty sure the remoteExecCall invoke is happening, but for some reason is receiving an objNull for the object I relayed from the CBA callback. The CBA EH is receiving the object correctly, is not null.

private _global = 0;
[_unit] remoteExecCall ["kplib_fnc_captiveUI_addCaptiveActions", _global, _unit];

Intending to JIP invoke globally for as long as _unit remains alive and not null.
Oddly enough, the same sequence is happening just fine for my player object. I see those relayed from the CBA callback just fine, and is received just fine via the remote.

dreamy kestrel
#

Then there is the matter of I guess needing a CfgRemoteExec, which I have not got, so it is strange that the remote is happening at all.

worthy igloo
#

is there a way to stop a marker blinking

dreamy kestrel
outer ocean
#

createGuardedPoint [side, position, objectMapID, vehicle]

where objectMapID: Number - static id of map object.

Can someone please let me know how to find the objectMapID ? it requires as Number (not array).

south swan
#

-1 to ignore should work well if you provide coordinates already, though?

worthy igloo
#
private _randomLoc = selectRandom ["US_heliCrash_1","US_heliCrash_2","US_heliCrash_3","US_heliCrash_4","US_heliCrash_5"];
_UH60Wreck setPos (getPos _randomLoc);
``` any know why this wont wrk
dreamy kestrel
worthy igloo
south swan
# sturdy ice I tried smth like this to get a bool but it didnt work ```sqf _HC1C = if("HC1" =...

looks most of the above worked 🤷‍♂️
HC1 is always defined if it's present in mission, so isNil check is likely unneeded.
player == HC1 is true on a headless client running HC1 (so player == HC2 should be true on a headless that runs HC2).
"HC1" == vehicleVarName player is also true on a headless.
isPlayer HC1 is true when headless is connected and false when not. On all machines, server/client/headless alike.
local HC1 is true on server when headless isn't connected and is true on headless when it's connected. False everywhere else, obviously.
[[args],{code}] remoteExec ["call", HC1] does target a headless for remoteExec.

dreamy kestrel
# worthy igloo objects

you are randomly selecting one STRING not an object; could be a marker, but if an object, then you need to resolve that object from the namespace.

sturdy ice
#
_hc1present = not isNil "HC1";
if(_hc1present && HC1 == player)then{
    //do HC1stuff
}
else{
    if((isMultiplayer && isServer && !_hc1present) || !isMultiplayer){
        //backup
    }
}

got it to work this way ^^

south swan
#

i'd argue _hc1present = not isNil "HC1"; check is only needed if you intend to share your script between multiple missions and not all of them would have HC1 placed on map. Otherwise it'd be always true.

sturdy ice
#

yeah i intend to use it for multiple missions

#

but ill write down your thing with remoteExec, may be handy for some cases ^^

hallow mortar
dreamy kestrel
worthy igloo
#

how do i add sqf {hint "Players have arrived at crash site and the self destruct has been started.";} remoteExec ["bis_fnc_call", 0]; [] spawn { sleep 60; private _DestroyWreck = createvehicle [ 'ammo_Missile_Cruise_01',getpos _UH60Wreck,[], 0, 'can_Collide']; sleep 0.5; deleteMarker _marker; deleteVehicle _UH60Wreck; deleteVehicle _fireObj; deleteVehicle _Holder1; deleteVehicle _Holder1; deleteVehicle _Holder2; deleteVehicle _Holder3; deleteVehicle _Holder4; deleteVehicle _Holder5; deleteVehicle _Holder6; _UH60Wreck = objNull; }; into a setTriggerStatements I tried a bunch of things

south swan
#

_targetTrigger setTriggerStatements [toString {condition code}, toString {activation code}, toString {deactivation code}];

hallow mortar
#
{hint "Players have arrived at crash site and the self destruct has been started.";} remoteExec ["bis_fnc_call", 0];

Don't do this. Do this:

['Players have arrived at crash site and the self destruct has been started.'] remoteExec ['hint'];```
BIS_fnc_call is, as far as I can tell, almost completely pointless, and in any case there's no need to use any type of `call` layer since you can just remoteExec `hint` itself
#

Also, the targets parameter for remoteExec is 0 by default, so if you want to use 0 and you're not using the JIP parameter you can just skip it

#
  deleteVehicle _UH60Wreck;
  deleteVehicle _fireObj;
  deleteVehicle _Holder1;
  deleteVehicle _Holder1;
  deleteVehicle _Holder2; 
  deleteVehicle _Holder3; 
  deleteVehicle _Holder4; 
  deleteVehicle _Holder5; 
  deleteVehicle _Holder6;

You can save yourself a lot of space on this:

{ deleteVehicle _x } forEach [_UH60Wreck,_fireObj,_Holder1,...];```
dry cliff
#

Need some help with an intel script. Can't seem to find anything that works. Trying to have it when you pick up the intel, a pic pops up as well as description in the intel section when you pull up the map.

copper raven
winter rose
hallow mortar
mighty bronze
#

Hello, is there any way to make the flag of a vehicle stay if it respawn?

copper raven
#

flag?

mighty bronze
#

I am useing this forceFlagTexture "\rhsafrf\addons\rhs_main\data\Flag_rus_CO.paa";

copper raven
#

what are you using to make it respawn?

mighty bronze
#

The module Vehicle Respawn

copper raven
#

use its expression field

mighty bronze
#

I dont underestend

copper raven
#

in the module attributes, there is a field called "Expression"

#

it runs everytime a vehicle respawns

mighty bronze
#

What should I put there? this forceFlagTexture "\rhsafrf\addons\rhs_main\data\Flag_rus_CO.paa";?

copper raven
#

no, this is not defined there, _this select 0 should be correct iirc

mighty bronze
#

So, this: _this select 0 forceFlagTexture "\rhsafrf\addons\rhs_main\data\Flag_rus_CO.paa";

copper raven
#

yes

leaden ibex
#

Hello there, I am coming here with a question that has been bothering me for the last few hours.
Finally got my CBA_fnc_addKeybind working, when I am alive, but once I die and move into spectator, they stop working.
Any idea what might be causing it?
When re-spawned, they start to work again, but I need them to work while in EGSpectator too.

I tried calling the function that adds the keybinds after initialising EGSpectator, but that did not help unfortunately.

How I add the keybind:

["IMF","open_admin_menu", "Opens admin menu", {call IMF_fnc_openMenu}, "", [DIK_HOME, [false, false, false]]] call CBA_fnc_addKeybind;

The function it calls certainly works in spectator too, as when called from debug console, the admin menu opens.

mighty bronze
copper raven
copper raven
hallow mortar
leaden ibex
# copper raven theres probably a different display

That's what I thought too. That's why I went from direct display 46 to CBA keybinds, but it's possible they just don't work that way. So I might need to add oldschool :
"Raw" eventhandler on the EG display. Which I wanted to avoid with cba

copper raven
#

do something similar to what people are saying there

leaden ibex
copper raven
#

try the keyup event instead

leaden ibex
#

Ok, will do, but I am ending it for today. Will report tomorrow

mighty bronze
copper raven
#

60492 should be the correct idd

leaden ibex
#

Thanks for the info, will look at it tomorrow!

copper raven
#

["GetDisplay"] call BIS_fnc_EGSpectator

mighty bronze
#

hello, is there anyway to make the respawn, of for example, a tank, cosumes more tickets than a "human"?

open fractal
#

manually reduce the tickets with BIS_fnc_respawnTickets?

mighty bronze
#

Solvded, thank you

brazen lagoon
#

is there an easy waay to paradrop a vehicle?

copper raven
hallow mortar
pulsar bluff
#

would be nice if we could override that default behaviour now we have event handlers

tough abyss
#

how would we go about setting someone to the surrenderd state through ace? cant find the name of the fnc

#

basically want something like the achillies zeus module to be applied to a list of units

leaden ibex
long bloom
#

Has anyone found a way to create an outline of an object/unit?
Bit like how other games let you see friendlies through walls.

winter rose
#

nope.

long bloom
#

That's a shame.

#

If you had the time and patience I suppose you could set it up with 3D icons which are just lines at set offsets from hitpoints to create some outlines.

south swan
long bloom
astral bone
#

Hia!
Does 'sync to' work between 2 prop objects?

south swan
#

define "sync to", please. Documentation says

Syncing
Character & Object

A generic connection without any inherent functionality.

astral bone
#

Err- tge connect to thing... sorry I am away from pc atm 😅 the sync to option on one object, then go to another object and it makes a line between them
I assume that is also what is used with 'syncronizedObjects'

south swan
#

if you only expect syncronizedObjects to work, then probably yes. Let me actually check

#

although the same doc states "One of the connected entities has to be a character, otherwise the connection will not be recognized once the scenario starts." 🤔

astral bone
#

Where was that, sorry? I must have missed that

astral bone
#

Huh- so now, I got a problem. I want to have it so I have a prop that has an action added to it (addAction) and then its linked somehow to 1 other prop that it gets the location of and when the action is preformed, it teleported the caller to the location

#

One thing is I could have it just use the variable name- thing- again away from pc 😅

south swan
#

you can synchronize both of them to a Logic. But synchronizedObjects doesn't seem to work on "dumb" props (like air intake plugs) for me 🤔

#

lemme try one dumb thing

astral bone
#

I know if I have a chair and a unit itll work. But I dont wanna have a chair and a unit xD

#

(Was messing with sitting animation, sync the guy to the chair so he would be moved to the chairs position)

pulsar bluff
#

Is there a config for the model position on a vehicle that a projectile is spawned at?

#

trying to get the precise (roughly) position that the projectile of a weapon is spawned at

#

I can derive in SQF with brief use of Fired event handler

south swan
# astral bone One thing is I could have it just use the variable name- thing- again away from ...

so, you can place all your props, give them varnames, sync all of them to Logic and place this in Logic's Init: sqf _so = synchronizedObjects this; { _current = _x; { if (_x == _current) then {continue}; _current addAction [ format ["Teleport to %1", vehicleVarName _x], // name depending on variable name of a prop {player setVehiclePosition [_this#3#0, [], 3, "NONE"];}, // _this#3#0 takes the target from below [_x] // give a target to teleport code ]; diag_log str [_current, "to", _x]; } forEach _so; } forEach _so;

#

you get a bunch of actions on every prop to get teleported to every other prop :3

astral bone
#

Hmm... noted. Although I had an idea that is overco.plicated for no reason.

south swan
#

🤷‍♂️

astral bone
#

(The best kind of ideas xD especially in a lang you dont know well!)
I can make UI in a mission right? Like, custom window that has buttons?

south swan
#

yep

south swan
#

although that (GUI) takes the amount of needed code up by at least an order of magnitude

astral bone
#

Maybe have a collection, inside are some object that have the addaction on them, then the rest of the object have- someway of having variable that are visible. Maybe setVariable?
So you go to one of the interactive objects, do the action and it then read all the objects in the collection with the variable set and lists them.

astral bone
pulsar bluff
south swan
#

🤷‍♂️ with what i posted, place 2 (or more) Logics, sync them to different props and you effectively get 2 (or more) teleporter "networks". And one prop can be used in different "networks" and be a common hub, in effect :3

astral bone
#

What- so what is varname?

#

Oh am I being dumb. Is varname not the global unique id? XD

south swan
astral bone
#

Oh yea. But actually, the format-

#

Er- wait-

astral bone
#

(Btw, its an elevator x3) I would get 'floor_1_1' though or similar right?

#

If I want 2 elevators that went to the same floor

south swan
#

yes it wouldn't work if you want to have a bunch with similar endpoint names

astral bone
#

Yea, so then thatd mean having to go in and change them all basically.

#

Although- hmm- it is an idea though..

#

I do like the window idea. Especially because it might be easier to reuse, and- never really messed with GUI stuff yet so :P

tough abyss
#

making code ( still learning sqf) and got a enum error?

#

what does it mean?

#
you_puppy_player={ params [["_object", player]];
    private _dog = createAgent ["Fin_random_F", getPosATL _object, [], 0, "NONE"]; 
    _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
    selectPlayer _dog; 

    _dog addEventHandler ["onMouseButtonDown", 
    {
    params ["_displayOrControl", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
    _ppl = _dog nearentities ["man",1.5];
    _ppl setDamage 0.6;
    [_ppl, true] call ACE_captives_fnc_setSurrendered;
    }];
    private _show = "camera" camCreate [(getPos _dog) select 0, ((getPos _dog) select 1) + 0.3, ((getPos _dog) select 2) + 0.92];; 
    _show CamSetPos [(getPos _dog) select 0, ((getPos _dog) select 1) + 0.3, ((getPos _dog) select 2) + 0.92]; 
    _show attachTo [_dog];
    _show switchCamera "INTERNAL"; 
};
#

code for reference

#

error was at _dog #addEventHandler ["onMouseButtonDown", { params ["_displayOrControl", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];