#arma3_scripting

1 messages · Page 771 of 1

manic sigil
#

None come to mind, outside of the AI using a weapon in a turret you dont intend for them to use

little raptor
#

gunners are turrets

#

but a vehicle has only 1 gunner seat

#

can anything go wrong
no

#

a gunner is just a special turret

tranquil jasper
#

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?

little raptor
#

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

tranquil jasper
#

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

little raptor
#

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)

tranquil jasper
#

no functional difference, but there is a difference when scripting sometimes you use moveInGunner sometimes moveInTurret, etc

little raptor
#

you can just do moveInTurret

#

if you want the main gunner you can quickly do moveInGunner without knowing the turret path

drifting sky
#

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]]

tranquil jasper
#

probably top mounted MG

#

vanilla vehicles do this too, but given to commander slot

drifting sky
#

I thought there was only ever supposed to be 1 "gunner" position, regardless the number of turrets.

#

Oh, you mean their turned out positions??

tranquil jasper
#

No there can be multiple gunners

drifting sky
#

multiple turrets or multiple "gunner" seats?

little raptor
#

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

jade acorn
#

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.

little raptor
#

you can add the next waypoint 5 seconds later

tranquil jasper
#

hold waypoint is correct

jade acorn
#

so there's no way to do this using the editor waypoints?

tranquil jasper
#

but hold waypoint doesn't have a proper condition so it completes instantly, thus it seems "skipped"

jade acorn
little raptor
#

not sure if it deletes the waypoints tho

#

iirc it didn't

#
this spawn {
  doStop _this;
  sleep 5;
  _this doFollow _this;
};
jade acorn
#

thanks, I'll try this out

drifting sky
#

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?

shadow sapphire
#

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.
little raptor
#

it can't be forced

drifting sky
#

so they can never use those guns then.

little raptor
#

just call

shadow sapphire
little raptor
#

call can do that in just 1 script

shadow sapphire
#

Okay!

little raptor
#

How would I call in that context?
_x call ASG_FNC_BLIGear;

#

no need for waitUntil or anything

#

} foreach [BA11];
why?

shadow sapphire
#

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.

little raptor
#

BA11Grave pushback (_this select 0);
PublicVariable "BA11Grave";
I'm gonna assume that array can get big pretty huge really quick

#

broadcasting arrays is slow

shadow sapphire
shadow sapphire
little raptor
#

the above code is already scheduled

#

otherwise you wouldn't be able to do waitUntil in the first place

shadow sapphire
#

I wasn't using waitUntil before and I think the script wasn't finishing.

little raptor
#

because you had spawn

shadow sapphire
#

Ah! Interesting. Okay, I'll note that.

#

Thanks for everything so far. got anything else?

little raptor
#

call executes the script and waits for it to finish

little raptor
#
units BA11 select [0, 3] apply {_x moveInAny BA11V};
tranquil jasper
# jade acorn so there's no way to do this using the editor waypoints?

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

shadow sapphire
little raptor
shadow sapphire
#

Ah! Okay, great! Thanks!

little raptor
#

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

shadow sapphire
#

That's terrific! Then that can just be the whole group.

royal bramble
#

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?

tranquil jasper
#

addAction works with dead bodies

manic sigil
#

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

tranquil jasper
#

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

drifting sky
#

Will ai groups given a "move" waypoint break off from pursuing the waypoint in order to attack known enemies?

civic dragon
#

Is there any possibility to get the current rpm gear of a vehicle ?

tranquil jasper
drifting sky
#

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?

tranquil jasper
#

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

drifting sky
#

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.

drifting sky
#

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]

drifting sky
#

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?

manic sigil
drifting sky
#

Is there a way to determine if a vehicle which can fire artillery is ready to fire an artillery round?

drifting sky
#

Is there a way to return which weapon on a vehicle is artillery?

#

Or which "gunner" is the artillery gunner?

drifting sky
#

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.

manic sigil
#

I have to ask - is it important that your player/s see or hear the guns firing?

drifting sky
#

Some of the artillery is going to be vehicles spawned in during the game

#

so yes... I want it all real.

manic sigil
#

But will the players see or hear the guns?

drifting sky
#

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.

manic sigil
#

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.

drifting sky
#

I'm going to stick with real artillery.

manic sigil
#

Fair enough.

drifting sky
#

Now, how to find which gun on a vehicle is artillery.

#

some vehicles have both an artillery gun and a MG.

manic sigil
#

Should just be currentweapon gunner artilleryvehicle

drifting sky
#

that's returning their rifle, not the weapon they're crewing.

manic sigil
#

Currentweapon artilleryvehicle

drifting sky
#

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.

manic sigil
#

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

drifting sky
#

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?

manic sigil
#

Weaponreloadingtime && ammo == maximumroundshere

drifting sky
#

so weaponReloadingTime of 1 is ready to fire?

#

or is 0 ready to fire?

drifting sky
#

Is there any reason why doArtilleryFire shouldn't work on a mobile artillery vehicle?

pulsar bluff
#

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

drifting sky
#

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.

red socket
#

Im trying to use the spawn ai module, anyone know how to get the ai to sync to high command when spawned?

drifting sky
#

I found another solution. Just move the waypoint about a million miles out for a few seconds, then delete it.

tough abyss
#

Is there a classnames designated for type of unit? Like a Infantry, Armor, Plane etc.

warm hedge
#

Well, that's what classNames designate for...

little raptor
#

do you want something to use with isKindOf?

winter rose
#

Man is CAManBase

manic sigil
#

Man is aFeatherlessBiped

tough abyss
#

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"];

warm hedge
#

OPFOR Tank I assume. That should mean nothing just a designation/note

little raptor
tough abyss
#

oh

#

thanks. now i get it.

winter rose
empty rivet
#

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

hallow mortar
#

hideObjectGlobal must be executed on the server and only on the server

empty rivet
#

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

hallow mortar
#

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.

empty rivet
#

Hm

#

in terms of getting it to work, would I have to use something along the lines of remoteExec or so?

hallow mortar
#

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.

empty rivet
#

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 😅

empty rivet
#

Again, thanks a lot. Works just fine now and saved me quite a bit of pain

broken forge
#

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.
little raptor
#

and I don't get the question. what does being undercover have to do with params?

broken forge
#

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.

little raptor
broken forge
#

So what if I wanted to get more specific, checking if you have a certain headgear, vest, and etc?

little raptor
broken forge
#

Now that you asked that, that would be a great added function, so yes

little raptor
#

and how do you define each area?

true bear
#

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

broken forge
#

Areas will be defined by a trigger

little raptor
# true bear hi, is someone able to help with a simple heli spawn script? like, spawn heli, m...
_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}]
true bear
#

that was fast ! trying it now

little raptor
# broken forge Areas will be defined by a trigger

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

true bear
#

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

little raptor
true bear
#

invisible helipads

little raptor
#

then they're not markers...

#

why don't you just use markers?

true bear
#

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?

little raptor
true bear
#

interesting, thx

drifting portal
#

is this possible?

hushed sequoia
#

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

tough abyss
#

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

little raptor
flat eagle
#

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

hushed sequoia
#

Where should I go then

#

Thax for the info leopard 20

hushed sequoia
#

Okay

little raptor
tough abyss
little raptor
#

no

flat eagle
#

no

little raptor
tough abyss
#

I'm dumb so me need explicit instructions

#

Thank you 😅

little raptor
tough abyss
#

Does the Vehicle thing need to be the specific variable of the tank or just vehicle (I'm using multiple tanks)

flat eagle
#

no

little raptor
tough abyss
#

Sweet. So this in the init of the tank?

little raptor
#

no you must run it every time meowsweats

#

use GetInMan event handler if you want to automate it

tough abyss
#

Oh boy this is gonna get complicated isn't it

flat eagle
#

ohhhhhh yes it is

little raptor
#
this addEventHandler ["GetInMan", {
  params ["_unit", "_veh"];
  _veh setEffectiveCommander _unit;
}];
tough abyss
#

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...

flat eagle
#

anything that sounds simple, never is

tough abyss
#

Every player I wish to use for it, right?

flat eagle
#

yes

tough abyss
#

Okay

little raptor
#

in multiplayer you better add a if (!local this) exitWith {};

tough abyss
#

Damn gifs don't work

#

Uhhhhh

granite sky
#

hmm, setEffectiveCommander is supposed to be run globally though.

little raptor
#

you sure?

granite sky
#

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.

little raptor
#

makes no sense

tough abyss
granite sky
#

would need to test.

flat eagle
#

seems like it can be ran like any other command

flat eagle
little raptor
#

if the wiki is correct

tough abyss
#

Okay because I've no idea where to put that in

little raptor
#

I guess like many other EHs it can be added to remote units but only triggers where unit is local

flat eagle
#

somtimes it can be hit or miss

tough abyss
#

My coding experience boils down to like 3 lines of HTML

little raptor
#

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];
}];
granite sky
#

The GetInMan will (probably?) trigger everywhere though, so it's already running setEffectiveCommander globally.

little raptor
tough abyss
#

Errored out

little raptor
flat eagle
#

im starting to think that just having the vehicle's crew join the players group would be easier

tough abyss
#

Didn't catch the error but something about expecting an object and getting a string

little raptor
#

fixed

granite sky
#

In Arma sometimes you can't have what you want :P

flat eagle
#

but its just as easy to remove them too

granite sky
#

This is fine if it works though, but you'd need to check multiplayer.

tough abyss
#

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

little raptor
#

lock the vehicle meowsweats

tough abyss
#

While they're in it? That's not gonna work well XD

granite sky
#

There is also lockDriver and lockTurret.

tough abyss
#

At this point the gains aren't worth it

little raptor
#

the problem is they can't get out either 🤣

flat eagle
#

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

true bear
#

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.

winter rose
#

What more do you want? meowhuh

true bear
#

cant get the line to work. : \

winter rose
#

if, at any point in the mission, anywhere, the player fires, it's lost?

true bear
#

only in the safe zone where the trigger is covering

#

like if the player fires inside the trigger, its lost

manic sigil
#

Sloppy way, add or remove the eventhandler on entering or leaving the trigger zone?

true bear
#

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

winter rose
#

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?

true bear
#

thx, ill tinker with that.

#

no enemies are involved though

manic sigil
#

Is it a challenge for trigger discipline, or just to enforce immersion?

true bear
#

both

#

if you suddenly fire your weapon at a military base you're out. just need a simple trigger that will register that

true bear
#

figured it out

drifting sky
#

Is there a way to give stuck vehicles a nudge (a kick in the butt) as an initial means of unsticking them?

jade acorn
#

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

drifting sky
#

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.

jade acorn
#
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
drifting sky
#

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?

granite sky
#

+y IIRC

drifting sky
#

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?

granite sky
#

I believe it's an impulse.

elfin comet
#

For waitUntil, would this fire only after both are true or just one of them?

waitUntil { triggerActivated reconSpotted; sleep (random[900, 1200, 1500]); };```
drifting sky
#

Is there a null value for a script handle? In other words, I'm looking to see if a variable currently holds script handle.

manic sigil
drifting sky
#

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?

open fractal
#

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];

drifting sky
#

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.

elfin comet
#

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.

tidal idol
#

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?

crude vigil
tidal idol
#

:D

Does it still work when testing in 3DEN?

crude vigil
#

How many times do u test ur mission?

#

Add another test on top of that, see for yourself, why trust me? =)

tidal idol
#

Considering that this is only one line, and only effectively changes the year, I'd say it's not worth testing.

crude vigil
#

I can only respect your decision. ¯_(ツ)_/¯

drifting sky
#

actions "heal" vs. "healsoldier". Thoughts on the differences between these?

drifting sky
#

what kinds of things constitute "entities" type in arma scripting?

pulsar bluff
#

teleportation works fine, just check for nearby players to ensure its not too immersion breaking

little raptor
#

waitUntil must return bool

little raptor
drifting sky
#

but it's not defined as far as I can see, what is an "entity"

little raptor
little raptor
little raptor
#

Afaik

#

See the allObjects command

drifting sky
#

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?

little raptor
#

Like I said the game uses it with different meanings
But for the entites command as I said only normal objs are considered

drifting sky
#

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?

hallow mortar
#

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

little raptor
#

But what's the point anyway?

drifting sky
#

So it's not making a copy of the code then.

little raptor
#

There's no command that modifies a code by reference

little raptor
drifting sky
#

I'm sending a script to be used IN a function.

little raptor
#

You can't modify code

little raptor
drifting sky
#

Just want to make sure it's not pointlessly duplicating the code in memory.

little raptor
#

It won't matter whether it's by reference or copy

little raptor
drifting sky
#

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.

little raptor
#

They are

#

Afaik

drifting sky
#

A=2; B=A; B=3; .... A still equals 2.

little raptor
#

Because you're not modifying it by reference

drifting sky
#

is there a way to explicitly modify by reference?

little raptor
little raptor
#

e.g. pushBack modifies by ref

#

But + makes a copy

drifting sky
#

k thanks for the headsup, that might have tripped me up at some point.

tough abyss
#

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

tough abyss
little raptor
tough abyss
#

and nothinh happen bomb is blind

little raptor
#

How do you do setMissileTarget anyway?

tough abyss
little raptor
#

Because you need the projectile

tough abyss
#

previously i did _pilotCamTrack = vehicle player setPilotCameraTarget [xxxxxxx]; and laser target on and BIS_fnc_fire GBU 24

tough abyss
little raptor
#

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

tough abyss
little raptor
#

Then copy the whole thing to the plane's init

tough abyss
little raptor
#

np

tired delta
#

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

manic sigil
#

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

versed widget
tired delta
#

i will look into that

versed widget
#

limitSpeed works for Ai vehicles only 🙂

pulsar bluff
#

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

manic sigil
shadow sapphire
#

How would someone most easily find the group of a dead AI unit?

winter rose
little raptor
#

@pulsar bluff

#

No need to approximate it. You can find exactly where it is

shadow sapphire
#

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 = [];```
little raptor
#

Then once the unit dies save the group as a variable in unit's varspace

shadow sapphire
#
{
    _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.
little raptor
#

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

shadow sapphire
#

OH! I see.

#

Why do we add negative one, rather than subtract directly?

granite sky
#

because otherwise you might need two functions

#

Depends if you ever want to add tickets.

shadow sapphire
#

I never want to add tickets when units are killed.

little raptor
shadow sapphire
#

That makes sense.

little raptor
#

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

shadow sapphire
#

Reads them back? Like as output or?

little raptor
#

yeah

#

I mean gives them back after modification (or if 0, no modification)

shadow sapphire
#

Gotcha! Thanks!

little raptor
shadow sapphire
#

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.

jovial steeple
#

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;

drowsy geyser
#

is possible to disable the night & thermal vision while in spectator mode?

bright sparrow
#

How can I make a trigger/ script choose between 1 command or the other

open fractal
digital torrent
#

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

bright sparrow
open fractal
bright sparrow
#

"this"

open fractal
#

i don't think you understand. I'm not talking about the trigger, I'm asking what you want to happen.

bright sparrow
#

Player leaves spawn (trigger "oos") then either playMusic "A" gets executed or playMusic "B"

open fractal
#

im done

bright sparrow
#

ok

open fractal
#

nah let me rephrase one more time

#

do you want it to randomly choose or choose one track over another for a reason?

granite sky
#

@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.

formal brook
#

Trying to fix something involving VTOLs, any way I can make them turn off Auto vectoring?

coarse dragon
#

hm

#
q setDamage [1];
is that wrong?
tough abyss
#

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

hallow mortar
manic sigil
coarse dragon
#
q setDamage 1;

that worked

manic sigil
#

That too :p

coarse dragon
#

dunno where i got the [] from lol

#

thank you kindly sir

manic sigil
#

The alternative syntax with an array ( the [] bit ) allows you to disable destruction effects.

coarse dragon
#

ohh

#

that explains why the code was working, but didnt do anyhting

manic sigil
#

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.

coarse dragon
#

im stupid soo dont worrie about explaining

#

lol

manic sigil
#

Nah man, if not for your benefit, then the benefit of the next guy who sees it wondering what they got wrong :p

coarse dragon
#

I'm both stupid and educational 😂 😂

tough abyss
#

Mb mb

slender beacon
#

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

slender beacon
#

I see

#

What would be similar to how ShellBase is used in this concept?

little raptor
#

the correct way that works with any mod is getting the simulation of the mag ammo

#

for grenades it should be "shotGrenade"

slender beacon
#

That helps, thanks!

calm python
#

anyone know how to add Thermal Vision on a turret tank with the init command?

little raptor
#

not possible

bold ravine
#

does anyone know if theres a way to change the TFAR encryption key of vehicles for TVT purposes?

#

/have actually have experience doing this?

velvet merlin
#

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

drifting portal
drifting portal
little raptor
#

you can find the function directly by going through the 3den display class

drifting portal
little raptor
#

idk. RscDisplay3DEN or something

drifting portal
little raptor
#

@drifting portal

configFile >> "Display3DEN" >> "ContextMenu" >> "Items" >> "Garage"
#
action = "['garage'] call bis_fnc_3DENEntityMenu;";
drifting portal
drifting portal
fleet sand
drifting portal
coarse dragon
#

Is it possible to do like a waking up from being knock out type thing?

fleet sand
drifting portal
drifting portal
drifting portal
#

there is a lot of difference

fleet sand
drifting portal
manic sigil
#

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.

little raptor
#

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

drifting portal
little raptor
#

¯_(ツ)_/¯

drifting portal
#
player setdamage 1;
proven charm
#

do I need to call setPylonLoadout on every client to make vehicle have the same loadout on all clients?

proven charm
#

yea.. was looking at that.. seems bit weird

#

how about server?

granite sky
#

I suspect it's wrong.

winter rose
granite sky
#

well, we're using it as if it was GE. I'll keep an eye out in zeus :P

winter rose
proven charm
#

hmm running setPylonLoadout on client with dedi server works..

granite sky
#

question is whether you get some visual desync from client->client.

proven charm
#

but is it going to work for all clients who don't run the command?

granite sky
#

Possibly the "real" weapons part is global but the visual pylon updating is local.

proven charm
#

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

drifting portal
coarse dragon
winter rose
#

yes, with Post-Process effects 🙂

spark turret
#

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

winter rose
#

isKindOf?

spark turret
#
    hint str ("_x isKindOf ['Air', configFile >> 'CfgVehicles'];" configClasses configFile);
``` throw "type config entry, expected string
winter rose
#

yeah…?

#

_x is config

#

use configName _x

spark turret
#

let me try 🙂

#

hm returns an empty array.

#

wait, are plane classnames even stored in cfgVehicles?

winter rose
#

…nah, CfgAmmo

#

yes
CfgVehicles

spark turret
#

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

winter rose
#

hi, I'm dad!

spark turret
#

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...

winter rose
#

hue hue hue

#

Arma'd

spark turret
#

hm its not what i wanted. it contains a lot of classes that are just hirarchy placeholders "Plane","UAV","Fighter"

winter rose
#

yep
check scope = 2 and isUAV = 0 then

spark turret
#

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 👍

spark turret
#

ah cool 👍

proven charm
#

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..

granite sky
#

In the sense of visually having the right stuff on the pylons?

proven charm
#

yes

drifting portal
#

I wonder why they made it LE

proven charm
#

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

drifting portal
drifting portal
#

that's weird

drifting portal
proven charm
#

they cant be fired though

drifting portal
#

still, I don't understand why its LE, kinda weird

#

because it creates more problems than it solves

proven charm
#

arma commands are weird 😄

drifting portal
#

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"?

proven charm
#

There's the JIP parameter for that

drifting portal
proven charm
#

good question

drifting portal
# proven charm 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

proven charm
#

sorry =/

#

I'm also working on loadout editor

drifting portal
proven charm
#

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

drifting portal
proven charm
#

yes

drifting portal
#

even if you disconnect and reconnect?

proven charm
#

yep

drifting portal
#

I guess when you change the pylon it gets broadcasted to JIP players automatically as its a part of the "vehicle"

proven charm
#

that's what I thought also

drifting portal
#

Arma 3 veterans rise up

winter rose
drifting portal
cosmic lichen
#

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.

winter rose
#

it's an Eden Enhanced bug most likely!

cosmic lichen
#

...

#

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.

winter rose
granite sky
#

@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.

cosmic lichen
#

[1,0.0502767,35]

granite sky
#

I think that's legit for max fog?

cosmic lichen
#

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.

drifting portal
#

while others are viewing everything normally

cosmic lichen
#

Weird.

drifting portal
spark turret
#

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

little raptor
spark turret
#

getPosWorld, getPosAsl

little raptor
#

were you in the car?

spark turret
#

no, im in zeus, but it was the position of a car i was getting

shadow sapphire
#

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.
winter rose
shadow sapphire
granite sky
#

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.

winter rose
ashen warren
#

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";
little raptor
#

oof

#

who even uses that still?! thonk

ashen warren
#

me apparently

little raptor
#

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

sonic sage
#

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

granite sky
#
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

spark turret
#

ah damn i didnt read Johns message

granite sky
#

I have no idea on the fire/smoke part :P

sonic sage
#

the eventhandler worked great

#

seems like creating the fire and smoke will be the hardest part

manic sigil
little raptor
#

there's no need to do that

sonic sage
little raptor
#

you can join the unit into a group of other side
but not when you create them. it has to be done with delay

manic sigil
#

Or that, yeah.

sonic sage
#

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

digital rover
#

does the EntityKilled mission EH fire on player disconnnect?

ashen warren
granite sky
#

That's normally quite difficult to arrange unless you've been shooting a lot of civilians.

ashen warren
granite sky
#

Yes. You should sort out your spawning script first though.

manic sigil
sonic sage
#

thank you

#

that's exactly what i was looking for

sleek galleon
#

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

sleek galleon
open fractal
#

oh shit bad question you said ace

sleek galleon
#

Yes ^^

open fractal
#

I believe ace arsenals can be added locally

sleek galleon
#

Ooh I'll check that ou !

#

out*

open fractal
sonic sage
#
  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;

open fractal
#

this isn't defined in your event handler

#

so _posATL is probably nil

sonic sage
#
  params ["_oldBuilding", "_newBuilding", "_isRuin","_this"]; 
  if (_isRuin) then { 
    hint("dead");
    [this modelToWorld [0,0,0]]execvm "FS.sqf";
  }; 
}];```
so correct would be this?
open fractal
#

this modelToWorld

#

this isn't a magic variable in an event handler

sonic sage
#

i think i get it now

open fractal
#

try _newBuilding instead

sonic sage
#

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

open fractal
#

yeah the event handler expression is a separate scope

tough abyss
#

does anyone have a script for spawning props

acoustic abyss
pliant shell
#

is there a way i can get a unit to play an animation in eden editor without loading polpox anim viewer?

whole light
whole light
tough abyss
#

i like it

drifting portal
#

how do I flip and object that is attached to another object?
I tried setVectorUp and BIS_fnc_setPitchBank and setVectorDirAndUp but none worked?

whole light
#

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).

proven charm
#

don't invisible units take splash damage?

fleet sand
fleet sand
tepid horizon
#

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

drifting portal
tepid horizon
#

Wait really?

drifting portal
tepid horizon
#

What do you mean disable simulation?

#

I’m not exactly familiar with scripting

drifting portal
#

put that in the object's init

tepid horizon
#

Ah thank you

drifting portal
tepid horizon
#

Just out of curiosity what were you doing trying to make flying submarines?

drifting portal
#

a boss fight to be more precise

tepid horizon
#

That’s an interesting boss lol

whole light
coarse dragon
#

How does one end a animation from Polpoxs viewer

sonic sage
#

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.

little raptor
little raptor
#

you can use killed event handler

sonic sage
#

Oof

little raptor
#

or MPKilled

fleet sand
little raptor
#

@drifting portal ^

little raptor
fleet sand
sonic sage
little raptor
manic sigil
sonic sage
#

These groups include static objects

little raptor
#

or just one (e.g. per task)?

sonic sage
#

All of them have to be killed before the task is considered completed

little raptor
#

add EHs to all

#

then increment a counter

sonic sage
#

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?

little raptor
#

no need to define it. you can use a default value instead

little raptor
#
{
  _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

sonic sage
#

Is My_units an array of the units in that group in this case?

little raptor
#

btw that's only valid in single player

little raptor
#

idk what you have

#

if it's a group you can do My_units = units myGroup

sonic sage
little raptor
#

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

tough abyss
#

does anyone have a bis garage script thatll show all mods and not make the vehicle invincible

drifting portal
#

the vehicle refuses to get flipped

#

I tried setVectorUp and BIS_fnc_setPitchBank and setVectorDirAndUp but none worked

#

it just stays upright

little raptor
#

you're probably doing something wrong

drifting portal
#

so I may try it and give feedback

drifting portal
little raptor
#

that was just an example

drifting portal
#

but for some reason it didn't work back then

#

thanks

little raptor
#

maybe you used setDir

#

¯_(ツ)_/¯

drifting portal
#

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

drifting portal
proven charm
drifting portal
proven charm
drifting portal
#

but the keep leaving the vehicle so

#

they won't engage the enemy

#

because they keep leaving (and getting back by script)

shadow sapphire
#

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?

granite sky
#

That's... challenging. And in the map case probably too slow for realtime processing.

#

Usual tools are nearestTerrainObjects and nearObjects.

shadow sapphire
granite sky
#

nearObjects uses isKindOf with object types, while nearestTerrainObjects has a separate categorization system.

shadow sapphire
#
{ _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.
granite sky
#

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?

shadow sapphire
#

You are probably right.

Dang.

granite sky
#

also house in nearestTerrainObjects is not the same as house in nearObjects :P

shadow sapphire
#

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.

granite sky
#

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

shadow sapphire
#

Hm. Sounds like a plan.

granite sky
#

Just don't expect it to work on different maps.

shadow sapphire
#

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?

granite sky
#

You could, but bear in mind that nearObjects is really slow if you throw a vast list of classnames at it.

little raptor
#

nearObjects only takes 1 class name

shadow sapphire
#

I think that's okay, because it will be happening before the players are involved in anything real, right?

little raptor
#

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

granite sky
#

Oh yeah, you're screwed :P

little raptor
#

unfortunately you probably have to resort to a very slow nearestTerrainObjects + comparing models method

shadow sapphire
# little raptor also many terrain objects don't have class names

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?

granite sky
#

I think you might be underestimating how slow this could be :P

little raptor
#

depends on the area size too

#

if whole map it's very slow

granite sky
#

Also every object that's hidden is extra network traffic on join. It's really not something you should do over a whole map.

little raptor
#

you can just hide them locally

shadow sapphire
#

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.

shadow sapphire
little raptor
#

you can't hide terrain objects globally anyway

granite sky
#

ah yeah, but then they're definitely gonna suffer.

#

You can argue starting the server up an hour early :P

shadow sapphire
#

It's meant to be a persistent battlefield with only one to two daily restarts for cleanup.

granite sky
#

Could consider replacing your deletion modules with a (large) array of positions stored in a script, and possibly pre-generating that.

shadow sapphire
granite sky
#

IIRC nearestObject is much slower than nearestObjects with a small radius if you're marking positions of single objects, which is maybe non-obvious.

shadow sapphire
#

I didn't even really realize they were distinct commands.

vestal radish
#

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?

open fractal
vestal radish
#

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

open fractal
#

did you pass this to the called code?

vestal radish
#

I barely know how to script so i dont know

open fractal
#

also is it just for one unit?

vestal radish
#

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;

open fractal
#

that's not how that works

#

the game doesn't know what this means if it's not inside the object init

vestal radish
#

if (!local _this) exitWith {};

#

would this help

#

and replace removeAllWeapons _this; fix that

open fractal
#

_this might work

vestal radish
#

alright ill try that

open fractal
#

_this is for passed arguments, which is what that init does

vestal radish
#

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

open fractal
#

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

vestal radish
#

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

open fractal
#

here's something I made real quick as a test

vestal radish
#

alright that looks like the format I was going to use so hopefully it will work

open fractal
#

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

vestal radish
#

sure dont know how to use it probably but ill take all the tools and templates i can get

modern meteor
#

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.

modern meteor
#

ah, i see

#

the rest of the code is fine?

winter rose
#

no sleep, no waituntil, etc
the rest seems fine

modern meteor
#

got it. but can I call an sqf file from the FSM? Are there any restrictions within the sqf?

winter rose
#

no restrictions at all!

modern meteor
#

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.

winter rose
#

all the SQF is valid; only suspension is not allowed - that's about it

modern meteor
#

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

manic sigil
#

The second hint would immediately overwrite the first.

winter rose
#

well, is the FSM executed 🙃

modern meteor
modern meteor
winter rose
#

I added it to it an existing FSM and pressed Save
where, and how? because FSM is following a certain order and logic

modern meteor
#

Here is a picture

winter rose
#

ok yeah, it should work indeed

granite sky
#

What's in the delay now? Nothing?

modern meteor
#

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?

granite sky
#

err, if it's not in a PBO, yeah

modern meteor
#

Yea, I save it and then pbo the addon

#

hm

#

Not sure what's wrong

winter rose
#

yeah, wrong way to test an FSM

#

try in a test mission instead

granite sky
#

shrugs

#

Just stick a diag_log in every init box and you'll probably figure it out :P

modern meteor
granite sky
#

blinks

modern meteor
#

Thanks, I will try this

tough abyss
open fractal
#

or just use debug console to paste to your clipboard

tough abyss
#

👍

tough abyss
#

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

open fractal
#

you can make it not invincible if you modify the function

#

not sure how complex this one is

tough abyss
#

im not a 100% sure how to modify the function

#

i know theres an enabledamage command somewhere that makes it invincible

open fractal
#

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

tough abyss
#

ok

open fractal
#

for the record I don't condone doing this with other peoples mods, just for modding the game itself

little raptor
#

Just use the "garageClosed" scripted event handler and re enable damage

open fractal
#

do you think a scripted EH would work for this

#

there it is

little raptor
#

Tho not sure what the vehicle's var is
You'd have to read the function

open fractal
#

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?

tough abyss
#

i use them just to play with friends

tough abyss
little raptor
#

no

little raptor
#

it's BIS_fnc_garage_center

#
["Open", true] call BIS_fnc_garage;
[missionNamespace, "garageClosed", {BIS_fnc_garage_center allowDamage true}] call BIS_fnc_addScriptedEventHandler
tough abyss
#

will it actually spawn in front of me

#

instead of where it was destroyed

little raptor
#

destroyed?

tough abyss
#

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

little raptor
# tough abyss will it actually spawn in front of me
["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

tough abyss
#

alright ty

tough abyss
#

thats been destroyed

#

then basically regens the vehicle

true frigate
#

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 :)

winter rose
true frigate
#

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?

winter rose
true frigate
#

Brilliant as always Lou, thanks! :)

misty sparrow
#

What the key for the debug console ??

winter rose
misty sparrow
winter rose
#

no

#

this channel is for scripting

misty sparrow
winter rose
#

?

little raptor
#

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 thonk

little raptor
winter rose
open fractal
#

yourVariable = nil;

manic sigil
#

Ugh, I give. I can't get this stupid function to work T_T

tough abyss
manic sigil
#

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.

tough abyss
#

because im stupid

open fractal
tough abyss
#

virtual garage is weird

quick root
#

can someone explain how to use setDriveOnPath because I don't understand from the documentation

proven charm
winter rose
#

well, maybe it needs some delay, or it needs vehicle crew2 @quick root

little raptor
#

@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 ^

little raptor
#

they get out because there's an FSM that tells them to do so iirc

little raptor
#

nearestEntities

#

no such command