#arma3_scripting

1 messages · Page 763 of 1

shadow sapphire
#

You're calling it in onPlayerRespawn now?

cyan valve
#

Yeah

#

so now that the file type is correct, let me see if that fixed the fall damage thing as well

#

it sure seems to have!

#

so I just needed the whole WaitUntil part of the code, as well as actually having the file not be a .txt, and it seems to be working

shadow sapphire
#

Good stuff.

cyan valve
#

I still need to test it with multiple people online to make sure it doesn't just apply to me, but I think that should hopefully do it

shadow sapphire
#

It should apply to every player.

cyan valve
#

Yeah, it should, but I've learned it's best to not rely on Arma to do what it should x3

#

Thanks a ton dude

#

your help and patience is much appreciated

shadow sapphire
#

All good.

#

Anyone know of the simplest way to replenish AI groups with the same units they lost?

I'm thinking about creating an array for each AI group and adding each AI to the array "onkilled," and using that as the respawn. Any input on that before I try it that way?

fair drum
#

yes it will show up in that array

oh you mean as if you were to fly through the trigger... hmmm. I'm not sure. Would have to test it

deep loom
#

Yeah I'm wondering if the uniforms allPlayer trigger will apply to that.

#

It doesn't list the tasks which are set to "all players". So I'm not sure.

#

But I know allPlayers does include headless clients

drifting sky
#

If I find that a unit is carrying a 40mm grenade round, is there a quick way to find out if their primary weapon is capable of firing it?

fair drum
little raptor
#

Add it with delay then

drifting sky
#

is there a way to return the muzzle which can fire the round?

sage heath
drifting sky
#

Unless there's a better way than this to force the ai to fire a specific round out of their grenade launcher: _unit selectWeapon _muzzle; _unit fire [_muzzle,_muzzle,_mag];

little raptor
little raptor
sage heath
#

not to me, sorry

little raptor
#

Before you add the EH

sage heath
#

ah

#

so...use sleep?

little raptor
#

Yes

deep loom
fair drum
#

i mean put a side check in your script to filter it out in case

sage heath
# little raptor It's already obvious where...
player addEventHandler ["animStateChanged", {
if ("halo" in _this#1) then {
_this#0 setVelocity (plane1 vectorModelToWorld [0, 10, -2]);
_this#0 removeEventHandler ["animStateChanged", _thisEventHandler]
}
}]```
#

this?

little raptor
#

Yes

fair drum
#

or lets just test it real quick and see if the trigger will fire when you fly through

little raptor
#

120 second delay? oof

#

I'd say 2-3 secs is enough

deep loom
fair drum
deep loom
#

Oh duh.

finite bone
#

How would I convert this: sqf [_identity] execVM "\Files\check_identity.sqf"; to remoteExec? IIRC, sqf {["check_identity.sqf"] remoteExec ["BIS_fnc_execVM", 0];} executes the sqf remotely but how would I pass my variable with it?

deep loom
#

So what would be the best way to filter out zeus?

#

allPlayers findIf {uniform _x isNotEqualTo "U_I_CombatUniform"} == -1;

fair drum
#

or check allCurators, etc

finite bone
deep loom
fair drum
#

no what we are saying is checking the type and comparing it

#

in a DRG game atm so i can't type it out

deep loom
#

No worries. Take your time. No rush and appreciate the help. Just still trying to get my head around it.

finite bone
# deep loom I'm already using the VirtualCurator_F as my Zeus

So if you want to ensure that whatever code/action you want to perform should not be on Zeus then you'd write it as sqf if (typeOf _x != "VirtualCurator_F") then { /* do something to units that is not zeus */ } else { /* do something to units that is a zeus */ };

fair drum
little raptor
drifting portal
#

two simple questions

Do dead units take cpu usage?

Do dead units deleted with deleteVehicle take cpu usage?

fair drum
little raptor
#

Yes

#

class names are not case sensitive

deep loom
little raptor
#

Better just not risk it at all

#

uniform returns the correct case tho

little raptor
#

The 2nd one is better

deep loom
little raptor
#

Tho not sure what you wanted

#

If you want to filter virtual stuff that won't work for you

deep loom
#

So allPlayers findIf {_x isKindOf "CAManBase"} == -1;

little raptor
deep loom
#

I'm trying to configure a trigger to fire when all players except for the zeus are wearing a certain uniform.

#

First solution was just to put zeus on a unit already wearing the uniform and remove the model.

#

Which worked fine.

#

But I thought a virtual zeus would be better.

little raptor
deep loom
#

I was creating an area trigger to test whether or not the virtual zeus was considered a player to see if it would fire when the zeus flew into it. It did.

#

So that's how I knew I'd have to filter the zeus out if I wanted to use a virtual one.

#

And I was just going to try to use the area trigger as a way to learn concepts rather than just copying and pasting stuff.

little raptor
#
thisList findIf {!(_x isKindOf "VirtualCurator_F")} != -1;
#

Wait the class is wrong

#

It was virtual zeus meowsweats

#

Ok fixed

#

Test now

deep loom
#

Works

#

So then using the uniform check script filtering out zeus players the code would be allPlayers findIf {_x isKindOf "CAManBase" && uniform _x != "U_I_CombatUniform"} == -1;?

little raptor
#

Put the uniform class in ...

#

Wasn't sure if Virtual curator is a CAManBase thonk

deep loom
#

Right. So just to clarify. The one I listed checks to see if player is CAManBase and then the uniform, and yours checks to see if they're not VirtualCurator_F, right?

little raptor
#

It triggers even if there are no players present

deep loom
#

Aren't there always going to be players present though?

little raptor
deep loom
#

I spawned in as zeus and checks the trigger and it didn't fire

#

But it also won't assign the task to a zeus.

#

So the trigger isn't checking yet.

fair drum
#

you want the task as zeus too?

deep loom
#

No.

#

Not needed.

#

I mean beyond knowing when the task succeeds I guess.

#

Which is interesting because the taskAssign module is set to all playable units

little raptor
little raptor
#

Unless you've set the trigger as area and didn't even move into it thonk

deep loom
fair drum
#

you have the trigger set to "Anybody" right?

deep loom
#

I didn't have any activation set at all. It just fires when the condition is met.

little raptor
#

It works with zeus

#

But not if server's empty

deep loom
#

I'm gonna test the revised one with a friend now. I'll let you know how it works.

fair drum
#

you can open multiple instances of your game btw

deep loom
drifting portal
deep loom
#

@little raptor @fair drum seems to work fine. Is there any way to get notification of tasks being complete as a zeus on a neutral side?

fair drum
#

if you gave him the task to begin with, he will see the changes

deep loom
#

I have the owner set to "all playable units" right now. I don't see an "anybody" option.

granite sky
#

Corpses are pretty expensive on client perf.

fair drum
#

should be fine then

drifting portal
#

do corpses send any orders or anything of sorts?

#

or do they only remain inactive until they prompted to ragdoll?

granite sky
#

On the client side it should just be rendering. Still expensive apparently.

#

well, plus a bit of AI spotting as that runs everywhere and I think they still check corpses.

drifting portal
granite sky
#

deleteVehicle is fine.

drifting portal
#

nothing better?

granite sky
#

Nope.

deep loom
granite sky
#

You also want to delete all the weapon holders that they create.

little raptor
#

Maybe it works that way

#

If not just show the notification manually

drifting portal
#

wanted to ask about dropped weapons too

granite sky
#

{ deleteVehicle _x } forEach (allMissionObjects "WeaponHolderSimulated");

#

you can do "WeaponHolder" too but I think all the dropped ones are WeaponHolderSimulated.

drifting portal
granite sky
#

What, like documentation

drifting portal
drifting portal
granite sky
#

This is Arma :P

drifting portal
#

like "Air" and "Land" etc

granite sky
#

You can browse the config viewer.

#

It shows the full class heirarchy of any type.

drifting portal
#

I will try that

#

also

drifting portal
#

because wiki says allMissionObjects is heavy

granite sky
#

I don't think they're in vehicles.

#

or entities.

drifting portal
#

if vehicles is less preformance heavy than allMissionObjects

granite sky
#

vehicles is dirt cheap but filtering it won't be.

drifting portal
#

oof

granite sky
#

Depends how often you do it really.

#

allMissionObjects used to be really slow but I think it was improved in 2.08?

drifting portal
#

yeah documentation is kinda dated but Idk

#

I will just test code preformance and see for myself

#

thanks

granite sky
#

Someone here did have the cute idea of detecting dropped weapon holders using the "Put" EH on the killed unit.

#

haven't tried that personally though.

drifting portal
drifting portal
drifting sky
#

Does anyone know if there's a CBA discord server? Or alternatively, does anyone know why AI stop shooting at CBA invisible targets after the target is moved?

pulsar bluff
#

get your stuff working and complete and then optimize

#

the 800 units is the elephant in the room

#

find a way to give players the same experience with fewer spawned units

drifting portal
#

that's the total through the entire mission

sage heath
#

hey anyone knows how to toggle the rhs c-130s cargo lights with a script?

sage heath
#

so thank you

drifting portal
#

And look for an animation that has to do with lights

sage heath
#

where do i put this in?

drifting portal
#

Try looking at the aircraft in question and using

copytoclipboard str(animationnames cursorobject);
#

It should copy the animation names

sage heath
#

so i put that, into the uhhh debug console

#

didnt work

#

nvm

#

got it

#

i just had to it in game

drifting portal
#

So just look for an animation

#

That has to do with cargo light

sage heath
#

jump lights actually and yep

#

found em

drifting portal
#

Send?

sage heath
#

"jumplight_red_hide","jumplight_green_unhide","jumplights_hide"

#

so red is on by default, but there is none for jumplights red unhide

drifting portal
#

Hmm

drifting portal
sage heath
#

no clue myself

#

but

drifting portal
#

Maybe red is not supposed to be turned off?

#

Or maybe it has another name

sage heath
#

all i need is: red turns to green

#

so that covers it

sage heath
drifting portal
#

Try

#

object  animate [animationName, 1, true];
#

Replace object with the vehicle

#

And animation name

#

With each one of these

#

See which one does the desired effect

sage heath
#

so i do, red hide first, then green unhide

#

and then that should cover it

drifting portal
#

I 'm not sure

#

Everyone does animations ina different way

sage heath
#

how come?

drifting portal
#

So try all

drifting portal
sage heath
#

ik, but it looks pretty obvious on what each one do

drifting portal
#

Yea

#

Just try all combinations

#

Is what I'm saying

#

In case something doesn't work

sage heath
#

ok

drifting portal
#

So basically find the right combination

drifting portal
#

And nothing changes

#

Maybe try changing that 1 to 0

drifting portal
sage heath
#

going great

#

its pretty much done, thank you

warm coral
#

does anyone know of a way to remove tank tracks? damaging them only makes the crew dismount, whenever i set the hull texture to invisible theres kinda just floating tracks

drifting portal
warm coral
#

fugg

drifting portal
#

Go try hiding texture for any trackes vehicle

#

It does not work unfortunately

warm coral
#

yeah i found a workabout for what im trying to do so it aint all lost

#

still sucks

drifting portal
#

if you wish to convert the tank into a simple object

warm coral
#

unfortunatly i need it as a working object

drifting portal
#

no luck then

tough parrot
#

Is there specific method to make aircraft ai follow waypoints after taking off? In my test it just flies straight forever into the sky.

#
createVehicleCrew _vehicle;
for "_idx" from (count WEST_UAV_PAT_WPTS)-1 to 0 step -1 do {
    (group (driver _vehicle)) addWaypoint WEST_UAV_PAT_WPTS select _idx;
};
_vehicle engineOn true;
(group (driver _vehicle)) setCurrentWaypoint [(group (driver _vehicle)),1];
#

it doesn't even take off unless engine is turned on manually

tired spear
#

Hey how would a script look for moving an object smoothly?

shadow canopy
#

Tried searching a for a bit, maybe just searching for the wrong words, but is it possible to get the current players weapon object, and therefore their muzzle position?

open fractal
warm hedge
#

Yes you can. With a bit of complicated script

shadow canopy
#

😮

open fractal
shadow canopy
#

How complicated lol

open fractal
#

I couldn't find a method

warm hedge
#

Like too complicated than it should. Let me write my method

open fractal
#

all i can think is getting the position of a projectile when it's fired

#

which obviously isn't accurate to a muzzle position

warm hedge
#
  1. Create a dummy Simple Object
  2. Fetch the position of the object using config and selectionPosition
  3. Fetch the weapon pos/vectorDir, Up
  4. Sum it all
open fractal
#

oh dear

warm hedge
#

See? Complicated

#

I'm not on my PC so can't write sqf but the idea is it

#

I can assist tho

open fractal
warm hedge
#

Tru

shadow canopy
#

Sure, ik the tiow mod does something similar ,but I wanted to spawn a charging laser at the weapons muzzle. RN it all works but spawns at the eye pos lol

#

@open fractal

open fractal
#

ah yes, the classic laser problem

shadow canopy
#

I was hoping maybe there was a command to get weapon object, that would help solve it all, but there isnt

shadow canopy
#

charge laser/ spool minigun kinda of same idea

#

Really thought there was a command to get a players weapon object

open fractal
#

not for held weapons

shadow canopy
#

dang, I think I mixed it up with unitBackpack

#

funny how u can get backpack object lol

open fractal
#

idk what a charging laser is but an alternative would be adding effects with a fired event handler

shadow canopy
#

I mean like u gotta hold the left mouse button to charge it up (in my case just left click and a second later it shoots) hence why I cant really on fired EH cause it happens after the charging

open fractal
#

i think you'd need to make a mod for that

shadow canopy
#

what you mean?

open fractal
#

an addon

#

you can't create weapons with just sqf

#

well you can, sort of, but it won't look or feel organic

#

you'd have to do things like detect left click actions and delete bullets and (inefficiently) draw a laser while checking line intersections

shadow canopy
#

why would I need to create a weapon?

open fractal
#

isnt that essentially what you're trying to do?

shadow canopy
open fractal
#

drawLaser is flawed

#

you can't see the color in overcast weather

#

it sounds like you want to get the muzzle position on every frame. idk what polpox can cook up but that's a challenge

shadow canopy
#

oh dang it doesnt work in overcast?

#

ooof

open fractal
#

afaik

#

ticket is still open on that one

shadow canopy
#

ill try it out

#

oh ticket?

open fractal
#

unresolved bug report

#

i havent tested myself but i just checked back on it

shadow canopy
#

is this ticket visible to teh public?

open fractal
shadow canopy
#

oh okay cool

sudden yacht
#

How do i deactivate a trigger. Not delete it.. Deactivate it. I cannot find any documentation on it all.

cosmic lichen
#

@sudden yacht Set its condition to false?

sudden yacht
#

@cosmic lichen I will look into it.

little raptor
tired spear
#

oh boy

little raptor
#

@open fractal

#

@shadow canopy

open fractal
#

The sacred texts

sudden yacht
#

@cosmic lichen So i figured it out. The trigger becomes deactivated when all sides/objects specified exit it automatically.

open fractal
#

Wouldn’t creating and deleting a simple object on each frame be a big ask?

little raptor
manic sigil
#

Me.

drifting portal
#

Is there another way to force players into free look other than locking them in an animation?

drifting portal
pulsar bluff
#

do we have any idea why lobby slots can "break" and leave the player stuck on "receiving data"?

#

even next person to join into that slot will get stuck

#

only solution then is to join a different slot

#

with that bug present, we cannot have "skipLobby" enabled, since all joining players would get joined into the broken slot and they would not be able to switch to a working slot

modern meteor
#

Trying to let the group AI switching to rifles except for the player. Any idea why they don't switch weapons?

 _x selectWeapon (primaryWeapon _x);
    }forEach units group player;

hint "Switching to rifle";```
modern meteor
#

sorry, what do you mean?

little raptor
#

I mean they select their weapon automatically

modern meteor
#

but you can force them to switch, no?

little raptor
#

no

modern meteor
#
 _x selectWeapon (handgunWeapon _x);


}forEach units group player;

hint "Switching to handgun";```
#

for example switches to handgun for player and group AI

#

I am just trying to exclude the player and just let the Ai switching weapons

little raptor
modern meteor
#

oh

#

in which places though?

little raptor
#

they always select whatever they want

modern meteor
#

ah i see

little raptor
#

if they're not engaging it works

#

when they engage they change their weapon

modern meteor
#

got it

little raptor
modern meteor
#

that's unfortunate because sometime the group AI switches to handgun although there are no enemies close by

#

no idea why they do that

little raptor
#

so count is correct rn

#

but anyway the code is wrong

modern meteor
#

think i fixed it

#
 _x selectWeapon (primaryWeapon _x);
    }}forEach units group player;

hint "Switching to rifle";```
#

but it's obviously useless if the AI switches automatically once they engage

little raptor
modern meteor
#

If i put them into disengage they stay with the weapon selected?

little raptor
#

I don't think so. by engage I mean "firing at enemy". not those command menu things

#

but you can try

#

¯_(ツ)_/¯

modern meteor
#

gotcha

#

thank you

hollow lantern
#

is there a way to get all variables currently present on a unit/player?

granite sky
#

Bear in mind that other mods can and will put variables on units, so it's normally only useful for debugging.

open fractal
little raptor
granite sky
#

(he skimmed over the important bits)

hallow mortar
#

Does vehicles include dead vehicles?

little raptor
jade acorn
#

hey, so I'm using { commandGetOut _x } forEach units group player in a trigger to make my teammates dismount from a helicopter, as "Transport Unload" waypoint works only on my unit. However this makes my character give one command per person, how can I script it so I give order to everybody to dismount instead of "X - dismount" one after another?

#

manual counterpart of what I want to achieve is to select whole team with ~ and make them dismount, but I cannot find a command that would do the same, GetOut action is non-verbal

jade acorn
#

😩

little raptor
#

tho you might want to not give command to yourself 🤣

#
commandGetOut (units player - [player])
jade acorn
#

thanks

#

I think I'm overcomplicating a lot of my code

modern meteor
#

Is there a way to let the AI use their weapon lasers without being in combat mode?

little raptor
jade acorn
little raptor
#

you can draw a laser manually tho... meowsweats

modern meteor
#

Thanks, i'll look into it

drowsy geyser
#

hey, how can i compare if two images have the same texture set with setObjectTextureGlobal
something like:

if (texture image1 isEqualTo texture image2) then {};

i know about getObjectTextures but i cant get it to work somehow, maybe an example?

drowsy geyser
#

yes single texture

little raptor
drowsy geyser
#

that works thank you!

broken forge
#

I'm working on a multiplayer mission and I would like to implement a check within my function of a player's distance from an AI. Once true then the AI does an animation, picks a weapon up and then join the player's team. What would be the best way of doing this? This is what I have done so far: ```sqf
waitUntil {count (allPlayers select { _x distance _hostage < 2 } select 0) > 0};

It just seems like this could be done much simpler then what I've done.
little raptor
#

first of all if you only want at least 1 instance of something, don't use count/select. use findIf

#

second of all, in this case since you're checking distance/area you can use inAreaArray

#

so the fastest version of what you wrote is:

count (allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2]) > 0
granite sky
#

If you're fine with 2d distance then it's a fair bit simpler :P

broken forge
#

So how would a findIf approach look?

granite sky
#

findIf is gonna be a lot slower for that case, because most of the time there won't be anyone near the hostage.

broken forge
#

oh, ok, defiantly don't want that then.

#

Now how would I go about getting the ai to join the player's group from ```sqf
count (allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2]) > 0

As of right now I have this bit of code for that: ```sqf
[_hostage] joinSilent group (allPlayers select { _x distance _hostage < 2 } select 0);
granite sky
#

Store the array returned by inAreaArray and pick the first one.

#

It's not a good idea running the search twice because if it's scheduled then the two calls may actually return different results.

#

In some cases you can get away with it, but it's still bad code :P

broken forge
#

Fair enough, the first part of code that counts the players is wrapped in a waitUntil and my code to have the AI play an animation, pick up a weapon and join the player group come after it. So would that interfere with storing the array?

little raptor
little raptor
#

you have an additional select 0 which selects an object

#

and you're counting an object

#

so it would never work

granite sky
#
private _nearPlayers = [];
waitUntil {
  sleep 1;
  _nearPlayers = allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2];
  count _nearPlayers > 0;
};
[_hostage] joinSilent group (_nearPlayers select 0);
broken forge
#

So this is what the code looks like now: ```sqf
if (!alive _shooter) exitWith {
waitUntil {
sleep 1;
_nearPlayers = allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2];
count _nearPlayers > 0;
};

        _hostage playMove "acts_executionvictim_unbow";

        sleep 5.7;

        _hostage enableAIFeature ["MOVE", true];
        // _hostage setCaptive false;

        [_hostage] joinSilent group (_nearPlayers select 0);
    };
granite sky
#

need to pre-declare _nearPlayers otherwise it might be overwriting something back down the scope.

#

IIRC you don't need to set it to anything but I'd have to check.

broken forge
#

Yep, I have that in the top of the function

granite sky
#

k

fading magnet
#

Why sleep doesn't work in OnActivation of a trigger?

broken forge
#

Now my next question is that you have a sleep within the waitUntil, the if statement is already wrapped inside a while loop that counts down the time every second, which has a few checks via if statements, so would I need that sleep command?

granite sky
#

@broken forge In that case the structure is wrong and you shouldn't have the waitUntil.

#

oh, it's a state machine that's not written as a state machine. Never mind :P

#

yeah you still want the sleep in the waituntil.

#

Because once you're into the inner stage (shooter dead) you still don't want to be spamming the scheduler, ideally.

#

In this case I doubt you're running more than one of them so it doesn't really matter, but it's good practice.

willow hound
broken forge
#

@granite sky Thanks for the info, I'll keep it in then since it's good practice. My next question is to do with a trigger placed in the Eden Editor for a different function. This function is one to capture an HVT, as of now I have this for the condition: ```sqf
alive civ_hvt_0 && { _x distance civ_hvt_0 <= 10 } count allPlayers > 0;

Is there a better approach for this?
@winter rose would what you wrote work best for this? ```sqf
allPlayers findIf { _x distance civ_hvt_0 < 10 } > -1;
solid ocean
#

hi all so im trying to make a simple technical using an offroad (named "tahoe") and a static mg turret, my script works fine in singleplayer but when i attempt to use it in multiplayer it either violently explodes, shoots off into space or falls off the back of the offroad truck. im guessing im doing something wrong not quite sure what im missing. 🤔

#

if (isServer) then { [this, tahoe] call BIS_fnc_attachToRelative };

granite sky
#

@broken forge inAreaArray is almost certainly better again.

#

Although triggers have distance checks as a built-in, so normally you'd structure them to use that.

broken forge
#

@granite sky So this would the best option: ```sqf
count (allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2]) > 0;

granite sky
#

in this case civ_hvt_0 instead of _hostage and 10 instead of 2.

broken forge
#

Ok, would you be open to a private chat, I have a few other things that I would like to go through, and I don't want to clutter up the chat channel here, so others can get their questions in and answered

solid ocean
#

works fine in singleplayer but soon as its put on a server it straight up refuses

granite sky
#

what's the locality of the two objects?

solid ocean
broken forge
#

If I'm trying to call/spawn a function that has some animations that the AI do, would I use [params] remoteExec ["functionName"]; or would the [params] spawn functionName; work fine for that?

fair drum
broken forge
#

@fair drum Ok, so because the mission is multiplayer I should use remoteExec?

fading magnet
fair drum
#

post the function

#

@broken forge

broken forge
fair drum
open fractal
#

if you’re trying to time it with the end of the animation consider adding an event handler to the unit (I think animchanged?)

broken forge
#

@fair drum I have a few other functions that I created to that I could link for you to check if you'd like. @open fractal I'll have to look into that, I would prefer that over using the sleep command.

fair drum
#

also, your playsound is going to be something you will have to remoteExec as it is local

open fractal
#

See animDone as well

broken forge
#

@open fractal I think the AnimDone would be the EH that I would want to go for. I'm just not certain on how to implement an EH within the script yet.

open fractal
#

you can just do _unit addEventHandler before the animation

broken forge
fair drum
#

where are you running these and do you know how to tell if a command is local/global?

#

and are you using a headless client

broken forge
#

They're all for a multiplayer mission and no headless client

willow hound
fading magnet
#

Much obliged!

open fractal
#

this should tell you what you need to know

#

this means the command must be executed where the vehicle is local

#

which would be the server if it’s driven by server-owned ai or the driver’s machine if a player is the last one to drive it

broken forge
#

So the engineOn doesn't work with how I have it setup. I just have the hvt driving the vehicle and once a player is in range to shutoff the engine

open fractal
#

that depends where you’re running it

#

if the hvt is a player then you need to execute it on the player’s client

#

if the hvt is a server ai then you execute on the server

broken forge
#

The hvt is an AI so would it work then

open fractal
#

where are you running the code

hollow lantern
#
_acre2Group = createGroup sideLogic;
"acre_api_basicMissionSetup" createUnit [[0,0,0], _acre2Group, "this setVariable ['BIS_fnc_initModules_disableAutoActivation', true, true];this setVariable ['DefaultRadio',"""",true];this setVariable ['DefaultRadio_Two',"",true];this setVariable ['DefaultRadio_Three',"",true];this setVariable ['DefaultRadio_Four',"",true];"];```
Anyone spots any issues? This doesn't seem to work and I don't know why. No error is returned.
broken forge
#

I have a trigger that when a player is detected, to then execute the function

open fractal
#

Triggers by default call code on every machine

#

do you see the server only checkbox

broken forge
#

yep, that is checked

open fractal
#

then it will work

#

if you want a specific command or function to run on a specific client that’s where remoteExec comes in

drifting portal
#

pay attention to the effect logo in the wiki pages

drifting portal
#

or else it will just play for the dedicated server/hosting client

open fractal
#

this will execute the engineOn command with [_car,true] arguments on the client that owns _car

#

you can also do this with whole functions

#

if you want to have everyone hear a sound you do

“SoundName” remoteExec [“playSound”]

Since playSound is local effect

drifting portal
#

such as createVehicle

open fractal
#

yeah this

#

basically check the locality behavior for every command you use and adjust your code accordingly

#

you’ll have them memorized if you write enough sqf

#

one of my first experiences with SQF was putting playSound3D in a trigger without checking server only. playSound3D is global attribute/global effect so the sound played 7 times simultaneously (once for every client) and it sounded horrible

fair drum
elfin comet
#

I'm trying to run some code on all groups on OPFOR. Would this be good syntax?

{
    if (side _x == opfor) then {
        //code to run
    };
} forEach allGroups;```
open fractal
#

should be

drifting portal
fair drum
#

i think weapon holders may show up on entities, not sure though

drifting portal
fair drum
drifting portal
#

but

#

I'm using entities "#slop"

#

it doesn't return blood drops

granite sky
#

entities does seem to include WeaponHolderSimulated (but not WeaponHolder)

#

so yeah, entities "WeaponHolderSimulated" should be the fastest method.

drifting portal
#

but what about blood drops?

#

i don't want to use allMissionObjects

granite sky
#

Don't those typically have their own garbage cleaning?

drifting portal
granite sky
#

you probably could but if they're gonna be deleted anyway after a few minutes then you may not want to.

tough parrot
#

Depends on the entity manager settings.

drifting portal
#

there is a cas pilot

#

he can easily murder 60 units in one swoop

broken forge
#

I'm trying to update the spawnHostage function to use an EH instead of sleep and been successful at showing a hint, but not when trying to get the unit to join the players group and picking up a weapon

granite sky
#

I would guess that's an issue with how you're referencing the unit?

#

joinSilent itself isn't picky about where it runs.

broken forge
#
if (!alive _shooter) exitWith {
            waitUntil {
                sleep 1;
                _nearPlayers = allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2];
                count _nearPlayers > 0;
            };

            // sleep 5.7;
            _hostage addEventHandler ["AnimDone", {
                params ["_unit", "_anim"];
                _anim = "acts_executionvictim_unbow";

                systemChat format ["%1 has finished %2.", _unit, _anim];
                _unit removeEventHandler ["AnimDone", 0];
                [_unit] joinSilent group (_nearPlayers select 0);
                _unit addWeaponGlobal _hgun;
                _unit addMagazines _hgunMags;
                _unit enableAIFeatures ["MOVE", true];
                _unit setCaptive false;
            }];

            _hostage playMove "acts_executionvictim_unbow";

            { _shooter removeWeapon _x } forEach weapons _shooter;
            { _shooter removeMagazine _x } forEach magazines _shooter;
        };
granite sky
#

Yeah so the trouble is that _nearPlayers (and _hgun etc) don't exist inside the EH.

tough parrot
drifting portal
drifting portal
granite sky
#

You realise perf will probably go up when 60 guys get murdered anyway :P

drifting portal
granite sky
#

@broken forge You'd need to make those vars accessible within the EH, for example by using setVariable on the unit.

broken forge
#

@granite sky So how would I pass the hgun, hgunMags, to the EH? I already have them at the top of the function, do I need to make them global for the EH to find them?

granite sky
#

Globals would also work but less-then-ideal.

broken forge
#

So what would a setVariable look like for the loadout: ```sqf
_ld0 = getUnitLoadout _shooter;
_hgun = _ld0 select 2 select 0;
_hgunMags = _ld0 select 2 select 4;

tough parrot
#

Look at Attributes -> Performance -> Garbage Collection in editor.

granite sky
#

Example:

_hostage setVariable ["nearPlayer", _nearPlayers select 0];
_hostage setVariable ["handgun", _hgun];
_hostage setVariable ["handgunMags", _hgunmags];
#

And then in the EH you can do private _nearPlayer = _unit getVariable "nearPlayer" for example.

tough parrot
#

@drifting portal I would have to assume blood get culled with the bodies, but you can also test it with a script that spams units and instantly kills them... see what happens when the limit is passed.

granite sky
#

slightly fancier way:

_hostage setVariable ["hostageVars", [_nearPlayers select 0, _hgun, _hgunmags]];

then in EH:

(_unit getVariable "hostageVars") params ["_nearPlayer", "_hgun", "_mags"];
broken forge
#

The AI isn't joining the group

drifting portal
#

thats what I have noticed

#

they take like 4 minutes

#

but when limit is passed they are immediately deleted

#

so good I guess

#

limit is about 200 units

broken forge
#
_hostage addEventHandler ["AnimDone", {
                params ["_unit", "_anim"];
                _anim = "acts_executionvictim_unbow";

                systemChat format ["%1 has finished %2.", _unit, _anim];

                (_unit getVariable "hostageVars") params ["_nearPlayer", "_hgun", "_hgunMags"];

                [_unit] joinSilent (group _nearPlayer);
                _unit addWeaponGlobal _hgun;
                _unit addMagazines _hgunMags;
                _unit enableAIFeature ["MOVE", true];
                _unit setCaptive false;

                _unit removeEventHandler ["AnimDone", 0];
            }];
open fractal
broken forge
#

@open fractal How would I go about that, would I just add this == ?

open fractal
#

yeah that would return a Boolean, you then want to incorporate it into an if () then {} statement

broken forge
#

if (_anim == "acts_executionvictim_unbow") then {}

granite sky
#

well, != plus exitWith would be cleaner.

broken forge
#

Just changed that, so what would be causing the issue of the AI not joining the group, he does everything else.

granite sky
#

Including the gun?

broken forge
#

yep

wary python
#

I am trying to use serverCommand via script to automatically kick or ban on dedicated server.

"password" serverCommand format ["#kick %1","Ceee"]; //works

but i cannot get the banning to work. Can anyone help me out with this?

"password" serverCommand format ["#exec ban %1","Ceee"];  //does not work
open fractal
#

have you made sure that variable is properly passing a player unit

tough parrot
open fractal
#
systemChat format ["_nearPlayer: %1", [_nearPlayer, "nil"] select (isNil "_nearPlayer")];

@broken forge toss this in there if you haven't already debugged it

drifting portal
broken forge
#

@open fractal it returned _nearPlayer: nil

open fractal
#

nothing is being passed as _nearPlayer then

#

so either you didn't setVariable correctly or give inAreaArray the correct parameters

#

you can use systemChat or diag_log to see where the issue is happening

broken forge
#

This is what I have at the very top of the function: ```sqf
params ["_hostage", "_shooter", "_time"];
private _nearPlayers = [];

_ld0 = getUnitLoadout _shooter;
_hgun = _ld0 select 2 select 0;
_hgunMags = _ld0 select 2 select 4;

_hostage setVariable ["hostageVars", [_nearPlayers select 0, _hgun, _hgunMags, _shooter]];

Here's a link to the full code: https://pastebin.com/WqUhfWS2
open fractal
#

you're setting the hostageVars variable before actually defining the arguments

#

put ```sqf
_hostage setVariable ["hostageVars", [_nearPlayers select 0, _hgun, _hgunMags, _shooter]];

right above addEventHandler
broken forge
#

it seems to be working now, but still saying nil for the return, nevermind I had to move the systemChat format down below the ```sqf
(_unit getVariable "hostageVars") params ["_nearPlayer", "_hgun", "_hgunMags", "_shooter"];

lapis ivy
#

Hello. I have one problem. My project uses a ticket system with players respawning. I would like to make a good protection against relogs, since when leaving the lobby and entering the server, the respawn time counter is reset. Now I have a banal system, and a very aggressive one:

Description.ext

onPauseScript = "antirelog.sqf";

antirelog.sqf

if (!alive player) then  {((findDisplay 49) displayctrl 104) ctrlEnable false;};

I forcibly disable the "cancel" button at the time of respawn, but I use ACE and at the moment of unconsciousness of the unit, you can press another button called "abort".

I have two options: aggressively prohibit pressing the "abort" button as well (I don't know how to do this), and the second: I need help, who could help me so that when I leave the server at the time of the respawn timer, the server remembers the time player, and when entering the slot (even to another one), he could not appear and the timer was resumed for this particular player.

#

I would like the second option.

#

If it's not difficult, can someone help me with this?

lapis ivy
#

It turns out that I have to somehow remember the time left before the respawn for the player?

#

Use PlayerDisconnected first?

modern meteor
#

Hey guys, how would I attach a laser to the rifle of a squad AI?

open fractal
modern meteor
#

the actual attachment

lapis ivy
#

Can I change the value of respawnOnStart already in the mission after the freeze time?

#

I need to change from -1 to 0, but already in a running mission.

little raptor
modern meteor
#

But they can turn on the laser in combat mode?

little raptor
#

yes

whole light
#

Is it possible to create Zeus modules and assign sub-modules entirely by script? I am trying to make an RTS interface based on Zeus that requires no editor setup (activated through a dialog in-game). I can create the ModuleCurator_F entity and then add player-side groups by script. However, when I do _module setVariable["addons",0];, it still gives the option to create groups and objects under the Create menu. Also, I am spawning in ModuleCuratorSetAttributesObject_F and other sub-modules, then trying to link them with _module setVariable["curator",_curator]; (where _curator is the spawned ModuleCurator_F entity). However, this does not work, the values I assign to the sub-modules do not take effect. When I replicate all of this with modules placed in the editor, I can get the result I desire (Zeus as an RTS interface, with the ability to modify stance, speed etc, but not damage/deletion).

My questions:

  1. Is it possible to create Zeus modules and assign sub-modules entirely by script?
  2. Is there a way to limit edit ability without spawning the sub-modules (for example, disabling the Create menu entirely or assigning variables to groups instead)?
modern meteor
#

Ok great. Can I also use lasers from other Addams?

#

Addons

little raptor
#

yes

modern meteor
#

Sorry iphone correction

open fractal
#

you can add any weapon attachment

modern meteor
#

Thanks guys

#

I give it a try

little raptor
#

However, this does not work, the values I assign to the sub-modules do not take effect
make sure you execute the code in unscheduled environment

#

also better use the other syntax of createUnit to create modules

modern meteor
#

Do I need to remove an existing item in the weapon slot first before attaching the laser. Let’s say I have a light attachment in the slot. Or does it just override?

modern meteor
#

Thank you Leopard

open fractal
#

yeah it overrides

#

i've done it for flashlights

modern meteor
#

Great, thank you

whole light
# little raptor yes

Thank you, the core module is working fine now. I am still having trouble linking the spawned sub-modules. In the spawn script, after I spawn the core module, I use this code to get the string to apply to other modules:
_m=(units _group)select 0; private _curator=str _m;
Then as I spawn each sub-module I use this code:
_m setVariable["curator",_curator];
It doesn't seem to link the modules though. Any ideas? I can post the whole .sqf if need be.

little raptor
#

_m setVariable["curator",_curator];
where did you get this variable?

#

is that even used by the module?

tough abyss
#

Not sure if this is the right place to put this, but if anyone has any experience with setting up servers would be interested in assisting me, i would greatly appreciate it

whole light
#

I assumed that the curator variable is what ties them all together.

little raptor
little raptor
whole light
finite bone
#

Consider the below snippet: ```sqf
_mystring = "Land_OfficeCabinet_01_F,Land_ArmChair_01_F,OfficeTable_01_old_F"; // this will be generated or manually entered by user (without spaces with commas)
_myarray = _mystring splitString ",";

Now, when I try to spawn an object using the classname from ``_myarray`` it also includes the ``,`` with the classname resulting in: ```
Cannot create non-ai vehicle  Land_OfficeCabinet_01_F,``` How'd I fix this?
#

I thought the splitString will remove the , from the string before adding it to the array

granite sky
#

It does. The error probably isn't where you think it is.

finite bone
shadow sapphire
#
Grv_i=0;
{
    {
        _equip = _x spawn ASG_FNC_RLIGear;
        waituntil {scriptDone _equip};
        _x addEventHandler ["Killed", {
            //add to deadpool (select Grv_i append _x)
            All_Grvs select Grv_i append [_x];
        }];
    Grv_i = Grv_i+1;
    } foreach units _x;
} foreach [RD11];

Why isn't this working (Specifically "All_Grvs select Grv_i append [_x];")?
Getting: Error zero divisor
All_Grvs = Grave (2D Array of units)
RD11 = type Group

granite sky
#

If it's supposed to use a different index (Grv_i) value for each unit then it's not going to work as intended.

#

Also _x doesn't exist inside that event handler.

shadow sapphire
#

Grv_i is to represent an Array of "dead" units in the Array All_Grvs

#

I think my problem is the scope of _x as you mention

#

The goal is to add the "dead" unit to a "grave" Array in order to be respawned later

orchid stone
#

according to the wiki, you have the following params available in this EH

this addEventHandler ["Killed", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
}];

if you just want to append the unit to the dead units array, just do

this addEventHandler ["Killed", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  All_Grvs pushBack _unit
}];
#

Grv_i is a global variable in your code

#

and it's always going to equal the number of units in your group (it looks like)

#

although you're going to end up with an array of objnulls

#

so im actually a bit confused on the usefulness of that array

tired spear
broken forge
#

I'm having some problems with my tasks not working correctly for a demo in multiplayer. I have a parent task to Find and Rescue a Hostage which has three child tasks to be completed for the parent task to succeed.
1.) Download intel from a laptop
2.) Rescue the hostage before time runs out
3.) Escort the hostage to safety.

The first task succeeds when my hackLaptop function completes and set a global variable hackComplete = true. So in the trigger I have Condition: hackComplete and then On Activated: [params] remoteExec ["jas92_fnc_spawnHostage"];

Which does spawn my function, but it doesn't set the task to succeeded. Then the next task never shows up, it's just skipped to the last task which is to Escort the hostage to safety. Once the hostage is at the waypoint this task succeeds and the parent task succeeds as well. But I don't see the other two tasks listed.

Now if I were to host the mission myself all the tasks show up and complete like intended. So what would be causing the issue(s) stated above? Here's a link to my function: https://pastebin.com/LwDED2yc

From what I understand the first task fails at checking if hackComplete is true

pulsar bluff
#

so player can hear VoN while tabbed out of game. are there any sounds that can be heard out of game as well?

open fractal
#

I don't see anything in that function related to the task framework

#

also is the trigger set to server only?

broken forge
#

The function is called via addAction on the laptop. Then each child task has a create task, task state, and trigger synced, none of the triggers are server only.

open fractal
#

why are you using remoteExec in a global trigger

broken forge
#

The function that is being called has two AI that start playing an animatoin

open fractal
#

?

broken forge
#

From what I understand if there's an animation being played in a multiplayer environment, you have to use remoteExec, I could be wrong though

open fractal
#

afaik there's no command that always requires remoteExec

#

commands like switchMove and playMove take a local attribute, so you have to execute on the server for server ai*

broken forge
#

So I can just use a [] spawn functionName?

open fractal
#

yes

#

that will spawn your function on every machine

#

which includes the server

broken forge
#

ok, I'll change it, for the first task trigger it is setup as followed. Condition: hackComplete
On Activation: [params] spawn jas92_fnc_spawnHostage;

#

This trigger is then synced to a succeeded task state, which is synced to the task. The trigger is also synced to the next child task

open fractal
#

I'm not sure what the issue may be with the tasks, but to go with your hypothesis about the variable try adding publicVariable "hackComplete"; to your function

#

that will set hackComplete to true on every machine

#

given that it's being set to true for just the client

#

you can just throw that line in after the variable is set

broken forge
#

Thanks again, that fixed it

shadow canopy
# little raptor <@457504976441180183>

Oh cool, just got back lol. thanks I will take a look at this. I suppose there wouldn't be a way to suggest a new command for arma to be able to get the object of a units weapon for version 2.11+ lol.

shadow sapphire
#

Anyone have any ideas on this block?:

/* RESPAWN ALL SIDES UNITS ON ANY SECTOR CAPTURE */

{
    _unitType = typeOf _x;
    _unitNew = createVehicle [_unitType, (getPos RRPD), [], 0, "CAN_COLLIDE"]; // recreate the unit.
    [_unitNew] join RD11;

} foreach All_Grvs;

//Clear Grvs array
//All_Grvs deleteRange [0, ((count All_Grvs) -1)];
All_Grvs = [];
PublicVariable "All_Grvs";

All_Grvs is an Array of unit type objects.
Adding to and clearing the Array functioning fine.
But failing on call to typeOf:
"Error units: Type Array, expected Object,Side,Group"

orchid stone
#

Couldn't find a good ambient search light script that didn't run in some unscheduled forever loop and generate a ton of traffic... so i attached a spotlight to a dying VR soldiers head, and hid the model... just in case anyone needs a good face palm...

#include "script_component.hpp"
if (!isServer) exitWith {};

private _logic = param [0, objNull];

_logic spawn {
    _this setDir random 360;
    _light = createSimpleObject ["A3\data_f\VolumeLight_searchLight.p3d", getpos _this, true];  
    _fakeanimsoldier = "C_Soldier_VR_F" createVehicle getPos _this; 
    _fakeanimsoldier isDamageAllowed false;
    _fakeanimsoldier isStaminaEnabled false;
    hideObject _fakeanimsoldier; 
    sleep random[3,4,7];
    _fakeanimsoldier switchmove "AinvPpneMstpSrasWpstDnon_G01";
    _fakeanimsoldier setAnimSpeedCoef 0.5;
    _fakeanimsoldier attachTo [_this,[0,0,0]]; 
    _fakeanimsoldier disableAI "ALL"; 
    _fakeanimsoldier enableAI "ANIM";  
    _light attachTo [_fakeanimsoldier,[0,0,0],"head",true]; 
};
steel fox
shadow sapphire
#

Initial declaration:

All_Grvs = []; // Array of dead units.
PublicVariable "All_Grvs";

Append Array, where RD11 is a Group

{
    {
        _equip = _x spawn ASG_FNC_RLIGear;
        waituntil {scriptDone _equip};
            _x addEventHandler ["Killed", {
                //add to deadpool;
                //select Grv_i append _x
                All_Grvs pushBack _this;
                PublicVariable "All_Grvs";
            }
        ];
    } foreach units _x;
    Player HCSetGroup [_x,""];
} foreach [RD11];
steel fox
#

You are adding the _this array of arguments to All_Grvs. Why not just only the new body?

shadow sapphire
#

The new body?

loud lodge
steel fox
#

Don't see why you are storing all arguments of the EH for just a respawn script.

loud lodge
#

Thank you for your help, we will review this. We were under the impression that in the context _this would be of type unit. The point was to keep the unit calling the EH in an Array.

orchid stone
#

_this is an array of params

steel fox
#

No _this is just the argument array. It is so in all contexts.

orchid stone
#

i sent some code earlier

#
this addEventHandler ["Killed", {
  params ["_unit", "_killer", "_instigator", "_useEffects"];
  All_Grvs pushBack _unit
}];

you can get the unit loadout using getUnitLoadout as well

#

so if you just want the unit loadout, try getUnitLoadout _unit

#

and then the inverse, you can use setUnitLoadout

loud lodge
#

Aaaaah I see now, we just reference with _unit instead of _this

steel fox
#

No. No.

loud lodge
#

Great to know about getUnitLoadout!

steel fox
#

Index the _this array and get the _unit reference. Either with params or select

fair drum
#
[apple, pear, orange] call {
  _this select 0; //apple
  _this select 1; //pear
  _this select 2; //orange
};

[apple, pear, orange] call {
  params ["_apple", "_pear", "_orange"];
  _apple;
  _pear;
  _orange;
};
loud lodge
#

Got it, thanks everyone!

steel fox
fair drum
orchid stone
#

i missed the edit, but i dont understand why you want him to index it instead of parsing that arguments using params

#

oh nvm, i missed the second part

#

you didnt say that, i misread

drifting portal
#

Is it possible to pull out the animation's length using condig?

#

If you have the string name of the animation obviously

fair drum
#

well take a look at the config for anything that resembles the duration 😉

drifting portal
#

thats why I asked

#

I will admit thou that I'm sleepy

#

So i will check again

steel fox
#

You can get the speed but without knowing the amount of frames in the animation (Which I don't think you can get from config) it is not possible.

drifting portal
#

Just the length in seconds is not possible??

#

Weird

steel fox
#

What are you trying to do?

#

Maybe just time it with the animationFinish EH? On a dumb unit then save the result?

drifting portal
#

make a function that seamlessly switches between animations

steel fox
#

Use the animationDone or what it is called EH?

#

No need to time then.

drifting portal
#

AnimDone

steel fox
#

If it's that then that yeah.

drifting portal
#

sadly I can't input arguments into it

#

except if I use setvariable

steel fox
#

Just use the unit itself as the nameSpace with setVariable?

drifting portal
#

yep

steel fox
#

Seems a lot cleaner then trying to time an animation.

drifting portal
#

well

#

since we are here

#

there is still not a possible way to play a gesture?

drifting portal
drifting portal
#

another problem arises

#

playmove barely plays any animation

open fractal
#

switchMove?

drifting portal
#

and if I used playswitch which plays most animations, it will not trigger the EH you mentioned

open fractal
#

you can use the event handler to make a whole sequence

#

with switchMove

little raptor
#

It's not an object

#

It's a proxy

#

You can't do anything with it, so even if the game returned it to you it's useless

open fractal
#
switch _anim do {
case "anim1": {_unit switchMove "anim2"};
case "anim2": {_unit switchMove "anim3"};
little raptor
#

You can't "make a sequence" with it

drifting portal
#

that's what I said

open fractal
#

I thought it did

drifting portal
#

nope

open fractal
#

I'll have to check one of my scripts

little raptor
drifting portal
#

in what sequence if I may know

#

oh

#

just saw your comment

#

lol

#

_unit switchMove _move; _unit playMoveNow _move;

little raptor
#

If you know what those command do it's fairly obvious

drifting portal
#

would this work

#

for animations

#

that won't work for playmove?

little raptor
#

Yes

drifting portal
#

like "Acts_welcomeOnHUB04_AIWalk_5"

drifting portal
#

_unit switchMove _move; _unit playMoveNow _move;

little raptor
#

Yes

drifting portal
#

lets try

#

why does this work tho

#

so

#

I think

#

the playmove

#

doesn't play

#

but just have the same delay

#

as the animation

#

correct?

#

so it is not running the animation, but its still running its "length"

little raptor
little raptor
#

Just try it first

drifting portal
#

i was just wondering

#

why does this work

drifting portal
little raptor
#

Because animation system uses paths

#

If two anims are not connected with paths you can't use playMoveNow or playMove

drifting portal
#

makes sense

little raptor
#

You have to jump to that node first

drifting portal
#

smooth transition

#

yes

#

it will just do nothing because there is no transition

#

but I don't think

#

i can make the script unscheduled

#

because i'm running a loop that runs a number of scripts in an array

#

foreach

little raptor
#

Not all of it

drifting portal
#
isNil {_unit switchMove _x; _unit playMoveNow _x;};
little raptor
#

Yes

drifting portal
#

good stuff thanks

little raptor
#

In config

#

That's the inverse of length

#

Or if negative the negated length

copper imp
#
[blufor, getPos thisTrigger, "FOB"] call BIS_fnc_addRespawnPosition

Can anyone help me with this, it's supposed to create a respawn on a trigger when activated for blufor, but it's not currently functioning

drifting portal
open fractal
#
systemChat format ["%1 Fired!",thisTrigger];

or diag_log if you working from the rpt

drifting portal
#

is there a way to know if paths are connected for two animations?

#

maybe through comparing config? or is there a command?

little raptor
little raptor
#

If you do playMoveNow but the other animation doesn't play (it's not immediate tho) they're not connected

drifting portal
#

and I don't think there is a way to detected if animation is not played right?

little raptor
#

Yes

drifting portal
#

basically trying

#

to detect

#

if playmove works or not

#

if it doesn't

#

switch to leopard's solution

velvet merlin
#

is attachTo considered bad for MP network traffic or performance/fps?

drifting portal
#

A general rule would be, if you just want the attached object for the looks and not to be interacted with (or basically simulated in any form) , then make the attached object a simple object

robust brook
velvet merlin
#

thanks both of you. still looking for some more concrete insight

drifting portal
little raptor
#

Because attachTo moves/updates the object every frame

#

And doesn't let the game optimize out "non-updated" objects

drifting portal
#

well how severe is it

little raptor
#

¯\_(ツ)_/¯

drifting portal
#

yeah it seems only dedmen knows

little raptor
#

It's most likely worse than placing an AI

drowsy geyser
#

i guess BIS_fnc_attachToRelative is the same?

drifting portal
#

yes

little raptor
#

It's a wrapper for attachTo

drifting portal
#

it just changes one of the behaviours associated with using attachto

drowsy geyser
#

is there any alternative to attachTo command?

little raptor
#

Depends what you mean by "alternative"

drifting portal
#

honestly from experience its not that bad

little raptor
#

If you don't need something to be attached just don't attach it

drifting portal
#

and if you don't need it simulated , make it a simple object

#

and if you attach to vehicles, add MPKilled or Killed event handler based on your usage case, so you can use it to delete all attached objects to a dead vehicle

little raptor
drifting portal
#

i only attach 3 simple objects at most

little raptor
#

Well you most likely won't notice anything with that many objs yes

drifting portal
#

yes

#

its the same as using while {true}, goes back to how much you care about optimisation

#

if you want to brick your game, its up to you lol

drowsy geyser
#

ill test with and without attachTo i want to see the FPS difference

drifting portal
# little raptor No. It's not

Maybe I didn't elaborate, basically I'm saying that if you use while{true} with no delay, you know your game will be bricked, same for attaching lots of objects without them being simple objects and being in rational numbers

little raptor
drifting portal
little raptor
#

If it's scheduled it's always around 3ms

drifting portal
#

unscheduled

little raptor
#

Unless a single command exceeds it

drifting portal
#

is what I'm speaking

little raptor
#

Which has nothing to do with while anyway

little raptor
tough abyss
#

Hello, I have a question regarding remoteExec statement.
Last year, I had issues to send huge data from server to a specific player.

For instance, I can pass a long string of 2k characters or an array of 4 dimensions with 100 entries (don't ask me why, this is for the exemple)
But I noticed that Arma could drop that kind of request or trim it.
(Extra question: if I pass a huge hashmap, will it be the case too?)

It is the case nowadays with the 2.0+ update?
What do you recommand me to do in order to send properly a huge amount of data over the network?
(As I read in the docs, publicVariable is not recommanded and remoteExec should be prefered)

pulsar bluff
#

you should be able to design so you dont have to send huge data

tough abyss
#

If I can't do otherwise, you advice me to split it in multiple parts?

pulsar bluff
#

what are you sending

tough abyss
#

By the way what is the limit of data we can pass in remoteExec ?

#

Data gathered from the database, for instance a collection of vehicles the player owns

#

And I had some cases where a player could own 200 vehicles ...

pulsar bluff
#

you could use setVariable instead of remoteExec

tough abyss
#

you advice me to set a variable over an object instead of broadcasting it directly to the client?

#

are you sure it is really efficient

#

moreover setVariable broadcast it to all players, this is insanely wrong

#

I see you can set it to an unique machine but man, I think remoteExec > setVariable

little raptor
tough abyss
little raptor
#

doesn't matter from who to whom

tough abyss
#

My goal is to send data from server to a specific player

little raptor
#

then do setVariable

tough abyss
#

But why would it be better than remoteExec ?

pulsar bluff
#
_database_result = ... callExtension ...
missionNamespace setVariable ['DB_playerVehicleData',_database_result,(owner _unit)];        // propagate the data to that client only
missionNamespace setVariable ['DB_playerVehicleData',nil];                                    // nil the var locally on server after propagation
_database_result = nil;

// CLIENT
if (!isNil (missionNamespace getVariable ['DB_playerVehicleData',nil])) then {
    _playerVehicleData = missionNamespace getVariable ['DB_playerVehicleData',nil];
    missionNamespace setVariable ['DB_playerVehicleData',nil];                    // nil the var locally on client after data received and sent to private variable\
};```
little raptor
#

you can for example do:

[my_huge_array, {my_huge_array = _this}] remoteExec ["call", client]
#

but what's the point? blobdoggoshruggoogly

tough abyss
#

Yeah I understand

pulsar bluff
#

could also send just numbers/scalar and have a function on client to interpret the incoming data

tough abyss
#

Yeah I will pass huge data through setVariable and will notify client how to deal with it through a remoteExec

#

or maybe I just can make an EVH on the setVariable?

little raptor
pulsar bluff
#

if ((_playerVehicleData # 5) isequalto 4) then { // vehicle is an SUV };

tough abyss
pulsar bluff
#

so you are just sending an array of mostly numbers and client is reconstructing the data from that

tough abyss
pulsar bluff
#

if your arrays of numbers are too huge then that indicates design problems, like why is the player allowed to own 200 vehicles

tough abyss
#

which is not that simple

#

it is not an array of numbers

#

it is an array of multiple dimensions with mixed data types inside

#

more precisely a hasmap nowadays, but it used to be an array last year

tough abyss
pulsar bluff
#

even things like classname are unnecessary. use a client-side lookup table to store classname as a scalar

#

so server sends the key and the value is stored locally

tough abyss
#

this is what I do at the client first spawn

tough abyss
modern meteor
#

Hi, the code below adds a laser to the AI primary weapon and activates it. It works perfectly fine if the AI uses an AR (like a HK rifle) but if it uses a sniper rife it seems that the attachment does not get replaced. Any idea why?

    _x addPrimaryWeaponItem "tier1_rahg_ngal_m300c_black_fl";
    _x enableIRLasers false;

     hint "Laser Off";
}
else {
    _x addPrimaryWeaponItem "tier1_rahg_ngal_m300c_black";
    _x enableIRLasers true;

    hint "Laser On";

}
}
forEach units group player;
#

So basically the sniper AI does not turn on the laser. For the other AI it works fine.

little raptor
#

the attachment does not get replaced
is the attachment even compatible?

modern meteor
#

yes and yes

#

they do support lasers

#

if i attach a laser on the rifle initially it works fine

#

so the issue that the laser does not get attached to the sniper rifle

pulsar bluff
modern meteor
#

For assault rifles it works though

#

Not sure why

little raptor
modern meteor
#

but i can attach it in the editor

#

and use it on the unit

little raptor
#

are you sure it's the same attachment with the exact same classname?

modern meteor
#

yes

#

100%

tough abyss
pulsar bluff
#

a simple array works too, but yes

tough abyss
#

do you have an exemple of a "hash" function that can do that efficiently?

pulsar bluff
#

send only keys in number/scalar form, client interprets and replaces with associated values

tough abyss
#

it means I have to "hash" the content of CfgVehicles entries at the game init for instance?

little raptor
pulsar bluff
#

no, there are only a few dozen vehicles in arma

little raptor
#

because numbers in sqf are floats

#

hash functions are not accurate enough

tough abyss
#

I am working on a modded version of the game, there are plenty of vehicles

pulsar bluff
#

more than a few dozen?

modern meteor
#

But I could try to add a different attachment to the sniper unit. I just wonder how I have to alter the code so that it changes to a different laser attachment just for the sniper.

#

?

pulsar bluff
#

[2,6,5] <----- 2 = the vehicle base class, 6 = the variant, 5 = the texture/etc

little raptor
tough abyss
#

In the modded version,
count configProperties [configFile / "CfgVehicles", "true", true]
Result : 24848
Idk in the vanilla one

little raptor
#

~9k iirc

tough abyss
#

but it doesnt mean every class is a vehicle the player can drive

pulsar bluff
#

i know there are not more than a few dozen spawnable vehicle classes

#

for a typical Life RPG garage

little raptor
tough abyss
#

And my problem is that I am not based on the Tonic framework, I do not have necessarily a config that regroups all the vehicles the player can buy at the car shop

#

or if this exists, it is a dynamic config provided by the DB and represented as a hashmap (so keys order is fucked)

pulsar bluff
#

that data isnt realistic, like it includes "I_Ejection_Seat_Plane_Fighter_03_F" and other nonsense

#

dont you have a whitelist of spawnable vehicles?

#

or can players spawn anything from config

tough abyss
#

yeah they can but it is a dynamic config

modern meteor
#

Ok, thanks Leopard. I’ll look into it.

rough summit
#

Hello everyone, how can I check if an item with the specified class is a backpack?

pulsar bluff
#

@tough abyss if i trim out just some of the duplicates (there are 17 hatchbacks for instance) im down to 259 for vanilla

#

and thats still with many reskin variants of the same asset

#

still 25+ offroad variants, when there are only 5-6 that matter + re-skins

#

i could probably get that number under 90 after trimming out re-skins, for vanilla assets

winter rose
pulsar bluff
#

including assets unlikely to be in Life RPG, like mobile artillery

tough abyss
#

what script did you use?

rough summit
#

And it wont work

#
Bag_Base
```  Work correctly, thanks for idea
granite sky
#

There is an actual isBackpack flag in CfgVehicles too, IIRC

crisp jacinth
#

Does anyone know if there is a possiblity to script an option with ACRE 2 to make a vehicles commander have a loudspeaker outside of the vehicle, like being able to broadcast over speaker or if that is an impossible Idea to execute ?

modern meteor
#

Is there a way to check if an attachment is attached to a primary weapon in an IF clause?

modern meteor
#

Or to be more precise if a muzzle attachment is attached or not?

willow hound
little raptor
#

or you can use _item in primaryWeaponItems _unit

modern meteor
#

Thank you guys, i'll give it a try.

drowsy geyser
#

is there a way to disable the activation of a trigger while a player is already inArea of that trigger?
but the trigger must stay repeatable but only useable by one player at the time.

modern meteor
#

very stupid question, what is the sign for OR in an IF clause please?

little raptor
#

or ||

modern meteor
#

thank you

drowsy geyser
modern meteor
#
    _x removePrimaryWeaponItem "rhsusf_acc_aac_762sd_silencer";
    _x removePrimaryWeaponItem "muzzle_snds_m";
     hint "Silencer off";
}
else {
    _x addPrimaryWeaponItem "rhsusf_acc_aac_762sd_silencer";
    _x addPrimaryWeaponItem "muzzle_snds_m";
    hint "Silencer on";

}
}
forEach units group player;
#

getting an error in the IF clause

#

not sure where the syntax is wrong

modern meteor
#

ah got it

winter rose
#

yep

modern meteor
#

()

#

to add

#

tk u

winter rose
#

well, you got 💡 first 😄

modern meteor
#

yea, that usually does not happen 🤓

#

hm

#

does not work as intended

winter rose
#

in check is case-sensitive

modern meteor
#

would be probably easier if I could just check for muzzle attached?: yes/no

#

but i guess that's not possible?

winter rose
#
private _itemsLC = primaryWeaponItems _x apply { toLowerANSI _x };
if (("rhsusf_acc_aac_762sd_silencer" in _itemsLC) || ("muzzle_snds_m" in _itemsLC)) then
#

so everything is lowercase and you don't convert the array twice

willow hound
modern meteor
#

instead of using _x, is there a variable which i could use for all AI squad members except the player?

modern meteor
#
    _x removePrimaryWeaponItem "rhsusf_acc_aac_762sd_silencer";
    _x removePrimaryWeaponItem "muzzle_snds_m";
     hint "Silencer off";
}
else {
    _x addPrimaryWeaponItem "rhsusf_acc_aac_762sd_silencer";
    _x addPrimaryWeaponItem "muzzle_snds_m";
    hint "Silencer on";

}
}
forEach units group player;```

For some reason it just add/removes the silencer for the unit with the attachment rhsusf_acc_aac_762sd_silencer but not for the others. Any idea why?
open fractal
#

and you can do - [thisList#0] to remove the player from the array

#

sorry I’m on mobile can’t properly write this out

modern meteor
#

just tried this but unfortunately it did not work

open fractal
#

you’re just trying to count how many units are in the group of the player that activated the trigger correct?

little raptor
#

it just means the current element that the forEach is iterating on

little raptor
#

like I've shown you several times

little raptor
open fractal
#

my bad it was someone else that had the trigger

broken forge
#

I'm having some issues with getting a trigger to fire when a player is driver of a vehicle in my multiplayer mission. veh_0 isEqualTo (isPlayer driver _x)

little raptor
#

it has nothing to do with multiplayer

broken forge
#

So something like this: alive veh_0 && {isPlayer (driver _x)}

little raptor
#

yes

broken forge
#

Ok, I was able to get it to work by using this: ```sqf
allPlayers findIf {_x in crew driver veh_0} > -1

open fractal
#

why not
(isPlayer driver veh_0)

#

that way you do t have to iterate through every player

little raptor
#

_x in crew driver veh_0
this is redundant too

#

crew driver veh_0?! meowsweats

little raptor