#arma3_scripting
1 messages · Page 156 of 1
or createUnit / createVehicle which is the slowest thing i've had to deal with
Those are instant for me
Relatively seen alganthe
oh yeah.
Then again in a lot of cases you wont run against the 3ms limit in scheduled, and there is no absolute need to stay in unscheduled space
Most larger projects prefer to though
i see stuff i could convert to pfh (custom, not cba) but some other that really has to stay in scheduled mode
you forgot a un*
Phone, thanks
Zbug in the end it really comes down to code design, and the priority of it running completely faultless
actually anything that has a mandatory sleep in it
as long as it's not cba
Add a PFEH that removes itself when it runs
sleep is also unprecise waitAndExecute is 100% precise
Essentially
it's not about precision i really don't mind that
it's an ACE3 function based on PFHs, but it can be converted to vanilla, which I did.
ok
I'd still argue that for a lot if things the difference between scheduled and unscheduled does not meaningfully matter. As long as youre aware of the differences when you do run into stuff.
well nothing on google for this one
yeah i see what you mean
that may explain the few "name unit : unit is dead" logs i find
may come from scheduled scripts with an alive condition
makes sense
Yea exactly
but if i'm going to scan 150 places on the map in a 200 meters radius, or spawn 50 units, i'd rather use some sleeps so the machine doesn't choke
and that means scheduled basically
The most fucking annoying RPT error I get now is unit _x has too many magazines
Or spawn 50 units in batches
yep :p
5 times 10
still
it doesn't freeze, it'll just reduce the framerate
More convuloted
does anyone know how the command menu works, or how it uses the values passed to it through the global variables
I noticed when messing around in zeus that you can change the AI spotting skill and speed. Can you do this in the editor as well? If so will the server AI settings overwrite the individual AI adjustments?
You can do it at any time using this: https://community.bistudio.com/wiki/setSkill (this is what those sliders use behind the scenes)
I found these in edenenhaced. If I change these will the be overidden by the server AI settings (ex: SKILL and PRECISION)
I'm not sure exactly on the order of precedence for CfgAISkill vs Editor setSkill during mission initialisation, but any skill changes after mission start will definitely override the server. (as long as they're executed where the AI is local, of course, because it's an LA command)
Could you please explain the LA argument. I'm my mind I view objects like AI to be global. If they are local I would need some work around because I want every player to be facing these AIs with the same skill.
https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality
AI, and most objects, exist globally and are synced, but one machine (usually the server, but not always - group leader takes ownership for AI, driver takes ownership for vehicles, etc) is their actual owner. That's the machine where the thing is local. A Local Argument command is one that must be executed on the machine where its target is local, in order for it to take effect.
setSkill is also a Global Effect command, which means all machines will receive the changes it makes. However, even if it was a Local Effect command, that wouldn't necessarily be a problem unless the AI changed ownership. Their actions are controlled by the machine where they're local, so even if other machines thought their skill should be different, it wouldn't matter - those other machines aren't in charge of what the AI are doing.
AIs have "final skill" which is a combination of server skill and mission skill.
That's quite annoying
Okay so in my case I'm speaking of an enemy AI thats is patrolling around. My mission is on a dedicated server. Does that mean they are local to the server? If so, does that mean the command should be placed in initServer?
John do you know what the specific math is for this equation? Does this mean that even if the aiskill command is executed after the mission starts the equation is still true?
If they were placed in the Editor, or created by a script running on the server, and not in a player's group, they'll be local to the server. initServer.sqf would be an appropriate place for the command. Their Editor attributes will work too, though using a script is a convenient way to bulk-apply stuff without duplicating code or making the mission.sqm massive by giving everything custom attributes.
Tyvm Nikko! I think I understand.
the only real performance issue i have to deal with at the moment is the way arma doesn't seem to like a large number of AIs (200+) even if they're not in visual range
even with headless clients
the client performance quickly becomes crap
so i've been drastically limiting the number of ais the mission can spawn at a given time but if you have any idea on how to make it playable with more ais i'm interested
Cache them, or only spawn then when player gets close
this is exactly what i've been doing
and it works great if all the players are together
but if player 1 and player 2 are 10 km apart and each makes their own ai spawn
it will lower the performance of the other client who's 10 km away
If you wanna be cheeky you could spawn ai on player clients
with createVehicleLocal ?
No
Same as you would on server
but wouldn't it make clients performance actually worse ?
Use player client as ghetto headless
because server and HC performance is awesome
Has anyone a good way of having an object spawn but despawn if a specific team is near by?
TLDR i'm trying to make the rallies from squad, where your personal squad can spawn on them, but if the enemy comes by it despawns.
Yes thats why it was cheeky
you should avoid createvehiclelocal its messed up logic
Maybe there is a mod already for this but i don't see one.
i use it exactly for what it was meant for :p
with stuff that has no colision no physics or anything
certain objects are transferred to the server when the client d/c, but the object is local to the server only
Another one is disabling that one option
so if you got multiple createvehiclelocal per client, server performance gets worse the more clients you have that d/c.
Is there a way to make an AI drone use it's laser to target a enemy?
Where AI checks for visibilty are conducted on all clients
how would you do that ?
@tough abyss you're run but the way i use it, even if the client d/cs right when they have local objects, it won't cause an issue
you're right*
Its engine/design issue, the local client object is transfered to the server. I think AI units aren't effected, but objects are
Anyway just a heads up
Why not use the lasertarget object I mentioned before?
That's what happens behind the scenes anyway
so even if they get local to the server that's not an issue
i just want them to be invisible to other clients
anyways
@indigo snow "Another one is disabling that one option Where AI checks for visibilty are conducted on all clients"
you got my curiosity here
can't leave me hanging too long
I'm having problem with how ace handles laser, when creating the laser I get an error in my rpt saying there is no owner for it.
But maybe the laser guided arty shell is the problem.
Im looking it up
ok 😃
Hold on phone
no worries
but wouldn't it help with cpu usage only where the AI is local ?
cause that means the server, and the server really has no issue
Opposite
oh
so you could do that on all players
get some performance improvement
but players wouldn't spot AIs anymore
so what exactly gets lost with it
player knowsAbout someAI
spotting rely on knowAbout though doesn't it, like if knowsAbout gets above a certain value, unit is spotted and can be targeted
Does not influence actual graphics drawing
for example let's say i'm a client and i have a few AI soldiers in my group, would that make them super dumb ?
i mean, dumber than they already are by default
😄
ok
can't really test in solo cause everything is local
but i'll have a test release on the server to try it
Set up a dedi on your pc
see what exactly changes and especially if fps get better with a lot of ai
hmmm yeah
i could do that indeed
i already have a remote server though, might be more accurate to see if fps are better or not
better, i'll put that in the main branch, linked to a mission parameter
so anyone who wants can test it
I need a way to retrieve the classname of the respawn loadout a player chose.
The respawn loadouts are generated dynamically on mission start like so:
{
[west, [_x]] call BIS_fnc_addRespawnInventory;
} forEach blufor_squad;
{
[east, [_x]] call BIS_fnc_addRespawnInventory;
} forEach opfor_squad;
blufor_squad and opfor_squad are just arrays containing all the unit classnames to make respawn inventories from. The player classname is always "survivor" but he can choose any loadout on mission start and then any time he respawns afterword. It is a multiplayer map
I am trying to get my mission that has never had any issues handling loadouts to work with 3CB faction's asinine custom config system which breaks compatibility with every existing script that handles unit spawning and inventory management. I figured it out for setting up the arsenal (which should contain only items from the selected classes) by creating a function to handle the custom config parameters and reformat them
If I can get the classname that corresponds to the chosen respawn loadout I can make an event handler that retrieves that same data and adds it to the player after spawning
but I can't find a way to do it. Role and display name aren't enough since multiple classes can have the same roles and display names.
if it breaks local AI i could have it work only for clients who have no AI in local (the majority of them)
There are 3 ui elements involved. You will need to check what index the user has selected locally. Or add a UI event handler to save the currently selected item for you to use later. The 3 possible controls are:
BIS_RscRespawnControlsMap_ctrlLocList
BIS_RscRespawnControlsMap_ctrlRoleList
BIS_RscRespawnControlsMap_ctrlComboLoadout
one of these returns the classname/vehicle?
I found a thread that uses those to return role or display name
but I need the classname so I can retrieve the loadout items from that class's config
You can grab the display name, then do a config compare to grab the associated loadout
Nah, that won't work
multiple classes can have the same display name
I checked and it does the same in the inventory lists
same for role. units can have the same combination of both
okay, so you know you can add custom attributes/properties to the config entries right? so add say, a index number that you intend to have them added. then compare that with the index selected
Custom attributes to the respawn inventories?
If you manually define them sure but how do I do that dynamically?
are you not using the config class for the respawn inventories?
it's like the first thing I mentioned
I need my system to work entirely off a list of classnames so I can use custom factions dynamically
that is adding them dynamically, not generating them. They are still defined in the config if you are using BIS respawn menu
so let me go back to thinking for a sec
what is in your mission config file
what's the difference
what part of it
class CfgRespawnInventory
nothing
the loadouts for that respawn menu are defined in CfgRespawnInventory.
not via BIS_fnc_addRespawnInventory
your current script does nothing. as that function doesn't take an array of item classnames
It literally does
it works for me
BIS_fnc_addRespawnInventory can take an object and create a respawn loadout from it
CfgRespawnInventory isn't in my description.ext anywhere
;p
looks like I need to add that to the wiki page. as the wiki page only states for inventory params a string (CfgRespawnInventory class), or an array of strings or numbers, but it does appear to search in CfgVehicles within the function itself.
I am certain that's how I figured it out
Maybe it isn't. I created this mission a very long time ago when I was much less proficient and I wouldn't have figured it out on my own then
testing something
you know, i'd be glad with anyone reviewing my code, if you want to stop the sass and walk the walk instead ;))
ok, so BIS_fnc_getRespawnInventories will return the array of inventory class names as strings in the order in which they were added. You can then do a comparison check to the index of the selected, treating it as the getter in that array.
_inventories select _selected
how you get _selected is up to you. either with UI event handler, or ui command checking with the 3 controls I posted above
my entire issue is how to get _selected
the classname isn't stored in the loadout so I can't retrieve it that way
actually wait I might have misunderstood
you can add an event handler to the ui control via https://community.bistudio.com/wiki/User_Interface_Event_Handlers#Listbox_Events or lbCurSel to get the _selected index along with one of these (not sure which one atm - probably combo loadout - you might have to dig a little deeper into that control with how it does its selection):
BIS_RscRespawnControlsMap_ctrlLocList
BIS_RscRespawnControlsMap_ctrlRoleList
BIS_RscRespawnControlsMap_ctrlComboLoadout
you can then use BIS_fnc_getRespawnInventories to get the array of loadout classes that you added (which should be CfgVehicle classes)
then you use _selected to get that position in the array and return that class (since it will be in order) which now you have the CfgVehicle class name. Then you can use getUnitLoadout/setUnitLoadout or whatever else you want to do
looks like that's just the display name again
but you mean I can get the index from that and select the list of classes and they should correspond?
_selected should be a number if you use lbCurSel on the event handler or command
that number, corrisponds to the array position of your class you added, which is found in BIS_fnc_getRespawnInventories
also, updated the wiki page to include CfgVehicles soldier classes for BIS_fnc_addRespawnInventory
are you sure that info wasn't in the wiki page in the past at some point?
_respawnCombo = uiNamespace getVariable (["BIS_RscRespawnControlsMap_ctrlComboLoadout", "BIS_RscRespawnControlsSpectate_ctrlComboLoadout"] select (uiNamespace getVariable ["BIS_RscRespawnControlsSpectate_shown", false]));
_respawnTemplateDisplayName = _respawnCombo lbText (lbCurSel _respawnCombo); systemChat str _respawnTemplateDisplayName
This is what I was using. Found it on the forum earlier but don't understand how it works
but it does use lbCurSel to select so I think I'm almost there
yeah just grab the lbCurSel, remove the stuff about lbText. we don't want the text, just the selection index number
should just be private _selected = lbCurSel _respawnCombo
it always returns 0
no matter which inventory you select?
Yeah. After spawning
if it only works in the menu I can't test that without the debug menu so I guess I need to try making it a variable for the player?
how many items do you have in the drop down menu? or do you have a single thing in the drop down menu, but many roles?
multiple items in both dropdowns
sometimes just one in the left and several in the right
depends on how the unit is configured
well there goes that idea
Wait that means this won't work
unless I sort the class names into a new nested array separated by their class?
that wouldn't preserve the order though
give me a sec
I can't really make any sense of the addrespawninventory function. Is it possible to set a custom display name through it? It doesn't look like it but I can't tell for sure tbh
i have a working answer, standby, i have to write it
do you use CBA
eh I'll just make it scheduled, it shouldn't need to be frame specific
@runic surge https://pastebin.com/Gu7R73cQ
it works (this is a testing example, you'll have to change the inventories at the bottom), but that's it. its not optimized or refactored. just the "get it working stage". but I gotta hit the sack for the night
Thank you for all your help
I think it's working
you're a legend for doing all that
you might have to change it up a little bit on a new respawn, but at least its a proof of concept. can't remember if ctrl event handlers stay after the control is closed.
I executed it in my current session via debug menu and then respawned and it worked. I am going to be doing a lot of testing and if possible making tweaks where necessary
It seems to be getting parent classes-- it works for vanilla nato but the 3cb faction I am testing with shows vanilla units and rhs units they inherit from. I will investigate further
oh this just uses the display name
I wonder if if CODE could be a thing?
For example, right now:
if(player getVariable "var" get "key" > 100) then {
123;
} else {
321;
};
``` => `nil`
But what if you could do
```sqf
if{player getVariable "var" get "key" > 100} then {
123;
} else {
321;
};
```=> `321`, which would act as `false` if code returns `nil` ?
Also suppress the errors similar to isNil
Yes I know it could be done with ENTITY getVariable ARRAY and getOrDefault*, I just wonder if there could be if that treats nil as false
Another way to solve this btw:
call {
if(player getVariable "var" get "key" > 100) exitWith {
123;
};
321;
};
Is there a quicker way to do agents apply {agent _x} ?
Basically allUnits but for agents? 🤔
allAgents
I never understood what agent is. Who/how does one even use Team Member or whatever its called?
Team & Team Member were introduced with Arma 2 and were never really used
agents however, are "simple AIs" so you can place plenty of them without hogging the CPU (too much)
Well agents returns Team Members, for no reason
_WBK_Combinus = ['WBK_Combine_CP_SMG',1,'',0];
[Zeus] call BIS_fnc_curatorObjectRegisteredTable;
I wanted to set the cost of the unit after following the curator wiki but this removes all objects from zeus. I'm not sure why
the first line has nothing to do with the second one
damn I'm still learning I apologize XD
no problem at all! Speak freely my son 😄
In that case, what would apply the first line?
private _list = ['WBK_Combine_CP_SMG', 1, 'B_Soldier_F', 42];
[Zeus, _list] call BIS_fnc_curatorObjectRegisteredTable;
Holy moly thank you I've been trying to do this for 2 days XD its 3 am and I'm supposed to wake up tomorrow for the real army lmao
now I just have to make positive numbers negative and I never have to think about it again
thanks again I suppose
From what I gathered its another system that should've been scripted but is handled by the engine for no good reason
Wish BI could just release design doc on agents or something, maybe there is a good reason for them
I guess the general reason is simplier AI simulation, but tasks and teams could've been just scripts
Used targetKnowledge command return, still not the same as what engine does 🤔
Now it started drawing the line right to the followed unit 🤔
It used the display name to do a config search. Might have to do additional config manipulation to avoid the parent class.
Just check the scope
What language is this
sqf
Fuck knows what that is
Which of these are effected by the server/difficultly settings AI Skill and AI Precision? Im guessing that the ones that having aiming in the name are adjusted by AI Precision and the rest are AI Skill?
Sleep in unscheduled dies when you've already screwed the pooch and are hammering the script engine. If you have to work around that you've already failed.
Oh
In case Google serves you some AI generated 🐴 💩 summary, here's something specific: https://community.bistudio.com/wiki/SQF_Syntax
You shouldn't be putting exhaustive searching and crap like that in the PFH because it blocks the entire main thread.
sleep even works in unscheduled ? thought it didn't
Scheduled I mean.
ha
I’m not learning it but thanks
i find that the sleep duration only gets unreliable when the engine has a lot of stuff to do like a large batch of createUnits, so that's actually fine by me if the sleeps start getting longer and stuff gets executed later
the variables getting changed during the loop is a much bigger problem, potentialy
LOL
Probably a very stupid question, but does anyone know if its possible to set up a headless client on LAN? Normally I would use a dedicated server, but one of the mod I’m using for my mission isn’t really dedicated server compatible and its kind of a pain to make it fully compatible with my mission.
Which variables?
How did you end up here then? Lol
anything that's not private to the scope, conditions like "alive unit", etc
a unit can be alive and dead in a single while loop
it can't be alive and dead in a single frame
Even though this ain't a #arma3_scripting topic but how it is not Dedicated compatible? How it does happen or how you could be positive about it?
just means you have to write your code with expecting that ..
no problem which comes out of it
I’m using johnnyboy’s SOG AI mod, another member of this server helped me out with making it mostly dedicated server compatible, but for the most part its still kinda unstable and I’d rather just use it on LAN. But the problem with that is that ALiVE missions perform much better on dedicated servers and I’m unsure if I can get the same kind of performance that I get with a dedicated server on a LAN.
exactly
Ideally I want to use a headless client to offload a lot of the AI calculations (+ ALiVE’s back-end stuff if possible)
Yeah, the code he posted was just updating arrays with game state. Nothing that needed to be atomic.
i've been using while loops a bit carelessly, some could be replaced with pfhs
but i'm against that idea that all loops suck no matter what
They do suck, but sometimes it doesnt matter that they suck since its trivial
things that take longer than a frame, can't be altered by external events, for example
I didn't said all loops sucks, I use foreach, for forspec, and count myself.
does anyone have a script to put into an object in order to spawn a civilian character? trying to impliment some automation in my units training server and our medical team needs a patient spawner. ive looked online but i can find anything that i can make work
createUnit and then the type of unit to spawn
would i enter the class name of the character i want to spawn then?
ah. thats interesting
You probably want to use something like an initServer.sqf script, which runs once on the server's end
You make a file called initServer.sqf in your mission folder
Cheeky
actually for var too in loadouts
cmon
I'm consistently running into issues where AI units will have their pathing be re-enabled on a dedicated server even when it is disabled through their attributes, are there any known causes for this and would my only work-around be running a script to disable it after X amount of time through the server?
LAMBS is loaded (although completely disabled for the mission) and while I suspect it is the cause, pathing isn't always re-enabled even with it on and IIRC sometimes it happened even though I didn't have LAMBS at all.
I'm fairly sure there's nothing in vanilla Arma that will re-enable PATH after you turned it off. If there is, you should try to replicate the issue.
_unit enableAi "PATH";
```?
I mean without you doing that.
There are some mods on the workshop that try to "unstuck" ai units by re-enabling features on a loop for all ai units... but in vanilla nothing should re enabled them without a script doing so on a sleep or something
Damn that won't work then
still much closer than before though
Just check the scope
what?
Just check the scope of the class as well. Parent / base / whatever you want to call it will usually have a scope of 0 or 1, since then they're not directly usable
_displayName == getText (_x >> "displayName" and { getNumber (_x >> "scope") >= 2 }
Nah the parent classes are standard units as well
the mod inherits from them
displayName isn't valid anyway since multiple classes can have the same display name, even in the same mod
Yeah I don't really know why you're using displayName anyway
wasn't my idea
Back to square one. My next idea was to create a modified version of BIS_fnc_addRespawnInventory to parse the custom config values.
I can't exactly see how this function parses the config though. I don't see where it retrieves the weapons[] and magazines[] config values
addRespawnInventory doesn't parse config values. It just stores a reference to a config class.
so where does the config parsing happen?
I don't know. Might actually be engine.
Oddly enough the config for this stuff seems to be undocumented, although it's superficially straightforward.
spawn equipment for units is contained in linkedItems[], items[], magazines[] and weapons[]. Respawn versions exist of each, starting with respawn.
Where? :P
anyway that doesn't matter because it doesn't help me parse the necessary config parameters
3cb faction mod deliberately has improperly configured unit inventories. This breaks functionality for anything that need to retrieve that info
I need to retrieve their custom parameters and parse it
specifically for the respawn system (not using preconfigured loadouts)
Isn't the issue that 3CBF runs an init function on unit creation that changes the loadout?
The units are improperly configured so they can use their custom init function for randomization
it breaks more often than it works
it's bad design but I'm trying to work around it
Aren't you saying that the data you're looking for doesn't exist?
it's stored in custom config parameters
different syntax, but the data is there. their function retrieves it from there
but that means the respawn system doesn't know where to retrieve inventory info
among many other issues
And are you trying to fix this with or without writing config?
I am trying to make their mod work with a mission that uses the respawn system via scripting
patching the mod would be obnoxious and it seems they don't want people doing that anyway. The pbos are obfuscated
You don't need to look at the pbos, you can modify a class without ever touching the pbo it's from
I know but a full config dump is much harder to work with
Just use the config viewer, see what the unit inherits from, and change it's items
and a patch wouldn't handle updates or changes
You can also just remove their init script
Do they change linkedItems in every class
If you want to read their code, you can put the function name into the debug console and paste the output somewhere, like this:
copyToClipboard str UK3CB_FACTIONS_COMMON_fnc_init_EH
No indentation but otherwise quite readable.
Then just modify the base class(es), and add magazines yourself
*if you want to go that route
weapons[] = {"UK3CB_QBZ95_hamr","hgun_Rook40_F","Throw","Put","Binocular"};
linkedItems[] = {"ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","UK3CB_CSAT_G_O_H_6b27m","UK3CB_CSAT_G_O_V_Carrier_Rig_Light"};
magazines[] = {"UK3CB_DBP88_30rnd_580x42_G","16Rnd_9x21_Mag"};
respawnLinkedItems[] = {"ItemMap","ItemCompass","ItemWatch","ItemRadio","ItemGPS","UK3CB_CSAT_G_O_H_6b27m","UK3CB_CSAT_G_O_V_Carrier_Rig_Light"};
respawnMagazines[] = {"UK3CB_DBP88_30rnd_580x42_G","16Rnd_9x21_Mag"};
respawnWeapons[] = {"UK3CB_QBZ95_hamr","hgun_Rook40_F","Throw","Put","Binocular"};
UK3CB_allowedbackpack[] = {"UK3CB_CSAT_G_O_B_ASS","UK3CB_CSAT_O_B_TACPACK_OLI"};
UK3CB_allowedfacewear[] = {"UK3CB_G_Neck_Shemag","UK3CB_G_Tactical_Black_Shemagh_White_Headset","UK3CB_G_Neck_Shemag_KLR_GRN"};
UK3CB_allowedheadgear[] = {"UK3CB_CSAT_G_O_H_6b27m","UK3CB_CSAT_G_O_H_6b27m_ESS"};
UK3CB_loadout_magazines[] = {["SmokeShellOrange",1],["SmokeShell",1],["rhs_mag_rgd5",2],["16Rnd_9x21_Mag",1],["UK3CB_DBP88_30rnd_580x42_G",4]};
UK3CB_loadout_magazines_backpack[] = {["UK3CB_DBP88_30rnd_580x42_G",4],["16Rnd_9x21_Mag",1]};
this is how they format it
Apparently it looks for a bunch of flags on a logic object:
entities "UK3CB_Factions_Loadout"
I know how it works
that's not the problem
the problem is manually reparsing all of this into standard inventory configuration
I am not interested in wasting that much time. I want to make it work mission side anyway, no extra mods necessary
parsing the config into arrays that match the standard is trivial but I can't get it to work with the BIS respawn functions since they don't look for the custom parameters and parsing apparently happens in the engine somewhere
So you've already reparsed this stuff and added it to CfgRespawnInventories?
fixing the mags is as trivial as
_fnc_flattenArray = {
params ["_nestedArray"];
private _fixedArray = [];
// Loop through each sub-array and extract the first element
{
_fixedArray pushBack (_x select 0);
} forEach _nestedArray;
_fixedArray
};
CfgRespawnInventories has to be done manually
you can't do it dynamically
that's for custom loadouts.
you use the add inventory function with a classname to do it from a unit class
So what are you trying to do again? :P
Respawn an AI class and have it with a sensible loadout?
add a set of unit classes to the respawn loadouts on mission start (based on the selected faction in the lobby)
Probably impossible unless you replace the respawn system?
It looks like it only uses config.
factions are just an array of classnames. this is intentional design. It needs to be no more complex than that. I already solved adding stuff to the arsenal.
yes that's the problem
Well, unless you pre-prep every loadout in config and then select them appropriately.
that doesn't fit the system
you add factions by adding a list of classnames, and that's it
that's the point
I have a script that I usually drop into the init of vehicles as zues, but now I'm trying to make it a standalone mod. tl;dr is its a script that adds variable time fuzes to artillery/mortars. Having a hard time figuring out where to do it.
All artillery and mortars, or specific classes?
For now specific classes. I'm using the m109a6 from RHSUSAF for testing
In the past I've made a compat mod for ITC to add additional ITC land system rounds to their m109a6, but that was almost completely copy/pasting from their other vehicles
Your two options are probably an init event handler added to the vehicle classes (massive pain in the arse) or a pre/post-EntityCreated mission event handler.
Yeah, been trying to do it via vehicle classes, and have been failing miserably
latter is also pretty nasty because it fires on every entity, right down to butterflies.
vehicle classes one is more of a config inheritance problem.
Because you need to retain the event handlers that are already defined on the vehicle.
plus loading your config only after the vehicle config you're changing has been loaded.
It's frustrating, because I finally got the script to be play nice in multiplayer as a drop in script, I just need it to init in a mod, dammit XD
I don't think I'm stomping on any existing event handlers, at least not on the m109a6
First thing to do is get a simple mod with a CfgFunctions working, so that you can at least call your function in debug console or wherever.
Only do the event handlers once you have the function working.
Very non-trivial due to how file paths work in a mod.
Read this until it works, might take a while: https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon
You can just use a CBA extended event handler and not have to worry about vehicle config at all
I'd bitch at this but honestly vehicle event handlers are so horrible that it's not a bad idea if you just want to get a mod working.
It's pretty similar to the EntityCreated option though.
Is vehicle event handlers more performance friendly? Rest of my communities I play with bitch and moan about performance from stuff like fires, so I have to justify anything I add
When it works, yes.
(But they won't complain when they use high poly count uniforms and kit, of course)
Adding the event handler itself is not going to cost much, it'd be the code that runs that would cause a difference.
You could go two ways with the EH route, add it to all vehicles and filter them in the function, or add it to specific classes
Well, ideally CBA works with vehicle event handlers underneath, although it depends how busted your other mods are.
you'll get those "CBA XEH not defined for class XXXX" warnings in the RPT in that case.
And then it falls back to the slow mode which sucks.
All xeh is just addEventHandler
Nah, a lot of them use vehicle event handlers by preference.
The things I do because they don't want to use ITC
Yeah I was thinking of something else
I appreciate the pointers, guys
would it be possible to create CfgRespawnInventories classes post init somehow?
I think you're going to be on your own on this one with how you currently want to implement your idea. Most of us do not do dynamic loadouts in this manner. Or we create our own respawn menus. Either continue to figure it out in the manner that you're doing, or consider maybe looking at a different implementation of the idea entirely.
And no you can't do config stuff in post in it. The pre and post inits are for your script files and functions
We can probably throw examples of other ways to implement dynamic loadouts, but you might be the first in the manner that you want to do
I'm trying to implement 3cb factions into an existing and totally functional mission that works with every other dlc and mod
the point is to get it working with existing stuff to compensate for the poor mod design
I'd have thought your best bet was to let the BI respawn stuff do what it likes, and then replace the loadout yourself afterwards with a delay from the respawn event.
ok im brand new to SQF and arma scripting, though not to scripting/development in general
and im going maybe a bit insane trying to find what i think should be a simple thing, just all the tutorials ive found seem to skip over or assume pre-existing knowledge lol
im trying to apply the Global Mob boltcutter action to an object that doesnt have it by default
following the docs here: https://community.bistudio.com/wiki/Global_Mobilization_Boltcutter
got the action added fine, but then to set the specific boltcutter action i need to set a "config parameter" gm_boltcutAction and i cannot for the life of me figure out how to do that properly
any help, even if its just pointing me at a more complete tutorial would be great
that was my initial solution
how do you propose I do that?
You can just use an init event handler to change their loadout
https://github.com/CBATeam/CBA_A3/blob/master/addons/xeh/fnc_addClassEventHandler.sqf
Just add a small delay to make sure it runs after the vanilla respawn stuff
I know that part I mean how do I assign the correct loadout?
there's no way to know the classname that corresponds to the loadout chosen by the player
That's up to you
I don't mean the logic portion, but what should they be wearing
You could save their loadout after init
what?
what they should be wearing is what the class wears by default, which happens after init, which happens after new respawn classes can be added. Getting the loadout after init would only work IF it was possible to retrieve the classname for the loadout chosen by the player
which doesn't appear to be possible at all
the array returned by BIS_fnc_getRespawnInventories lists the classnames used, which would imply that that is the name of the loadout, but the name of the loadout used by the player isn't stored on the player anywhere
and custom display/role names in the menu aren't possible either
Okay, what it does mean by "Dedicated compatible" anyways?
@runic surge The function that actually does the inventory fill is BIS_fnc_respawnMenuInventory, but there are no events to hook there, and the selected loadout isn't stored. You'd need to either replace that function with your own (modified) version or hook the UI controls.
SOG AI was written with a lot of locality assumptions, IIRC.
How does one hook the ui controls?
ugh :p
UI stuff is the one thing I don't understand about arma stuff
it's a complete mystery to me
Hooking is like what I did in that concept idea that I posted for you.
Making an event handler for the control
I'm putting this convo in a thread for you.
oh
I need a way to retrieve the classname
so that already didn't work out

Now you don't have to intercept the treatment action "inGameUISetEventHandler ["Action",""];" to execute your own code for full right treatment.
Does it trigger on actual heal and not action now?
wait 2.18 for check or mb in dev this work
@granite sky Thanks again for the assist. Got the eventhandlers working without too much issue, even figured out the weirdness the original ace csw m224 mod did to slap it on there too
Hey. How do I check if generated sqfc files using Arma script compiler work properly? And what patch they should have (if you open sqfc file, at the bottom there is a generated path to the normal sqf file)
I have a quick question about triggers. If I tick server only and have the trigger play music from the section at the bottom, when any player enters it would not play music for players cause it’s server only and I would have to remoteExec the music for players to hear it? And if I didn’t select the server only option when any player ran into the trigger it would play music locally for all players right except JIP?
Been scripting for so long yet locality still confuses the hell out of me
This doesn't seem to be a question about event handlers :P
Triggers aren't sufficiently documented to answer your question, but I'd go with "probably yes".
In general, sound-playing commands are local effect.
brain didn't brain
yes triggers
if using server only with a locally executed command, you must remoteexec it. If not selected, you don't as the trigger exists locally on each client (including JIP).
Clarification: triggers actually use commands like playMusic to do the effects you can select in their attributes
Does anyone know of a way of getting a models geometry mass value through sqf? like getMass but for just regular geo
In 2.18, getModelInfo will have it
When did BI say they were hoping to release that..?
Pretty soon
Hm ok, thanks
Ugh thats actually not very useful for me, I need to be able to tell from just the modelpath or config. Spawning the object isnt possible in my case
"Aiming at late summer" + this implies the next prof build will be the last 2.16 build #community_wiki message
Just spawn it at 0, 0, 0, get the info you need, and then delete it
Unless you actually cannot spawn it (for whatever reason?)
Does that mean the prof branch will be months behind in recieving 2.18 in compared to regular branch?
I could, but it could be thousands of objects per client which is incredibly un-ideal
Cache in a hashmap by object type.
Could also spread it out over multiple frames
I'm assuming you have a lot of similar objects and you don't literally need the mass of 1000 different types.
Im running through every cfgWeapons and cfgMagazines class
No, profiling is a bit ahead. They're about to hit the cutoff for changes; 2.18 is going to be locked down for full QA testing before release. That means profiling will stop for a bit, then resume once 2.18 arrives, based on the 2.18 data rather than on 2.16 as it is now
Uh, you don't want the model mass for those normally.
just the item mass, which you can read from config.
I'm pretty sure there are CfgWeapons and CfgMagazine classes that don't even have models
Vehicle weapons mostly, but also throw, put, etc and magazines from before proxies
Im using it to check if collisions with the player are possible, a geo mass of 10 or more is required for player collision
Ill run a test now to see what the count is and if its feasible
Maybe don't write this code until 2.18 :P
The code would be the same though no? I'm already using the portion of getModelInfo which is for 2.18 only
Looks like vanilla + ace would be 271 objects spawned, not as bad as I thought
So what are you doing with this information?
Filtering items that the player can use for a dynamic loadout system
Why's geo mass more important than inventory mass for that?
^
The spawn item and use getModelInfo works as you said it would, I appreciate the ideas everyone!
Why does collision matter for a loadout system?
The items are very close to the player and collisions occur
So I got code that effectively locks an inventory out from all players, just in case there's an object I want for a prop, but I don't want players shoving stuff into it or taking stuff out.
h = [] spawn {
waitUntil{ !isNull findDisplay 602 };
closeDialog 1;};
}];
[this, false, [0, 1, 1], 0] call ace_dragging_fnc_setCarryable;```
But now what I _want_ to do is make it so, in multiplayer, when someone tries to open a box, it checks the user's steam ID to see if they own the box.
My intention is to make lockers that only certain players can access. What I'm struggling with is how to check the player.
Psuedo code:
```if (variable_for_the_person_trying_to_open_the_box steamID != whatever)
waitUntil{ !isNull findDisplay 602 };
closeDialog 1;};
else
just open the box normally```
Any thoughts that might help?
wait apparently this exists and I may have been overcomplicating this for years https://community.bistudio.com/wiki/lockInventory
I'm gonna facedesk 
lockInventory is a relatively new command
Okay, so that simplifies the issue substantially. Let me fiddle with it a bit and see if I can figure it out myself before coming back for more help.
If you want to do it with Init field in editor, do something like:
this spawn {waitUntil {getPlayerUID player != ""}; _this lockInventory !(getPlayerUID player in ["123", "321"]);};
This spawns a thread that waits until player is initialized so we can pull their UID, then locks the inventory if player is not of certain UID
Speaking of which, wish there was a command to get steam id without having to wait for player object, such a bad thing to pull system information bit from a gameplay entity which it should be available at all times.
GIB ARRAY = getSteamInfo
Hmmm. There is a problem with lockInventory.
I can bypass it because it's bugged.
The inventory isn't actually locked out, the "inventory" command is merely removed. I can exploit placing objects on the ground next to it.

You'll need to handle it through https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryOpened then
check if you're allowed access to both containers
I have 2 scripts in my mission, but I've found out that one of them are messing with my "player location" and according to the map I'm lower left corner all the time... is this something script related and how do I fix it?
You could start by sharing your current script.
Without content it's hard to say why it doesn't work.
[0,0,0] is the left corner, so your position return is wrong, but where , don't know
yea, sorry, I'm really new to this part of Arma, so bear with me on this
I have to scripts:
- make a vehicle as a spawnpoint, which I can move around the map
- able to call for reinforcements
the problem is when I look in my mission file, I can only see 1 and that is the latter, where the hell did my 1. script go? haha
@granite sky thanks for catching my scope issue for the fired event, working properly now!
because that would not work in SQF @nocturne bluff ?
i am using a script to add a teleport action to an object
the script is
this addAction ["Teleport",{player setPosATL (getPosATL pad2)}];
does anyone know how i would add a minimum distance you would have to be to the object for the action to show up?
bc at the moment you can be as far as you want and still use it
10x while {_thing distance player < 5} do {...}
radius
You'll need to add other default parameters before getting to radius though
sick
does anyone know if https://community.bistudio.com/wiki/forceSpeed works on projectiles? ive been testing and cant quite get it to work (using a fired eh and projectile para)
guessing your referring to limit speed?
Both
Hey everyone!
forceSpeed is sir, try to keep it to that speed
limitSpeed is sir, don't overspeed
makes sense im still going to complain because it isnt convenient for me though
Nobody is going to stop you to be hrash against two decades old anything
tru
id assume best way to try limit speed of a projectile / missile would be set velocity transformation then, yes?
Guess so
wanna rage further?
you used an invalid example
which made even less sense thx to the 10 in front of it
thus i cleared your stupidity
What
10 while(_thing distance player < 5)
vs
10x while {_thing distance player < 5} do {...}
so ... tell me
what is more clear what you mean?!
Monetory recompensation truely
does BIS_fnc_showNotification by default run for all players?
As we all know loops are bad... best ways to script a task to complete is by using EHs?
It is a client function, if you would want to broadcast it for all players you would need to use remoteExec. You could do it via something like this 🙂
["TaskSucceeded", ["", "Disable the nuke"]] remoteExec ["BIS_fnc_showNotification", -2];
Also triggers confirmed the cancer that's killing our FPS?
simple thing @tough abyss
if you want a performant mission: use no scripts
You are welcome! In any case where you are planning on developing anything within a multiplayer environment or scenario with multiple players I would familiarize yourself with remoteExec as it will pretty much always be your go to. In the instance I sent, the -2 is within the targets parameter. When you specify -2 as a target, you are intending to execute globally (all players). I tried to link the wiki for it but I got timed out by a bot I think but I reccomend checking it out. Best of luck 😄
Thanks Milo! Really appreciate it. I'm still familiarising myself with all of these arma 3 scripting nuances like remoteExec and client-only functions / contexts!
((scripts include triggers, modules, ...))
however, that would be a very boring experience
which would not even be packable using the editor
It's possible if you get some guy to script and "admin" the whole thing
Yes a killed EH would be nicer than a trigger monitoring 10 alive x
pff ... the trick for real performance is choosing the right disadvantage for the right purpose
also invalid pseudo code
thus does not matters 😃
Ideal way to run things : AI on HC. All scripts on server. And player enjoys the smooth experience.
nope
No scripts no ai, no players no problems.
the ideal world for every IT guy ❤
however ... the trick is as said the correct tradeoff
it does not makes sense to run everything on server in regards of scripts
also you should not just throw all AI on the HC
however ... thats at least better then 80% of the stuff which gets produced 😃
Hello. I'm bit confused. Is this normal?
In the watch, the unit is not local to me, yes, but in the execute box it should return the object/unit by the server (server exec), right?
This is just a guess but I think that server doesn't have the concept of cursorObject
yes, it make sense lol
This is the object under your cursor
Dedicated servers/headless clients have no cursor so it always returns objNull
And even if it did have cursor it would return whatever's under their cursor not yours
How could you reliably determine whether a primary weapon is a gl variant or not?
I think you might be able to with weaponState and then getting it's muzzle. Don't quote me but you could probably do something like:
((weaponState player) select 1) in ["weapon_classname_1", "weapon_classname_2"]
Or alternatively
((weaponState player) select 1) find ["classname_prefix_1", "classname_prefix_2"]
Feels like there is probably a more efficient way of checking this and take this with a grain of salt as it is scratch but in the event that is helpful 🙂
This can tell if it's an alternative muzzle but it's not necessarily a GL (e.g. it could be an underbarrel shotgun)
To actually tell if it's a GL you have to check the weapon config (if it's an alternative muzzle it's in a separate class under the weapon class), get the magazine name, get the ammo name from the magazine config, and finally check the ammo config
I don't remember if GL ammo had a specific simulation or not but that's something to look out for in the ammo config
if it's the same as hand grenade, "shotGrenade", your work is done
If it uses something like "shotBullet", you have to check its indirectFire to see if it's an explosive shot
This would only work if the weapon is already on a unit
I need to find out just from the class name
I really like how you can't run loadout scripts on the server, as in non local units won't recieve weapons >.<
I guess I just need to tell if it is an alternative muzzle and what mags it uses
but gl/shotgun muzzles aren't all named the same way. If every weapon that uses additional alternate muzzles has muzzles[] = {"this","EGLM"}; I could retrieve that. I will try that first
That's the only way. Check if muzzle has shotShell simulation that does explosive damage
Also maybe cache the result so its faster
What info do you need exactly? Just tell if it has GL?
Which muzzle is GL specifically? Mags that are fit for that muzzle?
tell if a weapon has a second muzzle and what ammo it uses
pretty sure I got it figured out
Just checking for second muzzle is easy, check if there are more than 1 muzzle that is available to player
If you want a muzzle that has explosive ammo, then its a bit more complicated, you need to check each mag and magazine wells
what about detecting grenade types? smoke, he, etc for either thrown or launched grenades?
so theres no way to filter out smoke grenades from lethal grenades?
I'm pretty sure smokes have their own sim type
all I need to do is ensure that lethal grenades are selected instead of smoke by the player
I have no life so I wrote the code for you:
doesWeaponHaveGL = {
params ["_class"];
private _cfg = configFile >> "CfgWeapons" >> _class;
getArray(_cfg >> "muzzles") findIf {
private _muzzle_cfg = if(_x == "this") then {_cfg} else {_cfg >> _x};
private _mags = getArray(_muzzle_cfg >> "magazines");
{
{
_mags append getArray _x;
} forEach configProperties [configFile >> "CfgMagazineWells" >> _x, "isArray _x", true];
} forEach getArray(_muzzle_cfg >> "magazineWell");
_mags findIf {
private _ammo_cfg = configFile >> "CfgAmmo" >> getText(configFile >> "CfgMagazines" >> _x >> "ammo");
getText(_ammo_cfg >> "simulation") == "shotShell"
&& getNumber(_ammo_cfg >> "indirectHitRange") > 0
} >= 0;
} >= 0;
};
["arifle_MX_GL_F" call doesWeaponHaveGL, "arifle_MX_F" call doesWeaponHaveGL];
``` => `[true,false]`
expand from here
I appreciate your help but I'm already beyond detecting additional muzzles lol
Probably also needs indirectHit > 0 check too
Just check currentMagazine then
And see if it has explosive ammo
I need to do this while adding all the grenades to the player inventory not after
So you want to know which magazines are explosive shells?
It's the last bit there. Just change the findif to select.
Right now I just want items added to the player equipped properly. Only thing I'm lacking is making sure the player has the correct grenade selected when items are added
What's the correct grenade?
the one that explodes. whatever the lethal one is
it's always the default unless only smokes are in the inventory
You only want to change which magazine is loaded into the grenade launcher? Nothing else?
Hand grenades, not launcher
oh.
though I suppose it is possible that the launcher might be loaded with a smoke as well
So your problem is that a player is equipped with multiple grenade types, and you want to make sure their current thrown grenade is set to an explosive one?
yes, but while the items are being added to the inventory, not after
I think you can just add the explosives ones first.
I was wondering if addWeaponItem works with Throw
Just tried it, nope
player addWeaponItem ["Throw", "HandGrenade", true]
player addWeaponItem ["HandGrenadeMuzzle", "HandGrenade", true]
yeah you'd probably need to remove and re-add grenades then.
right. how do I separate them from the non explosive
Same way as the grenade launcher rounds.
I didn't differentiate those
Sa-Matra posted some code a little while ago for doing it
You have CfgMagazines classnames. Look up the ammo value in CfgAmmo, check indirectHitRange.
* or rather, part of Sa-Matra's code does it
Is there really no simpler way?
Nope.
Explosive grenades use simulation type ShotShell, smoke grenades use type shotSmokeX. Should be a reasonable way to distinguish them. (I wouldn't necessarily rely on indirecthit as modded smokes could have "realistic" splash damage)
You're starting to reach the boundary of the "time spent" vs "player appreciation" wall...
Good day. I'm facing the issue when not so large numbers are converting to scientific notation and that may cause issues. Example: 1234567 turns into 1.23457e+06
How do I check that it has happened and how do I turn it back into int? It breaks output to UI
HAHA you beat me to it. Even if a command doesn't support it, a lot is possible with configs, question is how far you wanna go 
Thank you 🙏
cant send long codes here?
pastebin as necessary
I'm gonna share a script i made, should i post here os mission makers?
do you need help with it? is there a problem?
This is a good place to share.
not really, just posting in case someone wants to use it, posted on mission makers
it certainly has room for improvement
does this section have a bank available of working scripts to use? Both SP/MP
What do you mean? Like scripting examples?
Well kind of. An area in this section that has scripts others have made and like to share.
Honestly not sure if there is a random scripts section here or anything apart just from what was sent in chat prior. I am under NDA for the server I develop for so not much examples wise I am actually able to share myself apart from stuff before I started. Anyway here is a really simple menu that I made in the event that helps you. It would go in the MP missions folder and be opened in the Eden Editor if you were looking for a way to get acclimated/getting your environment setup. Years old though so don't mock me for it looking like crap haha.
Is it possible to script ai aircraft (or any ai unit) engage a player thrown smoke grenade?
It would also be cool to know if you can set it to only engage a certain colour of smoke
When you say engage it do you mean like shoot at the smoke grenade?
Yeah, players pop smoke, friendly CAS comes in and shoots at the area the smoke is at
lol NDA for a > 10 year old game
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_projectile"];
private _smokeGrenades = ["SmokeShell", "SmokeShellRed", "SmokeShellGreen", "SmokeShellYellow", "SmokeShellPurple", "SmokeShellBlue", "SmokeShellOrange"];
if (_ammo in _smokeGrenades) then {
waitUntil {
uiSleep 1;
(!(isNull _projectile) && ((speed _projectile) < 1))
};
uiSleep 6; // Or however long until smoke is actually visible :)
private _grenadePos = getPosATL _projectile;
private _fireObjNamespace = format ["gl_fireObject_%1%2", (str (_grenadePos#0)), (str (_grenadePos#1))];
missionNamespace setVariable [_fireObjNamespace, createVehicle ["ah1w", _grenadePos]];
private _lcl_fireObj = missionNamespace getVariable _fireObjNamespace;
_lcl_fireObj hideObject true;
_lcl_fireObj allowDamage false;
private _nearbyAirSupport = nearestObjects [_lcl_fireObj, ["O_Plane_CAS_02_F"], 500];
if (_nearbyAirSupport isNotEqualTo []) then {
private _nearTargets = nearestObjects [_lcl_fireObj, ["Car", "Tank", "Man"], 200];
{
_x params ["_aircraft"];
private _pilot = currentPilot _x;
if !(isNull _pilot) then {
private _randomTarget = selectRandom _nearTargets;
// BRRRRRRRRRRRRRRRRRZZZZZZ :D
_pilot doTarget _randomTarget;
_pilot doFire _randomTarget;
};
} forEach _nearbyAirSupport;
deleteVehicle _lcl_fireObj;
missionNamespace setVariable [_fireObjNamespace, nil];
};
};
}];
No idea whether that will actually work or not since it is scratch. Will likely have parts I trolled on that needs fixed. Also wouldn't be surprised if I messed up the way to fire at the AI or something or used general poor etiquette since I don't often use AI related commands. That should help you though 🙂
Thanks man, will try it out as soon as possible
Yee when said like that but honestly it makes sense. The server had it's mission file leaked a few years back and it was nearly a decade worth of combined developer work just made public when it wasn't supposed to be. What better way to make sure that doesn't happen again than an NDA haha
Still, just removeWeaponGlobal first
do they not know that anyone that joins can take apart even an obfuscated pbo? its not like they have access to the BI encryption.
They do know that. Server files are not included on the client and cannot be deobfuscated though. Without those the mission wouldn't be able to be re-used without having to reinvent the wheel anyways. Oftentimes a missions most critical and sensitive tasks are performed on server. It makes sense they would want to keep those out of the hands of people who are looking to cheat or do other nefarious things that would impact player quality of life.
I'm scripting a tank being loaded VIV into a plane without mods. It visually fits, and that's enough for me. But players can still turn the turret to stick out of the plane. Note I do not want to disable seats or simulation of the entire vehicle, so that players can still exit.
What is an elegant way to immobilize a (tank) turret?
setTurretLimits maybe.
Set the turret hitpoint to destroyed and then reverse it when unloaded?
this is a good way, just set it to all 0s and the turret cant move and is stuck facing forward
forgive me if im wrong but, arent you still allowed to share things you've created? (assuming you're a sane person and make things in singeplayer environment first, before adding to mission file)
why i cant apply post process effects in thermal view? how to do it?
how do I make mine creation local?
Yes and no. I probably could in the time before it is actually being added if when I wasn't technically producing it for the server but honestly have never had a reason where I've needed to share code with anyone outside of my peeps. Just cool to watch people have fun with the stuff I make 🙂
Heh heh. Honestly had no idea you couldn't but hopefully you'll get as much of a kick as I did haha:
_ppEffect ppEffectForceInNVG true;
didnt work
Are you using your stored effect handle in placement of the placeholder I had: _ppEffect?
of course
Are you performing it before your desired effects?
after
Hmmm are you able to send an excerpt of what you have got? Honestly never even knew that night vision override post processing effects and first time seeing that command so I could just be trolling.
Honestly appears to work fine properly for me when specified afterwards so not sure why it would be giving you issues. Here is my debug code though in the event it helps you troubleshoot:
[] spawn {
_handle = ppEffectCreate ["colorCorrections", 1501];
_handle ppEffectEnable true;
_handle ppEffectAdjust [1.0, 1.0, 0.0, [1.0, 0.1, 1.0, 0.75], [0.0, 1.0, 1.0, 1.0], [0.199, 0.587, 0.114, 0.0]];
_handle ppEffectCommit 0;
_handle ppEffectForceInNVG true;
uiSleep 10;
ppEffectDestroy _handle;
};
I tried to use it in Thermal image of t72 rhs
it didnt work
Ahhhhh okay I was thinking of thermal NVGs that's my bad.
It's probably because it is considered a cameraView. Let me see if there is something for that.
Okay so not inherently a cameraView thing as night vision modes do show effect but oddly the thermals do not like you mentioned.
Not sure why you are wanting to spawn mines locally
but you could do it with createVehicleLocal 🙂
anybody know if there is a "move to formation" equivalent function or script that works post init out there anywhere?
the example for formationPosition isn't working for me
it may sound strange: but for players this is a problem, and for AI this is a very big problem - watching mines, all the waypoints break, and AI is severely blunt
nvm it works it just moves them to 0 0 as well lol should be simple to fix
Are you using the A3TI mod?
Nope standard rhs
join
_unit disableAI "MINEDETECTION" maybe
Although I'm not sure whether that disables the detection or the pathfinding around known mines. You didn't mention whether they're known mines.
thanks, I'll check how it works - but I don't want the AI to just die on mines, mines are just for the players - as part of the gameplay
Is that what I'm talking about?)
the main thing is that AI did not explode on mines
AI did not see them and did not blunt them
There are mods (well one..) that add encryption though. That'd be an option :3
Hi guys, does someone know if .ogv files are still supported in arma?
They are yes
Oh, just askin, because when I tried to use a video as a mission intro it got "squished"
I just wrote "video = ["intro.ogv"] spawn BIS_fnc_playVideo;" in a trigger, maybe I've done something wrong idk
It just looks like this
I tried to change a video resolution but it just made things worse
Which one would that be? One of yours? :3
Of course :3
Must be some encoding issue.
Afaik there is a guide on the wiki on how to convert it properly
Thanks, I'll try that one since i converted it from mp4 using a random browser converter lol
I usually do it with VLC but I don't remember what settings
Usually as.. once in 5 years
Do you maybe know where I could get them?
As far as I searched, it leads only to a OGV file format page and how to convert it using some old console app that I actually already tried and it didn't work for me
just installed it and found it
Hoping at least this will work, thank you very much
It really worked, thanks a lot!
tried this tonight https://community.bistudio.com/wiki/disableRemoteSensors didn't see any difference
not saying it doesn't work but
if it does something that's subtle
Hello, is there a way how to wait until the game closes the loading screen at the beginning of a MP game? I have an intro in init.sqf, but it usually starts before the loading screen goes off. Thank you
You could try waiting until display 46 is initialized
That's the main game display
Tried all this, but it seems to be not working:
waitUntil {getClientStateNumber >= 10};
waitUntil {local player && !isNull findDisplay 46};
waitUntil {player == player};
waitUntil {missionNamespace getVariable[ "BIS_fnc_startLoadingScreen_ids", [] ] isEqualTo []};
I can hear the birds singing in the background, so the world is already loaded, but the loading screen is still showing, after pressing the continue button on the briefing screen.
There a way to make a bar gate open with a trigger? Like when my players vehicle gets to a point it opens, rather than plowing through it/Wasting time getting out of a vehicle to manually open it 🤔
And close when you get to the other side*
Look here for some inspiration:
https://forums.bohemia.net/forums/topic/159802-how-to-open-a-door-with-a-script/
https://community.bistudio.com/wiki/animate
The string with a door name may be different for your building (fence)
its easy to set up. Id suggest google it and youtube. Plently of people have done this. I have it my mission.
Anyone use event handlers to activate a trigger? If so, how did you set it up
Was there an update that missed up the HandleDisconnect mission event handler or am I using it wrong? For some reason when my server mod adds the mission event handler it's not able to get the player variables to store in the database:
addMissionEventHandler ["HandleDisconnect", {
// params ["_unit", "_id", "_uid", "_name"];
private _unit = _this select 0;
private _uid = _this select 2;
private _data = [
_uid,
"armory_unlocks", [_unit getVariable ["Armory_Unlocks", []]],
"garage_unlocks", [_unit getVariable ["Garage_Unlocks", []]],
"locker", [_unit getVariable ["Locker", []]],
"garage", [_unit getVariable ["Garage", []]],
"cash", [_unit getVariable ["Cash", 0]],
"bank", [_unit getVariable ["Cash_Bank", 0]],
"number", [_unit getVariable ["SOF_Phone_Number", "unknown"]],
"email", [_unit getVariable ["SOF_Email", "unknown@spearnet.mil"]],
"paygrade", [_unit getVariable ["Paygrade", "E1"]],
"reputation", [rating _unit],
"loadout", [getUnitLoadout _unit],
"holster", [_unit getVariable ["SOF_HolsterWeapon", true]],
"position", [getPosASLVisual _unit],
"direction", [getDirVisual _unit]
];
if (vehicle _unit == _unit) then {
_data pushBack "currentWeapon";
_data pushBack [currentMuzzle _unit];
_data pushBack "stance";
_data pushBack [stance _unit];
};
// ["hsetidbulk", "", "", -1, _data, "", "null", false] call dragonfly_db_fnc_addTask;
["hsetidbulk", "", "", -1, _data, "", "null", false] remoteExecCall ["dragonfly_db_fnc_addTask", 2, false];
deleteVehicle _unit;
}];
Do the non-getVariable ones work?
Yes if I recall they do work
Within the mission I have an initServer.sqf which calls sof_server_init_fnc_serverSetup and within that function it calls sof_server_save_fnc_handleDisconnect which is the above code block.
Is there a way to get the object for the arsenal im in? For example ace has a variable ace_arsenal_currentBox that stores the obj reference for the arsenal you're in
@broken forge If the unit exists but the variables don't, you need to look into what your setVariable calls are doing with locality and timing.
Here is part of function on the client side that loads the data from the database and set the player values:
...
switch (_key) do {
case "reputation": {
SETVAR(player,Reputation,_value);
player addRating _value;
};
case "loadout": {
SETVAR(player,Loadout,_value);
player setUnitLoadout _value;
};
case "direction": {
SETVAR(player,Direction,_value);
player setDir _value;
};
case "cash": {
SETVAR(player,Cash,_value);
};
case "bank": {
SETVAR(player,Cash_Bank,_value);
};
case "armory_unlocks": {
EGVAR(armory,arsenalUnlocks) = _value;
SETVAR(player,Armory_Unlocks,_value);
};
case "garage_unlocks": {
EGVAR(armory,garageUnlocks) = _value;
SETVAR(player,Garage_Unlocks,_value);
};
case "locker": {
SETVAR(player,Locker,_value);
};
case "garage": {
SETVAR(player,Garage,_value);
};
case "email": {
SETVAR(player,SOF_Email,_value);
};
case "number": {
SETVAR(player,SOF_Phone_Number,_value);
};
case "paygrade": {
SETVAR(player,Paygrade,_value);
};
case "stance": {
SETVAR(player,Stance,_value);
player playAction _value;
};
...
};
...
macros lol
lol, the macro translates to player setVariable ["NameOfVariable", value];
That's local
Yep, so do I need to set it global?
Uh, if you want to read it on the server, yes
I don't know why you'd be doing database reads from the client.
So using this client side is incorrect? ```sqf
["hgetallid", getPlayerUID player, "", -1, [], "sof_client_init_fnc_handlePlayerLoad", netId player, true] remoteExec ["dragonfly_db_fnc_addTask", 2, false];
shrugs
Main thing is to ensure that you're not setting the same var from two different places at the same time.
It looks like the database task runs on the server and then sends data to the client, so that might be fair enough.
Yep that's what it does, but now you've got me second guessing on how to retrieve and set each player's variables, lol
check out my modules enhanced mod, I do a mpsync module that will make sure all players are loaded and ready before it does what you want
if you want to see the code behind on how I do it:
https://github.com/hypoxia125/Modules-Enhanced/tree/main/addons/mpsync
Chat was pretty busy so I'm reposting this question:
Is there a way to get the object for the arsenal im in? For example ace has a variable ace_arsenal_currentBox that stores the obj reference for the arsenal you're in
to be clear, vanilla arma then?
Yup
The object is passed into BIS_fnc_arsenal, so maybe. You'd have to read the function.
I've read it, It doesnt seem to be stored anywhere thats accessible outside the function
This is used though _box = [_this,0,objnull,[objnull]] call bis_fnc_param; with _this being supposedly the object? Not sure what this code dose exactly though
i believe that is the old function for param/params
But _this is obviously local to said script. _this is set to params [1,[]] at the start
I can get all of the arsenals with missionnamespace getvariable ["bis_fnc_arsenal_boxes",[]] however the best I can do after is filter by distance which is un-ideal
Is this static arsenals within a mission?
I'd like for it to work with ones added through zeus as well
Best I can suggest is replacing the BIS function with your own and chaining to it.
but you'd need a mod for that.
Mod is fine, this is in a mode already. How would I go about chaining it? If this process is a lot I might just chop part of this feature
Add a CfgFunctions entry that overwrites the one for BIS_fnc_arsenal and another one that creates another function for the original.
Thats smart, am I allowed to copy and use an entire BI function though?
You don't have to. You chain to the original.
Hm I'm missing something then
Because all you need to do in this case is store one parameter on the object.
You don't need to change any other functionality, so a wrapper is fine.
Is an example possible to give? I don't get how to overwrite the function while still utilizing its contents
Thanks, I have not found anything that would help me in your code. I play a very simple intro for each player individually (even JIP), so there is no need to wait for others.
Maybe if I could detect that the player is already in control, or some GUI elems visible or something like that.
The init is already executed on this screen (after briefing) and I have no idea how to know when its over, it can take seconds.
Though in SP, it works perfectly fine.
Try with this in InitPlayerLocal:
if (!hasInterface) exitWith {};
player setVariable ["LEG_PlayerLoaded", false, true];
addMissionEventHandler ["PreloadFinished",
{
player setVariable ["LEG_PlayerLoaded", true, true];
}];
waitUntil {player getVariable "LEG_PlayerLoaded"};
//Play intro after this.
Thanks, this is what I was looking for. I had checked this EH before, but I thought it worked differently.
Thanks to @fair drum and @tulip ridge too for help.
Does any one else code the crap out of AI air support?
I think this is where I've spent the most time, and abusing the hell out of mission event handlers to drop ordnance at max speed on laser markers or helicopter support, otherwise they rarely shoot rockets at enemy infantry.
Do I have to restart the game every time I add a script in my folder?
no, reload the mission\script
haha shit, you have saved me ALOT of restarting time haha
Just make another function:
class CfgFunctions
{
class BIS
{
class Category
{
class FncYouWantToOverwrite { file="your file"; };
class FncYouWantToOverwriteOriginal { file="bis file";};
};
};
};
Tho ideally don't put the backup fnc under BIS tag
I am trying to use a script that automatically equips red armbands to all OpFor units. The script works fine if the units are placed in the editor, however if they are placed in Zeus the armband is never applied. I used this exact script around 1 year ago and it all worked fine. Any ideas?
//EQUIP ARMBAND FOR X FACTION ON INIT
_armbandListGreen = ["gsb_armband_nv_g", "gsb_armband_nv_g_r"];
_armbandListRed = ["gsb_armband_nv_r", "gsb_armband_nv_r_r"];
_armbandListYellow = ["gsb_armband_nv_y", "gsb_armband_nv_y_r"];
{
if(side _x == opfor) then
{
_x linkItem selectRandom _armbandListRed;
};
} foreach (allUnits);
// EQUIP ARMBAND FOR X FACTION SPAWNED IN ZEUS
if (hasInterface) then {
private _zeus = (allMissionObjects "ModuleCurator_F") select 0;
_zeus addEventHandler ["CuratorObjectPlaced", {
params ["_curator", "_entity"];
_armbandListRed = ["gsb_armband_nv_r", "gsb_armband_nv_r_r"];
if (_entity isKindOf "Man" && {(side _entity) == opfor}) then {
_x linkItem selectRandom _armbandListRed;
};
}];
}; ```
if (_entity isKindOf "Man" && {(side _entity) == opfor}) then { _x linkItem... _x is not defined in EH scope
This solved it, don't know how I missed that. Thank you!
does anyone know how to get the angle to which a door is facing? I tried playing with the trigger, axis etc selectionPosition to get the angle but to no avail
which "angle'?
where its facing
You mean just the exit (door frame), or including the rotation of the door itself?
just exit
I am not proficient with working with the LODs and model sections. But I was dealing with this when spawning units infront of the door and orienting them accordingly. I did it by finding the position of the door and its corresponding path exit point, then creating a vector between, which shows the direction. I found the corresponding exit point by selecting the one that is closest to the door pos. This works for external doors, not sure about internal.
There might a different way probably. Some command that would work with the model selections.
IDK
ill try that
inb4 calculating direction between "OpenDoor" and "CloseDoor" action positions on bot navmesh
Or maybe just calculating the normal of the closed door?
inb4 internal door
at the model origin
what's the end goal, if you don't mind sharing?
trying to place a tripwire behind the door
If you don't need it to be fully procedural, you may utilize some handplaced pointers or arrows in Eden, or use model space coordinates to specify those points.
trying to do this automatically
is Paths LOD even accessible from SQF? 
tried buildingExit now but the positions returned arent front of the door :/
That is what I used for the external doors.
This may be what your are looking for https://community.bistudio.com/wiki/selectionVectorDirAndUp, as @south swan suggested.
trying that
You need to know the original selection vector dir and up (i.e. door closed)
If you do you can just measure the euler angles between the original matrix and the current matrix
well, for the use case the question seems to be mostly about the original selections dir
It's not really possible to tell the angle it's facing
You can only tell how much it's changed from its original coords
tried all LODs of selectionVectorDirAndUp now and I get some coords but still not same dir as door
Actually I have an idea but it might not work perfectly
You can get the FirstPoint selectionPosition, then AveragePoint selectionPosition
The vector between these almost always lands on the door plane itself (assuming it's very thin)
Then you get a vector perpendicular to this and you have your door angle
this is my test code incase anyone wants to take a look : ```sqf
_vv = bldg selectionVectorDirAndUp [format ["Door%1", _doorIndex], "Memory"];
_v = ((_vv # 0) vectorMultiply -1);
_trapPos = _bldgDoorPos vectorAdd _v;
relying on point order seems... brave
sorry?
i'm talking a obout Leo's idea
ah
This doesn't necessarily give the door vector
It just gives the bone transform. The door itself can be angled with respect to the bone
"along the door" may (or may not) be acceptably calculated as difference between door's AveragePoint and said door's axis AveragePoint 
There's a door axis selection?
I only remember door handles 
Actually yeah there should be an axis
"Door_%1","Door_%1_trigger","Door_%1_axis" I played with those (discord tampering with the strings)
Unless they use rotateX/Y/Z anims
i'm not sure it's guaranteed to be present in Memory LOD, though
well, rotateY (or whatever dir) also needs an axis, it's just 1 point there, no?
I think so yeah
Doors usually just have a cube shape and they're thin so it is a very good assumption
You can get italic type away with
(to show underscores)
"Door_%1","Door_%1_trigger","Door_%1_axis"
tried this now ```sqf
private _doorPos1 = bldg selectionPosition [format ["Door%1", _doorIndex], "Memory", "FirstPoint"];
private _doorPos2 = bldg selectionPosition [format ["Door%1", _doorIndex], "Memory", "AveragePoint"];
_doorAngle = (_doorPos1 getdir _doorPos2);
this getDir should approximate direction along the door, not perpendicular to it
<---- not good with maths
wish there was just normal vector for the door and I could get this working
you saying it wont work? 😐
why wouldn't it? Should be "close enuf" for most purposes
kwik maffs
Mafmen
If you want it perfect you can always hardcode the positions
for all, what, 4000 simulation="house" objects in vanilla?
_door = "door_1_trigger";
_axis = "door_1_axis";
_p1 = house selectionPosition [_axis, 1e15, "FirstPoint"];
_p2 = house selectionPosition [_door, 1e15, "AveragePoint"];
_vec = _p1 vectorFromTo _p2;
_n = vectorNormalized(_vec vectorCrossProduct [0,0,1]);
You can also use the avg and first point like you did instead of using axis
I also assumed that the door always rotates around Z axis (in model space)
This returns n in model space
You can use [0,0,0] getDir (house vectorModelToWorld _n to get the door angle
wow Leo, that code seems to be working nicely! Only thing I noticed is that it sometimes gets the position inside the house and sometimes outside. but still at front door. thx 👍
np. dunno but try:
_door = "door_1";
_p2 = house selectionPosition [_door, 1e13, "AveragePoint"];
Not sure if that trigger selection exists in all houses. It did in the few ones I tested
nah, it's just some doors have hinges on the left side and others on the right side 🤣
Oh that's what you mean. Yeah you can't guarantee which side it ends up on
switching to this doest seem to work, getting bad coords
i'd say sign of _n vectorDotProduct _p1 can show if _n points inside or outside the building
It uses geometry LOD so it's different
at least for outside doors and convex building shapes
p1 is in the same plane as n. Its sign should be zero
Actually no if you subtract it from p1 or p2
dot would be zero for perpendicular vectors, though
Well yeah hence sign is zero
they aren't guaranteed to be perpendicular, though
more bad MSPaint
_vec would be perpendicular to _n by cross product definition, but i propose to use trigger/axis model coordinates for center-ish direction
well thx again guys, I can live with the fact that the pos varies from door to door. I might make the whole thing random to have some variation in the mission
I know
I already explained
ah, i've misread that, sorry
tripwire mines are weird, I can walk over them and they dont always detonate...
mostly happens when placed inside buildings
odd
In case there isn't a lot of cross talk between channel here, I'll ask again here as suggested.
I'm adding a command to RscMenuEngage via config.cpp which calls an sqf file. I'd like to pass the location information along to the script, that is the player's cross hair location or map pointer location, similar to how the vanilla "supress" command works.
More detail here:
#arma3_gui message
lol Blue unit in red side group...
Side unit == blue
side group unit == red
Very strange bug...
Also, chatGPT says:
_targetPos: This is automatically set by the system when the player interacts with the map or game world.
But I'm dubious of that claim.
(I switch camera on leader)
The leader is watching him.
The leader thinks he is an enemy and he is in his own group.
You should, because ChatGPT just repeats things it finds, and the vast majority of code is garbage.
You can use https://community.bistudio.com/wiki/screenToWorld
That won't work with the map or collide with objects.
I used lineIntersectsWith to get accurate position data, but the vanilla commands have to have a solution for this.
I posted the actual code in GUI, link to that message above.
Like I said, im always dubious of anything chatGPT spits out, but bis does this somehow.
You need to differentiate between map opening and non-map.
Because the methods of getting the position are different
How do you know that we do it?
The way is screenToWorld, and then running a lineIntersectsSurfaces, to find the first surface on the line
Is it possible to disable physX for an object without disabling the ability to change animationsource?
On the server, sometimes there are cases when an object jumps when someone appears nearby or some object has activated physX within the radius of visibility. And it happens that the object even falls. For example, from the table. It is too stupid to create a cycle that will move the object back.
Are you just trying to disable collisions? If so, set the mass to 0
The laptop on which the action is taking place is on the table. And sometimes it jumps off the table itself when PhysX is turned on. And the laptop was previously placed in the editor a little higher than the table surface.
But when it falls on the table, it can very strongly move\turn\fall off the table
It can be seen that it bounces a little.
Is it possible that switchMove doesn't work in MP?
https://community.bistudio.com/wiki/switchMove
When I use it on a server it doesn't get replicated on a client.
Did you use playMoveNow its a big blue square on the wiki ?
I tried, and it didn't do any difference in my case.
what is your code ?
You want to see my code? It is quite long. It runs only on server.
Even if I try it via debug console (just the playMove and switchMove), it works only on the server.
This is the part I use for playing anims, just a snippet.
isNil
{
if (!alive _unit) exitWith {_halt=2;};
_unit switchMove _anim;
_unit playMoveNow _anim;
if (animationState _unit != _anim) exitWith
{
_halt=1;
};
};
But some animations work, partially.
I move the unit and attach it to a logic object before playing an anim.
try with puting anim globlay
[_unit , _anim] remoteExec ["switchMove"];
[_unit , _anim] remoteExec ["playMoveNow"];
Even Tho they have GE this would enshoure they are played globaly.
That works, but it is not ideal, since there are chained animations, that switch after a time.
If someone connects then they will see a standing unit on a chair before the update arrives, or will have to catch up on a very long JIP queue.
Since the anims cycle randomly indefinitely.
You can delete and overwrite JIP queue https://community.bistudio.com/wiki/Arma_3:_Remote_Execution#Advanced_Techniques_&_Functionality_Insight
That might help, great, will try. Thanks.
also Example 3 can help you https://community.bistudio.com/wiki/remoteExec#Example_3
It worked, though, it is still not perfect, since some animations make the unit turn around, which may get out of sync. E.g. server unit faces north, but client sees it facing south. There is probably nothing I can do about this.
I know that it's done somehow in the vanilla commands because "supress there" exists.
To be clear, by "vanilla commands", you mean the AI commanding menu/radio menu, not script commands, right?
Are the CBA eventhandlers executed locally or globally?
@stable dune it sometimes says you are typing but your not sending messages
I like type, but then I take a look from wiki or Google or search from channels , usually I answer before asking.
Many ppl asking same thing, sometimes in different content.
And I was answering to kbu, that depends what eventhandler a he means.
"XEH should always have the same locality as vanilla EH",
But if he means eventhandlers that can be added with CBA_fnc_addEventhandler , then it depends how it's called.
ok no problem there, just wanted to let you know. i thought there was cat walking on your keyboard ;D
It's called from XEH_PreInit added with addEventHandler
addEventHandler should be local, not sure about the XEH_inits though
https://github.com/CBATeam/CBA_A3/wiki/Extended Eventhandlers
Hopefully you find your answer here
That is in the engine. Not in script.
Not everything is directly exposed to script.
But engine does the same as what I described too.
Depends on the event.
The thing that triggers the event, decides whether it does it global or local
Can anyone please sanity check my script? It performs an ambient sound and fires on a repeatable trigger with a loop which keeps firing ambient sounds if at least 1 player is in the trigger.
params ["_trigger", "_unitsArray", "_soundPath", "_soundsIndex"];
if (isServer) then {
_countPlayersOnActivation = count [allPlayers select {alive _x && _x inArea _trigger}];
systemChat str (format ["Players in trigger: %1", _countPlayersOnActivation]);
while {true && _countPlayersOnActivation == 1} do {
_countPlayersInTrigger = count [allPlayers select {alive _x && _x inArea _trigger}];
systemChat "Loop activated";
_randomDelay = [10, 15] call BIS_fnc_randomInt;
_randomUnit = selectRandom _unitsArray;
_randomIndex = [1, _soundsIndex] call BIS_fnc_randomInt;
if (_countPlayersInTrigger < 1) exitWith {
systemChat "No players in trigger, breaking loop";
};
systemChat "Firing phrase";
playSound3D [getMissionPath (format ["\sounds\%1_%2.ogg", _soundPath, _randomIndex]), _randomUnit, false, getPosASL _randomUnit, 5];
sleep _randomDelay;
};
};
I feel like this is a flustercluck
Trigger activation:
_unitsArray = allUnits select {!(isPlayer _x) && _x inArea thisTrigger};
[thisTrigger, _unitsArray, "pub\pub", 17] execVM "scripts\ambientAI.sqf";
There must be a better way to do this. Currently if a player exits the trigger and re-enters it while sleep is not executed fully the trigger activates again
Seems to me I have to track execution process using a global var or somehow halt the entire trigger with waitUntil
shrugs
You could do all area checking with the trigger here. You'd need to store the spawned script handle.
triggerActivated would be what you check from the spawned script.
Alternatively you could drop the trigger entirely and just have a permanent loop doing the proximity checking, but it seems like the trigger would work here.
I sticked with a trigger so it could run only in proximity with players
I could really do the loop with activation without the trigger, actually, yes
Skill issue
allPlayers inAreaArray [_centerPos, _radius, _radius]
Trigger is probably a bit quicker if it fits your requirements, but they're a bit of a pain.
However it seems to me that running a loop for each zone would somehow hit perfomance?
Yow, is there a good way to ensure that setVelocity is being applied at the same rate no matter what the server framerate is?
I've made a script for boosting an aircraft, but the rate of the boost is highly variable depending on whether I'm in SP or MP.
since when setVelocity has anything to do with framerate? 
it does when you're applying it each frame to simulate an acceleration
🤷♂️ i'd assume you use getVelocity and vectorAdd somewhere as well. And i propose you to vectorMultiply the added velocity by diag_tickTimediag_deltaTime then
would it be diag_deltaTime?
yeah, you're correct
Brill, thanks! I'll give that a go! I couldn't find that function when I've looked in the past, thanks for pointing it out!
i mean, it's found by you, not me 🤣
Well, you set me in the right direction. 😄
hi all! I'm having an issue with this command used on terrain objects:
_object setDamage [1, false];
It works good for the hosting machine (image 1) however the connected clients see both destroyed and pristine building models at the same time (images 2 and 3).
What am I missing? I thought setDamage is a global argument/effect command? Why do buildings get duplicated?
Seems like it's more likely to happen for JIP players..
There's something super-janky going on with map object loading vs hiding/destruction at init time. I haven't been able to pin it down in a simple mission.
What I can tell you is that if you wait until initClient fires, then that asks the server for a list of destroyed buildings, and hides them on the client side, then it works.
Nothing else seems to be reliable.
I do hide some buildings client-side and it seems to be working fine, the problem is that in this particular case I don't need to hide them, I need to destroy them
I've had similar issues with both object destruction and hiding on the server side.
Well, except that hiding isn't reliable on the server either :P
I tried waiting 5 seconds after mission start and it seems like if the player is able to join before these 5 seconds the destruction works fine for him, but if he joins after the destruction triggers he sees the glitch
I guess I can wait for all players to fully load and then trigger the destruction script manually.. but man
Yeah it's shitty. I wish I had a simple replication and then someone might look into it.
but it seems to be strongly dependent on timings that you can't control accurately.
I think you got this issue
https://feedback.bistudio.com/T176730
Try use this code
_object spawn {waitUntil {time > 0}; _this setDamage [1,false]};
Issues fixed in Dev build 151218.
🤔 so they did not actually fix it then it seems .
So what I tried instead is to do the whole thing after time > 5 and it worked for players who are already connected, but JIP players who connect afterwards still see the duplicated buildings

