#arma3_scripting
1 messages · Page 732 of 1
_x isKindoF "CAManBase"
Will make sure only soldiers are returned, but as Sysroot said, 'units' command should not return snakes and stuff
I'd be careful w/ doing inheritance checks like that to detect units, it usually works fine but some addons as well as iirc certain animals have weird inheritance structures that can make those checks fail
Ok, I'll try
Thanks
DisableAI can increase server FPS?
The more i disable, the more i gain FPS?
I made some tests about that in the past, but can't remember the conclusion... i suspect the answer is "no".
Theoretically you could expect some degree of performance improvement by disabling certain features but I'd expect it to be negligible at best
Rendering and scheduler (and netcode if playing MP) take up the vast majority of arma's fps load
Hi guys. Is it possible to define a public variable on the dedicated server without editing a mission or makin an addon? E.g. by userconfig or so?
You can do it via anything that supports sqf via publicVariable
i.e. if you have access to debug console
Debug console is not an option. Need it to be defined once on the server and spread on the clients when they connect
All players will be able to do it?
Hello
Can anyone point me to any ideas what would be a proper way to implement a deafness effect if a player is too close to a vehicles cannon firing?
@crystal vessel ACE has a hearing damage framework that does similar so you could look at what they do, but a simple implementation could probably just use this along w/ code to detect firing weapony
https://community.bistudio.com/wiki/fadeSound
you want to quickly lower the game volume and then bring it back over a long time. that alone is very difficult to do correctly, unless there is some abstraction for layered volumes
0 fadeSound 0 should deafen the player
then you can fade it back in over a long interval for recovery
I am more looking into how to create the radius around the vehicle when it fires
Use a fire EH
So like
IF autocannon_40mm_CTWS FIRE
Kinda
i need to get nearEntities and then apply the fadesound
does CBA or something offer a layered volume abstraction?
Depends what you mean by layered I suppose
Arma by default supports separate audio control of master vs. environmental volume
i mean layering two distinct fades at the same time
a new fadeSound overrides the last one
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
}];
Can I remove _unit, _mode and such without impacting?
You cannot remove them but you can replace them with placeholders
best to just keep them as they are though
if you don't use them, you can replace it with an empty string
So just _empty?
""
Exception is if they're after all of the params that you do use
then you can freely remove them
can some one help me make a zeus register item via group config thing?
eh nevermind i am taking a break
Is it possible to use sqf in userconfig?
userconfig?
Arma3/userconfig folder
@blissful flowerI don't have much experience with them unfortunately but from what I understand they operate much the same as configs
so I'd guess unless there's some sort of sqf init field somewhere you probably can't
Thanks
It's that sort of thing that mission init files are really useful for
I know you said you don't want to mess with those
but that'd be the best way to do it as far as I'm aware
The idea is not to update all the missions but specify it somewhere else
Right yeah I get what you mean
I personally am not aware of anything other than debug console that would allow that, but I also don't have much experience hosting dedicated arma servers
someone else might know more
Hope so. Thank you anyway.
No problem, sorry couldn't help more
So I am missing { somewhere here
player addEventHandler["Fired",{if(_this select 1 isKindOf["Launcher",configFile>>"CfgWeapons"])then{[player]call LowArea;};}];};//[_this select 0]
If you count your { and }, you ll notice they re not equal count (the most outer scope/the one at the end "};" is the culprit). Also Fired EH is used only for vehicles iirc.
So one become two
player addEventHandler["Fired",{if(_this select 1 isKindOf["Launcher",configFile>>"CfgWeapons"])then{[player]call CRS_BB;};};//[_this select 0]
Now I am missing a ]
Added ] at the end with the same issue
Syntax errors will be easier to spot and fix if you format your code cleaner, like so
player addEventHandler["Fired", {
if (_this select 1 isKindOf["Launcher", configFile>>"CfgWeapons"]) then {
[player] call CRS_BB;
};
}];
that is the correct syntax and formatting
also note that you can use # as shorthand for select in most cases
so you can use _this#1 instead of _this select 1
In the 3rd line Call can I do "Script.sqf"?
Thanks!
No problem
private _caller=_this select 0; private _behindMe=_caller nearEntities["Man",50]; if(count _behindMe<1)exitWith{}; {private _PressureArc=[getPosATL _caller,(getDir _caller)-180,90,getPosATL _x]call BIS_fnc_inAngleSector; if(_PressureArc)then{ private _LoS=lineIntersects[eyePos _caller,eyePos _x,objNull,_caller]; if(!_LoS)then{_x remoteExec["Deafness.sqf",0,true];};}; }forEach _behindMe-[_caller];
Now that FIRED event had to call the 2nd sqf script
which interprets the situation and calls a 3rd one
I, for whatever reason, doesn't seem to work
I think I might have a wrong config on launchers?
I think RemoteExec might be used wrong
private _caller= _this select 0;
private _behindMe = _caller nearEntities["Man", 50];
if (count _behindMe < 1) exitWith {};
{
private _PressureArc = [getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] call BIS_fnc_inAngleSector;
if (_PressureArc) then{
private _LoS = lineIntersects[eyePos _caller, eyePos _x, objNull, _caller];
if (!_LoS) then {
_x remoteExec["Deafness.sqf", 0, true];
};
};
} forEach _behindMe-[_caller];
this should make it clearer
Yeah not quite sure what the purpose of the remoteExec is here
seems unnecessary
that and
you can't remoteExec a .sqf file
so that'd be what's wrong
I would just stick with an execVM
I am using CRS as a base to create a project because my scripting skills are too weak
_x remoteExec["Deafness.sqf", 0, true];
to
_x execVM "X\Z\Script.sqf"; ?
yup
Congrats!
Now I have to port this for a vehicle ! 😄
For vehicles you probably don't want to do any of this code that's checking if units are behind the vehicle, unless you want deafness to work that way
a simple radius scan for units close to the vehicle will probably be the best approach
you could even possibly change the amount of deafness based on their distance from the firing vehicle
I actually need a limited radius
remoteExec shouldn't be necessary for setUnconscious
it has global effect
for a basic radius check you can stick with just the nearEntities call
How would I go about changing from launcher to turret of a APC/TANK?
player addEventHandler["Fired", { if (_this select 1 isKindOf["Launcher", configFile>>"CfgWeapons"]) then { [player] execVM "Pressuretest\Script\LowArea.sqf"; }; }];
I am seeing Launcher and configfile
I am guessing it need to be changed to an correct config
So Launcher to Turret and CfgWeapons to Cfg(vehicle0?
Vehicle weapons are all defined in CfgWeapons iirc so that can stay the same
you just need to change Launcher to the class type you're looking for
so just changing launcher to turret could be what you want
So the Launcher is a class of the CfgWeapons, right?
Not sure if Cannon is correct
Launcher is a base class that all launcher-type weapons inherit from
isKindOf does an inheritance check to see if a given object's class inherits from another class
so when you do weapon isKindOf "Launcher" it's trying to see if weapon is an object that inherits from class Launcher
I'm not sure which base class you need to use to be honest
you could try cannon
best way to figure it out would be to open config viewer and dig through cfgWeapons for a vehicle weapon you want it to work with and see which classes that weapon inherits from
Okay, will check it out
So based on the path, it should be
configFile>>"CfgVehicles"
uhh.. the vehicle is that. I just don't know the class
I am looking for the specific class it might be tagged under, yes
You can find references to the vehicle's weapons in its vehicle config I believe
so hopefully that can help you to get to the weapon
somebody remember name of function that create grey marker on map bounding to building shape ?
@tough abyss
private _PressureArc = [getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] call BIS_fnc_inAngleSector;
To turn it into 2 arcs,
Should it be
[getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] && [getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] ?
Why do you need 2 arcs?
I want to have 2 position that give a deafness effect
Alright
Well && would require them to be in both positions since it's checking for both conditions to be true
if you want either to work you want to do OR which is ||
[getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] II [getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x]? (just add the correct values)
Yes though to make it cleaner I'd recommend doing this
private _inSectorA = [getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorB = [getPosATL _caller, (getDir _caller)-180, 90, getPosATL _x] call BIS_fnc_inAngleSector;
if (_inSectorA || _inSectorB) then {
// code here....
};
or something similar
if you want to make it more efficient you could stop it from getting the caller's pos and dir twice by saving it once like this
private _callerPos = getPosATL _caller;
private _callerDirBehind = _callerDir - 180;
private _inSectorA = [_callerPos, _callerDirBehind, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorB = [_callerPos, _callerDirBehind, 90, getPosATL _x] call BIS_fnc_inAngleSector;
if (_inSectorA || _inSectorB) then {
// code here....
};
How do you get that script format?
```sqf
code here
```
Ok
there ya go
Now to edit the current code
private _caller= _this select 0;
private _behindMe = _caller nearEntities["Man", 50];
private _callerPos = getPosATL _caller;
private _callerDirBehind = _callerDir - 180;
if (count _behindMe < 1) exitWith {};
{
private _inSectorA = [_callerPos, _callerDirBehind, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorB = _callerPos, _callerDirBehind, 90, getPosATL _x] call BIS_fnc_inAngleSector;
if (_inSectorA || _inSectorB) then {
private _LoS = lineIntersects[eyePos _caller, eyePos _x, objNull, _caller];
if(!_LoS) then {
_x execVM "Pressuretest\Script\Deafness.sqf";
};
};
} forEach _behindMe-[_caller]
just need to adjust _inSectorA and _inSectorB to the areas you want
Issue arises that arma tells me _callerDir is not a variable
ah haha
Error undefined variable in expression : _callerdir
I wouldn't call it any more efficient
getPosATL is fast
the real slowdown is the function itself
private _callerDirBehind = (getDir caller) - 180;
that's true
but code clarity is more important than micro-optimization anyways
missing [
lineIntersects
that checks view LOD
that's not what you should use for something like "deafness"
private _inSectorA = [_callerPos, _callerDirBehind, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorB = _callerPos, _callerDirBehind, 90, getPosATL _x] call BIS_fnc_inAngleSector;
these are literally the same thing
wat?
Yes, I have to change it so it is to the sides
So 90 is 90* from the players rear
CW
?
clockwise
oh clockwise
it's just a sector angle yeah
private _callerDir = getDir _caller;
private _inSectorA = [_callerPos, _callerDir - 90, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorB = [_callerPos, _callerDir + 90, 90, getPosATL _x] call BIS_fnc_inAngleSector;
this will give you 90 degree sectors on both sides of the player
can adjust to your liking
lol
lol indeed
Messing around with some vehicle concepts lately and have been trying to disable vehicles automatically exploding after their hithull points have surpassed 0.9 From what I've been reading on the wiki, it appears I might have to make a config patch. I was wondering if there's an easier way I'm overlooking?
what is this ?+ 90, 90,
so it's 90 degrees to left and right?
ok
yup
and the plain 90 in both of them is the total width of the sector
which gets split down the middle
so 45 degrees to the front and back of the player's sides
that's the main thing you're left to adjust to your liking
That'd probably be the cleanest way to do it, unfortunately
unless you're willing to make them invincible :P
Fair enough. I was wondering because in the Contact campaign Eddie is set to not drop below a certain damage threshold to prevent players from soft-locking the mission.
You could do that with sqf, yeah, but like I said you'd end up making it invincible
You'd pretty much just hijack the HandleDamage EH for the vehicle and make it return 0 if the vehicle's health is at or below the threshold (or if applying the current dealt damage would do so)
// PreventExplosion.sqf
params[["_vehicle", objNull, [objNull]], ["_dmgThreshold", 0, [0]]];
_vehicle addEventHandler ["HandleDamage", {
params ["_vehicle", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (_damage > _dmgThreshold) then {
0; // Prevent selection damage from exceeding dmgThreshold by returning 0
};
}];
this would probably do the trick
[car, 0.9] execVM "PreventExplosion.sqf"
prevents car from exceeding 0.9 dmg on any selection
Lmao, you sent that after I had half of my own script written.
Haha
Wasn't asking for handouts, but I'll gladly take it. Appreciate it, man.
No problem, lmk if it doesn't work, didn't actually test it
might've botched something
Will do.
I too need help with a script...
Come and ye shall be helped
_damage is already the resulting damage
I'm trying to script a more realistic respawn for multiplayer missions.
When killed, players respawn in an already loitering helicopter.
I'd like said helicopter to unload or rappel troops on a spot designated by troops on the ground, marked by a flare or by smoke.
@amber sapphire Might want to go grab the updated copy, made a syntax error too :P
and if everyone is dead, have an addAction that has the helicopter find the most suitable location and just drops everyone out
Yeah that's definitely a bit of a tall order
thought as much
like, pretty much an entire addon's worth of stuff
I wouldn't say an entire addon, but it would be a lot of coding.
Wouldn't take long to do the respawn in helicopter part, but smoothly integrating it with the helicopter following flares/smoke and the various edge cases would take a while
yea, I've got the respawn part down already
it's just the deployment part lol
so if I were to change the request around, to make it more feasible - what would you suggest is possible to achieve something similar to what I had in mind?
To get the heli to deploy at the flare zone?
something along those lines, is that 'easy' to script?
If anyone knows, since I have been looking.
CfgWeapons subclass rifle and launcher exists
I have no idea how to find the cannon for a M1A2 Slammer
Well I haven't done it myself, but plenty of addons have vehicles that are scripted to go to the locations of flares
It counts as a cannon_120mm but it is not under cannon or turret for config
so you could take a look around or piece together a method
as for how to smoothly integrate said method with whatever else you have written is up to you
I'll have a look around, thanks
I imagine for something so important that BI probably has a function for it already laying around somewhere
but if not could always do good ol waypoint coordinates
never done that before either lol
Neither have I!
But I'm sure it can be done
Alas AI behavior / vehicle control is pretty much the one corner of arma modding I'm not well versed in
thanks for your thoughts anyway
looking around, might be able to achieve it with support requester/provider module...
@tough abyss
player addEventHandler["Fired", {
if (_this select 1 isKindOf["rifle", configFile>>"CfgWeapons"]) then {
[player] execVM "Pressuretest\Script\LowArea.sqf";
};
}];```
Does this only react to the player firing?
Yes
Or will it also take into account if he is operating a tank?
Hm
Nope
However
You can use "FiredMan" instead of "Fired"
and then it will work for both
player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
}];
those are the params for it
I am looking or ANYTHING so i guess Fired works
If you want anything then you should use FiredMan
Oh
Fired only works outside of vehicles
OHHHH
In the text for the "Fired" EH:
Triggered when the unit fires a weapon.
This EH will not trigger if a unit fires out of a vehicle. For those cases an EH has to be attached to that particular vehicle.
FOUND IT
It was Firedman I needed
player addEventHandler["FiredMan", {
if (_this select 1 isKindOf["cannon_120mm", configFile>>"CfgWeapons"]) then {
[player] execVM "Pressuretest\Script\LowArea.sqf";
};
}];```
This fixed it
Ah there ya go
FiredMan and Cannon_120mm is the sub class for weapons
Pretty sure that's only going to apply specifically to 120mm cannons
might want to go with a base class
such as if Cannon is available
I will after
I need a last fix
So now I added a third Sector
private _caller= _this select 0;
private _behindMe = _caller nearEntities["Man", 50];
private _callerPos = getPosATL _caller;
private _callerDir = getDir _caller;
if (count _behindMe < 1) exitWith {};
{
private _inSectorA = [_callerPos, _callerDir - 90, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorB = [_callerPos, _callerDir + 90, 90, getPosATL _x] call BIS_fnc_inAngleSector;
private _inSectorC = [_callerPos, _callerDir +10, -10, getPosATL _x] call BIS_fnc_inAngleSector;
if (_inSectorA || _inSectorB) then {
private _LoS = lineIntersects[eyePos _caller, eyePos _x, objNull, _caller];
if(!_LoS) then {
_x execVM "Pressuretest\Script\Deafness.sqf";
};
if _inSectorC {
private _LoS = lineIntersects[eyePos _caller, eyePos _x, objNull, _caller];
if (!_LoS) then {
_x execVM "Pressuretest\Script\Front.sqf";
};
};
} forEach _behindMe-[_caller]```
So SectorC
and IF new
Fight now I am not getting ANY interaction, so there is a question where di one of the codes break
missing parentheses in the 2nd if statement
around _inSectorC
also what is sector C supposed to be
because it's not set up correctly
fixed it
private _inSectorC = [_callerPos, _callerDir + 10, 10, getPosATL _x] call BIS_fnc_inAngleSector;
Why 10 degrees to the right?
This is the FRONT of it
So the right and left will cause deafness
and front will kill
Yeah I'm saying you're not really getting the front
you're getting
a 10 degree wide sector 10 degrees to the player's right front side
So I need 2 Sectors?
if you just want a 10 degree region in front of the player you just need
private _inSectorC = [_callerPos, _callerDir, 10, getPosATL _x] call BIS_fnc_inAngleSector;
oh
though 10 degrees is quite small
might want to do 30 degrees minimum
also
you're doing this on the list of units in _behindMe
so none of them will ever be in front of you
need to do a separate code section for this sector
oh nvm
you left it named _behindMe but it's just a radius check
probably want to rename that to make it less confusing
anyways going to bed, hope it goes well
Thanks
Good day. Where can I find possible reasons for https://community.bistudio.com/wiki/setGroupOwner to return false (and not to change group ownership of course)?🤔 Log files doesn't even give a hint on that
you call it on the server?
Yes, sure
is the group empty?
No.
Should there be a time interval between group creation and setGroupOwner call? We tried waiting several seconds and it seems to do the job then
how can you add BIS_fnc_holdActionAdd to this (Land_DirtPatch_01_4x4_F) object ? https://i.imgur.com/EFSXCpI.png
that's a decal
I don't think you can
create a dummy object at it's position?
any dummy object in particular ?
Land_HelipadEmpty_F or Land_InvisibleBarrier_F would be good candidates, but it's not very important
private _caller= _this select 0;
private _radius = _caller nearEntities["Man", 50];
private _callerPos = getPosATL _caller;
private _callerDir = getDir _caller;
What would be the correct way to get the direction of the weapon pointing?
Weapon for a tank turrent
I have weaponDirection on my ideas list
I've got a trigger that I would like to activate if any of the following ("FlexibleTank_01_sand_F","ACE_medicalSupplyCrate","Box_NATO_Ammo_F","Box_NATO_AmmoOrd_F") item types move into the trigger zone but I can't seem to figure out how to write the condition. Anyone willing to help me out on this please? It would be greatly appreciated!!
@craggy lagoon
something like this should do it
(thisList findIf {(typeOf _x) in ["FlexibleTank_01_sand_F","ACE_medicalSupplyCrate","Box_NATO_Ammo_F","Box_NATO_AmmoOrd_F"]}) > -1;
What are you trying to accomplish?
@steel fox Thank you, I'm just wanting to display text when one of these items shows up in a zone. I was able to get it work when I specified one item but couldn't get it to work with when I wanted there to be a selection of items. I will test this out shortly, thank you again!!
@steel fox That worked perfectly, thank you so much!!
np
Worked like a charm: #videos_arma message (link to #videos_arma )
I know how to make myself spawn at a random position, but how do i make a wrecked helicopter and some weapons and supplies spawn there with me
At the start of game
What method are you using for this? Couldn't you just adapt it?
@steel fox at first i couldnt think of a way but i think i know how i can do it now, thanks
happy to help
I find myself spending unnecessary time fitting a ladder exactly so that the "climb ladder" prompt appears easily for the player. What scripting command puts players in ladders?
action
Yes! Just googled it meself. ... Where do I find the laddernumber:
unit action ["ladderUp", targetObject, ladderNumber, positionNumber] ?
config
Thank you
it's the index of the entry in ladders array
if your object has only 1 ladder it's 0
Hey- so
I've been trying to learn to use https://community.bistudio.com/wiki/setVelocityTransformation to move objects in a straight line in multiplayer
This is a big command, and math/vectors aren't my strongsuit, so does anybody know how I could tweak this script to move an object horizontally?
bob = createAgent ["C_man_1", player getRelPos [5, 0], [], 0, "CAN_COLLIDE"];
bob switchMove "ladderCivilUpLoop";
pos1 = getPosASL bob;
pos2 = pos1 vectorAdd [0,0,0.75];
bob addEventHandler ["AnimDone",
{
pos1 = pos2;
pos2 = pos2 vectorAdd [0,0,0.75]
}];
onEachFrame
{
if (!alive bob) then
{
onEachFrame {};
bob switchMove "";
bob removeAllEventHandlers "AnimDone";
};
bob setVelocityTransformation [
pos1,
pos2,
[0,0,0],
[0,0,0],
[0,1,0],
[0,1,0],
[0,0,1],
[0,0,1],
moveTime bob
];
};```
since you're using units just use their animation
I'm looking to use objects
setVelocityTransformation causes jittery anims
I.e. have a straight object just move at a continuous speed horizontally
Without having to use weird workarounds like attachto moving units
also this code makes no sense
This is, verbatim, the example from the Biki 😆
Think it's intended for SP though
I tried it in SP and it worked
just use two points
and use a desired time (or speed) to calculate the new interpolated position every frame
see the wiki
Can someone help me with this
[] spawn{
private _currentLeader = leader player;
teleportPlayer setPosATL (getPosATL _currentLeader vectorAdd [2,0,0.5]);
hint "teleported to squad leader";
};
I want to teleport a player to another players location, drops me an "expect object" on line 3
what is teleportPlayer?
this gives you a number
also why do you create a variable for it?
just pass it to this one
what exactly do you mean by that? like, put it in the addAction without cross referencing to another file?
is this code called directly from the action?
No the addAction references to another file where the code above is in.
show me your script
onPlayerRespawn.sqf
teleportPlayer = player addAction ["<t color='#0ac6d2'>Teleportieren</t>", "_resupply\scripts\teleport.sqf", [], 6, false, false, "", "true", 0.2];
teleport.sqf
[] spawn{
private _currentLeader = leader player;
teleportPlayer setPosATL (getPosATL _currentLeader vectorAdd [2,0,0.5]);
hint "teleported to squad leader";
};
so teleportPlayer is a number
you cannot teleport a number 😉
no need for spawn
params ["_player"];
private _currentLeader = leader _player;
_player setPosATL (getPosATL _currentLeader vectorAdd [2,0,0.5]);
hint "teleported to squad leader";
Not sure if its scripting related but is there a code or function to prevent an A.I unit from getting its ownership changed?
Ah okay, thanks I was kinda relying on some other stuff I did with spawn[] that did almost identical functions
are there commands or functions that give coordinates for parts of an ellipse? for example, I have a rectangle with a size, position, and rotation. How can I find the coords at the top of the rectangle?
Math
I don't think there are commands for that, perhaps a function but I wouldn't bet on it
Couldn't you just calculate the vector from the origin point upwards with size then rotate with the rotation?
maybe
Ah shame. Wanted to keep A.I from being transferred to a Headless Client. lol
well, you can
as in, just don't transfer them there?
it is not an automatic process
anyway, why would you want to override this transfer?
I found the variable to prevent transfer. I had a smooth brain moment.
Some of our CAS is virtualized, so when they get spawned in, upon transfer they go all wonky as we were using ACE's Headless Control
On another note however, I got my initPlayerLocal.sqf looking like this:
// This executes the briefing SQF. - Shows the briefing in the map screen.
[] execVM "briefing.sqf";
// Whitelisted ACE Arsenal
[arsenal_1] execVM "scripts\arsenal.sqf";
[arsenal_2] execVM "scripts\arsenal.sqf";
[arsenal_3] execVM "scripts\arsenal.sqf";
[arsenal_4] execVM "scripts\arsenal.sqf";
// Logistics Spawner
[spawner_1] execVM "scripts\LogiSpawn.sqf";
This is the best way to go about it?
I never felt like I understood what should go in init.sqf, what goes in initplayerlocal.sqf, etc.
Well, if you want hose things to run on the player's machine when they join. That is where you put it. this is a good reference: https://community.bistudio.com/wiki/Event_Scripts
I'm attempting to get the varname of a vehicle with Achilles Execute Code Module in Zeus trying to run
hint vehicleVarName player;
but nothing returns. Is there different code that I should be attempting to run?
I set the name in the editor so I know something should be coming back.
@craggy lagoon
hint vehicleVarName (vehicle player);
that should do it
I'm trying to create a "Son Tay" style mock up of an existing base on Tanoa, on another terrain. For that I need to collect the classnames, positions, and orientations of all the buildings within an area.
Does anyone know of a script (or command) that does this?
@steel fox Thank you but still getting nothing back, can this be done from the debug console?
Should work, the player is inside the vehicle you set the name on right?
Nope that was the issue. Thank you!!!
np
configs = [(configfile >> "CfgGroups" >> "West" >> "rhs_faction_usmc_wd"),2,false] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man");
why the hell does this not work?
it trips up on "man"
because missing }
just compile a list of the objects then spawn them again?
private _objectList = [];
forEach {
_objectList pushBack [typeOf _x, getPosATL _x, getDir _x];
} (_pos nearObjects _radius);
forEach {
_x params ["_type", "_posATL", "_dir"];
private _object = createVehicle [_type, _posATL, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
} _objectList;
You just have to figure out how you pass _objectList from the one script to the other. are you recreating it in the same mission?
are you using Eden or in a mission?
let me try but i think that did not work, im using a debug console aswell as a separate script file.
this is the new code configs = [(configfile >> "CfgGroups" >> "West" >> "rhs_faction_usmc_wd"),2,false] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man")}; and I cant post screenshot of my error
what does BIS_fnc_returnChildren return?
haha so you can do awesome tricks like grab all the sub classes from a config entry. when it works right, ive gotten it to automatically pull all the units from a group and plug them into the respawn loads that you can select from using the ingame respawn loadout function for multiplayer.
Now i want to do factions and zeus, ive already used CBA that adds code to every units init, removing them from the zeus editable objects if they are not a west side unit.
Anyway i need to figure out how i can grab all the configs and plug them into the .... command that registers the cfg to be available in the interface. The issue is the array wants you to have cfg, price . So i dont know how i combine an array of cfgs with an array of prices .....
is it possible to have an artillery computer style UI for an equippable launcher
probably. but there might be multiple ways to achieve a goal like that. so the launcher is non negotiable?
I wanted to make packable boats, like uav bags that open up into assault boats that you can wear on your back. So my failed attempt was to look at the configs
luckily someone already made the mod, and i need to study that mod more, very simple but he was able to like copy the elements from one backpack, and make a seperate custom backpack, and change it up.
if the launcher has to be equip able, then it might change your approach. Where as if you just opened up an artillery computer of a scripted spawn artillary, you could trigger that through the mission event flare gun script. You can even customize the colors i think
so white flare, red flare, green flare could all do different things
well any weapon that isn't treated as a separate vehicle you get into i guess
i see
Thanks. I'm not sure I understand your question. I'm making a mission using the Eden editor, yes. And I would like to extract objects that are "baked into the terrain".
Are you creating the mock up in the eden editor?
At the moment I am looking at a popular mod that recreates terrain slices, Seb's Briefingtable: https://github.com/Seb105/Arma-Briefingtable/blob/main/addons/main/functions/fn_createTable.sqf
I got the gist of the nearestobjecs command. I have an array of all sorts of objects. How do I "place" the array to see what I've extracted 😆 ?
loop over the array and create the object with create3DENEntity command
Let's see!
ah, and rotation is done with set3DENAttribute
Oof I'm stuck here. My extracted array using nearestTerrainObjects and nearObjects does not have position data for all these detected objects. And _ create3DENEntity_ obviously needs that.
Let me look at your suggestion 😄
that might help yeah...
although if you use it in the same editor environment. you could just run the getPos on the object in the recreation code.
then ctrl+c it to the other terrain.
I'll admit my scripting grammar isn't great. But Arma gives a "missing ;" error with this part of your script:
_objectList pushBack [typeOf _x, getPosATL _x, getDir _x]
}```
yeah, its missing a ; after the ]
I am going to brew some coffee...
doesn't foreach go after the block, not before?
depends on the command. I am not familiar with pushback :/
so forEach is geenrally used like
{
dothingwith _x;
} forEach someList;
whereas in the example it's being used like
forEach {
dothingwith _x;
} someList;
which might work idk
but if there's a syntax error that'd be most likely to be the problem imo
private _objectList = [];
{
_objectList pushBack [typeOf _x, getPosATL _x, getDir _x];
} forEach (_pos nearObjects _radius);
that is how it should be
Using this command in the debug console (I am in mission), it spits out a number. The array _objectList is empty.
(_pos nearObjects _radius); ^ This does give a list of objects.
_pos is a position and _radius is set to a number right?
It works for me
is it possible to avoid a large number display as a scientific notation? Just today I learned that arma only likes to show up to 6 digit numbers only, sadly 😦
_objectList is local to the script.
round it?
For debugging, I used player for _pos and 100 for _radius. Again, the command (_pos nearObjects _radius); gives a list of objects, fine.
OK.
I already tried making the objectList a global variable. @kindred zephyr what is an integer?
objectList = [];
{
objectList pushBack [typeOf _x, getPosATL _x, getDir _x];
} forEach (_pos nearObjects _radius);
objectList
this will return your object and make objectList global.
ahhhhh
bad ping, sorry
no player works
as long as it works
I am clearly not getting part of this. But thanks.
where are you displaying it? hint, systemChat?
@steel fox a gui, but I was using small numbers for test, the actual number goes over 1mil and its being shortened sadly, its being already converted into a string befor being shown
how are you getting the number? cut it up, convert to string, then add it all back together?
Here you go
hint ((_value call BIS_fnc_numberDigits) joinString "");
that will output the number as you want it
@steel fox thanks but found an easier solution using the next command:
_number toFixed 0; //Number has 10 digits
It takes advantage of the fact that it already transforms the number into a non-shortened version and the hides the decimals using 0 spaces
I saw that, does that just retain the amount of digits and not just do a round?
toFixed 2 gives you a nimber with 2 digits. I thought toFixed 0 would give you, well the first digit only.
No, its doesnt seem to work like that. It takes the float and according to the numbers of decimals you want to shows shortens or lenghtens after decimal. Setting it to 0 hides the decimal and still show an unshortened float
you can't show integers above ~16M in arma
it'll be inaccurate
numbers in SQF are floats
And yet people are still writing configs with float values into the quadrillionths for some reason
hit = 7.0000000000001
lets say you have an array of classes, and you need to add , 0.001 into the array after each config, how would you do that?
as in [class1, 0.001, class2, 0.001,...]?
okay thanks
i will have to look into flatten, and apply
ive never seen those before
flatten is very useful and also unfortunately not very well known
it's new
yeah 2.02
I'm getting Error: Undefined Variable in Expression on this line in initServer.sqf:
call TRI_fnc_pathZone;
This is my description.ext:
class CfgFunctions {
class allFunctions {
class TRI {
class lootSpawn {
file = "functions\lootSpawn.sqf";
};
class vehicleSpawn {
file = "functions\vehicleSpawn.sqf";
};
class gameFlow {
file = "functions\gameFlow.sqf";
};
class pathZone {
file = "functions\pathZone.sqf";
};
};
};
};
Not sure what the problem is :/
It worked! anyway so now my zeus can only spawn one faction, and im going to add in all the modules by hand
class Extended_Init_EventHandlers { class Man { init = "_this call (compile preprocessFileLineNumbers 'entSpawn.sqf')"; }; };
this is mine
i have cba
ehh it wont help lol
idk what yours is trying to do
that's wrong
class CfgFunctions {
class TRI {
class category {
that's how it should be
but yeah lemme change that
oh yeah it would
Yeah you had the tag and the category flipped around so it's registering them as
category_fnc_fncName
does that look "fine" to you? 
your function name is: allFunctions_fnc_blabla
clearly the best route here is to change it to BIS_fnc_functionName 😉
well i get errors but my script works
What errors are you getting?
part of the function
c1 addCuratorEditableObjects [[z1], true]; if (isServer) then { {[_x, [-1, -2, 0]] call bis_fnc_setCuratorVisionModes;} forEach allCurators; }; configs = [(configfile >> "CfgGroups" >> "West" >> "rhs_faction_usmc_wd"),2,false] call BIS_fnc_returnChildren; loadouts = []; {loadouts pushBack getText (_x >> 'vehicle')} forEach configs; publicVariable "loadouts"; loadouts apply {[_x, 0.01]}; loadouts append ["ModuleRemoteControl_F", 0]; [c1, loadouts] call BIS_fnc_curatorObjectRegisteredTable;
this is my init sqf
it works, it makes the zeus only able to place faction units + remote control module, but like i get errors
Didn't end up using flatten?
it works without it, flatten seems to need [] [[]] [[[]]]
loadouts apply {[_x, 0.01]} will produce that
as you're turning every class into a sub-array
also why do you use so many global vars?
loadouts append ["ModuleRemoteControl_F", 0];
this is inconsistent with the rest of your array
what does it have to do with using global variables?
easy to plug in c1 zeus z1 player
reminder that flatten gives an array as its return. it does not modify the original array
but i do have somewhat of an understanding
Sorry guys, apparently I'm kind of rusty with Arma scripting at the moment. I have a function that is supposed to run in init.sqf but nothing is happening. The script is not running at all.
This is my description.ext:
class CfgFunctions {
class TRI {
class allFunctions {
class lootSpawn {
file = "functions\lootSpawn.sqf";
};
class vehicleSpawn {
file = "functions\vehicleSpawn.sqf";
};
class gameFlow {
file = "functions\gameFlow.sqf";
};
class pathZone {
file = "functions\pathZone.sqf";
};
};
};
};
This is my init.sqf:
call TRI_fnc_pathZone;
This is my function, pathZone.sqf:
_pathZonePos = [["centerZone"], ["water"]] call BIS_fnc_randomPos;
_pathZoneDir = random 360;
"pathZone" setMarkerPos _pathZonePos;
"pathZone" setMarkerDir _pathZoneDir;
_sideA = 10000 * (sin _pathZoneDir);
_sideB = 10000 * (cos _pathZoneDir);
_pathZonePos params [_posX, _posY, _posZ];
_pathStartPos = if (random 1 > 0.5) then {
[_posX + _sideB, _posY + _sideA]
else {
[_posX - _sideB, _posY - _sideA]
};
player setPos _pathStartPos;
The map markers pathZone and centerZone are placed in the editor. I am running the mission but nothing is happening and I have no clue why. I'm not getting any error messages or anything.
there's no such thing as a "public" variable
missing }
what do i use instead?
pushBack
if you use append like that you get:
[[class, 0.001], ..., "ModuleRemoteControl_F", 0]
ohh thanks
well i still have error, but everything works, or well let me check the remote control module
use a linter
yeah I'm still getting nothing. What's a linter?
@tough abyss If you're going to be flattening it, you can switch it back to append
did you mean this:
call { TRI_fnc_pathZone };
?
where did you put the }?
no
ok yeah lmao 😅
I said missing }
yeah
nvm
nvm
this doesn't do anything
in your code
your if then
@tough abyss
loadouts apply {[_x, 0.01]}
try switching that to
loadouts = flatten(loadouts apply {[_x, 0.01]});
and switch the pushback to an append
okay so what is a linter? I cant find anything about one on the wiki
It's just software that does checks for basic syntax errors like that
included in some text editors and I believe there's also been a few made specifically for arma
dang
it worked
oh cool
Idk why when i threw flatten in there it didnt work
because you didn't store it anywhere
thanks
you need to tell it to store it in loadouts
otherwise it does nothing
yeah ive just been coding in python recently for school so I get mixed up sometimes I guess
if you're using that for zeus module costs it's wrong
you shouldn't flatten it
idk right now, my zeus is limited to one faction, everything costs 1 point.... ill figure out how to do different costs for the units, but for now i have to look at listeners for alive events 😦
altho according to the wiki you should 
I'm talking about this tho:
https://community.bistudio.com/wiki/Arma_3:_Curator#Assigning
not that function
Well that's the function he's using
¯_(ツ)_/¯
the flatten fixed all my errors
and even fixed the costs
so things are not free
DId you change your pushBack to an append?
Otherwise that will not do what you want
yes
you should've used it in the first place
I tried
maybe i forgot a bracket
He tried to but he wasn't storing the return
oh
he just did flatten() with no variable assignment
Hypoxic already told you that
Simple mistakes, grats on getting it working though
and for the love of god start using private vars instead of globals
hey, working on a single player mission. I have a conversation system which requires a certain key to be clicked in order to open it. In my case I'd like to use Space, which is by default binded to opening stuff. Can I change the default binding of this key within a mission or a mod, so it's not binded to more than two actions but just that convo? I am using CBA so it may be easier, however I'm not sure if it's even possible.
actions support shortcuts
why not just use that?
so this has nothing to do with scripting, why cant i fire a m136? the rhs rocket launcher
disposable
I can zoom, but it wont fire
its like rhs is broken, other people get a sight
do you have ammo for it?
its a disposable isnt it?
lol I meant the weapon thingy that prevents firing. safe mode? 
I don't remember what it's called
oh cool
theres a reload thing
well rhs settings are dumb
and i turned it back on, i figured it out thanks
is there a way to "reset" or cancel the current gesture without affecting the primary animation
afaik no (unless "" works, which I doubt)
I'm looking for something to make a plane just fly in a completely straight path. I just want it to fly at a set altitude at max speed for like 5 minutes without turning or anything. Waypoints have been a little unreliable. Anyone know of a method that might work?
or maybe "<none>"
yeah
max speed
try full speed waypoint, or force/limitSpeed
at a set altitude
flyInHeightASL or something
Is it not possible to remove the main turret from the prowler?
``` doesn't do anything but it is listed as an animation in the cfg
Speed and height is working great now. The only problem is flying in a straight line 😅 . I just want it to fly in a perfectly straight line all the way to the waypoint but it is weaving back and forth across a pretty large distance.
IIRC Prowler doesn't have such anim
any suggestions on how to do a checkpoint system? I wanna do a race, and my ideal system is like Forza Horizon's checkpoint system
can I just do this with the stuff from Karts DLC?
@brazen lagoonJust have a trigger that stores the vehicle's pos and orientation in a global var and then use that data
Yes
You can get a vehicle that activates a trigger
and then store that vehicle's position and orientation in a var
and then have some other system that takes that var and moves the vehicle back to that position and orientation
private _vehicle = vehicle player; // Get this via a trigger
LAST_CHECKPOINT = [getPosWorld _vehicle, [vectorDir _vehicle, vectorUp _vehicle]];
so this would store the data
and then to "load" the checkpoint you could just do this
private _vehicle = vehicle player;
_vehicle setPosWorld LAST_CHECKPOINT#0;
_vehicle setVectorDirAndUp LAST_CHECKPOINT#1;
would need some refinement and customization to work exactly how you want but that'd be the core of it
hey
anyone on?
i want to make a nothing variable, and then use an expression to assign the variable if it does not exist
isnil and isnull i am confused on
haha nvm, either var = nil will work because its nil, or it will work because its a latch, I think my code will work regardless if i understand how to check if variables exist
if (isNil "VarName") then {
//...
};
it has to be in quotes?
got it
it has to be either quotes or code
for your purpose quotes is best
thanks
So, I have a plane that flies a long distance from its starting point to a single waypoint. The problem is that it does not fly in a straight line. It usually starts out flying at the wrong angle, and slowly corrects itself after if has already drifted off-course a bit. I would like it to fly in an (almost) perfectly straight line. What can I do to fix this?
Can you access the planes object?
yes, the pilot as well
set it’s direction to a calculation of the direction you need?
yes
I already have
it starts in the right direction, and on its way to the waypoint it swerves around a bit and doesnt always go completely straight like I want it to
I want to minimize that
Gotta love arma 🤦♂️
mhm
@past wagonYou could have some sqf that continuously corrects its direction, but it could result in weird behavior
something like this
// ForcePlaneDir.sqf
_this spawn {
params["_plane", "_flightTime", "_dir"];
private _startTime = diag_tickTime;
while {diag_tickTime - _startTime < _flightTime} do {
_plane setVectorDir _dir;
sleep 0.1;
};
};
just a rough method but might work for what you want
you just input the plane, the time you want it to keep it straight for, and the desired direction
alternatively if you just want it to keep whatever direction it starts with so you don't have to input a vector, this would do the trick
// ForcePlaneDir.sqf
_this spawn {
params["_plane", "_flightTime"];
private _startTime = diag_tickTime;
private _startDir = vectorDir _plane;
while {diag_tickTime - _startTime < _flightTime} do {
_plane setVectorDir _startDir;
sleep 0.1;
};
};
first version you could do [plane, 20, [1,0,0]] execVM "ForcePlaneDir.sqf" for a 20 second flight straight along the X axis
second version could just do [plane, 20] execVM "ForcePlaneDir.sqf" for a 20 second flight along its initial direction
Blame physx
does a forEach loop change how a script runs?
Wdym? Change the scope? No. Its just a loop
In one of my scripts, having a forEach loop at the end of the function messes up the entire running of the script. most of the parameters passed in are made null and it breaks the functioning of the rest of the script
should i link the code
if not huge yes, otherwise use https://sqfbin.com
I made a reddit post with all the info, should i jsut link that?
has the output and stuff
Please put the code in sqfbin aswell. Thw syntax highlighting makes everything easier
ok
Also, reddit is slow on my phone 
first one without forEach - output https://i.imgur.com/zEab6vh.png
with forEach - output https://i.imgur.com/lIwzbnk.png
Looks like a deltaT issue to me, the code that converts the objects for text output with str probably gets scheduled after some of the objects are deleted by the forEach
resulting in NULL-object
does system chat need to be converted to str?
Are the objects successfully deleted or is it just the text output you're concerned with?
with the forEach loop all objects are deleted, and without it none are deleted
Makes sense, the other code doesn't have a deleteVehicle anywhere
yeha :/
So sounds like it works fine then?
I believe what I described above is what's causing your text output to fail
yeah trying that now
nup didn't change anything
Is the code called or spawned? If spawned, don't and try calling it.
called
@wind cairn What'd you change?
Oh I wasn't saying that it'd fix deletion, just that I had an idea why your text wasn't outputting properly
oh ok
So you're saying it's deleting all of the objects instead of all but one?
yeah
Hm
i think the issue has to be something with the forEach loop, since with it commented out text outputting and the array altercations work perfectly
Try using apply instead of a select? And just delete with that?
Code overall looks fine, looks like some weird code conflict of some kind
Idk why the forEach is doing the wonky and can't test so id day just
_missionObjects apply ([{deleteVehicle _x}, {_x}] select _x isEqualTo _objectToKeep);
On phone so expect atleadt one syntax error 
_objectsToDelete = _missionObjects apply { if (_x != _objectToKeep) then {deleteVehicle _x} };
this seems to work
Code clarity is far better than reducing chars/statements
if SQF had proper ternary operations it'd be another story but I hate when people do it w/ array select
_x isNotEqualTo _objectToKeep && { deleteVehicle _x}
:D
What confuses me, does apply not do exactly the same thing as a forEach loop? iterating over the array and applyin the code to each entry?
But you want to delete all objects but one? Why not just do
_missionObjects - [_objectToKeep]
Then you don't need to check inside the loop
Yes, the only difference is the result
huh weird
No the worst of all is ```sqf
{
deleteVehicle _x;
} forEach (allMissionObjects - [_objectToKeep]);
lmao
Well, that changes the whole code function but true
tried this, _x is undefined
DELETE * FROM mission_objects
Yeah, dedman caught that already
That would be the best way to do it, if you would use _missionObjects
Wrong SQ
Indeed it was meant to be humorous
I can't see why you'd ever want to delete all mission objects but 1
so I can have multiple spawn points for an item whihc is randomly selected
Couldn't find any other way of doing it
Huh?
You spawn a item at many spots, then delete all but one?
Oh god
i guess, ik its inefficient
Why not just selectRandom the array of pos?

yeah thats actually a way better idea

no spam plox 😛
is createVehicle supposed to create 2 objects?
it seems likes its creating the object at the desired location but then creating a second one at a random position close to the object
function call
[["box1Pos", "box2Pos", "box3Pos", "box4Pos", "box5Pos", "box6Pos"]] call Buzz_fnc_boxSpawner;
Are any of the objects placed in 3DEN beforehand?
Ah I know what's happening
You don't have any code to prevent multiple objects from being spawned at the same position, and when it tries to do so, since CAN_COLLIDE is not a param in your createVehicle call it prevents them from colliding by putting the second one away from the existing one
So you need to either prevent multiple objects from spawning at the same pos or set CAN_COLLIDE to allow them to spawn at the same pos
But why is it trying to spawn multiple objects anyway?
I presume you run the code multiple times?
nope, just once in the init.sqf
Well that is peculiar then
no idea whats happining
See if it happens spawning in a different object perhaps?
yeah still happens
in multiplayer?
dedicated server
so it's created once by the server then once by every connecting client
ah
if (isServer) then { /* */ };
```but better use `initServer.sqf` 😉
thank you!
yep
Probably your other code had same problem as well, dedi was first deleting it then you were questioning why only one object is left... thats cos the dedi side left only that object from random selection.
Yep, I didn’t even know it was called on the client aswell since it didn’t say on the little descriptions on the event scripts page
The biki documentation is notoriously patchy
what are you using? init.sqf ?
some things are given in extreme detail and others are expecting you to revive dead languages to understand what they're talking about
well, if you need moar details don't hesitate to ping in #community_wiki, we can sometimes provide edits where needed 🙂
though the details are here for this specific file ^.^
https://community.bistudio.com/wiki/Initialization_Order
Yeah don't get me wrong, a lot of the pages are pretty nice
just a few notable areas where things are incredibly vague
nice work on that script optimization page btw, lots of good stuff there
no worries, we are aware that the wiki ias, hem, quality differences let's say 😄 but sometimes we don't notice/work on it because it may be assumed that people know / deduce / find in outside resources, so something that appears "obvious" to us may need to be addressed
don't hesitate, it's a genuine, healthy invite 🙂
Fair enough, I'll let you guys know next time I stumble into a rough part of documentation 😛
I'll say one area that is severely lacking in proper documentation as far as I can tell is anything regarding .RTMs
Mostly have to resort to outdated youtube videos and vague outdated posts on the forums
ooooooh yeah.
and that's definitely not my turf 😬
(but we have @warm hedge on our team *hint hint* 😏)
😮
wha-
From the experiences friends and I have had with them, should be more like RTFA
as in Run The Fuck Away
but yeah any improvement to that documentation would be vastly appreciated by many I assume
Oh yeah and another thing
the BISkeleton.p3d that pretty much every RTM tutorial tells you to use is super hard to find on the internet unless you know someone who already has it
the original BI download link for it has been down for god knows how long
and with armaholic down most links on the forums to it are dead as well
had to find it on some ancient apache webserver
those torrents still work
Blech, torrenting
what's wrong with torrents?
Nothing but it shouldn't be the standard for distributing files
It's 2021, let me download things with my browser in 1 click
Does playsound work on a multiplayer server? will the other players hear it?
Could you give me an example?
Sure!
["soundName"] remoteExec ["playSound"];
just change soundName to whatever your config sound name is
Wow, that's a lot simpler than I thought. This is able to be executed via trigger on Radio Alpha, right? And this'll be heard by all players? (global sound)
This will be global, yes
As for execution via trigger
make sure that the trigger code isn't already running locally for each player, if it is you can stick w/ just basic playSound w/o remoteExec
Sorry, kinda got lost there now. how do I make sure it isn't running locally for each player? Will the server only condition mitigate that?
Yes the server only condition would do that
If you mean that all players will have the trigger for Radio Alpha execution, they don't, only one player will have it
What I'm saying is if you want to do remoteExec you need to make sure it's only executing on the server
but might be better to just stick w/ normal playSound w/ locality
aka just use playSound w/o remoteExec
basically, playSound only runs locally but if your trigger gets run for every player locally then that doesn't matter
Or I should try it out with server only condition. I've found that using regular playSound without remote exec doesn't let the sound play globally
Yup worth a shot
Might be because it's a dedicated server
Thanks so much! I'll try it out and see if it works!
No problem, if you run into issues and I'm still awake I'll try to help you out
That means a lot. Thanks!
Is there a way to get the correct ammo name for a static weapon? I'm attempting to create a rearm ammo create for the "RHS_Stinger_AA_pod_WD" turret and when I attempt to use "rhs_ammo_fim92_missile" or "rhs_mag_2Rnd_stinger" with the "call ace_rearm_fnc_createDummy" command it will create the ammo box but the turret won't rearm. I've been able to make this work for other static weapons so I'm guessing I'm just using the wrong type of ammo.
check the config
@little raptor That is where I got the rhs_ammo_Fim92_missile name from and I didn't see anything else in there.
I'll keep looking.
@craggy lagoonIf you have the weapon available as an object, you can get its exact current ammo type like this w/ debug console
currentMagazine weapon;
Actually, if it's a turret you may want to use this
I wasn't able to get anything back with them. If I use the Huron Ammo container to span an rearm box for the stinger turret I'm able to reload the turret. What could I run on the ammo box that is spawned from the Huron ammo container to see what it contains?
That's not how the vehicle ammo works, basegame or ace. You're looking for something like https://steamcommunity.com/sharedfiles/filedetails/?id=2162698437
I'm sorry I'm not following what you mean by that's not how it works? You can spawn individual ammo rearm boxes with Ace. Just need to change your settings Ace Logistics, Rearm, Rearm Amount set to Amount based on caliber.
Right, but those boxes don't contain the "ammo" inventory item. They are just dummy objects that abstract the ability to increase the vehicle's ammo state.
Hello!
This script locks doors (usually in house \ object init) and if a unit have a "key" item in their inventory, it opens the door \ gate.
Problem - doesn't work in MP. Can you please point me to the issue?
If !isServer exitWith {};
[this, player] spawn { params ["_door", "_unit"];
_door setVariable ['bis_disabled_Door_1', 1, true];
waitUntil {sleep 1;
if (
(_door getVariable ['bis_disabled_Door_1', 1]) >0 &&
{_unit distance _door < 3} &&
{'Keys' in (uniformItems _unit + vestItems _unit + backpackItems _unit)}
) then {
_door setVariable ['bis_disabled_Door_1', 0, true]
};
(_door getVariable ['bis_disabled_Door_1', 1]) ==0
};
waitUntil {sleep 1; (_door animationPhase 'Door_1_rot')>0};
_unit groupChat "The gate is open";
_unit removeItem 'Keys'
};
It's run on server and being passed player
Can you be more gentle with me? 😂
I'm pretty noob in Server stuff
So what do I need to do exactly?
You'll need to do your checks per-player
{
private _unit = _x;
// do your checks
} forEach allPlayers;
Alright, I'll dive into it. Thanks guys
Is there a reason you check for server or are you just following it because you saw it is being used in most cases?
To me , it looks fine if this code was done on all non server instances as well. But in case you want to pass it to server, that groupChat will not work as you expect either (message will only be seen on server so either only for hosting player or for no one in dedi scenario.)
I just made a mission with it to my group, tested it in SP, worked and on Dedicated it didn't
I'll try to refine it so it won't need the player stuff
Actually in both cases groupChat will fail anyways.
Dont forget to remoteExec for groupChat in that case.
Yeah will do. Thanks
hello again people 🙂
i have a question how is it that land "LAND" dont work but this works
_wp setWaypointStatements ["true", "heliback3 land 'LAND'"];
[20.52]
https://community.bistudio.com/wiki/land
land
I just dont understand the wiki
and another thing
i am trying to get the ai units get out from heli, they do get in but then i cant make them get out of the heli when heli is landed
i tried everything from this
https://community.bistudio.com/wiki/doGetOut
to this {soldier action ["getOut", heliback3]};
(soldier is the group name)
i just dont understand
can someone explain it to me?
i even tried to unnassign vehicle
how is it that land "LAND" dont work
this works
heliback3 land 'LAND'
wat?
heliback3 is the name of the helicopter
I know
you say it doesn't work
and in the next line you say it works
that's the wat
soldier is the group name
you need to pass units
at it is
heliback3 land "land dont work but when i type ["true", "heliback3 land 'LAND'"];
where do you try it?
the helicopter pilot must be "ready" for landing to work
so if you use waypoints the second code is the correct way
how do i put the code in the chat
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
if it's too big use sqfbin.com
thanks
// _wh0 setWaypointType "MOVE";
_wh0 setWaypointSpeed "NORMAL";
_wh1= getMarkerPos "_heppa";
_wh1 = _GG2 addWaypoint [_wh1, 0];
heliback3 land "LAND";
_wh1 setWaypointType "TR UNLOAD";
heliback3 disableAI "TARGET";
heliback3 disableAI "AUTOTARGET";
heliback3 allowfleeing 0;
heliback3 setbehaviour "CARELESS";
_wh1 setWaypointStatements ["true", "heliback3 land 'LAND'"];
sleep 10;
{soldier action ["getOut", heliback3]};
doGetOut ["_s1", "_s2", "_s3", "_s4", "_s5"];
```sqf
lol xDD
you must end it with three ` as well
thanks @little raptor
Are you asking why
["true", "heliback3 land 'LAND'"]; works
but
["true", "heliback3 land "LAND""]; not works?
heliback3 land "LAND"; dont work
but
setWaypointStatements ["true", "heliback3 land 'LAND'"]; works
i am sorry i cant articulate myself wert well
very*
Oh alright, it is probably because it is done instantly (but being pretty much skipped cos of assigned waypoint) while the other one waits till destination is reached(so waypoint is done) and then applied.
so i managed to make the heli land like this
_heli_1= createVehicle ["RHS_UH60M2_d", getMarkerPos "_paddi_1", [], 0, "NONE"];
_heli_1 setdir 140;
_heli_crew1 = [getMarkerPos "mkr_heli", west,2] call BIS_fnc_spawnGroup;
_units = units _heli_crew1;
_units params ["_h1","_h2"];
_heli_crew1 addVehicle _heli_1;
[_h1] orderGetIn true;
[_h2] orderGetIn true;
//=======================
_wh0 = _heli_crew1 addWaypoint [getMarkerPos "_heppa", 0];
_wh0 setWaypointType "TR UNLOAD";
_wh0 setWaypointSpeed "FULL";
_wh0 setWaypointBehaviour "SAFE";
_heli_1 land "LAND";
now the crew even lands without any problem 🙂
so it seems like if i createUnit then immediately addWeapon/addMagazine to it, it works in SP but not MP (running from a client, unscheduled)
addWeapon and addMagazine seem to be local argument/global effect and createUnit creates the unit locally right
so this should work
or is there some weird init where createUnit doesn't "finish" until it's told the server so it's not a valid unit for inventory purposes
Try addWeaponGlobal and addMagazineGlobal
just be careful not to run addWeaponGlobal on dedi server as it's broken for dedi
some stuff have changed and you need some delay for objects to sync before using any commands on them
hm what's the best way to do that? just spawn and then waitUntil something?
Never had any issues applying commands to objects immediately after creation
sleep
but you might want to try these first
hmm ok it seems to work but it's very dependent on how long i sleep for
addMagazineGlobal seems to work but i also need to setIdentity which doesn't, so i still need to sleep :/
@plush novaYou could just remoteExec setIdentity like so
[params] remoteExec ["setIdentity"];
Odd
yea hi'm just worried it will randomly not work because of lag or something
Safe option might be to do something like this
fnc_IdentifyAfterInit = {
params["_unit", "_identity"];
waitUntil {!(isNull _unit)};
_unit setIdentity _identity;
};
publicVariable fnc_IdentifyAfterInit;
[_unit, _identity] remoteExec ["fnc_IdentifyAfterInit"];
or define fnc_IdentifyAfterInit somewhere else first so you don't have to publicVariable it
up to you though, sleep will probably be fine in most cases
hey
so im trying to give all players zeus, but it seems like the code doesn't work unless its local or when the player has already spawned and not in loadout menu.
_logic = createCenter sideLogic;
_logic = createGroup sideLogic;
_zeus = _logic createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
_zeus setVariable ["Owner", ""];
_zeus setVariable ["Name", ""];
_zeus setVariable ["Addons", 2];
_zeus setVariable ["Forced", 0];
[_x, _zeus] remoteExec ["assignCurator",2];
_zeus addCuratorEditableObjects [[_x], true];
[_zeus, [-1, -2, 0]] call bis_fnc_setCuratorVisionModes;
_zeus addCuratorPoints 0.1
}forEach (call BIS_fnc_listPlayers);
run it local with initPlayerLocal? saves you the remoteExec
They're remoteExecing it on the server though
so should work fine
well so i put it in a init player local sqf
and well was not a solution
Did you remove the forEach?
as initPlayerLocal runs for every player, https://community.bistudio.com/wiki/Event_Scripts#initPlayerLocal.sqf. you just reference the player there
_logic = createCenter sideLogic;
_logic = createGroup sideLogic;
_zeus = _logic createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
_zeus setVariable ["Owner", ""];
_zeus setVariable ["Name", ""];
_zeus setVariable ["Addons", 2];
_zeus setVariable ["Forced", 0];
[_player, _zeus] remoteExec ["assignCurator",2];
_zeus addCuratorEditableObjects [[_player], true];
[_zeus, [-1, -2, 0]] call bis_fnc_setCuratorVisionModes;
_zeus addCuratorPoints 0.1;```
Also createCenter sideLogic is unnecessary
all sides have centers created automatically in arma 3
awesome
thanks
np
hmm ill probably take a break, but yeah, after this problem then i gotta solve alive problems
like i have a script that makes every west vehicle a respawn vehicle, to get the player closer to the action, but theres no way to preload alive units