#arma3_scripting

1 messages · Page 106 of 1

hallow mortar
#

SQFbin is maintained as a personal side project by one person IIRC. Sometimes they forget to update a cert or renew hosting or whatever and it's down for a bit. This time it's been down for a couple of days - no idea whether it's going to stay that way.

tough abyss
#

not just for me then ok thanks

#

is there a command like getmodelinfo that may work to get a objects subtype (pretty sure this is a subtype "\bush")

#

nvm named properties works

#

(if it is fixed this update)

stray flame
#

Hello, is it possible to turn my scripts from
onPlayerKilled.sqf onPlayerRespawn.sqf initPlayerLocal.sqf
Into a mod?

#

And are there any available resources on how to do this documented anywhere? I seem to run into dead ends

#

I have been working on a retexture mod for a while so I feel like I have a good understanding of the 101 when it comes to modding

hallow mortar
#

You probably want to look at Event Handlers / Mission Event Handlers, and preInit/init/postInit functions to add those event handlers

stray flame
#

So it is possible, and I should look at that?

hallow mortar
#

That is what I just said, yes

stray flame
#

Okay good

split scarab
#

Yep thank you that did the trick, I also had to disable simulation on the actual zeus player unit to avoid "free falling" sound effects when flying up high

mystic scarab
#

Hello, when creating a backpack, uniform or vest, is it possible to get the reference of the newly created container? I'm trying to create a container and then add items to it.

warm hedge
#

Creating as in/where?

mystic scarab
# warm hedge *Creating* as in/where?

I have a cargo container with persistent items saved with inidbi. Inside this cargo container, the players need to be able to place backpacks with items and these backpacks need to be recreated.

#

I'm a bit stumped at how to get a list of containers inside my container, a list of items contained in those containers and then remake them from inidbi entries

warm hedge
#

Good question. There should be a way but not straightforward

mystic scarab
#

I'm thinking I should make an array of arrays, like [[backpack1, [backpack1 contents], [backpack2, [backpack2 contents], ...] and then I can create the backpack, but how do I reference it to put stuff in it?

warm hedge
#

Nope, A3 lacks set/get the whole container of it

#

Which is in my wishlist

mystic scarab
# warm hedge Good question. There should be a way but not straightforward

I got the 3 separate functions for types of items (weapons, mags and generic) so I'd use those to add stuff, but to reference each container I'm thinking to try to use a helper array from everyContainer and then just delete the entry from it when I recreate one, but it seems very convoluted and was wondering if there's a simpler way.

warm hedge
#

I'm thinking if there is something that will return similar to getUnitLoadout

shrewd yew
#

@granite sky sorry for the ping. Pls can you check your Dm when you have the chance? i sent you a message

mystic scarab
# warm hedge I'm thinking if there is something that will return similar to getUnitLoadout

I noticed that everyContainer returned the containers in the order they were created, so I used that to save all the containers and then add them one by one when reloading the map. This allowed me to use everyContainer again to get the references in the same order as the ones that were saved. I then forEach into every new reference and dumped all the items I had stored in inidbi. Thanks!

#

Aaand it still doesn't work for backpacks, just vests and uniforms. Back to the drawing board, I guess.

warm hedge
#

Huh, doesn't it work? Let me test on my end as well

warm hedge
#

I think everyContainer can detect it

#

And addItemCargo also worked

warm hedge
#

Hmm since I'm suck at reading others' code, can you point which are backpack related things?

winter rose
mystic scarab
#

https://pastebin.com/raw/fPUiwu0a for the code. The problem seems to be that _container addItemCargoGlobal [_x, 1]; } forEach (_contObjects select 2); doesn't add backpacks, as they are succesfully stored with inidbi

warm hedge
#

Ah, so, this is the part that supposed to add backpacks into the cargo space?

mystic scarab
# warm hedge Ah, so, this is the part that supposed to add backpacks into the cargo space?

it's this part:

{
    OperationStorage addItemCargoGlobal [_x select 0, 1];
} forEach _containedContainers;

as it iterates through the array, it will just silently ignore any backpacks

I'm trying this atm, but it returns an error on non backpacks, even though it works:

{
    OperationStorage addItemCargoGlobal [_x select 0, 1];
    OperationStorage addBackpackCargoGlobal [_x select 0, 1];
} forEach _containedContainers;
warm hedge
mystic scarab
#

Is there a way to check the type of each element? I think they're just strings, though

warm hedge
#

getNumber (configFile >> "CfgVehicles" >> _x >> "isBackpack") == 1 not tested but something like that

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
mystic scarab
warm hedge
#

Config Viewer is always your goto, yeah

south swan
#

3 data types and a whole lot of conventions on top of older conventions

winter rose
#

getDammage

south swan
#

inb4 they introduce damaged weapons in the next update and call the needed selection gunDam

sullen sigil
#
gusts```
winter rose
#

dis ^ gust thing

agile cargo
#

Is it possible to script moving vehicle turrets using the keyboard?

#

the idea is to simulate more realistic turret controls

#

make it less OP

winter rose
agile cargo
#

Let's hope Killzone Kid sees this and deign to help us.

#

Or perhaps this:

#

An arrow indicating the vector and speed of the turret/gun movement, like on on GHPC

warm hedge
#

That would... yeah, I know what you mean, but it is nothing that an SQF can handle I'm afraid

agile cargo
#

I know, we would need an engine update Ded

drowsy geyser
#

is it possible to set a custom image on the spectrum device
this:

dreamy kestrel
dreamy kestrel
# winter rose nope what is your use-case?

trying to gauge whether a mobile respawn truck is 'eligible', subsquently show or hide a marker, etc, as such. AFAIK, predicated on these conditions.

private _objects = vehicles select {

    private _y = _x;

    alive _y
        && ((_y isKindOf Respawn_truck_typename) || { _y isKindOf huron_typename; })
        && {
            // Out of radius of ALL startbases
            { _y distance2D _x; _y distance2D _x <= _startbase_radius; } count _startbases == 0
        }
        && { private _mom = abs speed _x; _mom < _max_mom; }
        // TODO: TBD: wondering if this is the thing that is broken
        // Which if we have zero momenum then should be touching ground
        && { isTouchingGround _y; }
        && { private _posATL = getPosATL _x; surfaceIsWater _posATL; }
        ;
};

Symptoms are that markers are inconsistent, or appearing then disappearing.
I am reviewing that part, the thing that consumes the predicated objects, to see if it is something else than isTouchingGround.

winter rose
#

private mom, I see we had the same childhood

dreamy kestrel
#

heaven forbid you confused her with _min_mom.

ornate whale
#

Is it possible to synchronize transport heli module with playable AI units in SP? I tried synchronizeObjectsAdd, but it seems to not work?

hallow mortar
granite sky
#

getPosATL plz :P

#

oh wait, any surface...

#

honestly just block the thing if it's not on actual ground. Unless you really want to provide respawn capability while it's sitting on a bridge.

digital hollow
#

Check the animationPhase of the wheel suspension =p

winter rose
dreamy kestrel
#

ah velocity, yes, that is much better than speed, even abs speed i.e. momentum

#

then abs value those because I don't think we care velocity up or down, momentum in any direction

winter rose
hallow mortar
granite sky
#

vectorMagnitude velocity + surfaceIsWater maybe covers everything.

winter rose
# dreamy kestrel trying to gauge whether a mobile respawn truck is 'eligible', subsquently show o...
private _respawnVehicles = vehicles select {
    private _respawnVehicle = _x;
    canMove _respawnVehicle
        && ((_respawnVehicle isKindOf Respawn_truck_typename) || { _respawnVehicle isKindOf huron_typename })
        && { _startbases findIf { _respawnVehicle distance2D _x <= _startbase_radius } findIf == -1 } // if in radius of any of the startbases, disable truck
        && { vectorMagnitude velocity _x * 3.6 < _max_mom }
        && { isTouchingGround _respawnVehicle } // does not work well if not local
        && { not surfaceIsWater getPosASL _respawnVehicle };
};
winter rose
winter rose
dreamy kestrel
#

got something like this then, we'll see how that works. thanks!

private _objects = vehicles select {

    private _y = _x;

    private _posATL = getPosATL _y;

    alive _y
    // Of the appropriate classification
        && ((_y isKindOf Respawn_truck_typename) || { _y isKindOf huron_typename; })
        // Deployed away from ALL startbases
        && {
            { _y distance2D _x <= _startbase_radius; } count _startbases == 0
        }
        // With absolutely ZERO, i.e. negligible, momentum in ANY velocity vector
        && {
            private _vel_mom = velocity _y apply { abs _x; };
            { _x <= _max_mom; } count _vel_mom == 3;
        }
        // And of course we are non-amphib
        && { !surfaceIsWater _posATL; }
        ;
};
south swan
#

vectorMagnitude velocity _y < max_mom, please

dreamy kestrel
cobalt path
#

Question, is there a script to make vehicles more slingloadable? I am using a mod called "Simplex Tools and Extensions" which has a zeus modules that makes helicopter AI sling load a vehicle in front of them. However once they pick it up, they almost immediatly hit the ground.
I assume its because they are too heavy. I tried lowering their mass using setmass, but it doesnt seem, to get the job done

winter rose
dreamy kestrel
cobalt path
#

the module already allows ai to sling load everything, however than they crash because the object is too heavy

#

I wonder if I can change that

#

setmass didnt seem to change anything

winter rose
cobalt path
#

hmm, maybe it is ai

#

I will do testing, thanks

dreamy kestrel
winter rose
#

I think it says "true" if you hover over water surface in a chopper though, but hey

winter rose
sullen sigil
#

anything is a ship if you're brave

dreamy kestrel
# winter rose BoatX in Arma 3 I believe, but maybe some other class would be fine too

from couple of examples one RHS the Mk V SOC, or rhib or assault boat, vanilla. from the handy dandy config viewer.

["RHS_Ship","Ship_F","Ship","AllVehicles","All"];
//                   ^^^^^^
["Boat_Armed_01_minigun_base_F","Boat_Armed_01_base_F","Boat_F","Ship_F","Ship","AllVehicles","All"];
//                                                                       ^^^^^^
["Rubber_duck_base_F","Boat_F","Ship_F","Ship","AllVehicles","All"];
//                                      ^^^^^^
#

unless it is something truly pioneering, then it is probably non-naval, probably "Ship".

little raptor
winter rose
cobalt path
#

huh.....

#

wtf

#

I am using RHS assets maybe thats why

#

Let me see

dreamy kestrel
cobalt path
#

okey, I just picked up a Merkava with a little bird, weird

cobalt path
winter rose
ornate whale
#

Yes, I know, I have described it incorrectly. The problem is that only the player character (Leader) has the ability to request in SP.

cobalt path
#

Okay so default game helicopters respond to "mass" but modded helicopters (CH-53 from RHS and CUP) dont care what "mass" you set

arctic sluice
#

I'm trying to attach an item to players in Eden through init using the attachTo command. However because players have to spawn in, when the scenario is launched on a dedi server, the attached items just spawn in unattached to anything. Is there a way to make the script check if players have spawned in before it attaches to them?

sullen sigil
#

use isNull to check if player object exists

#

though its probably better to use onplayerrespawn event script or something similar

kindred zephyr
#

It is possible to access an argument for a function that is not index 0 when you only have a single argument in to pass?

For example:

TAG_fnc_myMagicFunction = 
{
_value0 = param [0, defaultValue, []];
_value2 = param [1, defaultValue, []];
_value3 = param [2, defaultValue, []];

//does something magical
};

[empty, empty, someValue] call TAG_fnc_myMagicFunction;

Let's say I don't have anything to pass as argument for the 1st and 2nd parameters because I want to use my default values inside the function but i do have a 3rd argument that i want to pass.

How does one does that?

Or do i forcefully need to pass the 1st and 2nd arguments in order for param(s) to be able to use that index that i want to pass?

sullen sigil
#

nil

kindred zephyr
#

ah perfect, thanks again kj

dreamy kestrel
kindred zephyr
sullen sigil
#

hashmaps are love hashmaps are life

dreamy kestrel
#

or at least leave it up to caller discretion, i.e. _opts = param [2, [], [[], createHashMap]]

kindred zephyr
#

personally for 3 values its not really worth to use a hashmap, i assumed that param worked only with defined values but when feeding it undefined/nil it uses the default value which works great in this case

dreamy kestrel
hallow mortar
#

Just curious, why 3 separate param instead of one params ?

kindred zephyr
#

i have a couple thousands items in a hashmap for STUFF haha, but yeah I understand the sentiment

kindred zephyr
#

also coding while braindead at 3 am is not good, let alone letting the code rot for a couple of months and then coming back

dreamy kestrel
sullen sigil
#

sounds like the past 7 months of my life

dreamy kestrel
#

good thing hashmap is wire friendly, can push it over the network 😉

kindred zephyr
#

can you? I always avoided doing so

dreamy kestrel
sullen sigil
#

yes you can but its not advised

#

usually its better to push the changes rather than the entire thing

#

however obviously youll need to sync

#

upon joining etc

kindred zephyr
#

I've been letting people update their data over the network by having them doing the calculations of bigger stuff instead, last time I tried sending one of the hashmaps with bigger data collections it got rather messy with desync

sullen sigil
#

how big is a bigger data collection

kindred zephyr
#

+1mil entries

#

no jk

sullen sigil
#

holy fuck

#

i dont even know 1mil words what on earth are you syncing

kindred zephyr
#

I was*

sullen sigil
#

oh

kindred zephyr
#

a cleaner system for a map with a lot of crap in it, but crap in the less despective way possible ofc

sullen sigil
#

i have server maintain hashmap and changes are published glibally

#

globally

#

then server event for postinit that requests the data from the server

#

data is sent via targetevent

#

thats a hashmap of arrays which also contain a hashmap

kindred zephyr
sullen sigil
#

why on earth would you network sync that

kindred zephyr
#

bad code, im not anymore

#

well, the visualization fo the "test" version of the script itself I guess, I was on a caffeine rush and then brain dead the next 5 minutes

sullen sigil
#

i want to invent a time machine just to go back and speak to you then to try and find out what was going through your head

sullen sigil
kindred zephyr
#

not a lot, I can assure you that

#

the one thing I can remember of that is how silly chernarus looks totally barren

cinder timber
#

anyone got code or method to make arsenal role specific

tough abyss
#

is there any way to detect if an object is a bush/tree?

twin oar
#

Hey guys, having an issue with this "BIS_fnc_EGSpectator" Trying to make it work for admins only with a key to let them switch in and out of the spectator if and when need be

#

Here's what I have

#
waitUntil {!isNull player};
if (isMultiplayer && {!d_pisadminp})
["Initialize", [player, [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator = DIK_END;
[] spawn {
      waitUntil {!isNull findDisplay 49};
      ["Terminate"] call BIS_fnc_EGSpectator;
};

digital hollow
warm hedge
#

Not sure rn but can namedProperties detect it?

digital hollow
#

Yes, that's much faster!

upbeat valve
#

I made a code to end a mission if all markers signifying towns have a diagonal brush applied, which would mean there's enemies in every town. Would this script work? The editor didnt give me an error when I ok'd the trigger but of course sometimes the code doesnt work regardless.


if ({markerBrush _x == "FDIAGONAL"} forEach _markerArray) then {"EndFail" call BIS_fnc_endMissionServer};```
hallow mortar
#

forEach doesn't work like that. It does the thing for each element; it does not return a combined result of all the things it did. It only returns the value of the last thing it did - in this case, that would be whether sallaMarker meets the condition or not.

upbeat valve
#

Oh ok

#

So what would combine?

hallow mortar
#
(_markerArray findIf {markerBrush _x == "FDIAGONAL"}) > -1

You don't need an if statement if you're using a trigger. The Condition field is the if and the Activation field is the then.

#

Well, unless you're activating the trigger based on some other condition and then deciding what ending to activate based on this. Then you do need an if statement.

dry cradle
#

Does anyone know how to disable the carrying/dragging function of chairs while still keeping the sit commands?

patent goblet
dry cradle
patent goblet
fair drum
hallow mortar
drowsy geyser
#

I'm trying to control a drone (C_IDAP_UAV_06_antimine_F) with the doMove command but it just doesn't respond and keeps flying higher, even commands like flyInHeight (forced) are ignored as long as the altitude is set above 5 meters

_targetPos = [player, 1, 10, 10, 0, 5, 0] call BIS_fnc_findSafePos;
driver _uav doMove (_targetPos);
    
waitUntil {_uav distance2D _targetPos > 0 && _uav distance2D _targetPos < 15};  
_uav flyInHeight [0, true]; 
    
waitUntil {isTouchingGround _uav};  
driver _uav action ["engineOff", vehicle _uav];
#

_targetPos = [player, 1, 10, 10, 0, 5, 0] call BIS_fnc_findSafePos;
driver _uav doMove (_targetPos);
This line above is ignored, it continues to fly higher regardless of flyInHeight (forced to true)

#

basically I try to have the drone fly back to the player position once it is not remote controlled anymore

winter rose
#

waitUntil {_uav distance2D _targetPos > 0 && _uav distance2D _targetPos < 15};
distance cannot be negative

#

_uav move getPosATL player?

drowsy geyser
#

this would be correct right?
waitUntil {_uav distance2D _targetPos < 15};

drowsy geyser
winter rose
winter rose
digital hollow
drowsy geyser
drowsy geyser
grizzled cliff
#

lol so this is perfectly valid code in carma

test_func(123)[2](444);
sullen sigil
#

i wonder if flyinheight alt syntax lets you do negative values

grizzled cliff
#

calls test_func with the arg 123, then gets the second index in the returned array, and calls that with the arg 444

#

totally random anonymous function returns

wooden dove
#

Is there something I'm doing wrong? I got this from the wiki and changed it abit so that it would give MRE's instead, but even with empty uniform, vest and backpack it just says "no space."

wooden dove
#

through an addaction

proven charm
wooden dove
# proven charm show that code pls

the first one is in a script and this one is in initPlayerLocal. I don't think this is the problem though, since I can see the action ingame

#

But when I use the action it just says not enough space in inventory

proven charm
#

humm , those ACE items valid/loaded?

wooden dove
proven charm
#

ok

wooden dove
#

Can use them also, but not sure if addItem works for them

proven charm
#

problem seems to be canAdd, not sure why

wooden dove
#

can I remove it?

proven charm
#

not really

wooden dove
#

or use it with something else?

#

not sure how else to check if the player has enough inventory space

proven charm
#

add some logging to the code: ```sqf
systemchat format [">> %1 %2", _player, _item]; // Before canAdd

wooden dove
#

sry ive never used that before...I'll add it before canAdd and test it? what should I look for?

#

like systemchats?

proven charm
#

actually use systemchat instead

wooden dove
#

ohh

proven charm
#

edited ^^^^

#

oh typo in my code, edited again, sry

wind flax
#

Not really sure how to ask this - is it possible to "replace" (stream?) an rsc to a texture selection?

digital hollow
#

Spectator

wind flax
#

I guess a better way to word it would be, is it possible to put a display inside of a texture selection?

wooden dove
#

@proven charm

#

should be working then right?

#

i dont understand T_T

#

oh actually idk what bis_o2_4722 is

#

thats not player... 😮

proven charm
#

is that code running in server? idk player should be null in server

wooden dove
#

oh wait actually, im testing it in local MP

#

should I test it in server?

#

havent uploaded the mission file to server yet

proven charm
#

Idk how Ace works but I think it should work in client

hallow mortar
#

At some point yes you should, but not for this reason

proven charm
#

maybe the uniform just cant hold items?

wooden dove
#

also the MRE's from arsenal fit too

proven charm
#

o right

wooden dove
#

originally i had them in arsenal but I wanted to limit the food so I made an addaction on a box to buy food.

#

not sure how else I can do this

#

im also kinda new to scripting and coding in general haha this is kinda my first mission

south swan
#

i mean

#

"ACE_MRE_MeatballsPasta_Item" is a CfgVehicles class. WeaponHolder with the food inside. "ACE_MRE_MeatballsPasta" is CfgMagazines CfgWeapons one 🤷‍♂️

wooden dove
#

this makes sense

#

thank you!

wooden dove
#

do i need to assignItem too?

south swan
#

on my machine addItem adds MRE to inventory and assignItem removes it 🤷‍♂️

wooden dove
#

thank you!

#

so wierd

#

works now!

granite sky
#

It makes sense, right. assignItem removes the item from uniform/vest/backpack and puts it in the slot. Except the food doesn't have a slot so it just does the first part.

split oxide
#

If you createVehicleLocal an ammo that produce submunitions, are the create submunitions also local?
bad question, type ammo is always propagated

foggy stratus
#

I'm weak in config lookups. If I have the class name of a map object using typeOf, how can I get the clean English Description from the config? Similarly, some objects on map are terrain objects, so typeOf returns an empty string. For these I can use getModelInfo to get a p3d filename and path. Can I use that to look up a clean English description in the config?

hallow mortar
# foggy stratus I'm weak in config lookups. If I have the class name of a map object using type...

When you have a classname, https://community.bistudio.com/wiki/getText with whatever the config property for the description is named.
Note that this will return the localised text, based on the current machine's selected language (unless the item in question doesn't use the localisation system). You can getTextRaw to get the localisation key, but there's no way to pick a language to localise to in scripting, so...

thorny radish
#

Does the compatibleMagazines function work with modded weapons? Im trying to add a quick random weapon script but cant quite figure out how to add magazines to the unit if I dont know what weapon they will get. I have it using this function right now but its not doing anything

foggy stratus
#

getText (configFile >> "CfgVehicles" >> "Land_vn_house_small_02_f" >> "displayName")

#

which returns "Brick bungalow", which is perfect.

hallow mortar
foggy stratus
#

For a terrain object that typeOf returns an empty string, I was still able to get what I want by first using getModelInfo, and parsing out file name from first element in array, which for railroad track is "vn_rail_tracke_r30_20_f.p3d". I strip off the .p3d, and prefix string with "Land_" then do getText....

#

getText (configFile >> "CfgVehicles" >> "Land_vn_rail_tracke_r30_20_f" >> "displayName")

#

Which returns "Rail Track (30m, Elevated, 20 deg, Right)", so I guess I can get the display name for both types of objectgs.

hallow mortar
foggy stratus
winter rose
#

you can always check if the config exists, and if not just use P3D name

foggy stratus
foggy stratus
#

My use case is to select AI on squad, look at object, and give order to "Move to <obj display name>", where units align themselves close to near side of building wall, or fence, or big log, etc.

thorny radish
# hallow mortar Yes, compatibleMagazines works with modded weapons. All you need to do is resolv...

So why would this not be working?

_possibleWeapons = ["rhs_weap_ak74", "rhs_weap_akm", "rhs_weap_akms", "rhs_weap_m14", "CUP_smg_Mac10", "CUP_smg_MP7", "rhsusf_weap_glock17g4"];

_choosenWeapon = selectRandom _possibleWeapons;
_choosenMagazine = (compatibleMagazines [_choosenWeapon, "this"]) select 0;

this addMagazine [_choosenMagazine, 5];
this addWeapon _choosenWeapon;
this addUniform _choosenUniform;
this addGoggles _choosenFacewear;

Ive cut out the extra stuff like removing loadouts the uniforms and what not. Everything is working as expected but the units never have ammo

hallow mortar
#

You're using addMagazine when you should be using addMagazines. You're currently giving them a single magazine with a maximum of 5 bullets in it.

thorny radish
#

Yeah I noticed that too, but either way even if I use addMagazines, they still have 0 ammo, no mags at all

hallow mortar
#

Also, the use of this suggest to me that you're doing this in a unit's init field. If you're doing that, you should add a check to only do this on the server, to avoid duplication. i.e. if isServer then { ...

hallow mortar
#

It's spelled "chosen" btw >:|

thorny radish
hallow mortar
#

✨ Find & Replace ✨

thorny radish
#

Still no ammo :/

removeAllWeapons this; 
removeAllItems this; 
removeAllAssignedItems this; 
removeUniform this;  
removeBackpack this; 
removeHeadgear this; 
removeGoggles this;

_possibleWeapons = ["rhs_weap_ak74", "rhs_weap_akm", "rhs_weap_akms", "rhs_weap_m14", "CUP_smg_Mac10", "CUP_smg_MP7", "rhsusf_weap_glock17g4"];

_possibleUniforms = ["U_I_L_Uniform_01_tshirt_skull_F", "U_C_E_LooterJacket_01_F"];

_possibleFacewear = ["G_Bandanna_CandySkull", "G_Bandanna_BlueFlame2"];

_choosenWeapon = selectRandom _possibleWeapons;
_choosenUniform = selectRandom _possibleUniforms;
_choosenFacewear = selectRandom _possibleFacewear;
_choosenMagazine = (compatibleMagazines [_choosenWeapon, _choosenWeapon]) select 0;

this addMagazines [_choosenMagazine, 5];
this addWeapon _choosenWeapon;
this addUniform _choosenUniform;
this addGoggles _choosenFacewear;

This is the entire code block. Unsure if something in here is causing an issue with out me realizing. I apologize for the noob questions but Im just starting out and figured this would be an easy way to get into it quickly

hallow mortar
#

Add a systemChat _choosenMagazine to see what it actually contains

#

Oh well I know what it is actually

#

You're adding the magazines before the uniform. Can't carry mags with no pockets

thorny radish
#

Sigh

#

Thats indeed what it was

#

Its always the extraneous things that get me it seems. I appreciate your help man

#

Just for your help, Ill go fix those variables to say chosen

open flume
#

Would anyone be willing to help me with an issue with my mission file, im doing a CTF and have everything working except the scoring mechanic. while i can drop off and deliver the things it only goes to one team
||its using a template of a single flag RvBvG CTF but it mostly working fine.||

#

Would post the stuff but its a mission file and fairly long so idk where i'd do it XD

ebon wing
#

Anyone know why this addAction wont show for everyone?

[LOC3_Unlocker,["Unlock",{

        if ("Keys" in magazines player) then{
            player removeItem "Keys";
            hint"Crate Unlocking";
            LOC_tracker = 1;
            execVM "Warzone\Warzone Locations\locReinforce.sqf";
            _timeLeft = GLOBAL_LootCrate_Unlock_Time;
            while{_timeLeft >=0} do{
                //Unsure if it shows to all players or not
                hint format[ "Unlocking in: %1s",_timeLeft];
                sleep 1;
                _timeLeft=_timeLeft-1;
                
                
            };
            
            
            hint"Crate Unlocked!";
            LOC1_loot lockInventory false;
        }else{
            hint"Missing Key";
        }




},[],6,false,true,"","_this distance _target < 3"]] remoteExec ["addAction",0];

manic kettle
#

Syntax looks correct at a glance...Guessing at a few things..
-Try "(_this distance _target) < 3"
-Remove the comments from the code ( //Unsure if it shows to all players or not). In some instances commenting an addaction gives me errors. Usually in init fields

  • Try just an empty code field {} and see if you see the action at all?

I usually just make an inline function myself, easier to handle...
_myFunction = {my code here};
[params] remoteExec ["call",0];

tulip ridge
#

In some instances commenting an addaction gives me errors. Usually in init fields
That would be because you can't have comments in object inits

manic kettle
#

Yeah that checks out

tulip ridge
manic kettle
#

Oh it could be the object is one of those that has a strange location for its center. Without knowing what object you're using its hard to say. Remove or increase the range and see if it works.

ebon wing
#

One thing I noticed though, the hint didint show to a player when they did trigger the addAction somehow, but I actually saw the hint

#

Should I be starting the script using the serverInit, or some other way?

#

Because I used playerlocalInit or whatever its called

manic kettle
#

If you run it in the server init it only runs on the server...So you need a remoteExec to run on players.
If you run it in init.sqf or the player init it will work without a remoteExec, because its already running on everything.
You could also use the object init in the editor and it functions the same as init.sqf

#

best practice imo...If this isnt part of some bigger mod...Just run it in the init of the object. Just remember no comments are allowed there.

ebon wing
tulip ridge
#

addAction is local, meaning if it's only run on the one machine, the action will only exist on that machine

#

If you remoteExec'd it on every client, then you'd have duplication errors

ebon wing
#

So, I either do remoteExec, or I run the script in the init.sqf? But even with remoteExec its still local

tulip ridge
#

You can:

  1. Run the _object addAction [...] code in the object's init
  2. Run the code in an init.sqf file
#

If you do either of those, you don't need to remoteExec adding the action, because those both run of every client

tulip ridge
ebon wing
#

So, The addAction is located in File X, File Y gets executed locally, and then it executed File X where the addAction is with the remoteExec, will it be ran globally, or because I started with a local call, no matter what its all local?

tulip ridge
#

File y will be executed locally
Anything in file x that is not remoteExec'd, will be executed locally

ebon wing
#

But then, if I execute File Y using serverInit, its all server side, so would using remoteExec actually work

ebon wing
#

I read that the number at the end of "addAction", plays a role in that

tulip ridge
#

The number is the target for the remoteExec, 0 means global (server and all players), 2 means just the server, etc.

ebon wing
#

So, does 1 mean all players?

granite sky
#

I have never seen a reference of what 1 means, if anything.

#

-2 means all machines except the server.

ebon wing
#

So, best I put it on -2 to avoid dups right?

granite sky
#

No, you should use 0 so that it works on localhosts.

ebon wing
#

I see

#

So, any clue though why it didint work, Im really baffled why its being so weird

#

I was hosting the server, I loaded in the script using a localPlayerInit thingy, but only he could see the addAction, I couldnt

tulip ridge
#

Try putting the addAction in just a init.sqf, and don't remoteExec it

granite sky
#

Likely the script ran before the client machine was connected. In those cases you'd need to use JIP, but just adding the action in client init is preferable if you can do so.

ebon wing
tulip ridge
#

Add true after the 0 in the remoteExec, ... remoteExec ["addAction", 0, true];

ebon wing
#

So, If Id like all my addActions spread across multiple files to work for players that just connected, what would I need

tulip ridge
#

Although actually you wouldn't need that if you did it on the initPlayerLocal

ebon wing
#

I added the true as well

ebon wing
tulip ridge
#

Try just putting this in the initPlayerLocal.sqf, and removing it from the server init

LOC3_Unlocker addAction
[
    "Unlock",
    { 
        if ("Keys" in magazines player) then
        { 
            player removeItem "Keys"; 
            hint "Crate Unlocking"; 
            LOC_tracker = 1; 
            execVM "Warzone\Warzone Locations\locReinforce.sqf"; 
            _timeLeft = GLOBAL_LootCrate_Unlock_Time; 
            while {_timeLeft >= 0} do
            {  
                hint format ["Unlocking in: %1s", _timeLeft]; 
                sleep 1; 
                _timeLeft = _timeLeft - 1; 
            }; 
                
            hint "Crate Unlocked!"; 
            LOC1_loot lockInventory false; 
        }
        else
        { 
            hint "Missing Key"; 
        } 
    },
    [], 6, false, true, "", "_this distance _target < 3"
];
ebon wing
#

Will do

tulip ridge
#

Can you send the file?

ebon wing
#

Sure

#

Wont let me send it in your dms

#

Thats the entire file


LOC3_Unlocker addAction
[
    "Unlock",
    { 
        if ("Keys" in magazines player) then
        { 
            player removeItem "Keys"; 
            hint "Crate Unlocking"; 
            LOC_tracker = 1; 
            execVM "Warzone\Warzone Locations\locReinforce.sqf"; 
            _timeLeft = GLOBAL_LootCrate_Unlock_Time; 
            while {_timeLeft >= 0} do
            {  
                hint format ["Unlocking in: %1s", _timeLeft]; 
                sleep 1; 
                _timeLeft = _timeLeft - 1; 
            }; 
                
            hint "Crate Unlocked!"; 
            LOC1_loot lockInventory false; 
        }
        else
        { 
            hint "Missing Key"; 
        } 
    },
    [], 6, false, true, "", "_this distance _target < 3"
];

player addAction ["Load", {execVM "Warzone\WarzoneStart.sqf";}];
player addAction ["God", {player allowDamage false; hint"god";}];

player addAction ["Loc3 Reinf", {LOC_tracker = 3;execVM "Warzone\Warzone Locations\locReinforce.sqf";}];
#

Thing is though, LOC3_Unlocker even though is global, isnt initialized yet

#

nvm tested it, no difference

arctic sluice
oblique lagoon
#

Is it safe to locally execute EG functions for every player in MP?
For eg. I want to check condition and do enableStamina for every player every frame.

#

So I put condition check and enableStamina in stackable event handler which fires every frame for every player.(in initplayerlocal.sqf)

#

It seems the function enablestamina runs 10k times in 300us in SP which means its quite simple function, but it sounds dangerous to run Effect Global function that much.

hallow mortar
#

I don't think it would cause serious issues in this particular case, but at the same time, you probably don't need per-frame precision for enableStamina state. You can make a loop that runs much less frequently.

tender fossil
#

Heya, I "fixed" a small annoyance in otherwise great SkaceKachna's SQFLint extension for Visual Studio Code (https://marketplace.visualstudio.com/items?itemName=skacekachna.sqflint): it complained about pretty much every global variable being "possibly undefined" which spams the "Problems" section and underlines every global variable. It started to get annoying so I disabled it by editing the source code.

My question is: would people here want to use the fixed version if I published it with a setting to disable/enable global variable flagging?

The original project has MIT license so it's possible to "republish" the extension (the original creator will be credited accordingly naturally).

oblique lagoon
fair drum
fleet sand
#

Hi guys question. How is this executing:

addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if!(_unit isKindOf "CAManBase") exitWith {};
    private _side = side _unit;
    if(_side isEqualTo civilian) then {
        ["systemChat",[format ["Player: %1 has killed a civilian named %2",name _killer, name _unit]]] remoteExecCall ["CAU_xChat_fnc_sendMessage"];
    };
}];

So when player kills anybody not just civilian i got the message player killed civilian. How is this possible ?

south swan
fleet sand
queen cargo
fair drum
queen cargo
#

Use sqf-vm language server then

The issue is not macro use but rather macros not being parsed properly

#

Tho I thought sqflint did some macro parsing for some time by now 🤔

tough abyss
#

Hi everyone, wonderful day to all. I have a question if anybody can help me

#

How do I get the target health? I have the following code on the hud: __ctrltarget ctrlSetText format["%1", cursorObject]; __ctrltargethealth ctrlSetText "";

winter rose
#

health is not exactly a 0..100% value in Arma

#

the basic info is damage cursorObject

tough abyss
#

Thank you, I did this:

#
__ctrltargethealth ctrlSetText format ["%1 %2 Health", round _targetHealth, "%"];;```
winter rose
#

why the double underscore and double semicolon though

private _targetHealth = (1 - (damage cursorObject)) * 100 toFixed 2;
__ctrlTargetHealth ctrlSetText format ["%1 %2 Health", _targetHealth, "%"];
tough abyss
#

I thought _ meant private

winter rose
#

it means local

tough abyss
#

Oh

winter rose
tough abyss
#

Thank you. So basically, the guy who coded the mod shouldnt have used __ but instead _

winter rose
#

yes, double underscore means nothing special

#

perhaps it means "super private" who knows

tough abyss
#

😮 Can I ask a stupid question?

#

What language is SQF based on? C++ ?

winter rose
#

not a stupid question 😉

#

the engine behind it is in C++
the language itself was not based on anything, just created "like that"

tough abyss
#

oh ok

#

Because im a java/python/typescript coder and some things are not so clear to me

#

for example, I want to parse this to string and remove the '.p3d' from the string if it exists: __ctrltarget ctrlSetText format["%1", cursorObject];

#

So I did this:

#
_targetinfo = _targetinfo.????
winter rose
#

select

candid sun
#

non zero based index?

tough abyss
#

Thanks, I think this should work: ```_targetinfo = str(cursorObject);

        if(_targetinfo find '.p3d' != -1) then {
            _targetinfo = _targetinfo splitString ".p3d" select 0;
        }```
winter rose
#

I raise you myp3dfile.p3d_lolIgotcha.p3d 😛

tough abyss
#

hmm

winter rose
#

(just kidding, the "chance" of this happening is 0 :D)

candid sun
#

can anyone show me a good example of try/throw/catch in sqf?

tough abyss
#

You have a point tho lol

little raptor
tough abyss
#

@little raptor way more cleaner. So what exactly happens with the brackets []

little raptor
#

creates an array 😓

#

the array is used as rhs arguments

winter rose
little raptor
cosmic lichen
#

Nothing

trail rose
#

It's mostly useless

cosmic lichen
#

Why would it select everything

little raptor
#

well you could still keep the if then 😓

cosmic lichen
#

[0, 10e9] does everything

little raptor
#

just [0] 😛

cosmic lichen
#

Just "String"

tough abyss
#

Thank you so much for the input guys. I will try this and see how it goes

little raptor
trail rose
#

try { throw "hello world" } catch { systemChat _exception }

#

I think it is

little raptor
#

also SQF doesn't use the traditional parentheses-called functions myFunction(args...). it's args call myFunction

tough abyss
#

oh

#

Thanks, makes more sense now

winter rose
tough abyss
candid sun
#

it's not widely used then?

trail rose
#

Almost never from what I have seen.

candid sun
#

excellent, i can worry about learning more important things then

grizzled cliff
#

its fucking pointless since it doesnt capture most errors

south swan
#

with call being just a binary operator. That takes argument(s) as LHS and function as RHS

grizzled cliff
#

so you ALWAYS have to throw

trail rose
#

It only captures throws.

grizzled cliff
#

yah

winter rose
trail rose
#

If it would capture regular script errors it would be perfect.

grizzled cliff
#

yea, anything besides syntax errors and id be happy

trail rose
#

Or if params would throw an exception.

#

The last time I saw it being used, was in the ace project in a function because someone felt like trying it out. We should probably get rid of that, come to think of it.

fair drum
tough abyss
#

I dont drink xd hehe

grizzled cliff
#

yea

#

i think i used it in a few places to handle input errors in some code in ACRE but i ditched it because of speed

trail rose
#

I started CSE with it. It got binned quite fast.

proven charm
#

I bet there is no way to remove grass from some areas, via script?

winter rose
proven charm
kindred zephyr
winter rose
proven charm
#

ok thx

candid sun
#

so i'm better off just getting used to using params function?

#

i'm upgrading an old arma 2 mission i did with the useful new a3 commands like pushback, etc

#

wondering what other functions i need to look in to

queen cargo
#

@tough abyss in SQF, there is no dot accessor or actual function calls
In SQF, everything is either an operator or a value/variable
In essence, [1, 2, 3] select 1 will 1. create an array and then via the "math" operation select, transform the array into a 2

#

aka: [1, 2, 3] select 1 is not very different from 1 + 2 in SQF

#

in fact, they are the similar, just doing different operations (just as + would not do the same thing as - but work the same syntactically)

south swan
#

code golf question: is there more proper/elegant way of getting all of vehicle's weapons than this? sqf flatten ((allTurrets _veh + [[-1]]) apply {_veh weaponsTurret _x})

thorn saffron
#

Not sure if this the right channel for this.
Is there a way to disable the film grain effect during the rain? It is giving me a headache.

grizzled cliff
#

yawns

sullen sigil
#

ive never seen a film grain effect in the rain

grizzled cliff
#

its nice when you get to a point in the code where you are like "ah i should add that" and its basically copy/pasting a couple things and changing around a couple checks

#

course then you go "wow all that copying and pasting, how can i make it more reusable"

#

and then you end up breaking everything :D

fair drum
#

And heavy downpour

little raptor
#

you mean those flashing rain drops?! yeah they're a bit annoying 😅

wind flax
#

Anyone know of any pre-existing functions to get the player directly in front of you? Like within 1 meter, directly in front of you?

thorn saffron
winter rose
fair drum
tough abyss
#

How do I know if a cursorObject is an entity and not, for example, a tree?

#

My code is showing damage of trees xd

#

if (cursorObject isKindOf "Man") then {

#

I actually need the inverse, when its not vehicles, men, women, buildings

#

Is there any neat trick I dont know of? Before I start spamming if's

hallow mortar
#

You can use ! to make not checks, and or [ or and ] to combine multiple conditions

#

For example:

if !((cursorObject isKindOf "CAManBase") or (cursorObject isKindOf "Building_F")) then { // "Building_F" may not be correct

if (!(cursorObject isKindOf "CAManBase") && {!(cursorObject isKindOf "Building_F")}) then { // ...```
#

It would be kind of (hur hur) nice to have an isAnyKindOf where you could feed it an array of classes to check, but we don't

winter rose
#

findIf works

tough abyss
#

I did this: if ((cursorObject isKindOf "Man" || cursorObject isKindOf "AllVehicles") && !(cursorObject isKindOf "Static") && !(cursorObject isKindOf "Thing")) then {

#

Seems to be working

winter rose
#

use "CAManBase" instead of "Man"

tough abyss
#

Hm ok, but , Why tho

#

its lower in the hierarchy

queen cargo
winter rose
#

Do you want to get rabbit health?

tough abyss
#

maybe hehe

kindred zephyr
#

can the color of an image/picture be changed in a dialog via code?

I dont mean changing the image from A to B, but changing A from white to black

warm hedge
#

ctrlSetTextColor

kindred zephyr
# warm hedge ctrlSetTextColor

is there any engine condition for the image to be able to change color?

like specific base color or being transparent?

warm hedge
#

Not sure what's the question. Are you talking about a very specific UI?

ebon wing
#

Hey, how would I make this sqf KEY_Spawn_Positions select _i apply {_x lockInventory false};

execute globally and work for players that join before the code is ran

wet lion
#

How can i check if specific facewear item is equipped on player or not?
I would like to write a script for high altitude parachute jumping and want to force my players to wear SOLR mask above 3000 m...

warm hedge
ebon wing
#

How can I remoteExecCall this line?

warm hedge
#

I've no clue why you can't have initPlayerLocal.sqf but you can check pinned Leo's explanation to convert a script into remoteExec

ebon wing
ebon wing
kindred zephyr
warm hedge
#

So, you mean you tried that and somehow it doesn't do anything?

kindred zephyr
#

yes

warm hedge
#

What color is that paa?

kindred zephyr
#

black

warm hedge
#

Then that's why

#

White is the only color you can adjust freely

kindred zephyr
#

does it need to be transparent or be a certain color to be able to change it using crtlSetTextColor?

yeah, assumed such was the case 🤪 Thanks Polpox

warm hedge
#

You can actually see some of official UI elements PAAs are simply white

tough abyss
#

Im sorry bothering you guys again, but how do I get if cursorObject is an enemy or friendly?

hallow mortar
tough abyss
#

private _isEnemy = [cursorObject, player] call BIS_fnc_sideIsEnemy; Like this? or Do I need to get something from cursorObject ?

warm hedge
#

side cursorObject and side player

#

And note that [A,B] call BIS_fnc_sideEnemyand [B,A] call BIS_fnc_sideEnemy are not always equal

ebon wing
#

Hey, so after reading through the pin, I tried doing this but it gives me an error




KEY_Spawn_Positions select _i apply {[_x, "false"] remoteExec ["lockInventory", _x]};```
warm hedge
#

You did not understand what Leo said

#

Read it once again and carefully

ebon wing
#

Well, he didint say much, he mainly posted examples

#

There arent explanations how to apply it to each element of an array

warm hedge
#

There is

ebon wing
#

Can you show me?

warm hedge
#

If you red the pinned post that's it

ebon wing
#

I have indeed read the pinned post

warm hedge
#

The first three codes are the most important explanation

ebon wing
#

I did exactly that

warm hedge
#

Oh wait since I'm on the phone I had hard time to detect the error

#

"false" this is simply invalid. I don't know why you've made it into a string

ebon wing
#

Since in the example he set it to quotes as well, I though it reads the string and executed whatever is in it

warm hedge
#

He never said so

ebon wing
#

He never said many things, so I went off his example which is literally this sqf [_target, "UNLOCKED"] remoteExec ["setVehicleLock", _target];

#

"UNLOCKED"

warm hedge
#

Because there is nothing else to explain

ebon wing
#

Well clearly there is, but anyways it worked

#

Thanks 👍

warm hedge
#

"Clearly there is" then suggest

ebon wing
#

The "UNLOCKED" argument after _target does not necessarily need to be a string but it depends on the condition your command expects

#

Since in my case it expects a boolean, you use true or false, as the string does not get executed

warm hedge
#

Well not even sure that is a valid "confusion"

ebon wing
#

cool

warm hedge
#

He even said "Just copy paste"

#

Not "Convert it into a string"

ebon wing
#

Bro, what in the world are you on about, I literally copy and pasted the code. Is this some sort of language barrier were having? Want me to pull out google translate and say it in Japanese?

warm hedge
#

No need to

ebon wing
#

Okay good, so stop laying it on a new SQF user, you ask me to suggest and then you spout the biggest bs "not valid confuion" the fuck?

#

Who tf are you to decide my confusion isnt valid?? Like what does that even mean

warm hedge
#

Because you did read something that is not written

ebon wing
#

For the record here, the example uses a string .. I copy and pasted his example

#

So dont start giving me a difficult time just because you dont have attention to detail man

hallow mortar
#

The example uses a string because setVehicleLock requires a string as its right argument.
When converting a command to remoteExec, you have to re-order the arguments, but their format doesn't change. You still need to use the correct arguments for the specific command.

ebon wing
#

Yeah, I just removed the quotes. I realized that, but he didint shrug. I pretty much said the exact same thing as you did after he asked me to suggest

hallow mortar
#

Well, I'm not sure how you got the idea that it needed to be converted to string when converting to remoteExec, since in the example it was a string before being converted to remoteExec.

ebon wing
#

I literally just copy pasted the example code and changed the names

#

You guys need to start sharing your joints with me, its some good stuff

ebon wing
#

Yeah? Still not saying anything about conversion, just pointing out I did it EXACTLY as he does it

#

Assuming the string gets executed, it doesnt, its just a parameter. It really isnt a big deal

hallow mortar
#

The pinned example shows a 3-step process of changing a non-remoteExec command to remoteExec. Pre-remoteExec setup, the template, then after applying the template.
The command before being changed to remoteExec has a string argument. This does not change between the non-remoteExec and remoteExec versions. Leopard didn't place the argument in a string - the argument was already a string in and of itself.
Therefore, being a string is not part of changing it to remoteExec. The string is just what the command had before. So you don't need to provide your arguments as strings, you just provide them as you would without remoteExec. If you needed to provide your arguments as a string, that would be mentioned, because it's a major change. The example only shows rearranging the arguments because that's all you do to them. The idea that the string is parsed and the stuff inside is executed, is not mentioned, and for a good reason.
Copying the example exactly is one thing, but if you're going to change something (for example, the command being used) you need to think about it and read the full explanation, which the pin does give.

ebon wing
#

Brother im not reading all that, sorry

hallow mortar
#

If you want to learn how to use SQF you're going to have to read some medium-length texts, otherwise this will happen again.

ebon wing
#

and for whatever reason are desperately trying to drag out by writting an essay

hallow mortar
#

¯_(ツ)_/¯

#

I tried

ebon wing
#

brother go troll somewhere else

pulsar pewter
#

dude everybody's trying to help you

#

basic point is: the command that leo has in his example NEEDS a string. That's why it's got "UNLOCKED"

#

The command you wanna use doesn't need one. Hence, why putting "false" is wrong.

#

You turned false into a string "false" when you didnt need to.

#

for remoteExec'ing a command, only one you need to turn into a string is the command name itself.
hence:

[leftArg, rightArg] remoteExec ["command", ...];
ebon wing
#

Yep, I know, thanks

ebon wing
#

Why are you guys getting involved with this without even reading the whole conversation, this all started because poplox started shitting on me for making a simple assumption, and after I provided a suggestion to clearify for others as he asked, he continues to shit on me. Then you two minions jump in and start talking about something else completely

winter rose
dreamy kestrel
#

is there some way I can discover the presence of a loaded mod? other than perhaps scanning missionNamespace for functions.

winter rose
#

use case?

south swan
#

or checking for class in CfgPatches being present

dreamy kestrel
#

would be moderately workable...

_cfg = "true" configClasses (configFile >> 'CfgPatches');
_cfg = _cfg select { configName _x find "acre" >= 0; };
count _cfg;

also knowing a couple of the classes, this one would be faster I think.

private _classes = ["ACRE_PRC343", "ACRE_PRC148", "ACRE_PRC152", "ACRE_PRC117F"];
private _expectedCount = count _classes;
private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgClasses = _classes apply { _cfgWeapons >> _x; };
{ !isNull _x; } count _cfgClasses == _expectedCount;
south swan
#

just one isClass (configFile >> "Cfgpatches" >> "some_acre_class") is usually enough, thb

meager granite
#

Sometimes I wish hashmaps stored order of added keys

warm hedge
#

It is not “Hash” anymore :>

lunar goblet
#

How would I do a script that could place a marker on a player not moving for an extended period of time?

south swan
#

(values _settings) params (keys _settings); blobcloseenjoy

lunar goblet
meager granite
#

Just wishing there to be an internal order list accessible somehow: ARRAY = orderedKeys HASHMAP or something

warm hedge
#

Ded would simply say nu

meager granite
#

Yeah, not at this point of hashmaps being a thing anyway

still forum
hallow mortar
hallow mortar
#

PS. you could add a deleteMarker _lastPosMarker after the end of the loop, so the marker goes away when the player is murdered found. Otherwise it'll just stay wherever they were last highlighted forever

lunar goblet
#

Thanks a lot!

candid sun
#

best way to escape quotations?
i'm writing player profile/steam id to db and i know Mr. '"'"'"' will come

pulsar bluff
#

trying to get the projectile object for use in the handle damage event

#

do i need to do something like _bullet = nearestObject [player,_projectile_class];

south swan
#

why not sqf this addEventHandler ["HitPart", { (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"]; }];?

fleet sand
#

Why do you need to do that cant you get projectile from handle damage ?

queen cargo
#

"escape quotations"
so you want to call compile user input?
great idea! What mission are you working on? i promise you i will provide you some escape function after that

south swan
#

now that i check, all the damage EHs seem to provide the projectile as an argument?

#

*"Hit" doesn't. But "Dammaged" and "HitPart" both do

pulsar bluff
#

that event needs to be added where the shooter is local

#

While you can add "HitPart" handler to a remote unit, the respective addEventHandler command must be executed on the shooter's PC and will only fire on shooter's PC as well

south swan
#

"Dammaged" doesn't have that caveat listed

pulsar bluff
#

so the projectile object isnt really accessible in realtime (handle damage)

south swan
#

and the damage-dealing projectile object is local to shooter's machine anyways, other machines have non-damaging copies tanking

pulsar bluff
south swan
#

"HandleDamage" also has "_projectile" passed as argument, yeah

#

although only a classname, not the actual object

pulsar bluff
#

yea not so useful. we can get class from object, but not object from class

south swan
#

what do you expect to do with that object afterwards, though?

pulsar bluff
#

i just want to get the velocity and vector

south swan
#

and what next? Would that be used in "HandleDamage" to calculate the override value or something?

pulsar bluff
#

eventually yes thats part of it

south swan
#

yeah, that's a problem

#

at the point of "HandleDamage" velocity can return 0 if the bulled doesn't penetrate the unit in question meowsweats

pulsar bluff
#

yea :\

#

ahh well

#

dammaged looks like the way to go

south swan
#

and "Dammaged" seems to happen strictly after "HandleDamage"

#

well, akshually

#

(at least on my machine) "HandleDamage" happens in two different frames. And in the first frame the projectile velocity is not yed decreased. meowsweats

pulsar bluff
#

yea we are looking at getting the projectile at the first instance of HD, saving the info and then carrying it thru to the later instances (i need it on hit index 11)

south swan
#
"[""HandleDamage"",5229,787.384]"
"[""HitPart"",5230,0.001]"
"[""HandleDamage"",5230,0.001]"
<<MULTIPLE REPETITIONS OF ABOVE>>
"[""Dammaged"",5230,0.001]"
<<MULTIPLE REPETITIONS OF ABOVE>>
"[""Dammaged"",5230,0]"
<<MULTIPLE REPETITIONS OF ABOVE>>``` are the result on my machine ([handler, diag_frameNo, velocity])
pulsar bluff
#
if (
    (_projectile isNotEqualTo '') &&
    (isNull ((localNamespace getVariable ['QS_currentBullet',[objNull,0]]) # 0))
) then {
    _bullet = nearestObject [_unit,_projectile];
    _bulletVelocity = ((vectorMagnitude (velocity _bullet)) * 3.6);
    localNamespace setVariable ['QS_currentBullet',[_bullet,_bulletVelocity,_hitPoint,vectorDir _bullet]];
};```
#

and then in hit index 11 resetting after use localNamespace setVariable ['QS_currentBullet',[objNull,0,'',[0,0,0]]];

south swan
#

uhm, why multiply by 3.6?

pulsar bluff
#

good point

#

i normally look for km/h with velocity stuff

#

rarely m/s

south swan
#

ah, yes, 1 m/s == 3.6 km/h, derp

pulsar bluff
#

m/s make more sense here tho

graceful kelp
#

is there a way for me to control a turret zoom with script?

foggy stratus
#

Is there a way to instruct AI to NOT enter a building. I'm building a feature where player squad leader looks at point on the side of an object (building, wall, fence, log, etc.), and positions are calculated in a line parallel to the exterior object surface for AI to move to. Like this: https://i.postimg.cc/YSJMdBJt/20230921064613-1.jpg

#

The problem is if those move positions are near a building that has navmesh positions, the AI will often choose to enter the building foolishly, instead of moving to calculated position outside of building.

dreamy kestrel
dreamy kestrel
dreamy kestrel
# dreamy kestrel it's a rough draft, TBH. especially the class verification. however, points take...

what I ended up with, essentially something like this:

private _cfgPatches = configFile >> "CfgPatches";
private _cfgAcrePatches = "configName _x find 'acre' >= 0" configClasses _cfgPatches;

_cfgAcrePatches isNotEqualTo [] && {
    private _cfgWeapons = configFile >> "CfgWeapons";
    private _classes = ["ACRE_PRC343", "ACRE_PRC148", "ACRE_PRC152", "ACRE_PRC117F"];
    private _validated = _classes select { !isNull (_cfgWeapons >> _x); };
    _validated isEqualTo _classes;
};
south swan
#

you can also get them by running configSourceAddonList (configFile >> "CfgWeapons" >> "ACRE_PRC343") for example (or for any other config class from mod)

tough abyss
#

Greetings everyone, great morning to all

candid sun
#

it doesn't have a name yet

dreamy kestrel
drowsy geyser
#

Is there a way to check if a mission (SP) was restarted?

candid sun
#

call it 25252551 wip if you want

#

what's the best way to escape quotations then?

drowsy geyser
meager granite
#

Not much of SP scripter, but how about adding an Unload event handler to display 46 so it removes your events so they can be added again on next start?

#

Nevermind, its the other way around, display doesn't get reset

#

Check if display still has your event ID saved, means you don't need to add it again

#
[] spawn {
    disableSerialization;
    waituntil {!isNull findDisplay 46};

    if(findDisplay 46 getVariable ["chat_eh", -1] < 0) then {
        private _chat = findDisplay 46 displayAddEventHandler ["KeyUp", {
            params ["_display", "_key", "_shift", "_ctrl", "_alt"];
            if (_key == 57) then {
                systemChat "This DAddEventHandler should be removed/deleted after SP Mission Restart";
            };
        }];
        findDisplay 46 setVariable ["chat_eh", _chat];
    };
};
#

More easily, just store some flag in the display

tough abyss
#

Can I define an array ( code optimisation) with DEFINE ? In wiki, I see this: #define BUFFER 1.053 // note: no semicolon

#

I want to define an array of 4 numbers. Should I just define the 4 numbers instead?

dreamy kestrel
#

Q: about buildings, in general. either BIS_fnc_buildingPositions or buildingPos tells us the spawn positions supported by a building, correct?

however, are we guaranteed that such an object should have exits? how would we detect whether it does? i.e. _building buildingExit 0, for instance, would return what?

trying to gauge whether should spawn units in or near building objects, if there are no exits, there is really no point spawning anything there, regardless what buildingPos says.

granite sky
#

I don't think that's something you can get from script.

dreamy kestrel
granite sky
#

I think it's only encoded in models.

#

oh, buildingExit is real...

#

Normally commands that return a position return [0,0,0] if not found.

foggy stratus
#

Does anyone know of a script that creates wall objects around the perimeter of a specified area? I could grind one out, but I bet someone has already done it.

sullen sigil
foggy stratus
#

If no better ideas, I may temporarily wall off the building using invisible wall objects.

sullen sigil
#

it will not optimise your code's runtime either, only its compilation (iirc)

digital hollow
foggy stratus
dreamy kestrel
# granite sky oh, buildingExit is real...

right seems that is the case, for both buildingPos and buildingExit. I guess windows count as exits, the chapel object for instance, single open door "entrance", but indicating three total exits. which I suppose could be a breach moment, maybe, or at least is accessible reaching out and touching someone. good to know, thanks.

foggy stratus
fair drum
#

Possible user inputs:

test
"test"

how it will be returned when grabbed in code

"test"
"""test"""

how can I normalize these to "test"?

so far I've tried parseText but thats no good:

parseText """test"""; // returns "test" - good
parseText "test"; // returns test - bad
granite sky
#

Those aren't user inputs though?

fair drum
#

they will be. it depends on how they enter it in the module. if they enter "test", it will be """test""", if they enter test then it will be "test"

granite sky
#

What if they enter test?

fair drum
hallow mortar
#
_string trim ['"',0];```
?
granite sky
#

Do you want the output string contents to be "test" or test?

fair drum
#

i want final output to be a string

#

single string

granite sky
#

with no quotes in it?

fair drum
#

with quotes

granite sky
#

gives up

fair drum
#

so I can use it as a string

#

if it doesnt have the quotes, it will be treated as a var

hallow mortar
#

String delimited by quotes but not containing any quotes?

#

Yes or no

granite sky
#

I think you might be misunderstanding what a string is.

#

Like you specify a string with "test" but that creates a string with test as the contents.

#

"test" select 0 is t

fair drum
#

I want to compile it in the end as code

kindred zephyr
#

str it

granite sky
#

oh wait, you can't do string select :P

kindred zephyr
granite sky
#

Well, you could do "test" select [0, 1]

#

No specific single-character select

hallow mortar
#

You can't use parseText because it returns Structured Text, not string

hallow mortar
fair drum
#
[compile "deleteVehicle myVehicle", compile """deleteVehicle myVehicle"""]
///
[{deleteVehicle myVehicle},{"deleteVehicle myVehicle"}]
#

this is why I need them the same

granite sky
digital hollow
granite sky
#

Like you could have something like if (condition) then {"test"} else {"test2"}

#

If you have arbitrary code input then logically you assume that any quotes in the input are valid.

hallow mortar
granite sky
#

Also it doesn't handle single quotes :P

digital hollow
fleet sand
#

Hi guys quick guestion is there a way for me to terminated the script that i launched via console. For Example i launch this script in console:

["MouseButtonDown", {
    params ["_displayOrControl", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
    if(_button == 1) then {
        systemChat "Player is holding right mouse button.";
    };
}] call CBA_fnc_addDisplayHandler;

["MouseButtonUp", {
    params ["_displayOrControl", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
    if(_button == 1) then {
        systemChat "Player is relesed right mouse button.";
    };
}] call CBA_fnc_addDisplayHandler;
```And now i did what i did and now i want to terminate it with out restarting scenario ? is that possible or is there a way to do that ?
still forum
meager granite
#

You get Error Undefined variable in expression errors from action button context, yet canSuspend is false? 🤔

still forum
#

canSuspend and undefined errors are separate flags

tough abyss
#

Thank you so much for the replies guys, I will def do that

meager granite
#

Just curious

still forum
#

probably

tough abyss
granite sky
tough abyss
#

Guys, Is this correct? ```private _enemySides = [side player] call BIS_fnc_enemySides;
private _list = player nearEntities ["Man", 5];
private _nearenemies = _list select {side _x in _enemySides};

    private _amountenemies = count _nearenemies;```
ornate whale
#

Is there any way how to make a heli land and wait for players to get it, while there are enemies nearby, without setting the heli group to careless? And possibly without using a waypoint "GET IN" for the group that is supposed to board the heli. Usually they get scared and fly away.

granite sky
tough abyss
#

OK

#

Changing now 😄

dreamy kestrel
hallow mortar
dreamy kestrel
tough abyss
#

Im out of ideas to what include in my hud information. hmm

meager granite
#

The less HUD the better

tough abyss
#

I like more HUD 😄

#

Im using it to learn sqf as well, so the more it has, the more I learn

#

One thing I might try to add is to: if cursorObject == enemy, draw a red circle/square on the enemy

meager granite
tough abyss
#

idk how hard it is to do it

meager granite
#

cursorObject might not be reliable but you can start there

tough abyss
#

Hmm ok

#

Im just lost on how to draw a red circle/square on the enemy

hallow mortar
#

I'm lost on what a losangle is

tough abyss
#

Sorry, English isnt my mother language

digital hollow
hallow mortar
#

You probably want drawIcon3D

tough abyss
#

Got it, let me check wiki

dreamy kestrel
# digital hollow you can get path lod points with `_house selectionNames 4e15`. looks like the en...

so when I use a method like this, it is returning the relative positions of the LODs, is that correct? if I wanted absolute positions, for instance, would need to add some vectors from the building position?

_object = building;
_paths = 4e15;
_lods = _object selectionNames _paths;
// Case Insensitive?
_returnmode = "averagepoint";
_lods apply { _object selectionPosition [_x, _paths, _returnmode]; };
tough abyss
#

Does it mean after I call it, it will keep rendering forever?

hallow mortar
#

This command has to be executed every frame. Use the Draw3D Mission Event Handler (which is executed every frame if the user can see the icon)

#

If you do it without a per-frame event handler like Draw3D, it will only be visible for one single frame

granite sky
#

You can remove the mission event handler later if you need to.

tough abyss
#

@granite sky Can I use an if like in the example ? unitsToDisplay = allUnits; addMissionEventHandler ["EachFrame", { private _offset = [0,0,0]; { private _screenPosition = worldToScreen (_x modelToWorldVisual _offset); if (_screenPosition isEqualTo []) then { continue }; // < your drawIcon3D treatment here > } foreach unitsToDisplay }];

granite sky
#

Seems reasonable assuming that worldToScreen returns [] for off-screen.

#

That unitsToDisplay might need updating though.

#

Oh, should be Draw3D rather than EachFrame.

#

Otherwise it might not be drawn at the correct point in the frame.

tough abyss
#

Hmm ok. Im unsure to which approach to take on this...

#

For now I want to draw only the enemy on my aim

#

but in the future I might try to draw all enemies on my FOV

hallow mortar
#
addMissionEventHandler ["Draw3D", {
  if ([side cursorObject, side player] call BIS_fnc_sideIsEnemy) then {
    drawIcon3D [ ... ];
  };
};```
drawIcon3D/draw3D already only draws icons within the screen bounds by default, so you don't really need to worry about calculating whether it's on screen
drowsy geyser
tough abyss
fleet sand
cosmic lichen
#

If you just wanna indicate that something is going one a non deterministic progress icon would work. Just use an icon and spin it on each frame.

drowsy geyser
hallow mortar
#

You can probably find the hold action functions, or at least the UI elements, and re-engineer it yourself

cosmic lichen
drowsy geyser
#

yes i think it 24

graceful kelp
#

i can use currentVisionMode
is there a way to set the currentVisionMode

tough abyss
#

Unless you are retreiving the playername from the database. You really don't need to worry about escaping quotations

tough abyss
#

Ok guys, I got the square drawn at the screen. However, it draws on the foot of the enemy instead of the center of him.

graceful kelp
#
  if ([side cursorObject, side player] call BIS_fnc_sideIsEnemy) then {
    // [texture, color, position, width, height, angle, text, shadow, textSize, font, textAlign, drawSideArrows, offsetX, offsetY]
    drawIcon3D ["CCPS_crysis\UI\targetIcon.paa", [1,0,0,0.75], aimpos cursorTarget, 1, 1, 0, "Target", 1, 0.05, "TahomaB"];
  };
}];```
ivory lake
tulip ridge
#

You can just toggle it on/off, there's not a way to cycle them

graceful kelp
#

yh trying to set the thermal mode of a turret

tough abyss
#

@graceful kelp Im trying it rn. Thank you so much

ivory lake
#

depending on how its set up anyway

tough abyss
#

Now the square is on top of the enemy, Im trying to get it on the center of the enemy body.

hallow mortar
#

Using aimPos (returns positionASL) to get a position for drawIcon3D (uses positionAGL) is not recommended

tough abyss
#

Thanks for the reply, Hmm. Ok. What do you suggest?

hallow mortar
#

cursorObject modelToWorldVisual [0,0,1]

#

[0,0,1] is the position relative to the object's base point (for infantry, the feet) in format [x,y,z]. 1 metre above the base point puts it about in the middle of a 2-metre Arma Man. This should also be reasonable for vehicles, although it may appear proportionally lower for tall vehicles.

high vigil
hallow mortar
#

Rewriting the game's physics engine would be a good start :U

high vigil
#

i was expecting little less brain dead response, maybe like Hit EH

tough abyss
hallow mortar
candid sun
#

i will be retrieving them

hallow mortar
# tough abyss Thank you, I will try that and let you know how it works out. Im just wondering ...

The icon will appear 1 metre above them. It's connected to their base point, not a particular part of their body.
You could consider this to be "OK" (avoids obscuring the target), or you could look for other options - adjusting the height based on their stance, or finding the position of a particular selection rather than working from the base point. However, you would then also have to check if it's a vehicle (they don't have stances and have different selections), and the less complexity you add to a per-frame check, the better.

hallow mortar
candid sun
#

i'm guessing toString + toArray would be the easiest way?

tough abyss
hallow mortar
#

Assuming you've put it in the position parameter of drawIcon3D (I don't remember what order they're in) then yes

candid sun
#

ok so we have toArray, which gives us the number of a unicode character, but there's no function to do the reverse?

ornate whale
#

Is it possible to make AI units spawn on spawn points instead of their dead bodies in MP? Even though players spawn normally, the AI teammates don´t.

kind cedar
#

What to put in the Init on a helicopter to have unlimited fuel? Eden Editor.

ornate whale
#

If the heli is doing loops through waypoints, you can put the set code in the on activation field in one of them.

urban flicker
#

How do you prevent the helicopter crew from disembarking helicopter?

granite sky
#

you mean after it's immobilized or what?

ornate whale
#

In which situation are they disembarking? Are there any enemies nearby? And do you mean pilots as the crew?

urban flicker
#

Im using hal air reinforcements

#

I think i need to figure out a way to disable tcl for spawning crew members

#

I think thats whats causing the issue when they land they just jump out and runnaway

open flume
#

so im attempting to spawn a flag attached to a player once they interact with a certain object

#

and once they reach a certain trigger the flag will despawn

#

i've got the spawning working but not the despawning

#
deleteVehicle _bflag;
};
};
};
},                     >
23:53:42   Error position: <_bflag;
};
};
};
},                     >
23:53:42   Error Undefined variable in expression: _bflag
23:53:42 File H:\Users\shotl\Documents\Arma 3 - Other Profiles\Longshot\missions\Red%20VS%20Blue.Blood_OPTRE\initPlayerLocal.sqf..., line 101```
#

Gives me this error

#
_bflag = "OPTRE_CTF_Flag_BlueTeam" createVehicle position player;
_bflag attachTo [player, [0, -.10, 1], "Pelvis"];```
#

(the code for spawning the object)

warm hedge
#

Post the part that produces the error

open flume
#
        [] spawn {
            switch (side player) do {
            case east: {
                waitUntil{player distance eastDrop < 2 && redflagOnPole};
                private _before = asaayu getVariable ["score",[0,0,0]];
                asaayu setVariable ["score",[_before select 0,(_before select 1) + 1],true];
                redscored = true;
                publicVariable "redscored";
                playSound "AddItemOK";
                ["<t size = '1.5'>OPFOUR HAVE CAPTURED A FLAG</t>",0.295 * safezoneW + safezoneX,0.1240001 * safezoneH + safezoneY,1,1,0,1105] remoteExec ["BIS_fnc_dynamicText", 0]; 
                ["<t size = '0'><img image='\a3\Modules_f\data\iconSector_ca.paa' /></t>",0.322 * safezoneW + safezoneX,0.09500001 * safezoneH + safezoneY,99999999,0,0,9925] remoteExec ["BIS_fnc_dynamicText", 0];
                uisleep 5;
                ["<t size = '1.5'>30 SECONDS TO FLAG RESPAWN</t>",0.295 * safezoneW + safezoneX,0.1240001 * safezoneH + safezoneY,1,1,0,1106] remoteExec ["BIS_fnc_dynamicText", 0]; 
                deleteVehicle _bflag;
            };
            };
        };
#

(put the section just in case)

warm hedge
#

You spawned so the _bflag is undefined

open flume
#

_bflag setVariable ["OPTRE_CTF_Flag_RedTeam", 1, true];

#

?

#

||idk what to lookup for this XD||

warm hedge
#

[_bflag] instead of [] before spawn

open flume
#

gotcha

south swan
#

and params ["_bflag"]; after spawn { :3

open flume
south swan
#

spawn doesn't run the code where it's written. The code to the right of spawn gets run in the different thread. And it doesn't inherit local/private variables of where it's created. So [_bflag, _whatever] spawn { params ["_bflag", "_whatever"]; ... means "a. send variables from here to the new thread in that order; b. in the new thread give the sent variables those names" blobdoggoshruggoogly

open flume
#

so for example i would for this do

[_bflag] spawn {
_bflag = "OPTRE_CTF_Flag_BlueTeam" createVehicle position player;
_bflag attachTo [player, [0, -.10, 1], "Pelvis"];
};```
#

?

#

(sorry if i look like an idiot, im learnin this as i go XD)

south swan
#

what you've posted would create a new vehicle inside the spawned code and do nothing with the one from outside

#

arguments spawn code. agruments can be anything (but Array is used most of the times) . To access the arguments from within the code you need to use either params command (i.e. [_bflag] spawn { params ["_bflag"];... to use it in the code with the same name) or _this magic variable (i.e. [_bflag] spawn { private _bflag = _this select 0;... equivalent to previous example)

open flume
#

||my tired brain no understand, but ty for helping. maybe awake longshot will be smart XD||

warm hedge
#

Take a sleep is a part of struggle

queen cargo
#

toString toArray "foobar" => "foobar"

#

there is absolutly no reason why you would want to add some escaping functionality to ArmA
because escaping " would only make sense if you want to call compile something and are scared that a single " could destroy your current string and cause a script error

#

if you want to interact with a database then ask your extension provider to provide some escape function because you WONT be able to escape everything proper without a gigantic overhead in arma

#

but if you do not have any database thingy then totally forget what you want to do as call compile is NOT a valid way for ANYTHIGN!

candid sun
#

what happened to your promise?

sage furnace
#

Hi all, is there a command that is responsible for the voltage on the bot?

That is, I want the bot to receive a certain voltage in a trigger and perform a certain action.

warm hedge
#

So, like, if the variable went more than the certain number, something will happen?

sage furnace
warm hedge
sage furnace
warm hedge
#

Well, since I haven't really messed around with fleeing let's try EH one

#
theEnemyUnit addEventHandler ["Suppressed",{
    params ["_unit","","","","_projectile"];
    private _voltage = _unit getVariable ["voltage",0];
    
    // closer the bullet, the unit will be scared more
    _voltage = _voltage + (50/(_projectile distance _unit));
    systemChat str _voltage;    // prints the current voltage
    
    // 1000 is just a placeholder number
    if (_voltage > 1000) then {
        // put anything
        hint "I'm scared!";
    };
    
    _unit setVariable ["voltage",_voltage];
}];```*VERY* rough script. The fact that I did not even tested tells that too
sage furnace
tough abyss
#

Good morning everyone

#

Im trying to calculate how much the player is safe in the environment. So I did the following code, but im unsure its correct : ```private _list = player nearEntities ["CAManBase", enemiesrange];

        private _nearenemies = _list select {
            side _x in _enemySides
        };

        private _knowaboutcount = 0;

        { 
            _knowledge = _x knowsAbout player;
            _knowaboutcount = _knowaboutcount + _knowledge;
        } forEach _nearenemies;```
#

knowsAbout also mention _x should be local.... Does it mean, bots in the server cant be used to calculate it?

distant egret
tough abyss
distant egret
#

No info is given about the locality so I wouldn't know. Try it and report back if it works 😅

tough abyss
#

Trying now 😄

#

Seems to be working locally. Going to try in the clan server soon

proven charm
ornate whale
#

How can I make sure that that my code is executed on every machine that has interface (e.g. server with a player and clients) with remoteExec command? Should I nest hasInterface codition in the arguments?

fair drum
proven charm
fair drum
#

aka menu hosted servers

proven charm
#

oh not sure what is the goal then

fair drum
#

he wants to exclude anything without an interface, dedis and headless

proven charm
#

ic

fair drum
#

could also just do a basic

[] remoteExec ["command", call BIS_fnc_listPlayers];
[] remoteExec ["command", (allPlayers - entities "HeadlessClient_F")];

but that would probably exclude people sitting in the menu

proven charm
#

from what i understand lobby commands are very limited

fair drum
#

which is why I mentioned just using a full global send and filter out in the code instead. gets those lobby people too.

#

depending on what hes using it for obv

ornate whale
#

Do you call the remoteExec right from a trigger, or you first call a function .sqf and inside you do the remoteExec? The thing is that I hate writing any code except for execVM or call inside any field in Eden.

#

I would like to call this .sqf function in a trigger and do the rest in the .sqf. But I am not sure how to structure my code properly.

fair drum
ornate whale
#

then I would have to call two function instead of one

#

That seems to be a bit redundant to me.

fair drum
#

no you don't? if you are using a trigger, set it to server only, remotexec the function and have everything else inside of that function

ornate whale
#

Basically I need what is between start and end to be called in the remote, but in one sqf file, preferably.

ornate whale
fair drum
#

let me see all you want to do so far. or is that it in the image?

ornate whale
#

Trigger -> missionEnd.sqf -> remoteExec

fair drum
#

yeah, so trigger (server only) -> direct call of missionend (still server from trigger) -> remoteexec your local stuff in that function as the server.

or

trigger (global) -> direct call of mission end -> no remote exec at all cause its local

#

if you start remoteexecuting, you don't want to nest all of that code (in your pic above - putting that in the remoteExec as a whole entity) and send it through the network. that will toast the network. you have to create a function file and call that

ornate whale
#

OK, so if I for example assigned the code to a global variable, then I would basically send it over network too.

fair drum
#

yes, and if you have a long set of code/string to compile, that's a lot of info to send over the network

ornate whale
#

How do I discern local global tirrger, as you mentioned?

fair drum
#

theres a check box that says "server only"

#

uncheck it

#

so now when the trigger fires, it calls your file and in your file you have

if (isServer) then {
  // server stuff
};

if (hasInterface) then {
  // ui stuff
};
ornate whale
#

Ha, ha, ha 😄 first time I noticed this option, I will need to reevaluate all my triggers then.

fair drum
#

its off by default usually

ornate whale
#

So, basically I am running all my code on the machine which triggers the trigger, if it is unchecked?

fair drum
#

you are running all of the code on all the machines when the trigger triggers

#

which is why you have your filters in the code

ornate whale
#

Even better

#

It will probably be best to do everything on the server, since I coded it all that way.

fair drum
ornate whale
fair drum
kindred zephyr
#

can someone clarify this for me?

pos3D, /* 3D Array of numbers as relative position to particleSource or (if object at index 18 is set) object.
Or (if object at index 18 is set) String as memoryPoint of object. */

This is part of the particlArray section, pos3D is supposed to take a memoryPoint if object in index 18 of the array is defined (which it is) however it keeps telling me that the value cannot be a string when trying to execute

#

any idea?
or should I instead just give it the 3D position of the memorypoint?

kindred zephyr
#

positive

little raptor
#

from what I see it accepts strings

kindred zephyr
#

unless "head" is not a valid memoryPoint

#

ah, think i see whats my issue, object goes undefined because im trying to test in another context

south swan
#
    // Calculate position & direction of particle effects
    private _pos = _object selectionPosition format["shower_%1_pos",_i]; // << Position3D
    private _dir = _object selectionPosition format["shower_%1_dir",_i];
    private _vector = ((_object modelToWorldVisual _pos) vectorFromTo (_object modelToWorld _dir)) vectorMultiply _power; // << Position3D

    // Create particle effect
    private _particle = "#particlesource" createVehicleLocal [0,0,0];
...
    _particle setParticleParams [
        ["\A3\data_f\Cl_water", 1, 0, 0], 
        "", 
        "Billboard", 
        1, 
        1.25, 
        _pos, // << Position3D
        _vector,  // << Position3D
        ...``` from some vanilla function code, though ![tanking](https://cdn.discordapp.com/emojis/700311400098299944.webp?size=128 "tanking")
#

bin_fnc_deconShowerAnim

#

conflicting syntaxes notlikemeow

little raptor
south swan
#

SQF simplicity stops being charming at like 6-8 command parameters notlikemeowcry

kindred zephyr
drowsy geyser
#

where can I find the underwater breathing function/script? couldn't find it.

ornate whale
#

What would happen if I called a titleText command on a dedicated server? Would it fail the whole script or just do nothing on this particular line.

hallow mortar
#

It would likely do nothing. The server usually just ignores UI commands.

drowsy geyser
# drowsy geyser where can I find the underwater breathing function/script? couldn't find it.

this is what i did but i wanted to look if i can improve it

private _sound = getMissionPath "sounds\breath.ogg";
private _basePitch = 1.0;
private _minSleep = 3;

while {alive player} do 
{
    private _fatigue = getFatigue player;
    private _pitch = _basePitch + (linearConversion [0, 1, _fatigue, 0, 1, true]);
    playSound3D [_sound, player, false, getPosASL player, 1, _pitch];
        
    private _sleepDuration = 10 - _fatigue * 10;
        
    if (_sleepDuration < _minSleep) then
    {
        _sleepDuration = _minSleep;
    };
    sleep _sleepDuration;
};
fair drum
vast zodiac
#

I'm having an issue with Eventhandlers

#

Whenever I use eventhandlers, I get a notification telling me undefined base class: Eventhandlers

#

I've tried moving it around but it doesn't quite work

#

Specifics in a second

fair drum
#

are you making a config? or a script?

vast zodiac
#

I'm making a config.ccp for a faction modpack

fair drum
drowsy geyser
open flume
#

so im running a script in eden and it works both on multiplayer and singleplayer

#

but when i try and run it on a server it messes up

sharp grotto
open flume
kind cedar
#

Is there a way to save players last position? if used for multiplayer, im editing on eden editor but me and my buddy are curious if while playing and saving the scenario if when we load back up we dont have to start back at the custom respawn location on base, but load back up where we last saved and with our last loadout we had

open flume
#
    _originalTime = serverTime;
    private _time = asaayu getVariable ["timeLimit",45];
    _result = 60 *_time;
    _result =_result - (serverTime - _originalTime);
    _textResult = [_result] call BIS_fnc_secondsToString;
    [format["<t font = 'PuristaBold' size = '.8'>%1</t>",_textResult],0.295 * safezoneW + safezoneX,0.00000001 * safezoneH + safezoneY,99,0,0,2188] remoteExec ["BIS_fnc_dynamicText", 0];```
#

(theres more but it handles and overtime function)

sharp grotto
open flume
#

(dat imgur is has a couple images)

sharp grotto
open flume
#

hmmm, aight

hoary kernel
#

When I use "HideObjectGlobal" on an object in dedicated MP (with headless clients) do i still need to call it as an remote exec?

If so, do i only send it to the server or all clients?

#

Context is usage inside an interaction on a generator.

granite sky
#

remoteExec to server only.

#

No JIP.

#

(Not that JIP makes any sense for server target)

hoary kernel
#

okay dokay, boss!

Thanks a bunch. I was confused by the documentation saying " Hides object on all connected clients as well as JIP." So i thought it took care of everything already when called clientside.

Ill try with remote exec 🙂

granite sky
#

It has SE on the page, which means it only does anything when run on the server.

#

(enableSimulationGlobal is weird though)

ornate whale
#

How can I access player's namespace in MP?

granite sky
#

You mean the namespace of the player object or like missionNamespace on their client?

twin oar
#

How can I whitelist a vehicle, to a variable?

#

What I'm seeing on the wiki isn't making too much sense

#
waitUntil {!isNull player};
WhiteListArray = ["Your playername"];
sleep 1;
systemChat name vehicle player;
//Assuming WhiteListArray contains a list of player names that are allowed to enter vehicles 
{ 
if (WhiteListArray find (name vehicle player) == -1) then {
    _x addEventHandler ["GetIn", { 
       if (((vehicle player) != player) and (alive player)) then { 
           player action ["eject", vehicle player]; 
       }; 
       hint "You aren't authorized."; 
   }]; 
};
} foreach entities "AllVehicles"; 
meager granite
meager granite
twin oar
#

I want to whitelist the "driver and gunner"

#

So pilot and co pilot as well

#

If I can whitelist them to a specific variable that I already have definded

#

the variables are whitelisted by a UID

fair drum
#

just use a getIn event handler

#

and filter there

meager granite
#

I suggest GetInMan and SeatSwitchedMan added to player

#

Instead of EH on each vehicle

#
    waitUntil {player == player};

    fnc_checkIfPlayerBelongs = {
        params ["_vehicle", "_turret"];

        if(_vehicle getVariable ["this_vehicle_is_restricted", true]) then {
            if(
                _turret isEqualTo [-1] // Driver

                || _turret isEqualTo [0] // Co-Pilot / First gunner
            ) then {
                player action ["eject", vehicle player];
                hint "You aren't authorized.";
            };
        };
    };

    player addEventHandler ["GetInMan", {
        params ["_unit", "_role", "_vehicle", "_turret"];

        [_vehicle, _turret] call fnc_checkIfPlayerBelongs;
    }];

    player addEventHandler ["SeatSwitchedMan", {
        params ["_unit1", "_unit2", "_vehicle"];

        [_vehicle, _vehicle turretUnit _unit1] call fnc_checkIfPlayerBelongs;
    }];
#

Threw together a snippet for you, didn't test

#

Add a UID check in there yourself, depending on your conditions (I assume each vehicles has their own UIDs?)

#

Gunner and co-pilot check can be more complex, check if its really a co-pilot in config and not a FFV seat, get all gunner seats to exclude from them too, etc.

meager granite
#

(Fixed checking for passenger instead of driver)

meager granite
#

Wish there was a shorter version of isNil{_hashmap get "key"} similar to "key" in _hashmap

#

"key" isNil _hashMap or something

#

Doubt the performance difference will be much, I just like less contexts created

hallow mortar
#

I feel like that's what getOrDefault is meant for

meager granite
#

But I need to know if value is nil specifically

torpid gate
#

Hello, I need help, I wanted to write a small script but I have a problem. I wanted to make it so that when you hover over a bot, an action appears and disables the bot's PATH.
So I wrote _unit = cursorTarget;
...
_unit disableAI "PATH";
But the script gives an error before _unit and how can I solve it?

warm hedge
#
  1. Tell the entire script
  2. Tell what exactly is the error
torpid gate
# warm hedge 1. Tell the entire script 2. Tell what exactly is the error
Status_cvest = missionNamespace getVariable ["Status_cvest", false];
_civHintShown = false;

_unit = cursorTarget;
if (_unit isKindOf "CAManBase" && side _unit == civilian) then {
    if (!_civHintShown) then {
        if (Status_cvest == false) then {
            Type_cvest = [1] call BIS_fnc_selectRandom;
            if (Type_cvest == 1) then {
                hint "Гражданин";
                _unit addAction ["Попросить остановиться", {call {cutText ["<t color='#00bfff'size='1.4'>Клон: </t> <t size='1.4'>Гражданин, остановитесь!</t>", "PLAIN DOWN", -1, true, true];}; _unit doMove _unit; _unit disableAI "PATH";  _unit addAction ["Попросить сдаться!", {[_unit, true] call ACE_captives_fnc_canSurrender;}, nil, 1.5, true, false, "", "", 3];}, nil, 1.5, true, false, "", "", 20];
                Status_cvest = true;     
                publicVariable "Status_cvest";
                } else {
                    if (Type_cvest == 2) then {
                        hint "Мб гажданин";
                        Status_cvest = true;     
                        publicVariable "Status_cvest";
                    } else {
                        if (Type_cvest == 3) then {
                        hint "Не гражданин";
                        Status_cvest = true;     
                        publicVariable "Status_cvest";
                        };
                    };
                };
            };
            sleep 0.1;
        };
    };```
This is the script itself, it is very raw and may look bad as I am bad at scripting.
warm hedge
#

You want to use _this#0 within addAction

meager granite
#

Why scripting error messages are localized anyway?

warm hedge
#

Because it is localized and font does not support Russian

#

You know what one of the iffy of Bohemians

meager granite
warm hedge
#

Ask them blobdoggoshruggoogly

meager granite
#

Wish there was something like ENTITY = lastVehicle ENTITY or ENTITY = lastParent ENTITY

#

Doubt its stored in the engine though

torpid gate
#

Thank you very much, after a few tests and reading the BIS documents I have solved the problem.

torpid gate
#

Hello again, I have again a problem with which I have been agonizing for a long time, but nothing works, please help.

Deistvie = true;
civHintShown = false;

while {Deistvie} do {
    if (_unit isKindOf "CAManBase" && side _unit == civilian) then {
        civHintShown = true;
    } else {
        civHintShown = false;
    };

    if (civHintShown) then {
        Type_cvest = [1,2,3] call BIS_fnc_selectRandom;
        if (Type_cvest == 1) then {
            Deistvie = false;
            hint "Гражданин";
            _unit addAction ["Приказать остановиться", {
                _unit = _this select 0;
                cutText ["<t color='#00bfff' size='1.4'>Клон: </t> <t size='1.4'>Гражданин, остановитесь!</t>", "PLAIN DOWN", -1, true, true];
                _unit disableAI "PATH";
                removeAllActions _unit;
                _unit addAction ["Приказать сдаться!", {
                    _unit = _this select 0;
                    [_unit, true] call ACE_captives_fnc_setSurrendered;
                    removeAllActions _unit;
                    Deistvie = true;
                }, nil, 1.5, true, false, "", "", 3];
            }, nil, 1.5, true, false, "", "", 20];
        } else {
            if (Type_cvest == 2) then {
                hint "Мб гражданин";
                Deistvie = true;
            } else {
                if (Type_cvest == 3) then {
                    hint "Не гражданин";
                    Deistvie = true;
                };
            };
        };
    } else {
        hint "Гражданина нет";
        removeAllActions _unit;
        Deistvie = true;
    };
    sleep 0.1;
};```
torpid gate
# torpid gate Hello again, I have again a problem with which I have been agonizing for a long ...

My idea was that the loop should make a constant check for a civilian slot and when it finds it activates the main script with different actions, the problem is that the actions are activated, but after the end of the one with action it does not start again, I assumed that this is because of the fact that Deistvie = true is written in the action, but I do not know how to make it so that only after the activation of the action activate and Deistvie.

next kraken
#

Hey guys, im having a little issue with the Enigma script : What i want to do is to limit the speed of the spawned vehicles, so they dont crash anymore. Im getting syntax errors, since i dont understand how to implement the command.

#

maybe someone can hint me in the right direcion or provide the correct syntax ? thanks in advance !

twin oar
#

Sorry was asleep