#arma3_scripting
1 messages · Page 771 of 1
gunners are turrets
but a vehicle has only 1 gunner seat
can anything go wrong
no
a gunner is just a special turret
from what I've seen, "turret" only refers to the "new" man-turrets while "gunner" is for things like tank gun, MRAP gun, ghosthawk miniguns, etc
can't remember what the BIS term is, was something like FFV?
no.
man turrets are called FFV
ghosthawk miniguns,
that has only 1 gunner
the other one is a turret
(technically both are turrets)
even the commander seat is a turret
the general vehicle seat classification is driver, cargo, turret
commander and gunner are just special turrets
A lot of the engine limits in RV are due to even Arma 3 basically just an upgraded version of OFP, I'm not surprised if there is some RV limitation of "only 1 gunner" in a vehicle. That's just one reason why Enfusion is so exciting
gunner is just a term
there's no difference between gunners and turrets
a vehicle can have as many gunners as you want
look at the ghosthawk and chinook thing (forgot its Arma name)
no functional difference, but there is a difference when scripting sometimes you use moveInGunner sometimes moveInTurret, etc
you can just do moveInTurret
if you want the main gunner you can quickly do moveInGunner without knowing the turret path
Hmm, one of the CUP tanks has 2 gunner positions: [[B Alpha 1-1:1,"driver",-1,[],false], [B Alpha 1-1:2,"gunner",-1,[0],false], [B Alpha 1-1:3,"commander",-1,[0,0],false], [B Alpha 1-1:4,"turret",-1,[0,1],false], [<NULL-object>,"turret",-1,[0,2],false], [<NULL-object>,"gunner",-1,[0,3],false]]
probably top mounted MG
vanilla vehicles do this too, but given to commander slot
I thought there was only ever supposed to be 1 "gunner" position, regardless the number of turrets.
Oh, you mean their turned out positions??
No there can be multiple gunners
multiple turrets or multiple "gunner" seats?
that's just a buggy turret
to make a gunner all you need is: primaryGunner = 1 in turret config
the second one was probably inherited by mistake
a vehicle has only 1 gunner
because moveInGunner doesn't take any "specific gunner seat" parameters
and the gunner command doesn't give you an array. it just gives you an object
how can I make AI wait at waypoint? Whenever I try to google anything about that, everything is referring to the hold waypoint and skipping it.
what I want to achieve is an AI group that has a patrol route, but everytime it reaches the waypoint, they stay there for 5 seconds before moving to the next one. I thought the waypoint completion timer will do the job but it only affects its state, AI will continue to the next one anyway.
you can add the next waypoint 5 seconds later
hold waypoint is correct
so there's no way to do this using the editor waypoints?
but hold waypoint doesn't have a proper condition so it completes instantly, thus it seems "skipped"
issue with skipping hold waypoint is that it gets deleted, the patrol route should stay the same and just cycle over and over
you can try doStoping the leader in waypoint completion statement
not sure if it deletes the waypoints tho
iirc it didn't
this spawn {
doStop _this;
sleep 5;
_this doFollow _this;
};
thanks, I'll try this out
Is there any way to force an ai vehicle crewmember to turn out, so they can use the guns which are only usable while turned out?
Would anyone show me how to take something like:
_BRPA11 = BRPA getPos [15, (getDir BRPA) + 090];
BA11V = "I_APC_Wheeled_03_cannon_F" createVehicle _BRPA11;
[
BA11V,
["Guerilla_03",1],
["showCamonetHull",1,"showBags",0,"showBags2",0,"showTools",0,"showSLATHull",0]
] call BIS_fnc_initVehicle;
BA11V setDir (direction BRPA);
BA11 = [_BRPA11, WEST, [
"B_G_Soldier_F","B_G_officer_F","B_G_Soldier_SL_F", //Vehicle Crew (Driver, Commander, Gunner)
"B_G_Soldier_TL_F","B_G_Soldier_TL_F", //Dismounts ("Right Wing", "Left Wing")
"B_G_Soldier_GL_F","B_G_Soldier_GL_F",
"B_G_Soldier_AR_F","B_G_Soldier_AR_F",
"B_G_medic_F","B_G_medic_F"
],[],[
"Private","Sergeant","Sergeant",
"Corporal","Corporal",
"Private","Private",
"Private","Private",
"Private","Private"
],[],[],[],0] call BIS_fnc_spawnGroup;
BA11 setGroupIDGlobal ["A 1 1"];
BA11 addVehicle BA11V;
Units BA11 select 0 moveInDriver BA11V;
Units BA11 select 1 moveInCommander BA11V;
Units BA11 select 2 moveInGunner BA11V;
_WPBA11 = BA11 addWaypoint [BA11V, 0];
_WPBA11 setWaypointType "GetIn";
PublicVariable "BA11";
{
{
_equip = _x spawn ASG_FNC_BLIGear;
waituntil {scriptDone _equip};
_x addEventHandler ["Killed", {
BluTickets = BluTickets -1;
PublicVariable 'BluTickets';
BA11Grave pushback (_this select 0);
PublicVariable "BA11Grave";
}
];
} foreach units _x;
} foreach [BA11];```
Reduced down to like... the minimum number of good generic variables that I could reproduce as needed.
afaik AI do that based on behavior
it can't be forced
so they can never use those guns then.
BA11
do you need those later?
_equip = _x spawn ASG_FNC_BLIGear;
waituntil {scriptDone _equip};
don't ever do that
just call
Yes, I need it later.
For curiosity's sake, why don't ever do that?
How would I call in that context?
Action 'turnout'? https://community.bistudio.com/wiki/Arma_3:_Actions#TurnIn_.2F_TurnOut
because you're creating a new script then waiting for it to finish in the current script, so you end up with two scripts
call can do that in just 1 script
Okay!
How would I call in that context?
_x call ASG_FNC_BLIGear;
no need for waitUntil or anything
} foreach [BA11];
why?
Oh! So just call it, rather than spawning it. I gotcha.
I think I was having issues doing it that way long ago, and that's why it's done the way it is.
BA11Grave pushback (_this select 0);
PublicVariable "BA11Grave";
I'm gonna assume that array can get big pretty huge really quick
broadcasting arrays is slow
Because it's part of a larger script, and this was done to several groups at once at the end of the script, but I'm looking to rewrite it.
It gets up to about eleven objects in the array.
having issues doing it that way long
you were not doing the same thing as what you wrote above
the above code is already scheduled
otherwise you wouldn't be able to do waitUntil in the first place
I wasn't using waitUntil before and I think the script wasn't finishing.
because you had spawn
Ah! Interesting. Okay, I'll note that.
Thanks for everything so far. got anything else?
call executes the script and waits for it to finish
Units BA11 select 0 moveInDriver BA11V;
Units BA11 select 1 moveInCommander BA11V;
Units BA11 select 2 moveInGunner BA11V;
you can just usemoveInAny
units BA11 select [0, 3] apply {_x moveInAny BA11V};
I did some testing, don't use a hold waypoint just use all move waypoints. At the place where you want the ai to hold for x length of time put down 2 move waypoints close to each other, in the first one OnActivation set something like holdTime = time + 5, then in the second one set Condition to time > holdTime. Then it will work and repeat forever
My testing indicated that the group leader must be driver (or sometimes commander is accepted) if a high command subordinate group will obey high commander's waypoints. Also, I'm particular about some things.
Will it automatically place them in appropriate seats for this?
moveInAny already moves units in that order
Ah! Okay, great! Thanks!
https://community.bistudio.com/wiki/moveInAny
Seat assignment seems to use the following priority logic:
driver (moveInDriver) → commander (moveInCommander) → gunner (moveInGunner) → turrets (moveInTurret) → cargo (moveInCarg
That's terrific! Then that can just be the whole group.
I'm trying to make a AI body interactable so players can interact with it and get a popup menu with text.
I used leaflets to accomplish this and it works. However, I have to set a texture for the leaflet to work and this causes the AI's texture to turn into the one I set.
Is there a way to make sure the AI's texture doesn't change or is there a better method to get a text popup?
addAction works with dead bodies
Holdactions as well, though it may make a difference if the body is dead for long enough, and the game cleans it up as an entity.
I had a mission where a body in a car spills out when the door is opened, so it can be investigated; but it only worked right if the guy died right before the players got to them, else it went screwy.
Ugh, still in the weeds trying to understand using call to run functions instead of spawning or execing them.
Alright, initserver is scheduled. So ill call my staging file off of that, so its scheduled. Alright, task two, need some trigger magic and define a function for the results, so just call tha- TRIGGERS ARE UNSCHEDULED SPACE YOU FOOL
call makes the script wait until the called code is completed, then returns a value. spawn lets the first script keep running, but does not return a value
so it's really just whatever you need
Will ai groups given a "move" waypoint break off from pursuing the waypoint in order to attack known enemies?
Is there any possibility to get the current rpm gear of a vehicle ?
I believe the group in general will engage enemies while still trying to reach the waypoint. However, squadmates that are "engaging" will break formation and attempt to get into a more advantageous position to kill the targets, which could be quite a ways away
So wil lthe group as a whole break away from the waypoint path in order to pursue enemies? And if not, is there a waypoint type that does allow that?
No, only individual units might break away, squad leader will stay on objective. Try search and destroy, although the waypoint system is not really made for this
Is there a command to get a group of artillery to fire on a target? Not a single artillery piece, but all pieces in a group.
Well, I've found this which gets them to fire. But how do I choose the dispersion amount? [ARTY_1,ARTY_2,ARTY_3] doArtilleryFire [getposasl ARTY_TARGET, "8Rnd_82mm_Mo_shells", 6]
Is there a way to get all vehicles (or in this case turrets) that belong to a group?
Got it with BIS_fnc_groupVehicles.... now is there a way to detect if a vehicle is artillery?
Not in base game, artillery is just kinda as accurate as it can be.
If you really must reimagine the Somme, you could do with https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_guidedProjectile and some https://community.bistudio.com/wiki/BIS_fnc_randomPos
Is there a way to determine if a vehicle which can fire artillery is ready to fire an artillery round?
Is there a way to return which weapon on a vehicle is artillery?
Or which "gunner" is the artillery gunner?
I guess I'll need this.... to get the artillery gun on a vehicle... check if it is presently crewed... check if it is ready to fire... check if target pos is in range.
I have to ask - is it important that your player/s see or hear the guns firing?
Some of the artillery is going to be vehicles spawned in during the game
so yes... I want it all real.
But will the players see or hear the guns?
is this a simulation or what?
I don't see what the point of having this stuff in the game is if you don't use it.
Let me describe it another way.
It may be all a simulation, sure - but would you mission be enhanced by having an entire surface naval fleet a thousand kilometers away, tanking your framerate and bloating your bandwidth, all so the players can see something explode?
If its that important, then by all means, youve got some coding ahead of you but its all doable.
I'm going to stick with real artillery.
Fair enough.
Now, how to find which gun on a vehicle is artillery.
some vehicles have both an artillery gun and a MG.
Should just be currentweapon gunner artilleryvehicle
that's returning their rifle, not the weapon they're crewing.
Currentweapon artilleryvehicle
is it possible to check if a weapon is artillery?
I guess I could make the assumption that the "gunner" on any artillery vehicle always has the artillery gun. Don't know if it's 100% a safe assumption though.
Yeah, considering its the commander with the GMG. Currentweapon should always return the gunner's weapon.
But you can record the weapon type and make sure with some currentweapon == 'b_155mm_gun_name_here' or w/e
There must be a way of getting whether a weapon can serve as artillery from its config.
Also, I need to find if a weaon is ready to fire in the sense that both a mag is fully loaded, and it has completed its cycle from the previous shot.
Do you think it's a safe assumption that all artillery vehicles start with a HE mag loaded in their artillery weapon?
Weaponreloadingtime && ammo == maximumroundshere
Is there any reason why doArtilleryFire shouldn't work on a mobile artillery vehicle?
the magazine class in doArtilleryFire is case sensitive
ensure it matches exactly to config class name
and also check with that "canArtilleryFire" command to see if it can engage that position
I've switched over to using fire mission waypoint, which is way simpler. However, I don't know how to cancel it! When I remove all waypoints for the group, the guns keep on firing.
Im trying to use the spawn ai module, anyone know how to get the ai to sync to high command when spawned?
doWatch
I found another solution. Just move the waypoint about a million miles out for a few seconds, then delete it.
Is there a classnames designated for type of unit? Like a Infantry, Armor, Plane etc.
Well, that's what classNames designate for...
I'm not sure what you mean
do you want something to use with isKindOf?
Man is CAManBase
Man is aFeatherlessBiped
I found this digging around other people's mission files to learn how to script. I don't know what is this 'OTANK' meaning. Mission_Dictionary setVariable ["OTANK", "O_MBT_02_cannon_F"];
OPFOR Tank I assume. That should mean nothing just a designation/note
that's just a variable, which corresponds to an OPFOR tank class (O_MBT_02_cannon_F)
Don't make me bring Diogenes in here
Guessing this goes in here. How would I go about globally hiding/showing objects + how would I globally have a light turn on/off. Im trying to create a spotlight by hiding/showing the light cones but apparently hideObjectGlobal doesnt seem to work. As for turning normal lights on and off, im trying to make the players be able to turn a series of portable lights on/off using an addaction trigger. All this works fine client side but obviously not server side
hideObjectGlobal must be executed on the server and only on the server
what do you mean by that? What I've pretty much done is put the hideObjectGlobal command into the objects init section that I want to hide, and initally use the trigger to set the hideObjectGlobal to true or false
By default, code in an init field is executed on all machines connected to the session, and in a trigger field is executed on all machines where the trigger condition is satisfied. The hideObjectGlobal command does not work if it is executed on a machine other than the server, or if it's executed by the server and by other machines at the same time. Because you're using an init field and trigger fields, it's meeting both of those conditions for failure.
Code in an addAction's code parameter (this is NOT a trigger) is only executed on the machine that did the addAction (which is usually not the server) so that would also meet a condition for hideObjectGlobal to fail.
Hm
in terms of getting it to work, would I have to use something along the lines of remoteExec or so?
Init fields are also executed again by any client that joins the game late, when it joins the game, so they're not really a safe place to execute global commands that might be countermanded later.
Yes, remoteExec targeting the server would be good for an addAction; for a trigger or init field you should use an if isServer then { check or set the trigger to Server Only.
Alrighty, much appreciated. I'll try to quickly give the remote exec a look. Need to get this done asap for a mission im trying to host 😅
Again, thanks a lot. Works just fine now and saved me quite a bit of pain
What would be the best way/practice for a params array that includes an array mission type, and then array that checks for uniform, headgear, and etc. ```sqf
params [[["_uniform", true], ["_permissibleArea", false]], [[["_uniform", ""], ["_headgear", ""] ...etc]];
Essentially an undercover function that checks if a specific uniform/kit is needed and if an area is permissible or not. Then an array to check what type of uniform/kit is required to stay undercover.
what you wrote is wrong
and I don't get the question. what does being undercover have to do with params?
I'm trying to create a function that first checks if you need to match a specific uniform/kit to be undercover, then if an area is permitted. So if you're undercover but enter a non-permitted area you're no longer undercover if _permissibleArea is set to true.
you don't need bools for that
just use a default value:
params [["_allowedUniform", ""], ["_area", []]];
private _forceUniform = _allowedUniform != "";
if (_forceUniform) then {...};
private _checkArea = _area isNotEqualTo [];
if (_checkArea) then {...};
So what if I wanted to get more specific, checking if you have a certain headgear, vest, and etc?
let me ask you a question first. does the gear differ for each "permissible area"?
Now that you asked that, that would be a great added function, so yes
and how do you define each area?
hi, is someone able to help with a simple heli spawn script? like, spawn heli, move to waypoint 1 and 2, despawn. thats it.
_crew1 = creategroup WEST;
_airframe1 = [getPos marker1, 140, "B_CTRG_Heli_Transport_01_tropic_F", _crew1] call BIS_fnc_spawnVehicle;
_wp1 = _crew1 addWaypoint [getPos marker1, 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "LIMITED";
_wp2 = _crew1 addWaypoint [getPos marker2, 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "LIMITED";
i made this, but missing despawn
Areas will be defined by a trigger
_airframe1 = [getMarkerPos "marker1", 140, "B_CTRG_Heli_Transport_01_tropic_F", west] call BIS_fnc_spawnVehicle;
_crew1 = _airframe1 select 2;
_wp1 = _crew1 addWaypoint [getMarkerPos "marker1", 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "LIMITED";
_wp2 = _crew1 addWaypoint [getMarkerPos "marker2", 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "LIMITED";
_wp2 setWaypointStatements ["true", toString {_veh = vehicle this; deleteVehicleCrew _veh; deleteVehicle _veh}]
that was fast ! trying it now
well you can set the permitted gear on the trigger as a variable:
_trigger setVariable ["AllowedGear", ["uniformClass", "vestClass", etc.]];
then in the function you can do this:
params ["_unit", "_area"];
if !(_unit getVariable ["isUndercover", false]) exitWith {}; //why bother checking a unit that is not undercover already?
_gear = [uniform _unit, vest _unit, etc.];
private _allowedGear = _area getVariable ["AllowedGear", []];
if (_gear isNotEqualTo _allowedGear) then { // not undercover anymore
_unit setVariable ["isUndercover", false];
...
};
if an area is not permitted don't assign any allowed gear to it and the function will work as it is
hmm, trying to call it with a trigger with nul = [] execVM "helispawn.sqf"; but doesnt seem to work.
is it possible getMarkerPos doesnt work? last time i made a small script I changed it to getPos and it suddenly started working
first of all never use getPos
second of all, what are marker1 and marker2?
invisible helipads
ohh !
hah my mistake
ill check it again
wow it seems to work now. thanks man. sick
❤️
im pretty new to this. why is getPos bad?
https://community.bistudio.com/wiki/getPos
explained in the yellow/orange box
interesting, thx
is this possible?
Hi can anyone help me out on a Good .cfg file and the right script to create a rotation on missions the text on wiki does not work
What is the script for making a player who is not part of the vehicle's group command the vehicle from the gunner's seat?
I want a player to get into a tank in the gunners seat and be able to drive the tank and shoot without having to have the AI in the tank be assigned to him
try #arma3_config or #server_admins. .cfg files are not scripts so it's not related to this channel
i dont think you can do that, in order for the player to command the AI in the vehicle the player has to be the squad leader
try setEffectiveCommander
Okay
that was in reply to the other guy 😅
you can ask in #server_admins
Thanks! So it's "setEffectiveCommand Gunner"?
no
no
vehicle player setEffectiveCommander gunner vehicle player
no guarantee it'll work
Does the Vehicle thing need to be the specific variable of the tank or just vehicle (I'm using multiple tanks)
no
it works on the current vehicle you're in. you must run it every time you change vehicles
Sweet. So this in the init of the tank?
no you must run it every time 
use GetInMan event handler if you want to automate it
Oh boy this is gonna get complicated isn't it
ohhhhhh yes it is
this addEventHandler ["GetInMan", {
params ["_unit", "_veh"];
_veh setEffectiveCommander _unit;
}];
I just wanted to make an arma scenario where it's one man to an Abrams and it's like World of Tanks but arma...
anything that sounds simple, never is
put that in player's init
Every player I wish to use for it, right?
yes
Okay
in multiplayer you better add a if (!local this) exitWith {};
hmm, setEffectiveCommander is supposed to be run globally though.
you sure?
well, it says so :P
but I'm honestly not sure it'd work at all if the AIs are in different group or different locality.
makes no sense
What happens if I don't add this? Bad things right...?
would need to test.
seems like it can be ran like any other command
it wont work, thats what happens
no it'll work just fine
if the wiki is correct
Okay because I've no idea where to put that in
I guess like many other EHs it can be added to remote units but only triggers where unit is local
somtimes it can be hit or miss
My coding experience boils down to like 3 lines of HTML
no need
just try without
@tough abyss since wiki says execute globally just do it that way then:
this addEventHandler ["GetInMan", {
params ["_unit", "", "_veh"];
[_veh, _unit] remoteExec ["setEffectiveCommander", 0, false];
}];
The GetInMan will (probably?) trigger everywhere though, so it's already running setEffectiveCommander globally.
well I just assumed it works this way
Errored out
yeah params are wrong... 
im starting to think that just having the vehicle's crew join the players group would be easier
Didn't catch the error but something about expecting an object and getting a string
fixed
Yes but I don't want that
In Arma sometimes you can't have what you want :P
but its just as easy to remove them too
This is fine if it works though, but you'd need to check multiplayer.
AYO
IT WORKED
Okay now to take this to the next level
How do I prohibit players from swapping seats or is that not doable
lock the vehicle 
While they're in it? That's not gonna work well XD
There is also lockDriver and lockTurret.
At this point the gains aren't worth it
the problem is they can't get out either 🤣
honestly if its a world of tanks style thing. the player should only be able to get in the tank, they shouldn't be allowed to leave the tank until it is dead
Anyone know how to create a simple trigger that registers if the player fires a shot? trying to create a safe zone with a trigger where you lose if you fire your weapon. something like _x = player addEventHandler ["FIRED",{shotsFired = shotsFired + 1; if (shotsFired > 0) just need a small line in the activation field if possible.
What more do you want? 
cant get the line to work. : \
if, at any point in the mission, anywhere, the player fires, it's lost?
only in the safe zone where the trigger is covering
like if the player fires inside the trigger, its lost
Sloppy way, add or remove the eventhandler on entering or leaving the trigger zone?
im pretty new to it, so not sure exactly how it works. just would like a safe zone where you will lose if you fire your weapon
add "FiredMan" event handler
and in it, if player inArea theTrigger end the mission
buuut I would rather trigger on the enemy being aware of the player, no?
Is it a challenge for trigger discipline, or just to enforce immersion?
both
if you suddenly fire your weapon at a military base you're out. just need a simple trigger that will register that
figured it out
Is there a way to give stuck vehicles a nudge (a kick in the butt) as an initial means of unsticking them?
unsticking in what way? if it sank under ground or into an object it would be safer to teleport it somewhere away from any objects
Usually they get stuck on low walls... just spinning their wheels endlessly.
Teleportation is the ultimate last resort. But I'm looking for solutions that go from light handed to heavy handed, in that order. So initially, I want to try just a gentle impulse to see if that unsticks them.
I'm guessing this works on vehicles? https://community.bistudio.com/wiki/addForce
cursorObject setVelocity [(sin(direction player))*3, (cos(direction player))*3, 0];``` maybe? I took it from BI Forums and it was used to push a boat, should work on vehicle too
but the force would have to be proportional to the vehicle mass
hmm... setvelocity or addforce?
By the way, what is the "forward" direction in model space? +x? +y? +z? -x? -y? -z?
+y IIRC
Does addforce add an impulse or does it add a force? I.e., does it just give them a kick, or does it give them a persistent thrust?
I believe it's an impulse.
For waitUntil, would this fire only after both are true or just one of them?
waitUntil { triggerActivated reconSpotted; sleep (random[900, 1200, 1500]); };```
Is there a null value for a script handle? In other words, I'm looking to see if a variable currently holds script handle.
It will immediately check if trigger is activated, then sleep for the random integer seconds before checking again.
I'm a little bit sketchy on arrays by reference. If I do this: private ["_array"]; _array = [1,2,3]; unit1 setVariable ["AN_ARRAY",_array]; unit2 setVariable ["AN_ARRAY",_array]; Do both unit1 and unit2 have a reference to the same array, or do they have coppies of it?
Are arrays always by reference unless they are explicitly copied?
afaik they're separate copies of the array
_array is local regardless you can't access it outside of that scope
also ```sqf
private _array = [1,2,3];
are you sure it isn't the variable name "_array" which is local and private, rather than the array that it points to
I just tested it, both UNIT1 and UNIT2's variable "AN_ARRAY" is a reference to the same array.
The following waitUntil keeps returning nil. I have tried a few different incarnations of it but none have worked. I just want it to wait until activeSquadLead user is within 300m of the LZ. Any ideas as to what I'm missing?
waitUntil { ((getPosASL activeSquadLead) distance (getPosASL (LZPointDistance select 0))) <= 300; };```
Nvm, probably has nothing to do with that setup. LZPointDistance is currently empty.
I have a one-line init.sqf in my mission file:
[[2100, 7, 5, 17, 36], true, false] call BIS_fnc_setDate;
to set the date at the start of the mission. However, whenever a player connects (or reconnects), this gets executed again, reverting the mission back to the very start. How can I make this execute in such a way that new-joining players don't run this init?
u rename ur file to initServer.sqf instead.
:D
Does it still work when testing in 3DEN?
How many times do u test ur mission?
Add another test on top of that, see for yourself, why trust me? =)
Considering that this is only one line, and only effectively changes the year, I'd say it's not worth testing.
I can only respect your decision. ¯_(ツ)_/¯
actions "heal" vs. "healsoldier". Thoughts on the differences between these?
what kinds of things constitute "entities" type in arma scripting?
just one impulse. you would need to put it in a loop like "onEachFrame" to have persistent effect
teleportation works fine, just check for nearby players to ensure its not too immersion breaking
That's wrong
waitUntil must return bool
In where? Arma uses many variants of "entity"
No
Both are references to the same thing
Objects with normal simulation speed
Afaik
See the allObjects command
The word "entities" is used in the description of 3 types of objects on that page.
0 - Slow (and very slow) entities: houses, rubbles, street lamps, churches, etc 1 - Normal entities: vehicles etc 2 - Fast entities: shots and other high precision entities
are they all "entities" as far as allentities is concerned?
Like I said the game uses it with different meanings
But for the entites command as I said only normal objs are considered
can scripts/code be passed by reference?
example: A={hint "HI";}; B=A; Does B contain a reference to the code in A, or does it literally copy {hint "HI"} into B?
I believe it contains {hint "HI"};. If you want to execute that code you would use call or spawn. You're essentially creating a function on the fly
Everything assignment in sqf is by reference
But what's the point anyway?
So it's not making a copy of the code then.
There's no command that modifies a code by reference
Why would it?
I'm sending a script to be used IN a function.
You can't modify code
So? Why would even reference be important?
Just want to make sure it's not pointlessly duplicating the code in memory.
It won't matter whether it's by reference or copy
Don't worry everything in sqf is passed by reference
I'll take your word for it. Though I can't think of any way of testing whether code is, since as you say, it can't be modified.
Well, you say everything is passed by reference. But basic data types aren't, right? Numbers, strings, etc.
A=2; B=A; B=3; .... A still equals 2.
Because you're not modifying it by reference
is there a way to explicitly modify by reference?
If you did that with arrays it would still not be a ref
No. Only commands can do that
e.g. pushBack modifies by ref
But + makes a copy
k thanks for the headsup, that might have tripped me up at some point.
hi . I have a question, does any of you know what script to use to make a gps or laser bomb fall on a designated target chewed by AI
I made aI turn on the laser marker and make the remote control the camera look at the point but the bombs still fly anywhere
setMissileTarget I guess
I know rockets, I mean guided bombs for AI
That should work for guided bombs too
Well, unfortunately they don't work, I checked all fire, fireattarget etc and inc scripts 😦
and nothinh happen bomb is blind
How do you do setMissileTarget anyway?
I haven't checked it yet, I'll see and let you know thanks
Then why do you randomly say it doesn't work?
Also you need Fired event handler
Because you need the projectile
previously i did _pilotCamTrack = vehicle player setPilotCameraTarget [xxxxxxx]; and laser target on and BIS_fnc_fire GBU 24
I don't know very much an event handler, could you help me please?
I can't because I'm on mobile
Just visit the event handlers page and copy the Fired EH code along with its params
The projectile is the _projectile variable
So just add _projectile setMissileTarget my_laserTarget below the params
My_laserTarget is the laser target. Change it to yours
I'm on the website but I can't see it :(. And if you're on pc, will you help me tomorrow or when you have time?
Then copy the whole thing to the plane's init
ok now i'll try with handlers. I will let you know tommorow. best regards and thanks for your help
np
Hello, i need help with a script of mine. Is there a way to force a player vehicle to not go faster than a set amount of speed?
i tryed "setCruiseControl "
but that only applyes on forward drive but not to reverse
Is the player driving in reverse to get around a speed limit a serious concern for your mission?
With all due respect, of course, just gauging if this is a problem that you actually need to spend effort solving :p
it would be a problem 😄
i think there may be a trick for that, first you need to get the speed of vehicle if vehicle speed > =1 then limit cruise control to 30 for example, and if vehicle speed <= -1 which means its reversing limit cruise control to -30
i see
thats smart 😄
i will look into that
MyVehicle limitSpeed 5; "myVehicle is vehicle name
5 is limit
limitSpeed works for Ai vehicles only 🙂
whats the best approximation of the muzzle position on a unit
is it like <unit> selectionposition "righthand" or something, or can we be more accurate
What effect are you trying to achieve?
How would someone most easily find the group of a dead AI unit?
no can do for a dead unit is removed (once reported dead by the leader) from the group
if needed after that, store the group into the unit with a setVariable
That really sucks. Too bad there isn't a "previous group" flag of some sort for just this sort of thing.
I have a reinforcement script for my AI squads in my high command based scenario, but it requires one "dead pool" per AI group to work. I was hoping to rewrite that as something like:
{
_unitBase = getMarkerPos "Respawn_West";
_unitGroup = oldGroup _x;
_unitType = typeOf _x;
_unitNew = _unitGroup createUnit [_unitType, _unitBase, [], 0, "NONE"];
_unitNew call ASG_FNC_BLIGear;
_unitNew addEventHandler ["Killed", {
B_Reserves pushback (_this select 0);
}];
} foreach B_Reserves;
B_Reserves = [];```
Use killed/MPKilled event handler
Then once the unit dies save the group as a variable in unit's varspace
{
_equip = _x call ASG_FNC_BLIGear;
_x addEventHandler ["Killed", {
B_Reserves pushback _this;
BluTickets = BluTickets -1;
PublicVariableServer 'BluTickets';
}
];
} foreach units BA11;```
I'm using the killed variable, and I used to just have graves per group, which worked. Your suggestion is likely what I seek.
BluTickets = BluTickets -1;
PublicVariableServer 'BluTickets';
this is wrong
instead, make a function on the server and simply do ticket handling there
[BLUFOR, -1] remoteExec ["ASG_fnc_handleTickets", 2];
ASG_fnc_handleTickets:
params ["_side", "_add"];
if (_side == west) then {
BluTickets = BluTickets + _add;
} else {
RedTickets = RedTickets + _add;
};
if you want to send them back to clients (e.g. to show in GUI) use a timer
and I'm adding -1
which means bled
because otherwise you might need two functions
Depends if you ever want to add tickets.
I never want to add tickets when units are killed.
that's a general function that does ticket handling
That makes sense.
you can even use a special case, such as add 0, to read the tickets
params ["_side", "_add"];
if (_side == west) then {
BluTickets = BluTickets + _add;
BluTickets
} else {
RedTickets = RedTickets + _add;
RedTickets
};
now the function adds tickets and also reads them back
Reads them back? Like as output or?
Gotcha! Thanks!
np. also note that you can do more stuff in there too. e.g. check if west has lost if BluTickets are 0
I have a ticket bleed script that does that already, I have saved your recommendation to integrate into the sector based ticket bleed script that I already have.
Got a hint in an holdAction that is appearing for everyone when I only want it to appear for the player who used it. Any advise on how to accomplish this?
[this, "Rig to Blow", "", "", "_this distance _target < 3", "_this distance _target < 3 && 'DemoCharge_Remote_Mag' in magazines player", {}, {}, {player removeItem 'DemoCharge_Remote_Mag'; RiggedThing1 setdamage 0.8; sleep 10; RiggedThing1 setdamage 1; _RiggedBomb = "DemoCharge_Remote_Ammo_Scripted" createVehicle Position RiggedThing1; _RiggedBomb setdamage 1;}, {hint "You need an Explosive Charge";}, [], 10, 5, true, false] call BIS_fnc_holdActionAdd;
is possible to disable the night & thermal vision while in spectator mode?
How can I make a trigger/ script choose between 1 command or the other
Your username makes it difficult to search in discord what you're trying to accomplish but wouldn't that just be if()then{}else{} unless you're referring to something more specific?
anyone know how to use addCuratorEditableObjects but only for player's side? basically i use spawn ai module but wish to make it only editable if they are the player side. tried working with the entities but kinda confused
I want the trigger to either play Music1 or Music 2
under what condition does it choose?
"this"
i don't think you understand. I'm not talking about the trigger, I'm asking what you want to happen.
Player leaves spawn (trigger "oos") then either playMusic "A" gets executed or playMusic "B"
im done
ok
nah let me rephrase one more time
do you want it to randomly choose or choose one track over another for a reason?
@digital torrent Well, you can use something like units west or allUnits select { side _x == west } instead of allUnits. Vehicles would need updates though because they can switch sides.
ok sound good. thanks!
Trying to fix something involving VTOLs, any way I can make them turn off Auto vectoring?
first question: I have a problem on my config, my gunner pov (turned in/ first person view) is not following the turn of the turret it just stays on the middle of the my gunner character, what might be the cause?
ps: i fxxked some parts of the configs like the ingunnermayfire stuffs like that xD
2nd question: why does it when i fire my hmg no bullets are coming out of the gun but theres an animation of the firing and all those stuffs
ps: my usti_hlvne and konec_hlavne/ gun beg and gun end selections are correct tho
Sounds like a #arma3_config problem
Not strictly wrong, but youre missing an element in the array, try [1,1]
q setDamage 1;
that worked
That too :p
The alternative syntax with an array ( the [] bit ) allows you to disable destruction effects.
But you need the second element in the array [x,y] to have that effect, otherwise itd just flip out, probably 'two elements expected, recieved one' or something like that.
Nah man, if not for your benefit, then the benefit of the next guy who sees it wondering what they got wrong :p
I'm both stupid and educational 😂 😂
Oh sorry wrong channel
Mb mb
What class does the vanilla grenade inherit from? I want to make a script that'll be able to recognize thrown frag grenades from any mod
then don't use inheritance
idk what you mean
the correct way that works with any mod is getting the simulation of the mag ammo
for grenades it should be "shotGrenade"
That helps, thanks!
anyone know how to add Thermal Vision on a turret tank with the init command?
not possible
does anyone know if theres a way to change the TFAR encryption key of vehicles for TVT purposes?
/have actually have experience doing this?
is there anything different to force cfgFunctions recompile of mission vs mod definition?
specifically it doesnt work for mod cfgFunctions with Eden Enhanced, while the native Function Viewer recompile does work
what function does "Edit Vehicle Appearance" in Eden editor use?
https://imgur.com/sZME6py
garage or something
my problem with garage is that I can't edit an already existing vehicle
you can find the function directly by going through the 3den display class
hmm, where do I go in config?
idk. RscDisplay3DEN or something
alright I will try that thanks
configFile >> "Display3DEN"
@drifting portal
configFile >> "Display3DEN" >> "ContextMenu" >> "Items" >> "Garage"
action = "['garage'] call bis_fnc_3DENEntityMenu;";
many thanks
I went into the source code of bis_fnc_3DENEntityMenu, it does use garage function, but problem is it seems like in-eden garage preview is different from in-game preview, a huge let down sadly
https://community.bistudio.com/wiki/BIS_fnc_garage i have opend garage with this and it seems to me they are the same.
can you give me which syntax you used?
Is it possible to do like a waking up from being knock out type thing?
use one of the examples.
did you try disabling full garage ?
["Open", false] call BIS_fnc_garage;
tried it
the same as this
wdym?
Im imagining he means similar to the start of the Adapt campaign;
Theres a character animation for getting up after being knocked out, but no effects attached to it, so youd have to script in any 'groginess' yourself.
you don't have to use 3den garage
just make your own function
use BIS_fnc_garage to open the garage
then use garageOpened and garageClosed scripted EHs to do whatever you want
I would like to only have the player be able to view 1 airplane that I already selected for him,
(I know how auto select that vehicle)
how would I go about editing BIS_fnc_garage_data so that he can only select 1 single vehicle ?
¯_(ツ)_/¯
player setdamage 1;
do I need to call setPylonLoadout on every client to make vehicle have the same loadout on all clients?
LE says yes
I suspect it's wrong.
then please provide evidence to change it 😎
well, we're using it as if it was GE. I'll keep an eye out in zeus :P
please and thanks! 😄
hmm running setPylonLoadout on client with dedi server works..
question is whether you get some visual desync from client->client.
but is it going to work for all clients who don't run the command?
Possibly the "real" weapons part is global but the visual pylon updating is local.
I don't know if it's a bug or not but the heli missile weapon didn't reload until I switched to manual fire
also have no gunner... maybe that's the reason
if you got news please tell me too, I made 2 full scripts for pylon editing in-game and I'm kinda concerned because I also use it as if its GE
Black then light unfocused then like a few blinks
yes, with Post-Process effects 🙂
im kinda lost, im trying to pull all classnames that inherit from "Air" in cfgvehicles
=> trying to pull out all airasset classnames.
but i cant figure out how to formulate a condition for that to pass to configClasses command
isKindOf?
hint str ("_x isKindOf ['Air', configFile >> 'CfgVehicles'];" configClasses configFile);
``` throw "type config entry, expected string
let me try 🙂
hm returns an empty array.
wait, are plane classnames even stored in cfgVehicles?
right, so i exported all classnames from cfgVehicles with
copyToClipboard str (("true" configClasses (configFile>>'CfgVehicles')) apply {configName _x});
but it doesnt contain any planes, f.e. "B_Plane_Fighter_01_F"
hold on, im super confuse
hi, I'm dad!
yeah, nevermind, it does contain the planes names. so my condition must be wrong
aaaaaand now that im doing the exact same thing as 3 minutes ago, it works...
hm its not what i wanted. it contains a lot of classes that are just hirarchy placeholders "Plane","UAV","Fighter"
yep
check scope = 2 and isUAV = 0 then
ah only the actual "objects" that can be spawned have public scope?
oh crap, arma didnt like that lol
seems like stringifying code with
_condition = str {true};
doenst work 😛
niiiiiiiiiice it works (i think)
["I_Plane_Fighter_03_dynamicLoadout_F","B_Plane_CAS_01_dynamicLoadout_F","O_Plane_CAS_02_dynamicLoadout_F","B_UAV_02_dynamicLoadout_F","O_UAV_02_dynamicLoadout_F","I_UAV_02_dynamicLoadout_F","C_Plane_Civil_01_F","C_Plane_Civil_01_racing_F","I_C_Plane_Civil_01_F","O_T_UAV_04_CAS_F","B_T_VTOL_01_infantry_F","B_T_VTOL_01_vehicle_F","B_T_VTOL_01_armed_F","O_T_VTOL_02_infantry_dynamicLoadout_F","O_T_VTOL_02_vehicle_dynamicLoadout_F","B_Plane_Fighter_01_F","B_Plane_Fighter_01_Stealth_F","O_Plane_Fighter_02_F","O_Plane_Fighter_02_Stealth_F","I_Plane_Fighter_04_F","B_UAV_05_F"]
thanks Lou 👍
toString, not str for code
ah cool 👍
i think setPylonLoadout has only local effect, had to run it on all machines to make it work in Dedi
could be just my code but i tried everything..
In the sense of visually having the right stuff on the pylons?
yes
I wonder why they made it LE
think i also found bug in the arma that if you leave dedicated server with persistent BF and join back it shows the current pylo has ammo even there isn't any. u have to switch weapons to make it show the correct ammo count
so if you have a 3 macer pylon that you already used up, disconnected and joined back you will find that is contains 3 fake macers??
yep
that's weird
adds to my confusion
they cant be fired though
still, I don't understand why its LE, kinda weird
because it creates more problems than it solves
arma commands are weird 😄
so I wonder, if you remoteExec setPylonLoadout
then somebody joins after that
will they just see a different loadout on the airplane ?
will they see the loadout empty?
and if that, if you enable JIP for remoteExec setPylonLoadout, will that cause it so that everytime someone joins in progress, the vehicle's loadout "resets"?
There's the JIP parameter for that
that's why I'm concerned with JIP
good question
man, when you showed that its LE, I had already made two vehicle pylon editors that I haven't test in MP, you basically shattered my goals and my 3.5 hours of work lol

actually you just helped me to solve the wrong ammo count bug. Took the JIP thing away and it works now
so no bug in arma was just my code
but can you see the correct pylon?
yes
even if you disconnect and reconnect?
yep
I guess when you change the pylon it gets broadcasted to JIP players automatically as its a part of the "vehicle"
that's what I thought also
Arma 3 veterans rise up
my back hurts
remoteExec 😉
its for a good cause, thank you soldier
I am having a weird issue maybe someone else has encountered it before.
In an MP Mission ran on dedicated server, the fog setting seems to change suddenly from 100% fog to 0% fog. There is no fog change in the mission or in the framework. Weather is only set in Eden Editor and the time for weather change is set to 8h (Mission duration is like 30-45 min)
It also does not change equally for everyone. For some it disappears, for others it becomes more.
it's an Eden Enhanced bug most likely!
...
3den Enhanced has no fog setting 😛
Admit it, you tinkered with Eden Editor since you work for BI and screwed something up.
Seriously though, if someone has an idea, shoot me a msg.
nah, Dedmen has a pitchfork and makes weird noises when I get close to A3
@cosmic lichen Run fogParams in debug console and post the results
There's an issue where people break the fog by dragging all the sliders to the bottom, which is nonsense mathematically.
[1,0.0502767,35]
I think that's legit for max fog?
Should be.
I wonder if it could be that fog value decreased on the server, and at some point it gets synchronized with the clients, causing the sudden change of fog.
Would not explain why fog values are different on each machine though.
there is a glitch I also have been encountering with fog where, upon change of fog to be less, some clients screens live in a completely FOGGY world where they can't even see their arms
while others are viewing everything normally
Weird.
desync sounds plausible but I know nothing about arma to be honest
hey uh, i noticed that my position getting was around 5 meters to high (above the cars). i tested that in diagnostic branch.
Now back on normal branch its normal again.
not 100% sure if it was my code or a bug
what position command did you use?
getPosWorld, getPosAsl
were you in the car?
no, im in zeus, but it was the position of a car i was getting
Could someone explain this script to me?
[] spawn
{
private _types = ["TREE", "SMALL TREE", "BUSH", "BUILDING", "HOUSE", "FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE", "CHURCH", "CHAPEL",
"CROSS", "BUNKER", "FORTRESS", "FOUNTAIN", "VIEW-TOWER", "LIGHTHOUSE", "QUAY", "FUELSTATION", "HOSPITAL", "FENCE", "WALL", "HIDE", "BUSSTOP",
"ROAD", "FOREST", "TRANSMITTER", "STACK", "RUIN", "TOURISM", "WATERTOWER", "TRACK", "MAIN ROAD", "ROCK", "ROCKS", "POWER LINES", "RAILWAY",
"POWERSOLAR", "POWERWAVE", "POWERWIND", "SHIPWRECK", "TRAIL"];
_types sort true;
private _counts = [];
private _countTypes = count _types;
["R3vo_GetNearestTerrainObjects",""] call BIS_fnc_startLoadingScreen;
{
private _terrainObjects = nearestTerrainObjects [
[worldSize / 2, worldSize / 2],
[_x],
worldSize,
false
];
if (count _terrainObjects > 0) then
{
_counts pushBack [_x,count _terrainObjects];
};
((_forEachIndex + 1) / _countTypes) call BIS_fnc_progressLoadingScreen;
} forEach _types;
"R3vo_GetNearestTerrainObjects" call BIS_fnc_endLoadingScreen;
private _export = "<big>[[" + getText (configFile >> "CfgWorlds" >> worldName >> "description") + "]]</big>" + endl + "{{Columns|5|";
{
_export = _export + endl + "* " + (_x # 0) + ": " + (str (_x # 1));
} forEach _counts;
_export = _export + endl + "}}";
copyToClipboard _export;
};```
I'm trying to understand it so I can write a script that does basically `{ _x hideObjectGlobal true } foreach (nearestTerrainObjects [this,[],3])` for specific types of objects and can maybe do an entire map maybe in the server initialization.
you don't need to understand this one to write your own code?
I don't know how to code. Everything I do or have done is from reverse engineering something someone else has written.
But if you're willing to help for some reason, I'd be obliged.
It's just counting total terrain objects by type, showing a progress bar while it does so (because it's slow) and then outputting the type+count totals to the clipboard. I'm not sure there's anything relevant to your application.
sure can! the channel is here for that purpose 🙂
hi all,
I'm trying to get a scripted encounter with friendly AI spawning in. I for some reason, the friendly AI decide to just shoot me on site vs fighting the opfor forces instead.
Any ideas?
if !(isServer) exitWith {};
_SpawnPosition1 = [2549.257,5799.12,0]; //[x,y,z]
_SpawnPosition2 = [2596.118,5872.970,0]; //[x,y,z]
_SpawnPosition3 = [2598.024,5841.735,0]; //[x,y,z]
_SpawnPosition4 = [2558.549,5843.523,0]; //[x,y,z]
_SpawnPosition5 = [2558.239,5834.118,5.956]; //[x,y,z]
_SpawnPosition6 = [2542.433,5800.089,0.044]; //[x,y,z]
newgroup = createGroup [west,true];
_newLeader = "OPTRE_UNSC_Marine_Soldier_Officer" createUnit [_SpawnPosition1,newGroup, "newLeader = this"];
sleep .1;
_newUnit = "OPTRE_UNSC_Marine_Soldier_Engineer" createUnit [_SpawnPosition2,newGroup,"newUnit = this"];
sleep .1;
_newUnit = "OPTRE_UNSC_Marine_Soldier_Radioman" createUnit [_SpawnPosition3,newGroup,"newUnit = this"];
sleep .1;
_newUnit = "OPTRE_UNSC_Marine_Soldier_Rifleman_AR" createUnit [_SpawnPosition4,newGroup,"newUnit = this"];
sleep .1;
_newUnit = "OPTRE_UNSC_Marine_Soldier_Rifleman_BR" createUnit [_SpawnPosition5,newGroup,"newUnit = this"];
sleep .1;
_newUnit = "OPTRE_UNSC_Marine_Soldier_Rifleman_BR" createUnit [_SpawnPosition6,newGroup,"newUnit = this"];
newGroup move [2577.732,5868.477,2.968];
newGroup setBehaviour "Combat";
don't use that syntax of createUnit...
oof
who even uses that still?! 
me apparently
that syntax doesn't return anything
friendly AI decide to just shoot me on site vs fighting the opfor forces instead.
are those classes even BLUFOR?
if they're not, you can't make a unit change sides simply by spawning them into a group of other side
so, i want to spawn smoke and fire effects once a building is destroyed
normally i could just link the modules to a trigger and do that for each building
but i have a lot of them
so i decided to try and script it
i'm thinking i should throw them all into an array and then just use that to check their state.
when they're dead the script will spawn the fire and smoke and then delete the object from the array
but i'm pretty new to this stuff and i'm not sure how i would go around doing this, can anyone give me a hand?
i was also thinking this could maybe be done with an event handler
addMissionEventHandler ["BuildingChanged", {
params ["_oldBuilding", "_newBuilding", "_isRuin"];
if (_isRuin) then {
// Your stuff in here
};
}];
if you have a specific array of buildings that you want to trigger on, you can check _oldBuilding in yourSpecialBuildingArray
get an eventhandler (probably from cba) that notices building destruction and then spawn a fire module.
ideally give all modules a timer to die out, to avoid longterm lag
ah damn i didnt read Johns message
I have no idea on the fire/smoke part :P
the eventhandler worked great
seems like creating the fire and smoke will be the hardest part
Setfriend, or spawn friendly units and script their equipment and IDs to appear as hostiles https://community.bistudio.com/wiki/setFriend
there's no need to do that
thank you so much, the presets in there work great
you can join the unit into a group of other side
but not when you create them. it has to be done with delay
Or that, yeah.
if i exec an sqf in the init of an object how do i reference that object in that sqf?
in this case i want to get the position of the destroyed building
does the EntityKilled mission EH fire on player disconnnect?
its funny cause they are blufor units and will attack opfor units but decide to shoot blufor players
That's normally quite difficult to arrange unless you've been shooting a lot of civilians.
i know but it doesn't make sense. if it was set to east instead, i understand that the units would think that i was an enemy. but if I am a west faction and the script is spawning in as west, it should be friendly to each other right?
Yes. You should sort out your spawning script first though.
If you must use exec, spawn, etc, you can pass arguments to the executed script within the array preceding the command; [getpos this] execvm "yourScript.sqf".
Within the .sqf, you can recover the passed arguments with _this.
Hello !
I'm trying to set up a script that whitelists certain items for an Ace arsenal, but, and here's the twist, I wish that it allows different gears for different roles.
For instance, if the player spawns as an autorifleman, they can only get autorifleman weapons from the ACE arsenal. (For instance, mg's), snipers'd have access to long-range scopes with long rifles, medics would have access to advanced medical supplies, enginneers/EOD specs explosives and so on.
This is to allow my players to have a wider array of customisation while still preventing the good ol' medic dressed in a ghille suit using a navid with a TWS scope and a vorona launcher (And ofc a few claymores to add to the bullshittery)
The main problem is ... I'm shite at writing scripts and none of my guys are wiser than me in that area. I've been quite unlucky while researching, either nothing relevant comes up or I don't have the skills to understand it... So, I guess i'm looking for a comprehensive tutorial or a script that's free to use & modify for my needs.
Would anyone be able to help or direct me in this ?
Thanks
will you have ace loaded?
The mod ? Yes
oh shit bad question you said ace
Yes ^^
I believe ace arsenals can be added locally
params ["_oldBuilding", "_newBuilding", "_isRuin"];
if (_isRuin) then {
hint("dead");
[this modelToWorld [0,0,0]]execvm "FS.sqf";
};
}];```
// Fire
private _ps0 = "#particlesource" createVehicleLocal _posATL;
_ps0 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard",
0, 1, [0, 0, 0.25], [0, 0, 0.5], 1, 1, 0.9, 8, [1.5],
[[1,1,1, 0.0], [1,1,1, 0.3], [1,1,1, 0.0]],
[0.75], 0, 0, "", "", _ps0, rad -45];
_ps0 setParticleRandom [0.2, [1, 1, 0], [0.5, 0.5, 0], 0, 0.5, [0, 0, 0, 0], 0, 0];
_ps0 setDropInterval 0.03;
//smoke
private _ps1 = "#particlesource" createVehicleLocal _posATL;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12],
[[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;```
this is what i've got this far
the stuff involving the particles definitely works as i got it from the wiki and tested them.
but i'm getting an undefined variable error for _posATL that i can't seem to figure out
i'm assuming this is what is incorrect
private _posATL = _this select 0;
params ["_oldBuilding", "_newBuilding", "_isRuin","_this"];
if (_isRuin) then {
hint("dead");
[this modelToWorld [0,0,0]]execvm "FS.sqf";
};
}];```
so correct would be this?
i think i get it now
try _newBuilding instead
it worked perfectly
thank you
i guess i just assumed since the eventHandler was inside the Init field, the "This" magic variable would work
now i know it doesn't
yeah the event handler expression is a separate scope
does anyone have a script for spawning props
Search "Phronk Furniture". It's on the BI forums. There's also a script version by Tinter, that depends on CBA.
is there a way i can get a unit to play an animation in eden editor without loading polpox anim viewer?
TPW also has a nice script for this.
When looking for suitable anims I always use switchMove and playMove from the debug console.
i found an addon called DP building
i like it
how do I flip and object that is attached to another object?
I tried setVectorUp and BIS_fnc_setPitchBank and setVectorDirAndUp but none worked?
Is there a way other than hideObject to make units invisible? For my RTS-style Zeus interface I want unspotted units to not be visible, but be able to take damage (from blindfire, arty etc).
don't invisible units take splash damage?
Flip it first then attach or if its allready attach disable simulation, detach, flip, reatach and enable simulation.
_obj setObjectTexture [0, "#(rgb,8,8,3)color(0,0,0,0)"]; not the best way but myb if you put the Alpha texture of their uniform to 0 and somehow hide the head ?
Is there a way to have an object like an aircraft carrier float in the air like there’s no gravity so you’d get something like this?
Hold on images are disabled
that's literally what I'm doing right now lol
Wait really?
disable simulation
yes
this enableSimulationGlobal false;
put that in the object's init
Ah thank you
Just out of curiosity what were you doing trying to make flying submarines?
gunship
a boss fight to be more precise
That’s an interesting boss lol
I don't think it works with all uniforms. The only way I've found to hide heads is to use a null one at the config level.
How does one end a animation from Polpoxs viewer
i see, thanks
So, I'm working on a scenario that involves a lot of objectives that have "!alive" checks
Some of these are about 10 of these per trigger
Let's say I've got a hundred of these checks going
Is that enough to impact performance?
It does seem like It's a very ineffective way of doing things
The alternative I imagined involves arrays of units inside another array and then I just work with that to do the checks.
Just not sure how I would do that yet.
enableSimulationGlobal should be executed on the server
that's still bad
yes
you can use killed event handler
Oof
or MPKilled
If that dosent work you can always simulate those units take damage with EH. With that you could have a bit more control how mutch units take dmg myb a bit performent as well.
you should flip after attaching
@drifting portal ^
you have to make an invisible unit model (res lod empty but containing other LODs)
I beleve that was his queation how do you flip something after its attached
So let's say I have a group of units I need killed how would I check that using the event handler.
Off the top of my head I'm imagining just incrementing a variable until it reaches a certain number.
_obj attachTo [_src, [0,0,0]];
_obj setVectorUp [0,0,-1];
Would a trigger set for Side, Not Present work?
These groups include static objects
the question is do you want them all killed?
or just one (e.g. per task)?
All of them have to be killed before the task is considered completed
then yeah what you said is correct
add EHs to all
then increment a counter
Im a noob to sqf.
So just to make sure, I'm guessing this would be some sort of global variable.
Where and how could I define this?
Because anything inside that event handler would be limited to the scope of that units event handler right?
no need to define it. you can use a default value instead
yes
{
_x addEventHandler ["Killed", {
My_killCounter = (missionNamespace getVariable ["My_killCounter", 0]) + 1;
if (My_killCounter == count My_units) then {
["myTask", "SUCCEEDED"] call BIS_fnc_taskSetState
};
}];
} forEach My_units;
you can put that in init.sqf or something
Is My_units an array of the units in that group in this case?
btw that's only valid in single player
it's an array of any objects
idk what you have
if it's a group you can do My_units = units myGroup
This is for an MP scenario, does that complicate things?
yes
what I wrote doesn't work properly in MP
{
_x addEventHandler ["MPKilled", {
if (!isServer) exitWith {};
My_killCounter = (missionNamespace getVariable ["My_killCounter", 0]) + 1;
if (My_killCounter == count My_units) then {
["myTask", "SUCCEEDED"] call BIS_fnc_taskSetState
};
}];
} forEach My_units;
MP version
should be placed in initServer.sqf
does anyone have a bis garage script thatll show all mods and not make the vehicle invincible
yes thats what I have done but
the vehicle refuses to get flipped
I tried setVectorUp and BIS_fnc_setPitchBank and setVectorDirAndUp but none worked
it just stays upright
they do work
you're probably doing something wrong
can you provide the example that worked?
so I may try it and give feedback
this
I will ignore the [0,0,0] part
well you should
that was just an example
the problem is I tried that same as your example before I have asked
but for some reason it didn't work back then
thanks
like I said you were doing something wrong
maybe you used setDir
¯_(ツ)_/¯
nope
now I'm facing a problem where the AI unloads because of the tank being flipped
tried setUnloadInCombat and allowCrewInImmobile and locking the vehicle too
Should disableAi "PATH" do the trick?
@drifting portal Check out the comment in https://community.bistudio.com/wiki/allowCrewInImmobile
Yep I checked it, my problem is that these are the crew, so setting them to careless will make them not engage enemies
well if all else fails you could create a script that moves them back in
i did that
but the keep leaving the vehicle so
they won't engage the enemy
because they keep leaving (and getting back by script)
Anyone help me get started on a script that removes all military, garbage, and wreckage map objects from a map or designated area on mission start?
That's... challenging. And in the map case probably too slow for realtime processing.
Usual tools are nearestTerrainObjects and nearObjects.
Too slow doesn't bother me too much, as it will be done before players are really on the map. I would be satisfied with something that is basically my old script that does this, but with a tweaked filter that won't erase EVERYTHING.
nearObjects uses isKindOf with object types, while nearestTerrainObjects has a separate categorization system.
{ _x hideObjectGlobal true } foreach (nearestTerrainObjects [this,[],3])```
Placing that on undesired objects and changing the number at the end is how I am doing it at the moment. I remade almost all of Altis as a "cleaned up" or "pre-war" version by pasting those all over the map on trash heaps and military stuff.
There's likely no easy way to autodetect military or trash objects. You'd need to build a list of classnames yourself.
Like a military bunker on Altis is probably just "HOUSE" in nearestTerrainObjects.
Trash heaps are HIDE, I think?
You are probably right.
Dang.
also house in nearestTerrainObjects is not the same as house in nearObjects :P
Know what? That would probably work anyway. As long as it isn't deleted trees and rocks, a whole map cleanup might be asking too much, but I can do what I've already done MUCH more easily as long as the stupid things aren't deleting trees and rocks. If it catches a house every now and again, I can adjust that more easily than any of the autistic hyper fixated game logic placement I've already done.
Also building a list of classnames isn't that hard. Get some binos and do a lot of typeof cursorObject
There are not that many distinct models :P
Hm. Sounds like a plan.
Just don't expect it to work on different maps.
That's pretty lame. Could I make it more or less map agnostic by just building the classes to include all the shit from multiple maps?
You could, but bear in mind that nearObjects is really slow if you throw a vast list of classnames at it.
nearObjects only takes 1 class name
I think that's okay, because it will be happening before the players are involved in anything real, right?
but even if you used nearestObjects note that it doesn't use exact class comparison
it uses inheritance
also many terrain objects don't have class names
Oh yeah, you're screwed :P
unfortunately you probably have to resort to a very slow nearestTerrainObjects + comparing models method
That is interesting. I haven't tried to use it on anything that I wanted gone and have it not work, but I'm only really using it on military buildings, ruins, trash, and wrecks. I've not encountered any of those that failed on me... yet.
Thanks for all the input!
What is the problem with it being slow as long as it's executed before we need processing power for other things? Is it just bad practice or are there real ramifications down the line for me using slow code in the beginning?
I think you might be underestimating how slow this could be :P
Also every object that's hidden is extra network traffic on join. It's really not something you should do over a whole map.
you can just hide them locally
Oh, I see.
I guess I didn't think it could be much worse than my current method, as I have covered basically the entire map in not only the deletion modules, but also creation modules.
You guys' explanations make sense, though.
Oh?
you can't hide terrain objects globally anyway
ah yeah, but then they're definitely gonna suffer.
You can argue starting the server up an hour early :P
It's meant to be a persistent battlefield with only one to two daily restarts for cleanup.
Could consider replacing your deletion modules with a (large) array of positions stored in a script, and possibly pre-generating that.
That IS something I will consider. Good advice!
IIRC nearestObject is much slower than nearestObjects with a small radius if you're marking positions of single objects, which is maybe non-obvious.
I didn't even really realize they were distinct commands.
trying to make a script that can go into a .sqf file that randomizes a units uniforms, headgear and so on and so far have had no luck anyone have any insight?
randomize as in pick from a whitelist or randomize like when you click the button in the arsenal?
i plan on making a list of possible uniforms to choose from so I guess whitelist
currently im having difficulties even removing their gear I have a .sqf that goes into the units config with the command removeAllWeapons this; as a start but it wont actually do anything it just throws back an error
did you pass this to the called code?
I barely know how to script so i dont know
also is it just for one unit?
let me just do this
class v_cohort_pilot_f: O_Soldier_base_F
{
author="Vengen";
scope=2;
displayName="test";
class EventHandlers
{
init="(_this select 0) execVM 'V_units\scripts\random.sqf'";
};
};
};
this is the config for the custom unit
and inside of random.sqf is this
removeAllWeapons this;
that's not how that works
the game doesn't know what this means if it's not inside the object init
if (!local _this) exitWith {};
would this help
and replace removeAllWeapons _this; fix that
_this might work
alright ill try that
_this is for passed arguments, which is what that init does
i know this sqf works as ive used it to make vehicles with objects attached to them im just having trouble tryna make the script for the random gear
i dont know how the init line works in a unit config but I can share a script I made if you figure out how to pass that argument
also it's not good practice to use execVM multiple times on its own, you want to define a function so it's already compiled
execVM forces the game to read the file
which is slower
hey she worked!
so that remedies that problem now i know how to strip the guy naked
for more context what im doing it making somlian units for a liberation and I want it to look like theres a varity of them when they are spawned
alright that looks like the format I was going to use so hopefully it will work
note it's out of order at the bottom
removeAllWeapons shouldnt be at the end for obvious reasons lol
i also made a custom arsenal for copying classnames if you want me to dm that to you
sure dont know how to use it probably but ill take all the tools and templates i can get
Using an FSM today for the first time. Is this a code which I could execute within the FSM?
waitUntil{!(isNil"dmpCVP")};
dmpCVP = dmpCVP - 5;
sleep 1;
_temp = execVM "mission_failed.sqf";
waituntil { isNull _temp};
sleep 5;
hint format ["Campaign points, %1!", dmpCVP];
playSound3D [getMissionPath "sound\Killed.ogg", player];
I am asking because it does not seem to execute ingame.
nope, can't use sleep
no sleep, no waituntil, etc
the rest seems fine
got it. but can I call an sqf file from the FSM? Are there any restrictions within the sqf?
no restrictions at all!
Got it. And is there a way to test in advance if the code works within an FSM? I compiled it with F7 but it did not show any errors although the code was obviously not suitable for an FSM.
all the SQF is valid; only suspension is not allowed - that's about it
understood. tyvm
Hmm, I modified the code to:
dmpCVP = dmpCVP - 5;
hint format ["Campaign points, %1!", dmpCVP];
playSound3D [getMissionPath "sound\Killed.ogg", player]; ```
But if does not execute
I added it to it an existing FSM and pressed Save
Not sure if I am doing something wrong
The second hint would immediately overwrite the first.
well, is the FSM executed 🙃
I know, just want to see if anything happens at all
Yes, all the other steps within the FSM are getting executed
I added it to it an existing FSM and pressed Save
where, and how? because FSM is following a certain order and logic
ok yeah, it should work indeed
What's in the delay now? Nothing?
delay: time - _checkTime > 5
no idea why it's not working. The hint just does not show
All I need to do is to save the FSM, correct?
err, if it's not in a PBO, yeah
Sorry, not familiar with this command. What does it do?
blinks
the BIKI is here for you 🙂
https://community.bistudio.com/wiki/diag_log
Thanks, I will try this
that literally makes my vehicle invincible and spawn in the same spot where it spawned before
you can look for it in the functions viewer and modify it for your needs
or just use debug console to paste to your clipboard
👍
one thing when i actually spawn it using the viewer
it makes my vehicle invincible impervious to rockets and explosives
and i cant get rid of said vehicle
since its invincible
it also from time to time can fly away
you can make it not invincible if you modify the function
not sure how complex this one is
im not a 100% sure how to modify the function
i know theres an enabledamage command somewhere that makes it invincible
you copy the code, paste it in an editor, write a note at the top that you modified it, define TOM_fnc_garage with CfgFunctions
ok
for the record I don't condone doing this with other peoples mods, just for modding the game itself
Why do that?
Just use the "garageClosed" scripted event handler and re enable damage
Tho not sure what the vehicle's var is
You'd have to read the function
I don't think you can get that straight from the EH, I've tried it with the garage
BIS_fnc_garage_center returns by default the player reference, yet otherwise the created vehicle object
not sure what this means but maybe you can use that variable in conjunction with the EH?
it seems like bis_fnc_garage_center stores the position reference and then the object?
theyre literally admin mods
i use them just to play with friends
do you have a script for spawning bis virtual garage vehicles
no
what Real Artisan Foods said is correct
it's BIS_fnc_garage_center
["Open", true] call BIS_fnc_garage;
[missionNamespace, "garageClosed", {BIS_fnc_garage_center allowDamage true}] call BIS_fnc_addScriptedEventHandler
ty man
will it actually spawn in front of me
instead of where it was destroyed
destroyed?
well when i reopen it it respawns directly where said vehicle was destroyed
or blown up by infantry
and you cant exactly move the vehicle
["Open", true] call BIS_fnc_garage;
if (missionNamespace getVariable ["my_garageEH", -1] != -1) exitWith {};
my_garageEH = [missionNamespace, "garageClosed", {
player hideObject false;
BIS_fnc_garage_center setVehiclePosition [player modelToWorld [0, sizeOf typeOf BIS_fnc_garage_center, 0], [], 0, "NONE"];
BIS_fnc_garage_center allowDamage true;
}] call BIS_fnc_addScriptedEventHandler;
[missionNamespace, "garageOpended", {
player hideObject true;
}] call BIS_fnc_addScriptedEventHandler
try that
it spawns it in front of you
alright ty
tested it it still opens the virtual garage on the vehicle
thats been destroyed
then basically regens the vehicle
Hey! First off, not sure if this is really scripting so I hope its alright to put this here.
First time messing with teleportation, how would I make sure the action only teleports the player that uses that action? I've looked online and some people are saying to just use 'player' but some are saying that would teleport all players on a dedicated server.
Thanks :)
yo! that's indeed scripting 🙂
using player in an action will not move all players, no worries.
Awesome! One more then, would that only be if I put that in the init? Would it be different if I called the script through remoteExec for example?
if you put it in an addAction, no worries ever
Brilliant as always Lou, thanks! :)
What the key for the debug console ??
tilde ~, or Ctrl+D if using CBA
in zeus ??
yes but nobody see it
?
Right I forgot that part
Well I'm gonna sleep but anyway all you have to do is set bis_fnc_garage_center and bis_fnc_arsenal_center to nil
Well at least I hope 
If no one helps you with it I'll write it for you tomorrow. Just ping me then
nah don't worry, we'll wait 😄
where do i put nil
yourVariable = nil;
still dont get where to put it
If anyone wants to take a crack at it, go ahead, but barring someone pointing out an obvious fault, I'm just going to continue with the slightly-worse but working thing.
because im stupid
goes in the event handler expression after the vehicle is set to take damage
put nil in both and sadly it still just respawns the same vehicle in the exact spot
virtual garage is weird
can someone explain how to use setDriveOnPath because I don't understand from the documentation
so you flip the vehicle and they still keep getting out? maybe they need to be assigned to seats again?
how did you try it so far? 🙂
ah, this
#arma3_editor message
well, maybe it needs some delay, or it needs vehicle crew2 @quick root
@quick root ^
That makes the vehicle move straight between to its waypoint tho
You might need to try the full path
bis_fnc_garage_center = nil;
bis_fnc_arsenal_center = nil;
["Open", true] call BIS_fnc_garage;
if (missionNamespace getVariable ["my_garageEH", -1] != -1) exitWith {};
my_garageEH = [missionNamespace, "garageClosed", {
player hideObject false;
BIS_fnc_garage_center setVehiclePosition [player modelToWorld [0, sizeOf typeOf BIS_fnc_garage_center, 0], [], 0, "NONE"];
BIS_fnc_garage_center allowDamage true;
}] call BIS_fnc_addScriptedEventHandler;
[missionNamespace, "garageOpended", {
player hideObject true;
}] call BIS_fnc_addScriptedEventHandler
@tough abyss ^
no
they get out because there's an FSM that tells them to do so iirc
if you simply throw it in a linter it tells you why
nearestEntities
no such command