#arma3_scripting
1 messages · Page 203 of 1
QGVAR is macro -> quoted variable,
So
QGVAR(createZeus)
Becomes
//Quoted -> Prefix, addon,()
"ace_zeus_createZeus"
And it's called with
["ace_zeus_createZeus",player] call CBA_fnc_serverEvent;
https://cbateam.github.io/CBA_A3/docs/files/events/fnc_serverEvent-sqf.html
Neat, that actually works
I'll still try implementing my own thing because it puts a little "Created" on the screen which I don't like
Thanks for the help!
Works like a charm now
Made a little function like this and called it in preInit:
_gmGroup = createGroup sideLogic;
gm = _gmGroup createUnit ["ModuleCurator_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];
gm setvariable ["owner","#adminLogged"];
publicVariable "gm";
Sorry but I'm still struggling with my zeus module. I'm having trouble making the module public so I can later add units as editable objects. So far I've tried publicVariable and missionNamespace setVariable. Any other way to access it from outside the script?
Oh I think I can steal from the ACE guys
Nvm I can't attach it to the owner because my owner is #adminLogged 🙁
so when it comes to unit capture, if I choose to dump the unitcapture data in an sqf. (here's one as an example)
SHUC1 = [coords here];
[AFB1, SHUC1] spawn BIS_fnc_Unitplay;```
and to activate it I put this in a trigger
```sqf
execVM "AFB1.sqf"```
if I wanna put the sqf file in a separate folder, do I have to do anything different to the trigger?
I'm worried if I put it in a separate folder, instead of the mission's root folder, the game won't be able to find the thing
You can do execVM "<folder>\AFB1.sqf"
Your folder needs to be within your mission folder
While having another "aim" test with a group of 3 soldiers (i.e. one leader and two soldiers), I noticed something odd: The 2 soldiers "aim" immediately at the intended target (using doWatch, knowsAbout, revealand doTarget) when I step into the repeatable trigger, BUT the leader for some reason takes his time to adjust his aim (about 2-3 seconds). I even cranked up the leader's spot time, aiming speed and spot distance to 100%, but he remains markedly slower to act than the two soldiers he commands. What could be the issue? Should he not be able to adjust his aim with the same speed just like the two others, as the target he should aim at is handed to him via the trigger?
Did something change with how pilots decide to eject from planes? I've had the same SAM launcher and pilot in my mission always eject right before the missle hits. Tested this literally over 50 times over the course of making this mission. But now he just sits there and eats the missile, killing him. Is there a command that tells a pilot to eject? Maybe I could fix the issue that way...
Did you have any AI mods originally? Is the AI accidentally on careless? Anyways, if you just want a fix, you can do a projectile distance check and force the pilot out when it's about to hit.
No AI mods. Just SOG CDLC. Behavior for the group is set on safe at the moment in the editor. I've been playing with the setting the damage of the plane. At 40% damage he will eject before the missle hits. Gonna play around with this and see if it can be consistant. Just so weird that something changed. I had this on a 100% success rate before with lots of play testing. Take a break for 4 months, come back, and it's different.
If there anyway to get Civilian to be Seperate from Independent?
addMissionEventHandler ["EntityKilled",
{
params ["_unit", "_killer", "_instigator"];
_killersCash = _instigator getVariable ["Cash", 0];
_PenaltyCivilian = 100;
if (side _unit == Civilian) exitwith
{
_killersPenaltyPLY1 = _killersCash - _PenaltyCivilian;
_instigator setVariable ["Cash", _killersPenaltyPLY1, true];
hint format["Killer: %1 Cash %2", name _instigator, _killersPenaltyPLY1];
};
}];```
I have this, but everytime you kill a Independent it says you killed a Civilian
maybe I've been staring at it for too long, I put the hint in to confirm it and i'm not entirely sure why its picking up Independent as Civilian kills
should probably check for a IsKindOf rather than unit side now that i've posted it
Sides are kinda weird on death.
I forget the exact rules. It's not documented.
side group may or may not work, as they leave the group at some point too.
oh because when you kill anything.. it becomes civilian? judging by Zeus
Other approach is that you set a variable on them on creation.
(side (group _unit)) == civilian
Nice, its working now
cheers guys 🍻
I have a addon using a hemtt+cba template, how should i define a optional dependency? I dont need that .pbo at all if it is missing.
just check isClass (configFile >> "CfgPatches" >> "mod_name") in all the XEH_scripts and exit early?
Or is there some better way, like the requiredAddons in config.cpp but instead of a error it just gets ignored?
I believe this is what you need.
skipWhenMissingDependencies = 1;
Depends on what you're doing
If you're making an addon that does config changes, you need to use requiredAddons and skipWhenMissingDependencies
If you're just doing a small individual script, you can just check if the class name exists in CfgPatches
Just know that skipWhenMissingDependencies makes the whole addon not be included
another noob question. I'm making a TP system that points to team vehicles. Is there a place I can put Y-2 so you don't TP inside of the vehicle in the following code, this a line from the original TP start point:
this addAction ["<t color='#E50000'> ALPHA 1-1", {player setPos (getPos ALPHA_11_TRNSPRT)}];
ALPHA 1-1 what shows on the menu, ALPHA_11_TRNSPRT is the variable name of the vehicle
Pleas, and thank you
Y-2?
-2 in "Y" direction of the variable
oh, I think you mean like
{ player setPosATL (getPosATL
ALPHA_11_TRNSPRT vectorAdd [0,-2,0]) };
if you just want them not to spawn in/on the vehicle and you don't care about the direction then setVehiclePosition with "NONE" probably works.
ahh, perfect, I assume [0,-2,0] is XYZ. [0,0,5] would pos +5 in "Z"
Yeah, positions in SQF are just three-element arrays, [x,y,z]. Some commands use different orientations though so you have to check.
Will do. Works perfect, I appreciate you. Someone left my group, and I'm trying to lean as much as possible, very quickly, to replace him. I appreciate the help from this channel. Sorry, but I'm probably gonna be a bug in here for a bit
Just double checking, the maximum load of uniforms/vests/backpacks are only adjustable in config and can't be set from SQF alone, right?
setMaxLoad
ooh, interesting
I'm just adding some eventhandlers if tfar is loaded.
By whole addon you mean that addon folder, not all the folders within the addon as a whole right?
No skipWhenMissingDependencies means it won't load any of the addon, any textures, sounds, models, etc. in that addon won't be available
For event handlers, you can just only add them if tfar is loaded
Ok, thanks 🙂
@fair drum sir, I hate to bother you again, but I can't over-emphasize how new I am to this stuff, if you get a minute, could I get you to DM me, or @me, please
you can ping me here whenever. I prefer it here so that others can take over when I disappear as I'm on call so much at the hospital
I get that. I wasn't sure which would be better, I didn't want to be the guy that clogs the channel with nonsense and redundant information. I'm extremely new to this world. I started making Reforger stuff for my group, but Reforger really doesn't require any scripting knowledge. One of the guys who was making our A3 stuff stepped away from the group. Now I'm trying to roll back to something I don't understand. I say all that, to say, is there a good starting point to know the basics, for instance the script you made me last night goes into the mission folder as its own script file, or in an init script box of the rifle groups, or in an init box of the mission itself?
the script i wrote goes into the editor debug menu (preferably with advanced developer tools mod so it doesn't scream at the comment). Its an editor script, not a mission script
Perfect, I'll try to get it up to speed in a few. Thank you so much, homie
I didn't want to be the guy that clogs the channel with nonsense and redundant information
and I don't mind helping out noobies. I actually enjoy it.
Thank you. It's hit or miss in these channels, sometimes it's great, sometimes it's like a machinist trying to ask an engineer something. I definitely appreciate the help
I'm trying to make a second function and I've messed it up somehow. Does this look right?
{
class FoxClub
{
class fnc
{
file = "functions";
class Conversation {}; // this will make the function FoxClub_fnc_conversation
};
{
file = "functions";
class intelFound {};
};
};
};
Remove the three lines between the two functions and it's correct.
As it is, it's not :P
class CfgFunctions
{
class FoxClub
{
class fnc
{
file = "functions";
class Conversation {}; // this will make the function FoxClub_fnc_conversation
class intelFound {};
};
};
};
That's three lines.
Ah I see. Thank you. Can I name fnc to whatever or does it need to stay?
If you use file inside it then it doesn't matter what it's called.
Like is that just for organizing? I could have a couple different names with stuff in each respectively right?
It sets the default path, but file overrides it.
so yeah, if you do that then it's just for organization.
Normal for mods because the default path is useless there.
But you still want a 1:1 category to folder mapping usually.
Would this work?
class CfgFunctions
{
class FoxClub
{
class Conversations
{
file = "functions";
class Conversation {}; // this will make the function FoxClub_fnc_conversation
class intelFound {};
};
class OtherUsefulStuff
{
file = "functions";
class Usefulstuff1 {};
class Usefulstuff1 {};
};
};
};
yes but it's degenerate
What does deneerate mean?
well, assuming you didn't mean to type Usefulstuff1 twice.
If it's worth another category then it's worth another folder.
oops
Okay got it. So make a new folder for functions that are very different from one another.
This gets an error for undefined variable _caller. My function starts with:
params ["_target", "_caller", "_actionId", "_arguments"];
_scout = missionNamespace getVariable ["scout", objNull];
if (_caller == _scout) then {
Maybe the call isn't passing _caller to the function?
I call it like this:
params ["_target", "_caller", "_actionId", "_arguments"];
[_caller] call FoxClub_fnc_intelSearch;
yeah, but what calls this? you have this deep call stack
The call is place in the on start portion of a holdAction
The code there works fine but I was trying to put it in a function for readability. I use two other functions on the on complete portion of the holdAction and they apparently pass caller successfully.
Yes. line 15 in the function
which is if (_caller == _scout) then {
params ["_target", "_caller", "_actionID", "_arguments"];
[_caller] call FoxClub_fnc_intelSearch;
// intel search
params ["_caller"];
preferred:
_this call FoxClub_fnc_intelSearch;
// intel search
params ["_target", "_caller", "_actionID", "_arguments"];
// stuff
do you see the difference between these and yours?
look at the order of them, not that they were removed
if we do it your way:
https://discordapp.com/channels/105462288051380224/105462984087728128/1410430253922386022
_caller is now inside of _target
and none of the other params exist, they are all nil
remember, order is what matters, not what they are named
[_caller] call FoxClub_fnc_intelSearch;
// for this example, is basically
[_caller, nil, nil, nil] call FoxClub_fnc_intelSearch
// your function is looking for
[
"_target" // now has _caller in it because this is at index 0, just like your function call
"_caller" // nil
"_actionID" // nil
"_args" // nil
]
Hmmm... so if I wrote this it would fix it now that the function.sqf sees the indexes in the correct order?:
[_target, _caller] call FoxClub_fnc_intelSearch
sure, and if you didn't care to pass target, you would do:
[nil, _caller] call FoxClub_fnc_intelSearch
what
_this call FoxClub_fnc_intelSearch;
is doing, is just bringing all the parameters from the previous scope, to the new scope, in the order they already exist in
because _this is really just [_target, _caller, _actionID, _arguments]
so its like writing
[_target, _caller, _actionID, _arguments] call SomeFunc
Whoa... I'm try that now! 🤯
keep in mind the brackets
[_this] // translates to [[_target, _caller, _actionID, _arguments]]
_this // translates to [_target, _caller, _actionID, _arguments]
is there a way to easily sort a hashmap?
hashmaps don't have "position" like arrays do
I hate that haha
it doesn't create in order
So do you need to write params in the function.sqf AND the holdAction? Or one or the other?
it takes a different way of thinking, yes
nope, its all just key value pairs
Oh well for sure on the holdAction
I mean not even by creation order 😭
thats where there _this grabs it
I write the params when I want to do something with them. if you are just passing them from one function to another without using them, I like to use _this
it does not follow creation order
the question you need to ask, is why you need them sorted
I'm running a script that get some phases that has a progress (0 to 1), it starts with phase 01, so my first idea is to run a forEach loop and get the first key/phase that is below 1. But of course, hashmap doesn't have an order
I'll find another way
you can use those phases (string) as keys, or you could use numbers as keys. The issue is the forEach loop. Iterating over a hashmap is slower than just using an array.
yeah, gonna make an array using number to id the phases, thanks for the idea
I usually store keys order alongside the data itself
createHashMapFromArray [
["order", ["key1", "key2", "key3"]]
,["data", createHashMapFromArray [
["key1", 100]
,["key2", 200]
,["key3", 300]
]]
];
But you'll need to be careful when creating and editing the hashmap to keep same keys in both array and data
Thank you. I got it working using only arrays.
FYI on the public ACE3 Slack we have the #intercept channel for public people to start to get to know Intercept
Hi all. Anyone knows how to work the setObjectScale command?
I tried typing:
conc_wall_001 setObjectScale 1.3;
into the ini of the objects, but after publishing the mission into Steam, when loaded into the game tey appear with the original size.
I also tried to attach to another object as some forums suggest, but same result.
conc_wall_001 attachTo [box, [0,0,0]];
Any help would be greatly appreciate
i would say you will find answer from examples ->
https://community.bistudio.com/wiki/setObjectScale
It should work if its simpleobject or attached and then scaled
mp environment brings its own issues with scaling
im curious - why is it illegal to start a unit's variable name (in eden) with a symbol/number, but setting a variable using setVariable to namespace or wherever else that starts with a symbol/number seems to work fine?
(been setting some variables to missionnamespace using hashValue which can generate numbers and symbols and was surprised that it worked)
I also tried with the Wiki, but it doesn't work whilst playing the mission (in SP)
it is because it is 😄 let's say a namespace uses string as identifier, while a variable in script is parsed - and in general you cannot start with a number
so it is just down to the parsing then, gotcha - yeah i was just curious about that behavior
thanks
Are you making these simple objects first?
yes, using the allSimpleObjects [className1, className2]; command.
now It works but if I try to change the scale of an object with position and rotation it loses the params (position and rotation)
allSimpleObjects doesn't create simple objects
Well,
You need to read more from the wiki.
Changing the direction of the object (e.g. using setDir, setVectorDir, etc.) will reset the object back to its original size (probably because the engine normalises the directions, thus the scale in the transformation matrix becomes 1), so those commands should be run before resizing the object.
Instead of using the ammo vics to resupply vehicles or turrets, is there a way to turn objects such as boxes into ammo vehicles in terms of them able to rearm turrets or vics in the vicinity?
I think it's a config thing... but you can script that in other ways
thnx, but this has a base and rearm vics close by
i want it so i have a props nearby that rearm turrets in its vicinity
how come? did you actually read the code?
wait, do i put that sqf in a prop and it will rearm and refuel nearby vics and turrets?
this function of mine is for my cas menu, you have to get it and make changes for your own scenario
but basically it checks for a x object nearby to rearm, refuel, and repair
i see
not too well versed in scripts but i'll see what i can learn from it and dissect
ty
np, just ask here if you need some help on that
yes vanilla already has vehicle supply boxes
but yeah thats config
Is there documentation on how leader player is chosen? Let's say there are 8 editor placed slots in one group for multiplayer. The game starts and slot 1-4 are human and slot 5-8 are AI and all AI outrank human players (rank set in editor). How is leader player chosen then?
Single player is easy to determine. The player controls the AI so thats the leader player. But in testing my MP mission I've seen it hand off leader player to the AI and I cant determine if it's chosing based on slot or rank or what.
Rank (sometimes) determines inheritance, but the initial group leader is determined by...the leader of the group. Typically the first unit placed in the group, or the first unit in the group's config if it was placed from the Groups menu, or the unit to which other units were manually grouped, or the unit set as the leader from the right-click context menu.
If you need to override it, use https://community.bistudio.com/wiki/selectLeader
So if I have 8 slots and lets say just two people join. They chose slot 4 and 5 (AI disabled) who is leader player?
I feel like we've had this conversation before
We defintley have. And I've forgotten most of it. Cause it was months ago.
Typically it will be the earlier slot (4) because that's usually the older unit (in terms of Editor placement order and therefore unit creation), but that isn't necessarily the case.
Specifically setting the leader, through selectLeader or the context menu, could make a different unit the leader.
Hmmm I wonder then if I should always force a select leader. To avoid a situation where someone dies and AI gets passed leadership.
If you can't guarantee that there will be no AI, and you can't guarantee that AI will always be lower rank than players, then yes you will probably need to selectLeader if you want to ensure that an AI never ends up as the leader.
You could use the leaderChanged group event handler to do it.
Also too, I could set all units to the lowest rank? Maybe if given the choice between a player and ai of the same rank a player always wins?
I can't decisively say that is not the case, but that's because I don't have a lot of evidence either way. It's a big assumption and I wouldn't rely on it.
From a mission design standpoint, what makes the most sense as far as who gets to control the AI? In the lobby I made sure slot 1 says group leader so players will know that's who controls AI. If that player dies then I can reassaign him group leader. That seems obvious. But if that person disconnects for some reason then who gets it next? I could select random whoevers still alive but what if a player doesn't want to have to control AI. Maybe it should be an addAction to whomever wants to have control?
Or maybe I revaluate and force AI group members to be OFF, like in the SOG CDLC.
But the Spearhead CDLC has AI squad members and its fun too.
I'm really conflicted here lol
You can also enable TeamSwitch and let players switch into any playable unit any time
Oh thats interesting. Is that like in SP when you press 'U'? I didnt know you could do that for MP.
It can be done in MP too, but with limitation - you can only switch to unit of the same team
But that's likely non issue in your case
Correct. I'll have to consider this option too.
These are very subjective questions and I would not say that there is a best answer.
@fair drum seriously, thank you, sir. works like a charm
and for the next one, is there a way to do a addaction script to activate a trigger from the menu?
Anyone remember the function for creating a class during runtime? I can't find it
You can't, config is static
This is just a guess, but I've got a feeling that was about a different language and this was the wrong channel
hm
I could have sworn I'd encountered something. Is there something similar and I'm just mis-remembering?
Not really
There's the hot reload for config, but that's only meant for development purposes. It also might not work for new classes, no clue
I'm familiar with that one and its not what I'm thinking of unfortunately. I appreciate the help
Which menu?
Maybe you're thinking of hashmaps, which can be used kind of like config classes (not for adding new stuff to actual configs though)
I don't think so, but thats a good idea. Im scouring the wiki right now trying to figure out what I'm thinking of
during debugging? in diag exe?
you can only modify the config using diag_mergeConfig
Maybe I'm thinking of addClass from vbs... ugh
Sorry, was trying to make that two separate messages, didn't mean to make it look like I was asking you specifically. Middle mouse, same place a addaction would be for a object like a TP or arsenal, but not tied to an object in this case, accessable anywhere
You would add the action to the player itself and make it so it only shows to the player.
ahh, perfect. thank you
How can I localize text in BIS_fnc_textTiles?
[format [localize "%1STR_WEID_Diary_Stash_001%2", "<t font='PuristaBold' size='1.6' color='#FFBF00'>", "</t><br />Stash location discovered"], true, nil, 7, 0.7, 0.25] spawn BIS_fnc_textTiles; does not work.
nvm I think I'm stupid.
Nope, I have no idea either way.
you are setting t tags in the localisation label…?
yeah...
Ok, I guess the parseText part is a requirement for this one. sqf [parseText format ["%1 %3 %2", "<t font='PuristaBold' size='1.6' color='#FFBF00'>", "</t><br />Stash location discovered", localize "STR_WEID_Diary_Stash_001"], true, nil, 7, 0.7, 0.25] spawn BIS_fnc_textTiles; works fine.
i think i need a rubber duck for this.
anyone have the eos files? forum is down so unable to get them off there
Looking for help on converting a selectionPosition value from relative model space to position ASL with respect to the same object, a
For some reason, using a selectionPosition "HUD LH" is yielding a different value than AGLToASL(a modelToWorld(a selectionPosition "HUD LH")) vectorDiff getPosASL (a)
Notably, the more complex statement is yielding a value about a meter higher than the other; this is more in-line with what I want, but for some reason it also changes when object a moves around, which drastically increases uncertainty in my results.
Am I missing something? I tried to trace all the correct position formats and "relative to" considerations by taking the "position in model space", converting it to AGL using modelToWOrld, and converting that to ASL where I do my comparison with the object.
Overall, I'm looking for a position of "HUD LH" that can be directly compared to a positionASL with respect to getPosASL (a); that is, the return value of this: AGLToASL(positionCameraToWorld [0,0,0]) vectorDiff (getPosASL a)
selectionPosition returns a value relative to the model center and model orientation. Even if the orientation is identity, the model center isn't necessarily the same as the ASL position.
ASL position is typically at the ground contact point of an object, IIRC.
See getPosWorld.
Correct translation of selectionPosition to ASL should be just a modelToWorldVisualWorld (a selectionPosition "HUD LH")
ASL uses XY from GetPosWorld and Z from Placing Point offset
//- - - Transition to Deploy - Fade In
titleCut ["", "BLACK OUT", 3];
3 fadesound 0;
3 fademusic 0;
Sleep 3;
//- - - Cinematic Border In
[0,0,false] spawn BIS_fnc_cinemaBorder;
Playmusic "";
["<t font='PuristaBold' color='#f7f9fa' size='1'>- 6 Minutes Later -</t>",-1,-1,7,1,0,789] spawn BIS_fnc_dynamicText;
skipTime 0.1;
sleep 6;
//- - - Hereford Hideout Prep
{ _x setunitpos "Middle"; _x disableAI "Move"} foreach units CB_G_Hereford;
CB_Hereford_Leader setpos (Getpos WP_Leader_HideoutPrep);
CB_Hereford_Gunner setpos (Getpos WP_Gunner_HideoutPrep);
CB_Hereford_Medic setpos (Getpos WP_Medic_HideoutPrep);
CB_Hereford_Leader setdir 190;
CB_Hereford_Gunner setdir 190;
CB_Hereford_Medic setdir 190;
//- - - Player Deploy
CB_Player setpos (Getpos WP_Player_HideoutPrep);
CB_Player setdir 190;
CB_Player switchmove "AmovPknlMstpSlowWrflDnon";
//- - - Show - units - Hideout - Guards
{_x enableSimulation true;_x hideObjectGlobal False;} forEach (getMissionLayerEntities "Layer_Hideout_Guards" select 0);
Sleep 2;
//- - -Fade in
titleCut ["", "BLACK IN", 3];
3 fadesound 1;
3 fademusic 1;
Sleep 2;
//- - - Dialogue - Hideout
["Cpt. Liam Anderson", "Alright. This is it."] spawn BIS_fnc_showSubtitle;
["HerefordTopicChat", "MissionConversation", ["Hereford_HideoutPrep_1", "Hereford_HideoutPrep_1"], "SIDE", nil, nil, 1, true] call BIS_fnc_kbTell;
Sleep 0.5;
["Cpt. Liam Anderson", "Hold here. Let them thin out a bit. We go on my signal."] spawn BIS_fnc_showSubtitle;
["HerefordTopicChat", "MissionConversation", ["Hereford_HideoutPrep_2", "Hereford_HideoutPrep_2"], "SIDE", nil, nil, 1, true] call BIS_fnc_kbTell;
sleep 2;
//- - - Cinematic Border Out
[1,1,false] spawn BIS_fnc_cinemaBorder;
Bumping this again,
Sometimes whenever i use BIS_FNC_ShowSubtitle and BIS_fnc_CinemaBorder, the subtitle is obstructed by the cinematic border.
Any remedy for this?
Confirmed worked as intended! Now I have an Excel sheet that does all the math that lets you set up HUDs.
looking for a script that shows the hold space bar action when a player is inside a trigger and it must be held for 15 seconds, and then put an inventory item on the floor after the 15 seconds
and does the unit need to have this object in inventory?
yes they do
You can use simple conditions
player inArea yourTriggerVar && "youritem" in (items player)
And you can add hold action on the player.
You could use initPlayerLocal.sqf
ive never understood scripting 😂 thats why i was seeing if anyone has a pre made ill give it a try though thanks 👍 , just need somehting simple to put in the init of a trigger and thats it
Do you use 3den enhanced?
Well is not complicated.
You could do something like ->
//initLocalPlayer.sqf file in your mission root
[
player,
"Drop Item XX",
"", "",
"_this inArea yourTriggerVar && 'YOURITEMCLASS' in (items _this)",
"_caller inArea yourTriggerVar && 'YOURITEMCLASS' in (items _caller)",
{ hint "Started!" },
{},
{
params ["_target", "_caller", "_actionId", "_arguments"];
private _item = "YOURITEMCLASS";
private _weaponHolder = createVehicle ["GroundWeaponHolder", [0,0,0], [], 0, "NONE"];
_weaponHolder setPosASL getPosASL _caller;
_weaponHolder addItemCargoGlobal [_item, 1];
_caller removeItem _item;
},
{},
[],
15,
nil,
true,
false
] call BIS_fnc_holdActionAdd;
Making holdaction is extremely simple using 3den enhanced unless you want to script it directly
True.
Yes I do have 3den enhanced I’ve figured a way to do it to get the hold action now I just need to get an eject on the ground afterwards so I’ll try the script you’ve just given me thanks
Hey, I'm trying to figure out who is deleting or hiding my objects on my server. Knowing that if I played in single player, nothing would happen, I'm about 75% sure it's a mod thing. I did try placing any infostand, and all of them gave the same result. So, if anyone can help me try to figure out a method or something, I would appreciate that.
.rpt
"-------------------"
"-------------------"
"[DEBUG][RX] Deleted: at [-78.6791,3800.13,156.843]"
"[DEBUG][RX] --- STACKTRACE START ---"
"[DEBUG][RX] --- STACKTRACE END ---"
"-------------------"
"-------------------"
"[DEBUG][RX] Moved: from [-78.6791,3800.13,156.843] to [0,0,0]"
"[DEBUG][RX] --- STACKTRACE START ---"
"[DEBUG][RX] --- STACKTRACE END ---"
"-------------------"
"-------------------"
i did try to use something like this:
[] spawn {
// --- Collect all RX_InfoStand objects
private _objs = allMissionObjects "RX_InfoStand";
if (_objs isEqualTo []) exitWith {
diag_log "[DEBUG][RX] No RX_InfoStand objects found to watch.";
};
diag_log format ["[DEBUG][RX] Watching %1 RX_InfoStand objects...", count _objs];
private _states = [];
{
_states pushBack [ _x, getPosWorld _x, alive _x, isObjectHidden _x ];
} forEach _objs;
while {true} do {
{
private _obj = _x select 0;
private _posOld = _x select 1;
private _aliveOld = _x select 2;
private _hiddenOld= _x select 3;
private _posNew = getPosWorld _obj;
private _aliveNew = alive _obj;
private _hiddenNew= isObjectHidden _obj;
// --- Deleted
if (_aliveOld && {!_aliveNew}) then {
diag_log "-------------------";
diag_log format ["[DEBUG][RX] Deleted: %1 at %2", typeOf _obj, _posOld];
diag_log "[DEBUG][RX] --- STACKTRACE START ---";
diag_stacktrace;
diag_log "[DEBUG][RX] --- STACKTRACE END ---";
diag_log "-------------------";
};
// --- Hidden / Unhidden
if (_hiddenNew != _hiddenOld) then {
diag_log "-------------------";
diag_log format ["[DEBUG][RX] Hidden state changed: %1 -> %2 at %3", _hiddenOld, _hiddenNew, _posNew];
diag_log "[DEBUG][RX] --- STACKTRACE START ---";
diag_stacktrace;
diag_log "[DEBUG][RX] --- STACKTRACE END ---";
diag_log "-------------------";
};
// --- Moved
if !(_posNew isEqualTo _posOld) then {
diag_log "-------------------";
diag_log format ["[DEBUG][RX] Moved: %1 from %2 to %3", typeOf _obj, _posOld, _posNew];
diag_log "[DEBUG][RX] --- STACKTRACE START ---";
diag_stacktrace;
diag_log "[DEBUG][RX] --- STACKTRACE END ---";
diag_log "-------------------";
};
// --- Update snapshot
_x set [1, _posNew];
_x set [2, _aliveNew];
_x set [3, _hiddenNew];
} forEach _states;
uiSleep 1; // check once per second
};
};
performance extension mod maybe?
I don't think so because it's only deleting any infostand that I place nothing else is getting deleted
did you test this without any mods?
I want to spawn a random opfor group with my script and I have code that works for vanilla units, but I'm struggling to see how I can support groups from mod factions. This is what I currently do:
private _biFactionNames = ["CSAT", "FIA", "Spetsnaz", "CSAT (Pacific)"];
_eastFactions = [];
{
private _factionName = getText (_x >> "name");
if (!_ignoreBI || {!(_factionName in _biFactionNames)}) then {
_eastFactions pushBack _x;
};
} forEach configProperties [configFile >> "CfgGroups" >> "East", "isClass _x"];
_randomFaction = selectRandom _eastFactions;
_groupsToSpawn = "true" configClasses (_randomFaction >> "Infantry");```
The issue is that the category of the groups isn't universally "Infantry", but if I just spawn a random group I will also spawn boats and tanks and stuff. I don't see anything in the config viewer that identifies a group as infantry, but it's gotta be possible somehow. The 3den editor and zeus interface both know what is and what isn't infantry. Does anybody have any ideas?
How Bohemia does it:
How SOG does it:
The 3den editor and zeus interface both know what is and what isn't infantry
What do you mean by this?
As far as I can see, the groups list simply reports the category name and the group icon that are defined in the category and group config. It doesn't have any ability to automatically detect what type of group it is - it just shows what it's told to.
btw, I'd recommend using Leopard20's Advanced Developer Tools mod, it massively improves the config browser and makes it much easier to use. It doesn't cause dependencies so it's safe to use.
Just Loop through all units in the group and look up their type in config
Thanks for the advice, I was hoping I'd find a way around that 😂
Currently using spawnGroup and it's just comfy
Is there an addaction line I can put in an object or or player character that will run a hide object command line by using the action in the middle mouse-action menu?
You can still do that.
Just filter out all groups that have boats or vehicles in general first.
Before spawning that is.
Yeah I'm actually trying that right now but I can't wrap my head around working with config entries
Never know when to use configClasses or configProperties
This is what I got:
_groupsToSpawn = _groupsToSpawn + configProperties [_x, "(_x call Safehouse_fnc_isInfantry)"];
} forEach configProperties [_randomFaction, "isClass _x"];
fn_isInfantry.sqf:
systemChat format ["Group Class: %1", _groupClass];
{
systemChat format ["Unit: %1", _x];
private _vehicleClass = getText (_x >> "vehicle");
systemChat format ["Vehicle: %1", _vehicleClass];
if (getNumber (configFile >> "CfgVehicles" >> _vehicleClass >> "isMan") != 1) exitWith {false};
} forEach _groupClass;
true
I need to make sure that a) the first script does not get called for the property "name", but only for the groups in the faction, and b) that I can check whether each guy in a group isMan
I'll explain this when I get home in 6 hours. We need to go over arguments and parameters.
oh damn. I'm sorry homie. I'm definitely outta my league with some of this. I appreciate you
I got it to work

do you get the same issue if you use BIS_fnc_EXP_camp_playSubtitles?
from my experience the first subtitle has to be started before you run the cinema border function to have them showing up in front of the borders consistently but maybe the other function does not have that problem.
Trying to use CBA extended init eventhandlers to do some shenanigans. Everything works fine in SP editor, but the script doesnt run on a dedicated MP server
class Extended_Init_EventHandlers {
class UAV {
class HAB_Sensor_Drone_Init {
init = "_this call HAB_SENSOR_fnc_drone_init";
};
};
};
script itself
params ["_drone"];
if (!isServer) exitWith {};
private _frequency = 2400 + floor (random 84);
private _freqString = format ["%1MHz", _frequency];
private _radio = createVehicle ["habSensor_elint_radio", [0,0,0], [], 0, "CAN_COLLIDE"];
_radio attachTo [_drone, [0,0,0]];
_radio setVariable ["freq", _freqString, true];
_radio setVariable ["jammed", false, true];
_drone setVariable ["hab_radio", _radio, true];
private _jammingPFH = [{
params ["_args", "_pfhID"];
_args params ["_drone", "_radio"];
if (isNull _drone || isNull _radio) exitWith {
[_pfhID] call CBA_fnc_removePerFrameHandler;
};
private _isJammed = _radio getVariable ["jammed", false];
if (_isJammed) then {
private _lastJamTime = _drone getVariable ["hab_lastJamTime", 0];
private _timeSinceLastJam = time - _lastJamTime;
private _currentEffect = _drone getVariable ["hab_jamEffect", -1];
if (!(_drone getVariable ["hab_isJammed", false]) || (_timeSinceLastJam > 60)) then {
_drone setVariable ["hab_isJammed", true, true];
_drone setVariable ["hab_wasEngineOn", isEngineOn _drone, true];
_drone setVariable ["hab_lastJamTime", time, true];
private _effect = _drone getVariable ["hab_jamEffect", -1];
if (_timeSinceLastJam > 60) then {
_effect = selectRandom [0, 1, 2];
_drone setVariable ["hab_jamEffect", _effect, true];
};
_effect = _drone getVariable ["hab_jamEffect", 0];
switch (_effect) do {
case 0: {
_drone engineOn false;
_drone setVariable ["hab_jamEffect", "engine", true];
};
case 1: {
_drone disableAI "MOVE";
_drone setVariable ["hab_jamEffect", "move", true];
};
case 2: {
private _driver = driver _drone;
if (!isNull _driver) then {
_driver setDamage 1;
};
_drone setVariable ["hab_jamEffect", "kill", true];
};
};
};
} else {
if (_drone getVariable ["hab_isJammed", false]) then {
private _effect = _drone getVariable ["hab_jamEffect", ""];
switch (_effect) do {
case "engine": {
_drone engineOn (_drone getVariable ["hab_wasEngineOn", false]);
};
case "move": {
_drone enableAI "MOVE";
};
};
_drone setVariable ["hab_isJammed", false, true];
_drone setVariable ["hab_jamEffect", nil, true];
_drone setVariable ["hab_wasEngineOn", nil, true];
};
};
}, 1, [_drone, _radio]] call CBA_fnc_addPerFrameHandler;
_drone addEventHandler ["Killed", {
params ["_drone"];
{
if (typeOf _x == "habSensor_elint_radio") then {
deleteVehicle _x;
};
} forEach (attachedObjects _drone);
}];
Wait, the subtitle has to go first??
That sucks for a transition
But i'll try that other subtitle thing first
alright, what do you want this action to do?
Have you confirmed that the script itself is not what's running?
I.e. putting some sort of log at the very beginning and seeing if that runs
Also prefix your global variables
Got it running, ended up just throwing in the vanilla event handlers
Sorry hoss. There's a big fair/music festival this weekend and took the fam tonight
I am having a hard time spawning and despawning AI groups with the show hide modifiers set up to alpha and bravo channel triggers. They work once each and don't repeat, even if I have repeatable checked. It was suggested by @thin fox that a show hide command line might make more sense. So instead of requiring the people that I want to be in charge of calling AI(spawning) when needed, to know the command lines and my variables. I thought what about making a addaction, in the character, that has that command line in it.
units aren't really "despawning" when you do that. they are still hidden and take up resources. what are you trying to do? most of the time we create and delete units with data.
if i use setVariable on a player on a decicated Server, set my variable to global
player has a disconnect and reconnects as the same slot, same profile etc.
is my variable persistent or does it reset/vanish?
If the variable is set on the player object, e.g. player setVariable ..., then it is attached to the unit the player was inhabiting at the time it was set. If that unit still exists and the player took control of it again, the variable is still set. If the unit was deleted after they left, then they create a new unit and the variable is unlikely to be attached to it.
You could use profileNamespace setVariable [...]; to save a variable to the player's profile so you can access it again when they reconnect
how can i retrive the profileNamespace?
is that the name i see ingame?
You can run profileNamespace getVariable [...]; for that
It'll fetch variables from the profile of the client you run it on
do you mean the profile name?
No, we were genuinely talking about profileNamespace as a solution for what they were trying to do
my bad for not scrolling up
at the end, i want to build a respawn counter. So each player can respawn like 3 times.
so each variable needs to be somehow unique and i dont want to hardcode 20-30 Player into my mission 😅
So i guess i will use one of that, decremente by one, then remoteEXEC the rest of my code
And pray that i dont fuck up locality 😅
You could create missionnamespace hash, where you use player uid as key and if not set -> default 3 , and on respawn -1 from counter. and if counter is 0, -> spectace.
So if user reconnect in same mission he has counter xx , so players cannot reset counter when reconnecting etc.
https://community.bistudio.com/wiki/getPlayerUID
that is unique.
uuhh thats nice. thank you 😄
this Discord program is Awsome i love it
Can anyone spot the error? I want to spawn a 40mm HE grenade and have it explode inside/on an object, but nothing happens. It should be the correct syntax according to BIKI, but it doesn't work with the vehicles from the example on BIKI either, but then again, it isn't throwing an error so I don't really know what's wrong.
_proj = createVehicle ["G_40mm_HE", _pos , [], 0, "CAN_COLLIDE"];
_proj setPosATL _pos;
sleep 0.01;
_proj setDamage 1;```
You could try triggerAmmo rather than setDamage.
Removing the sleep may also help.
40mm grenades have a minimum arming distance and/or time, and it may be deciding that it has hit the object and failed to detonate (thereby being destroyed) before you can trigger it. (It's also possible that triggering within the arming distance doesn't work at all, I think I remember running into this myself previously)
You could also try using a 40mm HE or GPR-T autocannon round instead, those have similar-ish power but no minimum arming distance
yeah, that worked (used DemoCharge_Remote_Ammo_Scripted)
Cheers!
Like I've said, it's just better to start learning how to spawn units instead, it's not that hard. It depends on what command/function you're going to use, but in any case, you need a position and classnames of the units you're going to spawn. I can make a simple example for you, if you want.
I would, actually, if it's not too much. What little I do know is from picking at others example from the workshop, here, been watching Gunter serverloh a lot lately, lol. I have a private discord that has a hoarder's amount of stuff and links saved, lol
It isn't the end of the world. It's not a metric ton of AI. I like how the high command modules work, and wanted to give a 2 to 3 "higher ranked" players a action to bring in a couple, small, AI groups that are setup with HC subordinate modules
@grizzled cliff Any chance I can get an invite to the ACE3 slack? By happy coincidence I actually compiled Intercept for the first time ever myself yesterday, would be interested in the #intercept channel 😃
Yeah Gunter's videos helps a lot
would someone perhaps be able to help me out with scripting a AI to move once a player hits a trigger? I'm trying to have a Officer walk over from his post to speak to the players before they can pass through the checkpoint
just go to ace3public.slack.com
All Slack team requires invite unless they use some kind of tool to auto send invites
Aye, slack requires invites, unless they changed something since I last used it
figure out how you want to structure your data. are the units you want to hide show in an array of units? or an array of groups? etc
I am making groups of 4. That way, if I'm the HC, I would be a proper ALPHA 1 SL, and the AI, 4 man groups, would ALPHA 1-1 and ALPHA1-2, that I could move and task independently. I am doing this more than once, and 2 teams seems a bit under whelming, so I might make a real person in charge of ALPHA 1-1, 1-2, 2-1,and 2-2. but that's the basic setup. It's a as needed basis, for support. they'll be used to hold a Phase line, or hold security why we(real players, having the real fun) move on objectives
o
I can't remember ever getting an invite... I must have at one point
Turns out I did get an invite
BUT YOU DON'T HAVE TO
Aren't you lucky
well in general, if you want to hide things, you want to hide them using hideObjectGlobal which is a server command. Therefore, you need to remote exec the action to the server:
{
[_x, true] remoteExec ["hideObjectGlobal", 2];
} forEach _myArrayOfThings;
if you want to lower the amount of network calls (when you get a lot of objects), then you would make a function in CfgFunctions, then exec that function on the server and pass the whole data set:
// myCustomFunction
params [["_thingsToHide", [], [[]]], ["_state", true, [true]]];
if (!isServer) exitWith {};
{ _x hideObjectGlobal _state } forEach _thingsToHide;
// local player action execution
[_myArrayOfThings, true] remoteExec ["myCustomFunction", 2];
its really up to you how you want to set it up from there.
So, f I wanted this as a addaction function, on very specific player character slots, I would use the third example, _myArrayOfThings would be the variable name, and myCustomFunction would be the menu text when selecting it?
no. do you know how to define functions in the game yet?
Honestly, no. Up until a week ago, I was the Reforger guy for our stuff. Reforger is combining components and configuring options, correctly, more than anything. It requires almost no scripting knowledge. Everything I've learned is very situation specific. I mad a TP system. I DL'd a 4 pole TP comp mod, opened a pole, looked ad the commands, and said "oh, I get it, I can do that". But as for general knowledge, and properly understanding, no, I'm not that guy yet.
people, have sent me some BikI pages to look over, I've started, but I'm still very new
reforger does require a ton of actual oop programming knowledge btw if you want to move away from anything base game.
so you can define functions in a multitude of ways, but the recommended way is to use CfgFunctions and using the function library https://community.bistudio.com/wiki/Arma_3:_Functions_Library
this way, your function is defined on every machine
"your function is defined on every machine" means all players would have access to the function?
yeah, say if i have a function that should run locally on a client, and me, the server wants to tell that client to do something:
// say _unit2 is a player object that someone controls
[_args] remoteExec ["myClientLocalFunction", _unit2];
// we tell whoever owns _unit2 to execute that function. if it doesn't exist on their machine, nothing happens
so in your case, we want to tell the server itself to do something, from a local client
so your action in simplest terms would be:
player addAction {
"Hide My Things",
{
params ["_target", "_caller", "_actionID", "_args"];
[myGlobalArrayOfThings, true] remoteExec ["RAG_HideObjectsOnServer", 2]; // 2 is always the server
}
};
and you would make RAG_HideObjectsOnServer and register it in CfgFunctions within description.ext (if using a mission, not a mod)
We upload our mission folder, from MPMissions, as a ZIP, and the owner puts it on our server
yeah so you would modify class CfgFunctions inside of your missions description.ext file
Roger, I'll start playing. I'm definitely behind the curve on this stuff, but I'll try getting there piece by piece. @fair drum @thin fox @granite sky thank you guys, I appreciate you guys being gentle with me, lol
if you haven't learned it yet, github is a very useful thing for people to help you on things
aHA
Didn't even think of looking there. I thought it was mainly releasing stuff outside of the steam workshop. Didn't know what else would be on there, I've been mainly using here, YT, and Steam mod compisition as examples to work from
its not about whats on there. its about uploading your missions, you have a problem, we can look at the entire code base, and push a fix which then you would just have to merge
Hello , How can i solve this problem ?
When i click Shift + T to mark while im flying with drone , it doesn't appear for my friends
does it appear for you?
Yes only for me
hmm. I wonder if it could be a server difficulty setting
Is there an option to make it appear ?
I will check rn
i don't see any setting that do this thing
Roger that, I'll look now, thank you
Attempting to check if a config parameter exists within a player's helmet class. Any help on this error?
config entries are an actual data type and isNil doesn't support them
(also you might need brackets to force the config path to be interpreted correctly)
You might find it easier to use the default value functionality in this https://community.bistudio.com/wiki/BIS_fnc_returnConfigEntry
I just put in parentheses to debug, I'll check out that function too, thanks
does the custom waypoint that the player can place on map with Ctrl + Left Click create any object or marker that I can get position of?
No, but you can use https://community.bistudio.com/wiki/customWaypointPosition
I have a task with a trigger that sets the task state to complete and one that sets it to failed. Even though players can complete it and it will mark as succeeded, they can also still satisfy the conditions to make it fail and thus overwrite the previous completion. I don't like this. I want it to stay complete or fail when they do so.
I've been using deleteVehicle for the opposite trigger to prevent this problem but wanted to check if there was an easier solution?
making a variable that sets true when the task is completed, or just call this in the trigger's condition https://community.bistudio.com/wiki/BIS_fnc_taskState
Do something like this && !task_01_completed or this && !(task01 call BIS_fnc_taskState == "SUCCEEDED")
I like this variable idea. Thanks!
I remeber the rule about not using player as a condition on a server-only trigger. Does this rule extend to the activation field as well? Would this work?
[wentPastInfil, [leader player]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance leader player <= 100}];
Seems to work on a second client when I test the mission but that confuses me as to why the server can see leader player on activation but not as a condition.
alr I think my brain stopped working on how forEach loops works.
{
copyToClipboard str (_x # 0);
}forEach [[6,6,6], [[1,2,3], [4,5,6]]]
I'm getting [1,2,3], is that right in this example? I want to get the first array.
Yes
Though if you are mixing arrays of various sizes like this, it's better to use param or params with defaults so you don't error if something doesn't exist.
I used params and I got like the player group, in that same array
why would you use forEach with copyToClipboard? :/
That code will write "6" and then "[1,2,3]" to the clipboard, but you only see the last one. Because clipboard overwrites.
I figured he was just doing it for a theory example. But yeah you wouldn't really ever use it this way.
don't worry xD It was just an example
You'd need systemChat str _x to get [6,6,6]
I get that
but I get the whole array, and I wanted to get just the first one
Idk by at top of my head, to get [6,6,6] I could just do _x # 0 or using params, but I get nothing using params
But that's the first array in your provided array
[[6,6,6], [[1,2,3], [4,5,6]]]
=>
[
[6,6,6], // #1
[[1,2,3], [4,5,6]] // #2
]
[[6,6,6], [[1,2,3], [4,5,6]]] params ["_array1", "_array2"];
systemChat str _array1; // [6,6,6]
systemChat str _array2; // [[1,2,3], [4,5,6]]
and using forEach?
First _x would be [6,6,6], second _x would be [[1,2,3], [4,5,6]]
so in a forEach params ["_array1", "_array2]: _array1 == [6,6,6] and _array2 == [[1,2,3], [4,5,6]]?
No, if you params the original array
oh ok I got this
Inside foreach you'll end up with two numbers on first _x then with two arrays on second _x
{
_x params ["_array1", "_array2"];
systemChat str _array1; // 6, then [1,2,3]
systemChat str _array2; // 6, then [4,5,6]
} forEach [[6,6,6], [[1,2,3], [4,5,6]]];
Yeah, makes sense
I’ll repeat the question because I need an answer: Is there a way to make the SHIFT + T mark appear to my friends while I’m controlling the drone?
do someone by chance have working convoy script ?
I have found Wolfenswan's convoy script https://github.com/Wolfenswan/ws_fnc/blob/master/AI/fn_taskConvoy.sqf I will test it 🤘 🤩
https://community.bistudio.com/wiki/Arma_3:_Difficulty_Settings TacticalPing - and make sure you ping in the correct channel.
How can I track a player when he becomes a pilot or a UAV gunner? For some reason, I'm trying to give the player a global variable via remoteControl - that he uses a UAV, but it doesn't give me the player, but his Alpha group...
player is null in dedi server, thing about this: it's a different machine, it's not a player playing it, only the clients are
you could try to attach a trigger to the leader and check distance using that, I used this method a couple of times
The reason you don't use player is because a dedicated server machine does not have a player unit. It doesn't have an interface, it can't have a player. So you wouldn't use player in a server-only trigger because it's likely the server will be a dedicated server - not because of anything specific to the condition field or even to triggers. You wouldn't use player in any code that's going to run only on a dedicated server machine.
If you are in a locally-hosted game, then the server is not a dedicated server, it's a player machine, and player will work on it, because there is a player unit to retrieve. So in that case, player will work in a server-only trigger, because it's running on the server which is also a player machine. But it's a bad idea to rely on that, because you can't assume that the mission won't be loaded on a dedicated server.
So the reason using leader player works when testing with two clients is because one of the clients is the local host? If I tried this on a dedicated server it would stop working.
Yes. Because the code is being executed only on the server, and if it's a dedicated server, it has no player unit, so player returns objNull, which is not useful.
I am using player switchMove "acts_unconsciousStandUp_part1"; (run from a script on some player's machine) to have a player stand up from unconsciousness. The animation only plays for that player, so for everyone else it looks like he's just standing there. Can I do [player, "acts_unconsciousStandUp_part1"] remoteExec ["switchMove"]; to make the animation play for everyone? Specifically, if the remoteExec is run on client A, will client B interpret player as client A, or as client B?
clientB won't interpret player as their own player, no worries here
player is evaluated before the remoteExec is sent.
so this would be ok on DED server right ?
if (!hasInterface) exitWith {};
That piece of code on its own would work. Whether it's "OK" depends on what you're actually trying to do.
roger that m8
Do you understand the purpose of that piece of code?
yes sir
its saying really not the server
only whoever has Interface with the server
witch would be the player
ofcorse
Is urls broken since latest update?
not that i noticed
What URLs? What latest update?
urls on shortcutbuttons arent working anymore
It doesn't mean "interface with the server". It means a user interface - a display, the means by which you interact with the game. Dedicated servers do not have an interface; it is impossible to play on them. Headless clients also do not have an interface. All their processing happens invisibly, without graphics. Player clients have an interface; you can see the game running and interact with it.
hmmm interesting
It also doesn't inherently mean that all machines with interface will execute the code. It just checks whether the current local machine has an interface, and exits if it doesn't. If the code wasn't executed on all machines to begin with, it doesn't automatically go looking for other machines with interfaces to make them run the code.
hmmm interesting again
so like i use the code on my RRR stations and my intro and outro sqf,s
(Rearm Repair Reload)
so like if you land in The RRR trigger then it works for that client
would that be correct ?
or is there a better way
Well it depends how your triggers are set up. That code alone doesn't do everything you want. It's for using with other code, to ensure that code doesn't run on machines without interfaces. For example, you could use it with code that does UI or audio stuff, so that code gets skipped on machines that don't need it.
copy that i understand thx so much Nikko your the best
we should change that code to
if (!hasUserInterface) exitWith {};
Why?
i dont know
@pallid palm Idk if this is useful for ya, I have this script that creates a RRR area. It is used to RRR jets in air. https://github.com/PiG13BR/PIG-Air_Supremacy_PVP/blob/main/functions/fn_createRRR.sqf
and it works in dedi
Scripting for a Range
Hi all, hoping you can help.
I am trying to script a shooting range for a unit training map I am making, and I have put the script into a file and also put code into the laptop, but I get a Script rapidfire_single.sqf not found message when trying it out in-game.
the following is the script i used
/*
rapidfire_single.sqf
5-round sequence on ONE target, 20 seconds total
*/
private _target = t1; // variable name from target Init
private _rounds = 5;
private _totalTime = 20;
private _interval = _totalTime / _rounds;
// make sure target starts down
_target animate ["terc", 1];
for "_i" from 1 to _rounds do {
_target animate ["terc", 0]; // pop up
sleep (_interval / 2);
_target animate ["terc", 1]; // back down
sleep (_interval / 2);
};
the following is the laptop int I used
this addAction ["Start 5-Round Rapid Fire", {execVM "rapidfire_single.sqf"}];
are you sure the file is called rapidfire_single.sqf and not rapidfire_single.sqf.txt or something similar?
oh that is it, didnt even notice the .txt
thanks
is there somethnig specific needed to make fireAtTarget work? The UAV (Mk41 VLS) has both doWatch and doTarget on the LaserTargetE but when fireAtTarget executes the missile does not fire towards the target.
assignedTarget confirms the correct target is selected by the UAV gunner
Do you have the right muzzle? What's your code?
params [
["_vls", objNull, [objNull]],
["_target", [0,0,0], [[]], [3]],
["_missiles", 1, [0]]
];
if (isNull _vls) exitWith { hint "No VLS specified"; };
if !(typeOf _vls == "B_Ship_MRLS_01_F") exitWith { hint "Invalid VLS type"; };
private _laserTarget = "LaserTargetE" createVehicle _target;
private _targetName = format ["VLS_LaserTarget_%1", round(random 999999)];
_laserTarget setVehicleVarName _targetName;
_laserTarget setPosASL _target;
_vls reveal [_laserTarget, 4];
_vls doWatch _laserTarget;
_vls doTarget _laserTarget;
waitUntil {(vehicleVarName (assignedTarget _vls)) isEqualTo _targetName};
waitUntil { _vls aimedAtTarget [_laserTarget] > 0 };
for "_i" from 1 to _missiles do {
_vls fireAtTarget [_laserTarget];
sleep 2;
};
deleteVehicle _laserTarget;
sleep 2;```
the VLS fires, but the missile goes directly sraight up in the air
If all else fails you can use setMissileTarget to force the missile to do whatever you want
do I need a firedEH to get the missile object that setMissileTarget requires?
(I guess so)
Yes, or technically projectileCreated mission EH but that's a bit overkill
Alternatively, if no one will be actually watching, you can just create the missile directly and skip the VLS
well the point is to not skip the VLS. I'll try the firedEH/setMissileTarget approach, thanks
odd, that indeed changed something. Guess I also have to keep my target longer available otherwise the missile goes somewhere else mid flight.
Thanks for the links, I'll check them out in more detail
So checked your code(s) @fair drum but for me the VLS always overshoots the target and I don't know why. I did nothing different, albeit I'm not 100% sure which position a module has when it is placed.
params [
["_vls", objNull, [objNull]],
["_targetPos", [0,0,0], [[]], [3]],
["_missiles", 1, [0]]
];
if (isNull _vls) exitWith { hint "No VLS specified"; };
if !(typeOf _vls == "B_Ship_MRLS_01_F") exitWith { hint "Invalid VLS type"; };
private _laserTarget = createVehicle ["laserTargetC", _targetPos, [], 0, "CAN_COLLIDE"];
_laserTarget setPosASL _targetPos;
private _targetName = format ["VLS_laserTarget_%1", round(random 999999)];
_laserTarget setVehicleVarName _targetName;
diag_log format ["LaserTarget Position: %1", getPosASL _laserTarget];
_vls doWatch _laserTarget;
_vls doTarget _laserTarget;
west reportRemoteTarget[ _laserTarget, 480];
waitUntil {(vehicleVarName (assignedTarget _vls)) isEqualTo _targetName};
waitUntil { _vls aimedAtTarget [_laserTarget] > 0 };
for "_i" from 1 to _missiles do {
_vls fireAtTarget [_laserTarget];
sleep 2;
};``` I even tried to set the Z position to 0:
```sqf
_laserTarget setPosASL [_targetPos select 0, _targetPos select 1, 0];```
Guess I have to check how this works when you manually designate a target using e.g a darter and the VLS locks onto that.
But thanks for your help both so far
I'm really new to modding in arma but not in programming and I was wondering if there's a way to send data from arma to an external application? If there is then would some be able to help me out on the weekend? Ohh and I would like to use this https://docs.rs/laminar/latest/laminar/ to send and maybe receive data
Laminar is an application-level transport protocol which provides configurable reliability and ordering guarantees built on top of UDP. It focuses on fast-paced fps-games and provides a lightweight, message-based interface.
Also ping me when replying
I did that and it didn't work as in I got hemtt to build a mod and I have a rust lib project for the dll but it's not doing anything...
I feel like the DLL isn't being loaded in the game
You need to deactivate battleye in order to use a custom dll. When your dll is ready there is a procedure written on the website to get your dll whitelisted by battleye
or just disable battleye, it's more or less useless anyway.
only causes problems with the server and drags down the performance for clients (scripts.txt) 😆
not to mention that all the better cheats can apparently bypass it.
Okay when I can I'll try it and tell u the results
Is it therefore impossible to determine which player is leader player on a dedicated server?
A dedicated server machine does not have a player to find the leader of. If you want to find the leader of a group, on the dedicated server machine, you'll need to find a different way to reference the group or one of its units.
units west findIf {isPlayer _x && alive} == -1;
But maybe isPlayer wont work either?
Well it certainly won't work if you write it with wrong syntax
Actually I think maybe im doing it the wrong approadh because this gets called in a remoteexec function:
["wrongWay", [leader group playergroup]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance leader group playergroup <= 100}];
Admittadly playergroup is probably a bad name for the variable but I dont want to change it now becaus ewho knows what else ive tied it to.
if playergroup is a reference to a group, you do not need to use group on it. group is for using on a unit to return a reference to the unit's group; if you already have a group reference, it's pointless and probably won't work anyway.
Got it. It's redundant. I'll test this out now. Thanks!
Is there any way to actually "reorder" the units in a group if some of them die, so you do not have "empty F#" spots in the lineup? (I mean besides to unjoin and rejoin all those units).
You could try removing the dead units from the group
But are they not automatically removed once the groupleader realizes the killed ones are dead? In my experience in a player lead group (and I think it is similar in AI led groups) if some of the units die you end up with empty slots, so for example: A group of 5 soldiers -> F1 is the leader, the other soldiers are at the selectable F2, F3, F4 and F5 slots. Now if the F3 guy gets killed you end up with F1, F2, F4, F5 -> the F3 slot remains empty. What I am looking for is a way to reorder the group somehow, so the new, reordered lineup would result in F1, F2, F3, F4. Hope that made sense?
Oh yeah I've noticed that too. In my mission I tested it as the leader of the group (F1) and when I died and respawned, I still had control over the AI but the F1 slot was now empty space and the icon bar started with F2.
Exactly! Same happens if you are grouped up in MP, with players and AI units -> if some of them die you end up with empty slots (seems the only way to fill those if if you recruit new AIs or disband the group and then reform it -> but there has to be a better way to do that?).
Maybe if you remove then re-add all members of the group it will assign a numerical order?
yes, as I mentioned if you ungroup/unjoin all units and then rejoin the alive units to the group it reorders them (removing empty slots) - I just wondered if there is another way to achieve that
Ah sorry I missed that part. I don't have a lot of SQF scripting knowledge so if there is a way I wouldn't know. Give it some time and someone else might be able to help. I've posted on here before and didn't get a response till the next day because of timezone differences.
No worries, mate! Thanks for the input :)
I'm working on this contingency. If the scout in the group is still alive the function will use him; otherwise, it grabs the leader of the group. I've tried to provide some protection against a Nil and objNull scenario. Is there anything else that's good common practice I didn't think about?
_scout = missionNamespace getVariable ["scout", objNull]; // prevents an error if Nil is returned
if (!isNull _scout && alive _scout && _scout in units playergroup && vehicle _scout == ptboat) then {
// Scout is alive and in the group
["scoutSays", [_scout]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _scout <= 100 }
];
} else {
// Anyone else leading will speak
["anyoneElseSays", [leader playergroup]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance leader playergroup <= 100 }
];
};
I'm in the middle of something right now. I'll try to come back to this later.
Hmmm so even with setMissileTarget firedEH the missile overshoots the target...
params [
["_vls", objNull, [objNull]],
["_targetPos", [0,0,0], [[]], [3]],
["_missiles", 1, [0]]
];
if (isNull _vls) exitWith { hint "No VLS specified"; };
if !(typeOf _vls == "B_Ship_MRLS_01_F") exitWith { hint "Invalid VLS type"; };
private _laserTarget = createVehicle ["laserTargetC", _targetPos, [], 0, "CAN_COLLIDE"];
_laserTarget setPosASL _targetPos;
_laserTarget setPosASL [_targetPos select 0, _targetPos select 1, 0];
private _targetName = format ["VLS_laserTarget_%1", round(random 999999)];
_laserTarget setVehicleVarName _targetName;
diag_log format ["LaserTarget Position: %1", getPosASL _laserTarget];
_vls doWatch _laserTarget;
_vls doTarget _laserTarget;
west reportRemoteTarget[ _laserTarget, 480];
private _muzzle = currentMuzzle gunner _vls;
private _currentAmmo = _vls ammo _muzzle;
waitUntil {(vehicleVarName (assignedTarget _vls)) isEqualTo _targetName};
waitUntil { _vls aimedAtTarget [_laserTarget] > 0 };
if (_currentAmmo <= 0) then {
diag_log format ["VLS: %1 is out of ammo, cannot fire!", vehicleReceiveRemoteTargets _vls];
};
for "_i" from 1 to _missiles do {
private _firedEH = _vls addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_thisArgs params ["_laserTarget"];
diag_log format ["Missile created: %1", _projectile];
_projectile setMissileTarget _laserTarget;
},[_laserTarget]];
_vls fireAtTarget [_laserTarget, _muzzle];
sleep 2;
_vls removeEventHandler ["Fired", _firedEH];
};``` target is the radar where a laserTargetC has been created via the coordinates of the radar object. https://i.imgur.com/uTd6t9d.jpeg
Is targetPos also in ASL? Because create vehicle uses atl
laser target objects delete themselves quite quickly if left unattended. You might need to attach it to something.
Yeah I don't see an attach. The scripts I linked yesterday, I attach them to a module.
is there else if in SQF? Or just nest another if statement inside the else?
So this is what I have:
if (conditionA) then {
// code A
} else {
if (conditionB) then {
// code B
} else {
// code C
};
};
I havent used the ones you mentioned. Would one be better for this?
call {
if (conditionA) exitWith { code A };
if (conditionB) exitWith { code B };
code C;
};
Not hugely faster but it looks nicer.
And I define variables before this code the same way as before?
Yeah, it's functionally identical.
How do I structure it so it's readable in this way though?
_scout = missionNamespace getVariable ["scout", objNull];
_leader = leader playergroup;
_unitsInBoat = crew ptboat - [_leader];
_randomUnitInBoat = if (count _unitsInBoat > 0) then { selectRandom _unitsInBoat } else { objNull };
call {
if (!isNull _scout && alive _scout && _scout in units playergroup && vehicle _scout == ptboat) exitWith {
["wrongWayCoveScout", [_scout]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _scout <= 100 }
]; };
if (!isNull _leader && alive _leader && vehicle _leader == ptboat) exitWith {
["wrongWayCove", [_leader]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _leader <= 100 }
]; };
if (!isNull _randomUnitInBoat && alive _randomUnitInBoat) then {
["wrongWayCove", [_randomUnitInBoat]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _randomUnitInBoat <= 100 }
];
};
};
The unary version of call (no parameters in front) doesn't do anything except create a child scope. So even _this passes in unchanged.
if your conditions and payloads are that large you'd still want to write them as
if (condition) exitWith {
// code
};
In some coding styles you'd write it like that regardless, but I prefer the compressed style for some things.
Sounds good. As I learn I'd like to keep things the same across the board if I can
You can remove the isNull check. In this situation, alive covers both null and dead cases, because objNull is always detected as being dead if you use alive on it.
So if im understanding, I don't need to worry if _scout ends up as objNull. alive objNull won't throw an error. But I don't all the way understand why with that explaintion
alive objNull always returns false. It is always dead.
is always detected as being dead if you use alive on it
Got it. And if it's dead then of course it returns false too
You can also save some performance by using lazy evaluation with && (see the wiki page)
Just read about the lazy evaluation. Kinda went over my head but basically, for && write the code in such a way that the most likely condition to be false comes first so that it doesn't have to continue reading the rest of the conditions?
You have to use the second syntax specifically, using a { code } data type as the right-side argument. It doesn't do it by default.
e.g.
(alive someUnit) && {triggerActivated someTrigger}```
the code within the code block is not executed if `alive someUnit` returns `false`.
Meanwhile,
```sqf
(alive someUnit) && (triggerActivated someTrigger)```
both pieces of code are always executed regardless of what the first one returns.
target is down, yeah the attachTo seemed to be the key. I was also able to remove code not needed such as doWatch etc.
Thanks for the help. In the end I selected the attachTo position based on the following nearestObjects:
private _objTarget = nearestObjects [_targetPosAGL, ["AllVehicles", "StaticWeapon"], _radius];``` and attached the laser marker to it
So curly braces have to come second. What about if there are 3 conditions? If I put curly, braces on the last two are those last two executed even if the second one returns false?
&& cannot have 3 conditions. It only has 2, left and right.
This is three?
if (alive _scout && _scout in units playergroup && vehicle _scout == ptboat) exitWith {
If one of those conditions happens to contain another &&, then that is that other &&'s own business.
Look at each of your && there. Each of them has a condition to its left and a condition to its right. Where is the third condition for either of them?
I think I see what you mean. As the code is read, it can't know about whatever is in front of what it has already read? So it only knows about left and right?
So this is how you would do it? If the left is returned false, then I save performance otherwise, it goes to the curly braces.
if ((vehicle _scout == ptboat) && {alive _scout && _scout in units playergroup}) exitWith {
Yes. And if you want, you can do it to the second && as well, although you're probably not saving any worthwhile amount of performance in this case.
So another set of curly braces within the curly braces then?
Just a note but isEqualTo will support the comparison of multiple types which makes it more error redundant. Using == can be useful in cases of string comparison where you don't want to toLowerANSI for case sensitivity but otherwise recommend isEqualTo. I suppose == might also be marginally faster but FWIW 🙂
if ((vehicle _scout == ptboat) && {(alive _scout) && {_scout in units playergroup}}) exitWith {
Depending on how the order of precedence works out, one of the && is evaluated first (with its left and right conditions) and then its result is used as one of the conditions for the second &&. Don't be blinded by its fancy special-character-having name; it is a binary command like any other and follows the same principles. (It's also known as and)
What the curly braces are doing is creating a Code data type. Most SQF is executed as it's read, but a Code data type allows a piece of code to be saved for later ("later" is not necessarily an appreciable amount of time). For example:
_var = name player; // _var contains the player's name
_var = {name player}; // _var contains the code "name player" and you can call it later```
On the wiki you posted is 11 the highest precedence or is 1? In my mind 11 is a higher number than 1 so the 11th example has the highest precedence.
11 is the highest precedence
11 is Braced expressions. Which makes me think those evaluate first. But in my example parentheses are supposed to come first. But maybe parentheses are considered braces?
It's written in a wonky way.
( ) are a priority marker and always come first.
[ ] designate an Array data type; their contents will be evaluated before the array is used for anything.
{ } designate a Code data type.
Also since you guys were talking about lazy eval just figured I'd also add it's worthwhile being super careful that uiNamespace and profileNamespace variables are properly sanitized. Can be super easy to add an execution exploit without even meaning too. For example:
private _var = profileNamespace getVariable ["global_bool", false];
private _food = ["burger", "pizza"] select _var;
Only time I've ever accidentally added one was because of select code syntax along with me forgetting to type check a hash map I was dealing with. Luckily I caught that in a later audit for exploits but yikes haha 😅
Obviously tho any case where code can be ran is where an exploit could occur. Although would not be as typically in an apply, forEach or while due to their explicit code types being harder to mistake, can really happen anywhere if you don't sanitize variables properly 
Thanks Milo, although for me this is really over my head. I'm still learning missionNamespace😄
Ah okay sorry about that. We all start somewhere tho and having read your comments you seem to be getting a large enough grasp of things it was easy to mistake :)
So why do I need to use call here. It's in the trigger activation field. Will it not work without it?
The purpose is to create a sub-scope so that exitWith can exit that, but not the entire script
If you don't plan to have any more code after this set of if cases, then you shouldn't need it, but if you do, then you do
Ah so if this is the only script in the activation field I dont need call.
Ah perfect!
This might be a hard question to answer but in VScode ctrl+z doesn't do anything for me. I checked the keybinds and it's there for undo so I'm at a loss.
ctrl+y for redo works just fine.
Try some of the solutions here: https://superuser.com/questions/1606368/ctrl-z-not-working-on-visual-studio-code-and-not-working-by-using-on-screen-ke
Resetting key binds didn't work. So I just tested it in google docs too. Wont work there either. Might be a windows 11 issue. 😮
Try the other solutions too, and also try basic troubleshooting steps like restarting your PC and unplugging/replugging your keyboard.
Beyond that, this isn't really an Arma 3 scripting issue, so I don't want to get into thorough troubleshooting here.
Of course. Thank you!
Is the _scout variable here neccessary? I assume selectRandom unit playergroup would never return objNull or nil right?
_scout = missionNamespace getVariable ["scout", objNull];
_randomUnitInGroup = selectRandom units playergroup;
I wanna remove unit from car on HandleDisconnect EH.
I think that this can be done only AFTER the EH return. My question is if I can execute any code after the EH that is not explicitly inside the EH. Or shall I just spawn -> sleep -> execute code?
I wanna do this because if a player disconnects while in a vehicle, it still exists on “crew vehicle”
Did you get this work?
Tested this one , and if you add your laser target to editable object on the curator, you will see that your laser target will disappear before missiles reached the target.
But if you create dummy xx object and attach your laser target on that it doest disappear
selectRandom [] => nil
_scout is neccessary if you'll use it twice, otherwise you might as well inline that getVariable
Sure you can also copy paste it twice or more but that's even worse
Its better to lay things out properly and prioritize readability in non performance critical scripts
hey,
is there a possibility to return all units inside a given area?
for example i want to know at a random time, how many players are inside a specific city/base and make a decision based on those values.
i could run a distance check for each player and each location, but i feel like there is a better solution available 😅 like ask a trigger what its current _thisList is
read city/base as a specific, random location somewhere in a world. so i cant use those predefined towns and locations things.
each side will be mostly custom build
list trigger might work. will test later 😅
inArea command
^ inAreaArray*
Sup guys, does someone remember how to make a script that adds a magazine to a weapon when the last bullet is shot?
if im not mistaken i was using FiredMan to do it
Adds to the gun or the inventory?
I guess it was in the inventory, cause it allowed the reload animation anyways
I lost the damn code when i bought a new ssd
player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if(_unit == _vehicle) then {
if(_unit ammo _muzzle == 0) then {
_unit addMagazine _magazine;
};
};
}];
Something like this probably
Let me test it out
Hey what solution did you find in koth to remove player unit from vehicle crew when it disconnects?
You mean the UI?
No, I mean that whenever a player is in a vehicle and they disconnect, the unit will remain seated in the vehicle. If you execute “crew vehicle” the unit will still be there even tho the player left.
Unit will not leave the car even after returning false on HandleDisconnect
Ah
And my code on HandleDisconnect to move unit out doesn’t work
Hmm, I don't think I have anything special there, just returning false on HandleDisconnect?
I deleteVehicle _unit too
I have disabledAI=1; so I'm guessing my units just delete on exit
But otherwise there is nothing special
If you want to keep the unit, I guess you can just order them to move out?
unfortunately not
Try <= 1 instead of == 0?
kay
nope
I really don't remember how it was made back in the day
I just tried it and my first code works just fine
Any muzzle too
Not quite, but say what the bug is so we can judge
Weird, let me try again
idk which mod cna fix it
Its a bug in some mod that uses CBA
cause it*
it doesn't say which mod. And its not possible to tell from that message
How can I identify which one immediately?
Oof
Is there a way in Arma 3 Launcher to see which mod uses CBA
so it can be easier?
Yes but its not that easy
That button shows you dependencies, but clicking that button for every mod will be annoying
But not all mods list their dependencies correctly. So it might be that you won't find it
This is a pretty fast way to do
#arma3_troubleshooting message
i think add -debug parameter and you might see the full path of the script causing the error?
Oh thanks, I'll try it
I wasn't going to do the method anyways, would've been too long lol
not here. That'll just show you the CBA code that got tripped up by something putting bad data into a CBA variable
You could look at the waitUntilAndExec array in debug console and see what kinda object is actually in there, maybe that might hint to who put it there
fat chance, but does anybody have the Civilian Occupation Script? (COS)
Was the only script I could really get working with Zombies and Since Ravage doesn't work with Dedicated servers any longer i'm trying to find a replacement for spawning them - cheers in advance
i will have to make a new Config.cpp
Just execute this in debug console
it will add you a mag as soon as you finish one
still nothing unfortunately
You're doing something wrong then, this code does exactly what you need
Well maybe it doesn't check if you have more mags before adding a new one
try dropping 1 mag first, maybe you are already at the limit?
tested that as well, but no luck
I'll take a better look at it later
But thank you bro
Oh yeah, there might be no space for addMagazine
had only 3
Still no mag was added
only 3 doesn't mean anything, you had more free space in your vest/backpack?
Agent Ransack
How do i make unitcap for a boat? I've tried with LCVP and when i copy movement code i just get this []. Or if there is any script that would force AI to move straight and not strafing
Hey guys, is it possible to disable a guns sights thermal mode?
I don't want to disable it for everyone, just a few players in a pvp zone where thermals are disabled.
Tried a few google searches but the google ai slop is ruining my searches these days.
removing the possibility of players having it in the first place?
and wdym by "pvp zone"? an area?
It would 1000% be easier not giving them to the players yeah.
I have a script I tossed together to make areas pvp zones and those players in them can't interact with others outside of it. (PvE players basically), it acts on this single variable.
I managed to come up with one for helmets like the viper helmet but the optic part for guns is throwing me off.
if (player getVariable ["pvpmode", 0] isEqualto 1) then {
private _visionMode = currentVisionMode player;
if (_visionMode > 1) then {
player action ["nvGogglesOff", player];
//player action ["NightVision", player]; // Cycle to normal vision <- cannot find this on the wiki
hintSilent "Thermal imaging is off due to PvP mode!";
};
};
I think "action ["NightVision"" is fake also.
you can just remove the item from the player when it enters the zone (save it in a variable with setVariable), and add it to the player's inventory later when he leaves the area
make an array with classname of the items that you don't want players to have in that zones
and make a script to check the player's loadout once enters the zone
how to prevent game from pausing in SP when I tab out ? (I am on linux I don't have the launcher)
makes testing very tedious 😔
https://community.bistudio.com/wiki/Arma_3:_Startup_Parameters#Developer_Options
-noPause startup parameter
OpticsModeChanged EH + setOpticsMode maybe. Not sure if NV/thermal mode counts though.
oh maybe VisionModeChanged EH instead.
I don't think you can block it entirely with script though. There's an action for vehicles IIRC.
For vehicles you can use disableTIEquipment, but I don't believe it affects handheld weapon optics
Another approach would be to add non-TI versions of the TI optics in config and swap them over.
After Hours, I finally found the mod
It was dzn Extended Jamming
Ty fellas, @granite sky, @hallow mortar, @thin fox, I'll try to check out these options when I return home.
I was considering seeing if removing the players current optic and adding it back instantly if they're aiming and the thing is in thermal but not sure how viable it is, I'll see when I return home to the scripts.
If you guys can think of any alternatives between them I'm open to other ideas too.
Thank you @stable dune , @still forum , @radiant lark for helping me
I'll finally be able to play arma 3 without pop - up in my way
Thanks for everything!
That's what I did but it still has shown he problem
Oh then yeah, the pain was inevitable
does marker overlaping mission position in BIS_fnc_strategicMapOpen preventing to selecting said mission ?
e.g. if on mission position is placed marker, I cannot select mission. is it a bug or did anybody had same problem ?
What does it mean to "inline that getVariable"?
I'm trying to write a script to set BIS_fnc_garage_data but my game is getting stuck on loading the garage
http://pastebin.com/raw/tYWY3BVi
this is the output from the copytoclipboard. Aside from not building the helicopter array, i don't see any issues witht he formatting: http://pastebin.com/raw/EpzMhiUX
I have the brilliant idea to make a heli (littlebird or AH-64D) support vehicles convoy, what is the best option? SAD waypoint loop on one of the vehicles? 🤔
cia_heli setHit ["tail_rotor_static", 1, true, objNull, objNull, true];```
could anyone assist me with what could be going on here and why my setHit code appears to do nothing? It does seem to deal damage properly, but that final parameter with 'true' **should** theoretically blow off the rail rotor and play the proper sound effect, but it does not. Am I forgetting anything here? would appreciate any help 🙂
swappingg to setHitPointDamage doesn't seem to do anything either, doesn't even Red Out the rotor itself:
cia_heli setHitPointDamage ["tail_rotor_hit", 1, true, objNull, objNull, true];
cia_heli setHitPointDamage ["tail_rotor_static", 1, true, objNull, objNull, true];
_scout = missionNamespace getVariable ["scout", objNull];
_scout setDamage 0;
vs
missionNamespace getVariable ["scout", objNull] setDamage 0;
setHitPointDamage would be better option because of hardcoded hit point names
HitHRotor - main rotor, HitVRotor, back rotor
I'll try it with those names, I was going off the ones I could find in the ConfigViewer, as this is a cDLC helicopter - is that accurate to do?
HitHRotor and HitVRotor should be the same between all helis
for setHitPointDamage
"tail_rotor_hit" should've worked with setHit
this was exactly what I was looking for - seems to work perfectly now, thank you very much 🙂
I am running the following from debug console:
5 fadeMusic 0;```
which should result in the music fading to 0 volume over five seconds. The music plays without issue, but it never fades out. ``hint str musicVolume;`` returns 0. ``playMusic "";`` stops the music, but I want it to fade out. Anyone got any ideas?
Are you running ace
yes
Ace
Should just be doing ace_hearing_disableVolumeUpdate = true before the fade music, and then set it to true 5 seconds after iirc
ace_hearing_disableVolumeUpdate = true;
5 fadeMusic 0;
[{
ace_hearing_disableVolumeUpdate = false;
}, nil, 5] call CBA_fnc_waitAndExecute;
how exactly can I access and pass a variable to a firedEH? Tried different methods, none of them seem to work. I need to pass two variables to the EH.
Unfinished code:
[_vls, ["Fired", {
params ["", "", "", "", "", "", "_projectile"];
(_this select 8) params ["_targetToDelete", "_mcount"];
[_projectile, _targetToDelete] spawn
{
waitUntil {
private _isAlive = alive (_this select 0);
!_isAlive
};
detach (_this select 1);
deleteVehicle (_this select 1);
};
}]] remoteExecCall ["addEventHandler", 0, _vls];```
use setVariable
I got that example as well.
well not quite, my goal is to delete the laserTarget after the missile impacted
This is just to show the set variable on the missile around line 152
I use a frame system for my missile collision detection.
setVariable save lives
But you can replicate if not frame sensitive like you are doing. Just pass around variables in the missile's namespace.
well my object I want to delete already has a global mission namespace, only thing I then have to setVariable is the _mcount variable that is a integer
or the variable set with setVariable is different than setVehicleVarName
after reading the wiki I guess it is different
Vehicle var name is just the string representation of the variable name. It isn't used much at all.
Each object has its own namespace you can use via set/getvariable
yeah and my understanding of it seems odd. So jsut for clarity:
I set a variable on lets say object A with name A1. Can this variable then hold information about an object?
Meaning I can call getVariable A1 and can extract the object reference out of to delete it?
Or does this work differently
Say I have an object _toilet
I can set variables like
_toilet setVariable ["waterLevel", 10]
And grab it by
_toilet getVariable "waterLevel"
for "safety", leave a default value in getVariable as well
yes but how does the EH knows about _toilet? If I get it right then I can only assign it to lets say the projectile? But how can I access the projectile before it has been fired?
because the projectile is only present when the weapon fires and then I require some variables from the outside
set the variables on something you will have a reference to inside the EH - like the vehicle that is firing, for example
ah, that would work
yes that works
e.g.
_vehicle setVariable ["myTargetObject", _target];
_vehicle addEventHandler ["fired", {
params ["_unit", ...];
private _target = _unit getVariable ["myTargetObject", objNull];
}];```
if the script runs again (as it can with another target but still same ship) could there be a possibility that the getVariable receives a different target than intended and how would I avoid this? My guess is that the script runs trough so quickly that it shouldn't happen
if you assigned to the ship namespace, no
I've been putting this as a safety measure in a condition, but then I started thinking: is it really necessary? My mission only has one group that the players could be in. If a player dies, does that mean they are no longer part of the group? There is a part later in the mission where an AI can join the players. I think I used join group or something like that. But that doesn't create a new group for the player right?
_scout in units playergroup
@fair drum @hallow mortar Thanks guys, made it work now and also used the vehicleVarName of the laserTarget as unique setVariable identifier for the vls object https://github.com/aebian/Madley/blob/dev/itsAebian/NH_vlsLaunch.sqf
You have this [bin\config.bin/CfgVehicles/B_MRAP_01_F] inside your array which is not in quotes so it would break on the slashes and also won't be able to find the variable it thinks is there
Hello!
So cameraView outputs "GUNNER" when I'm ADSing, not "INTERNAL" or "EXTERNAL" as I expected.
Is there any way I can know I'm in 1st person (or 3rd for that matter) while I'm ADSing?
Does anyone have/maintain a list of the old scripts lost to time with the closure of armaholic and bohemia forums?
I know about scripts like 1ncon undercover and Don's infantry recruitment, but I can't browse through random scripts anymore because the sources of those scripts are mostly dead.
'GUNNER' is the 'ads' cameraview mode
In his code he's getting the value from the config, which would return a string
okay, well the same goes for the example from the wiki
the config path is in an array there too
so my conclusion the format would be str, arr, str, arr
Seems like an error on their end. There's no way the parser can understand that value
Does it post any errors?
Try just wrapping it in quotes and see if it works. Also see if it logs anything to the rpt
the config type is a little tricky
A = [configFile];
A is now [bin\config.bin]
the wiki example is most likely a return that has been parsed in the wrong way
ex. config.bin/CfgVehicles/C_Offroad_01_F would be configFile >> "cfgVehicles" >> "C_Offroad_01_F"
Is there such a thing as a group namespace?
the group itself is a namepsace if you use setVariable
Ah okay thanks
thanks cptnick, i didnt get a chance to read your reply before I came up with the solution haha: _airArray set [count _airArray, [( configFile >> 'cfgVehicles' >> (getText (_x >> "vehicleClass")) )]];
dont set count
use pushback
_airArray pushBack [( configFile >> 'cfgVehicles' >> (getText (_x >> "vehicleClass")) )]];
No problems opening the menu, but I just see a bunch of "Car" in the list
think I know why though
What class do you want to grab?
Just configFile >> "cfgVehicles" >> _x would suffice to grab the path to the vehicle config
right forgot about configName, sorry
Is it possible to block zoomTemp? I'm using
player addAction [
"",
{
true
},
[],
1.5,
false,
true,
"zoomTemp"
]
to test and it doesn't work for that. It does work for defaultAction to block shooting, though.
no worries*
Adding on to it since we've both tried blocking stuff
I think DefaultAction is the only one that can be blocked with addAction. addUserActionEventHandler is how I thought other actions were blocked, but that didn't seem to work either
yeah
I can solve things myself 😃 I just like to discuss the issue while i figure it out haha
the EH does fire though
But all seems to be working now
Do you know of a way to change the camera distance when the garage inits?
@still forum How does setObjectTextureGlobal and setObjectMaterialGlobal work with uniforms on players? It seems to remember which uniform it was assigned to exactly even if you drop it and pick it up again! Also works properly with JIP it seems. Its not documented but I just tried to find a flaw and apparently there is none, it works properly in seemingly all cases! When was this added, what are these textures and materials tied to if weapons/mags/items are not real network entities?
KK did that recently
A uniform also remembers its contents when you drop it and pick it up again. I'd assume material is stored same way
I remember it being extremely unreliable so I simply did my own algorithms with local sets, but now it suddently works perfectly
Weapons/mags/items are not.
But inventory containers are
Was there a change log about it, did I miss it?
Should've been, half a year ago?
I'm in awe tbh
uniform textured with setObjectTexture/Global will now show custom texture in weaponholder came in december
And yeah its stored in the inventory container
👏
If only we could recolor vests in the same way 🙏
They have a container too
I'd also wish for hat and goggles but that's stretching it
Now that we are talking about global and everything, can I create a local entity (vehicle or object) and do setObjectTextureGlobal to it? I guess only bad outcome will happen from doing this, which makes me think that global effect commands applied to local entities is the root cause of the lag that hackers manage to cause on my server
But at the same time I don't think Arma hasn't though about this and prevented it
Guessing it will end up with Error: Object(what : ever) not found on execution/JIP in RPT
Server: Object 12:15010 not found (message Type_128)
Server: Object 12:15011 not found (message Type_134)
Server: Object 12:15012 not found (message Type_128)
Server: Object 12:15013 not found (message Type_134)```
😅
I couldn't wrap my head around it at the beggining
Are these really global textures/materials on local entity errors?
Any way to clear the JIP Queue?
I know remoteExec["", "id"] will do it, but idk how to get all the IDs, exportJIPMessages will do the job but it will export to a file, so not quite accesible from SQF afaik
Only option left might be to make an extension
Just tried setObjectTextureGlobal on a local entity, no errors on client (another one)
What about server
This will basically crash the server
Guessing formation/group bullshit
Yeah
Btw does Arma have its own Usermode anti cheat to prevent known blatant exploits?
It's called good moderation
👍
Iirc the 128 and 134 not found were due to opening/closing inventory on nothing so it creates a dummy weapon holder.
Same looking log, just cant remember exact numbers
What? How? They are just log messages
That's the only logs I get from whatever the dude is doing
But whatever action behind the logs, it just lags the server so much you basically have no choice other than to restart
But lags are not a crash
Yeah, I get that in technical terms a lag is a lot different than a crash, and a crash might raise some awareness because an arma 3 server should never crash
But in terms of the outcome for players, it's basically a crash
Literally unplayable
Well it's easy to troubleshoot cause of a lag spike
Oh, really?
All the info I know is just the rpt lol
Idk abot the script making those rpt messages
The message is ignored because the object doesn't exist
Most global effect commands have the flag to not broadcast the effect if the object only exists on the machine running it
That's why things like the setPosX commands work fine on local only objects.
Profiling build, captureSlowFrame
Shit, too late, all I have are logs rn. Ty though, will do it if it ever happens again (it most likely will)
@still forum Now that we have procedural textures, how about procedural materials? 
Different thing sir
Okay, ty
Also what do you mean by now. That's a Arma 2 or older feature
"mycoolmaterial" createMaterial createHashMapFromArray [
["shader", "Super"]
,["diffuse", [1,1,1,1]]
,["stage1", ...]
,...
];
player setObjectMaterial [0, "mycoolmaterial"];
something like this
Maybe with # prefix so quickly figure out its not a file
Tbh biggest feature would be allowing rvmats to use mission textures, its impossible right now without hackery
Oh I meant ui2texture which is pretty much scripted textures
Being able to script define/change materials would've been another leap forward for possibilities
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Trying to make it so infantry spawn at a parker depending on variable number
however i cant seem to get the marker location to change at all
if (_where == 1) then {_ai_location = "base_spawn_ai_2"} else {_ai_location = "base_spawn_ai"};
_group1 = [getMarkerPos _ai_location, WEST,["rhsusf_usmc_marpat_d_teamleader"]] call BIS_fnc_spawnGroup;```
am i doing a dumb dumb?
_ai_location is undefined outside if,
_ai_location = if (_where == 1) then { "base_spawn_ai_2" } else { "base_spawn_ai" };
or
_ai_location = ["base_spawn_ai", "base_spawn_ai_2"] select (_where == 1);
oh that looks great that way, didnt know you could do _variable = if (condition)
But BIKI shows that: https://community.bistudio.com/wiki/if
i think i've been that focus'd on trying to get it working i've became totally tunnel vision'd
I'm trying to save a player's view mode at the time of incapacitation to restore it when player is healed by a friendly medic. This is needed because I force 3rd person view during the incapacitation period.
But if the player is ADSing at the moment of his incapacitation I'm having difficulties knowing whether he's using 1st person or 3rd person, mainly if the ADS is happening in vehicle/static turrets.
At least on foot I can have a waitUntil and wait for cameraView to show my intended result, but while using turrets and vehicle guns this workaround is useless.
So sad it seems like I cannot get a player's custom face and do setFace to everybody to make them have that same face
Hi peeps I need some thought power.
Is there a simple way to replace 'true' with alive' in a formatted text?
Currently working on a small reinsert tool and I'm building a vehicle status overview to show if vehicles are alive/dead, something like this:
Now as you can see using 'alive vehicleVarName' returns true of course, is there an easy way to replace that with alive? same goes for false/dead
Code:
_hintText = composeText
[
"Pie Simple Reinsert", lineBreak, "Vehicle Status Overview", lineBreak,
format["%1 is %2",PIESimpResp_RespVic_MRAP1 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_MRAP1], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_MRAP2 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_MRAP2], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_MRAP3 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_MRAP3], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Transport1 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Transport1], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Transport2 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Transport2], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Transport3 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Transport3], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Helo1 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Helo1], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Tank1 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Tank1], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Backup1 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Backup1], lineBreak,
format["%1 is %2",PIESimpResp_RespVic_Backup2 getVariable "PIESimpResp_RespVic_VicName", alive PIESimpResp_RespVic_Backup2], lineBreak
];
hintSilent _hintText;
already tried regexReplace but that only takes strings not text
private _aliveDeadText = ["dead", "alive"];
format ["%1 is %2", player, _aliveDeadText select (alive player)];
Alternatively, do a regex replace and then convert to text after
I'd do the second personally, just didn't want to write it on mobile
you can use the view EH and store whatever was before ADS?
Sounds like it has some loadout randomization script running on init
What thing has that? Unit is a "C_man_1_1_F"
Could try setting the loadout on the frame after spawning the unit
Could be vanilla, could be another mod you're loading
Ugh, sure
When its executed on local nothing happens
I don't know what you mean by "executed on local", like the uniform is correct when running the script local to the player on a server?
yeah
you just take the debug console
local execution will copy uniform
server execution will copy but instantly replace it
Shit okay I am dumb, nevermind
What was the issue?
Nah it was definitely some code i've never seen before on server side
["dead", "alive"] select (alive PIESimpResp_RespVic_MRAP1)
Yep that was said
You'd also want to save the array to a variable because they use it multiple times, that way it's only created once
what script that making plane carpet bombing?
what commands show class name bomb in debug console?
What is class name bomb
the name of Bomb in the plane
Quick question regarding post process effects - how does it determine which client to execute on? E.g. if I ran ppEffectEnable on the server it would run only on the server itself?
So I'd need to do something like remoteExec on x client?
All the post process effects are on the local client that the commands are executed.
Make a function as if it was run locally, do all your commands there. Then, remote execute that function to the clients.
Ty
Oh and one more thing, how is hasInterface handled? Also need to be run client side?
It can be run anywhere. Dedi will be false, listen will be true, player client will be true, headless will be false
You use it for filtering out who you want to run things
Mm, but say I want to check x client, I can't specify which client I want to check in the command itself, so to check a given client I'd have to run it on that client no?
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Correct. But you can exit early if hasInterface is false. It is a way to execute on all clients but if false you can avoid the expensive code if it is per se a Headless client.
Thanks guys, I've got it all working
Does anybody happen to know how to use like Cinematic Black Bars during a mission? Like a trigger or something? I want to get into more complex things and make my mission feel alive for players. Mainly for A3 Eden Editing?
https://community.bistudio.com/wiki/BIS_fnc_cinemaBorder
One integrated way
currentMagazine maybe
if you look for the ammo class, getText (configFile >> "CfgMagazines" >> currentMagazine plane >> "ammo")
What about for whenever they’re ingame? You know, where the players would be able to move during the cinematic borders
You can have some your own script. Maybe I'll write one based on that fnc
is it possible to stop a unit that is doing a scripted move? I cant find anything on the wiki page for BIS_fnc_scriptedMove
end of file ->
//at begin of script
#define THIS_FUNC BIS_fnc_scriptedMove
#define TO_STRING(ARG) #ARG
....
//end of file
isNil
{
_unit playMoveNow _endAnim;
_unit setVariable [TO_STRING(THIS_FUNC), ""]; // end
_unit enableAI "MOVE";
};
//--- finish
I believe you can stop it the same way it is stopped in function.
Is there a function somewhere that opens the Vehicle Customizer screen for a vehicle that's already spawned in game?
how do i view the BIS_fnc_scriptedMove function?
From Functions Viewer in game
(im using mods
ADT -> https://steamcommunity.com/sharedfiles/filedetails/?id=3499977893
3den Echanted ->https://steamcommunity.com/workshop/filedetails/?id=623475643 )
So in vanilla (without mods) can be a different kind viewer appearance
thank you!
So I have this in the initialization line of my zeus module, but nothing's added to the left side list when I open zeus: {this addCuratorEditableObjects [[_x],true]} forEach (allMissionObjects "");
tried allMissionObjects "All" as wel, nothing
Is that line being run by the server?
It's in the init line so presumably all connected clients + server
just running in the editor
What would it take to get these characters to show correctly in game?
Địt mẹ! Họ thấy rồi
As an aside why loop this when the command takes an array
thats just how I seen the example
Well that could be the issue, it takes an array and you are passing object
this addCEObjects [allMissionObjects "all",true]
Nah hes not hes adding an array containing a single object
Oh you're right, it's an array for each of the mission objects -_-
how do you use them?
If the characters don't exist in the font used by the chat display, there might not be anything you can do
I was just trying to use Vietnamese for my Vietnam mission. It's not a big deal. I can still have a voice actor speak Vietnamese and write the subtitle in English.
it's more like "do you use a stringtable, is your file saved as UTF-8", etc etc
The line is stored in init.sqf and is retrieved with a function. I'm afraid I dont know the words you mentioned "stringtable" and "UTF-8".
Does allPlayers work on a dedicated server?
https://community.bistudio.com/wiki/allPlayers
It should yeah, just note that it might return an empty array for a good while after mission start. It was driving me crazy years ago until I discovered that there's quite a delay there 😅 When I used/tried to use it, it could take as long as half a minute from mission start until it started working properly
Thanks for the tip. How did you resolve that issue for yourself? Maybe add a 30 second timer with a black screen to delay the mission start?
I'm guessing he was just abbreviating
According to BIKI you can use https://community.bistudio.com/wiki/BIS_fnc_listPlayers instead
figured when i couldnt stick it in haha
According to v2.18 changelog:
Tweaked: Improved
allPlayersscript command on servers
That's nice 👍
Well its working for allMissionobjects, but not allMapMarkers
"Error position: <addCuratorEditableObjects [allMapMarkers>
18:53:13 Error Type String, expected Object" why is allMapMarkers a string?
in notepad, pick "save as" and you should see the encoding options
Thanks for the insight. The "OpticsSwitch" event handler did the trick. Although I wished to make it a one-time check (at the moment of incapacitation), the EH will do.
A stringtable is a table...of strings...which the game looks things up in to replace placeholder text. It can contain several possible values for each key, and choose from them based on the selected language.
https://community.bistudio.com/wiki/Stringtable.xml
UTF-8 is a text file encoding type. It is essentially the default standard for text encoding, and has full support for all Unicode characters. Most text editors should work in UTF-8 by default, but it is possible to select other things which don't have full Unicode support or which can't be read properly by the game.
https://en.wikipedia.org/wiki/UTF-8
Map markers are strings
okay, well then how can I add the markers to the zeus marker list?
I know markers individually are strings, but I figured I could throw the allmapmarkers in as an array just like allMissionObjects "all"
But allmapmarkers returns markers
Which are strings
You cant just throw a command in because it isnsyntactically similar to another one
But more on topic, i dont knownof a way to add existing markers to a curator
I just seen array as an input type on the wiki and figured it would take both XD
There's a markers section under the EDIT list for zeus, so I dont think it was too far fetched to think I could add markers in with that function >.<
Always be suspicious if the input type is array
Dive into the curator functions
See how they natively handle markers
Where can I get started with simpleVM? It seems to lack docs
There is this thing but normally I just guess & test:
https://community.bistudio.com/wiki/diag_testScriptSimpleVM
Does anyone save missions with MCC?
Riddle me this - - - if my squad is halted via a vanilla "stop" command by the player - how can my script get a single unit back up and moving again? enableAI "MOVE"; doMove; doFollow; have all been tried.
Leopard20 - c
doFollow doesn't work with player-issued commands (those issued via the commanding menus). As a workaround, it is possible to use joinSilent instead, and join the unit into its current group:
[_unit] joinSilent group _unit; // return to formation
Note that the group must have at least 2 units, and not all units should be joined at once, otherwise the group will temporarily become empty and all its waypoints will be lost!
https://community.bistudio.com/wiki/doFollow
@hushed turtle - thanks - let me look into that - much appreciated.
I have a script in which the crew assembles and disassembles static weapon depending on whether an enemy is nearby, but that's not the point, as soon as I install my script in the init of group, the mission doesn't open, i.e. the loading screen freezes. I tested it in the editor and it works normally. I'm playing in a singleplayer mission with a dedicated server. My script:
params ["_unit"];
private _group = _unit;
private _pos = getPos leader _group;
private _randomDir = random 360;
while {true} do {
if ({alive _x} count units _group == 0) exitWith {};
private _groupPos = getPos leader _group;
private _enemies = allUnits select {
side _x != side _group && {alive _x && _x distance _groupPos < 350}
};
private _friendlies = units _group select {alive _x};
private _wp1 = _group addWaypoint [_groupPos getPos [20, _randomDir], 30];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointStatements ["true", "
group this allowFleeing 0.5;
[group this, 'StaticWeaponUnpacked', {
_this spawn
{
sleep 30;
[_this select 0] call BIS_fnc_packStaticWeapon;
};
}] call BIS_fnc_addScriptedEventHandler;
[
this,
this,
this getPos [1000, random [0, 45, 315]],
this getPos [30, 0]
] call BIS_fnc_unpackStaticWeapon;
"];
};
sleep 5;
};```
Notepad and Notepad++ are different.
In Notepad++, you can see the current encoding type in the bottom right status bar, or change it from the Encoding menu in the top toolbar.
Text encoding types and file formats aren't the same thing.
Ah, in that case it says "UTF-8".
But I am using VScode. Is that just modifying the notepad file or is it, it's own thing?
Do you see any other files in the folder that it could be modifying?
Yes there are files that I created in VScode. And the notepad file has my up to date code. Interesting. I thought VScode was it's own file type or something.
I guess the important thing is Arma sees the .sqf extension.
I am making this thing where I setVariable to myself, but for the sake of performance I broadcast the variable to players close to me.
For this, setVariable will take an array of netIds, the deal is that my code is client sided, so I do not know how to get the players netids from client
You can just use the player objects, you don't need to find their netIDs
I tried and it didn't work, I must've coded something wrong then 😅
Nah it most definitely doesn't work with the player objects
_broadcastTo = nearestObjects[cameraOn, ["CAManBase"], 10];
player setVariable ["SP_69", true, _broadcastTo];
//_broadcastTo = [civ_2]
//player getVariable "SP_69" = false```
Oh, I confused it with remoteExec which does use objects. Kind of weird that they don't both use the same system.
Other than that, you can't get other machines' network IDs on a client. You could have a server function which accepts the player objects and then gets their network IDs with owner.
do you really need to worry about it?
is just a bool?
yes it's just a bool
Or you could remoteExec setVariable like some kind of barbarian
Yeah but having that on client.. I'd rather not 😅
do it if you see that it affects performance, if not, don't create non existent problems
it's just that, if I can make it a little more performant, why not
It's possible/probable that the complicated workaround for network IDs will end up costing more performance than just doing it the easy way
If you're going to send a really heavy data to network then yes, you should worry about it, a little bit, but just a bool? nah, don't waste your time
Gotcha, ty guys
Ok, so I'm trying to take the bobcat's gun away and so far hideTurret has worked great to make the model disappear. Now I'd ideally like to retain the 'seat' while removing the ability to operate the (now invislbe) gun. Any ideas?
How can I make this condition if I can't write code in the condition spot? The wiki says that only a string can go there.
[
ptboat,
"<t color='#FFFF00'>Place C-4 Plastic Explosive: 15 Minutes</t>",
"a3\ui_f_oldman\data\igui\cfg\holdactions\destroy_ca.paa", //idle icon
"a3\ui_f_oldman\data\igui\cfg\holdactions\destroy_ca.paa", //progress icon
"(missionNamespace getVariable ['ActionSTABTimeBombs', false]) && (vehicle _caller != ptboat)" // condition
"true", //condition progress
{
params ["_target", "_caller", "_actionID", "_args"];
["bomb45", [_caller]] remoteExec ["FoxClub_fnc_Conversation"];
}, //code on start
{}, // code every tick
{
missionNamespace setVariable ["ActionSTABTimeBombs", false, true];
playSound3D [getMissionPath "sound\PlaceBomb.ogg", getPosASL ptboat, false, ptboat, 3];
["scripts\bomb.sqf"] remoteExec ["execVM", 2];
}, // code on finish
{}, // code on interuption
[], //arguements
3, //duration
8, //order from top
false, //remove on finish
false, //show if unconcious
false //show in middle of screen
] call BIS_fnc_holdActionAdd;
U should write condition as a string, not as a code. And u shouldn't use private vars.
that and also you can use toString (it's better to read)
I'm not sure how to do what you all are saying? Is this what is meant?
_string = (missionNamespace getVariable ['ActionSTABTimeBombs', false]) && (vehicle _caller != ptboat)
"_string" // condition
just write your condition code inside a string or use toString command
@thin fox means to use
private _code = {
// ur condition
};
toString _code; // condition
Oh this is new for me. Interesting. i haven't done this yet.
yeah I'm on mobile so I can't provide you with an example sry
No worries! I'll mess around with it. I'm unclear where to put the private part and also would it be okay to put _caller in there too.
for condition to show, it only works _this and _target, the rest you can pass as arguments
in your case in can look like this:
private _condition = {
(missionNamespace getVariable ['ActionSTABTimeBombs', false]) && (vehicle _this != ptboat)
};
[
ptboat,
"<t color='#FFFF00'>Place C-4 Plastic Explosive: 15 Minutes</t>",
"a3\ui_f_oldman\data\igui\cfg\holdactions\destroy_ca.paa", //idle icon
"a3\ui_f_oldman\data\igui\cfg\holdactions\destroy_ca.paa", //progress icon
toString _condition, // condition
"true", //condition progress
{
params ["_target", "_caller", "_actionID", "_args"];
["bomb45", [_caller]] remoteExec ["FoxClub_fnc_Conversation"];
}, //code on start
{}, // code every tick
{
missionNamespace setVariable ["ActionSTABTimeBombs", false, true];
playSound3D [getMissionPath "sound\PlaceBomb.ogg", getPosASL ptboat, false, ptboat, 3];
["scripts\bomb.sqf"] remoteExec ["execVM", 2];
}, // code on finish
{}, // code on interuption
[], //arguements
3, //duration
8, //order from top
false, //remove on finish
false, //show if unconcious
false //show in middle of screen
] call BIS_fnc_holdActionAdd;
but in my opinion it's simpler to use string condition
What is string condition?
as implemented in this code
The wiki says the arguments get passed to the code sections but doesn't mention the conditions part. So would it be okay as written above?
Ah, you said but which made me think there was another way that what you wrote. I'm going to plug this in and see what happens. Thanks yall!
conditionShow: String - (Optional, default "true") condition for the action to be shown.
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit)
so u should use _this instead of _caller
Ah that's probably why its not showing up in the action menu. Ima adjust that now.
Yeah adjust that worked. So I understand more. Would this work too? I switched the object name with _target
private _condition = {
(missionNamespace getVariable ['ActionSTABTimeBombs', false]) && (vehicle _this != _target)
};
i think it should work
Yeah, it did. So cool! Thank you all! This opens up many more possibilities for conditions for me!
Is there any func to check if player is speaking?
I've also thought about checking if the player's mouth is moving, if it is, then player is talking. Is this possible to check using sqf or is it too much to ask for?
if u mean VON, arma 3 hasn't command to check if player speaking.
yeah I mean VON, arma 3 doesn't have the command but it does have that sort of functionality added. Because players move their mouth when they talk
if I could check the animation state of the mouth, that would make me an easy isSpeaking command
The TFAR mod has an option to let AI know if players are speaking near it. Maybe you ask what they did?
tfar has tf_isSpeaking var on player
https://community.bistudio.com/wiki/getPlayerChannel
Only returns > -1 if the player is speaking
This works, thanks
Hey there 😄
Ive got a problem that my publicVar dont work like expected.
You can see my math. I simply try to add +1 to the existing value "EBER_AA_COUNT".
It does work in editor. But dont work on the server.
Do I have to localize my execVM via remoteExec to global so my publicVariable "EBER_AA_COUNT" can be changed from another script?
How do you run this code. How do you check it doesn't work on the server
Each machine has its own value of each variable.
publicVariable "varname" publishes the local value of that variable to every machine at the point when it's called.
Every time you change the value, you have to publish it again if you want other machines to have the same value.
Its an execVM "......\randomGen.sqf";
So if Ive got @granite sky right, my problem would be fixed if I would change the first script via remoteExec to global?
Ouuuu
Ill show you - 1sec. Im still here
@rich bramble In a real quick test I was able to physically remove the turret from the bobcat with bobcat animate ["HideTurret",1], and then remove the weapon with bobcat removeweapon "LMG_RCWS"
'bobcat' being what I named the bobcat
But you can see how things are done.
So I just would have to insert a publicVariable again in the script in the moment the value had changed?
In all cases, its getting late. But Ive learned something new 😄
Thanks brother ❤️
What is "again" in this context?
Ive published it once by its creation.
If Im "up" again Ill try to also publish it after any changements.
So in the document with +1 as well
Because I hadnt know that Ill have to publish the changed version as well.
The more I think about the more self understanding it becomes haha
publicVariable will transmit the variable and its content once when it is executed. It is not going to automatically updated once the variable is updated in your local computer, if this is the question
Now Im confused again because both scripts run on the same server via execVM. (We also use headlessclients)
But there need to be a chance to loose the var in this system. Because the enviroment is the only diffrence
Why you run this script twice on different computer when the concept of the script is about to transmit one variable?
knowledge gap and I generate wich AA will spawn at first and then do the details in a second script
No. That's not what I ask, I ask why you run the same script on two different computeres, which means, it runs twice
ouuu now Ive got
I never wanted to do. I tested in the Editor without headless clients and when I decided to test on our server it spawned the AA 900 times because the add to the total amount wont happen
Okay, I'll try not to figure out your intention
(I dont know how to get headless clients in editor to simulate the enviroment of our server)
I'm saying because publicVariable will transfer the variable to everyone, using the local variable, regardless it is run on your client computer or your server
If you server runs it, it transfers the variable that is stored in the server locally, if client runs, it transfers the variable that is stored in the local computer
This is the concept
You are running the same code in two different clients, is one possible issue
Since Ive started with programming/ scripting the localization is a hard thing.
At first to understand (I would say I did)
At second the usage (Thats my current state)
And people like you help a lot to understand and get clearance about the ongoings
Meanwhile I do lough about people who cry about the "bugged Arma" because Ive understood where most of the issues are created...
A real honest and big thanks to you <3
its half passed 7am in germany, I havent slept. Today is GameDay. Im the host...
Ill do the script manually for this week and will attend your tips after I got the chance
Because now I need a break and sleep
Anyone familiar with ACE? Any way to disable ACE medical for a mission (for that mission only, i dont want to delete the pbo from the server), so that i can use FAK revive instead just for that mission. Cant seem to find it in the modules.
Does anybody have experience with Arma 3 sector modules? I want to change the capture time of a sector that I dynamically created through code, however I can't get it to work. This is my current code (the cost does not apply):
private _sector = _group createUnit ["ModuleSector_F", _safehousePosition, [], 0, "CAN_COLLIDE"];
_sector setVariable ["sides", [west], true];
_sector setVariable ["name", "Safehouse", true];
_sector setVariable ["designation", str _wave, true];
[_sector] call BIS_fnc_moduleSector;
private _area = createTrigger ["EmptyDetector", _safehousePosition];
_area setTriggerArea [10, 10, 0, false];
_area setTriggerActivation ["ANY", "PRESENT", false];
_sector setVariable ["areas", [_area], true];
missionNamespace setVariable ["sector", _sector];
sleep 1;
[_sector, EAST] call BIS_fnc_moduleSector;```
This is what I found in the docs: https://community.bistudio.com/wiki/Arma_3:_Module:_Sector
Post the entire code
I don't think you can disable it entirely, however just disabling revive might work which should be possible
Im back.
Slept 1-2 hours.
Got lvl. 1.000 on motivation
Im that <----> close to finally succeed
Sorry, I edited the original message to have everything related to the sector in there
Also very weird that I had to sleep 1 before assigning the sector to EAST
I assume it was a race condition somewhere
The sector works, but the capture time does not change