#arma3_scripting
1 messages · Page 157 of 1
oh so it's not out yet? The resolution date on the bug appears to be December 2023 o_0
oh well
I suspect it's partial and there's a whole mass of bugs in there.
I'll check the RC though.
I suggest download current release Candidate and recheck
huh, might actually be fixed
I guess that confirms that hideObject and setDamage 1 on terrain objects really are the same thing :P
Also this wasn't even a network sync issue.
huh, I subscribed to this back when you opened it.
good to know. Though I'm not gonna make my playerbase switch to the RC so the manual activation will have to suffice
I swear 60% of zeuses work is to babysit armas jank 😭
anyway, thank you everyone
Has any one else had issues where dofire, commandfire, dotarget, dofire, etc. Only work when the group leader is within short range (i.e. <100m) of the target?
It's been a while since using missionEventHandlers.
I am trying to waterproof a tank (setWaterLeakiness does not help). So I tried:
_snorkeltank = addMissionEventHandler ["Drowned", {
params ["_vehicle", "_drowned"];
if (_vehicle = mytank && _drowned = TRUE)
then {
onEachFrame {
mytank setHitPointDamage ["hitengine", 0]
}
}
else {
onEachFrame {}
};
}];
When running this in debug console, I get:
Error position: <= mytank && _drowned = TRUE) then {
onEachFrame {
>
Error Missing )
Where would the closing parenthesis go?
== not =. You shouldn't be using onEachFrame either, outside test code.
it would just be:
private _veh = vehicle player;
_veh setWaterLeakiness 0;
setWaterLeakiness does not help you say, but how it does not
Sorry yes I did post in the wrong channel. I moved it over to config_makers
You answered 0 out of my 3 questions, but sure
Vanilla Arma; no mods loaded.
Editor -> Place (any) tank -> Edit attributes tank object -> init:
this setWaterLeakiness 0;
-> Drive tank into water
-> Engine damage ( vehicle player getHitPointDamage "hitEngine"; increases)
Didn't Bohemia just add a new command this year or something that allowed vehicles to be buoyant or immune to water damage?
Can't for the life of me remember it but I know I am not crazy. Might not be what he is asking tho I suppose.
Very precisely what I am asking.
https://community.bistudio.com/wiki/setWaterLeakiness should do this.
And in the second sentence of my message on this topic: it is not doing this.
I mean it's certainly possible I am not understanding something.
I think that they are correct that you would not need to loop that command and especially not onEachFrame however honestly kind of just knowledgeable regarding that command. Let me see if I can do a little bit of reading on it.
Might be able to use getWaterFillPercentage to make it better as not sure the rate it fills but perhaps something like this? My head right now kinda goes to the way I've seen people prevent drowning in the past which is by consistently setting the players oxygen via a loop.
while {surfaceIsWater} do {
uiSleep 0.1;
_vehicle setWaterFillPercentage 0;
};
Actually maybe doesn't even need to be set more than once?
_vehicle setWaterLeakiness 0;
_vehicle setWaterFillPercentage 0;
I should just stop yapping and open my editor but just cba rn haha
Had a look at it, this indeed stops water leakinees, the number doesn't change
But engine still dies underwater
Looks like engine death is unrelated to water fill
Yea same on some vehicle it works but on some it dosent
Simulation type?
for example on Tigris works but on any tank it dosent work.
Thank you for the investigation guys. I learned something.
that might be a bug in arma you could report that on feedback tracker
the vehicle is submerged below 'maxFord' for longer than 'waterResistance'
Looks like they meant maxFordingDepth
which is lower for tigris than for tanks for example
So water leakiness is unrelated to engine water damage
Probably should add a note to a scripting command
I didn't test but maybe leakiness affects how quickly floating vehicle will start drowning?
Also crew running out of oxygen?
I remember dedmen posted videos with a hummingbird when he made the commands
And if you set allowdamage false for your tank, then it will literally be a submarine on tracks 
I think it's for buoyancy, i.e. how quickly floating vehicle will stop floating. It was added as support for RF's helos with deployable (and puncturable) flotation devices.
The last full game update was in September 2023
Things fixed in December, have indeed not been released yet
It's only tested for helicopters.
does setShotParents works on rifle bullets? I tried
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
[_projectile, [objNull,objNull]]remoteexec ["setShotParents",2];
[{_gunner=objNull;}]remoteExec ["call",2];
systemchat str(getShotParents _projectile);
}];
but didnt work, maybe I messed up locality?
define not working? i think the problem maybe setShotParents isnt yet updated in server when you call getShotParents . assuming that is the problem
remoteExec isn't instant, though
and [{_gunner=objNull;}]remoteExec ["call",2]; doesn't make sense, tbh
it doesnt do anything, _gunner is set to null and then the variable is forgotten
just for example. I'd assume a "ping + 1 frame" delay before changes get propagated back from the server at best
well, seems to be couple of frames even on localhost
setShotParents doesn't work properly on things like rifle bullets because they aren't global projectiles (i.e. server updates its copy but every machine has its own copy, and those others don't get updated). KK was going to look at it and see if it could be made to sync better, but I don't know if that actually happened in time for 2.18. (#arma3_feedback_tracker message)
There was some change for that. Maybe new parameter in createShot command?
theres a createShot command?
come back next week with it!
ah I thought it was familar
it'd be especially nice if this wasnt server only as imo the main use case is for scripted ammo clientside and having a delay via network lag would make that worse
if security is a concern maybe only able to set VEHICLE INSTIGATOR to units local
Uh that's a nice idea, please put on ticket to not forgetto
true
Anyone know how to make an ACE Arsenal interactable from further away? Can't find it in the frameworks bit of the website...
with the vanilla action menu or ACE interact? cause you can add a vanilla action to it with an extended range if you want which would be the easiest solution
I was thinking with the ace interact if such a thing is possible
trying to make an arsenal that everyone can use without having to crowd in close around it
You can, you just need to create the action yourself.
Take a look at https://ace3.acemod.org/wiki/framework/arsenal-framework.html#12-opening-an-arsenal-box-manually
When using the BIS_fnc_exportEditorPreviews command, many of the items are halfway in the floor, does anyone know how to prevent this without modifying the model?
I'd expect it to use the objects bounding box, based on geometry lod
I’ve had a really stupid idea and I wonder if it would actually work in theory
Could you attach an armoured plate to the front torso of a player
Yes
accurate armour? I don't even think so. But it can stop or maybe gets penetrated I guess
What do you mean?
By accurate I just mean accurate hit box
So that a bullet that hits the physical plate will be stopped but if it hits the guys shoulder or abdomen it will do appropriate damage
And then the actual vest could act as shrapnel protection/ Kevlar
Well, that means you want to build a system over an Arma damage system?
Yeah but would it not work as a work around
As from my knowledge anything with armour hitboxes is either very difficult or impossible
So just attaching a physical plate object just in front of the player should work, as I know with ace and pretty sure even in vanilla bullets get slowed down/ do less damage after penetrating an object
Sounds like the goal is as complex as rewriting everything
How so?
Literally just make plate object, attach it in front of player
Boom
Because let's say, Arma 3 human damage model is not that complex. They don't have a hitbox/hitpart only for a shoulder or a hand
What I am suggesting is not that at all
Then your wordings are too much overcomplicated. If you just want to attach a metal plate to a human body, you can
It’s just that when you have an actual plate object, if the bullet hits the plate object it will either stop or slow down, however if it doesn’t hit the actual plate object it will do normal damage
Yeah
My idea is magic floaty armoured plate in front of player (probably aligned with vest itself)
When the magic floaty plate object is hit the bullet will slow down or stop
It’s mainly motivated by me not liking the fact that the shitty skeleton plate carrier from RHS that’s the size of a literal dinner plate is the best armour in the game
Would that work?
I don't even know what is the vest you mean, but sounds like what you really want to make is a Mod that mods RHS
I really don’t think I’ve explained this very clearly lmao
Yes you can attach an object to a unit and it will block bullets if the bullet hits it; or penetrate the object if the bullet is fast enough, high enough caliber, etc
Will it do less damage?
Yes, because the bullet would be slowed down when if it penetrates though the object
Bullet damage is modified by its speed, and hitting a surface slows a bullet down
Nicee
This hopefully shouldn’t be so hard to code
Btw are there any mods that add an actual armour plate object or do I have to model it myself?
¯_(ツ)_/¯
You could at least just test stuff with vanilla objects, and add model(s) later
That’s what I’m doing now
This could be a pretty cool little mod if it works
I’m getting ahead of myself but theoretically I could make different materials for Kevlar, steel, amyloids etc
Btw this is what I was taking about
Btw does disabling simulation effect its penetration?
Yes
It works!! I do have one question
How to I attach it specifically to the guys torso so it doesn’t just float in front of him
Like when he moves I want it to move with his torso
Check wiki article. It has a way
Attach to relative isn’t really working
Not attachToRelative. attachTo
And that means it’ll stay on his chest when he goes down
Because it’s not really doing that here
Like orientation wise
As I said attachTo can do it
Ahh I see what I missed
It works! I mean it’s a little scuffed as there’s a delay between the dude ragdolling and the plate moving but other than that it works as intended
How does the mod sound? A way to be able to pick different plates (steel, Kevlar, ceramic etc) and have them actually work, where bullets that hit the physical plate will either pass or not. Also allows way more freedom with armour as the plate itself isn’t an actual vest meaning people can make their own custom rigs and still have protection
Btw @warm hedge why does attaching objects to your hand cause weird things to happen in first person? The most I’ve ever been told is ‘it’s an arma issue’ and then refusing to elaborate
"Weird things"?
Tiny gun massive painkiller
?
From PIR for example
When you use attachTo to try and hold an object apparently you can’t fix it?
There's some rendering issues with attached objects, they're rendered "under" your body (or vehicle if in a vehicle)
What?
Like if you attach a gun in your left hand, you'd see the gun on top of your hand
If you mean render "issue", it is what it is. FPP model is always rendered into the first layer
Is there any way to get around it?
No
That's just how the engine renders it
I doubt there'd be some "setRenderLayer" command or something added, although that would be cool
Just trying to work something out, I'm not too good with Arrays but I figured this would be the best way to store them in order to pull the variables later.
Currently, when the Volume EH is triggered, it will update indexes 1 and 2 in playerData - and vice versa.
I've tried to fix this by using the second script (New updatePlayerData), but it returns a generic error and I can't really see why, even after reading the "set" page on the wiki.
playerData = [];
updatePlayerData = {
private _playerID = _this select 0;
private _volume = _this select 1;
private _isSpeaking = this select 2;
private _index = playerData findIf { _x select 0 == _playerID };
if (_index != -1) then {
playerData set [_index, [_playerID, _volume, _isSpeaking]];
} else {
playerData pushBack [_playerID, _volume, _isSpeaking];
}
};
//Detect Volume Mode
["MyID", "OnSpeakVolume", {
_playerID = _this select 0;
_volume = _this select 1;
[_playerID, _volume, ""] call updatePlayerData;
// debug message because this shit WILL break
systemChat format ["%1 can be heard from %2 meters", _playerID, _volume];
}, _playerID] call TFAR_fnc_addEventHandler;
//Detect if Speaking
["MyID", "OnSpeak", {
_playerID = _this select 0;
_isSpeaking = _this select 1;
[_playerID, "", _isSpeaking] call updatePlayerData;
systemChat format ["%1 Is currently speaking", _playerID];
}, _playerID] call TFAR_fnc_addEventHandler;```
New updatePlayerData
```sqf
updatePlayerData = {
private _playerID = _this select 0;
private _volume = _this select 1;
private _isSpeaking = this select 2;
private _index = playerData findIf { _x select 0 == _playerID };
if (_index != -1) then {
playerData set [_index, [_playerID]];
if (_volume != "") then {
playerData set [1, _volume];
};
if (_isSpeaking != "") then {
playerData set [2, _isSpeaking];
};
} else {
playerData pushBack [_playerID, _volume, _isSpeaking];
}
}; ```
Sorry for the wall of text, but if anyone has any ideas or can point me to some resource, I'd really appreciate it 🙂
you have a missing underscore:
private _isSpeaking = this select 2;
Good spot, apparently the update function is still broken though 😦
It doesn't actually do anything, so I'm not sure how you define it as broken.
If it's generating a script error then paste that.
Supposedly there's a Generic expression error in if (_volume != "") then {
That's what the log is outputting
I'm assuming I'm updating something incorrectly
Second version seems completely wrong but I don't know why it'd generate a generic expression error.
Like playerData set [1, _volume]; is incorrect.
Yeah I guess I'll have to redo it sadly then. The first update variable works, but like I said it just overwrites the other value with ""
Probably does what you want, but I suspect there's something bad happening with the inputs:
updatePlayerData = {
params ["_playerID", "_volume", "_isSpeaking"];
private _index = playerData findIf { _x select 0 == _playerID };
if (_index != -1) then {
private _data = playerData select _index;
if (_volume != "") then { _data set [1, _volume] };
if (_isSpeaking != "") then { _data set [2, _isSpeaking] };
} else {
playerData pushBack [_playerID, _volume, _isSpeaking];
};
};
I think you must be right, just tried using this and it's returning both generic errors at if (_volume != "") and if (_isSpeaking != "").
Volume is a number of either 5, 20 or 60, and isSpeaking is a boolean, but I can't see how those differences would cause that error.
Ahhh I didn't know that. My fault man, sorry.
I assumed they were strings because you were referring to them as strings :P
Yeah I should've clarified from the start 😅
You could use isEqualTo and isNotEqualTo instead.
or use nil and isNil "_volume"
I prefer the latter method but it's a style thing.
Would that be an issue with how I'm calling the Update function too?
[_playerID, "", _isSpeaking] call updatePlayerData;
And I assume that's because "" means a string. Damn
Assuming that this is the only code that writes it.
"" is an empty string. "wibble" is a string with stuff in it.
Yeah these EH's are the only updates to playerData, would I need to call the function with nil instead, then?
actually that doesn't quite work because then the last line breaks.
you'd have to change it to playerData pushBack _this
Took me an embarrasingly long time to work out the variable name had to be inside quotation marks
SQF syntax makes a lot more sense once you understand the language. It's actually very simple which is why a lot of the syntax is wack.
like params ["_a", "_b"]; is just a unary command taking an array of strings.
I'm now calling the function with [_playerID, _volume, nil] call updatePlayerData; and the updater is essentially what you've sent but with if (!isNil "_volume") then { _data set [1, _volume] }; and the final line you've said about.
It's working perfectly, so I'm assuming you've either been doing this for too long or you're some kind of wizard. 
I've definitely made some spaghetti code in this game before, I dread to open the scripts I made when I first started 
May your SQF skills be sacred
if not ((group _x) in _excl) then
{
_excl pushBack _x
}
}
Fragment of a code [HAL - modified version]...
Testing I managed to get exclude function working, but getting error:
Error Undefined variable in expression: _x
I know that _x is an object, not a group [code will not work if _excl pushBack (group _x).
Help please?
You need to show more of your code, in the sample there, there would be no _x
not updated yet, couple of changes yet to be added
forked hal from 2022 version
Pretty nasty 3267 line code.
"Where is the error line"
I think that's only possible if you have a nil in the array.
that seems to be the only place where RydHQ_Excluded is used though, so the issue would be outside this giant mass of shit.
Ok. There is a line like this though:
if (isNil ("RydHQ_Excluded")) then {RydHQ_Excluded = []};
in nr6_hal/HAL/HQSitRep.sqf
Hey guys - i was referred to the channel about a question regarding an auto opening for an already equipped parachute when in the freefall animation. Has anyone worked on something like this yet?
@sharp torrent Add some logging and find out what's actually in the array.
I told you how to do it
So i'm combing over the wiki and cross referencing other scripts and I just can't wrap my head around how to implement the
getUnitFreefallInfo
0 = this spawn {
waitUntil {getUnitFreefallInfo player};
_this action ["openParachute"];
};
that just doesn't look right to me
Because it's not
- getUnitFreeFallInfo does not return a bool, look at the wiki
- Why you running this scheduled, use an AnimChanged event handler, which I also linked, and check if they're freefalling when it changes
- _this is not defined
_player addEventHandler ["AnimChanged",
{
params ["_unit","_anim"];
if (animationState _player == "freefall") then {
["OpenParachute", player]
};
}
];
so i was able to find the the 'pose' on the wiki
// Define variables
objnull addEventHandler ["AnimChanged"
{
params ["_unit","_anim"];
if (animationState _player == "freefall") then {
["OpenParachute", player]
};
}
];
// Function to deploy parachute
private ["_player", "_chute"];
deployParachute = {
// Check if unit has parachute equipped
if (backpack _player == "parachute") then {
_player setBackpackCargo ["parachute", 1];
}
};
does this look right from your knowledge?
No, not at all
Why are you adding an event handler to a null object.
If you're using some ai thing, you should definitely not be.
so i'm on the wiki in the locality section - would it be - isplayer addEventHandler
and I'm not using AI - I'm genuinely tryingto learn
No you would add it to a player object. Isplayer is a bool witch returns a true or false.
Hi guys, anyone know a script to visualize cargo boxes on flatbed trucks like in Liberation mode?
You would take a box you want and just attach it to the truck. Attach to or BIS fnc attach to relative
I'd like to load and unload them in-game
addEventHandler takes an object, you need to give it an object.
In the example for the AnimChanged, it shows how you could add it in a object's init box, since that's what this would be.
You could use an initPlayerLocal.sqf script in your mission. Which would run locally for each player when they join, and then add the event handler to player.
_player setBackpackCargo ["parachute", 1];
setBackpackCargo isn't even a command
this addEventHandler ["AnimChanged", {
params ["_unit", "freefall"];
}];
i think i'm just ovethinking all of this now
params is used to create local variables, you can't have the name not start with an underscore. Just leave the name as it is in the example, _anim
this addEventHandler ["AnimChanged", {
params ["_unit", "_anim"];
}
];
if (pose player == "Freefall") then {
["OpenParachute", player]
};
am i getting somewhere? lol
one sec I gotta ask chatgpt how to sqf
dude i didn't go to school for this and my references are the wiki and the forums. I'm just trying to bash together code in notepad++. It's frustrating
yeah, he is best friend to help you with sqf. Not
I mean it's not that far from workable
But I recommend starting with more basic sqf tutorials
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
looking for some help, i want to detect when a player loots a AI map and add some markers to their map (basically simulate getting markers etc from the stolen map), cant seem to find much on this, would I be better off just sticking a "gather intel" action on the dead soldiers or something?
that or use the "Take" event handler added to all enemies (and ideally removed afterwards)
If i execute attachTo command in object init (so it will be executed on every client on server), does it means like all clients now will calculate the attachTo command and send the results to every other client (because it Global Effect command)? So when there is 100 players on server the attached object will be moved on every client 100 times per frame?
So for optimisation its better to execute this command only on server, yes?
Only on server or maybe local is better of course. But GE means it is not LE, that does mean the attaching object won't have 100 attached objects in the same time anyways
I would like to trigger the end of a mission, when all players of side opfor have entered an extraction vehicle. Came up with this:
((units opfor) arrayIntersect (call BIS_fnc_listPlayers)) in (crew _extractVeh);
But this is not giving TRUE. My first troubleshooting question is: can " in " check for multiple units in an array?
Ah
Does it need looping?
{_x in (crew _extractVeh)} forEach ((units opfor) arrayIntersect (call BIS_fnc_listPlayers));
This appears to work in my singleplayer test. Have others used such a check as well in their group/clan/unit missions?
Follow-up question: I cannot enter this expression in my trigger condition field. Get a "Condition Type Nothing Expected Bool" error.
in the first context checks the array ((units opfor) arrayIntersect (call BIS_fnc_listPlayers)) is in the array (crew _extractVeh) which means - it will never gets true
[0,1,2] in [[0,1,2]]; //true
[0,1,2] in [0,1,2]; // false```
Ah didn't know. But would you know why the looping code throws an error if placed in a trigger?
Because arrayIntersect does not return a boolean
But in does. And this line does return a boolean in the debug console.
And urm, your last code also doesn't make sense too
{_x in (crew _extractVeh)} forEach ((units opfor) arrayIntersect (call BIS_fnc_listPlayers));```
Which means
```sqf
{code} forEach array;```
Which means `nil`
What you really need is findIf
Hi
I've made a code to create craters around the map and generate debris
since im making a mission with a more post apocalyptic theme
[] spawn {
waitUntil { !isNull player };
// Request crater data from the server
requestCraters = owner player; // Set the player as the value (or any unique value)
publicVariable "requestCraters"; // Send the request to the server
// Wait until allCraters is populated by the server
waitUntil {
!isNil "allCraters" && {count allCraters > 0} // Ensure allCraters is received and has data
};
[] spawn {
private _player = player; // Store the local player object
// Function to manage crater visibility based on player's distance
private _manageCraterVisibility = {
params ["_player", "_craters"];
// Loop to continuously check crater visibility based on distance
while {true} do {
{
private _distance = _player distance _x;
// Hide crater if it's more than 1200m away
if (_distance > 1200) then {
_x hideObject true;
} else {
_x hideObject false;
};
} forEach _craters;
sleep 3; // Frequency of distance checks (adjustable)
};
};
// Start managing crater visibility
[_player, allCraters] call _manageCraterVisibility;
};
};
I'm using this code to hide them and save some performance, but it doesnt seem to save that much, is there anything i can make to get some performance?
Tested running on a dedicated server, tried also on local machine, didnt seem so different fps wise
the simulation of the craters are also already disabled on their creation code
If you really have a reason to run this code, use hideObjectLocal since your code tries to update it globally
I really don't see there is a big reason to run this code even, though
Doesnt it save fps at all? Thought if i hid them, the game doesnt have to render so get some fps
The game already does it basically
i go from like 80-90 to 20-30, but to be fair i'm using 4k craters in a 4.5kmx8km area
I'm not sure what this comparison is. You compare what to what
My fps when playing the map without craters x with
Well, are you sure this chunk of code helps at least a bit?
Not it should but yes it does increase FPS
without it, it goes to 15fps, it helps a little
is there something to do when doing a mission with high amounts of placed objects regarding performance? or it would be best to just change the terrain itself(After getting the creator permission)
Near to nothing. If you really have a reason to have massive amount of craters, I'd suggest this instead. Basically same functionality with Object View Distance in Video Settings: https://community.bistudio.com/wiki/setObjectViewDistance
Will take a look and do some tests, thanks for the help!!
Is there a generic check to see if a given muzzle is a grenade launcher? Im working on a script to make a unit fire one and I need it to work for both (for example) the m79 and the m16m203
Its a terrible idea to ask ChatGPT for anything complicated in SQF
But yeah hiding craters won't matter that much as the game already does that outside of object visibility
The code is bad because it assumes player never changes. The request up top is also questionable, sends it globally instead to just server. You dont even need any requests anyway, just wait for public variable.
And there are much better ways to handle distance checks in bulk rather than checking distance individually
Also make sure your craters are simple objects instead of full entities with disabled simulation
No generic checks, you'll need to do it yourself. I wrote something similar here a few days ago: #arma3_scripting message
My script checks if weapon can fire explosive ammo. You can cut it down to a specific muzzle search.
thanks much
Thank you, but I am now confused about things. I will try to explain.
First; are you not describing the main syntax of forEach
https://community.bistudio.com/wiki/forEach
Why are you saying it is Nil ? Again I have tested this code, and it outputs TRUE in the debug console if my OPFOR character is in the _extractVeh .
Second; will FindIf not give me a number (position)? I could use =! to see if there is any match. But either array can have many variations. Will this guarantee that all elements of my array are present in the (crew _extractVeh) array, no matter what order either are in?
Sorry I don't mean to attack; you are the only one helping me right now!
I guess I am basically asking this:
How can I check if ALL elements of array X, in any order, are in array Y (any order)?
forEach is "run this code once for each value from this array". It doesn't combine anything magically. If it returns - it only returns the result of the last single check.
Since you want all elements to match the condition, findIf is the proper way to do it. You need to find first match that doesn't fit the condition. If no match is found, means all elements satisfy the condition.
_needles = [1,2];
_haystack = [1,2,3,4,5];
_allNeedlesAreInHaystack = _needles findIf {!(_x in _haystack)} == -1;```
This can also be done through forEach but its outdated approach and you had it wrong, your line would return true if last element satisfies the condition, disregarding any before the last.
findIf returns -1 if no element satisfies the test condition. When test condition is !(_x in _haystack) - findIf returns -1 if there is no element of _needles that's not present in _haystack
Say you need to check if all numbers are positive, what you have is:
{_x > 0} forEach [-1,-2,-3,4] => true
Im really new to sqf, and yeah gpt sends a lot of deprecated functions, i use it as a support, had to change a good part of what i asked from it, this code in particular runs client-side, taking the variables that are set in another code and available in the server, its in the onPlayerRespawn and the simulation of them are already disabled, the request variable is a function defined in the init to request the mentioned variables whenever someone spawns in hope of giving a little bit of performance, but its just not enough since the fps gain is only okayish
The code doesn't fit for onPlayerRespawn either because it doesn't terminate previous thread and needlessly requests the array again
so im actually spamming the request for something that the engine itself already does?
Yes, and on each respawn since you said you have it on onPlayerRespawn
If your server broadcasts allCraters, its already available (at some point after loading) on all clients
Another flaw of the script is that it checks against player and not against camera
You may have a cutscene or control a drone or spectate some other player and craters will still be visible only around player
I'd say to redo the script using inAreaArray but with 4k crates you might end up with freezes even in scheduled environment
If you really need your craters hidden separate from engine culling, you'd need to introduce some kind of grid system to narrow down the checks
Since craters wont ever move during gameplay its can be really simple
In other words, you need to rewrite the whole thing understanding how engine works to try to squeeze some additional performance
but the performance gain would still be minimal or that would actually have an impact?
at this point changing the terrain itself seems like the way to go
If objects are simple objects, it should be minimal to unnoticable
You can still try though to see
What are these craters anyway? Editor placed? Randomly generated each start?
since i plan to actually put even more objects in the mission(Bases, trenches, checkpoints, etc)
Yeah, they are randomly placed and in a set meters range it destroys another objects like fences and buildings
creating a war-torn scenario
the idea was to make it dynamic so i could easily switch between terrains and customize them without so much effort
i define an area where then its divided by chunks, which craters are then distributed on random positions
Destroyed buildings that spawn ruins could actually be main performance hitter in your case
Try your tests without destructions to see how just the craters affect the performance
Make sure they're simple objects (createSimpleObject)
There is also a simple object made from vehicle class and simple object made just from the model, iirc they also had some slight performance difference
after the object is destroyed i perform a linesintersect to adjust flying debris and then set them as simple objects, wouldnt it already be doing it?
Speaking of grid/chunk system to narrow down sets for inAreaArray checks, I wonder what would be the fastest method to do grid/chunk lookup? 🤔
_x enableSimulationGlobal false;
_x allowDamage false;
What do you mean by flying debris?
im doing this way inside a for, after adjusting its height
since i'm using a custom terrain things like sea level are actually in the sky, so sometimes the generated debris are high up
@marble atlas
// Set Independent (IND) to be hostile to OPFOR
independent setFriend [east, 0];
// Set Independent (IND) to be friendly to BLUFOR
independent setFriend [west, 1];
You mean the building ruins?
yeah
There is a much better way of finding ruins than line checks which are very expensive
inb4 dividing the X/Y coordinates by 300 and floor-ing the result to get the chunk coordinates
@marble atlas Find or create the file called init.sqf
And put that script inside that, or you can make another script file and have init.sqf run that.
Global event handler that fires whenever a building turns into another or ruins
Was thinking about chunksHashMap get mapGridPosition positionCameraToWorld [0,0,0]
Gonna need lots of keys in that hash map though
Pointing to same chunks mostly
hence the divide/floor approach to make that stuff discrete 🤷♂️
Yeah maybe simply rounding the coordinates is better, as the main performance hit is elsewhere anyway
chunksHashMap get (positionCameraToWorld [0,0,0] select [0,2] vectorMultiply 1/1200 apply {floor _x}) then
Oh, there is extra Z
GIB resizeRet 😡
is _array select [0,2] a thing yet?
Yeah, that will work too to have things inline
Not sure about 1/1200 for 1200m visibility radius though, chunks will have to overlap so you can get everything in a single chunk
get 300m chunks and load 9 of em 🤷♂️
This is educational!
Very didactic; thank you.
For 1200m radius you'll need to get 2x2 so overlapping chunks gonna have to be 4800x4800
What you need is:
[-1,-2,-3,4] findIf {_x <= 0} < 0 => false
[1,2,3,4] findIf {_x <= 0} < 0 => true
But I am still not 100% on board with Findif . Because the second (array "Y") array will certainly have more elements, so it will certainly return a mismatch.
Expected someone in the BI forumswould ask the same question:
https://forums.bohemia.net/forums/topic/229124-simple-array-comparison/
Hey, I have a quick question: Is there a way to check of all elements of an array are inside another array? I can imagine a way of writing code for this, but I wonder if there is some built-in function that might be quicker? Something to the effect of: array1 = [1,2,3]; array2 = [5,1,6,2,7,3]; ar...
The answer I see is an arrayIntersect *. Pardon
i mean, changing chunks when they overlap doesn't sound trivial
(Nested in my case, since that is how I make the first array "X")
It all can be precalculated on start so you can get overlapping chunks in a single get
second (array "Y") array will certainly have more elements, so it will certainly return a mismatch.
wat
Honestly i might end up just messing with the terrain editor since it seems like the more performance saving way and i want to put even more stuff in the map, if you guys want what i have done so far i can send it so you can take a look
See start of question. My _extractVeh has a driver/pilot.
its an idea i had but i recognize its a really complicated thing for a beginner like me
Having objects pre-baked into the map is the most performant way of having it
I will wait until you help Zanga first!
Having dynamic objects can be performant but it requies knowledge of the engine to do it properly
i mean, player moved 600 meters and ended up in a different chunk. Would you hide all the stuff from previous chunk and unhide all of the new one? Calculate the hide/unhide lists on the fly? Have them precalculated all possible neighboring pairs of chunks?
but would be a really nice to have a script like that, so you could make any terrain wartorn without needing to change things in terrain building level
Trust me. You don't want to do it. It's way more complicated
i didnt find anything like that searching up
You just need mega chunks that include neigbor chunks objects in it and search that instead
i need that fps 😭
Try seeing how having just craters affects the performance. Then add destruction and compare again
It's okay anyways. I want to welcome you as long as you have a passion to learn; it seems it's resolved while I'm away
and thats just the mission atmosphere part, the rest of it(factions and map population in general) is done by drongos mod, which also consumes some fps but not as much as my scripts xD
You can also use ARRAY - ARRAY here
count(((units opfor) arrayIntersect (call BIS_fnc_listPlayers)) - (crew _extractVeh)) == 0;
Basically substract all crew members from opfor players, if none are left (all were in crew), means its good
findIf way to do it:
(units opfor) arrayIntersect (call BIS_fnc_listPlayers) findIf {!(_x in _extractVeh)} < 0
findIf loops until it finds first unit that is not in _extractVeh, then returns its index, if none found it returns -1 thus the < 0 check
This is a helpful way of wording it. Thank you.
If I compared an arrayIntersect with my first array, would that be any different?
ie:
_a1 = [1,2,3];
_a2 = [1,2,3,4,5];
_compare = _a1 arrayIntersect _a2;
_bool = _compare isEqualTo _a1;
*Have a different outcome?
Yeah you can also do it like that
arrayIntersect or array - array wont work if you need some other condition than equality though
That's where forEach and findIf will come into play
Say you want all opfor players in extraction vehicle AND have full health
(units opfor) arrayIntersect (call BIS_fnc_listPlayers) findIf {!(_x in _extractVeh) || damage _x > 0} < 0
To do that with arrayIntersect you'll need to grow your code even more to pre-filter arrays, etc., while findIf does all that in a single line.
(and with performance that would vary from micro-benchmark to micro-benchmark) 🙃
Its a good idea to setup small tests with numbers exactly like that and run your logic against them, rather than having to run the mission and waste time preparing real setup, only do that once you have logic right.
yeap, solid 60+ fps on dedicated without creating debris
even without hiding them as i was doing before
Might be a good idea to delete some debris or replace them with something simplier
There is also setObjectScale which could work on simple objects to have your craters bigger
the size is fine
the idea is a rocket barrage in the scenario
they dont need to be too big
the idea here is to make stalker inspired mission with missions and factions
but im using a map that is too untouched, so i wanna to make it more destroyed
the map is already heavy so im trying to do everything possible(At least that i can manage to do) to save some performance
the craters is an idea to not only make it the map more war-torn for my mission, but also make it available so anyone can make any map like it through using an script/module
but its waaay harder than i anticipated
visibility script makes me gain 1 fps, but also makes it much more unstable, ty for the help, will focus on managing the debris now and try the BuildingChanged
Thank you for all your efforts! ❤️
I will get there, eventually, maybe xD
How can I hide multiple layers using getMissionLayerEntities? Tried dropping them into an array.
_villagelayers = ["V1_AIwithObjects", "V2_AIwithObjects", "V3_AIwithObjects"];
{
_x enableSimulation false;
_x hideObjectGlobal true;
} forEach (getMissionLayerEntities _villagelayers select 0);
_villagelayers = ["V1_AIwithObjects", "V2_AIwithObjects", "V3_AIwithObjects"];
{
{
_x enableSimulation false;
_x hideObjectGlobal true;
} forEach (getMissionLayerEntities _x select 0);
} forEach _villagelayers;
Thanks so much! If you don't mind me asking, why can't I put the variable after getMissionLayerEntities and have to put a magic one instead?
I'm seeing that layername should be a string, so it should work in theory?
You're passing array instead of string
You need to iterate through your array and feed that into getMissionLayerEntities, that magic _x is that each string item
Ok, don't laugh at me but I asked ChatGPT for a script that helP me call for reinforcements, I have followed the steps but I'm not sure that it works haha
anyone who can help me check what I've done wrong?
what I've done wrong
Using ChatGPT instead of learning SQF yourself
yeah, problem is that I'm to stupid to learn SQF but gave it a try
Start small, try a lot
Its working now but when I've called for reinforcements with the button in the scroll wheel menu, it adds a line "call for reinforcements" after every call haha.
any idea how to remove that "feature"
addAction shouldn't be in the script -- this is clear even from the comment in the script itself.
so is chat gpt.
@tough abyss do you want to learn it? or just have us write you the script. either is fine.
i asked chat gpt to make me a 3 min alarm when players use the laptop
// This script delays for 180 seconds (3 minutes), then triggers an alarm sound.
// 3-minute wait (sleep is in seconds)
sleep 180;
// Play alarm sound at a specific position (replace "Alarm" with any valid sound from Arma 3)
playSound3D ["A3\sounds_f\alarms\alarm_triggered_01.wss", player, false, getPos player, 1, 1, 500];
says invailed numbers in epxression
Don't use ChatGPT. It's not good at SQF, and it's very bad for the environment - queries to ChatGPT and other AI services have a massive energy cost.
The code it's given you is wrong in several respects:
- the file path is almost certainly not a sound file that actually exists
- it uses
getPos playerfor the sound position. First, you probably don't want the alarm to be played from the player's position; secondly, the sound position parameter requires an ASL position, whichgetPosis not.
The "invalid number in expression" error is actually not caused by ChatGPT being "wrong" as such, though. That's likely caused by putting the code with comments in an Editor code field. Editor code fields don't go through the preprocessor before being executed, and one of the preprocessor's important functions is to remove comments, because the game won't understand them. So either move this to an external script file which the game will preprocess on loading, or remove the comments.
I'd rather not learn haha, will take to much time so I would be glad if you can help me
really thought gpt would help me with making script that are very hard
give me everything you want it to do
Can anyone help me figure out whats wrong with this code. It's for a radio asset called radio1? Music tags are good. When i launch the mission it just spools out errors and doesn't run the code
The innit from radio1: [] execVM "radio_music.sqf";
Knowing what the errors say would be useful
You could make this a lot simpler by using playSound3D or say3D rather than doing constant volume adjustment to simulate 3D position
im trying to add smokescreen to gunner, so it can be fired from that position, any idea why i have this after i added magazines to the weapon?
first time added it works, but after that it keeps in red with that
Hello, I'm trying to find out what might be causing this issue. I've added zeus ( https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/pull/376/files ) to A3 Wasteland stratis mission made by @drifting barn, all working fine however now the vendor NPCs have disappeared when the mission is running making it impossible to access their menus, you can see them in the zeus editor though. Not sure what logs are needed but i can share them.
Magazines are auto loaded only if added before the weapon
I'm trying to submerge an entire island terrain from view. Using example 1 from the https://community.bistudio.com/wiki/setTerrainHeight is very CPU consuming: takes almost a minute to run the script.
Perhaps I can make it faster, by deleting all the terrain objects first. How would I do this?
I think https://community.bistudio.com/wiki/nearestTerrainObjects has the answer. Stand by.
Okay by basically adapting example 1 from both nearestTerrainObjects and setTerrainHeight (adjust objects False) I have reduced 1 minute load time to 35 seconds, for a 8x10 km stretch. The island is approx 30x16 km = 6 times the size. Let's see how it benchmarks...
What do you mean "from view"? You want to hide it? Make it go underwater? What's the goal?
I am setting up a "Prologue" coop mission, where the diver players jump off the boat in the middle of the ocean. Real purpose is to create a lobby for players to check mods and networking et cetera.
It's convenient to use the terrain (Kaska island), because it matches the skybox and lighting of the main mission. I will place all mission objects (players and boats) kilometers away from the terrain, so only the outline of the landmass needs to be submerged.
That and all the location names visible on the map; but that comes next.
oh man, thanks alot!!
I want to have the ability to spawn reinforces (the units: ["B_UKR_Army_AT_01", "B_UKR_Army_Grenadier_01", "B_UKR_Army_Medic_01", "B_UKR_Army_Team_Leader_01", "B_UKR_Army_Sapeur_01", "B_UKR_Army_Rifleman_01"] )
i want them to either move to my last known location from a spawn point or spawn next to me.
I would like to have the script with infinite spawns
IF possible I would like to spawn a vehicle with units in ( this vehicle: RHS_M2A3_wd )
the problem is that I have 2 more scripts, I know that the one that makes me spawn on a vehicle is working fine but having some issues with the no stamina on LAN. works for my first character but not when I respawn..
I hope you understand, as I said, this is waaay of my area of knowledge haha
And I'm really uncertain about my solution for several init files 😐
- Submerge only part of it
- Limit view distance instead
Didn't even thought of that, will stop thou its more of a gimmick for me haha🤘
This is a rather stupid question, but since getPos and getPosASL both return coordinate arrays, they should be roughly similar - depending on the map. No?
Nevermind, just read this page. It makes sense now.
https://community.bistudio.com/wiki/Position#PositionAGLS
Never use getPos unless you want a headache (or do one-time use test scripts)
Huh. I use that a lot, might be the case why some inconsistencies are happening. Thanks 🙂
For whomever wanted to know what setTerrainHeight does at large areas...
I tried the following code in a 30x17 km area in the initserver.sqf:
//https://community.bistudio.com/wiki/setTerrainHeight example #1
private _fnc_flattenTerrain =
{
params ["_start", "_a", "_b", "_h"];
private _newPositions = [];
for "_xStep" from 0 to _a do
{
for "_yStep" from 0 to _b do
{
private _newHeight = _start vectorAdd [_xStep, _yStep, 0];
_newHeight set [2, _h];
_newPositions pushBack _newHeight;
};
};
_newPositions;
};
private _desiredTerrainHeight = -40;
private _positionsAndHeights = [getPosWorld _markerBottomLeftCorner, 17000, 30000, _desiredTerrainHeight] call _fnc_flattenTerrain;
setTerrainHeight [_positionsAndHeights, false];
``` Game gave an overflow error and softlocked during editor preview.
So I reduced scope. Turns out viewDistance 500, maximum weather, and disabling birdsounds using ```enableEnvironment [false, true, 1];``` works great.
One last question-
Players can still take their boats and visit the mainland. Even if it takes 5 minutes, I know players will try.
Does anyone have an area restriction instant lightning strike script per area that they have used before?
All suggestions thanks to Sa-Matra! By the way...
===
So what I have come up with, is a trigger.
Activation on OpFor (player side) presence. Repeatable. Server only.
onActivation:
[thisList select 0, nil, true] spawn BIS_fnc_moduleLightning;
thisList select 0 setDamage 1;
Problem is that it needs to deactivate first before reactivating. Which might happen if a boat full of players enters the area, and don't all die on the first strike. Has anyone made a robust, tested lightning script?
Is there for instance, a player local script I could make, that checks inAreaArray, and has the player initializing a lightning strike on themselves?
forEach is one way
Could use a step of terrainGridWidth of getTerrainInfo instead
Altis has a cell with 7.5m side for example, no need to add position each meter (default for step)
so, i've got a problem basically, operation frenchpoint's Peugeot P4 Milan and the PATSAS variant is broken because the mod itself has a feature where its like ammocan where it takes magazines from the vehicle's inventory, problem is, there is no item for the milan missile, and no such item exist according to the document
so uhm
what now lads
Sigh...
Well, I guess some people just want to watch people's computers burn.
https://steamcommunity.com/sharedfiles/filedetails/?id=2822758266
Just use mod deformer (for dedicated need be server mod) All info saved in .sqm
I have a problem, at the beginning the dynamic simulation for soldiers is set to 200. But when I play the script I want to set it to 1000, when I enter this script "Group" setDynamicSimulationDistance 1000; it doesn't work and activation is still 200, can it be fixed?
I suppose it also depends on viewDistance
Make sure you create a placeholder object if you care about the object you are actually striking as if I recall it will actually delete the object it strikes whether it be a player or vehicle which can have unintended affects for variables in its namespace, etc. On mobile rn but more examples regarding that and how to create a placeholder (if necessary) can be found on the wiki 😄
If you're actually typing "groupName" with the quotes, it doesn't work because of the string
Ew 
magic strings 
when I type the group name nothing happens, when I just type the word "group" nothing happens either 😦
I checked it, and it doesn't want to work either "Group" setDynamicSimulationDistance ((viewDistance * 0.8) - (viewDistance * fog));
I enjoy the Deformer mod. It works in multiplayer. But it adds a dependency. And I want this mission to have the shortest list of mods that is the same for bothclients and server. Lowest complexity for others to run the mission.
So far I only tested this script on singleplayer editor preview. Result was dead/destroyed vehicles. Will it behave differently in multiplayer (locality)?
Deformer no need in clients!!!!!!!!!!!!
@extDB3 - database
@OustAddon - server functions for my server
@Deformer - for deform terrain.
params in my **vanilla **server
-serverMod="D:\SteamLibrary\steamapps\common\Arma 3@extDB3;D:\SteamLibrary\steamapps\common\Arma 3@OustAddon;D:\SteamLibrary\steamapps\common\Arma 3!Workshop@Deformer"
Thanks 🙂
Does anyone know if there is a command like BIS_fnc_exportEditorPreviews but that creates pictures for inventory use?
I found that shotgun hits can be not intercepted by handledamage. This is the damage list that came to me when I was hit(image). The damage was done from the same unit during 1 frame. Even the lifeState changed consistently during the frame.
only 68 damage bypassed my processing code.
I have an idea where the failure occurred. Exactly 0 damage passed through the body, which is why I died. But this is not
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
diag_log _this;
diag_log [_unit,alive _unit,lifeState _unit,time,diag_tickTime];
if (!alive _unit || !isDamageAllowed _unit) exitwith {};
scopeName "EHScope";
_realDamage = _damage;
_isfalldamage = _projectile isEqualTo "";
_state = lifeState _unit;
_fallenHits= ["hitface", "hithead","hitneck","hitchest"];
//Here my Damage Handling by _context
diag_log _damage; //can be max 0.9 or 0.975
//Here my handling of a player falling into a non-combat state
//this condition (_damage >= 0.95 && !(_state isEqualTo "INCAPACITATED") && (_context in [0,1]|| _isfalldamage))
// The condition is that the AI is killed in 50% of cases without going into a state INCAPACITATED
// if (!isplayer _unit && random 1 > 0.5) then {
// _damage = _realDamage;
// breakTo "EHScope"; //Lethal damage to AI.
// };
diag_log _damage;
_damage
The logs definitely show that the last 2 diag_logs did not work for some reason.
Even when the player was alive according to the exitwith condition
Because of this, I'm now thinking about removing shotguns from AI equipment.
//Now the first 5 lines look like this.
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
diag_log _this;
diag_log [_unit,damage _unit,alive _unit,lifeState _unit,time,diag_tickTime];
if (!alive _unit || !isDamageAllowed _unit) exitwith {Diag_log ( "Exitwith " + str damage _unit);Diag_log [!alive _unit , !isDamageAllowed _unit]};
Again, several handlers stopped executing code before the first IF was called
Damage on _context = 0 was 0.
Handler cancelled my code execution after diag_log _this.
Then
Damage on _context = 0 was 4.17943.
Handler cancelled my code execution after diag_log _this
Then
I am dead and exitwith triggered on me dead.
It looks like the bullet just doesn't disappear and deals a huge amount\count of damage in one frame.
I entered exactly what is selected, I don't want the dynamics to be for a selected group but for everyone, but unfortunately it doesn't work 😦
I know Wime, but entering what bis officially provides doesn't work either, i.e. not the group name, only :group: as a string
omg i find why my unit die!
my condition return
diag_log [_damage >= 0.95 , !(_state isEqualTo "INCAPACITATED") , _context in [0,1], _isfalldamage];
[bool,true,true,false]
I wrote one of the variables with an error in “Here my Damage Handling by _context” Because of which _damage was returned as nil due to a missing variable error... I spent 2 hours trying to find 1 stupid letter z at the end of the variable...
I'm trying to play a sound
playSound3D [getMissionPath "frying_pan_sizzle.ogg", br1, false, getPosASL br1, 1, 1, 20, 0, false];
but I don't want it to be played at sea level and the playsound3d entry on the BI wiki doesn't have a negative option, how do I skip a field in something like this?
playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset, local]
I want to skip or leave default soundPosition
soundSource has the actual AGL location but soundPosition overrides it
I want the other parameters in front of it to be the same
"getPosASL" is not "at sea level". It's "position with height a ltitude measured from sea level"
I want to skip or leave default soundPosition
Provide default value.
if i wanted to make Civ's Hostile would i need each one of them have a custom name?
It's not immediately bad, but its not good either. Especially if you dont know the possible dangers.
Not everyone needs to be a perfect arma scripter but explaining why they might not be the best is something suitable in a channel solely about scripting
I would like to set a large (100+ in a wide area) amount of Editor place objects to " Simple ".
I'm not sure how I would select all of them in a trigger area.
I'm also not sure how to refer to them using https://community.bistudio.com/wiki/BIS_fnc_replaceWithSimpleObject
Does entities detect empty objects?
Or would 8 allObjects 0 cover all decor objects as well?
what is the problem with objects in the editor select attribute simple object (checkbox)?
Ah...
Need find all simple objects in area trigger?
Almost-. I need all editor objects in area trigger, changed to simple 🙂
I tried the following code:
This I placed in the onActivation part of a trigger.
{[_x] call BIS_fnc_replaceWithSimpleObject} forEach ((8 allObjects 0) inAreaArray thisTrigger);
It crashed the game with a "Status Access Violation".
(allSimpleObjects []) inAreaArray myTrigger ```
Find all simple obj in area trigger.
Hm. So for example I have object like "Land_BarrelTrash_F" . It is not simple by default. But I want to change it to simple.
In my test setup, I have about 25 objects.
However I want to make a pretty big scenery with ~150 objects. I don't want to click every menu to check "Set Simple Object".
But maybe that is faster than coding this 
Why create simple objects during the game if you can create them in advance and hide them until the right moment? It just feels like you're building a sky-high code in your head instead of a simple approach. 
Great. So I have placed each (not simple) object already. How do I make them all simple?
Select all objects in editor and change attribute for all selected...
Ha! I had forgotten you could change attributes of several things at same time in Eden Editor!
Do you know the check / getter command for a simple object? To see if it worked.
https://community.bistudio.com/wiki/get3DENAttribute
Follow all get3den..... and be happy. All power eden in your code! And hands.
If in started game
isSimpleObject cursorobject
One thing to keep in mind is that setting custom Editor attributes on an object does make it take up more space in the mission.sqm, and when you have a very large number of objects that can stack up a bit. Depending on how big your mission file is otherwise, this may not be particularly important, but sometimes it can be the difference between an acceptable server-to-client transfer time or not.
Applying things to many objects at once is almost always more space-efficient in script than in attributes. e.g.
{
_x setSkill [...];
} forEach units west;
is a lot smaller than 100+ copies of the entire unit attributes class in the mission.sqm.
you still need this? i've been letting my girl play skyrim and now shes addicted lol. i have my PC back for now
that would be amazing! haha had the same issue, daughter took the pc to play.
IF you have the time and want to help, of course.
Idk if that's what you want, but I have a similar script that I used for my ops
there are some examples in it
just grab and change the values
he wants a plug and play. no interest in learning. if you want to do that for him go ahead, but I'm starting to get up so I can do it in a few min if you don't want to.
oh, so not my problem lol
Does anyone run a loop or function to add flashlights to spawned (not editor placed) FIA units and if using ai behavior mods, to remove the code from pilots, co pilots and driver units. Thanks in advance
there is an event handler for that, EntityCreated (iirc)
the command does work, it's just the fact that groups need to be simulated to update their dynamic simulation distance. Arma moment, i'd say
@winter rose ok. I will look at that. Thanks. Have you used it before?
I don't remember, perhaps - why?
I was wondering how best to use it. As a loop or function
Modules enhanced has a module for that. Adding flashlights and having them toggle on or off, etc.
Edit... I now see the non editor placed comment. Well feel free to look through and modify the code.
EntityCreated is an Event Handler, which means it automatically activates and runs its associated code whenever that event happens. So there's no need to use a loop with it.
You could use a function; have the EH-creation done by a function, or have the EH call a function. "Loop or function" is a false dichotomy - those are two completely different things that could even be combined (not for this purpose but in theory), not two alternative solutions to the same problem.
@fair drum thanks. I'd rather not add another dependency if possible.
u wot
@hallow mortar ok. So running this with init.sqf would be fine?
You might consider initServer.sqf instead, since the server is likely to be where the units are created and where their AI is running, but init.sqf should work.
Example:
addMissionEventHandler ["EntityCreated",{
params ["_entity"];
if !(_entity isKindOf "CAManBase") exitWith {};
if !(side group _entity == west) exitWith {}; // for side filtering - use west, east, or independent as appropriate
_entity addPrimaryWeaponItem "acc_flashlight"; // pretty sure that's the classname
_entity enableGunLights "ForceOn";
if (!(isNull objectParent _entity) && {_entity == driver vehicle _entity}) then {
// disabling AI mod stuff depends on the specific AI mod so that's up to you
};
}];```
@hallow mortar thanks. I will definitely try this. Appreciate your help
thank you very much for the information.
Thanks! But I'm not smart enough to deal with scripts myself, so I'm waiting for @fair drum and his magic haha
@hallow mortar hey again. If I wanted to narrow the filter more to both side and faction say, IND_FIA, opfor_FIA, I forget the exact names should I make individual if ()then; statements for each or on same lines, and the same question applies for == driver && pilot && co-pilot?
Sry. I am at work on phone so I cannot give better example.
For faction instead of side filtering, replace that line with something like this:
if !((toLower faction _entity) in JL_var_flashlightfactions) exitWith {};
and then at the start, before the current first line, add this:
JL_var_flashlightfactions = ["ind_fia_f", "opf_fia_f"];```
(make sure those are the right faction names)
In engine terms, "pilot" and "driver" are the same thing; the person in the seat that controls the vehicle's movement is the "driver", there is no separate `pilot` command. Detecting copilots is more complicated because they aren't really a specific seat type. You could try `gunner` (see example below) but no promises that works for all types of helicopter.
```sqf
... && {_entity in [driver vehicle _entity, gunner vehicle _entity]} then { ...```
You can also use typeOf to check whether the unit itself is one of a specific list of classes, but that tends to get pretty fiddly pretty quick, and there are edge cases, like riflemen being the default driver class for carlike vehicles
@hallow mortar ok thanks. I didn't realize pilot and driver is the same. No biggie about the copilot
_faction = faction _entity;
if ((JL_var_flashlightfactions findIf { _x == _faction }) < 0) exitWith { };
_vehicle = objectParent _entity;
_isDriverOrCopilot = (!(isNull _vehicle)) and { (_entity == (driver _vehicle)) or { _entity == (currentPilot _vehicle) } };
That will only detect the copilot if they've already taken control of the vehicle because of the loss of the original pilot, which seems somewhat unlikely given that the entity/vehicle has only just been created
OK:
_vehicle = objectParent _entity;
_isDriverOrCopilot = (!(isNull _vehicle)) and {
(_entity == (driver _vehicle)) or {
_turretPath = _vehicle unitTurret _entity;
(getNumber (([_vehicle, _turretPath] call BIS_fnc_turretConfig) >> "isCopilot")) == 1
}
};
getNumber ([_vehicle, _vehicle unitTurret _entity] call BIS_fnc_turretConfig) wat
?
BIS_fnc_turretConfig seems to return config class, what's the meaning of getNumber here?
It [this code, not the BIS function] was probably supposed to get the value of a property within the turret class, but a layer got missed
hence my question
Fixed.
Why Ai just run away vs 1 player 
The reason is AISkill ["courage",0.1] ???
What a terrible player. That they even run away hundreds of meters.
Anyone have an example value of what getPosATL grabs?
Is it just [x,y,z]
So im trying to do a thing where a trigger spawns a grenade (SmokeShellPurple) and a person can pick it up using ace and throw it into a trigger to make the trigger fire.
Haven't be able to figure out how to get the trigger to dectect SmokeShellPurple" to set the stuff off. (Also need to make the trigger delete the grenade and one to detect when its been deleted to spawn another one.)
Have you tried https://community.bistudio.com/wiki/allObjects ?
https://community.bistudio.com/wiki/allMissionObjects Might also help. Haven't used these commands very much.
not yet. So far ive tried these
if (typeOf vehicle == "SmokeShellPurple") then {count thisList > 0};
{_x isKindOf "SmokeShellPurple"} count thisList > 0
friend of mine is seeing if an event handler works but no luck so far
what other trigger settings are you using. sometimes, for the custom stuff to work, you have to set to Anybody
try this in your codition of trigger:
{{_x inArea thisTrigger} count (getpos thisTrigger nearObjects ["Class_Name_Of_Granade",30]) > 0
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
dang thats not the one lol
Type: None
Activation: None
Type: N/A
Repeatable- Yes
Server Only- Yes
yeah so try your isKindOf example, but with Anybody
Condition: Missing }
delete first {
also, consider findIf instead of count
didnt work. No errors but its not firing
no errors but its not firing still
im putting it in condition
standby
standing by
thisList does not detect ammo objects - so you cannot use that method
Legon's method by doing a nearObject check is correct. You can implement it various ways. Pay attention to syntaxes, they will depend on if you need any smoke, vs a specific smoke.
nearestObjects for isKindOf comparison
nearObjects for direct comparison
prefer findIf over count for these frequent checks
either do a inArea check like legion does, with a large radius:
//radius
triggerArea thisTrigger params ["_a", "_b"];
private _maxRadius = _a max _b;
// rest of the check
or if you have a circular trigger, you can get the radius using triggerArea directly and just check if the array is not empty (faster)
im trying to use a square trigger that defines a specific area inside a bunker prop
how would I do it if was inside of the specific trigger area? im not to familiar with inArea in this context but i have used it for specific units like when I made a hostage rescue mission
written for understanding, not for speed, but it will get you what you want.
triggerArea thisTrigger params ["_a", "_b"];
private _objects = thisTrigger nearObjects ["SmokeShellPurple", _a max _b];
_objects findIf {_x inArea thisTrigger} != -1;
and if a square and you want to get crazy, and ensure you are checking those corners, you can use pathags instead of _a max _b
this makes sense. Now what i need to do is delete the "SmokeShellPurple" when it enters the area and then spawn a new one. I also need to set a trigger up so that when there is no "SmokeShellPurple" it will spawn one
this is to reset when someone throws it in, delete it if someone tries to chuck it over a wall or something, and when it inevitabely dies out due to time
personally, I would be using a loop instead of a trigger for this amount of custom stuff
A loop? ive never herd of those
you probably have. the scheduled space while loops and waitUntil, etc (you could do unscheduled with framehandlers, but this doesn't seem time sensitive)
so you want an area that a person can throw in a smoke, and no matter what smoke, its going to be a purple and at a specific location? is that what I'm getting?
Maybe? there are other types of smoke in it. Im working on making this like TVT sport kinda thing. I had made other versions of it previously using the ACE wheel but I figured that using the smoke grenade would make the game go quicker.
Basically I want the purple smoke grenade specifically to be the "ball" and when it gets thrown into a bunker (the "goal) it adds a point based on which goal its in. The smoke grenade is then deleted in order to set off a different trigger which will spawn a new smoke grenade.
The reason for the separate spawning trigger is I need one that will detect if the smoke is not present in-general because they will eventually time out and get deleted by the game so i need a means of making a new one when that happens. So i can couple deleteing the existing one with that to use less overall
so what i need to figure out is how to delete the purple smoke grenade with the On Activation and detect if one exists in Condition.
can only one person have the "ball" to be able to throw it?
yes because its spawned via a trigger the grenade auto activates so people cant put it in their inventory and carry it
its held via ACE
ok. so you'll have to save the ball on creation as a missionNamespace variable which you will use to reference. you can also use the class "SmokeShellPurple_Infinite" to get an infinite smoke grenade as well
so im doing this to make the grenade
_smokePos = getPos Ball_Spawn;
_smoke = "SmokeShellPurple_Infinite" createVehicle _smokePos;
the idea i had was in the goal script it would do this but that isnt working.
_smoke setPosATL _smokePos;
Thats true. Anyways yeah my attempt to teleport it back to its starting position didnt work
Nevermind! I figured it out, had to remind myself how namespace variable worked
@indigo snow "not good either" ... tbh ... thats bs
scripting is not much different from programming
actually there is no real difference at all
thing is simple: you have to know when to use loops and when to use eg. PFHs
just like with everything
I'm trying to simulate someone pumping up a fuelbladder.
All it has to do is slowly go up.
As a test case, I've placed the fuel bladder on a water surface (it floats). And applied this:
target_fuelbladder setVelocityTransformation
[
[4823.07,8645.77,38.45],
[4823.07,8645.77,40],
[0,0,0],
[0,0,0.0516],
[1,0.000767902,0],
[1,0.000767902,0],
[0,0,1],
[0,0,1],
0.05
];
The object disappears when I run this, without an error. What am I missing?
Classname " StorageBladder_01_fuel_forest_F "
Alright, I always run into this problem, can someone explain how to fix this? I'm defining an array in the "main" scope of an sqf file, then I need to modify it inside of a loop and have that change edit the parent scope (the sqf main)
example:
_myArray = [1,2,3,4];
[] spawn {
_myArray pushBack 5;
}
hint _myArray select 4;
>> error, _myArray undefined
I could pass the array to the subFunction like this:
[_myArray] spawn {}
But then the _myArray I'm editing is the subfunction's local copy.
The specific script I'm working on right now is a simple script to respawn AI. I'm going this route because ... reasons.
I'm calling it on multiple groups, so I can't (as easily) just define a global like WR_groupData because as I cann the script for each group it'll get overwritten, and I don't really want to have to add an array for each group to my global array of all groups.
No, arrays are passed by reference, not by value: https://community.bistudio.com/wiki/Array
the same applies for any variable, like
_myString = "foo";
if (_myString == "foo") then {
_myString = _myString + "Bar"
}
error, _mystring is undefined.
If this is in the same scope, then it's impossible.
_myArray = [1,2,3,4];
_scriptHandle = _myArray spawn {
_this pushBack 5;
};
waitUntil { scriptDone _scriptHandle };
hint (str (_myArray select 4));
At the end of the day, bad scripting is bad. Nothing changes it.
And it's not a lot of work to fix the problem, they just refuse to actually do anything about it.
can object roadway lod be disabled?
No
i wonder why, now you cant make fully passable objects using disableCollisionWith
well you can make a ticket. it might actually be added (not with disableCollisionWith but maybe with setPhysicsCollisionFlags)
already did, kind of: https://feedback.bistudio.com/T180863
Well that ticket says disableCollisionWith is not working correctly. It doesn't ask for a new feature
But anyway I think I made a ticket for that too
yea Idk if my comment there makes sense. practically roadway lod is collision
Hello again, I am still learning this scripting language, its a chore to say the least. Between @hallow mortar and @faint burrow code I have combined in to this.
JL_var_flashlightfactions = ['IND_G_F','OPF_G_F','IND_C_F'];
addMissionEventHandler ["EntityCreated",{
params ["_entity","_entity_2"];
if !(_entity_2 isKindOf "CAManBase") exitWith {};
_vehicle = objectParent _entity_2;
if (!(isNull _vehicle)) && { (_entity_2 == (driver _vehicle)) || { _entity_2 == (currentPilot _vehicle) }) then {
_entity_2 setVariable ["TCL_Disabled", True];
};
if !(_entity isKindOf "CAManBase") exitWith {};
_faction = faction _entity;
if ((JL_var_flashlightfactions findIf { _x == _faction }) < 0) exitWith { };
_entity addPrimaryWeaponItem 'acc_flashlight';
_entity assignItem 'acc_flashlight';
_entity enableGunLights 'AUTO';
}];
I presume each event needs its own block of code. I could be wrong too. this bot is messing with me. I will try to place in SQF
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
In your case I would combine code blocks.
If you choose to use two separate EHs, you don't need to do _entity_2. The _entity variable is a private variable, specific to each instance of the EH, and does not conflict with other variables of the same name in different scopes.
The code formatting uses a specific character: `
It's at the top left on a UK keyboard, not sure about others. If you can't find it, copy it from the bot's message.
But as Schatten said, in this case, you can easily combine both things into one EH. Do the vehicle-driver stuff first, since it applies to all factions, then do the faction filter and then the flashlight handling.
Also, this line:
JL_var_flashlightfactions = ['IND_G_F','OPF_G_F','IND_C_F'];```
is meant to be _right at the start_ - outside the EH entirely. The purpose is to define that array, once, as a global variable that the EH can refer back to when it fires. This is more efficient than redefining the array every time the EH fires.
ok. its been updated in example to what you suggested. I will test it later. Appreciate your help.
Hi guys !
Could anyone suggest me sources, where could I get an information about scripting ( advices, unusual techniques etc. ), which help me to improve my scripting knowledge and skills ? Except BIS forum
Maybe YouTube channels
@tired cargo unfortunately, many and I mean many players and content creators are long gone. There are some left. If you Google youtube channels some will populate, jester if I remember was a popular one. I'd try here and
https://discord.gg/arma-3-scripts-and-goodies-767300449929658379
It depends on what you're looking for. Can you be more specific.?
So, I have base scripting skills and I feel confident, but I am looking for something, that could improve my skills. There is something similar when you have achieved something, but want to expand your knowledge, for example, by reading books, or something like that. Something that is not written about in many places, that is, the information is not popular enough, but greatly improves the understanding of scripting
@tired cargo I get it. Udemy offers free online c++ education videos. Let me know if you find anything. I am always wanting to learn more myself.
Why many content creators are along gone?
game longevity, content stealing, moved on to other games, passed away.
Lots of reason, nothing in concrete
Oh gawd, call the police.
Anybody messed with the "end game" revive system and restricting the revive to certain roles? (ie. Medics only)
To have a bit more substance what the difference between good practice vs. bad practice is heres an example: I made a mission for yesterday, and had my units spawn via a function instead of doing it all in a for loop inside the script. It made the AI spawn probably 50% faster than normal, which is great cuz it can lead to issues with vehicles leaving and such. However I had still put down too many AI so the mission ran like shit until i deleted a bunch of them. Solid basics matter more than finetuning performance in some scripts.
Here is one that a friend and I made to help people who have had an interest in starting SQF for our server. The "Fockers Scripting Guides" are best for getting a handle on how to setup a Eden environment, beginning writing scripts, testing, etc. Killzone Kid tutorials will kind of be going on the assumption you already have a bit of that pre-req knowledge. The scripting commands page is overall just an extremely useful resource to find commands that you may be looking for on how to do stuff (get player heath, etc).
https://docs.google.com/spreadsheets/d/1zI7r5jw-ikiQlnCCkqevThQ4NCC2xufPDaVwOto4dow/edit?gid=0#gid=0
The Fockers guides I remember having quite a few typos among other things which were not great but at the time they still really helped me and I feel like do a really good job at getting someone started
trying to understamnd the warning at https://community.bistudio.com/wiki/weaponsItems
if I understand correctly the command could return for example
[laser,optic,weapon,flashlight,bipod,[mag,ammo]] or
[optic,weapon,laser,bipod,[mag,ammo],flashlight] and so on?
No, the command can return
[
["arifle_MX_ACO_pointer_F", ...],
["launch_NLAW_F", ...],
["hgun_P07_F", ...]
]
or
[
["hgun_P07_F", ...],
["arifle_MX_ACO_pointer_F", ...],
["launch_NLAW_F", ...]
]
Endless thanks) I have base scripting skills, but I think, that I could find something new and interesting, or maybe something, I haven't used before
Are c++ skills really useful for arma scripting? I know, that something is similar, something is not, I also have base c++ skills, but I am interesting about your experience, how was it for you? What helped you a lot or made your work easier ? Except similar syntax
Learn C# for reforger, it's OOP and similar syntax. Sqf is procedural so knowing program flow from a procedural language would help understand.
But really sqf is it's own animal. A disgusting, ugly, animal.
If you're trying to learn SQF just learn SQF
C++ is a lot more complicated than both SQF (A3) and Enforce Script (Reforger)
But you can also learn JavaScript which is kinda close to SQF (but there are still many differences)
Learning C# is also a good option but that's better for Reforger
SQF syntax is nothing but mathematical expression
e.g. if you write 1 + 2 in math, in SQF you can have 1 plus 2 where plus is a command. There's literally nothing else to SQF. If you understand how to use a calculator properly you already know the SQF syntax
There's literally nothing else to SQF
except for the arcane, twisted secrets of what the commands actually are and what they do
Well I was talking about the syntax. Not knowing what a command or function does is inherent in all programming languages and you can just read the docs for them
But still you do need some programming background to understand stuff (e.g. arrays, strings, etc.)
😀
Anyone here familiar with ESS? I'm trying to set it up for spawning, but I can't figure out where the line of code used to control enemy variables goes.
I've tried checking Google for a setup guide but haven't found anything, and as someone who knows next to nothing on SQF I don't fully understand what the instructions included are saying.
Hey fellas, long time!
It's there a way to tamper with the gravity of an object or is it necessary to do stuff OEF in order to control/"remove" gravity acceleration with transformations/position setting?
whats ESS ?
do you mean EOS
ahh ok i see, Try EOS its way better IMO
C# is 1 Half step above C he he i'm a guitar player
I am trying to understand setVelocityTransformation.
As a simple experiment, I am trying to get a VR block to rise 2 meters up within 10 seconds, with this code:
startPos = getPosATL VR_cube;
endPos = startpos vectorAdd [0,0,2];
startVelocity = velocity VR_cube;
endVelocity = startvelocity;
cube_vectorDir = vectorDir VR_cube;
cube_vectorUp = vectorUp VR_cube;
t1 = time;
t2 = time + 10;
interval = linearConversion [t1, t2, time, 0, 1];
VR_cube setVelocityTransformation
[
startPos,
endPos,
startVelocity,
endVelocity,
cube_vectorDir,
cube_vectorDir,
cube_vectorUp,
cube_vectorUp,
interval
];
The block is only sitting in front of the player at start. I have no mods loaded.
The result, even if I directly enter the values, is that the object instantly disappears. What am I missing?
it wants ASL positions, not ATL. Mixing those up in VR would put your block 5 meters below the ground
and you need to execute setVelocityTransformation every frame while the object moves 
please, refer to https://community.bistudio.com/wiki/setVelocityTransformation
So should I interpret this command as generating a series of frames, without animation?
That is, "playing" them.
generating a single "frame" (defined by interval) of a series defined by other parameters, i'd say in those terms
Also I have changed the first command in my example block to:
startPos = getPosASL VR_cube;
Now nothing happens.
I will wrap it in an eachFrame event handler.
I believe I have mimicked Example 2 from the BIKI:
startPos = getPosASL VR_cube;
endPos = startpos vectorAdd [0,0,2];
startVelocity = velocity VR_cube;
endVelocity = startvelocity;
cube_vectorDir = vectorDir VR_cube;
cube_vectorUp = vectorUp VR_cube;
t1 = time;
t2 = time + 10;
interval = linearConversion [t1, t2, time, 0, 1];
onEachFrame
{
VR_cube setVelocityTransformation
[
startPos,
endPos,
startVelocity,
endVelocity,
cube_vectorDir,
cube_vectorDir,
cube_vectorUp,
cube_vectorUp,
interval
];
};
There are no visible effects when running this. And no errors.
What's missing?
interval = linearConversion [t1, t2, time, 0, 1]; being inside onEachFrame is missing
why would output of setVelocityTransformation change if you don't change any of its arguments between frames?
Because, I thought, that interval defined the step size. Which if that was the case, should be defined before it is executed.
For continuous movement this command should be executed each frame while changing the interval value.
...
Later inside some on frame event...
_interval = linearConversion [t1, t2, time, 0, 1];
Thank you.
I assumed that the second argument (endPos in my case) defined the end of the movement. However in my code the object continues indefinitely. What is a convenient way to stop it?
stop applying setVelocityTransformation after the end time 🤷♂️
if (time > t2) then {onEachFrame {}}; (or if (time > t2) then {removeMissionEventHandler [_thisEvent, _thisEventHandler]}; if you use more production-ready each frame execution) inside the loop
So you have to keep track of time manually when executing this? Ok.
Has anyone ever used setVelocity [0, 0, 0]? Or does that give unusual behavior?
I mean I don't understand why setVelocityTransformation wouldn't stop when you've defined both an endpoint in space, and a stop point in time with the interval. So would setVelocity even have a noticeable effect unless you manually stopped the frame by frame execution loop?
Correction: I think I understand that the interval can be changed to whatever scale looks good for the animation. But I don't understand why an endpoint is even a parameter here.
Regardless; thanks for the tips!
read that not as "beginning"/"end", but "value at interval 0"/"value at interval 1" 🤷♂️
the picture at setVelocityTransformation should be more like this, there's no logic to stop below 0 or above 1 
I have a script that I think will remove the stamina haha, but it only seems to work for my player unit, and only until I respawn. It doesnt work at all for my friend when playing LAN.
any smart one that can help me with correct script?
you could use onPlayerRespawn.sqf instead. weird though it didnt work for the other player
for that script to run at start you need to check this: https://community.bistudio.com/wiki/Description.ext#respawnOnStart
thanks! but wow that's way beyond my knowledge haha
Could you help me fix that script?
Just rename your initPlayerLocal.sqf.
A code block used in a for loop is no different to a code block that is the main body of a function, that couldn't have been the substantive difference that gave you improved performance.
yeah, sorry to bring up this again... but it doesnt seem to work.
throwing in my file and a screenshot that shows that there still are stamina
Your file has wrong name.
hahah fuck, that's embarrassing. sorry
No problem.
Hi guys!
Is it possible to make mission database ? I mean, each server restart: positions ( players and vehicles ), equipment etc. are saved
Dedicated server
This is something simillar as Altis Life
Yes
Can you suggest the way ?)
You'd have to write it in sqf, probably use a hashmap for players (since the steam ID gets returned as a string) then store all the other stuff in... Eh, an array is fine but hashmaps are nice. Basically, save it all to profilenamespace on the server or the mission namespace then save it periodically
Then an init or respawn eh for restoring players
Well, thanks, I try it )
You can read more about databases here : https://community.bistudio.com/wiki/Arma_3:_Scripted_Database
oh interesting, whats the difference between a database here and a hashmap?
I guess its more structured by the looks
A database, in the sense that that article discusses, is just an arrangement of arrays. In engine terms there is no such thing as a database. All you're doing is making arrays in a certain format and manipulating them with array script commands.
A hashmap is its own data type, specifically designed for rapid retrieval from memory based on key searches. All the lookup stuff is done internally by the engine, not by multiple SQF commands, and the data is stored in a way that can be accessed very efficiently regardless of the number of records.
If you want to make a large database, and you want it to be SQF rather than handing it off to a dedicated database extension on the server, hashmaps would be the better choice. That stuff about scripted databases exists because hashmaps are a relatively recent addition to the game.
I'm planning to add some CBA settings to my mission, but I want to make it an optional mod. Would init.sqf / initServer.sqf be sufficient for assigning default values, or is there a conventional way to define those variables if CBA isn't loaded?
(mainly concerned about my defaults overwriting whatever the user sets)
if (isClass(configFile >> "CfgPatches" >> "cba_main")) then {do stuff}
heh, thats fair
self-documenting too
ooh maybe later i'll add ryan's zombie settings to my mission too
Had another question with setVelocityTransformation.
Has anyone used this command in a Multiplayer, Dedicated server situation? Are there any extra things to consider?
You can create a wrapper function with the same parameters as the CBA fnc
e.g. TGC_fnc_addSetting which calls CBA_fnc_addSetting if it exists or just sets the default value if not
hmm that's nice as well, i'll conditionally call XEH_preInit.sqf from init.sqf as a fallback then
All the implementations I've found so far in the BI forums and this Discord wrap setVelocityTransformation in an onEachFrame execution (stacked or not). The command is labeled Global in the BIKI. I think this would generate a lot of network traffic. Is ther e a way of making sure this is only local?
PS the object is decorative and needs no physics.
has anyone ever made a script that modifieds a guns rpm to counter shitty fps
To answer your question: the RPM of a gun is defined in their config, which you cannot really modify using commands.
Just a guessing here, but you could force better mission performance by setting the viewDistance lower.
no, unless an object is local, direction and position transformations will get transmitted through network no matter what. It will even if its local, but the received client will discard due to missing references
setWeaponReloadingTime
thats vehicle weapons only
yh which is what im working with
Oh wow did not know this command existed, thanks.
Thanks. Is there a way to disable PhysX (collisions with all objects) on created simple objects?
do a super simple object instead. Although Simple objects should have physx already disables iirc 🤔
Simple objects don't behave with PhysX themselves, but other objects will collide with them, like how static rocks work
How would I disable all collisions? hideObject also makes it invisible. Can you transform/move objects with enableSimulationGlobal false applied? I guess I should just try.
You can disable physx collisions by setting the mass to 0
Again with the multiplayer implementation-
Here's my test code:
// Create local object
VR_cube = "Land_VR_Shape_01_cube_1m_F" createVehicleLocal (getPosASL logic_1);
//Set parameters. Object keeps orientation, only moves up 2 meters in 5 seconds.
startPos = getPosASL VR_cube;
endPos = startpos vectorAdd [0,0,2];
startVelocity = velocity VR_cube;
endVelocity = startvelocity;
cube_vectorDir = vectorDir VR_cube;
cube_vectorUp = vectorUp VR_cube;
t1 = time;
t2 = time + 5;
// Execute movement transform
0 spawn
{
_moveCubeEH = addMissionEventHandler ["EachFrame",
{
_interval = linearConversion [t1, t2, time, 0, 1];
VR_cube setVelocityTransformation
[
startPos,
endPos,
startVelocity,
endVelocity,
cube_vectorDir,
cube_vectorDir,
cube_vectorUp,
cube_vectorUp,
_interval
];
}];
// Terminate movement
sleep 5;
removeMissionEventHandler ["EachFrame", _moveCubeEH];
};
I will be executing this in an editor placed trigger onActivation field.
Should I wrap the spawn code in a remoteExec to make sure there's no network traffic?
No, that's not what remoteExec is used for. remoteExec is actually used to generate network traffic (ideally but not always in a controlled manner) - it instructs other machines to execute the code.
I guessed that was its primary purpose (it's called remote after all). But I thought that the _targets parameter would let you limit it to separate executions on client machines.
Because the editor trigger is of course already global, right?
I want everybody to see the movement at the same time. I just don't want it to generate traffic.
Unless a trigger is set to server-only, it exists as a separate copy on every machine, and its code (condition and activation) will be run locally on every machine.
OK. But as setVelocityTransformation is global, should this be accounted for?
setVelocityTransformation is global effect, meaning other clients will see the results, and global objects won't get desynced between clients. But you're giving it a local-only object, so there's nothing to send; the object doesn't exist on other clients. (A very similar object does, their own local one, but it is a different entity and a reference to it won't work on other clients.)
Thank you very much for the detailed explanation.
Here's my question: why is it a local-only object? Its position seems to be the same for all clients, and you want it to move at the same time for everyone. Why not use a normal (that is, global) object, instead of creating a local copy for everyone?
The players are pumping up a fuel bladder object. They will be near/on top of the object. They are also going to be in a pre-made scene with >100 editor placed objects.
I'm trying to limit both unusual Arma physics from collisions, and the performance cost.
My idea is to create the simple (no collisions) object underground, locally, and have it transform up by a meter.
Although this is starting to look like premature optimization :).
Local objects won't stop collision problems, and the performance cost of moving one object with network sync isn't important.
Unless you test it and find the network sync causes noticeably choppy movement, I would suggest just using a global object. It'll be easier, especially for JIP handling.
Just make sure when you do things with creating and managing global objects, you're only running the code on one machine (e.g. the server). Otherwise you will end up with many more objects than you want.
OK. So players will be initiating this "pumping up" with a BIS_fnc_holdActionAdd. Should I then wrap the spawn part of the code-
0 spawn
{
_moveCubeEH = addMissionEventHandler ["EachFrame",
{ ...
VR_cube setVelocityTransformation
...
];
}];
...
};
in a remoteExec with target parameter 2 ?
Depends how long it's going to take.
If it's going to only be a few seconds, just let the client that did the action handle it. The chances of them disconnecting in those few seconds aren't zero, but I wouldn't worry about it too much.
If it's going to take a while, then I would tell the server to do it, yes - although I would suggest making all of it into a function (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) and remoteExec'ing that. It's more efficient than sending all your code over the network, and handling creation on the server too will save having to broadcast the variable referring to the object.*
* global (scope) variables are not automatically global (network) variables. If you do e.g. vr_cube = createSimpleObject ..., then the object will exist on all machines, but the variable vr_cube will only exist on the machine that did it - accessible in all script scopes, but not for other machines. You'd need to broadcast it to other machines with setVariable or publicVariable - or simply handle it all on one machine and not need it to be either kind of global.
This is covering a lot of questions.
OK, I will just make this a 1 person thing that takes 10 seconds. And thus execute the code as is, without any variables set locally, or any commands executed on a particular machine.
How can I force a (single) destroyed object to remain indefinitely?
ie I have setDammage 1 an object at mission start.
don't delete it?
OK so even though it starts a few hundred meters away from players, I can be sure it will not be part of garbage management?
Hello. What is the best way to detect if a value from a variable has changed? I'm planning to use it with CBA_fnc_addPerFrameHandler.I just need some logic guide lol
If you want to be safe, try removeFromRemainsCollector. That should™ take care of BI garbage collection - any scripted systems you might have running are another thing entirely.
Got it. I just need it to remain in the game until players reach that part of the mission. Then I assume it'll be fine.
I'm almost there! I've got the holdAction and the setVelocityTransformation to work(!).
But the object, StorageBladder_01_fuel_forest_F, still collides with players. I have tried setMass 0 and disabling simulation. What's another trick?
Depends what kind of value and whether it's you who changes it or someone else
it's a number, and the server changes it. I've found a way by creating an "old value" and updating it after.
i cant remeber work to do this, I need a init.sqf in the same folder as the .pbo ya?
ah thanks been a min so im trying to recall. here is what I have.
all files should be in your pbo file
init.sqf execVM "wave_respawn.sqf"; wave_respawn.sqf ```hint "wave_respawn.sqf has been executed!";
not in the MPMissions?
the .pbo isnt a file on my computer. is only a unreadable text file
yeah all files and init should be in the pbo file
oh is there some third party extractor?
yeah you can pbo your mission from the editer
huh. oh wait here
send to MPmissions folder
you need to put all you sqf files in your pbo
Right, I explained, that the .pbo is not a file on my computers.
hmmm why
that is what I am trying to find out by asking people on discord?
see you make your mission in the editer then you putt all your files in the mission folder then you pbo it send it to MPMission folder
i have like 20 or 30 files in my mission folder the i send it to MPmissions folder and it pbos it
having a exturnal pbo i dont think will work
thanks help the help but I am not making myself cear enough on what exactly my issue is.
whats in your exturnal pbo
your not making any sense to me. nothing. I told you three times already the .pbo is not a file on my computer. so nothing can be in it.
if its not on your pc how can ArmA 3 read it
i mean file as in folder.
are you looking to make a mod to share your mission? or just share the mission singularly on the workshop
if you are just sharing on the workshop as a mission, you don't need a pbo at all (you publish from editor)
hmmm i guess im not understanding what hes asking
the answer that he is looking for is that the init.sqf file needs to be in the mission root folder where the mission.sqm is @tough abyss
okay so i found the answer, I need a .pbo manager
ArmA 3 can pbo also but yes you can use pbomanager
what?
the editer can pbo missions
isnt that just how is saves it?
no it saves it as a root mission folder
if you export it to MPMissions folder it will pbo it
👍
cool
i open my mission in the editer and check to make sure everythings right then i export it to MPMissions folder and wala its pboed then i can host it as a server and check it again
then i can put it on a DED server and check it again
due i told you you dont understand what im telling you
there is away to test you mission with out pboing it if you set file patching in steam
nor do you understand the screenshot I sent
it was to small to see
the .pbo being created is not the issue.
im not sure of the problum your having
you have said the pbo is not on your PC that could be your issue
i wish i could help you im sorry i dont understand what your asking
all i can say is all files must be in your root mission folder before you pbo it
you cant have a exturnal pbo thats not on your PC
i dont think you can have pbo files in your root mission folder eather
what is the mission folder?
but im not sure about that, i never had pbo files in my pboed file
no its not is an folder to hold all your pboed filres
becuse your saying it should be a folder i can put .sqfs into?
okay wait, lets back up
yes the MP missions folder holds all your pboed missions
for a multiplayer mission. what is the file structure?
well there can be many file structures
your root missions folder holds all you mission you made in the editer
nope all them files should be inside the pbo
so game1.pbo/ MPMissions/ file1.sqf file2.sqf?
nope
explain
in your mydocuments is the mission folder
can you elaborate alittle more opn that?
in that folder should be all the mission you made in the editer
in each missions folder should hold all the files for each mission
in the mydocuments ArmA3 or other profiles folder theres a missions folder
right we talked about it already.
ok so each folder in the Missions folder is a diff mission, and in each diff mission folder holds all ther files for each mission
okay right here is the issue
cool
it doesn't make the .pbo a folder.
yes right
right thats the issue.
but we already established that.
oh no
earlier, we established that the issues is the .pbo is not a folder, right so, not sure the next step?
you cant have all your mission files as 1 pbo
each mission must be pboed as 1 pbo file
This is a bit painfull to watch 😄
But here: https://community.bistudio.com/wiki/PBO_File_Format
https://community.bistudio.com/wiki/Mission_Export
So you have 2 MPMissions folder.
- Mission folder is inside the Documents the path would look something like this;
\Documents\Arma 3 - Other Profiles\Legion\mpmissions\Framework.Stratis
Note: Framework.Stratis at the very end that folder was generated when i saved a mission in mpmissions in eden editor.
2.Second MpMissions folder is located in the root of your game file path could be something like this:
D:\Steam\steamapps\common\Arma 3\MPMissions
Now in this file when you export a mission to multiplayer you will have a pbod mission and this is the file that you put on server.
really. all that to write some code for it
not worth it at all, I remeber a few years back I did this far less complicated it seemd like. thanks anyay
pbo is a file
If you want to write the code for a pbo mission or a pbo mod. Then you have to unpbo the file make the changes and then pbo it again. There is other method with PBOPREFIX but its a bit complicated to explain.
i mean, not origianally native to a wondows
i cant just wwrite some simple code on a .sqf file
if you just use the editer its way easy
what do you mean? i am??
Read the first line of a link that i send you here;
PBO means "packed bank of files". A .pbo is identical in purpose to a zip or rar. It is a container for folder(s) and file(s).
https://community.bistudio.com/wiki/PBO_File_Format
yeah you can make a simple sqf file but it must be in the mission folder before you pbo it
no no
sleep 1; waitUntil { not isNull player };
hint "Welcome to the Server.";
// This is the action that the player will perform to capture the laptop
[laptop1, "Capture Laptop", "", "", "player distance _target < 3", "call {true}", {}, {
// This is the code that runs when the action is completed
laptop1 setVariable ["captured", true]; // Set the laptop as captured
hint "You have successfully captured the laptop!"; // Display a message to the player
}, {}, [], 10, 0, true, false] call BIS_fnc_holdActionAdd;
addXP = {
_player = _this select 0;
_enemy = _this select 1; // Enemy that was killed
_xpToAdd = 10; // XP value for killing an enemy, can be adjusted
_currentXP = _player getVariable "XP";
_newXP = _currentXP + _xpToAdd;
_player setVariable ["XP", _newXP, true];
// Show a hint message
hint format ["You gained %1 XP for eliminating %2", _xpToAdd, name _enemy];
};
// Event handler for killing an enemy
player addEventHandler ["Killed", {
[player, _this select 1] call addXP; // Pass player and the killed enemy to the function
}];
few years ago i wrote this for ann online server
it worled fine
you put the sqf in the mission folder then you pbo it
okay what does "you .pbo it" mean exactly
Export mission
i did that
so all the files you need are in the mission folder right
no no the mission file in mydocuments
yeah you open the mission in the editer
Ok so when you go in eden editor and when you save a mission it will generate a file; Name.Map
Then you put your sqf files in that folder and make all the changes you want. And when you are done and want to put that mission on the server to play you export mission get the PBO from MPMissions from your root where you install the game and put that file on the server.
agree
i dont think he understands where his mission folders are
i need a beer after all that lol
and i dont even drink lol
I pointed out where it was twice
So I can only write code for the .spf files in the Missions folder not the MPMissions?
yes
ok well, I restarted and saved a basically blank map. but in my Arma3/Missions, I dont see the mission I saved in it? strange.
Did you save it as a singleplayer mission or multiplayer mission depending how you saved it it would be in their folders.
Your saved mission would be in your documents check this:
#arma3_scripting message
wait
so, save or export because they are different? But if I export then the .pbo isnt a folder anymore?
ya look
thats H:\SteamLibrary\steamapps\common\Arma 3\Missions
so you have to save it.
i making a step by step for you ok m8
well look. i am saying the export makes it not a folder anymore.
hold on
the docs for this is absolutly trash.
i making a step by step for you ok m8
hold on
ok you ready to read
ok here it is
1st make a mission in the editer
then save it
this will make a folder in your mydocuments/ArmA 3/your name/missions
lets say the mission is called Attack_city.straits
so then you open the folder in your mydocuments/ArmA 3/your name/missions/Attack_city.straits
this mission will have a .sqm file only
then put any .sqf files or other files in that folder Attack_city.straits
then you go back to the editer and open the mission in the editer
then you go to the upper left and find Export to MaultiPlayer,
this will make the mission into a pbo file Attack_city.straits.pbo
so then exit the editer do not close the game
then go to Quick Start
then at the top chose host server
your mission should be on the map you made your mission on
2x clicke on the mission name bingo all done
😮💨
yaman, thanks but i'll after to come back tomorrow and ask some other people
we arent understanding eachother.
read that its all there
oh my god your right it literally just fix all the issues i was having
no i told you, you didnt undestand what im asking for help about
we backed up to the missions not MPMissions and from there idk.
I explain that when I saved the mission I wasnt seeing it the misisions folder for some reason and its like you skip over the acutal issue i have and tell me to read
so its all fixed now ?
you don't have to use the F boom i mean really
well i hope someone can help you
i think you are looking in the incorrect place for your missions folder its not in usersaved
its in missions
Will this one work for both me and my buddy when playing LAN?
Yes it will
merge doesn't return the hashmap 😡
... remoteExec [..., [-2, -3]] will that RE to everyone but 2 and 3? 🤔
Tested it, answer: Two negative owners REs matches all clients (and server ofc)
Or in other words, it doesn't work, only single negative owner allowed
When does JIP setObjectTextureGlobal happen in initialisation order? 🤔
hmm, interesting question of whether for that sort of command the networking just sends the current state of the object, or stores each one as a JIP message.
I guess texture state can be local too.
Might be able to tell by spamming a bunch of them and checking the JIP queue.
If there is already a set texture message to same target, the old one is replaced by the new one.
Otherwise each is a separate message
Is there a plugin for np++ for arma scripting?
Google searching gave me options from 2013-14 and a dead github.
sqf markup basically
Is that something built in, or is there a langauge file to download?
Is there a way of adding MEDEVAC support for eden editor, for example, unit gets into engagement, one soldier goes down, I could then call in a helicopter to pick him up and take him away?
Collins, there is a mod that enables medevac, where you load a unit, player or otherwise, it flies out, heals them, and then brings them back.
It is designed to work with ACE, and needs to be fixed, but the dev has said it is fine to edit the files as long as you credit them.
MRHMilsimtools
I edited mine though.
Ok thanks a lot, will have a look at this!!
Yep, the admin menu stuff is bugged out, so I recommend removing it, and the heal function for medevac uses and old version of the function. Find the new one on the ace github, and replace it.
Thanks a lot, tbh I am not too concerned about the healing part, just want a helicopter to land, I load them up and they go
Okay, the script has the heli turn and fly them back in after it reaches the healing point, so you will just have to adjust that then.
Yeah no worries, thanks again!
Anyone able to help me out with a script I'm trying to make?
Looking to make a script which returns the following values:
- Position of a memory point on a Primary Weapons optic
- Direction of the players rifle.
The point is to attach a PIP camera to said position in a specified direction
https://community.bistudio.com/wiki/weaponDirection
As for the memPoints, I dont thing you can programatically get those on the fly for guns atleast. There might be a command for that already
@wise frigate this is for muzzle point but you can do the same for optics too
Does this also take into account the bank/angle of the rifle or just the point itself?
It also has the direction
_vx vectorMultiply -1 in the last line is the direction in model space (or you can just use weaponDirection)
muzzlePos is defined in config
Its actual mempoint name is something else (zasleh something I guess)
But yeah
Look in the config to see where the optic mempoint is defined
Gotcha, so theoretically I could just add lets say:
OpticEndPoint = "OpticMem"; in the config of said optic and it should work?
No no it's defined by the weapon config. You just need to look it up
Solid, will do, thanks!
so I have my init.sqf in the folder with the missions.sqm. still i simple hint it's working.
I'm sorry, not sure what you are asking with that last sentence.
That file structure looks fine.
sure, I mean I just started this so I might know be able to ask the right question.
the hint "Test"; in the init.sqf isnt displaying when the mission starts.
Make a initplayerlocal.sqf
waitUntil{player == player};
hint "Test";
You should wait mission start:
waitUntil { time > 0 };
does it matter if I play it as single or multiplayer?
No. It should work either way
what the heck, still nothing? shouldn't be too hard so maybe a deeper issue, although not sure what could've happened?
Did you close the mission or just restarted?
I went back to the enden editor
What are the contents of your init.sqf file?
hint "test";```
What if you put sleep 2; instead of the waitUntil line?
nah nothing, i have sleep 2; hint "test";
correct mission loaded?
yup
I would use both
waitUntil{player == player};
uisleep 5;
hint "test";
systemChat "Test";
What did you write the code with?
Vscode
Make sure you use NP++ or VSCode and UTF8 encoding
and that didnt work either so its not reading that file
