like there's this but I don't really understand how you'd script this https://community.bistudio.com/wiki/BIS_fnc_addSupportLink
#arma3_scripting
1 messages · Page 25 of 1
Hey I’m tryna come up art work for arma 3 how do I make the turret rotate
Editor modules:
Synchronise a Support Provider module to a support unit, synchronise a Support Requester module to that Support Provider, and synchronise a playable unit to the Support Requester.
Scripting:
That function you linked replicates that process, but you'll need to create the Provider and Requester modules first (with createUnit for modules, I think) and possibly call their functions too.
3 options:
- get in the vehicle and do it yourself
- put an AI in the gunner seat and use
lockCameraTo - use POLPOX's Artwork Supporter to convert the vehicle to a Simple Object, and then use the Simple Object Editor to animate it
Thanks
And one more question how do I retract the landing gear and the close the canopy of the plane or jet while mid air
4 options:
- get in the vehicle and do it yourself
- put an AI in the vehicle, and attach it to a dummy object on the ground using
BIS_fnc_attachToRelative[PROBABLY] - with POLPOX's Artwork Supporter installed, put
[this] call plp_fnc_simpleAttachin the object's init field - use POLPOX's Artwork Supporter to convert the vehicle to a Simple Object, and then use the Simple Object Editor to animate it
Does anyone know how i can make this remote execute onto a server? I need a variable to save and load onto a dedicated server.
profileNamespace setVariable ["ARSENAL_savedata", _datatosave];
[profileNamespace,["ARSENAL_savedata", _datatosave]] remoteExec ["setVariable",2]```
Bear in mind this will create one variable in the server's profile namespace, named "ARSENAL_savedata", which contains only the latest data saved to it. If you're trying to save separate data for every player, you would want to either create a hashmap on the server and have each player save data to it with their UID as the key, or create separate uniquely-named variables for each player.
should use the mission profile namespace or whatever the new thing is called
turns out, checking uniqueness in an array index pero each item added is not ideal. Got to loop +300k items in <1min now.
Conclussion: optimization and ideal placement of sorting, do not sort while adding/check for uniqueness while adding in incredibly huge arrays
Q: awhile back I found a blurb that claimed objectParent might be faster than attachedTo for purposes of determining is an escorted unit attached to whatever, escort (player), transport vehicle, etc. but I am finding that it returns objnull, whereas attachedTo correctly returns the player? not sure the conditions or parameters of that claim...
but as it stands, that does explain some things about some (unexpected side) effects I have been seeing, or expecting.
(units player - [player]) params ['_x'];
[objectparent _x, attachedto _x]; // [objNull, player]
So then the question is, would attachedto work for purposes of examining 'simple' captive being loaded in a vehicle? i.e. 'moving in' to a vehicle is the same as attaching the unit?
If you want to know if they're in a vehicle, just use in. Or if you don't have a direct reference to the vehicle, vehicle _unit == _unit will return false if they're in any vehicle
cool thanks
@kindred zephyr That's one of the situations where forcing stuff into hashmaps makes sense.
Not sure I understand the situation though. You have 300k objects?
sadly, this array is not fit to be a hasmap, its literally a list to iterate over and would cost me more
I probably have like 2 mil total
I mean as a replacement for pushBackUnique.
Trouble is that you can't use objects directly as indices.
netID works in multiplayer but not SP.
BIS_fnc_netId and BIS_fnc_objectFromNetId?
nah, the issue was not really on that relation, but that the iteration itself from the loops got progresivelly slower, but I already fixed it 😄
I'm curious what your current code is.
Anyone know why the command createVehicleCrew (_this select 0) doesn't work with the vehicle respawn module or on the vehicles? Just tried this.
print _this to see if it actually holds the correct value
How do I print _this?
systemChat str [_this]
Do I put that in the init of the respawn module?
put it where you put the createVehicleCrew
I'll try that. Thank you. I'll keep you posted.
@copper raven nothing came up,
I put it after the createVehicleCrew (_this select 0) command.
Vehicle still respawns without crew
What is the system chat supposed to show/tell you?
I get the entries from a range of 0 to 2mil according to context -> check their uniqueness separaterately -> make the variable avialable to clients -> do stuff with the variable.
ITs just a nearesTerrainObjects but specific 3pds and that it, not really complicated but highly ineffective in the original form (from 20 minutes to 2 at most).
Array intersects its to heavy for it to work on such a large array, so I sort and check for closeness back and front each index
that means the code is not even getting executed
so what else can i do to make my vehicles respawn with ai like they should?
IDK, i've never used that module
well, thank you for your help sharp. i appreciate the attempt.
Bohemia Interactive Forums
Hello !! I need your help because I try to respawn vehicles with init (arsenal, vehicle configuration (color, seats ...)) Currently I use the modul of respawn, after destroying the vehicles respawn but without the init, so he respawn the wrong color, without being an arsenal ...) Thank you for yo...
are you using this Expression field?
// scripts\door.sqf
params ["_obj", "_target"];
_obj addAction [
"Open Door",
{
params ["_obj", "_target"];
titleText [nil, "BLACK OUT"];
playSound3D ["\SWLB_core\sounds\door_open.wss", _obj];
sleep 3;
player setDir (getDir _target);
player setPosASL (getPosASL _target);
playSound3D ["\SWLB_core\sounds\door_close.wss", _obj];
titleText [nil, "BLACK IN"];
}
]
Working on a pretty basic script, basically you pass what object you want the action to be added to, and the variable name of the object you want to be teleported to. Currently, everything works but the teleporting, you just fade to black and come back in the same spot. I have a feeling I'm passing the variable name incorrectly.
inside script knows nothing about the outside _target
try sqf // scripts\door.sqf params ["_obj", "_target"]; _obj addAction [ "Open Door", { params ["_obj", "_caller", "_actionID", "_params"]; _params params ["_target"]; titleText [nil, "BLACK OUT"]; playSound3D ["\SWLB_core\sounds\door_open.wss", _obj]; sleep 3; player setDir (getDir _target); player setPosASL (getPosASL _target); playSound3D ["\SWLB_core\sounds\door_close.wss", _obj]; titleText [nil, "BLACK IN"]; }, [_target] ]
Yep, worked like a charm, thanks!
Why is it that _obj works but not _target?
https://community.bistudio.com/wiki/addAction
Game passes some arguments to the action script and the "object which the action is assigned to" happens to be first in that list. And then your params ["_obj", "_target"]; assigns _obj name to it.
The second thing in the list is the unit that activated the addon. So your params ["_obj", "_target"]; assigns the _target name to it. And then teleports the player back to their position :3
params is no magic, it's just "take whatever was passed to this code/function and assign these names to it"
Yeah, I guess I just missed that addAction "sets its own params" (I know that's not technically correct but I hope that makes sense)
Hi, Is there any guilde/ example i can define own keybind to action?
https://community.bistudio.com/wiki/Arma_3:_Modded_Keybinding Trying solve this, but i didn't get how i should do it
define action, is it some engine action or something you scripted? etc
Yeah, i think , that. but i do not how to define.
Like if i want right shift button + -
I just want get keybind to open GUI
like in example
// adding event handler
(findDisplay 46) displayAddEventHandler ["keyDown", "_this call functionName_keyDown"];
// function definition
functionName_keyDown = {
params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
private _handled = false;
if (!_shift && !_ctrlKey && !_alt) then {
if (_dikCode in (actionKeys "NetworkStats")) then {
systemChat format ["EH fired for %1", _ctrl];
_handled = true;
};
};
_handled;
};
?
Awesome, thanks alot
is there an "allObjects" syntax which is faster than allMissionObjects "weaponholder"
Yeah, some reason if (_shift && (_this #1) == 12) then {}; doens't work, but i changed it to arrow downif (_shift && (_this #1) == 208) then {}; and that works. Thanks alot for help.
Minus (on main keyboard) Graphics DIK_MINUS 0x0C 12
_ ArrowKeypad DIK_DOWN 0xD0 208 DownArrow on arrow keypad_
_this is not this
this is not defined inside the event handler 🤷♂️
and _this#1 is already named _dikCode
Ye, in my code those is. Edited to text too.
and if (_shift && (_this #1) == 12) then {hint "werks";} does hint alright on my machine 🤔
Hmm
I do not even have any mods on
are you using main - or numpad one? Numpad minus is 74
strange. Maybe try to systemChat str _dikCode; at some point and see if you get a different return value 🤔
Yeah, this is what I test next. To get correct number
I have a issue with my mission where some units wont react to hostile presence if the mission is loaded on our dedicated server.
The unit appears with the yellow "empty" color when looking in zeus.
The only think that I changed is put on dynamic simulation and added doStop this; in their init box
it works fine when i test in editor
if I want to make it so my players pick up an item and they activate a diary record as intel will this line here work
objectParent player == d1;
d1 is the object (I use a usb item from a mod)
few questions:
- What is the name of skipTime variant that automatically plays the "Some time later..." screen? Can't find it on BIKI, I remember someone mentioned it in one post on Forums but I haven't found that one message yet. I'd rather use that function instead of scripting this myself.
- Player can change his head/eyes position in vehicle with Ctrl+PgUp/PgDn, can I alter this through a script (so set a certain head position) or is it exclusively player-only thing?
BIS_fnc_skipTimeBIS_fnc_setDate- no AFAIK
Neither. d1 in this context is an object, not an item, more specifically, it is just a “weapon holder” not the item itself
You need the classname of the inventory item (DIFFERENT from the classname of the ground-placed object), and then you can check that with either items or magazines
- it will be either
itemsormagazines, not both - the wrong one won't work
Nope
8 allObjects 0 plus a select to filter weapon holders out, should be faster i think?
Most inventory items are just "you have x items of type y" and not real persistent things
if I put a item on the floor and pick it up is the floor object dead per se
maybe I could try !alive
sorry if it is stupid
if they're in seperate holders, you can "differentiate"
An item can't be named. You only can name the “weapon holder”
but if a unit takes them both, then no
"select" and "faster" rarely belong in the same sentence, tbh
Nice
I think it worked cause in order to put the item from the floor to the inventory it kills the object with "deletevehicle"
i know... there needs to be a classname syntax added to allObjects, like "myType" allObjects [8, 0]
Virtual holders are usually deleted when they're empty, yes
ok then it works as stupid as it may sound
You can also look into things like the Take event handler if you want to do interesting stuff like identifying who specifically took it, or tracking it being taken from a crate with multiple items
BIKI states that Hold waypoint can be "skipped" through a trigger or a script command, that command is to just remove that waypoint or is there something else?
Will this
[this, ["Pick up knife", {deleteVehicle d2}]] remoteExec ["addAction",0, true];
give only one new action or stack a "Pick up knife" action on the object for each player
d2 is a bloody knife from my mods. I use it for a murder mystery op
is there a way to prevent selected players to be able do turn vehicle engines on or to drive vehicle ? I mean except setFuel 0 or setHit ["HitEngine", 1].
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Engine
This would do I think
thank you so much !
will my line work and show one action across my players or show one action for each player when interacting with the object?
placed where?
It has this so I suspect it's in the init field of the knife object.
Code in init fields is executed on all machines at mission start or when they join the mission, so in this case you do not need to remoteExec - the remoteExec command will be executed by every machine, broadcasting to every other machine, resulting in duplicate actions.
oh
then how can I make it show the action only once so any player sees only their action on the scrollwheel and not
"Pick up knife"
"Pick up knife"
"Pick up knife"
ok, so using doStop this; on a unit will break it on a dedicated server and it shows up as "empty" if you look at it in zeus.
anyone know a workaround for this?
simply don't remoteExec it. Just use the addAction command without remoteExec.
will it work in mp?
Given that:
Code in init fields is executed on all machines at mission start or when they join the mission
why would it not?
oh ok
I saw this in the addaction wiki page
[_object, ["Greetings!", { hint "Hello!"; }]] remoteExec ["addAction"];
let's say 10 players join... will they see 10 greeting actions or one each
sigh
// create object on the server and add action to the object on every client
if (isServer) then
{
private _object = "some_obj_class" createVehicle [1234, 1234, 0];
[_object, ["Greetings!", { hint "Hello!"; }]] remoteExec ["addAction"]; // Note: does not return action id
};```here's the full example
don't remoteExec it
ok
if (isServer) means it'd get executed only once. On the server. 🤷♂️
try 0 = this spawn {doStop this};, I always used 0 = this spawn {doStop units _this}; in groups init and never had any issue with these units
doStop causing units to appear empty is fairly well-known. Never had it actually break them though - despite appearing empty they still behave normally (other than being stopped).
0 = is not required, for quite some time now 😄
I haven't used it since then 😛
ain't gonna change what ain't broken
think of all the bits that could be saved!
all three of them (literally)
...and that's why every script that used to exploit the pre-1.94 waitUntil nil handling now generates script errors :D
errors -> broken -> fix it 🤣
I mean before the change. It always needed fixing - it relied on undefined behaviour but no one wanted to fix it because it didn't generate errors and "wasn't broken". Then when BI fixed the undefined behaviour...
I work with the F3 mission framework. Old versions of the framework used that behaviour for their unit marker script, running that check something like once every second or two. We have a large archive of old missions that are now massively irritating to play if you have script errors turned on, because people back then didn't fix what "wasn't broken".
(We also still have some people who complain about BI fixing it...)
Posted on September 20, 2013
Killzone_Kid
In case you have more complex code inside waitUntil loop, to be on the safe side always return boolean at the end of the scope:
if i go somewhat back through the page versions on wiki, though
and (obviously) no mentions on bool return being mandatory 🤔
it wasn't UB though was it? if you returned nil, then it would keep checking?
until the code returns true.
nil != true. Is that really UB?
thank you, that seems to work in my small test. I also had issues getting AI Path to disable correctly. Do you think it would work if I spawn that as well?
well, akshually 
Well, this is the change note that fixed it:
Fixed: Using waitUntil with nil made the script enter a state of infinite suspension
That seems fairly undefined
infinite suspension
what would waitUntil {false}; do?
Fail forever, presumably, but in a safe way
Perhaps "undefined" is the wrong word, more like "unintended". I think the point remains; it was always wrong code, it just didn't generate errors
If BI considered it worth fixing, it was probably doing something bad internally
i spoke too soon, while this spawn {doStop this}; did not bug out my units, it also didn't work as the units did not stay on position.
same issue with disableAi, also did not work on dedi for some reason..
this spawn {doStop _this};
ooh, missed that. thank you will try again
ok, seems like it is working now, but only sometimes. anything else apart from doStop i should do to make them stay?
the disable path worked fine now, but for these ones it is fine if they start moving after contact
what's the point of spawn there?
for some reason the AI breaks on dedicated server without it
but doStop makes units leave the formation and they wont' move with their leader, but they will still look for cover and engage (like search and destroy) enemies, it won't keep them in one place like in case of disabling pathfinding
that is fine, but in my case there are no enemies nearby
hm, noticed they are in aware stance, would that make them seek cover then?
have you tried putting that dostop thing in group's init?
no, but in this test case it is on each individual unit
Aware shouldn't make them walk around, it just puts them in formation + running speed
in Combat behaviour they change positions and stances.
if you could please check that dostop thing when placed in group init, as I said I didn't have any issues with AI when I gave their groups this spawn {doStop units _this};.
but at the same time I didn't use any AI mods, so maybe this is the case too
do you have ai mods
not sure if ACE changes ai, but i do have lambs as well
saw no difference unfortunately, might be lambs then
are you trying to garrison these doStop units? have you tried using lambs garrison module instead?
I'm placing them near some sandbags and bunker (manually placed) lambs dont seem to recognize it as something that can be garrisoned
Is there a way to do setObjectTextureGlobal on a helmet instead of the uniform? It has a hidden selection, I just don't know how to use it.
you can't do that to vests and helmets afaik
So there's no way to retexture them even if they have hidden selections?
you can do that through config, but it forces you to make a mod
according to some comment from 2014:
Vests and helmets are seperate instances. So far I've only been able to change the texture of the uniform (which is in CfgWeapons), but neither helmet or vest. Using (vest player) isn't going to work either as setobjecttexture takes an object and not a string. *I guess a possibility is to create the helmet / vest seperately, add a texture to it, and then add it to the player. *It's just guessing but worth a try.
so you could try but generally speaking and what people/biki say, only uniforms and objects with hiddenselections can be retextured with a command
you can only texture the uniform
@copper raven I'm using the init field for the createvehiclecrew command you told me about. But I also already had crew in the vehicles when I put the code down. I will remove the crew from the vehicles to see if that works.
So I put that in the expression field and not the init field?
Ok. I'll try that then
expression runs everytime a vehicle respawns
Unfortunate news. Thanks
Ohhhh!!!! Thanks for clarifying that. I will do that and report back
Im at work rn, so it wont be for a little bit
So if i wanted to do that same vehicle spawn thing, spawn cargo troops for it, join them all to same group and add them to high command all those things should go to expression field?
Any other advantages to missionProfilenamespace other than reducing profilenamespace bloat and ability to transfer mission saves between profiles?
You know, if you'd have read what I told you in this message, you'd have solved this yesterday.
how can I spawn a fire effect through script rather than eden?
nvm found create3DENEntity
@lavish stream my bad mike, I wasnt aware of the expression field itself in the module and was pretty tired, but I do appreciate the help you and @copper raven have given me. I am at work rn and will have to do this tonight. Question: if I have a vehicle starting in mid flight does that command respawn the vehicle in flight or?
that won't work
I'd imagine the module will respawn it at ground level but stranger things have happened so.
oh it won't?
Ok I will try this when I get home.
oh ok ill look at that
Does the event handler HandleDamage work correctly with ace3 'new' medical? Im not sure in my testing as the unit still dies as im trying to prevent its death.
I need an event that happens when an object is created, really when a UNIT is created, is that the "EntityCreated" mission event handler? or is it an "Init" event? Key class I think is "CAManBase", i.e. _entity isKindOf "CAManBase"... thanks...
EntityCreated
that is the one then, thanks.
if you mean you want to add your own HandleDamage then no it won't, it will break ACE stuff
Fug, I assume there is no way around that huh? Thank you for the info.
i have three Editor placed objects and i want them to randomly spawn at predefined positions every 15 seconds.
The code works but when i run it in MP the script does not run simultaneously for every player, is there another way to achive that?
if (isServer) then
{
_randomObjPos = [
[7595.75,4005.57,0],
[7595.97,3993.47,0],
[7589.42,3999.57,0],
[7583.47,3993.63,0],
[7583.51,4005.68,0],
[7577.25,3999.46,0],
[7571.52,3993.45,0],
[7571.37,4005.22,0]];
while {true} do
{
_objPos1 = _randomObjPos select floor random count _randomObjPos;
_objPos2 = _randomObjPos select floor random count _randomObjPos;
_objPos3 = _randomObjPos select floor random count _randomObjPos;
obj1 setPosATL _objPos1;
obj2 setPosATL _objPos2;
obj3 setPosATL _objPos3;
sleep 15;
};
};
does EntityCreated include 'non-entity' assets? i.e. 'vehicles'? IIRC there is a class init?
ah okay I see, I was recalling CBA_fnc_addClassEventHandler ...
Where are you calling this script?
And do the objects spawn every 15 seconds ands its just out of sync between players, or do they spawn at different intervals?
from init.sqf
they spawn every 15 sec but out of sync between players
consult ace docs
IIRC it depends whether your HandleDamage is installed before or after ACE's.
@copper raven @lavish stream ok, so it works, however now theres another issue. I have it so they're on a waypoint system. When they respawn, waypoints non existant
Crews there, but they just sit
Ok, well, progress was made. I'm grateful for that. Could I add waypoints in the expression field along with the createvehiclecrew command?
I'm just trying to get it right. Would a trigger work?
is there a way to return a list of all holdActions assigned to an object?
Hold Action technically is just a regular action, you should be able to fetch by addAction related commands, if that fits
if i can return them via actionIDs that means the miller in my old man save has no actions assigned. would explain why i cant deliver the quest item
heh, i have an idea for a really terrible workaround
hah. i'm correct. if i start a new game, miller has 2 hold actions
so for some reason, in my savegame the actions are either not (re?) added, or they have been removed
Can errors in parseSimpleArray not be caught with try-catch or am I doing sth wrong?
Code?
try { private _array = (parseSimpleArray GVAR(itemsInArsenalCustomCategory)); } catch { diag_log "Update failed."; };
Works fine when variable is well formed, does never execute catch if not.
Same behavior with this:
try { diag_log call compile '["Test]'; } catch {diag_log "nope";};
Never gets to the catch part.
Or does that code work for you?
no, try-catch is not meant for that.
try catch does not catch vm exceptions
it's only for use with https://community.bistudio.com/wiki/throw
Is there a bug in my code or is ArmaScriptCompiler not compatible with 2.10? The following code throws a syntax error:
private _compatItems = compatibleItems _wpn;
commands list probably outdated
https://github.com/dedmen/ArmaScriptCompiler/blob/master/src/commandList.cpp add the missing ones here, but ofc you will need to recompile yourself
And script errors are not throwing?
That's unintuitive.
Then how am I supposed to catch such errors?
https://github.com/sharplol/ArmaScriptCompiler/releases/tag/x64_2.10_cmds you can use this, also made a PR need to wait for Dedmen
Thanks, I don't have gcc or clang installed so this is really helpful 👍
Are there inbuilt methods to check or would I have to write custom code?
custom code i'm afraid
what are you trying to parse?
string of an array of strings
List of class names users can input/copy via cba settings
if it's throwing an error, then that means that the input is invalid
so there's no point of validating it
I know that the string is not valid, I made it invalid to test it
is it ever invalid then? (without you intentionally making it invalid)
I was looking for ways to catch user input mistakes
ah it's user input
yeah
yeah. You know the CBA settings editbox?
well yeah if you want to check it for errors, you basically need to write a parser
but it's gonna be really slow in sqf
Yeah. Wouldn't be much of an issue, they'd not do that multiple times a second xD
but I'll think about whether it's wort writing a parser
Sqf parser in sqf. Xzibit.jpg

i'd personally just let it error
if it fails it will return an empty array
private _test = parseSimpleArray _data;
if (_test isEqualTo []) then {
_test = ["some default data"];
};
you'd think so, but no, it errors big time
yes
that's what i meant
if it fails, it throws an error and returns an empty array
I'll have to verify that tomorrow, but I think it doesn't continue to execute after the error
well it should
I'm new to arma scripting so I apologize if I sound a little thick.
So I have an arma server and I'm running a client side addon , now I want to overwrite a function in said addon.
The only way I was able to achieve this was by making my own addon and loading it after the initial addon.
Now my questions is: Is there a way to achieve the same result without the player having to download an extra addon?
No.
thank you 👍
Alright lads need some help.
I've had a loadout system I've used for a while when hosting my own small ops locally, essentially doing a bunch of addactions to lockers that give loadouts to players that use them, those addactions just calling loadout sqfs etc etc .... worked perfectly. Now though I'm trying to use it on a dedicated server and it's just not working at all and I was wondering if anyone would be able to help me get it to work on dedicated servers.
Init
_liststoresArray = [stores,stores_1,stores_2,stores_3,stores_4,stores_5];
//_liststoresExtraArray = [storesExtra];
//_listrifleArray = [rifle];
//_liststenArray = [sten];
//_listbrenArray = [bren];
// Stores
{
_x addAction ["<t color='#A32323'>Field Kit Store</t>", {}, "", 1.5, true, true, "", "true", 5];
_x addAction ["Commander", "loadouts\Commander.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Section Leader", "loadouts\Section Leader.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Rifleman", "loadouts\Rifleman.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Scout", "loadouts\Scout.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Machine Gunner", "loadouts\Machine Gunner.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Sapper", "loadouts\Sapper.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Medic", "loadouts\Medic.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Aviator", "loadouts\Aviator.sqf", ["3","1"], 1.5, true, true, "", "true", 5];
_x addAction ["Crewman", "loadouts\Crewman.sqf", "", 1.5, true, true, "", "true", 5];
} forEach _liststoresArray;```
Rifleman.sqf
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
// Add back compass, watch, and map
player addWeapon "vn_l1a1_01";
player addPrimaryWeaponItem "vn_b_l1a1";
//player addWeapon "vn_m72";
player addWeapon "vn_hp";
player linkItem "vn_b_item_compass";
player linkItem "vn_b_item_watch";
player linkItem "vn_b_item_map";
player linkItem "vn_m19_binocs_grn";
player addBackpack "vn_b_pack_p08_01";
// Helmet (randomly selected from list)
_helmet = selectRandom ["vn_b_boonie_08_02",
"vn_b_boonie_08_01",
"vn_b_boonie_07_02",
"vn_b_boonie_07_01",
"vn_b_boonie_06_02",
"vn_b_boonie_06_01"];
player addHeadgear _helmet;
// Uniform (randomly selected from list)
_uniform = selectRandom ["vn_b_uniform_aus_01_01",
"vn_b_uniform_aus_02_01",
"vn_b_uniform_aus_03_01",
"vn_b_uniform_aus_04_01",
"vn_b_uniform_aus_05_01",
"vn_b_uniform_aus_06_01",
"vn_b_uniform_aus_07_01",
"vn_b_uniform_aus_08_01",
"vn_b_uniform_aus_09_01",
"vn_b_uniform_aus_10_01"];
player forceAddUniform _Uniform;
player addVest "vn_b_vest_anzac_01";```
Won't post the whole thing but the above are examples
The chosen objects that have the addaction assigned to them don't even show the addactions at all
it looks like you are running addAction on the server, when it should be run on each client that you want to have the action
also the player variable only works on client
so your going to need some remoteExec calls or run that code in client, not server
can I detect whether a unit is during a ragdoll? I was planning to have a trigger that would activate when target is hit with a car (target has damage disabled so he ragdolls but is still alive)
if not possible I'll just make him damageable again and later replace with a brand new alive copy
perhaps checking animation? I think it equals ""
Bugger, this server vs non server stuff is really beyond me? Mind pointing me at what I should go reading about?
not sure about tutorials but if you put your addaction code to file called initPlayerLocal.sqf then it's happening on client, for example
is your Init code in init.sqf file? or init field?
Hi everyone, im trying to learn scripting. Is there something wrong with this line? Im trying to activate it with a trigger.
[getMarkerPos "mygroupspawn", WEST, ["US_MGSPlatoon"]] call BIS_fnc_spawnGroup;
The trigger itself seems to work, it gives off the sound it was supposed to
you should probably make _moneyDatabase a global variable instead, it wont work as local. also this seems undefined: private _countMap = count _hashmap;
player only works on client
loop allPlayers
but whats the point of this?
of this "bridging" hashmap
you're just updating value every 10min, you can just get the value via getVariable normally anytime you want
so store it when they're about to disconnect/load it when they join back
Is there a reason as to why CBA_fnc_players works like so:
(allUnits + allDeadMen) select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}
instead of
allPlayers - (entities "HeadlessClient_F");
The latter is way faster when there are units on the map, with 90 units on the map it is ~20x faster
I think that maybe because allPlayers takes time to be ready
following Sharp's advice you can use this to run code when client leaves the server : sqf addMissionEventHandler ["HandleDisconnect", { params ["_unit", "_id", "_uid", "_name"]; false; // probably good to have false }];
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#HandleDisconnect ah didn't see the message above 
Ah, makes sense. I'll just not use cba_fnc_players in time-critical scripts then 👍
@copper raven hey would it be possible to sync 2 modules together? One for the createvehiclecrew and th other for the waypoints?
some notes there
Or would that cancel one over the other?
i have no idea what you mean by that, what modules?
Vehiclerespawn
Could it be added to these notes that cba_fnc_players reliably returns player objects even at mission start, unlike allPlayers
if you create 2 modules that means it's two seperate respawns
you can't "link" them
just put everything into the same respawn module
that doesn't work because the local variables wont exist inside the spawn
Ok gotcha. I wasnt sure if you could do that in the expression field.
you can, simply seperate the statements with a semicolon
also you are not updating the money...
Yeah I was just checking because theres only one line for the expression field.
sorry I don't follow, I see no prints in your code
lots of errors there, first, getVariable takes two arguments not 1, second, _moneyDatabase, _allPlayers and _money is undefined in the scope you use them, third, you're looping over _allPlayers but are just setting the same hashmap key everytime
Is there any way to check if arma is using .sqfc or .sqf for a function ?
I added some with compileScript (.sqf & .sqfc), but since its documentation is not too great, i asked myself if it's even working for me.
@granite haven ```sqf
moneyDatabase = createHashMap;
[] spawn {
while {true} do {
sleep 600;
//private _uid = getPlayerUID player; //for later
private _allPlayers = call BIS_fnc_listPlayers;
//private _countMap = count _hashmap; // for later
{moneyDatabase set [getPlayerUID _x, _x getVariable ["BIS_WL_funds",0] ]} forEach _allPlayers;
};
};
something like that 😃
that only fixes the undefined variables, rest is still broken
plus global variables cannot be private
ugh true, it needs some work...
edited a bit but not 100% sure if that works
Good morning everyone, I don't know how often this might be asked but I'm new to the game and I realize I can make scenarios in the editor. I've been working on one and I realized that I can animate the doors on some vanilla vehicle so is it possible to make a helicopter door open and close on the GetIn\GetOut command and how would I go about doing so
still those local variables that wont work inside a spawn. plus other errors
you would also need to update them, now u just get the values once
init.sqf, placed in the mission includes. The objects I want to do this loadout switching with are named Stores, Stores_1, Stores_2 etc etc as per the array
ok well you can use if(hasinterface) then // True if client in there or use the other .sqf file I suggested
yes
but then the file never reaches end
it will be stuck in the while loop
ummm how are you running the file?
execVM ?
Putting it in initplayerlocal seems a cleaner way to do it, less stress on the server.
With the actual .sqf that applies the loadout (that is called by the init addaction) do I need to change anything there? or need to remoteexec the addactions still?
sure
addactions should work in the initplayerlocal
Love it, thanks a ton mate I'll give it a good soonish and get back to you ❤️
I'm trying to have a hold action that only displays text to the caller. I tried doing this with titleText and using remoteExec where _caller is local (I also tried with player), but it still shows to other units. (I've tested in SP and MP, both by zeus controlling another unit).
This is the "Code Interrupt" block
if (not (_caller getUnitTrait "Engineer")) then {
// Only display message if caller is not an engineer
[["You have no idea what you're looking at, perhaps an engineer will be able to understand it?", "PLAIN DOWN"]] remoteExec ["titleText", _caller];
// Display titleText message to the unit that called the action
// Pass arguments with double brackets since titleText expects an array
};
(The comments have been added, they are not in the block itself)
The interrupt code is only executed where the caller is local, so remoteExec is not needed.
However, while you target locality by referencing a unit or object, locality is not exclusive to that object, it's exclusive to the entire machine where that object is local.
So your text will appear to other units if they are also local to the same machine. If you're Zeus controlling the unit, it is now local to your machine - and, in locally-hosted multiplayer, if you're the host, most things are local to your machine (everything if you're the only player). This is unlikely to be a problem in real MP because only one player will be on each machine.
Okay, I was wondering if perhaps it was correct, but just behaving differently because of the method I was testing it
Thank you!
How can I check if a variable is an array?
I found isArray but that seems to only take configs as inputs
_variable isEqualType [];
Alright, thanks ya guys!
isEqualType would be the preferred way since it's a single command, rather than a command and a string comparison - shorter and tidier to write, and almost certainly slightly faster
typename is terrible if you want to compare, isEqualType was exactly intended for that purpose (as a replacement to that)
why does hint preprocessFile "core\testVelocity.sqf"; hint the script but
copytoClipboard preprocessFile "core\testVelocity.sqf"; this doesnt copy to clipboard
MP-restricted
so I can only do in singleplayer?
I shalt let you deduce that one 😛
How can I turn this into a loop?
Bravo move position player;
I basically want to make team Bravo constantly follow team Alpha and also have them at a 10-20 meter distance from each other
it doesnt work in singleplayer I already tested is quite odd
use BIS_fnc_stalk
How can I remove a specific string from the beginning of another string?
Say I have a variable removeMe that is equal to the string "test", and I have the string "testThat isn't supposed to be there".
Basically:
removeMe = "test";
testString = "testThat isn't supposed to be there";
// some code
newString = "That isn't supposed to be there";
I know this is quite a simple task in a lot of other programming languages, but I don't know how to do this in Arma
_str = ["testThat isn't supposed to be there", "test"] call CBA_fnc_replace;
_str;
Oh cool, thanks!
No bother.
is there a way to create a module without running the function that's defined in config?
Creating what module? Not a new one, I'm guessing?
spawning a module with createUnit or createAgent
Is it a module, or a script?
What do you want to do?
And, How do you want to do it?
create a module and then set the options on it before calling its init function in a script
Share your module code.
I'm doing something like sqf _amb_placement = createAgent ["ALiVE_amb_civ_placement", _pos, [], 0, "NONE"]; _amb_placement setvariable ["debug", str _debug]; _amb_placement setvariable ["function", missionnamespace getvariable (gettext (configfile >> "cfgvehicles" >> "ALiVE_amb_civ_placement" >> "function"))]; [_amb_placement] call (_amb_placement getVariable "function")
(not exactly but this is simpler than posting all of the functions)
the problem is if I use createAgent with this classname the module's init runs immediately, before the setVariable calls are done
OK. I've never really used ALiVE.
Any issues with using createUnit?
Are you using this in a script? Or Are you editing the ALiVE mod?
using this in a script
I am asking if you can create a module in script without running its init
or, more correctly, delaying its init
I hear your question.
I don't thing you can, and I don't know how you can.
I can't help you any further. Sorry.
Let me know how you get on though.
that's fine. I think its probably doable if you create an addon
How can you display a cutText layer on top of a titleText?
I've been trying to help a friend, and I thought that cutText just wasn't working, but it's because it was being displayed behind a titleText Black in/out layer
Here's his script so far
// Black Screen while quote displays
titleText ["", "BLACK OUT"];
sleep 2;
cutText ["“In examining disease, we gain wisdom about anatomy and physiology and biology. In examining the person with disease, we gain wisdom about life.” - Oliver W. Sacks", "PLAIN"];
sleep 4;
// Add effects and fade out curtain
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
titleText ["", "BLACK IN", 5];
// Info text
[format ["Bekatov, %1.%2.%3", date select 1, date select 2, date select 0]] spawn BIS_fnc_infoText;
sleep 3;
Basically, he wants the screen to start out black, then have the quote come in, wait a bit, then apply the blur effect while the screen fades back to normal
I tried swapping the cut/title texts, but the black screen doesn't seem to work with the cuttexts
Use layers:
layer cutText [text, type, speed, showInMap, isStructuredText]
999999999 cutText ["“In examining disease, we gain wisdom about anatomy and physiology and biology. In examining the person with disease, we gain wisdom about life.” - Oliver W. Sacks", "PLAIN"];
Keep the layer number ABOVE the other layers.
Test if titleText needs the same layer numbers.
I tried using layers, but it still kept displaying underneath the titleText
Also setting it to a number that high dropped me to like, <1 fps lol
Test if titleText needs the same layer numbers.
titleTextdoesn't use layers
Then you're almost fucked...
https://community.bistudio.com/wiki/BIS_fnc_dynamicText
Just tested it, still displays underneath :p
If you don't mind, post your init and I'll play around with it.
This is it
OK.
// Black Screen while quote displays
titleText ["", "BLACK OUT"];
sleep 2;
cutText ["In examining disease, we gain wisdom about anatomy and physiology and biology. In examining the person with disease, we gain wisdom about life. - Oliver W. Sacks", "PLAIN"];
sleep 4;
// Add effects and fade out curtain
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
titleText ["", "BLACK IN", 5];
// Info text
[
"Bekatov",
format
[
"Bekatov,
%1.%2.%3",
date select 1,
date select 2,
date select 0
]
] call BIS_fnc_infoText;
sleep 3;
Works for me.
Weird, the text doesn't get displayed for me
Which text?
The quote
Really?
How are you testing it?
Just that code in an init.sqf
Only other thing I have running at the start is a script to set up ACE Fortify
I doubt that's it.
Yeah
It runs fine on my end.
Although BIS_fnc_infoText shows only for a second.
I'll take another look at it in the afternoon.
Let me know if you solve it.
Will do
Is there a list of trigger condition examples out there?
Why list?
It's even weirder than that. It throws an error and sometimes still returns an array. So it kinda salvages what it can parse even when it throws an error.
Which, ironically, makes it entirely useless in this case, cause there is no way to to reliably determine whether it throw an error or not.
To Sync waypoints, we use this: synchronizeWaypoint
But what keyword is for the Set Waypoint Activation?
If it is, then how to make it work? Because it is the same as the Condition and OnActivation box in the Editor.
But not the actual Set WayPoint Activation
I don't understand?
https://community.bistudio.com/wiki/Category:Command_Group:_Waypoints
If that thing is not that you look for, check this article
i'm trying to choose a random player but it gives me an error message: undefined variable _randomPlayer
this is my code:
_alivePlayers = allPlayers select {lifeState _x != "INCAPACITATED" && !(_x getVariable ["vestOn",true])};
_randomPlayer = selectRandom _alivePlayers;
_randomPlayer addVest "V_TacVest_blk";
_randomPlayer setVariable ["vestOn", true, true];
it gives me that error msg, but still adds the vest and sets the variable on true, very wierd
@drowsy geyser what happens if _alivePlayers is empty?
You mean if there is no player at all?
you don't getVariable out of the thin air. You need to provide the namespace to it 🤷♂️
The code only runs if there is atleast 2 players
Hey I just want to say you guys are doing an awesome job! Have a good rest of the day!💯
and if both of them have vests (or are incapacitated)?
The code runs in a trg
Trg con:
{vest _x == "V_TacVest_blk" && lifeState _x == "INCAPACITATED"}count allPlayers < 1
which would be 0 if all players are incapacitated, but have no vests. Leading to empty array in the executed code. Leading to _randomPlayer being nil
call - run in this thread and wait for return
spawn - start in a separate thread and don't wait for it
This shouldn't happen because only one player at time will have a vest and get incapacitated
findIf
assuming that all BIS_fnc_WL2_dataBase does is just update data in some "database", that loop is pointless, _playerMoney never changes
allPlayers findIf {vest _x == "V_TacVest_blk" && lifeState _x == "INCAPACITATED"} == -1
ah i see what you mean yeah
looks fine
one " missing though
Hi, is there a way to hide the "task" icons on a Map Control ?
I have a question: is there a way to prematurely stop the fire of a destroyed vehicle ? Can we also change the color of this fire ?
Hello everyone,
I am trying to figure out a script command to set a headgear texture using setObjectTexture. I've tried using headgear player setObjectTexture [0, "texture"]; but have had no success.
You can't. Headgear doesn't support on-the-fly retexturing
I imagine only uniforms support it?
Uniforms and backpacks
thx for the help
Note that uniform textures will be reset if the uniform is removed or changed, or if the unit is opened in the Virtual Arsenal
Hey! I want to create a script that detects if a player is moving too fast within a certain area, almost like a motion trigger, could anyone think of a way that I could do this?
I'd imagine I'd have to use an EH to detect movement for each player on the server, but I can't quite tell how I would go about something like this.
I'd just run a loop clientside with the speed command tbh
A non-server-only trigger with the condition as (speed player) > 5 (tune the number) would be fine
Oh, great! I thought it would be a lot more difficult haha. Thanks! 🙂
Sorry, would this be (any player present) AND (speed player) > x
set the condition in the dropdowns as "any player present", and then in the condition field:
(player in thisList) && {(speed player) > x)}```
Awesome, I assumed "any player" would just set it off for everyone anyway 😄
The condition from the dropdowns is only used for actually activating the trigger if this is used in the condition field. Otherwise it just sets the conditions for what can appear in thisList
You could also set the dropdown conditions as e.g. BLUFOR present if you only wanted it to trigger for BLUFOR players - thisList would contain only BLUFOR units, so player in thisList would only be true if they were BLUFOR
That's actually really handy to know, thanks a lot! 🙂
speed player reads 0 for some animation types (sideways? I forget) so vectorMagnitude velocity player is more reliable. Might not matter here though.
Sorry for the dumb question but my brain isn't working this one out, even with the wiki, for some reason I'm not making sense of it.
if (var == true):
{
hint "something";
};```
is returning `Error: type if, expected switch.`
I've looked on the wiki for 'if' and 'switch' to see if I can see the difference, I've tried a number of combinations that always end in the same outcome. Another odd thing is that on the wiki, it doesn't show the if statement needing a colon, but I've tried this and it just freaks out.
I've read up a little on switches and don't fully understand them, from what I can grasp, it seems to be that if something is true/false, you can have two different results, but I don't need one to activate if `var` is false, so I assume an 'if' statement would be acceptable here, apparently not.
Again, really sorry is this is a very amateur sounding question, but I figured I might as well learn it here to avoid this in future 😅
You know, I just noticed it. You need to add 'then' after the statement. Like I said, I'm not working at 100% right now 
You get a less obvious error if you just miss the then out. You're getting the version for a bad :
I had actually tried it with out the colon, it had told me I was missing a semi colon, which I assumed it must have meant I had written it completely wrong.
It's because you have two data types (if (stuff) becomes an "if" data type) without a command in between. It figures they're the end & start of two lines so you get the missing semicolon error.
Right, that makes a little sense but I'm going to have to come back to this tomorrow when it's not 1am 😄
Thank you for the explanation though 🙂
Trying to make team Bravo follow Alpha using this in an init field and it isnt working
[Bravo, Alpha, 5, 0]; spawn_BIS_fnc_stalk;
Never scripted before so I'm clueless on how to make it work
You have two syntax typos for a start.
[Bravo, Alpha, 5, 0] spawn BIS_fnc_stalk; is at least valid code.
Bravo and Alpha would need to be variables for groups that exist at the time the code is executed.
I know that, since I copied the line Artisan sent, but wouldnt let me press okay if I didnt put a ; after the ] 😕
it's confused by the random underscore _ between spawn and BIS_fnc_stalk
Oh! Didnt see that
Anyone know why this script isn't working for the vehicle respawn? CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1));
Found this and I put this in the expression field of the vehicle respawn module. But the waypoints dont copy over for some reason.
Oh and how do you make the font look like script on here?
!code
How to use SQF syntax highlighting in Discord
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
The ` key is often found in the top left below ESC
Found it. I'm on my phone.
Also could you help me figure out why the copyWaypoints command isn't working with the respawn module?
I'm trying to figure this out and it's annoying
Someone probably can but not me. I never use the respawn module so I don't know the necessary things
A lot of our top scripters are in Europe, where it's currently between 0300 and 0500, so you might have to wait a little before someone comes along
It's fine, I'm close, but not close enough to figuring this out
I just need to see if I'm missing something or if something else needs to be added
How could I remove an added event handlers on unit death?
Example, I added a Reloaded EH, I want a Killed event handler to remove the Reloaded EH on death if certain condition is not met.
I understand EHs have an index number, im just not sure how to grab the index outside of the eventhandler
Store it on the unit with setVariable.
Thats a good idea, thank you.
I tried to draw player path in 3D screen with drawLaser because it's far more visible tthan drawLine3D but after some lasers they start to dissapears like if a limit is reached. Can this limit be changed?
What limit? Amount, or distance?
Distance limit is 1700 meters more or less, number of lasers limit is low. I would need at least to increase number limit.
I have many small segments of 15 meters lasers.
And when number limit is reached they dissapears in no particular order.
Just some of them dissapears, randonly.
The good is i have no performance problems with lasers, and it's easy to see.
drawLine3D is a bit heavy and hard to see.
Sounds really like a hardcoded limit
when you use _obj attachTo [_pal]; shouldn't the _pal stay on it's original position?
_pal shouldn't get moved when you attach anything to it, if that's your question
as in attachTo doesn't move the to object
but you can move _pal after you get something attached to it (and attached object would move with it)
ok thx, wanted to be sure about this...
actually I meant _obj should stay where it is
no, it doesn't. To keep the relative offset you need to use https://community.bistudio.com/wiki/BIS_fnc_attachToRelative
attachTo doesn't keep left _obj where it was. It moves it to the listed bone/offset of the target (right) object. Defaulting to origin and [0,0,0] offset
ok got it, thx 🙂
I'm getting same result with these: ```sqf
_obj attachTo [_pal];
[_obj, _pal, true] call BIS_fnc_attachToRelative;
Anyone with experience with RHS loading of vehicles script? I am looking some info about rhs_maxCargoMassCoeff
Alright, I am pulling my hair out over this.
I am getting the error _spawnpoint is undefined on the third line by createUnit when running the following script. Why?!
private _getSpawnLocation =
{
params["_group"];
private _spawnpoint = _group getVariable "spawnpoint";
private _spawnpoints = [];
{ //Loop through every object synced to the respawn point
if (typeOf _x == "Sign_Arrow_Yellow_F") then
{ _spawnpoints pushBack _x; };
} forEach synchronizedObjects _spawnpoint;
selectRandom _spawnpoints
};
private _spawnpoint = [_group] call _getSpawnLocation;
(ALL_INFANTRY_UNITS # _factionNumber # _groupType # _queuedUnit) //Select the correct unit to spawn
createUnit [_spawnpoint, _group, "[this] call _unitInit;"]; //Spawn selected unit
is that the exact code you have?
No, one sec.
put it in sqfbin.com
That's the code.
kay
It's slightly rearranged from my script file to only include essentials. That's why I've had to change it a little.
It should now be accurate.
Overall layout is identical.
Fixed.
well, if you're getting _spawnpoint is undefined that means either _group is undefined, or _group doesn't have "spawnpoint" defined
Both are defined.
where is it saying that it's undefined? synchronizedObjects _spawnpoint or createUnit [_spawnpoint here?
() #createUnit [ . . . ]
so that means _spawnpoints is always empty (your for loop doesn't add anything into it), thus you run selectRandom [] which is nil
The weird thing is I have done poor-mans-debugging and used hints and it's not undefined.
You wanna know the kicker?
It spawns the units as expected.
But I am getting errors.
doesn't make any sense
[this] call _unitInit; maybe you meant this?
because this will always error
_unitInit is undefined
(Sometimes, depending on how I write it. Always an error though.)
It's defined else where.
https://community.bistudio.com/wiki/createUnit use the main syntax instead of the alternative one
it doesn't matter
a local variable doesn't carry into that script
Let me check. If that's the case then the error is way off.
Debugging SQF is absolutely the worst.
Hate it.
the main syntax returns the created unit, so you can run private _unit = ... createUnit; [_unit] call _unitInit;
I made the _unitInit global and error remains. Not it.
run systemChat str [_spawnpoint] before the createUnit line
Alright. I just saw something telling.
I've used hint for debugging because I am running it in SP (systemChat does not work in SP) and I just now saw that there appears to be some null's mixed into the valid spawnpoints. I've got no idea where the hell they're from . . .
systemChat does not work in SP
it does though
I thought it did but when I tried it recently it did not.
The chat does not appear for me.
Don't know why.
your ui layout settings are broken maybe
Hm. You're right. I modified my UI layout not long ago.
Weird why it does not show the chat still. I only made the chat window larger.
debug [_spawnpoint, _spawnpoints, _spawnpoints apply { typeOf _x }] in the _getSpawnLocation
private _spawnpoints = [];
{ //Loop through every object synced to the respawn point
if (typeOf _x == "Sign_Arrow_Yellow_F") then
{ _spawnpoints pushBack _x; };
} forEach synchronizedObjects _spawnpoint;
you can replace this with
private _spawnpoints = synchronizedObjects _spawnpoint select { typeOf _x == "Sign_Arrow_Yellow_F" };
Does that select a random array element though?
Doesn't it select the first valid?
Wait. My bad.
i didn't include the selectRandom part did i, it means it stays as is
what i sent does exactly what your forEach loop does
Sometimes you just need to do a rubber ducky. 😄
Or in this case print out all different kinds of variables.
I have now found and solved the underlying issue. It was caused by some spawn point locations not having sub-spawn points configured and I had not created a fall back solution for that yet. Now that is fixed and no more errors. :)
Thank you @copper raven .
Disconnected
so after
i remember what you were trying to do
what i sent is exactly what you want
contains the unit occupied by player before disconnect
wat?
Im running a HandleDamage EH on the server, it tracks values fine and correct with AI and a zeus remote controlling the unit. If a player goes into the lobby slot the EH stops working. Not sure what is the reason for this. I know MPEventHandler syncs globally so I would assume I need to sync HandleDamage manually or something? Im not sure how to do go about that.
You're adding the EH on the server, but handleDamage only fires when the unit is local to the machine the EH is on, and when a player takes over the unit, it becomes local to their machine rather than the server
The best way to resolve this would be to add the EH on all machines when they join. You could add it in e.g. init.sqf, or by remoteExecing it from the server with the JIP parameter set to true
how do you remoteexec a EH? I dont feel like I need to convert everything to an Init.sqf as the server is setting up SetVars to track the data, so I can just make those sync globally.
Same way as with any other command. [left arg, right arg] remoteExec ["command",0,true]; -> [_unit,["HandleDamage",{code}]] remoteExec ["addEventHandler",0,true];
Adding it in init.sqf would be the preferred option because it reduces the amount of data that has to be sent over the network.
ah ok, thank you. I wasn't sure if a EH was remoteexecable like that. TBF this script is only ment to be setup at mission start and not during the mission. So im not too worried about data over network
It will be set up during the mission if a player joins after mission start. It's best to reduce network traffic where you can, because although individual parts may seem small, it can add up when you have a lot of players.
There is no need to be afraid of init.sqf, it's not complicated and requires very little effort to use. It's one of the best tools for doing things on mission start.
If you are dead-set on remoteExecing, make sure the remoteExec command is only run on the server, otherwise all clients will remoteExec it to each other as well, resulting in duplicate EHs.
It will only be ran on the server, that is correct.
Im not afraid of init.sqf, I just didn't initially setup the script with it in mind and already am a bit too deep in the weeds without scratching and redoing stuff to fit that mold better. Was mainly hoping for the server to focus on the heavy lifting for this particular script going into it. (pretty much spent my time to rewrite it making it less hard coded.) Def will spend time to polish it even more after a quick fix method.
What are your suggestions sharp?
make two functions, one to drive the EH and one to add
If you already have this EH set up to run on the server, you shouldn't need to redo much at all. The EH code should be largely self-contained (because it has to be) so just cut the part where you add the EH and paste it into init.sqf. That should be like 90% of the work, only some locality touch-ups to finish off.
(And then, if it's a lot of code in the EH, turn it into a function that the EH calls for efficiency)
// serverside
_unit remoteExec ["tag_fnc_addMyHandleDamageEventBlabla", 0, true];
// tag_fnc_addMyHandleDamageEventBlabla
params ["_unit"];
_unit addEventHandler ["HandleDamage", { call tag_fnc_onHandleDamage }];
// tag_fnc_onHandleDamage
params [...];
// do stuff
always use a wrapper code for event handlers, as everytime an event runs it's code is recompiled
(last time i tested atleast, probably still is the same thing)
oh I see, that makes sense. I didnt know it was recompiled on every fire.
another quick question. Is this the best way to call an unscheduled environment in the mission init's?
call compileScript ["scripts\boss\boss.sqf"];
call an unscheduled environment
what you sent doesn't do that
well if I remembered correctly compileScript is a shorthand for a longer command
that's not the point
call may not be the right term
call doesn't force unscheduled execution
create an unscheduled environment may be better phrasing
to go unscheduled, best way as of now is
isNil _myFnc
i think I should rephrase.
I only know 2 ways to "start" code in an init.
execVM
preprocessFileLineNumbers
I believe compileScript is a shorthand for preprocessFileLineNumbers
compile(final) preprocessFileLineNumbers to be exact
my question is are those the best and only ways or is there some hidden better method im not aware of
CfgFunctions?
True, outside of that though.
if you're in scheduled and need to exec once in unschd, isNil compileScript ["script.sqf"]
otherwise execVM
ok I see, that is a useful tidbit of info to write down.
execVM if from unschd to scheduled, call compileScript ["script.sqf"] is the best if you want to stay in the current environment
but i'm talking about things that only ever execute once, otherwise use CfgFunctions (because you're recompiling code for no reason otherwise)
Gotcha
cfgfunctions is still the best though, unless you're executing some init script then it's okay
does exitWith reliably exit scripts from the main scope of the script. I've read about issues in the past and am curious if it's robust enough to use for request validation (things like "if (!isServer) exitWith {false;}" that are critical to security
not main scope, no
current scope
if true then {
if true exitWith {};
// breaks
hint "test1"; // hint doesn't execute
};
// resume execution
hint "test2"; // prints "test2"
Yes, of course. I mean specifically exitWith's from the scripts main scope. (exitWith's that SHOULD exit the script)
depends what you mean with main scope
I found some old threads this week saying traditionally it couldn't be relied on to exit the script
I just mean the upper most scope in the script
well only if you call exitWith in that exact scope
I understand that, and that exitWith exits the current scope. I'm concerned about an apparent unreliability I read about vaguely from like 2015
I'm curious if there are still issues now or it was fixed
can you link what you read?
Or maybe the OP just didn't understand the issue
It wasn't anything specific, just something like "of course, there's the reliability issues"
which is why I was hoping someone here might have more info. It's totally possible they just didn't understand scopes
there was something with exitWith not breaking a waitUntil
but it was fixed iirc
apart from that, i don't know anything else
ahh, maybe it was that then
thanks for the info either way. It seems to be working reliably in my test environment, I just want to make sure it's still working under load
I use it so heavily that I'm pretty sure it's reliable.
And I found a bug in random recently :P
I use vectorCrossProduct a lot. People here think i'm crazy when i start to use my right hand to predict the new vector direction 🐒
Hi i have a question is there a way to add mines to zeus interface. I am using ZEN and Ace as mods and i place AT mines via composition. AT mines are vanilla ones. But they dont show up in zeus interface what so ever. This is the code i have but even this dosent work any tips how to add it to zeus interface?:
{
_x addCuratorEditableObjects [allUnits,true];
_x addCuratorEditableObjects [allMines,true];
_x addCuratorEditableObjects [entities [[],["Logic"], true,true ],true];
_x addCuratorEditableObjects [vehicles,true];
_x addCuratorEditableObjects [allMissionObjects "All",true];
} forEach allCurators;
Hello guys! I have a trouble with arma 3 editor and script, so:
I want an explosion to occur when a unit enters a trigger, but I don't know how to get the ammo name. I'm using the Fire Support Plus mod and I need to know the name of the 230mm Mine ammo. I will be grateful for your help
""name of the ammo" createvehicle getMarkerPos "marker_0"
what am I supposed to put in place of ABCD in <log record="ABCD">Get to the ABC record</log>? It doesn't take my record name, meanwhile <execute expression='player selectDiarySubject "Profiles:Record0"'></execute> works. Do records have some different name or they shouldn't have spaces or any symbols? So far I couldn't get log to work
put Record0 in there
you need to put a record
check cfgammo config
I'll make a fix on biki then, as it says "record name" while "subject name" is the subject name, and "record name" is actually its ID
or you can run _target addEventHandler ["Fired", { hint typeOf (_this select 6) }]; and fire the vehicle/unit and see it
where can i find it?
config viewer in-game
didn't work, text is white as a normal string instead
I tried just ID in log and it didn't work either
so putting any number into log also makes the text white non-linked
try adding both the subject and the record
like <log subject="Hello" record="ABCD">?
Anyone know why this script isn't working for the vehicle respawn? CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1));
[9:59 PM]
Found this and I put this in the expression field of the vehicle respawn module. But the waypoints dont copy over for some reason.
this one works! thanks
I've tried swapping the 0 and the 1 and it still doesn't work.
maybe because the vehicle is destroyed?
but this is put into the expression field of the vehicle respawn module
i thought i was close to figuring it out
i don't know if AI keep their waypoints when they die
so before the vehicle respawn module broke, they did. but since it's been broke, well, alternatives had to be figured out without using the module
broke? what do you mean?
so the vehicle respawn module, DOES respawn the vehicles, as intended. BUT if you have AI in them initially, the do not respawn, hence all the asking for help here
they should respawn with the vehicle. but for some reason, now they don't
i seen something about it not working since 1.68 or something like that.
yes
the crew gets respawned with said vehicle
but waypoints for whatever reason don't stick
even with copyWaypoint
add systemChat str [group (_this select 1), waypoints group (_this select 1)]
into the expression field
do i add that by itself and no others?
doesn't matter
it will output something to chat
see if the group is actually still there and the waypoints are what you expect
im guessing the group no longer exists at the time of the execution of that field, thus copyWaypoints doesn't do anything
but its weird because they are there
or maybe it should be copyWaypoint
without the s
no
oh
just trying to thinkOutside the box
ok i got a picture of it
but how do i show the whole error
it says there is an error
yeah it says that
but where?
i have it at the end of my string
CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1));
where would i put the ;?
Bohemia Interactive Forums
Greetings, I am attempting to get an enemy AI vehicle to respawn once it is destroyed in a MP mission and follow the previous waypoints it had on patrol. I have tried the copyWaypoints in various combinations but not sure if some of the commands can be executed from the vehicle init or the respaw...
thats where i came across the string
the code you sent does not have any missing semicolons
all i'm trying to say
it's elsewhere
check rpt
!rpt
Arma RPT
Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.
To get to your RPT files press Windows+R and enter %localappdata%/Arma 3
Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files
To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.
Error in expression <ct 0)), waypoints group (_this select 1));>
19:40:43 Error position: <);>
19:40:43 Error Missing ;
19:40:43 Error in expression <ct 0)), waypoints group (_this select 1));>
19:40:43 Error position: <);>
19:40:43 Error Missing ;
where's that code from?
the report
ct 0)), you don't have any commas in your code
This error is being generated by a different piece of code to the one you've shown us
hold on let me use the sqfbin
https://sqfbin.com/ paste it here
already pasted there
then give us the link? 
19:38:59 Error in expression <systemChat str [group (_this select 0)), waypoints group (_this select 1)>
19:38:59 Error position: <), waypoints group (_this select 1)>
19:38:59 Error Missing ]
19:38:59 Error in expression <systemChat str [group (_this select 0)), waypoints group (_this select 1)>
19:38:59 Error position: <), waypoints group (_this select 1)>
19:38:59 Error Missing ]
you missed a ] from the code i gave you
CreateVehicleCrew (_this select 0); (group(_this select 0)) copyWaypoints (group(_this select 1)); systemChat str [group (_this select 1), waypoints group (_this select 1)];
put this in the expression field
ohhh ok
wait, why are there 2 select 1's in this string vs this select 0 and this select 1?
just curious
ok nothing popped up when it loaded in
i don't know what you were trying to do
yeah, you need to destroy the vehicle
to make it respawn
yeah so that's what i said
is there a way to not delete the vehicle?
check the module settings
well then use killed event handler
https://forums.bohemia.net/forums/topic/222710-script-respawn-vehicles/?tab=comments#comment-3348736
Bohemia Interactive Forums
Thats the expression field, if you use something like this in the objects init field: [ AmmoboxInit, [ this, true, {(_this distance _target) 10} ] ] call BIS_fnc_arsenal; then you need to change it into this to make it work in the vehicle respawn modules expression field: params [_newVehicle,_ol...
"Wreck"
do you not have that option?
in the respawn module or the spawn ai options module?
respawn
there is preserve, delete and delete with explosion
params ["_new", "_old"];
createVehicleCrew _new copyWaypoints group _old;
deleteVehicleCrew _old;
deleteVehicle _old;
put this in expression field
and it should work
ok
edited, bit faster
it works!!!
you're awesome bro
if i had nitro, i would gift you something.
thank you!
np
that took a minute lol
if you had just c/pd this 1:1 instead of trying to edit your own stuff, it would've been faster 😄
hey, its all about learning. oneScript at aTIme
again @copper raven thank you so much
is there any way to increase the volume of trigger sound without having to resort to playSound3D 
i don't think so as they're engine driven
sadness
time to figure out how to use while loops and sleeps properly
_thisTrigger = thisTrigger;
_thisTrigger spawn {
//blah
``` seems to be complaining thisTrigger is undefined and yet is in the activation field of it 
thisTrigger not _thisTrigger
oh you did that im goofy
putting it in through the spawn was complaining of a global variable in a local space
thisTrigger spawn {
_trigger = _this;
//...
};
did you do it like this?
wat?
i did thisTrigger spawn { and game complained that thisTrigger was a global variable
can you send the full error
thisTrigger is actually a local variable
wait i forgot the params bit in my example whoops one moment on that too
oh its complaining when i pull params through
params ["thisTrigger"]? 😄
thisTrigger spawn {
params["thisTrigger"];
//code go here```
exactly 😄
do i not need to do that
you cannot put global identifiers in params
but is thisTrigger not a local variable
it is, but only engine can do such behavior
just do this problem solved
or you can slap an underscore in front of your newly defined variable
thisTrigger spawn {
params["_thisTrigger"];
//code go here
also problem solved
for "a" from 0 to 5 do {
a = 4; // assigns to global 'a'
hint str a; // prints value of local 'a'
};
this is similar to thisTrigger
you'd think this would crash the game because a is never 5, but that's not the case
perfect its working now thanks 🙂
you also cannot write into actual thisTrigger, because there is no way to do so (you can only assign to a local variable if it's _ prefixed), thisTrigger = 1337; systemChat str thisTrigger you will still get the trigger handle printing
oh
thomk
thank you
me again
i presume BIS_fnc_replaceWithSimpleObject is not to be used to optimise large scale mp scenarios (where localonly is not useful)
I believe the doc is self-explanatory
if i do private _randomWeapon = selectRandom ["random_gun1","random_gun2"];
how can i make there also be specific ammo for each of the guns
you can private _randomWeaponWithAmmo = selectRandom [["random_gun1", "ammo1"], ["gun2", "ammo2"];. Or you can private _randomWeapon = selectRandom ["random_gun1","random_gun2"]; private _randomMagazine = selectRandom compatibleMagazines _randomWeapon;
any chance someone here knows the name of the display menu used for Arsenal loadout save/load?
"name"? I believe it uses its own template save/load menu. configFile >> "RscDisplayArsenal" >> "Controls" >> "Template" defined in ui_f,
if i do ```sqf
ranFnc = {
private _randomWeapon = selectRandom ["random1","random2","random3"];
private _Holder1 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_Holder1 addweaponcargo [_randomWeapon,1];
private _Holder2 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_Holder2 addweaponcargo [_randomWeapon,1];
};
yeah
you make the random once, line 2
private _choices = ["random1", "random2", "random3"];
private _holder1 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_holder1 addweaponcargo [selectRandom _choices, 1];
private _holder2 = createVehicle ["WeaponHolderSimulated",[6858.84,6466.95,-0.523778],[],0,"CAN_COLLIDE"];
_holder2 addweaponcargo [selectRandom _choices, 1];
```@worthy igloo does this make more sense?
i understand but i thought both ways would of worked
private _randomWeapon = selectRandom ["random1","random2","random3"]; = "select a random value out of 3 and store it as a private variable named _randomWeapon"
_Holder1 addweaponcargo [_randomWeapon,1]; = "add whatever is stored in _randomWeapon variable into _Holder1 inventory"
for mags would it be _Holder1 addMagazineCargo [compatibleMagazines _Holder1 weaponcargo, random 8];
compatibleMagazines _Holder1 weaponcargo doesn't make sense.
weaponcargogoes in front of inventory, soweaponCargo _Holder1;- it returns array, to get a weapon from it you
select:(weaponCargo _Holder1) select 0; compatibleMagazines ((weaponCargo _Holder1) select 0)returns array of all compatible magazines for that weapon;selectRandom (compatibleMagazines ((weaponCargo _Holder1) select 0))to select a random compatible magazine.
with the end result of _Holder1 addMagazineCargo [selectRandom (compatibleMagazines ((weaponCargo _Holder1) select 0)), ceil random 8]; (ceil added as i'm not sure what addMagazineCargo does with non-integer magazine counts)
also addMagazineCargoGlobal would be needed if the inventory state should be the same in multiplayer
addMagazineCargo seems to round halves to the nearest even number O_o. 0.5 becomes 0, 1.5 and 2.5 become 2, 3.5 and 4.5 become 4... 
lul - tell Dedmen and run away 😄
That sounds correct yes
It's a legit rounding mode. Called round-to-even or bankers' rounding.
Avoids bias when you're accumulating a lot of halves.
Hi I have a question about HCs.
HC1Present = if(isNil "HC1") then {False} else {True};
if (HC1Present && isMultiplayer) then {do stuff on HC1;
};
}
else { do stuff on Sever;
};
};
Im trying to just run this script on one of two HCs. But I cant figure out a method to detect if it is HC1 or HC2.
How to use SQF syntax highlighting in Discord
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
define "detect if it is HC1 or HC2", please.
"Get network ID of HC1/HC2 from the server to do remoteExec"?
"For the code running on some HC detect which specific HC it's running on"?
Something else?
"For the code running on some HC detect which specific HC it's running on"?
this fits
I tried smth like this to get a bool but it didnt work
_HC1C = if("HC1" == vehicleVarName player) then {true} else {false};
o_o
please don't
returning a bool from an if statement is redundant
_bool = if <condition test> then {true} else {false};
is the same as
_bool = <condition test>;
yeah now i see it lol
well, that code seems to be taken directly from guide :3
yes its from the guide for hcs ^^
o_o
"HC1" == vehicleVarName player should work (or be close) from what i see in the docs 🤔 Maybe !isNil "HC1" && {HC1 isEqualTo player}. I need to check when i get home
the second line with the stupid if is from me no worry xD
external guide linked at the end of https://community.bistudio.com/wiki/Arma_3:_Headless_Client, page 4
yeah this is the code i use and now i want to just execute it on one hc. in its current form it is executing it on booth.
private _isHC = not isNull (missionNamespace getVariable ["HC1", objNull]) && { player == HC1 };
```no?
i mean this is from me bcs its stupid xD
_HC1C = if("HC1" == vehicleVarName player) then {true} else {false};
aaah, external guide
I would have been sad to see this on the biki
linked at the relevant wiki page, though
yeah well
my take is: why even bother actively running any code on HCs when server can run all the logic and remoteExec needed parts 🤷♂️
also, if i actually read the wiki correctly, HC object seems to be always present, but only returns isPlayer HC == true when actual HC is connected? Need testing. Too much fluff, conflicting information and code based on decisions/problems i know nothing about
Q: using CBA to respond to a class "init" event. That is receiving the target object correctly (CBA_fnc_addClassEventHandler).
I am trying to turn that around into a JIP callback. I am pretty sure the remoteExecCall invoke is happening, but for some reason is receiving an objNull for the object I relayed from the CBA callback. The CBA EH is receiving the object correctly, is not null.
private _global = 0;
[_unit] remoteExecCall ["kplib_fnc_captiveUI_addCaptiveActions", _global, _unit];
Intending to JIP invoke globally for as long as _unit remains alive and not null.
Oddly enough, the same sequence is happening just fine for my player object. I see those relayed from the CBA callback just fine, and is received just fine via the remote.
Then there is the matter of I guess needing a CfgRemoteExec, which I have not got, so it is strange that the remote is happening at all.
is there a way to stop a marker blinking
I do not think this is the issue, however, according to the wiki, CfgRemoteExec defaults.
createGuardedPoint [side, position, objectMapID, vehicle]
where objectMapID: Number - static id of map object.
Can someone please let me know how to find the objectMapID ? it requires as Number (not array).
-1 to ignore should work well if you provide coordinates already, though?
private _randomLoc = selectRandom ["US_heliCrash_1","US_heliCrash_2","US_heliCrash_3","US_heliCrash_4","US_heliCrash_5"];
_UH60Wreck setPos (getPos _randomLoc);
``` any know why this wont wrk
are they randomly selected objects? or markers?
objects
looks most of the above worked 🤷♂️
HC1 is always defined if it's present in mission, so isNil check is likely unneeded.
player == HC1 is true on a headless client running HC1 (so player == HC2 should be true on a headless that runs HC2).
"HC1" == vehicleVarName player is also true on a headless.
isPlayer HC1 is true when headless is connected and false when not. On all machines, server/client/headless alike.
local HC1 is true on server when headless isn't connected and is true on headless when it's connected. False everywhere else, obviously.
[[args],{code}] remoteExec ["call", HC1] does target a headless for remoteExec.
you are randomly selecting one STRING not an object; could be a marker, but if an object, then you need to resolve that object from the namespace.
_hc1present = not isNil "HC1";
if(_hc1present && HC1 == player)then{
//do HC1stuff
}
else{
if((isMultiplayer && isServer && !_hc1present) || !isMultiplayer){
//backup
}
}
got it to work this way ^^
i'd argue _hc1present = not isNil "HC1"; check is only needed if you intend to share your script between multiple missions and not all of them would have HC1 placed on map. Otherwise it'd be always true.
yeah i intend to use it for multiple missions
but ill write down your thing with remoteExec, may be handy for some cases ^^
If it is a marker you have to use https://community.bistudio.com/wiki/getMarkerPos instead of getPos (also don't use getPos/setPos)
figure it out, the remote exec is fine; the CBA event needed adjustment.
how do i add sqf {hint "Players have arrived at crash site and the self destruct has been started.";} remoteExec ["bis_fnc_call", 0]; [] spawn { sleep 60; private _DestroyWreck = createvehicle [ 'ammo_Missile_Cruise_01',getpos _UH60Wreck,[], 0, 'can_Collide']; sleep 0.5; deleteMarker _marker; deleteVehicle _UH60Wreck; deleteVehicle _fireObj; deleteVehicle _Holder1; deleteVehicle _Holder1; deleteVehicle _Holder2; deleteVehicle _Holder3; deleteVehicle _Holder4; deleteVehicle _Holder5; deleteVehicle _Holder6; _UH60Wreck = objNull; }; into a setTriggerStatements I tried a bunch of things
_targetTrigger setTriggerStatements [toString {condition code}, toString {activation code}, toString {deactivation code}];
{hint "Players have arrived at crash site and the self destruct has been started.";} remoteExec ["bis_fnc_call", 0];
Don't do this. Do this:
['Players have arrived at crash site and the self destruct has been started.'] remoteExec ['hint'];```
BIS_fnc_call is, as far as I can tell, almost completely pointless, and in any case there's no need to use any type of `call` layer since you can just remoteExec `hint` itself
Also, the targets parameter for remoteExec is 0 by default, so if you want to use 0 and you're not using the JIP parameter you can just skip it
deleteVehicle _UH60Wreck;
deleteVehicle _fireObj;
deleteVehicle _Holder1;
deleteVehicle _Holder1;
deleteVehicle _Holder2;
deleteVehicle _Holder3;
deleteVehicle _Holder4;
deleteVehicle _Holder5;
deleteVehicle _Holder6;
You can save yourself a lot of space on this:
{ deleteVehicle _x } forEach [_UH60Wreck,_fireObj,_Holder1,...];```
Need some help with an intel script. Can't seem to find anything that works. Trying to have it when you pick up the intel, a pic pops up as well as description in the intel section when you pull up the map.
you have undefined variables everywhere
and what the heck is that remoteExec
I have a feeling most/all of them could/should be global variables rather than local, then there wouldn't be any problem
Hello, is there any way to make the flag of a vehicle stay if it respawn?
flag?
I am useing this forceFlagTexture "\rhsafrf\addons\rhs_main\data\Flag_rus_CO.paa";
what are you using to make it respawn?
The module Vehicle Respawn
use its expression field
I dont underestend
in the module attributes, there is a field called "Expression"
it runs everytime a vehicle respawns
What should I put there? this forceFlagTexture "\rhsafrf\addons\rhs_main\data\Flag_rus_CO.paa";?
no, this is not defined there, _this select 0 should be correct iirc
So, this: _this select 0 forceFlagTexture "\rhsafrf\addons\rhs_main\data\Flag_rus_CO.paa";
yes
Hello there, I am coming here with a question that has been bothering me for the last few hours.
Finally got my CBA_fnc_addKeybind working, when I am alive, but once I die and move into spectator, they stop working.
Any idea what might be causing it?
When re-spawned, they start to work again, but I need them to work while in EGSpectator too.
I tried calling the function that adds the keybinds after initialising EGSpectator, but that did not help unfortunately.
How I add the keybind:
["IMF","open_admin_menu", "Opens admin menu", {call IMF_fnc_openMenu}, "", [DIK_HOME, [false, false, false]]] call CBA_fnc_addKeybind;
The function it calls certainly works in spectator too, as when called from debug console, the admin menu opens.
The respawn no longer works
theres probably a different display
that code should not break the respawn, you did something wrong
Expansion: in this context, the special variable _this contains an array of references which the module passes to the expression code. _this select 0 picks out the first (well, 0th) element of that array, which should be the new vehicle. (If it's not 0, it will probably be 1).
That's what I thought too. That's why I went from direct display 46 to CBA keybinds, but it's possible they just don't work that way. So I might need to add oldschool :
"Raw" eventhandler on the EG display. Which I wanted to avoid with cba
do something similar to what people are saying there
Don't think this relates, as pressing my key few times will actually open the dialog few times
try the keyup event instead
Ok, will do, but I am ending it for today. Will report tomorrow
You were correct, thank you, it worked.
otherwise,
_display displayAddEventHandler ["KeyDown", {call cba_events_fnc_keyHandlerDown}];
_display displayAddEventHandler ["KeyUp", {call cba_events_fnc_keyHandlerUp}];
where _display is the spectator display
60492 should be the correct idd
This sounds promising
Thanks for the info, will look at it tomorrow!
["GetDisplay"] call BIS_fnc_EGSpectator
hello, is there anyway to make the respawn, of for example, a tank, cosumes more tickets than a "human"?
manually reduce the tickets with BIS_fnc_respawnTickets?
Solvded, thank you
is there an easy waay to paradrop a vehicle?
create a parachute and attach a vehicle to it
Vehicles ejected from ViV in midair (e.g. Blackfish Vehicle Transport) will automatically receive a parachute. You can do that with https://community.bistudio.com/wiki/setVehicleCargo
would be nice if we could override that default behaviour now we have event handlers
how would we go about setting someone to the surrenderd state through ace? cant find the name of the fnc
basically want something like the achillies zeus module to be applied to a list of units
Added it to onPlayerKilled.sqf and sadly did not help 
Has anyone found a way to create an outline of an object/unit?
Bit like how other games let you see friendlies through walls.
nope.
Just the old "Skeleton" method?
That's a shame.
If you had the time and patience I suppose you could set it up with 3D icons which are just lines at set offsets from hitpoints to create some outlines.
https://community.bistudio.com/wiki/selectionPosition
returnMode: String (Optional, default "FirstPoint") - can be one of:...
"BoundingBox"
If that's in regrads to me - yeah, that's how people do the skeleton method.
Hia!
Does 'sync to' work between 2 prop objects?
define "sync to", please. Documentation says
Syncing
Character & ObjectA generic connection without any inherent functionality.
Err- tge connect to thing... sorry I am away from pc atm 😅 the sync to option on one object, then go to another object and it makes a line between them
I assume that is also what is used with 'syncronizedObjects'
if you only expect syncronizedObjects to work, then probably yes. Let me actually check
although the same doc states "One of the connected entities has to be a character, otherwise the connection will not be recognized once the scenario starts." 🤔
Oh...
Where was that, sorry? I must have missed that
Huh- so now, I got a problem. I want to have it so I have a prop that has an action added to it (addAction) and then its linked somehow to 1 other prop that it gets the location of and when the action is preformed, it teleported the caller to the location
One thing is I could have it just use the variable name- thing- again away from pc 😅
you can synchronize both of them to a Logic. But synchronizedObjects doesn't seem to work on "dumb" props (like air intake plugs) for me 🤔
lemme try one dumb thing
I know if I have a chair and a unit itll work. But I dont wanna have a chair and a unit xD
(Was messing with sitting animation, sync the guy to the chair so he would be moved to the chairs position)
Is there a config for the model position on a vehicle that a projectile is spawned at?
trying to get the precise (roughly) position that the projectile of a weapon is spawned at
I can derive in SQF with brief use of Fired event handler
so, you can place all your props, give them varnames, sync all of them to Logic and place this in Logic's Init: sqf _so = synchronizedObjects this; { _current = _x; { if (_x == _current) then {continue}; _current addAction [ format ["Teleport to %1", vehicleVarName _x], // name depending on variable name of a prop {player setVehiclePosition [_this#3#0, [], 3, "NONE"];}, // _this#3#0 takes the target from below [_x] // give a target to teleport code ]; diag_log str [_current, "to", _x]; } forEach _so; } forEach _so;
you get a bunch of actions on every prop to get teleported to every other prop :3
Hmm... noted. Although I had an idea that is overco.plicated for no reason.
🤷♂️
(The best kind of ideas xD especially in a lang you dont know well!)
I can make UI in a mission right? Like, custom window that has buttons?
yep
gunBeg I think
although that (GUI) takes the amount of needed code up by at least an order of magnitude
Maybe have a collection, inside are some object that have the addaction on them, then the rest of the object have- someway of having variable that are visible. Maybe setVariable?
So you go to one of the interactive objects, do the action and it then read all the objects in the collection with the variable set and lists them.
I wanna have it so I can copy and paste it to have more hen 1 teleport with minimal changes to get them both running seperatly
thanks
🤷♂️ with what i posted, place 2 (or more) Logics, sync them to different props and you effectively get 2 (or more) teleporter "networks". And one prop can be used in different "networks" and be a common hub, in effect :3
What- so what is varname?
Oh am I being dumb. Is varname not the global unique id? XD
https://cdn.discordapp.com/attachments/737175675818999898/1032256185023340605/unknown.png "Variable Name" in object properties
(Btw, its an elevator x3) I would get 'floor_1_1' though or similar right?
If I want 2 elevators that went to the same floor
yes it wouldn't work if you want to have a bunch with similar endpoint names
Yea, so then thatd mean having to go in and change them all basically.
Although- hmm- it is an idea though..
I do like the window idea. Especially because it might be easier to reuse, and- never really messed with GUI stuff yet so :P
making code ( still learning sqf) and got a enum error?
what does it mean?
you_puppy_player={ params [["_object", player]];
private _dog = createAgent ["Fin_random_F", getPosATL _object, [], 0, "NONE"];
_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
selectPlayer _dog;
_dog addEventHandler ["onMouseButtonDown",
{
params ["_displayOrControl", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
_ppl = _dog nearentities ["man",1.5];
_ppl setDamage 0.6;
[_ppl, true] call ACE_captives_fnc_setSurrendered;
}];
private _show = "camera" camCreate [(getPos _dog) select 0, ((getPos _dog) select 1) + 0.3, ((getPos _dog) select 2) + 0.92];;
_show CamSetPos [(getPos _dog) select 0, ((getPos _dog) select 1) + 0.3, ((getPos _dog) select 2) + 0.92];
_show attachTo [_dog];
_show switchCamera "INTERNAL";
};
code for reference
error was at _dog #addEventHandler ["onMouseButtonDown", { params ["_displayOrControl", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
