#arma3_scripting
1 messages Β· Page 181 of 1
so it should be {AI disableCollisionWith _x} forEach [_platform]?
ah no, that bit is wrong too :P
sorry i dont understand
_platform = [plat_1, plat_2, plat_3, β¦.etc];
{ AI disableCollisionWith _x } forEach _platform;
[] declares an array. You don't just put it around random things.
oh i see, i was looking at an example on the wiki and i thought it was correct, thank you very much
Code in the object init field gets ran when a player JIP, right? So if it put this there then the object might zorp around if players join?
this setPosATL (getPosATL (selectRandom [cache_file_pos_1, cache_file_pos_2, cache_file_pos_3]));
@granite sky So this is what i had originally and didn't want to do it this way because i have to do it individually for each object but it works.
AI disableCollisionWith plat_2;
AI disableCollisionWith plat_3;
AI disableCollisionWith plat_4;
AI disableCollisionWith plat_5;
AI disableCollisionWith plat_6;
AI disableCollisionWith plat_7;
AI disableCollisionWith plat_8;
AI disableCollisionWith plat_9;```
But for some reason this one doesn't.
```_platform = [plat_1, plat_2, plat_3, plat_4, plat_5, plat_6, plat_7, plat_8, plat_9];
{ AI disableCollisionWith _x } forEach _plat;```
The forEach has wrong variable
forEach _plat
You definitely want an isServer on that one regardless.
if (isServer) then {this setPosATL (getPosATL (selectRandom [cache_file_pos_1, cache_file_pos_2, cache_file_pos_3]));};
Unless you have other code in there that needs to run everywhere, I prefer if (!isServer) exitWith {}; for readability reasons. Also you can drop most of those brackets because the SQF parser handles command command in the only reasonable manner.
is there any method to get any throwables near an object besides a loop to get nearby objects and sort for a grenade in mp in a decently optimized manner? it appears that fired near event handler does not work in mp to get the actual thrown weapon.
and from digging into contact alien which has same use case it uses firednear since sp 
If I put this in a initplayerlocal, only the player that enters the trigger will have rain right?
[] spawn {
waitUntil {sleep 5; ([outsideTrigger, player] call BIS_fnc_inTrigger)};
0 setRain 1;
};
Yes
ah yes I see the info now, but it says it will turn to server setting, so setting it on client doesnt work
It depends what soon means and what MatthewL wants
well interesting that the two other syntaxes are marked "local effect"
No
It's server command
And will not execute on client
And when executed on server, it will add globally rain
But if you use
Alt syntax that is local
setRain rainParams
Parameters:
rainParams: Array - array of custom RainParticles params - see rainParams. Use empty array [] to reset to default config values
have a local LELocal effect
Those are particle rain that is locally created
What about that green box saying it has local effect when executed on client?
And you don't need use spawn in local init .
You can use condition and activation field in trigger attributes.
If you don't mark server only,
Trigger activation will be executed locally on client.
Local effect when executed on client, but only for a brief period before the client re-synchronises with the server
Well I am using the setRain params
0 setOvercast 0.5;
0 setRain 0;
0 setFog 0.7;
setHumidity 1;
enableEnvironment [false, true];
forceWeatherChange;
setRain [
"a3\data_f\snowflake4_ca.paa",
1,
0.01,
15,
0.1,
2,
0.5,
0.5,
0.02,
0.02,
[0.1, 0.1, 0.1, 1],
0.1,
0.1,
5.5,
0.3,
true,
false
];
This is above, Im setting the rain to 0 here, and want it to only start when the player enters an area, would I just do setRain with params again?
And it's bad solution regardless, on listen server, the server host would essentially make changes global, while any client would make changes only for him temporary
Which is of course weird
either way
its not happening on a trigger, its happening based on a spawn in the initplayerlocal, which would make it local no?
ic
I can't reach 1500 anymore, even with th debugconsole
Prisoner is suggesting to use trigger's condition and activation fields instead
will it only run on the people that enter the trigger though, its not gonna do it for everyone everytime someone enters the trigger?
yes
You mean if client 1 enters trigger ,
will that activate trigger to other clients?
Yes
I only want the rain to appear to people who are in or have been in the trigger
It will activate only there where player enters in trigger.
you can just add
//Condition
player in thisList
//on activation
// Your local rain setup
So it will locally execute current event.
Are Arrays faster than HashMaps? Even if items are accessed in random order?
i guess that depends on how do you use them. if you need to search for something in array then hashmap would be faster
Indeed, how are you going to use them? HashMaps have O(1) lookup time (i.e. the lookup time is constant instead of being dependent on the size of the data structure like in case of array)
Array also has constant lookup time, if you know the index you're looking up.
What order you access items in doesn't matter
Correct me if I'm wrong, but one caveat of this solution is that since Server Only is not checked it means that if a player JIP, then the trigger becomes "reset" (since the JIP brings in his own copy of the trigger). Thus leading to a situation where it could be activated again, which might be undesired behavior.
Its created locally on client
So it doesn't affect to other clients/ server.
Trigger is local on client where it's created.
So it doesn't reset other trigger that is local on other clients.
So in my example this is what would happen:
Player A enters the trigger (local rain for player A).
Then player B joins the game. Player B enters the trigger (local rain for player B).
Doubt this will work, client will sync weather with server automatically.
Yes,
Because player A is not player B on player B client ,
So player A client trigger with condition player in in area trigger will be only activated and only on client A when player A enters in trigger area .
So when using player in condition.
And now some else can do some clarification what I just wrote π
I was kinda curious. Since HashMaps could be used to group related variables with string based key representing variable name. SQF does not have any structs like C does have.
I'm at my wits' end with removing unused aircraft pylons and I need some help.
For some reason, when calling as a vehicle respawn script (referencing _this select 0 in the BIS vehicle respawn module), the following lines seem to have no effect, but work perfectly when executed separately in launcher console:
{_plane removeWeaponTurret [_x,[-1]]} forEach [
"Missile_AA_04_Plane_CAS_01_F",
"Rocket_04_HE_Plane_CAS_01_F",
"Bomb_04_Plane_CAS_01_F",
"Rocket_04_AP_Plane_CAS_01_F"
];
interesting read (new feature): https://community.bistudio.com/wiki/createHashMapObject
whats launcher and where is _plane defined?
Oops, typo, meant console. _plane is the 0 param for [_this select 0] call av6_fnc_setPylons as called from the vehicle respawn module.
The same function also adds the new loadout, and that part works as intended. I'm just left with the empty pylons from the default loadout, despite the code I pasted here.
Hi, anybody know how to make onPlayerKilled.sqf and onPlayerRespawn.sqf to work properly for 20 people on the server?
What's the issue?
My general advice would be to read up on https://community.bistudio.com/wiki/Event_Scripts and note that onPlayerRespawn may or may not be called on newly created units depending on if you've got respawnOnStart set in description.ext
hard to say but you should debug your variables and have script errors turned on hint format ["PLANE IS: %1", _plane];
This is it. When even hinting or systemChatting the name didn't work, I double checked and realised I was editing a copy of the actual function. I got it to work now. Thanks!
This is quite interesting, however I'm not fan of that string based syntax, but better than nothing I guess 
Is there an event handler I could use for a certain type of vehicle being close to a unit?
Unless you count attaching a trigger to it, no.
hello! I'm looking for a way to write a function that would put an argument object into one of three categories:
- Vehicles - any car, plane, truck etc that a player can ride in.
- Crates - any object that can not be controlled but that has inventory.
- Props - any object that can not be controlled and does not have an inventory.
I'm checking the wiki and there seems to be no methods like "hasInventory" or "canBeDriven" so I'm a bit lost here. What would be the best approach?
For vehicles I went with fullCrew [_object, "", true] isNotEqualTo []
That does include statics. You could check directly for a driver slot otherwise.
https://community.bistudio.com/wiki/isKindOf might also be useful
isKindOf will generally work but inheritance doesn't strictly determine anything.
object isKindOf "Crate" ```
might work? π€
I was thinking about using isKind of but then the question is which classes to use
I dunno is there a class "Crate" that all crates inherit from? π
me neither
seems like it does return empty seats, yep that might help with vics
Your idea of having seats etc checks is likely a better option
There's probably a better way with config lookups but I couldn't be bothered to figure it out at the time. That stuff is poorly documented.
Hello, I try to do temporary black screen to be able to make some changes to objects in the background.. I was able to do it in sp/localmp but if I try to edit the script for execVM and remoteExec the script doesn't work at all on the dedicated server do you know how to fix this script ? (black screen for all players in a certain circle or at least for all players...)
Object init:
call{tr1 addAction ["Renive barricade", {
[] execVM "scripts\blkfade.sqf";
tr1 say3D ["music4", 1000, 1];
["scripts\strombarik.sqf"] remoteExec ["execVM",2];
}]
}
blkfade.sqf:
["", "BLACK FADED", 0.30] remoteExec ["titleCut", 0, true];
[1] remoteExec ["fadeSound", 0, true];
hint "Script TEST"; // Test Hint
Thanks π for any hint .
private _hasInventory = getNumber (configFile >> "CfgVehicles" >> _objectClass >> "maximumLoad") > 0;
@frozen seal this could tell you if it has an inventory
Then with the has crew idea
yeah, maximumLoad is the most plausible one I could find.
You can work out if itβs a vehicle or a βcrateβ
Anything else is a prop per your theory π€·ββοΈ
well.. I have myself made a mod that had an item with maximumLoad set to 0 but the inventory would still open for some reason π
Though for my purposes it does not really matter, if maximumLoad is 0 the inventory would always be ampty anyways.
thanks!
You might need to check for existence of maximumLoad to work around the zero issue.
Objects that don't have the inventory action don't seem to define it at all.
So isNumber rather than getNumber? Behaviour for missing entry isn't documented.
maximumLoad should always be a number if it exists, so if it either does not exist or if it's set to 0 - it's a prop
it returns the default iirc
e.g 0
I guess
getNumber does, yes. That's also not documented but well-known. Not sure what isNumber does.
return false if not present I believe, that would not make any sense if it returned true but I feel your SQF experience asking π
what can be done to prevent player running around naked for others? - seems to happen if people spawn in vehicles
. . . clothes
there seems to be a script issue somewhere, so a fix would be in order - now to tell you what to fix, that is on the mods/scripts you use
i see
All the isX commands return false if the property isn't defined or isn't the specific type
I am having an issue with my script. then end goal is to give everyone (MP) the intel after a timer goes. But I am not sure how
player createDiarySubject ["cryptoKey", "Crypto Keys"];
player createDiaryRecord ["cryptoKey",
["Public Key",
"-----BEGIN PUBLIC KEY-----<br />MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMYejiS/zTosFFUWo8CWh7KJGh<br />+4kL+yd4AOGWCGquQiE7FEHBD4R6Y0aXb6Gf5iorsZIa+zpDFGN2dKy9/c9ttGZ4<br />6EphJWE4X6tfHcVdc9fVsWpsFwwwg4a11uVkfaIamloCyPalh9fKhZXHPle7lDM/<br />5lrEHByLu0w+THQbKwIDAQAB<br />-----END PUBLIC KEY-----"]];
};```
You could place this in an activation field of a trigger with a timer when you want it to go off? Condition could be any player present?
so theres a trigger already to do a countdown so long as they are in the trigger area
So you want that code to run at the end of the countdown correct?
ya and i got the timer to go and it does give the intel, but only to the person in the trigger, i want it to go to every player in the server
[player, ["cryptoKey", "Crypto Keys"]] remoteExecCall ["createDiarySubject", 0, true];
[player, ["cryptoKey", ["Public Key", "all that shit"]]] remoteExecCall ["createDiaryRecord", 0, true];
I don't know the diary API so I'm just replicating the local effect. remoteExecCall ensures that the two commands are executed in order.
JIP enabled because you probably want it to apply for players who join later too.
Ideally you'd change it to server execution.
Otherwise that's a lot of crap being spammed into JIP.
sorry im kinda new at this, what ya mean
Change the trigger to server only, make sure it triggers on any player, and remove the hasInterface condition.
ahh i see
The more proper way to do the remoteExec there is to create a function that runs the createDiarySubject and createDiaryRecord, and remoteExec that instead. But if you're working from the editor then creating a function is a bit of a stretch.
why is the output of exportJIPMessages so cryptic?
Security
hello Awsome Arma 3 friends; What would be a good way to implemant the briefing, i have a briefing sqf, and i execVM it from the init.sqf is this the best way or is there a better way
or is that what John Jordan is saying up there
initplayerlocal.sqf
waitUntil{player == player};
call Your_Briefing_function;
That's how i used it.
init.sqf runs on client and server, can be used but better to just put it into initplayerlocal.sqf imho.
ok cool thx man awsome
so if i want my briefing to work in SP MP and DED i would still need to exec it in init.sqf i found
Why initplayerlocal.sqf wouldn't work for briefing? Just recently tried it on SP and listen server
in the Editer the player as in SP is the server so i didn't see the briefing when i had it in the initplayerlocal.sqf
that might be cuz i didn't pbo the mission file
and was just playing it from the Editer
im not really sure
or maybe i need if (!hasInterface) exitwith {}; at the top of my briefing .sqf
put that line in init.sqf. IMO init.sqf is best for scripted briefing
or in briefing .sqf but point is to use init.sqf because it always triggers
copy that brother
thx @proven charm i trust eveything you say, you are one of the great people in here imho
np
I might launch the game just to re-test it. I rally didn't notice any issues with briefing not appearing when calling createDiaryRecord from initPlayerLocal.sqf
hello, im doing a script where all civilen "damage" is heavely punished.
I want to add an dammage or handleDamage to every civilian house in a large area ( like 4 or 5 km2)
its too heavy to do this? its quite inexpensive ?
will be only on the server side
I'm using the following code to paradrop vehicles for my halo jump mechanic, which I derived from BIS_fnc_curatorObjectEdited (maybe modified by CBA?): sqf private _pos = getPosATL _unit vectorAdd [0, 0, 1]; private _parachute = createVehicle ["B_Parachute_02_F", _pos, [], 0, "CAN_COLLIDE"]; _parachute setDir getDir _unit; _parachute setVelocity velocity _unit; _unit attachTo [_parachute, [0, 0, abs (boundingBox _unit # 0 # 2)]]; But under windy conditions, the parachute will blow sideways and land on the ground at an angle. After the parachute collapses in this situation, the vehicle is usually banked into the ground and either flings into the air or explodes. Is there a better way to paradrop vehicles?
for something that affects all objects, i would consider using a mission event handler for this instead, perhaps EntityKilled? for example:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled sqf addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator"]; if (typeOf _unit in ["some civie house type"]) then { // ... }; // You could also check for civilian kills here: if (side group _unit isEqualTo civilian) then { // ... }; }]; It's simpler, but it won't tell you if a building was partially damaged
I solved this by running ray check under the vehicle, then detaching the vehicle
ah, lineIntersects? ill look into that
i think i got the name of that command wrong, but i know i used a similar command for my signal flares
(oh nvm, i mistyped it in wiki)
private _z = boundingBox _vehicle # 0 # 2;
private _pos = getPosASLVisual _vehicle;
private _pos2 = _pos vectorAdd [0,0,_z];
if(lineIntersects [_pos, _pos2, objNull, _vehicle] || getPos _vehicle select 2 < 2) then {
detach _vehicle;
//systemChat str "detach";
};
you didnt need to ignore the parachute object as well?
I have it above the vehicle so it doesn't matter
you can include it into command if you want
yea, but builings in arma are a litte more stronger than i like to ( al least CUP ones )
Probably super late to the party but I'm really glad SQF now has "map" (functional programming sense, not cartography) π https://community.bistudio.com/wiki/apply
There's select <code> too now.
_x is local variable within the forEach, I don't think it exists within addAction code
You can sent it to addAction by argument
https://community.bistudio.com/wiki/addAction -- arguments param.
}, _x select 1, 1.5, false] and in addAction code createVehicle [_this select 3,
if your bb_asset is not defined in editor that will error because bb asset doest exit .
And if you are creating MP environment, then your bb_asset is only defined on the client where you use addaction.
Other clients variable doens't exist if you don't do PublicVariable of it
or yes, if you want a player to spawn only one vehicle at a time (bb_asset), it works.
And it will delete the last spawned vehicle (bb_asset) when spawning a new one.
Don't know how you want and where (SP or MP) and how to limit and for who
I might not be getting this, but as far as I see I need to run addAction on every player his/her arma to add an action to an object (https://community.bistudio.com/wiki/addAction). Am I correct with this assumption?
So when I use lookAt the AI turns upto the point it can see the target I'm referring to, meaning, not the whole body is turned towards the target. How do I go about this?
Essentially, I want unit A to have its whole body and head face unit B regardless of where A and B might be located.
I tried getRelDir, using vectors, atan2 and none seems to be working.
you can use getdir to get the angle _azimuth = player getDir tank;
I did, and it still does not face directly against the player. The AI tunrs upt until the point where its head can visually see but not fully turned ot face the player head-on.
setdir?
Used setDir, setFormDir, lookAt, doWatch, and sqf _ai lookAt (unitAimPosition _pla1 vectorAdd (velocity _pla1 vectorMultiply 0.2));
Theres always a 15 - 30 degree offset
weird if setdir doesnt work. maybe you need to disable the AI features to make it stay at the set direction
yes
effects: Local
in fact, to quite from the linked page: This command has local effect. Created action is only available on the computer where command was executed.
How about placing an object further away from the tank and having the AI look at the object instead. Keep adjusting it until it a appears as if the AI is looking at the tank?
Thats the problem, lookAt and doWatch both induce between 30 - 72 degree offset from the actual target.
Ah I see, so it might look right one time but not other times because the range of offset varies.
Yea it looks perfectly at the target for like 1 frame, and then immediately turn to a random offset range throwing off the time. I'm essentially looking at a laser cannon AI track the player and shoot after 10 seconds (kind of similar to how it is in Example 3: https://community.bistudio.com/wiki/lookAt)
But the onEachFrame would be costly (and I don't want continuous tracking, just select a random player, set the cannon's direction towards the player, and shoot)
Ok. Thanks! I'll start abusing the hell out of bis_fnc_mp. π
hello,
any one know how to disable UAV markers ?
I'm able to hide almost all blu markers (custom difficulty, disableMapIndicators)
but the uav (darter) drone still show up
clearGroupIcons probably
thanks for the hint, I'll try
nope, the uav marker seem to be different from other markers (unit, unit in vehicle)
even in Veteran they are show ?!
I'll try
groupIndicators = 0
friendlyTags = 0;
mapContentFriendly = 0;
(in custom diff),
- disableMapIndicators
- setGroupIconsVisible
with no luck
as soon as the drone have a crew there is an icon (representing the uav)
when the uav is unmanned the marker gone
makes sense because its the crews group that has the icon, not the uav
i guess π
ok, and how to hide/disable the icon when the uav is crewed ?
hmm, there is something else with the uav
I'm able to hide a truck (or any other vehicle) with ai in it, but not the uav
the uav marker seem to be show, no matter what you try (and work for any other vehicles)
you used clearGroupIcons for the group right?
yes, and it work for others vehicle
hmmm
ive got similar problems before. what i did was just call clearGroupIcons in loop π
i think that worked.....
hehehe, dirty trick :), but even with that icon still show !
{ clearGroupIcons _x } foreach (groups west)
should do the job ?
I'll try, no luck (work for other vehicles)
ok
the uav marker is something 'special' π
seems so
thanks for the help anyway
np
I'm working on yet another magazine repack function, and I noticed there was a recent addition to magazinesAmmoFull including the "magazine id" of each entry returned. Is it possible to use this ID to remove that specific magazine from the player, or will I have to suffice with removing all magazines and adding them back?
https://community.bistudio.com/wiki/magazinesAmmoFull
setDir works but AI will turn away from it, because that's not how they aim. For our grenade code I used setDir + disableAI "MOVE" to get them to throw the thing in the right direction.
So the AI can still shoot weapons with disable AI move?
If you use forceWeaponFire, sure
They also will if you walk in front of their gun. MOVE doesn't stop their combat behaviour, it only prevents them from moving.
I forget whether I tried using selectWeapon on "Throw" instead.
Is there a way to see how many hours you have on a particular mission file?
I'm curious how many hours I've put into mine.
Excuse me scripting people, i have a friend that wants to learn scripting/coding for arma, any of you know any good tutorials they can follow?
there are no good up to date ones really
just start with small things, keep wiki open at all times, ask questions here
Some people like this site http://foxhound.international/development.html, and http://killzonekid.com/ has alot of good information
As with any programming/scripting, nothing beats playing around with it
the identity is "Kerry" but the head = "KerryHead_A3"
βοΈ That has all the identities but not the name of the heads....
Is there a command I can use to find out a character's head name?
Just look up some configs. Why you need to know head name?
To make custom identities
example: ```sqf
displayname = "Jack";
texture = "val_tat_b\data\MacTavish_co.paa";
head = "DefaultHead_A3";
identityTypes[] = {"Head_NATO"};
author = "Val";
material = "val_tat_b\data\MacTavish.rvmat";
disabled = 0;
materialWounded1 = "A3\characters_F_EPB\Heads\Data\m_IG_leader_injury.rvmat";
materialWounded2 = "A3\characters_F_EPB\Heads\Data\m_IG_leader_injury.rvmat";
textureHL = "val_tat_b\data\Taurus_handslegs_co.paa";
materialHL = "val_tat_b\data\Taurus_handslegs.rvmat";
textureHL2 = "val_tat_b\data\Taurus_handslegs_co.paa";
materialHL2 = "val_tat_b\data\Taurus_handslegs.rvmat";
impressive that there is no getter for heads and nobody asked for it
Because you simply get it through config
I'm using this code to place a file cabinet in 3 random positions using invisible helipads. The issue I'm having is that some get placed backwards or at weird angles relative to their surroundings (like backwards against a wall). I tried to hold shift and orientate the helipad in the editor to see if it did anything (it did not). Any ideas how to solve this?
if (!isServer) exitWith {};
this setPosATL (getPosATL (selectRandom [obj8_1, obj8_2, obj8_3]) );
Use setDir and getDir
Thanks, if I setDir, I'm guessing that it would work for one of the random spawns but might look weird for the other two. How could I make it know which spawn it's at? Maybe like some if statements in the object's init perhaps?
You want to setDir using getDir's of obj8_1 etc, no?
I'm probably misunderstanding but let's say I getDir of of the position I like. Now when I go to setDir it should look correct for the "spawn" I tested it in. But if it ends up at a different "spawn" it might look weird because it would need a different setDir there, right?
What's your attempt?
See how this is misaligned from the wall? You are saying I use setDir to place it properly, right?
Urm, I meant your code
Well that's fine for this house it is in. But it could spawn in two other houses which probably wont work for the setDir of the first house.
Oh I posted the code above. I was asking for direction of how to solve this issue.
Ah I see
Point is, if these obj8s are meant to get pos and dir, you can use getDir. However you need to reconstruct your code a bit since you don't want to selectRandom it twice
So store the selectRandom'd obj, use it to getPosWorld and getDir
if (!isServer) exitWith {};
this setPosATL (getPosATL (selectRandom [obj8_1, obj8_2, obj8_3]) );
if (getPosATL obj8_1) then {setDir XYZ};
if (getPosATL obj8_2) then {setDir XYZ};
if (getPosATL obj8_3) then {setDir XYZ};
Maybe something like this in the obj8 init?
One moment while I read your suggestion/
if (getPosATL obj8_1) then {setDir XYZ};
```the `getPosATL obj8_1` doesn't return a boolean
if (!isServer) exitWith {};
private _selectedObj = selectRandom [obj8_1, obj8_2, obj8_3];
this setPosATL (getPosATL _selectedObj);
if (_selectedObj isEqualTo obj8_1) then { this setDir XYZ1; };
if (_selectedObj isEqualTo obj8_2) then { this setDir XYZ2; };
if (_selectedObj isEqualTo obj8_3) then { this setDir XYZ3; };
That should work I think
Oh urm... why there is XYZ1 etc?
Nice. Now how do I get the position value in the editor?
I guess they're just placeholder values (?)
those are just placeholder as I try to write this code here.
I guess my next step is to find what those values are. I wonder if I can grab them from inside the editor.
I actually thought you wanted to use obj8 etc to get both pos and dir
One easy and obvious way is, open up the preview and check getDir and getPosWorld return values
Does "preview" mean to use the console commands once I'm in game? Yeah I think I see what you mean
Yes, big bottom right button
Thank you both for the help. This should keep me busy for a bit.
@tough abyss I think this would work [player,['My action',{hint 'hello world';},nil,0,true,true,'','true']] remoteExec ["addAction", -2];
There is also a ghetto/less secure way [{player addAction ['My action',{hint 'hello world';},nil,0,true,true,'','true']}] remoteExecCall ["BIS_fnc_call",-2];
Is there any way to hide Miller's hair while he is wearing a cap/helmet?
No
I guess one could brute force their way into changing to a hairless identity with an inventory closed event handler
I hope changing identities mid game on a MP match doesn't cause issues thou
Hi. I'm trying to add the custom asset list to the game arma 3 - warlords, it looks impossible. I've seen all manuals and watched all youtube tutors (there arent many), but still cant edit a single thing in the asset list.
Got any idea?
Why BLU_F and OPF_F? Wiki shows that it should be WEST and EAST: https://community.bistudio.com/wiki/Arma_3:_MP_Warlords
I have no idea how Warlords works but just a glance at configs suggests you have to use WEST and EAST too
fn_WLParseAssetList.sqf:
if (typeName _target == typeName sideUnknown) then {
{
_entries append (configProperties [configFile >> "CfgWLRequisitionPresets" >> _x >> str _target >> _type]) + (configProperties [missionConfigFile >> "CfgWLRequisitionPresets" >> _x >> str _target >> _type]);
} forEach BIS_WL_shoppingList;
} else {
{
_entries append (configProperties [configFile >> "CfgWLRequisitionPresets" >> _x >> str (side group _target) >> _type]) + (configProperties [missionConfigFile >> "CfgWLRequisitionPresets" >> _x >> str (side group _target) >> _type]);
} forEach (_target getVariable "BIS_WL_requisitionPreset");
};
Yeah, you must use stringified side as config name
BLU_F and OPF_F are faction names, not sides
Is FSM an appropriate method for mission flow handling in multiplayer scenarios?
I've no experience yet but since the code isn't scheduled it seems like it might be very heavy on resources.
Yes
I think watching KKs Scripts without the basic knowledge is like pumping yourself Heroin, when you just smoked Cigarettes before π
(overload)
personally i dont use FSMs
and im making a mission
but i use HashMapObjects for everything π
Hi, Id like to write some Ais behaviors and it seems to me that they are usually done with FSM files. I didnt read so much things about that. Id like to know what differences, gain or advantages makes FSM scripting vs SQF. Then, the way to integrate a FSM file in some working environment (init.sq...
yeah
scheduled is always the way to go imo
i run my entire AI Commander in SQF yeah its 2k lines but honestly could just break it down into a diagram yourself in Paint while your coding and leave in it in ur files for people to find so they understand.
i.e i left a huge readme for mine
like ye technically FSM is scheduled
its really up to the readers opinion
since HashMapObjects exist i dont see any reason to NOT have a giant 10k line HashMapObject
because the methods are clearly defined.
@keen stream use remoteExec
I'm trying to use an array of possible magazines in order to get a count of how many mags the player has that fall within the array, but it's not returning the value, instead it is stuck at 0.
Below is my initPlayerLocal.sqf:
[] call SOCOM_Vests_JPC_fnc_reloaded;
[] call SOCOM_Vests_JPC_fnc_take;
[] call SOCOM_Vests_JPC_fnc_put;
[] call SOCOM_Vests_JPC_fnc_arsenalCheck;
missionNamespace setVariable ["SOCOM_Vests_JPC_ArsenalOpen", false];
SOCOM_PrimaryMags = [
"TOTT_PMAG_Blk_30rnd_A1",
];
missionNamespace setVariable ["SOCOM_PrimaryMags", SOCOM_PrimaryMags];
Then in my fn_countMags.sqf I have this to get the mag count:
private _totalMags = count (magazinesAmmo player select { (_x select 0) in _trackedMags });
Not sure wehre I'm going wrong here.
Hard coding _trackedMags with just the class name works fine, but I want to have an array of possible mags to be tracked.
When does countMags run?
do you have script errors on?
As it might be a timing issue?
Can you add a check into countMags to print out the result of _trackedMags
That , is the primary suspect, but also keep in mind that in is case-sensitive - check and double-check that your specified classname is exactly correct.
It's set to run after the Put, Take, Reloaded events, and when the user is in the ACE Arsenal it runs every 0.1s
This check should allow us to determine which of the issues it is.
So I have this under the trackedMags:
systemChat format ["Player has %1 primary mags", _totalMags];
It just says I've 0.
The array is just one item, I just wanted to make sure it actually passess the class name correctly.
You need to fix that trailing ,
In which part exactly?
In the array of tracked magazine classes
Then in my fn_countMags.sqf I have this to get the mag count:
systemChat str(_trackedMags);
private _totalMags = count (magazinesAmmo player select { (_x select 0) in _trackedMags });
Can you do this for me regarding the countMags
Iβll let Nikko do his part first
In SQF, , is used to separate elements in an array from each other - if there's no element after it to be separated, it's not valid. So you can't have a , after the last element in an array. This is a hard blocker and will cause a script error.
Stand by, booting up
So nothing at all comes up in the chat, and putting it into the debug console when in game and executing: systemChat str(_trackedMags); doesn't display anything.
Fixed the trailing ,. Same issue persists
Disrgard, an empty array is returned
What's in SOCOM_Vests_JPC_fnc_arsenalCheck?
["ace_arsenal_displayOpened", {
missionNamespace setVariable ["SOCOM_Vests_JPC_ArsenalOpen", true];
[] spawn {
while {missionNamespace getVariable ["SOCOM_Vests_JPC_ArsenalOpen", false]} do {
[] call SOCOM_Vests_JPC_fnc_countMags;
sleep 0.1;
};
};
}] call CBA_fnc_addEventHandler;
// Event handler for when the Arsenal is closed
["ace_arsenal_displayClosed", {
missionNamespace setVariable ["SOCOM_Vests_JPC_ArsenalOpen", false];
}] call CBA_fnc_addEventHandler;
I gotta get going to work, if you have any ideas just @ me so I'll be able to catch your messages when I'm back home. Appreciate the help
_trackedMags being empty indicates that SOCOM_PrimaryMags is undefined, and the getVariable is using its default value. But we can see SOCOM_PrimaryMags being defined here.
Possibilities:
- something in one of those called functions is broken or has an inline suspension, which prevents everything after that in initPlayerLocal.sqf from being run
- something is overwriting
SOCOM_PrimaryMagswith[]ornil
Notes: - You don't need to
setVariableSOCOM_PrimaryMags. A global variable (no_prefix) is a missionNamespace variable by default, so doing thatsetVariableis effectively the same asSOCOM_PrimaryMags = .... You'd only need thesetVariableif you wanted to change it from local to global, set it in a different namespace, or use the network broadcast feature. This shouldn't cause the main issue, though.
Is there a way to apply Depth of Field effects that are used in Splendid Camera to a player (ie without the camera open)?
I'm trying to get a vehicle to have it's texture changed when it's respawned, but I can't seem to get it to run the script - It's always the default appearance.
running the function outside of this expression field works fine, so I don't know what I'm doing wrong.
Those are params.
instead of newVehicle try (_this select 0)
So
[(_this select 0), ["Bluefor",1],true] call BIS_fnc_initVehicle
this select 0, select 1 element from the array (params ["_newVehicle","_oldVehicle"])
Thanks!
Hasn't worked, sadly :(
Here's the vehicle respawn module, synced to the mrap
@nocturne bluff I'll take a stab at it.
If you're looking for this (vanilla Strider HMG), you might want to name it "Blufor" instead
Either of the two examples I posted in response to Quiksilver should work for you @keen stream
How do I open the player's inventory while they're in a vehicle? I've tried the following:
https://community.bistudio.com/wiki/Arma_3:_Actions#Gear sqf player action ["Gear", objectParent player]; But the inventory dialog doesn't actually show up. FWIW, I noticed Project SFX: Remastered was still able to play their inventory sound, and looking in their source code, they're using the InventoryOpened event handler so that likely fired, but my magazine repack system relies on the opposite InventoryClosed handler to know if it should stop repacking the player's magazines.
Hey! Anyone knows how to remove sectorpopulate in warlords without having to remove INF_F from warlords init bcs it throws a ton of errors into log? I mean it works like this, but it's impossible to find other errors in the log bcs of it
this worked for me: (vehicle player) action ["Gear", objectParent player];
huh, performing the action from the vehicle worked? that's odd
but apologies for not editing my message earlier, i figured out it works if you replace the command with actionNow, which i guess makes sense, you aren't supposed to perform the inventory animation inside vehicles
another bug squashed :)
@keen stream same as bis_fnc_mp just a command version of it
You can set all the settings at once with https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/master/addons/core/functions/fnc_setSwSettings.sqf
Your issue is because you're not setting the frequencies on the specific radio that a player has, but the basic version
I.e. You're using TFAR_ANPRC152 instead of TFAR_ANPRC152_x where X is the id of the radio they have
what's "local hint" in the code above? π€
whats the purpose of CBA_missiontime ? have a synchronized time between all the clients ? Its not the same as serverTime ?
If I would really need OOP I would use them too, but I can't seem to like string based(keys) syntax HashMaps have compared to syntax in languages like C++/C#/Java. It does not seem to make like it is clearly defined, when members and methods are called using strings.
That being said I'm still happy that we have OOP at least at some form in SQF.
Nevermind, apparently this was recently changed
ok, thanks
biggest reason is, they are lightspeed fast
in SQF.
syntax doesnt bother me but i coded in LUA with Classes which is basically OOP
everything is oop there iirc for games like Supreme Commander FOrged Aliance which Lua 5.0.1 (Moholua specifically)
having HashMapObjects is what got me into coding in SQF
hello!
I am a bit confused about functions like setRain and setOvercast.
For most of them wiki tells that they have local effect, however there is also the forceWeatherChange that is supposed to be executed on the server?
If that's the case, how do I go about changing the weather from scripts? Should I first call all the set- commands locally for all clients and then fire forceWeatherChange only on the server?
Or will forceWeatherChange force the server to broadcast weather parameters?
Weather is synced with server
from the server.
All the weather functions are effectively server-effect in A3, I think. Some of them will have temporary local effect.
so I should call all the set- functions on the server and then fire forceWeatherChange to sync it?
How often does weather get synced? Is that several seconds?
forceWeatherChange just shortcuts the transitions, I think.
Hey, got a question for you @still forum!
I'm parsing through old TFAR files on GitHub and found this function, fnc_initRadioTower.sqf
https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/master/addons/antennas/functions/fnc_initRadioTower.sqf
Any idea what it does?
Does it basically just initialize a radio repeater?
overcast sync is broken tho, clients can have different values
https://feedback.bistudio.com/T183693
Anyone know if there is a way to apply the focus effect to a players view? Like this, but not specific to a camera: https://community.bistudio.com/wiki/camSetFocus
no can do, AFAIK
Any chance of that being introduced?
Could be cool for night vision. You could apply focus to emulate lens caps, or focusing on nods.
Can one group have multiple formation leaders?
Wish you could just disable engine sync and handle everything yourself
like you could in OA
isnt that what the teams are for? https://community.bistudio.com/wiki/assignTeam
not what I meant - formation leaders aren't controlled by the player if I understand it right.
They're what controls who the AI follow in a formation.
You can have multiple formations if you for example give move order to multiple units in your group or to achiev this by scripting I belive that's what doFollow command is for @visual epoch
gotcha ,thanks!
They are not old. Yes repeater.
Heya I have the following code, unluckly for some reason the EVH never triggers. Anyone got some Ideas? Feel free to ask for missing context!
private _group = createGroup [EAST, false];
_group addEventHandler ["EnemyDetected", {
params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
diag_log format ["EnemyDetected! - _this: %1", str _this];
}];
The Player that should trigger the Script is CIVILIAN sided with the following known Changes:
EAST setFriend [CIVILIAN, 0];
player addRating -1e20;
You can't make east consider civilian as enemy, IIRC.
civilian has some hard rules. It's not as flexible as the other three factions.
Sad me, thanks to responding
So I have an object that has an addAction, which then calls a function
I have a variable defined in the init of the object
The function gives me an undefined variable error when its called
https://feedback.bistudio.com/T163827
There is a BI internal ticket associated, so it may happen in the future
The object/addAction:
this setVariable ["meth_cooking", false];
this addAction
[
"Cook Meth",
{[player] call drugsys_fnc_cookMeth},
nil,
1.5,
true,
true,
"",
"(playerSide == civilian);",
5,
false,
"",
""
];
The function:
params ["_labObject", "_isActive"];
_labObject = "meth_table";
private _isActive = _labObject getVariable |#|meth_cooking;
// Err - undefined variable in expression here ^
if (_isActive) exitWith {hint "ERROR: You are already cooking meth!"};
getVariable requires a "string" for the variable name
explains why it was working in debug.. i had quotes in the console 
You have other problems with this function though
im open to any pointers, im new to this type of stuff
i can already see a few
- The function requires 2 parameters,
_labObjectand_isActive, but when you call it you only pass 1, the player who activated it - you then overwrite the
_labObjectanyway...with a string, which you then try to use for things you can't use a string for
a long time ago one of my friends told me that defining stuff using params or private was pretty much the same for my use-case. i suppose it was just easier than defining everything was private., just not proper. whats the difference between the 2 use cases?
Change [player] call drugsys_fnc_... to [_this#0] call drugsys_fnc_... - this will pass the object the action is attached to into the function. (There's more to this but I'm going to answer your question first)
private is used to define new private variables that didn't exist before, either with no value or with a specified value.
params is used to extract elements from an array into new private variables. If no array is given, it automatically parses the auto-generated variable _this, which contains any arguments that have been passed to the current script.
In the function, replace the first 2 lines with this single line: params ["_labObject"];
This means we are now only expecting one argument, and we don't immediately overwrite it with an unhelpful value.
Sorry, I only say that because TFAR Beta has not had an update in quite a while π
Legend though- do you have to be next to the repeaters for them to work?
Or will they amplify any signals they recieve?
i really appreciate the help nikko, but my code was total spaghetti when i sent it and i think it may be leading you down the wrong rabbit hole
i dont think at this time im at the point where i need to be passing anything to the function
i removed [player] to blank and it still worked 
private _methlab = meth_table;
_isActive = _methlab getVariable "meth_cooking";
if (_isActive) exitWith {hint "ERROR: Someone is already cooking meth!"};
this is working fine now
(I already wrote this and it's useful information so I'm just hitting send)
It's not essential, but I'd suggest using the other syntax of getVariable, which allows you to specify a default value that gets used if the variable isn't defined (I recommend false in this case). That way, you don't have to bother doing the initial setVariable, because your getVariable will simply assume it's false until you specifically set it to something else.
this syntax?
varspace getVariable [name, defaultValue]
That will work, but the issue is that it's not easily reusable. You've hardcoded it to only refer to a single specific object. Using params and arguments allows you to use the same function for any object you like, without needing to change the code or have copies of it.
Yes
I see what you mean. i will try to write it up and get it working using params (getting used to passing arrays would be useful)
the last alpha update was a bit over a month ago.
They repeat the signal they receive, if signal with 10% signal strength reachess them, they'll repeat the garbage they are receiving
So the way I just went about it is that I just put trackedMags as the array within the countMags function, and it works fine. Hack-ish type way of doing it, but if it works, it works.
do bleed tickets/respawn tickets actually work or nah?
I move this object with the following code. In the object properties I have simulation enabled. So why is it still floating?
this setPosATL (getPosATL _selectedObj);
Not all objects have gravity
If I put the invisible helipad on the ground then the car in half inside the terrain. How could I make it so it looks normal?
You could try orienting it to the terrain
See the example on https://community.bistudio.com/wiki/setVectorUp
Thanks I'll give that a shot!
@native hemlock Looking at it now π
I meant on Steam Workshop, I don't follow TFAR development too closely
And ah, awesome! That's actually super good to know, thanks!
Sometimes setDir works and sometimes it doesn't. I can't figure out why. The code seems simple enough:
private _selectedObj = selectRandom [obj9_1, obj9_2, obj9_3];
if (_selectedObj isEqualTo obj9_1) then { this setDir 96; };
if (_selectedObj isEqualTo obj9_2) then { this setDir 318; };
if (_selectedObj isEqualTo obj9_3) then { this setDir 120; };
this setPosATL (getPosATL _selectedObj);
Are you saying this behaviour is deterministic or not?
I'm saying that I can't reproduce the behavior at will.
wait, where is this code?
Given that the only thing it does is run setDir on a random object, it's probably not the setDir that's the problem.
This is placed in the object init in the editor. Full code:
if (!isServer) exitWith {};
private _selectedObj = selectRandom [obj9_1, obj9_2, obj9_3];
if (_selectedObj isEqualTo obj9_1) then { this setDir 96; };
if (_selectedObj isEqualTo obj9_2) then { this setDir 318; };
if (_selectedObj isEqualTo obj9_3) then { this setDir 120; };
this setPosATL (getPosATL _selectedObj);
if (_selectedObj isEqualTo obj9_1) then { obj9 setVectorUp surfaceNormal getPosASL obj9 };
if (_selectedObj isEqualTo obj9_2) then { obj9 setVectorUp surfaceNormal getPosASL obj9 };
if (_selectedObj isEqualTo obj9_3) then { obj9 setVectorUp surfaceNormal getPosASL obj9 };
It transports a car to 1 of 3 random spots. The Biki said to do the setDir first then setPosATL. After than it does the surfaceNormal so the car isn't inside the terrain if there is a hill.
And sometimes it doesn't set the direction of the car? No dependency on the position?
Hmmm. Let me check that with ADT. I will move the invisible helipad and run the code again in different spots.
Do waypoint IDs change as they're completed, or are they static after they're first assigned?
question, completely new with scripting but i was wondering if anyone has a script that allows me to add teleported in eden
As in you step into a volume and it teleports you somewhere?
i would like them to interact with a terminal
When I change this to the objects variable name obj9 it fixes it.
but a a script where you just get tp'd if u get close to something also works
Yeah, that's easily doable. I can't get to my PC right now, but you can make use of addAction and setPosATL
Are you sure this script is actually on the car, not the driver or the group?
like i said, completely new to scripting so i got no clue what anything is
Sorry, can't write it tonight, but I'm sure someone here will help
all good, thx tho
Yes, it is in the object's init. Furthermore, this object can't be driven as far as I can tell. You can open the doors on it though.
It's not a car? :P
Oh it is, lol. But it seems the SOG:PF devs did not intend for it to be driven. (EDIT: It's because I chose "prop" in the editor) In my mission there's a holdAction on it to search it for intel.
Well it's working now, but idk why I can't use this in the init for it though.
Not really.. I haven't touch BIS_fnc_MP in a very long time and never looked at remoteExec(call) up until now.
Is their a proper/efficient way to have a helicopter pocket you up after all tasks are completed and take you back to base to end the mission?
I'm building a mission and I want it to end with the helicopter pick up, then back to base and mission ending.
Is there an EH or something like that that's triggered when you use the ranging function of an optic?
You can try a userAction EH for "gunElevAuto". It doesn't include information about which optic or FCS is involved though, so you'd need to use other commands as well to find out what the player was doing at the moment of EH activation.
https://community.bistudio.com/wiki/addUserActionEventHandler
@hallow mortar Hi Im trying to spawn a batalion group vehicle using arma commander mode but when i do the camo's i have applied aren't applied when spawning ingame, do u know how to fix this
I don't know anything about "Arma commander mode"
Asking the channel in general is usually better than pinging specific people. I help when I can but I'm not on-call support.
I'd like to remove a communication menu that was assigned to an entire group after someone in the group uses it. What's the best way to go around it? I fear I'll have to keep track of each one somehow.
you mean this https://community.bistudio.com/wiki/Arma_3:_Communication_Menu ?
Yeah. I was gonna include a link to that but the server doesn't allow it for some reason.
ok well its been a while since i played with that but theres this removeAfterExpressionCall = 0;
hth
I know about that, but I am adding the same command menu item to everyone in a group, and I'm not sure if one person using the call would also remove it from everyone else.
Hard to test multiplayer stuff like that
ok
i understand however i was told that changijng class name fixes issue, can i have like a eprate class for a seprate camo
I still don't know anything about "Arma commander mode"
I'm also testing to see if running this monstrosity would do the same.
_unit = _x;
{
[_unit, _x] call BIS_fnc_removeCommMenuItem;
} forEach supportUsers;
} forEach units spear1;```
`supportUsers` is an array of commandmenu IDs from when they're being created.
While this _does_ technically work it also throws a bunch of errors in the function itself - Probably because I'm giving it commandmenu IDs that don't exist on the given unit, too.
Probably best to limit these things to single persons in the future, huh.
can you post the errors?
You are sending unit and unit in function.
Not unit and index
how do usetg a global trigger
_unit = _x
And your _x is unit
[_unit, _x] ,
So is same as
_unit , _unit or _x,_x
There's a nested forEach loop, the outer one saves _x as _unit, but the inner one overrides the _x, no? Unless I am misunderstanding the order here.
That's a very broad question. Global triggers have many uses, and many ways to use them. It's more important to know what the actual objective is that you want to achieve.
More important for someone else to know, that is. Please stop pinging me.
if you really want to use that approach you can just make sure the "loop" hasnt ended: if(isnil "BIS_fnc_addCommMenuItem_loop") then { // bail };
@stable dune Am I understanding this correctly? what would I need to change?
Aa it was nested,
Sorry.
My bad.
Hmm, what item/s are you trying to remove?
sory okay
I have a very aggressive ai spawned in, ti attacks even independent even after setting it to be peaceful, why
Yeah,
Another thing.
Units spear1.
Is a group of players?
And you want to remove from their command menu item?
It's a player group, yeah. I want to remove (all) command menu items from each member.
Then you need to make sure that the event is called on the client since the event is local, so you need to use remoteexec.
I mean if you have player 1 , player 2 , player 3 in group.
And you want to remove from player 1-3 x command menu item(s).
And you need to use _target.
[_unit, _x] remoteExecCall ["BIS_fnc_removeCommMenuItem",_unit];
So it will be executed locally on client,
And you can use remoteexecCall, which is unscheduled
oh yeah that's clever.
I'm still getting used to what should be local and what isn't.
I should probably do the same for adding them.
Yes.
https://community.bistudio.com/wiki/BIS_fnc_addCommMenuItem
If using this.
It has local effect local args
Hm, I have a different problem now.
Executing it remotely means I don't get the list of IDs I was using, because I don't get the addCommMenuItem returns.
It's time to β¨ make a function β¨
You can make a function
Is that really the only way to get around to it?
A function is essentially a script contained in a variable. When you remoteExec a function (that's defined on all machines involved) the target machine executes that script locally. This means you can easily remoteExec complex code that does stuff with its returns.
Functions are super useful and quite easy to make once you know how, so it's worth learning.
The most proper way to do it is with CfgFunctions (https://community.bistudio.com/wiki/Arma_3:_Functions_Library, long page but a lot of it isn't actually important for your usage), but you can also just define variables like this:
my_fnc_someFunction = {
params ["_one", "_two"];
systemChat _one;
};```
and then broadcast with `publicVariable` or `setVariable` if needed.
One thing I am confused about - BIS_fnc_addCommMenuItem is a function and it doesn't return anything when I remotely execute it. How would me creating a function encompassing it change something?
If that function returns nothing, it would still return nothing. I don't think there's anything useful it could possibly return to you, though, so...
sorry, typo. edited
I found a way to cheese it since the IDs are persistent in this case, but I still wonder how this would've changed things.
The advantage is being able to do this (simplistic example):
my_fnc_addAndSave = {
private _ID = [ ... ] call BIS_fnc_addCommMenuItem;
missionNamespace setVariable ["my_local_commItemID", _ID];
}:
my_fnc_getAndRemove = {
private _ID = missionNamespace getVariable ["my_local_commItemID", -1];
[player, _ID] call BIS_fnc_removeCommMenuItem;
};
publicVariable "my_fnc_addAndSave";
publicVariable "my_fnc_getAndRemove";
0 remoteExec ["my_fnc_addAndSave",0];
sleep 5;
0 remoteExec ["my_fnc_getAndRemove",0];
The basic function doesn't return anything when remoteExec'd because remoteExec doesn't transfer returns back to you, from anything - it can't, practically speaking, because it can't wait for an unknown number of other machines to report back. But when you put it inside another function, you can handle the return locally within the outer function. The return doesn't need to go back to the originating machine.
(I have a message with a more advanced, JIP-safe example of doing this. I'm going to find it while you read that.)
This will take a while for me to process so I'm on the same page
#arma3_scripting message
This is about addAction but it's also an ID-based thing, so the principle is essentially the same
I'll have a look at it, thanks
To try and explain further:
When you remoteExec a function, you're essentially telling the target machine to look up its own local copy of the function, and execute it normally - just the same as if there was no remoteExec involved. That means all the normal scripting principles behave exactly as normal, locally to the target machine. The originating machine doesn't (and can't) receive a response, but that's okay, because everything is being handled on the target machine, within the function.
I assume that files tied to the scenario (init, description, other sfm files) are also present and ran on client PCs when "execVM" is called?
Or do I need to run execVM through remoteexec, too?
Just a tip from security perspective: allow execution of your own functions only in CfgRemoteExec by disabling remote execution of actual scripting commands. It will prevent vast majority of (script based) cheats
hey i've never scripted before but am trying to get chatgpt to make me a script where the AI Plane/pilot can't go below 3k meters and cant bomb while below 3k meters, this is the script:
params ["_plane"]; // Reference to the AI plane
private _minAlt = 3000; // Minimum altitude for bombing (in meters)
// Set the plane's behavior to COMBAT to enable bombing
_plane setBehaviour "COMBAT";
// Continuously monitor the plane's altitude
while {alive _plane} do {
private _altitude = getPosASL _plane select 2; // Get altitude above sea level
// If the altitude is below the minimum, adjust the altitude
if (_altitude < _minAlt) then {
_plane flyInHeight _minAlt; // Set the plane's altitude to the minimum
};
// If the altitude is above the minimum, command the plane to drop bombs
if (_altitude >= _minAlt) then {
// Define the target type and search radius
private _targetType = ["Tank", "Car", "StaticWeapon", "Man"];
private _radius = 2000; // Search radius in meters
// Find the nearest target within the specified radius
private _targets = nearestObjects [getPos _plane, _targetType, _radius];
if (count _targets > 0) then {
private _target = _targets select 0; // Select the closest target
_plane doTarget _target; // Set the target
_plane doFire _target; // Fire (drop bomb)
};
};
// Wait for a short period before checking again
sleep 2;
};
};
but am getting getting an error saying "init: missing }" can someone help please?
Everything that's included in the mission folder gets packed into the PBO and is distributed to all machines.
Whether it's executed is different. Event scripts like init.sqf or onPlayerRespawn.sqf are automatically executed by everyone according to their event conditions. Normal script files are executed on any machine that...tries to execute them. Commands like execVM are Local Effect, so they only execute that script on the current machine.
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
It's usually preferred to use functions rather than execVM, because they're more flexible and more efficient.
thanks was trying to do that
And some rule and referring Lou,
#arma3_scripting message
You shouldn't use ChatGPT or other LLMs for SQF. Actually, for anything at all, but especially for SQF because it's a niche language with a lot of game-specific oddities, and they don't understand it at all. They will happily generate complete nonsense that happens to appear plausible.
oh
alright, thanks
yea makes sense
I can't actually spot the syntax error in that one. The setBehaviour and doFire are wrong (plane rather than group/unit) but they'd throw a different error.
Also flyInHeight ASL vs ATL mismatch, and the bombing probably won't work.
hey i have a quick question for any1 that can answer me so i made a unit and the insignia shows on most uniforms but me and my friends use custom uniforms and the insignias dont show at all is this a coding issue ? or is it the uniform just being too big to display the patch ? or soemthing different ? i put this in another channel as well and dont know if this is a issue with uniform scripting or something different
possibly _plane select 2 in the first line of the while loop?
Nikko makes a very good point. I want to add a caveat, though. This is from the perspective of someone who is very new to programming and from the perspective of someone who has 15 years of experience as a mechanic. One thing my instructors taught me in mechanic school was that you can't just rely on scanners to give you the correct diagnostic code on a vehicle all the time. But you can use the codes as clues to help you diagnose an issue. The scanner is a tool.
It's the same thing for ChatGPT. It is a tool. You have to be smarter than the tool to know how to use it correctly. But if you can do that then it can have some benefits. For example, for me, it has helped me understand concepts and even specific commands of SQF. I like to ask it how things work and why it works that way. Then I often cross check this info with people here.
It is not my first source of info (mostly it's the last). I will come here first. But sometimes everyone is asleep when I post and ChatGPT is literally the only source to help me break a roadblock by myself and it has helped me plenty of times. Just remember, be smarter than the tool.
yup you're right, i just tried to get something quick going since the AI was going to like 300 meters and bombing π
I'm trying to make a camera move with unitCapture / unitPlay, and only the movement isnt working. I have my item and
testCamera = "camera" camCreate getPosATL testPos;
sleep 0.5;
[testCamera, testCameraCapture] spawn BIS_FNC_unitPlay;
testCamera cameraEffect ["internal","back"];
This puts the player in the camera but it doesnt move with the capture data. I can use [player, testCameraCapture] spawn BIS_FNC_unitPlay; to move my player on the capture arc perfectly fine; am I missing some sort of fundamental incompatibility or is there a different way to move cameras? (that's MP compatible, I used keyframes to get the movement but its not MP compatible) There also aren't any script errors when using a camera
It's getPosASL _plane select 2 so it's valid.
I have a script for moving boats through positions using eachFrame and setVelocityModelSpace. This allows boats to navigate narrow rivers that AI with waypoints could never do. One small problem is that engine noise does not match the forced speed of the boat. The boat engine is on, but always at the low idle noise. When a player drives a boat and accelerates fast you get a louder noise.
Is there a way to force engine noise louder via code?
ChatGPT does move bad then good, it F's up your thinking
don't use ChatGPT just learn from others and BIS too
plus it leaves things out and F's you up even more
i wish i could use ChatGPT to fix my Golfswing lol hahahaha
canMove testCamera => false
BIS_fnc_unitPlay:
if (_object getvariable ["BIS_fnc_unitPlay_terminate",false] || {_step >= _recordingCount - 2} || {!_ignoreDisabled && {!alive _object || {!canmove _object}}}) exitwith
```this is a condition to stop the playback. Camera "can't move" by itself so script stops the playback
Unless you want to write your own version of the function, you can try spawning some static entity and attaching camera to it
Not sure which will work though, Logic maybe?
hm. okay, that's a good catch. thank you
Spawn logic, spawn camera, attachTo camera to logic, do a playback on the logic
yeah, I used the keyframe camera attached to a game logic unit before for the recording. can probably do it again. otherwise I can just modify the function
Do you have an AI driver there? Maybe give them a waypoint so they at least try to get somewhere and accelerate?
Wish there was a scipting command to set and return RPM
general purpose
Could make scripted events like engine failure, save/playback RPM values like in this example, etc.
Maybe limited to only some sim types if its much of a hassle
Any ideas what do to with units stuck in rocks? It prevents mission from ending, since all enemy units need to be killed
write a script that counts all alive units excepts those inside rocks
consider the ones in rock as dead
simplest way. or move then out of the rocks...
something bad with the AI spawn code (I guess) if they end up inside rocks
There is no big difference in the format. @hasty violet
but rocks are my friend :(
most defensable location!
so thats how you cheat in MP (Gun sticking out of a rock) π
They somehow just walk in sometimes
I've seen AI walking through walls in this game
Or other objects like trees
How to check if they are inside a rock?
first get the rocks with nearestTerrainObjects [_cpos, ["HIDE","ROCK","ROCKS" ], 50];
then loop the rocks against the AI and check https://community.bistudio.com/wiki/boundingBoxReal
if they overlap
(HIDE = rocks btw)
Unit standing right next to rock might overlap too sometimes, but it is still better than stuck units
how would i add an action to a vehicles specific memoryPoint or selection? i want to show the addaction only if the player looks at the rear door
this addAction
[
"Open rear door",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if (_target doorPhase 'Door_4_source' > 0.5) then
{
_target animateDoor ['Door_4_source', 0];
}
else
{
_target animateDoor ['Door_4_source', 1];
};
},
nil,
1.5,
true,
false,
"",
"true",
2,
false,
"", //?
"" //?
];
yes, but i dont know what to enter
well the selection are in the vehicle config so you can use config browser to find them
Or selectionNames
i mean simply type in for example: door4 ? using selectionNames
There is no guarantee that the rear door has selection
door4 stands for rear door but whould simply type in the selection argument door4?
Same answer. Animation name is not selection name
door3 stands for the side door of the "C_Van_02_vehicle_F" and writing door3 as the memoryPoint works but door4 for the rear door does not work π€
okay for the rear door it is: Door4_sound
Is there a page that lists all the BIS_fnc functions and its syntax?
Ah I'm an idiot looking just at the Scripting Commands 
Np, it happens π
I have a scenario with a lot of vehicle units that start out with simulation disabled, but once they're enabled again, I'm having a hard time getting them to follow their waypoints, or move at all.
code?
hello Awsome Arma 3 Friends: So i use getPosASL for stuff above, What about stuff Below sea Level is it still getPosASL
As far as I know, you just get a negative height if it's below sea level
like under water
they should make a getPosBSL he he
so i guess i still use getPosASL and it will give me a like a negative height
if the thing is under water
rgr m8 thx
It's a trigger for OPFOR units. On Activation looks like this: {_x enableSimulationGlobal true;} forEach thisList;
so everyone in trigger gets their sim on?
That's the intention, yeah.
gets there sim on lol thats funny
the units are enabled, I've checked in zeus enhanced at runtime, it's just that they refuse to move their vehicles in any way.
Only solution I found is to have the units start outside of the vehicle and get them to get in afterwards, but that feels like a lazy solution to a problem I shouldn't have an issue with.
are you sure? you could debug it using single vehicle like: simulationEnabled TestVeh
in console
returns true
did you check all the units attributes
hmm , the enableSimulationGlobal should be run only at server but idk if thats a problem. are you testing from editor?
yes. And I made sure that the trigger that runs this is only evaluated on the server.
ok
I could send u the scenario so you can see for yourself.
maybe crew has its simulation toggled different way than vehicles
no need
as i cant think of anything good :/
somtimes we copy and past units and we forget to set the attributes bact to normal
I made a change to enable the simulation of the crews as well. Kind of lazy to declare them directly but whatever.
{_x enableSimulationGlobal true;} forEach thisList;
{_x enableSimulationGlobal true;} forEach crew varsuk2;
{_x enableSimulationGlobal true;} forEach crew quilin1;
maybe just forget the triggers for now and test everything in console
take one vehicle and play with that
will do
Yeah, I'm seeing the same problem even when doing the same process in the console one command at a time.
Units with disabled simulation within a vehicle with disabled simulation will not move at all once the simulation is enabled on both the vehicle and the crew within.
humm maybe it matters in wich order you enable vehicle vs crew
try enable vehicle first
why must you disabled simulation cant you just put use doStop
and then change command after that
I want to have a lot of units on standby that get activated over time as the scenario progresses. I don't want them all to be simulated at all times from the get-go for optimalisation reasons.
well if you cant get this to work you could try using enableAI/disableAI "ALL" on the men
yeah just use doStop on the w8ting units
That's what #arma3_scripting message this does
ok
or just spawn in the units as you need them
I did that last time, but I like being able to customize the units in eden editor, so I wanted to try doing stuff differently.
you can customize spawned in units
messing with disabled simulation can be messed up i found over the years
what method would you recommend?
heres an Exsample of a customize unit
"O_Soldier_unarmed_F" createUnit [getPos leader (_grp), _grp, "_handler = this execVM 'loadouts\CSAT_SoldierAK.sqf';", 0, "MAJOR"];
i use the unarmed unit so it does not throw a erra in the RPT
all you need to do is build the CSAT_SoldierAK.sqf loadout
and name it as u wish
if you want the CSAT_SoldierAK.sqf just let me know
then you can just edit it
Is there a way to create custom units (like that "O_Soldier_unarmed_F") and have it in description.ext for that mission, or is that not supported?
why do you want it to be in the description.ext
so that it's local to the mission. creating a unit with a full loadout and then changing it's loadout with another script feels... inefficent?
in the sqf it will be local to the mission
the description.ext is not the solve all to local
the description.ext is just like a params file as it were
local and nonlocal is some what of a diff thing
Okay, but why create a unit with a full loadout, only to give it a different loadout a second time? there must be a better way.
what do u mean give it a second time ? theres no second time
the unit only get a load out 1 time theres no second time
the unit gets spwaned in with the loadout
Can I see the sqf file you mentioned?
yes sure m8 np 1 sec
//Server Run
if (!isServer) exitWith {};
scriptName "CSAT_SoldierAK";
//Gear names
_vestArr = selectRandom ["V_BandollierB_cbr","V_Chestrig_khk","V_BandollierB_cbr"];
_backpackArr = selectRandom ["B_FieldPack_cbr","B_FieldPack_khk","B_FieldPack_blk"];
//comment "Remove existing items";
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;
//comment "Add weapons";
_this addWeapon "arifle_AKM_F";
_this addPrimaryWeaponItem "30Rnd_762x39_Mag_F";
//comment "Add containers";
_this forceAddUniform "U_I_L_Uniform_01_tshirt_skull_F";
_this addVest _vestArr;
_this addBackpack _backpackArr;
//comment "Add items to containers";
for "_i" from 1 to 5 do {_this addItemToUniform "FirstAidKit";};
//comment "Add items to containers";
for "_i" from 1 to 3 do {_this addItemToVest "30Rnd_762x39_Mag_Tracer_Green_F";};
for "_i" from 1 to 3 do {_this addItemToVest "HandGrenade";};
//comment "Add items to containers";
for "_i" from 1 to 2 do {_this addItemToBackpack "SmokeShell";};
for "_i" from 1 to 6 do {_this addItemToBackpack "HandGrenade";};
for "_i" from 1 to 4 do {_this addItemToBackpack "30Rnd_762x39_Mag_Tracer_Green_F";};
//comment
_this addHeadgear "H_Booniehat_tan";
//comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";
_this linkItem "ItemRadio";
_this linkItem "ItemGPS";
What I was trying to say is that when you use createUnit, you use a class from CfgVehicles - like "O_G_Soldier_F" - That class already has a predetermined loadout, does it not?
not the unarmed unit does not
you know unarmed
oops need the selectRandom at line 6 also
can't beleive i missed that wow
there fixed
theres a hole host of ways to edit units
I think I'll just look at how BI did it in the campaign.
ok sure np m8
yull find my way is way easyer
iv have all ready done that what u just said
and my way works awsome with no erras and super fast gaming
cuz of all the guys in here that teached me
like Dart and Gencoder8 and so may others i cant even remember all the names that helped me
i guess im getting up there in age im 64 now on Feb 17 woohoo
no work and Arma 3 all day woohoo hell yeah
lol
i ask my friend how are you and he said he is tired i said hi tired im retired lol he he
woohoo
If someone who isn't 12yo could respond, I'd be grateful.
Unfortunately there isn't. New soldier classes are part of CfgVehicles, which doesn't work in description.ext (except for a very small part of it relating to sound sources). You can't create new classes without a mod.
The only thing you can do is use an existing class and immediately replace its loadout.
You do have the choice of using setUnitLoadout versus using individual addWeapon etc commands.
I see, thanks for the explanation!
yes choice we like choice
Don't worry too much about the efficiency. Because this is the only way to do this, it's really common to see it done - if there were major problems with it you'd have heard about them. As long as you're not continually spawning huge numbers of units, the game will manage just fine, and even then you'd probably die of having a billion AI active rather than noticing the loadout script's overhead.
Thanks, I will try letting AI drive a bit to get speed up before my script takes over. I am using waypoints as a directional string of positions to move through.
[Params] remoteExec ["Functionname",Target];
[Params,Function,Target] call life fnc mp
iirc π No big deal
hello Awsome Arma 3 friends: What would i put in a script, if i want every Land_MetalBarrel_F on the map, to expload if it gets destroyed
even if i spawn in the Land_MetalBarrel_F or if it exsist all ready
i can do it if i name all the barrels
but i can't seem to get it right for all barrels with out names
i know its just a simple like 6 or 7 line script but i can't seem to get it right
if someone can get me started with the top lines i can do the rest
first get all barrels then setup Killed EH on each https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed . then create the explosion in the Killed EH (Bomb or something)
ahhh ok yeah thx m8 why didnt i think of that π¦
your the best m8 thx @proven charm
assuming barrels can "Die"
yes they can yup
Good
thx again brother
yw
as a matter of fact i already have a EH for destroying Caches without names, So all i need to do is adapt it to Berrels woohoo
i just forgot lol
Here's a link to a sample mission with full featured exploding barrel scripts. Includes fire fx, burns a little before exploding, launches exploded barrel, sets near units on fire and they scream. See the video and link to download sample mission from dropbox. Scripts work well, but are ugly to read (I wrote them 10 years ago). You can use them as is, or take some code or fx from them as you please. My very first script I ever wrote was exploding barrels for OFP probably 20 years ago...holy shit I'm getting old. https://forums.bohemia.net/forums/topic/174218-jboy-burningexploding-barrel-script-released/
lol ok cool m8
Burning/Exploding barrel script for ARMA 3. Get more details on it at the ARMA 3 forums.
lol that video is awsome lol i also been playing as far back as OFP m8 woohoo
That is the sample mission you can download. I just tried it and it still works. Start mission and start shooting barrels.
ok thx m8 will do
Anyone able to help with this script I am trying to make for corrosive rain?
``[] spawn {
while {true} do {
// Check if it's currently raining
if (rain > 0.2) then {
{
// Skip AI, OPFOR, and INDEPENDENT
if (!isPlayer _x || {side _x in [east, resistance]}) exitWith {};
if (alive _x) then {
private _isInside = [_x] call fnc_isSheltered; // NEW shelter detection method
private _isProtected = [_x] call hasProtectiveGear;
if (!_isInside && !_isProtected) then {
[player, 0.5, "body", "burn"] call ace_medical_fnc_addDamageToUnit; // Apply burn damage
};
};
} forEach allPlayers;
sleep 10; // Apply burn damage every 10 seconds
};
sleep 5; // Check rain status every 5 seconds
};
};
``
``[] spawn {
while {true} do {
// STORMY WEATHER (Transition over 60 seconds)
[1] call BIS_fnc_setOvercast; // High overcast for rain
60 setRain 1; // Max rain over 60 sec
60 setFog 0.4; // Thick fog over 60 sec
60 setLightnings 1; // Enable lightning
forceWeatherChange; // Ensure weather syncs in MP
sleep 180; // Storm lasts 3 minutes
// NORMAL WEATHER (Clear conditions + rainbow, transition over 60 sec)
[0] call BIS_fnc_setOvercast; // Clear skies
60 setRain 0;
60 setFog 0;
60 setLightnings 0;
60 setRainbow 1; // Add rainbow
forceWeatherChange; // Sync changes
sleep 180; // Normal weather lasts 10 minutes before repeating
};
};``
It will not rain and if I set weather changes in eden it doesnt effect the player
holy cow my exploding barrel EH just blew me up big time lol hahahahaha
well thats what i was going for
if im using ace and cba, where would be the correct place to put setWind [0, 0, true]; in a mod to have the server run that at the start of every mission?
one of the XEH files i assume? 
the function on the wiki states it needs to be executed server side, not sure when during mission loading it needs to be run to actually set the wind
When scripting a a texture onto an object what is the best dimensions for that picture being put on the object?
you making a mod?
Must be power of two
yes
ok well when using https://community.bistudio.com/wiki/Arma_3:_Functions_Library there's postInit to run the function at start. hth
actually that's preInit / postInit
If you're using ACE Weather then you might need to do something more complex - I've found that it tends to interfere with other attempts to set wind conditions
Are there any functions which can tell me which player is in which slot in the lobby/role assignment?
Good evening people,
can someone explain me the output? What does it show to me?
Input:
_getLayerInfo;
Output:
I only see that there are 2 classnames of the objects in these Layers. But I dont know the rest...
https://community.bistudio.com/wiki/getMissionLayerEntities
Explained here
Each of these:
2a6a5806080# 487395: rail_concreteramp_f.p3d Land_Rail_ConcreteRamp_F
is one entity. It's a representation of a reference to an object that doesn't have a variable name set. It consists of some object ID, the model name, and the classname.
These two:
[],[<NULL-group>]
are the non-object things in the layer: markers (empty array because no markers) and groups (grpNull, presumably also no groups)
These are actually direct Object type references, not strings as they might appear - this is just the information that gets printed when you try to display one as a string.
I'm trying to create an endless zombie spawner that has a max cap of how many can be spawned, I have a loop script setup below
while {alive player && (player inArea "endlessZone") && {alive _x && side _x == east} count inArea "endlessZone" <20 } do { *whatever script* }
I've confirmed everything about the script works except the {alive _x && side _x == east} count inArea "endlessZone" <20 I think its something to do with the brackets and parenthesis stuff but idk what order those go in or how they work, could someone rewrite this where the count inarea cap works?
Basically it should stop looping the script if the number of zombies breaches 20 (they're east/opfor)
Your usage of inArea is invalid.
{alive _x} count (units east inAreaArray "endlessZone") < 20
Also works but slower:
{alive _x and _x inArea "endlessZone"} count units east < 20
thank you I will try this
If I remoteExec a function that has a createVehicle in it, it creates the vehicle for everyone that has been remoted executed to right? Like, if there were 5 people and I remoteExecuted it to everyone, does it create 5 vehicles or just 1 vehicle?
Correct. createVehicle is a global command (which means if one calls it, it will be sent over the network and everyone eventually sees it/creates it)
So if I execute createVehicle in the server (remoteExec 2) can all players see and interact with it?
Or, just don't remoteExec it
I'm create my extension in c#. I can already accept calls via callExtension, etc., but I don't fully understand how I can save some information between calls to my extension?
first you must get the callback function like this: ```
#if WIN64
[DllExport("RVExtensionRegisterCallback", CallingConvention = CallingConvention.Winapi)]
#else
[DllExport("_RVExtensionRegisterCallback@4", CallingConvention = CallingConvention.Winapi)]
#endif
public static void RVExtensionRegisterCallback([MarshalAs(UnmanagedType.FunctionPtr)] ExtensionCallback func)
{
callback = func;
}
Don't see how that is related to the question
That is just normal C# though.
Define a static variable, and then you can store any info there. That's nothing specific to extensions
then you can use the callback callback("extName", "fnName", "your data" );
maybe I misunderstood
I didn't see the question say anything about callbacks
yeah i must have misread what he said. well there's some bonus info π
Yeah I have a function for loading data cause of the limit per load back that splits the data into chunks then sends
But it uses the static variables in C# to do this
So you could use that idea for your use case.
Which limit?
callback has no limit, and input data for RVExtension also has no limit (well up to the maximum string limit)
From the DLL to ingame due to string limit
callback's limit is 9mb
I just thought that the dll is loaded when called via callExtension and unloaded at the end. Accordingly, the static variable will die.
its not unloaded
Iβm not using callback Iβm using it just like a post request idea
unless it crashes then its unloaded right?
That's great news, thank you.
Yeah but, you'd probably have a much easier time using callback, because then you don't need to deal with the limit and constantly polling
When the game crashes, everything is gone
i meant the DLL crashes
When the DLL crashes, the game crashes
^
Youβre probably right, but I didnβt know about callbacks until after I made it. I did plan to make an update at some point to use callbacks
huh it hasnt ever happened to me that when there is bug in my DLL arma also crashes . i guess thats because the safe environment due to try-catch
which language your using Jerry?
C#
oh me too
I also had a C# extension crash the game recently, was missing a try catch
I think we could also give an option to increase the output buffer size for normal RVExtension. But probably not worth it, if you need it you might aswell pass data back using callback
Yeah but honestly itβs not too bad, I just return a code of 1 if there is more data chunks to send zero if itβs done
And itβs only like 4 calls max the data isnβt massive
But I do like the callback idea
The fact you can tell it get me this whenever itβs done is nice for that essentially async benefit
callbacks play well with MT
_veh = createVehicle [ASORVS_CurrentVehicle, ASORVS_VehicleSpawnPos, [], 0, "CAN_COLLIDE"];
_veh setVehicleLock "UNLOCKED";
_veh setDir ASORVS_VehicleSpawnDir; sleep 210; hint "ΠΠ°ΡΠ° ΡΠ΅Ρ
Π½ΠΈΠΊΠ° Π±ΡΠ΄Π΅Ρ ΡΠ΄Π°Π»Π΅Π½Π° ΡΠ΅ΡΠ΅Π· 30 ΡΠ΅ΠΊ."; sleep 30; deleteVehicle _veh;
_veh disableTIEquipment true;
Hello, i get _veh disableTIEquipment true; doesn't work
I still have thermal on gunner
You're only doing disableTIEquipment after the vehicle has been deleted
sleep 30;
deleteVehicle _veh;
_veh disableTIEquipment true;```
These things happen in the order they are written in
I assume its intentional but in case its not, that vehicle will only exist for 4 minutes no matter what happens.
Thanks!
Hey boys do you think its possible to help with shadow distance changing ?
Problem is, when You zoom in as tank gunner, and your shadow distance is set to 200 (for fps safety), you will see very deformed objects in distance. When You zoom even more, objects at a greater distance are totally screwed. Only solution I've found is to change shadow view distance, that means, you will see perfectly modeled objects for set shadow distance, but when you get back on normal zoom, shadow distance is still for example 700, so fps drop will be significant.
Can I ask for very, very simple mod, which will change shadow distance for 2 zoom mods of rhs tanks ? Default zoom could have players default shadow distance setting, or just something around 300.
I would appreciate help greatly!
You could use CH View Distance, which can increase object draw distance based on current zoom
But I don't anything about dynamic shadow draw distance
How do I force/prevent an AI unit from falling unconscious?
I know that mod, only if I rewrite it somehow, thx anyway.
Isn't it in ACE addon settings ? Not sure thou. "Medical" section or like that
How would I reference the current zero? It looks like user action EHs only parameter is whether it was activated or not
After looking at the code for ace_xm157, I think I've figured it out
Is it possible to disable music on death screen? It stops current music from playing, which I don't like when I can just switch to other alive unit using teamswitch and keep playing
bump, find any way for local AI? createAgentLocal /s
Unfortunately no
How do I return the display of the scope you're looking down?
display?
in order to get the value of the 151 idc (range)
Like... the zeroing value on the Hud?
For the HUD elements themselves, its a little more convoluted, but if you want straight up zeroing values;
https://community.bistudio.com/wiki/currentZeroing
Some optics like the Nightstalker and the new optic from EF have built-in laser rangefinders. Not full auto-zeroing FCS, just a rangefinder that displays the range in the optic.
Ah that makes a bit more sense
The display IDD is 300, with the classname as "RscUnitInfo" using _x getVariable ["BIS_fnc_initDisplay_configClass", ""];
The issue stems from the display being used in multiple locations for other HUD elements.
The control IDC for range is 198.
The below code will grab the display you want in vanilla for the nightstalker, however your mileage may vary due to mods, or things I may not have taken into account
(uiNamespace getVariable ["IGUI_displays", []]) select {
_class = _x getVariable ["BIS_fnc_initDisplay_configClass", ""];
_class isEqualTo "RscUnitInfo" && !(isNull (_x displayCtrl 198))
};
Thanks! I'll have to try it out
I was trying to public a script handle, have tried
_vehicle setVariable ["bot_vehicle_scriptHandle", _scriptHandle, true];
and
publicVariable "bot_scriptHandle"
but got same warning in RPT file like:
11:02:46 Performance warning: SimpleSerialization::Write 'bot_vehicle_scriptHandle' is using type of 'SCRIPT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
so, I assume that a script handle could not and should not be publiced, is that right?
Script handles wouldn't have any non-local meaning. What are you trying to do with them?
terminate a script via remoteExec :/
Store the script handle locally to the script (on the vehicle probably), call a function to do the terminate.
Yeah its definitely a simpler way, thanks.
and now I realized how stupid I am trying to public a script handleπ
I tried this but the AI unit just randomly falls unconscious and i dont know how to stop it
Anyone knows how to use the lifeState command
https://community.bistudio.com/wiki/lifeState
LifeState just returns the current state of the player, doesn't change any states
Ok, so if I set the unconscious state of a unit to true, is it a one and done thing or do i need to loop it, i'm trying to work around an issue I have but it might be a conflicting mod
if you use setUnconscious, it should keep the unit incapacitated until woken via script iirc
Ok thank you Iβll try this but it will also work in the opposite way correct. Meaning I want to keep it from going unconscious
You can't prevent someone from using setUnconscious unless you completely disable the command
It sounds to me like you might have a mod thatβs setting setUnconscious back to false whenever you set it to true, this would be a mod conflict, but I canβt really help you narrow this down unfortunately. I do know about the ace EH for unconscious, but that doesnβt necessarily trigger when just using setUnconscious
It has to be, everything was fine before so I got to uncheck what mod is causing the issue
Using ace?
Does anyone on here have any experience with scripting TFAR channel/frequency data? I've been trying to assign channels for all players in a mission by using, for example,
[(call TFAR_fnc_activeLrRadio), 1, "50.0"] call TFAR_fnc_SetChannelFrequency;```
run from initPlayerLocal. It works fine in testing with <10 players, but when I tried using it on an op with 30+ players, the players seemed to get split into 2-3 different subnets (player A and player B, despite both being on 50, couldn't hear each other).
The issue is not:
* Radio assignment. When we've played with the exact same radio equipment, but assigned channels manually (without scripting), it works fine.
* TeamSpeak or player settings. When we've played with the same people on the same TS3 server, it works fine.
The issue could be:
* Scripting stereo settings (but doubtful, since stereo settings shouldn't make you unable to hear certain players) (I used stuff like ``[(call TFAR_fnc_activeSwRadio), 2] call TFAR_fnc_setSwStereo;``)
* ``TFAR_fnc_setChannelFrequency`` somehow also randomly changing the passed radio's encryption scheme (but then again, why would someone build that functionality?)
I am asking on here instead of doing additional testing because the only way to reproduce the problem would be to take a not insignificant amount of time from our regularly scheduled games, so I thought I'd check if anyone has any experience with this first.
initPlayerLocal
That sounds too early. By that time the handheld radios are not initialized yet.
If you are doing it for all players, why are you using script and not the TFAR settings pre-defined frequencies?
hey, can I get a small help with object hide scripts, I am not sure why but even if I am trying to hide a vehicle, the unit inside stays on. any way I can deal with this??
What do you mean by on?
you can hide crew too
I tried which is weird for me lmao
Your try is weird? That's weird
Actually, if you hide a vehicle, the crew are also
What exactly you try then
I am asking what code you run
What module then
show/hide
It hides the crew too for me
arma being arma?
Your something being your something
true
Now, a serious question, how do you make your synchronization
Post your Eden Editor's setup screenshot
sorry what?
Yea
Try vanilla unit/vehicle then
Same
What about vanilla game
Probably mod side
I am saying try it
Then you may have a wrongly made Mod
Hi all) In general, I made a correct ragdoll for a dedicated server)
So,
You want set unit unconcious and keep it unconscious?
you want units doesn't go unconscious like when you shoot them and they don't die, they go unco and woke up?
I am doing it in this roundabout way because I want to set people to different default channels and alternate channels based on roles (so the JTAC always has air net as alternate, squad leaders always have platoon net, everyone starts on their own squad channel, etc).
The script waits ten seconds before changing any channel settings, and the channels do get switched so it isn't initiating before the radios are ready, it's just that when the script does run, some people can't hear each other.
Well you could turn off radio encryption, to see if that changes it. But I don't see how this could mess that up
Reading some code where they are spawning #particlesources with createVehicle instead of createVehicleLocal, does that actually have any effect or does it still spawn only locally?
Hi ! Is there a way to use the Arsenal Camera Movement without the menu of the arsenal to be used in another script ?
anyone knows how i can make a bomb/missile to belong to the player or any unit i choose? so that whenever
that missile explodes and kills any enemy unit, it would count as the player (or a chosen unit) did the kill
i tried the following script while placing an opfor unit next to the missile for testing, you can see i tried setOwner but doesn't work
private _missile1 = "USAF_GBU28" createVehicle getPos h1;
_missile1 setOwner (owner player);
_missile1 setDamage 1;
setShotParents works for rockets and such, pretty sure there's another command for setting an owned mine though?
addOwnedMine for mines works iirc
Even if it actually spawned globally, effects have to be applied locally, so it's only wasting network performance
thnx i'll try them
how can I catch it loading into memory in extension (c#)?
And when is the extension loaded on the first call or when starting arma 3?
Can you rephrase this? I'm not sure if I understood the question
had to come back to thank u again, after couple of hours, i got it working becuz of the setShotParents suggestion u mentioned : )
Hi guys does anyone know where arma 3s Vehicle in Vehicle functions are in the files? I want to know how this function works to make my own version with the same cargo space limitations etc. I just need better control over it. I know about the config setup I just want to see what the function does internally.
It's in-engine. There are no functions
Which is why you use a command to use it, not a function
dam shame, okay. Well I can easily guess what it does but rewriting it is more of a nightmare than just seeing how it does it. okay thanks ill get to work
What's the script for deleting a group of units via a trigger?
DeleteVehicle didn't seem to work
Also if another trigger affects that squad & the squad is deleted before the other trigger is triggered, will that cause errors?
deleteVehicle works but you run it on each unit, not the group.
Ah ok, thanks
Does someone happen to know if ACE has an equivalent scripted event handler for their arsenal? I'm adding compatibility for it and need to ensure that I can restore the player's last loadout/reuse it for the player's recruits.
Ah figured it out, ["ace_arsenal_displayClosed", {}] call CBA_fnc_addEventHandler;
On first call
Not sure what you mean here
Am I correct in my understanding there's no way to read current compass declination / deviation set using setCompassDeclination or setCompassOscillation, respectively?
Yes
hello everyone I need help with setShotParents , where is the wrong ? private _pos = getPos _drone;
private _owner = owner player;
private _grenade = createVehicle ["GrenadeHand", _pos, [], 0, "CAN_COLLIDE"];
_grenade setOwner _owner;
[_grenade, _owner ] remoteExec ["setShotParents", 2];
triggerAmmo _grenade;
Take a look at the command parameters - The right param should be [player, player] in your case, not _owner
https://community.bistudio.com/wiki/setShotParents
_projectile setShotParents [_vehicle, _instigator]
Is there a way to reference the UI compass model arrow angle?
owner player doesn't seem to make much sense in general
Alright, you can get the map compass control, but because it's a model.cfg animation source it doesn't appear there's a way to access the rotation of the map compass. The same would be true for UI compass if Iknew how to find it (I don't think it's a control/display since it's odd? or at least I couldn't find the relevant display)
Instead of these workarounds, just make a ticket and ask for the command to be added
I would also love to know the animated direction of the compass tbf
Did you manage to find the model control?
Yeah
Does this command not work on it?
https://community.bistudio.com/wiki/ctrlAnimationPhaseModel
Well it should. It works with models not objects (models don't have configs)
Just make a simple object using the model path, then use animationNames to get all anims
Hello guys, i'm having some troubles with spawning a specific unit in a invisible helipad. The problem is, i used this code for spawning a vehicle:
this addAction ["Spawn Warhound->MP->Mega Bolter on Pad 12", {_pad12 = getPosASL Spawn_Pad12;_dir = getDir Spawn_Pad12;_veh = createVehicle ["TIOW_Warhound_MP_VMB_BLU",[0,0,0],[],0,"NONE"];_veh setPosASL _pad12;_veh setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];
But how can i spawn a blufor unit the same way i spawn a vehicle?
Using the createUnit command
First create a group using createGroup west, then use createUnit to create a unit into the group
Hello Leopard,
Ok, i will try and i will report back.
Thanks!
I typed this but it's giving me an error, where should i type the create group, before the addaction?
this addAction ["Rifleman", {_pad12 = getPosASL Spawn_Pad12;_group = createGroup west;_dir = getDir Spawn_Pad12;_veh = createUnit["B_Soldier_F",[0,0,0],[],0,"NONE"];_veh setPosASL _pad12;_veh setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];
It depends, but you need to be passing the group into createUnit anyway, like _group createUnit [other shit]
Yea, I want the unit to not go unconscious, the unit I'm having issues with was flying an airplane then it just randomly went unconscious and crash
Like this?
this addAction ["Rifleman", {_pad12 = getPosASL Spawn_Pad12;_group = createGroup west;_dir = getDir Spawn_Pad12;_group = createUnit["B_Soldier_F",[0,0,0],[],0,"NONE"];_group setPosASL _pad12;_group setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];
It is giving me this error:
No, like I wrote :/
You are setting _group to contain the result of createUnit. This is incorrect. You need to use _group as the left-side argument for createUnit.
// current, incorrect
_group = createUnit ["B_Soldier_F",[0,0,0],[],0,"NONE"];
// correct
_unit = _group createUnit ["B_Soldier_F",[0,0,0],[],0,"NONE"];```
My bad, i understood it wrong.
Ok, it worked. thank you.
This is the code:
this addAction ["Rifleman", {_pad12 = getPosASL Spawn_Pad12;_group = createGroup west;_dir = getDir Spawn_Pad12;_veh = _group createUnit["B_Soldier_F",[0,0,0],[],0,"NONE"];_veh setPosASL _pad12;_veh setDir _dir;},nil,7.5,true,true,"","true",5,false,"",""];
Hi guys, does anyone have any idea how I can get a more realistic dimensions of an object in game? Im currently using boundingBoxReal and that returns the same as zues when highlighting an object. Which as you can see for some vehicles is well... not accurate...
however arma 3s Vehicle in Vehicle system somehow knows the true dimensions of the vehicles because when loading this tank in a C17 it attaches at the right point to look like its parked in the back.
boundingBoxReal [_obj,'geometry']; gives you a pretty close fit apparently.
Of course we have no way of knowing what VIV uses :P
ah okay ill try working with that and yeah I know just wondering if anyone had got closer than that HUGEEE box that boundBoxReal gives lol
ill test that now thanks. Also another one... Im using this code to try and find the landContact point for vehicles. And well it returns [0,0,0] which means it dident find one and I doing something wrong? Ive checked the names array and get this for a humvee. Which is its land contact names lol
["wheel_2_2_damper_land","wheel_2_1_damper_land","wheel_1_2_damper_land","wheel_1_1_damper_land"]
names = (cursorObject selectionNames "LandContact");
cursorObject selectionPosition [names #0, "LandContact", "FirstPoint"];
Maybe a strange question, but how would people here go about getting the dice game from KCD2 into arma 3? Traditionally it's called Farkle or 10,000.
My concept atm is to just have an ACE self interaction be able to roll a varying amount of D6 up to 5, and have players manage their scores on their own. - This idea is easy (I think) but not the whole picture of the game.
I WANT the custom dice from KCD2. This means weighted dice, dice with weird sides, dice that always roll 3 etc that players can collect and build a "strategy" with and THIS is the hard bit in my mind.
My only idea for this atm is an item for each dice type that gives its own action to the ACE self interaction pool. Dice always rolls 3's? Its FNC (or whatever I have to make/call) determins what it rolls and players just have to remember that if they're scored you don't roll them
Additional features that would be amazing but I don't think will be worth the effort atm;
- Automatic scoring
- Removing of scored dice until the next round
- Some sort of UI, even just numbers on the screen
How would you go about implementing this game yourself? (not looking for people to do it for me obviously β€οΈ just thoughts and ideas)
look at the example by lou at the bottom
https://kingdom-come-deliverance.fandom.com/wiki/Dice_(Kingdom_Come:_Deliverance) if you look at the dice (this is kcd1 but whatever) table you can see a similar percentage chance, basically you set the weight
Yeah 100% what I'll be doing if I go that route, easy enough to make the custom dice and values as I've already got loot tables going using randomweighted
It's more the scoring, rolling of individual dice, rolling of groups of dice etc
Good to know I'm looking at the right things though
Quick sanity check
Is code within IF/THEN statements scheduled, unscheduled, or dependent on scope?
Specifically, statement code rather than condition code
That's not quick :P
It'd be quicker with an answer to my question π€£
Anyways, figured it out on my own
So the madness continues
Oh? What's the answer?
Answer is I still have no clue, the problem I was trying to solve fixed itself
I assume it's dependent though
Natural answer is dependent, but it's also possible that the scheduler can't break within a code section executed by an if.
I guess you can write some pretty epic code within an if so it'd have to be capable of breaking.
just an FYI looking at the positions the VIV gives the vehicles and the positions my code using this method gives its the same. So more than likly VIV uses this method. Thanks for sharing.
any idea why this wouldnt work?
Looks like a bug to me, but you'd do better to ask someone who works with models.
alright ive got a guy I could ask thanks, the reason is becasue the boundingbox method dosnt give accurate ground points if the models geomotry isnt set right which some arnt. So land contact points would fix the Z attach point π
You need placingPoint from https://community.bistudio.com/wiki/getModelInfo
Is it possible to select random element from HashMap?
toArray and selectRandom
_randomValue = _hashMap get (selectRandom (keys _hashMap));
Wiser solution
Same as any other code block. If the code is running in an unscheduled environment it runs unscheduled. If it's running in a scheduled environment, it runs scheduled.
// Assume this runs unscheduled
if (true) then {
systemChat str canSuspend; // false
};
[] spawn {
if (true) then {
systemChat str canSuspend; // true
};
};
Hello there, is it possible to increase health/armor of a Rhino MGS so it can survive more hits ?
HandleDamage Event Handle can make some trick
Will it work in pub zeus for example as well ?
If it allows you to use scripts, yes
Alright thanks a lot
Oh amazing thanks!!
Strange that I couldn't access the land contact points using there named selections maybe a bug but this will do nicely. I'll try it later
works perfectly thanks alot!
[ public poll ]
SQFBin / EnforceScriptBin poll available here: #community_wiki message
_unit addHeadgear "H_HelmetO_ViperSP_ghex_F ";
Something stupidly simple yet not working
Forums are down sooo, what do I do?
I want the helmet to be added to my unit spawned via script
Do you add an NVG slot item immediately afterwards? The Viper helmets have built-in NVGs and adding an actual NVG item at the same time might conflict
I am trying to put it inside of the helmet slot
That wasn't the question
Is the unit a vanilla type, or does it come from a mod? Some modded units (e.g. from 3CB Factions) have initialisation scripts for gear randomisation, which can overwrite your changes if the timing is right
extra space after classname
Or that
I'm not sure I understand what you meant
Oh wait
hold on
yes that
"H_HelmetO_ViperSP_ghex_F ";
β
"H_HelmetO_ViperSP_ghex_F";
only if you confirm it werkz!
happens to the best of us, one more example π
yet a space killed me
Space Wars
I'm updating a task's description every ten seconds, and initially I was going to cache the description to avoid calling BIS_fnc_setTask* too often, but after looking at its source code, it seems that it's smart enough to not broadcast unchanged variables, but it will always JIP remoteExecCall at the end: ```sqf
if (_global) then
{
[_id, _notification] remoteExecCall ["BIS_fnc_setTaskLocal", 0, toLower _id];
}
else ...
-# \* I'd use BIS_fnc_taskSetDescription, but their param call only allows bare strings, and rejects the arrays I need for my stringtable keys :(
Does remoteExec(Call) happen to avoid network traffic if its parameters are always the same?
No, although if you're using the same JIP ID then it'll replace the entry in the JIP queue.
you can always check if something has changed and then use remoteExec
Hey guys, Im trying to get spectator to work when players die. Essentially players will have a 3 minute respawn time, during which I want them to be able to spectate their team mates.
These are the settings Im currently using,
Description.ext
respawn = 3;
respawnDelay = 60;
onPlayerKilled.sqf
["Initialize", [player, [], true]] call BIS_fnc_EGSpectator;
onPlayerRespawn.sqf
["Terminate"] call BIS_fnc_EGSpectator;
The only issue im experiencing, Is as soon as the players die, they are able to spectate for roughly 2-3 seconds and then are forced back to the map screen where they can select their respawn point.
If ayone can think of a work around or have any advice please @ me
Pls, don't crosspost.
This is where you can get an answer.
I don't know, but assume some one can help, just wait.
Delete other post before some one who have more power tells the same
Rgr, I wasnt aware of which place would be best. I normally just get shouted at telling me its not the right channel
Yes. You will , but more you will get if you crosspost every channel
Rgr
yeah, afaik the respawn screen will mess with what you want to do, or maybe you can find a way to only force the respawn screen after 3 minutes... my way out of this, is just to do my own GUI with respawn points, it will take time and expertise but it can be called any time you want
