#arma3_scripting
1 messages · Page 106 of 1
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)
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
You probably want to look at Event Handlers / Mission Event Handlers, and preInit/init/postInit functions to add those event handlers
So it is possible, and I should look at that?
That is what I just said, yes
Okay good
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
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.
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
Good question. There should be a way but not straightforward
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?
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.
I'm thinking if there is something that will return similar to getUnitLoadout
@granite sky sorry for the ping. Pls can you check your Dm when you have the chance? i sent you a message
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.
Huh, doesn't it work? Let me test on my end as well
Could you tell me what is your code?
Hmm since I'm suck at reading others' code, can you point which are backpack related things?
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
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;
Is there a way to check the type of each element? I think they're just strings, though
getNumber (configFile >> "CfgVehicles" >> _x >> "isBackpack") == 1 not tested but something like that
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
That seems to work, thanks! Can you explain what it does and where I can read more about config?
Config Viewer is always your goto, yeah
getDammage
inb4 they introduce damaged weapons in the next update and call the needed selection gunDam
gusts```
dis ^ gust thing
Is it possible to script moving vehicle turrets using the keyboard?
the idea is to simulate more realistic turret controls
make it less OP
not really (only a few turrets can be controlled by script iirc)
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
That would... yeah, I know what you mean, but it is nothing that an SQF can handle I'm afraid
I know, we would need an engine update 
is it possible to set a custom image on the spectrum device
this:
are there any safer alternatives to isTouchingGround I wonder... besides the obvious anecdotal caveats mentioned.
https://community.bistudio.com/wiki/isTouchingGround
most likely not, see Arma 3: Spectrum Device
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.
private mom, I see we had the same childhood
🤣 it's true
heaven forbid you confused her with _min_mom.
Is it possible to synchronize transport heli module with playable AI units in SP? I tried synchronizeObjectsAdd, but it seems to not work?
As long as you're not checking too often, you could use the Z axis of getPos to make sure it's not too far above any surface
true true
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.
Check the animationPhase of the wheel suspension =p
use velocity _vehicle isEqualTo [0,0,0]; because if it is not touching ground it soon will 🤣
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
so… you want vehicles in water?
I think players would reasonably expect bridges, piers, raised platforms, ship decks, train tracks etc to be valid positions, otherwise yes I would've said getPosATL
vectorMagnitude velocity + surfaceIsWater maybe covers everything.
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 };
};
stahp ninja'ing me on vectorMagnitude!
I'd rather go with exitWith, but no idea if it works well in select (should, afaik)
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; }
;
};
vectorMagnitude velocity _y < max_mom, please
even better thanks
you made me do it: https://community.bistudio.com/wiki/isTouchingGround#Example_2
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
what do you mean "more slingloadable", what is the use case
if you're talking vanilla hook 'sling load' then yes, probably mass related.
I want helicopters be able to sling load stuff they shouldnt
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
use setMass indeed
if they crash it's perhaps because of AI issue as in they don't consider the volume
but the mass will not drag the chopper down
wow that's elaborate...
I'm wondering though "BoatX", isn't "Ship" the base?
_vehicle isKindOf "Ship"
I think it says "true" if you hover over water surface in a chopper though, but hey
BoatX in Arma 3 I believe, but maybe some other class would be fine too
anything is a ship if you're brave
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".
that's not how you set up transports
iirc you need a support requester module first, which is linked to player
then a support provider, which is linked to both the requester and the heli
thonks, will amend
an MH-9 lifting a Hunter with setMass 200 without issue 🙂
maybe a mod resets mass once the vehicle is hooked (which doesn't detach the cargo but pulls the helicopter down indeed)
vanilla hook is dangerous... might try Advanced Slingload.
okey, I just picked up a Merkava with a little bird, weird
Cant I am using a module for AI by a mod.
amended, thonks! also fixed the "above water hover" or "in water parking"
Yes, I know, I have described it incorrectly. The problem is that only the player character (Leader) has the ability to request in SP.
brilliant! 💡
Okay so default game helicopters respond to "mass" but modded helicopters (CH-53 from RHS and CUP) dont care what "mass" you set
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?
use isNull to check if player object exists
though its probably better to use onplayerrespawn event script or something similar
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?
nil
ah perfect, thanks again kj
pro tip, sometimes, when there get to be numerous such arguments, I start considering key value pair options.
i do use hashmaps when such is the case. Thanks
hashmaps are love hashmaps are life
right but without all the HASHMAP hand waving in the actual call. internally I createHashMapFromArray, for instance.
or at least leave it up to caller discretion, i.e. _opts = param [2, [], [[], createHashMap]]
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
it's not, but when the args get rather populous...
Just curious, why 3 separate param instead of one params ?
i have a couple thousands items in a hashmap for STUFF haha, but yeah I understand the sentiment
legacy, I will first get stuff to work and the clean and "update"
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
for stuff? yeah, not doing it right... 🤣
sounds like the past 7 months of my life
good thing hashmap is wire friendly, can push it over the network 😉
can you? I always avoided doing so
I'm teasing, for stuff, right... I think it is possible, depends on the situation of course.
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
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
how big is a bigger data collection
I was*
oh
a cleaner system for a map with a lot of crap in it, but crap in the less despective way possible ofc
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
try loading chernarus redux as is and get all the objects in the map x)
why on earth would you network sync that
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
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
hence why i never consume caffeine
not a lot, I can assure you that
the one thing I can remember of that is how silly chernarus looks totally barren
anyone got code or method to make arsenal role specific
https://steamcommunity.com/sharedfiles/filedetails/?id=2955697477&searchtext= this is pretty good for vanilla
is there any way to detect if an object is a bush/tree?
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;
};
(nearestTerrainObjects [_object, ["Tree", "Bush"], 0]) isNotEqualTo []
Not sure rn but can namedProperties detect it?
Yes, that's much faster!
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};```
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.
(_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.
Does anyone know how to disable the carrying/dragging function of chairs while still keeping the sit commands?
[this, false] call ace_dragging_fnc_setDraggable;
[this, false] call ace_dragging_fnc_setCarryable;
Can I put that into the Init section on the object? I had also read something similar to this that wanted me to make a whole .sqs and have it go look at that, pretty much stuff thats above my current skill level lol
object's init section will be fine I think
Apply gives you the combined returns
Yes but for this use case you then have to count them, which is less efficient than using findIf as described
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
waitUntil {_uav distance2D _targetPos > 0 && _uav distance2D _targetPos < 15};
distancecannot be negative
_uav move getPosATL player?
this would be correct right?
waitUntil {_uav distance2D _targetPos < 15};
it doesn't respond, it could be because the drone is not in my group?
yup - eventually with a little sleep 0.01; before that
no, a UAV should be in its own group
creating helipad and using land command might work better.
it works now i guess it was because i used waitUntil wrong, thank you 🙂
I'll try it, it might be useful in some cases
lol so this is perfectly valid code in carma
test_func(123)[2](444);
i wonder if flyinheight alt syntax lets you do negative values
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
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."
Anyone know what to do?
how are you calling it?
through an addaction
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
humm , those ACE items valid/loaded?
i think so! I'm able to get them from an ace arsenal box.
ok
Can use them also, but not sure if addItem works for them
problem seems to be canAdd, not sure why
can I remove it?
not really
or use it with something else?
not sure how else to check if the player has enough inventory space
add some logging to the code: ```sqf
systemchat format [">> %1 %2", _player, _item]; // Before canAdd
sry ive never used that before...I'll add it before canAdd and test it? what should I look for?
like systemchats?
actually use systemchat instead
ohh
Not really sure how to ask this - is it possible to "replace" (stream?) an rsc to a texture selection?
Spectator
I guess a better way to word it would be, is it possible to put a display inside of a texture selection?
@proven charm
should be working then right?
i dont understand T_T
oh actually idk what bis_o2_4722 is
thats not player... 😮
yeah weird one 🤔
is that code running in server? idk player should be null in server
oh wait actually, im testing it in local MP
should I test it in server?
havent uploaded the mission file to server yet
Idk how Ace works but I think it should work in client
At some point yes you should, but not for this reason
maybe the uniform just cant hold items?
i tried that though...tried a few different uniforms and made them empty
also the MRE's from arsenal fit too
o right
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
i mean
"ACE_MRE_MeatballsPasta_Item" is a CfgVehicles class. WeaponHolder with the food inside. "ACE_MRE_MeatballsPasta" is CfgMagazines CfgWeapons one 🤷♂️
I think its starting to work! Thank you! It's not saying "Not enough space" anymore if I have space and if its full inventory it says "not enough space". The item isnt going into my inventory though. But I think the canAdd works well now?
do i need to assignItem too?
on my machine addItem adds MRE to inventory and assignItem removes it 🤷♂️
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.
If you createVehicleLocal an ammo that produce submunitions, are the create submunitions also local?
bad question, type ammo is always propagated
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?
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...
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
In case someone else needs this, displayName is property I need, so for a particluar building type I do this:
getText (configFile >> "CfgVehicles" >> "Land_vn_house_small_02_f" >> "displayName")
which returns "Brick bungalow", which is perfect.
Yes, compatibleMagazines works with modded weapons.
All you need to do is resolve the weapon selection first.
e.g. (simple example)
_randomWeapon = selectRandom ["class_name_a","class_name_b"];
_magazineClass = (compatibleMagazines [_randomWeapon,"this"]) select 0;```
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.
I'm not sure it's guaranteed that P3D name and classname will share a pattern like this. A lot of the time they do, but they can be different, it's not a hard restriction and the author might decide not to follow it.
Yeah, I was afraid of that. I'll be mostly good, and for those that don't work I'll just show the file name and strip out prefixes and suffixes, and substitute underscores with spaces. For the important objects I care about this will mostly be good.
you can always check if the config exists, and if not just use P3D name
That's exactly my plan.
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.
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
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.
Yeah I noticed that too, but either way even if I use addMagazines, they still have 0 ammo, no mags at all
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 { ...
Try replacing [_choosenWeapon, "this"] with [_choosenWeapon, _choosenWeapon]. In theory the muzzle name "this" should refer to the default muzzle, but IIRC in some contexts you have to explicitly refer to it by the classname.
It's spelled "chosen" btw >:|
Lmao yeah, I had already written it like 19 times before I noticed and im too lazy to fix it now
✨ Find & Replace ✨
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
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
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
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
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];
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];
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
Yeah that checks out
//Unsure if it shows to all players or not
Alsohintis local effect, meaning it will only show on the local machine, in this case, the person using the action
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.
I see, thanks guys! Yeah I want the hint to only show to a single person. Ill remove the comments, the object is just a computer
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
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.
I see, so if I just run it on init.sqf everything will run everywhere, wouldnt that cause some duplication errors?
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
Well, I just want everyone to see it. I though remoteExec is the way
So, I either do remoteExec, or I run the script in the init.sqf? But even with remoteExec its still local
You can:
- Run the
_object addAction [...]code in the object's init - Run the code in an
init.sqffile
If you do either of those, you don't need to remoteExec adding the action, because those both run of every client
Remote Exec is the way, depending on where your code runs
If your code runs on one machine and you want it to appear on all machines, then yes you could remoteExec it
I did, but it still only showed up for me. I have a quick little scenario to explain
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?
File y will be executed locally
Anything in file x that is not remoteExec'd, will be executed locally
But then, if I execute File Y using serverInit, its all server side, so would using remoteExec actually work
I see!
So, any idea why this wouldnt be shown to all players?
I read that the number at the end of "addAction", plays a role in that
The number is the target for the remoteExec, 0 means global (server and all players), 2 means just the server, etc.
So, does 1 mean all players?
I have never seen a reference of what 1 means, if anything.
-2 means all machines except the server.
So, best I put it on -2 to avoid dups right?
No, you should use 0 so that it works on localhosts.
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
^
Try putting the addAction in just a init.sqf, and don't remoteExec it
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.
Oh lord. Ill of course need all my code to work for even players who arent connected so, I need to use JIP?
Add true after the 0 in the remoteExec, ... remoteExec ["addAction", 0, true];
So, If Id like all my addActions spread across multiple files to work for players that just connected, what would I need
Will try now
Although actually you wouldn't need that if you did it on the initPlayerLocal
So, right now Im starting the script in serverInit and I can confirm I cannot see the addAction
I added the true as well
It may be due to what John was mentioning
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"
];
Will do
No sauce doesnt work
Can you send the file?
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
can you elaborate on this?
This is all I've got right now in the init of the object:
this attachTo [o1_1, [-0.12,0.08,0.08], "lefthand"]; this setDir 180
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.
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.
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).
It was only for sake of simplicity of the code. I guess Ill compare with getstamina and change only when getstamina and logic is opposite.
Done, see: #production_releases message
Can you add the ability for it to not throw flags on macros?
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 ?
side of a captive or dead unit is civilian. Use
side group _unit
https://community.bistudio.com/wiki/side
Yea that was it. Thank you very much.
Flags on macros?
Undefined variables, or syntax error flags. Red squiggle lines lol.
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 🤔
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 "";
Thank you, I did this:
__ctrltargethealth ctrlSetText format ["%1 %2 Health", round _targetHealth, "%"];;```
why the double underscore and double semicolon though
private _targetHealth = (1 - (damage cursorObject)) * 100 toFixed 2;
__ctrlTargetHealth ctrlSetText format ["%1 %2 Health", _targetHealth, "%"];
I thought _ meant private
it means local
Oh
Thank you. So basically, the guy who coded the mod shouldnt have used __ but instead _
yes, double underscore means nothing special
perhaps it means "super private" who knows
not a stupid question 😉
the engine behind it is in C++
the language itself was not based on anything, just created "like that"
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.????
non zero based index?
Thanks, I think this should work: ```_targetinfo = str(cursorObject);
if(_targetinfo find '.p3d' != -1) then {
_targetinfo = _targetinfo splitString ".p3d" select 0;
}```
I raise you myp3dfile.p3d_lolIgotcha.p3d 😛
hmm
(just kidding, the "chance" of this happening is 0 :D)
can anyone show me a good example of try/throw/catch in sqf?
You have a point tho lol
_targetinfo = _targetinfo splitString ".p3d" select 0;
_targetinfo = _targetinfo select [0, _targetinfo find '.p3d'];
@little raptor way more cleaner. So what exactly happens with the brackets []
does "string" select [0, -1] select everything?

Nothing
It's mostly useless
Why would it select everything
well you could still keep the if then 😓
[0, 10e9] does everything
just [0] 😛
Just "String"
Thank you so much for the input guys. I will try this and see how it goes
just so you understand how SQF works:
SQF uses operators. and it's not OOP so there are no methods (e.g. can't do "string".Trim())
and there are 3 types of operators: binary, unary, nular (sic)
binary: like a + b: _string select [0, 1] <- select is binary
unary: like +a : alive player <- alive is unary
nular: like a variable a: player
also SQF doesn't use the traditional parentheses-called functions myFunction(args...). it's args call myFunction
Ive found this also: https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
it's not widely used then?
Almost never from what I have seen.
excellent, i can worry about learning more important things then
its fucking pointless since it doesnt capture most errors
with call being just a binary operator. That takes argument(s) as LHS and function as RHS
so you ALWAYS have to throw
It only captures throws.
yah
I don't see what mods have to do with it beware of the confusion though ^^
If it would capture regular script errors it would be perfect.
yea, anything besides syntax errors and id be happy
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.
Hold my beer
I dont drink xd hehe
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
I started CSE with it. It got binned quite fast.
I bet there is no way to remove grass from some areas, via script?
spawn grass cutter objects
nice 👍 should they be deleted afterwards?
only available in the line its wrote on 🤣 🤣 🤣
I think you can, but IDK
test getting away/coming back too
ok thx
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
@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)
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})
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.
ive never seen a film grain effect in the rain
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
I think it's when it's night time and a bright light is shining through it.
And heavy downpour
you mean those flashing rain drops?! yeah they're a bit annoying 😅
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?
No, there seems to be actual film grain effect appearing when it starts to rain. It's not very noticeable, but I'm running a reshade that makes it more apparent and the grain effect makes my head hurt. I wonder if I could use post process scripting to get rid of it.
filmgrain ppeffectenable false?
What do you want to do with it, because there's probably an easier way of thinking about it
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
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
findIf works
I did this: if ((cursorObject isKindOf "Man" || cursorObject isKindOf "AllVehicles") && !(cursorObject isKindOf "Static") && !(cursorObject isKindOf "Thing")) then {
Seems to be working
use "CAManBase" instead of "Man"
Do you want to get rabbit health?
maybe hehe
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
ctrlSetTextColor
is there any engine condition for the image to be able to change color?
like specific base color or being transparent?
Not sure what's the question. Are you talking about a very specific UI?
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
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...
initPlayerLocal.sqf or remoteExecCall
goggles player
I cant do that, Ive got this in its own file
How can I remoteExecCall this line?
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
Its a huge script, ive got 10+ files at work and this problem is all over the place, I cant move all that into one file
I see, looks handy ill read it over thanks
not really, I mean as, literally, is there any binding for the image to not be changing color?
does it need to be transparent or be a certain color to be able to change it using crtlSetTextColor?
So, you mean you tried that and somehow it doesn't do anything?
yes
What color is that paa?
black
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
You can actually see some of official UI elements PAAs are simply white
Im sorry bothering you guys again, but how do I get if cursorObject is an enemy or friendly?
Make a function https://community.bistudio.com/wiki/Arma_3:_Functions_Library (or multiple functions) and activate the function from initplayerlocal.sqf
private _isEnemy = [cursorObject, player] call BIS_fnc_sideIsEnemy; Like this? or Do I need to get something from cursorObject ?
side cursorObject and side player
And note that [A,B] call BIS_fnc_sideEnemyand [B,A] call BIS_fnc_sideEnemy are not always equal
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]};```
Well, he didint say much, he mainly posted examples
There arent explanations how to apply it to each element of an array
There is
Can you show me?
If you red the pinned post that's it
I have indeed read the pinned post
The first three codes are the most important explanation
I did exactly that
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
Since in the example he set it to quotes as well, I though it reads the string and executed whatever is in it
He never said so
He never said many things, so I went off his example which is literally this sqf [_target, "UNLOCKED"] remoteExec ["setVehicleLock", _target];
"UNLOCKED"
Because there is nothing else to explain
"Clearly there is" then suggest
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
Well not even sure that is a valid "confusion"
cool
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?
No need to
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
Because you did read something that is not written

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
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.
Yeah, I just removed the quotes. I realized that, but he didint
. I pretty much said the exact same thing as you did after he asked me to suggest
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.
I never said it needs to be convered to a string wtf??
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
I am referring to this
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
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.
Brother im not reading all that, sorry
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.
Your paragraph isnt about SQF rather some completely misunderstood situation you obviously are clueless about
and for whatever reason are desperately trying to drag out by writting an essay
brother go troll somewhere else
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", ...];
Yep, I know, thanks
^^^
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
is there some way I can discover the presence of a loaded mod? other than perhaps scanning missionNamespace for functions.
or checking for class in CfgPatches being present
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;
just one isClass (configFile >> "Cfgpatches" >> "some_acre_class") is usually enough, thb
Sometimes I wish hashmaps stored order of added keys
It is not “Hash” anymore :>
https://community.bistudio.com/wiki/Arma_3:_Scripted_Database
You can probably use this, or maybe store the key index in your HashMap
How would I do a script that could place a marker on a player not moving for an extended period of time?
(values _settings) params (keys _settings); 
I'm doing a form of hide and seek game mode and trying to make it so that after about 3 minutes of not moving a hider can get marked on the map for everyone
Sure there are tons of ways to script around it, right now I simply store an array alongside the hashmap in case I need to keep order of keys that I added into the hashmap
Just wishing there to be an internal order list accessible somehow: ARRAY = orderedKeys HASHMAP or something
Ded would simply say nu
Yeah, not at this point of hashmaps being a thing anyway
Yeah I sometimes wake up from weird dreams too
Try this (execute locally per player, e.g. initPlayerLocal.sqf)
https://pastebin.com/UVjTr9rM
note: I'm stupid and dIdn't change some kos_var_ global variables to local variables when I decided to change halfway through. The _localVariableNames defined at the start are correct.
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
Thanks a lot!
best way to escape quotations?
i'm writing player profile/steam id to db and i know Mr. '"'"'"' will come
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];
why not sqf this addEventHandler ["HitPart", { (_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"]; }];?
Why do you need to do that cant you get projectile from handle damage ?
"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
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
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
"Dammaged" doesn't have that caveat listed
so the projectile object isnt really accessible in realtime (handle damage)
and the damage-dealing projectile object is local to shooter's machine anyways, other machines have non-damaging copies 
yea nice, i wonder if that fires before or after handle damage ...
"HandleDamage" also has "_projectile" passed as argument, yeah
although only a classname, not the actual object
yea not so useful. we can get class from object, but not object from class
what do you expect to do with that object afterwards, though?
i just want to get the velocity and vector
and what next? Would that be used in "HandleDamage" to calculate the override value or something?
eventually yes thats part of it
yeah, that's a problem
at the point of "HandleDamage" velocity can return 0 if the bulled doesn't penetrate the unit in question 
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. 
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)
"[""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])
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]]];
uhm, why multiply by 3.6?
ah, yes, 1 m/s == 3.6 km/h, derp
m/s make more sense here tho
is there a way for me to control a turret zoom with script?
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.
in "CfgPatches", what is "some_acre_class"? not one of the radios, I gather?
also, however, it is sort of the point, modules or what not can change between deployments, can they not? has to be robust to change in that regard.
could be missing something there?
it's a rough draft, TBH. especially the class verification.
however, points taken re: the patches issue. problem is, I'm not that confident we can depend upon some name or another "being there" from one release to the next.
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;
};
class names in CfgPatches are the same class names that are checked by requiredAddons[] in mods' config.cpp to decide the config load order. If they aren't stable enough for your needs - pretty much nothing is 🤷♂️
you can also get them by running configSourceAddonList (configFile >> "CfgWeapons" >> "ACRE_PRC343") for example (or for any other config class from mod)
Greetings everyone, great morning to all
it doesn't have a name yet
well true nothing is full proof I suppose. points well taken re: the configSourceAddonList approach.
work in progress, balancing that with reasonable performance.
Is there a way to check if a mission (SP) was restarted?
https://feedback.bistudio.com/T156689
👆 thats why im asking
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
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?
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.
I don't think that's something you can get from script.
or config? I'll have to do some digging I guess...
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.
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.
@granite sky do you have any ideas on this question: #arma3_scripting message
yes it just copy pastes it in
If no better ideas, I may temporarily wall off the building using invisible wall objects.
it will not optimise your code's runtime either, only its compilation (iirc)
Try having the destination be 1000m above
Interesting, thanks, trying now..
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.
Dude, you rock! That solved my problem. I am super stoked. Thanks!
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
Those aren't user inputs though?
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"
What if they enter test?
it will be "test"
_string trim ['"',0];```
?
Do you want the output string contents to be "test" or test?
with no quotes in it?
with quotes
gives up
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
I want to compile it in the end as code
str it
oh wait, you can't do string select :P
according to example 4 you can?
You can't use parseText because it returns Structured Text, not string
I've got a pretty good feeling about this. I'm launching the game to test it but you could, too.
[compile "deleteVehicle myVehicle", compile """deleteVehicle myVehicle"""]
///
[{deleteVehicle myVehicle},{"deleteVehicle myVehicle"}]
this is why I need them the same
Thing is "test" is valid code.
you can get path lod points with _house selectionNames 4e15. looks like the entry points are named in1, in2, ...
that could actually also be good for having garrisoned AI looking the right way xD
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.
This will do what you want unless there are quotes in the middle as well. Then it breaks.
You might need some sort of input validation or restriction.
Also it doesn't handle single quotes :P
yes you can do
#define ARRAY1 [1,2,3,4,5,6,7,8,9,0]
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 ?
You could. But it wouldn't be any "code optimization" besides maybe readability
You get Error Undefined variable in expression errors from action button context, yet canSuspend is false? 🤔
canSuspend and undefined errors are separate flags
Thank you so much for the replies guys, I will def do that
Any other contexts where this flag is on apart from scheduled threads?
Just curious
probably
Ok I used the define properly. Now I need to get nearEnemies, theres no such method except for : https://community.bistudio.com/wiki/nearTargets
CBA_fnc_removeDisplayHandler, but you'd probably need to store the IDs when you add the handlers.
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;```
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.
Normally you use CAManBase rather than Man because the latter includes goats.
right goats snakes rabbits flies other ambient "life"
the goats are not what they seem
huh I think see, inM being the exits, "posN" being the positions. very good very good, I like that a bit better.
Im out of ideas to what include in my hud information. hmm
The less HUD the better
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
has huge HUD block in the corner, kill feed in another, shows icons over all players, laser designators and other crap on the screen
idk how hard it is to do it
cursorObject might not be reliable but you can start there
I'm lost on what a losangle is
Sorry, English isnt my mother language
setTurretOpticsMode
You probably want drawIcon3D
Got it, let me check wiki
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]; };
Why does https://community.bistudio.com/wiki/drawIcon3D uses addMissionEventHandler ?
Does it mean after I call it, it will keep rendering forever?
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
You can remove the mission event handler later if you need to.
@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 }];
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.
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
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
sorry for interfering but its a question releated to draw3d, is it possible to draw a circle like progress bar,
i know there is this https://community.bistudio.com/wiki/progressSetPosition and i can already create a progress bar with it but would be nice to have a circular progress bar
I add this only once, right?
I liked the kill feed idea. Will work on that next.
Appreciate it. Yea i figured. Another question how are thse black cirlces made is this just a overlay picture or is there a way to do that with out a picture ?
https://www.youtube.com/watch?v=rqTOSfbJs8s
Natively there is no support for circular progress controls sadly.
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.
i think the holdAction works like that right?
You can probably find the hold action functions, or at least the UI elements, and re-engineer it yourself
Hold Action uses a series of images that indicate the progress in %
yes i think it 24
i can use currentVisionMode
is there a way to set the currentVisionMode
Unless you are retreiving the playername from the database. You really don't need to worry about escaping quotations
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.
you using getpos?
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"];
};
}];```
https://community.bistudio.com/wiki/Arma_3:_Actions#NVGoggles although you probably want HMDs idk if there's a way to cycle with those
You can just toggle it on/off, there's not a way to cycle them
yh trying to set the thermal mode of a turret
@graceful kelp Im trying it rn. Thank you so much
then setTurretOpticsMode shouuuld work
depending on how its set up anyway
Now the square is on top of the enemy, Im trying to get it on the center of the enemy body.
Using aimPos (returns positionASL) to get a position for drawIcon3D (uses positionAGL) is not recommended
Thanks for the reply, Hmm. Ok. What do you suggest?
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.
any one have ideas how to fix this shit http://www.youtube.com/watch?v=8-Y3urqfda4
Rewriting the game's physics engine would be a good start :U
i was expecting little less brain dead response, maybe like Hit EH
Thank you, I will try that and let you know how it works out. Im just wondering what will happen if the soldier is proned xd
It's fundamentally a symptom of issues with the physics simulation and can't truly be fixed.
You can try using EpeContactEnd EHs to detect excessive velocity after an impact and reset it, but this means adding such EHs to all objects you want to "fix", and may be unreliable or produce false positives.
i will be retrieving them
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.
BTW, you should think about adding a semi-transparent background, or text outlines, to your HUD texts, as they're difficult to read against some backgrounds
i'm guessing toString + toArray would be the easiest way?
Like this? drawIcon3D ["UI\targetIcon.paa", [1,0,0,0.75], cursorObject modelToWorldVisual [0,0,1], 1, 1, 0, "Target", 1, 0.05, "TahomaB"];
Assuming you've put it in the position parameter of drawIcon3D (I don't remember what order they're in) then yes
ok so we have toArray, which gives us the number of a unicode character, but there's no function to do the reverse?
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.
What to put in the Init on a helicopter to have unlimited fuel? Eden Editor.
You probably can't set it to unlimited, but you can surely re-fuel it. Repeatedly setting fuel to 100%. https://steamcommunity.com/app/107410/discussions/17/2828702373010029713/
If the heli is doing loops through waypoints, you can put the set code in the on activation field in one of them.
How do you prevent the helicopter crew from disembarking helicopter?
you mean after it's immobilized or what?
thank you
If you talk about disembarking on waypoints, then use TRANSPORT UNLOAD - unload only other groups from the cargo space, instead of GET OUT - all units including piloting crew will get out. There's also simple UNLOAD - that means unload units of the group of the piloting crew in the cargo space, but not pilots and gunners.
In which situation are they disembarking? Are there any enemies nearby? And do you mean pilots as the crew?
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
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)
Post the part that produces the error
[] 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)
You spawned so the _bflag is undefined
how would i define it if it were spawned?
_bflag setVariable ["OPTRE_CTF_Flag_RedTeam", 1, true];
?
||idk what to lookup for this XD||

[_bflag] instead of [] before spawn
Danke
and params ["_bflag"]; after spawn { :3
would i need to do that for all of them?
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" 
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)
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)

||my tired brain no understand, but ty for helping. maybe awake longshot will be smart XD||
Take a sleep is a part of struggle
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!
what happened to your promise?
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.
So, like, if the variable went more than the certain number, something will happen?
Yes. I mean that when bots or a single bot is under heavy enemy fire, there will be a surrender.
https://community.bistudio.com/wiki/fleeing
Mmmmaybe this. Or, you can use
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Suppressed
For more advanced scripted solution
Don't take my impertinence ( more like stupidity )
Give me an example in strings. Please help me to understand. I am in scripts at an intermediate level.
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
Thank you very much! I will check a little later and write to you.
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?
It means the unit you are checking on needs to be on the machine (that checks). So if you are connected to a server and use it locally on your machine to check it on a unit that's owned by the server, you will get unknown results.
Can I use https://community.bistudio.com/wiki/targetKnowledge instead?
No info is given about the locality so I wouldn't know. Try it and report back if it works 😅
everything works in SP , it's the dedi-client where locality matters
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?
A one size fits all that fits all machine combinations (listen server, dedicated server, clients, headless clients) is to have a restriction on your code and globally execute it with 0.
if (!hasInterface) exitWith {};
// more code
from the wiki (about the remexec target parameter): Negative number: the effect is inverted: -2 means every client but not the server
this cancels out listen servers which is what he would like to include as well
aka menu hosted servers
oh not sure what is the goal then
he wants to exclude anything without an interface, dedis and headless
ic
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
from what i understand lobby commands are very limited
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
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.
create a function and register it with CfgFunctions, then remoteExec that function
then I would have to call two function instead of one
That seems to be a bit redundant to me.
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
Basically I need what is between start and end to be called in the remote, but in one sqf file, preferably.
I mean, i dont want to do the remoteexec in the trigger right away.
let me see all you want to do so far. or is that it in the image?
Trigger -> missionEnd.sqf -> remoteExec
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
OK, so if I for example assigned the code to a global variable, then I would basically send it over network too.
yes, and if you have a long set of code/string to compile, that's a lot of info to send over the network
How do I discern local global tirrger, as you mentioned?
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
};
Ha, ha, ha 😄 first time I noticed this option, I will need to reevaluate all my triggers then.
its off by default usually
So, basically I am running all my code on the machine which triggers the trigger, if it is unchecked?
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
Even better
It will probably be best to do everything on the server, since I coded it all that way.
if so, post your finished code and i'll check it
Thanks a lot, I will ask if I need something else. I think I will be good from now on. I had been doing SP only up to this point, so I had to adjust my thinking a bit for it.
A good rule of thumb is
UI and Sounds Clientside
Calculations/Loops/etc Serverside
You want to offload as much as you can off the clients so they have the best experience.
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?
are you sure?
positive
from what I see it accepts strings
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
// 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 
bin_fnc_deconShowerAnim
conflicting syntaxes 
well yes. if it's not an object that parameter can only be an array (pos)
SQF simplicity stops being charming at like 6-8 command parameters 
thanks, it was the object being undefined,
where can I find the underwater breathing function/script? couldn't find it.
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.
It would likely do nothing. The server usually just ignores UI commands.
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;
};
add in a surfaceIsWater and posASL z < 0 check for underwater
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
are you making a config? or a script?
I'm making a config.ccp for a faction modpack
hop over to #arma3_config and i'll help
actually this is not for underwater, it is if a player wears a respirator
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
You gotta be more precise with what you actual problem is and maybe even show the script here 😛
ye was trying to find it but got lost XD
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
found it!
_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)
I don't see how the difference of eden/mp would cause the UI to change it's position tbh 
i dont either but it do XD
(dat imgur is has a couple images)
You could save the position to https://community.bistudio.com/wiki/profileNamespace or https://community.bistudio.com/wiki/missionProfileNamespace and then load it again.
Maybe it's something with remoteExec, try to make it a client function instead of remoteExec
hmmm, aight
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.
remoteExec to server only.
No JIP.
(Not that JIP makes any sense for server target)
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 🙂
It has SE on the page, which means it only does anything when run on the server.
(enableSimulationGlobal is weird though)
How can I access player's namespace in MP?
You mean the namespace of the player object or like missionNamespace on their client?
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";
You're broadcasting safe zone values from host to everyone else. Each client has their own and have to calculate UI coordinates locally.
Whitelisting by player name is a bad idea, there is UID for that. What's your goal anyway? Only let certain players get into vehicles while everyone else only has to be on foot?
Well yes but no
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
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.
(Fixed checking for passenger instead of driver)
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
I feel like that's what getOrDefault is meant for
But I need to know if value is nil specifically
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?
- Tell the entire script
- 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.
You want to use _this#0 within addAction
https://community.bistudio.com/wiki/addAction
Or use params ["_unit"]; to declare _unit
RPT files in %localappdata%\Arma 3\ will show you proper error message btw.
Why scripting error messages are localized anyway?
Because it is localized and font does not support Russian
You know what one of the iffy of Bohemians
Yeah, but why localize them at all? These errors aren't really user facing texts 🤔
Ask them 
Wish there was something like ENTITY = lastVehicle ENTITY or ENTITY = lastParent ENTITY
Doubt its stored in the engine though
Thank you very much, after a few tests and reading the BIS documents I have solved the problem.
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;
};```
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.
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.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
maybe someone can hint me in the right direcion or provide the correct syntax ? thanks in advance !
Yes every vehicle has a variable
Sorry was asleep