#arma3_scripting

1 messages · Page 582 of 1

tough abyss
#

woow that was fun had mortars drop where i used to be but now to increase the dispersion little bad when he drops 6 mortars within 5 feet of you

fading barn
#
private _radius = <number of meters of dispersion>;
private _angle = random 360;
private _distance = random _radius;
private _aimPoint = _center getPos [_distance, _angle];

Mortar1 commandArtilleryFire [_aimPoint, "8Rnd_82mm_Mo_shells", 6];```

Should be center-weighted, so most will impact near the center of the circle of radius whatever you want. Doesn't take into account terrain elevation or wind/drag if you have ACE Artillery on.
#

If you'd like to be a bit more nice, you can do
private _aimpoint = _center getPos [_radius * sqrt (1 - abs random [-1, 0, 1]), random 360]; instead of the above _aimPoint.

tough abyss
#

hmm will com back to that gotta go for now thanks for help tho

spiral fractal
#

if I want to execute moveInCargo in remoteExec what number should I set in target param?

robust hollow
#

believe it is where the unit is local

#

so, [unit,veh] remoteExec ["moveInCargo",unit];

spiral fractal
#

everything works but when I test on dedicated, its not, and idk how to debug it 😐

robust hollow
#

check ur server rpt file for errors or warnings

fading barn
#

What does the CFUNC macro do?

jaunty dock
#

Hey guys what is programming like in Arma 3? And what is mapping like too? I'm coming from garry's mod being a very competent Lua programmer

#

In comparison what's the difficulty like

still forum
#

when I use local exec I have to press it twice
Thats because the command is asynchronous/scheduled, but debug console is unscheduled.
@winter rose
it should freeze the game until the result arrives
That wouldn't work. Network messages are not processed when the game is frozen, so if it would freeze, the message would never go out and the answer would never get back.

@fading barn whatever it was defined to do. Depends on the mod. What are you talking about?

@jaunty dock
Arma scripting is very easy if you understood the concept. (almost) Everything is a command, there are 3 types of commands
command, command arg, arg command arg

jaunty dock
#

what about mapping

#

do all maps have to be big and open berth

still forum
#

Terrain making? whole other beast, nothing to do with scripting

jaunty dock
#

I am really after recreating the darkrp small map experience in arma ngl

#

Modding capabilities >>> gmod

still forum
#

You could do that without making a terrain

#

just find a flat place on some existing terrain, and place down some buildings in the editor

jaunty dock
#

can we not make entire maps ourselves

#

or is it some system

still forum
#

You can

#

But as I said thats a whole nother beast to get into. If you want to learn more about that then #arma3_terrain
But if you just want to basically build a small town, I don't see the need to make a whole terrain

jaunty dock
#

oh lovely

#

I might go ahead and buy arma then

#

what's the programming language btw?

#

Never actually looked into it

#

other htan a mere google

#

is it some weird form of xml

fading barn
#

It's a CBA/ACE macro for doing a function call of some kind, but I can't figure out what kind in particular. Looked through their documentation and found stuff like FUNC(arg) for a local (to the mod component) function EFUNC(name,arg) for an external (to the component) function in the same mod, DFUNC for global stuff, QFUNC to return the function in quotes, etc. Nothing about CFUNC.

jaunty dock
#

C-style scripting language

#

ugly

robust hollow
#
//cba
#define DOUBLES(var1,var2) var1##_##var2
#define TRIPLES(var1,var2,var3) var1##_##var2##_##var3
#define FUNC_INNER(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
#define EFUNC(var1,var2) FUNC_INNER(var1,var2)

//ace
#define CFUNC(var) EFUNC(COREMODULE,var)

?

fading barn
#

Is that in the base script_component?

fading barn
#

Thanks @robust hollow didn't think to trawl the GitHub, just went through the linked documentation from there.

robust hollow
#

👌

ocean bison
#

Hi all. I have some troubles with preprocessFile command logic. (arma2OA windows)
I have some scripts in game root directory (for development needs)
When I use preprocessFile command in game client (wia debug console) I can change code in file and reload it again and again.
So don't need reload mission to see changes in game - all is cool.
But when I try do that on dedicated server - all files a locked to writing - so I can't change sripts until server restart.
I also sight that files is locked on client when I try use command directly in mission init.sqf
I need an advice. How can I reload my scripts without restarting the server? Any way to disable file locks? Mayby better pacticle for scripts reloading? Thanks

random loom
#

You'll need to enable filepatching

#

and you cannot edit .pbo files while they're in use.

ocean bison
#

all files is unpacked. And don't see any option for arma2oaserver to specify filepatching (only -noFilePatching to disable it). And it work as should i think - but lock files to writing. thats my problem

random loom
#

I know that there's the -loadMissionToMemory parameter in Arma 3, though that doesn't appear to be the case Arma 2

#

I've also noticed that at least on Windows you cannot swap out mission files without restarting, whereas you can at least on Linux.

still forum
#

Files should not be locked when you just load them once with preprocessFile.
But in general I have seen other issues where on dedicated files are locked even if they shouldn't be, even on A3.

winter rose
#

could loadFile help?

ocean bison
#

Just tried - also locked. It may be easiest to use the extension to reload scripts in my case.

winter rose
#

yep. That or database

tough abyss
#

ok little help here if i place an ai unit in the editor what is its group name

winter rose
#

Alpha 1:1 usually

#

if you click on the leader, there is a symbol over his head - you can double-click that

tough abyss
#

so that is the group name for scripting purpouses then

winter rose
#

if you want to get a scripting reference to his group, this would be ```sqf
group _myUnit;

#

you have to either name the unit, or name the group

#

"name x" = assigning a variable name

tough abyss
#

so in its init field of group i put group _name_goes_here

winter rose
#

no.
What do you want to do? in human words

tough abyss
#

i just want to know the name of the group so i can use it for part of a script

winter rose
#

open the group properties, and in variable name, put "mySuperGroup"

this will be the reference name to this group from now on

tough abyss
#

ok

#

done

winter rose
#

yw.

tough abyss
#

will a detected by trigger not loop ?

winter rose
#

if you set it to repeated, perhaps

tough abyss
#

hmmm for some reason its not re triggering

winter rose
#

maybe it needs to not know about enemies first, before re-triggering.

tough abyss
#

ahh i see im not deactivating the trigger

spiral fractal
#

wildlife affect fps? will it help if I disable it in mission enableEnvironment [false, true];?

winter rose
#

well yes, they have to be calculated
they don't cost much in term of performance though

spiral fractal
#

Thank you!

vague geode
#

How can I save certain player information during a mission (only while the mission is running)? What I am trying to do is save players CP count when they disconnect as long as the current round of Warlords is running to be able to give them the same amount back once they reconnect for the same side so that if a player for example looses connection and then rejoins they don't loose all their CP and in extension their team doesn't. So the values I'd need to save are, the players SteamID (or some other means of clearly identifying the player), theplayerSide and a number representing the amount of CP the player had when s-/he lost connection/disconnected.

tough abyss
#

whats the script command that i would use if i wanted to have a task complete by having the player look at a location

winter rose
#

@vague geode see getPlayerUID for Steam ID

vague geode
#

@winter rose My problem (at least for now) isn't getting the values/variables but how to save and administer them. [PS: Have you gotten promoted recently?]

winter rose
#

well, either a db (if you want to avoid server restart) or a simple array of players data

#

you could also use the db* functions

#

(and yes, promoted from Veteran → Veteran Moderator)

#

@vague geode ^

spring lodge
#

You could save information to the players profile

winter rose
#

not recommended, prone to player's edition

vague geode
#

@winter rose Congratulations on your promotion. Can you tell me more in depth how to do it with databases? Also where would I initilize said array?

winter rose
#

I don't know. I only know that extdb2 or 3 are used solutions for Arma permanent servers

tough abyss
#

ha ha from scratch i just made my own little script, I mean this script probably exists already, but still no tutorials, no help and it works XD

winter rose
#

Welcome to the wonderful world of scripting… there is no exit

tough abyss
#

I shall call it the recon script cansee=[objNull, "VIEW"] checkVisibility [eyePos player, eyePos unit1]; if(cansee==1) then {true};

cunning crown
#

You could save them server-side (something like missionNamespace setVariable ["%PlayerID_CP", 0, ...] and then send that to the client if it reconnects

winter rose
#

your code returns true or nil @tough abyss

([objNull, "VIEW"] checkVisibility [eyePos player, eyePos unit1]) == 1 // returns true or false
tough abyss
#

hmm me no understand all i know is it worked when i tested it

umbral nimbus
#

Working on a script to export activity in a mission, into Tacview. Great progress so far

winter rose
#

Simply place your description with your link @umbral nimbus.

umbral nimbus
#

done

#

So far performance impact is minimal to neglactable.
A recording like this is 35 Kb.

2 hours of play will be as much as 12Mb.

#

24Mb when you double the units

steel star
#

Is there a place to start if i want to get into scripting as I've got a lot of experience in Zeus and Eden but i want to progress?

winter rose
steel star
#

@winter rose Thanks!

acoustic abyss
#

@steel star KillZoneKid's blog also has a few in depth posts on things like variables that are broadly useful.

steel star
#

Yeah i had a look at it i don't think I'm smart enough for scripting aha thanks anyway though

winter rose
#

with that (each day a bit) you are very fine. and of course, practice makes it perfect!

acoustic abyss
#

@steel star Speaking for myself (still a beginner!), an unstructured approach could be more exciting (and frustrating). Everybody's different. What led me down the rabbit hole was mixing and matching things the player could do to make new gameplay.

For instance: an alarm that trips (trigger) and plays a sound (adding sound description.ext) and activates enemies, that can be deactivated by a switch (addaction) or destruction (trigger).

Placing (and making!) image textures on walls.

Adding a punishment for certain player actions (eventhandler or trigger).

You can do most of these things with the editor modules and one line of code in some init. Then gradually transition to writing more steps into standalone script files.

Read what other people write in this channel. Google your idea with "Arma" and "how" in the keywords. Take apart other people's scripts. You can also ask specific questions here.

winter rose
#

I can only be pushing in the same direction, "baby step" objectives, and taking other people's scripts apart (and not stealing them, of course)
This is how I learnt the most 🙂 eighteen many years ago

signal kite
winter rose
#

spawn chances of grass patches for example

tough abyss
#

gods i wish there was a key bind to have you character push the grass in front of him down flat, every blade of grass on Altis is the right height to obscure your vision after 20ft if your not on a decent elevation or another stance between prone and high prone that lets you emu poke your head like 3 inches higher

radiant spindle
#

Hey people, need some help with a little issue. I'm executing this function https://pastebin.com/kGUqg81u on a unit. It basically unequips everything it has and then adds the items I specify on another script, everything works fine but my problem is, when I start the game I can't use the vanilla cycle through grenades. I can however use the ACE grenade throw system. Anybody knows why that might be? maybe something got changed since that function was made.

#

If I remove the grenades from my inventory and pick them up again they work just fine

winter rose
#
  #include "autoEquip.sqf"
```_holy molly…_
#

@radiant spindle maybe try to addMagazine handgrenades instead of addItem?

#
(uniformContainer _unit) addItemCargoGlobal ...
``` `addItemToUniform`/`addItemToVest`
radiant spindle
#

Ok for some reason testing the mission in MP works just fine, either way

#
  #include "autoEquip.sqf"
```_holy molly…_

@winter rose What's wrong with that btw? 😅

winter rose
#

it's awful?

#

either make one file, or make another function that returns the loadout but don't do that ^^"""

radiant spindle
#

The thing is I'm not executing the function directly, I'm using a preInit declared in description.ext
class Extended_PreInit_EventHandlers { autoEquip_preInit = "call compile preprocessFileLineNumbers 'scripts\autoEquip\autoEquip_preInit.sqf'"; };

#

When I made the function I was told this was the better way, maybe that was not the case then 😅

winter rose
#

one of you deserves a paddlin', decide quickly whom 😄

radiant spindle
#

Probably both

#

Thanks for the help! I'll try and optimize this thing

winter rose
#

first thing first, make it work properly
cleaning up is when everything is in place

radiant spindle
#

I mean it seems to work in MP, it always did as far as I remember, it's just now I noticed SP testing had these issues and I'm not sure why, I'll investigate some more

light moat
#

Hey, so I see a lot of cool stuff in old man, would something like the checkpoints work in an MP environment?

And is there any forum where I can see any scripting to make stuff like that possible?

winter rose
#

the official forums are open yes, as well as the wiki

light moat
#

Thank you!

fleet bear
#

Hello! Is it possible to use diag_activeSQFScripts to find and terminate a script execVMed from a specific filename?

winter rose
#

nope!

#

grab the handle or it is lost forever

fleet bear
#

Understood, thanks)

potent dirge
#

Evening folks.
Is there anyway to make the FIA hostile to the AAF, but allow both to be hostile to OPFOR and friendly to BLUFOR. I feel like there's a simple way to do it and I'm missing something

#

Or even better switch the side of a faction entirely other than using the sqf [_unit] joinSilent createGroup [_side]; trick for each and every unit

potent dirge
#

For a little context, I'm trying to make a mission where the player's relations with each faction can vary but the relations between the factions is always constant

potent dirge
#

I think I've been able to simplify the problem by making FIA BLU and AAF IND, now I only need to figure out how to change relations for only one faction of a side

fading barn
#

@potent dirge

potent dirge
#

Thanks, but I've read through the wiki severally. I think the functionality I'm trying to create isn't available in Arma or at least not sqf.

#

I'm trying to edit relations at the faction level not at the side level

fading barn
#

I see. Not sure there's an easy way to do that.

potent dirge
#

Another workaround I was thinking of is making FIA as IND then giving them negative rating that way AAF will attack them, but then I will need to make NATO friendly with them at the same time.

fading barn
#

Possibly you could use the sideEnemy and use setFriend to make them friendly with BLUFOR

#

That might just break stuff, also.

potent dirge
#

That might just work.

#

I'll report back once I try it

#

Hmm, sideEnemy is enemy of sideEnemy

#

Damn sideEnemy

sage flume
#

I want to use a particular ammo crate to spawn at a location but I want it to be empty,...as is, it is full. I thought at one time years ago I wanted this but forgot, (old brain)

#

Search only shows how to fill one

glass zinc
#

Hi, does anyone know how to remove terrain obects that cannot be found with a search or count function?

if (worldName isEqualTo "Tanoa") then { {    
if (    
(toLower(str _x) find "signtc_23_2.p3d") >= 0 ||    
{(toLower(str _x) find "b_cycas_f.p3d") >= 0} ||      
{(toLower(str _x) find "timberpile_01_f.p3d") >= 0}   
) then {_x hideObjectGlobal true; _x enableSimulationGlobal false;}    
} foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE"], worldSize]); 
};

I use this script to normally remove broken objects from map, but the objects I am trying to remove now are not findable with nearestTerrainObjects, I can find time with cursorobject, but they will not show up with nearestTerrainObjects. so when this function runs it cant find them to count them. thus they are uncountable.

does anyone know a alternate means to remove the objects from the entire map that does not rely on them being counted first?

Also FYI i can still global remove all objects from the map, but cannot seem to isolate these specific objects for removal.
374559: t_ficus_medium_f.p3d

potent dirge
#

@sage flume have you tried ```sqf
clearItemCargoGlobal _ammoCrate

#

bruh what did you just make me watch

fading barn
#

It's either a spambot or an idiot. It's posted in pretty much every channel.

potent dirge
#

I have this crazy idea. Maybe I can make FIA side BLU, AAF side IND, then make NATO side CIV, BLU would be hostile to IND, and vice versa and both will be friendly to CIV

#

It could probably break a lot of things since there are also regular civilians as well

#

I might just refrain from doing it out of shame, if someone like Lou Montana finds it

#

or what if I used sideEnemy then made sideEnemy friendly to sideEnemy

fading barn
#

Like I said, might break something, or otherwise result in unexpected behavior, but it's probably worth a shot.

winter rose
#

I might just refrain from doing it out of shame, if someone like Lou Montana finds it
well if you find a way and it works, why would you be ashamed 😄

potent dirge
#

But it looks so dirty 😭

winter rose
sage flume
#

@potent dirge do I put this in the init of my mission?

#

clearItemCargoGlobal _ammoCrate

winter rose
#

No

#

init fields exec for every player connecting, so it would clear your box mid-mission if someone were to connect

sage flume
#

@winter rose The mission is a SP,...does that matter?

winter rose
#

not at all then 🙂

sage flume
#

Thanks !

winter rose
#

Sorry, coding reflexes

sage flume
#

I get an error when I try this...

#

17:41:21 Error position: <_ammoCrate>
17:41:21 Error Undefined variable in expression: _ammocrate

#

😟

winter rose
#

clearItemCargo this

sage flume
#

I'm such a rookie,

winter rose
#

that's how one learns!

sage flume
#

DO I need a ;

winter rose
#

nope

potent dirge
#

It appears it is impossible to change a unit's side to sideEnemy without changing rating, and also not possible to change sideEnemy relations with any side even itself.```sqf
[_unit] joinSilent createGroup [sideEnemy, true];
side _unit;
//Returns _unit's original side instead of sideEnemy

#

Or am I missing something, I hope?

winter rose
#

it might very well be possible that it's impossible, yes

fading barn
#

I could totally see sideEnemy not being changeable like that.

#

Best bet's probably to use Civ

winter rose
#

also, sideEnemy is enemy to sideEnemy, too

potent dirge
#

yeah I tried messing with setFriend to see if that could fix that, but can't change any relations to and from sideEnemy

winter rose
potent dirge
#

Probably, they don't have a sideCentre like normal sides, so you can't create groups with them, probably why I couldn't do so earlier. However, sideLogic has a sideCentre, so maybe I can try that.

#

It actually worked. side _unit is LOGIC, but the AI won't engage even though [resistance, sideLogic] call BIS_fnc_sideIsFriendly; returns false

winter rose
#

be sure to check if the group is created before joining it
you may need to createCenter manually, if it works

potent dirge
#

I think at this point it's better for me to just redesign the mission to fit Arma instead of the other way around. Using sideLogic as an 'extra' side might cause me problems in the long run

#

Thanks for all the help, really appreciate it, learnt alot about sqf too

winter rose
#

with pleasure
but yeah a "new side" is some kind of unreachable Eldorado… and a Pandora's box as well

urban tiger
#

Looking to make a 'draw3d' nametag that has a variable that is unique only to that unit this variable would constantly be changing for both real and ai units.
anyhow got any idea's for the best overall performance. tried doing it via an mpeventhandler but makes performance issues very quickly as it constantly creating a new handler (while removing the old one)

coarse sedge
#

Hello,

can anyone recommend a nice clean script that can reduce damage to a single vehicle, or increase it's health?

urban tiger
#

@coarse sedge this addEventHandler ["HandleDamage", {(_this select 2)/DAMAGEREDUCTION)}];

coarse sedge
#

ty, and is there a way to tune it up and down abit?

urban tiger
#

. /1 is 'defualt' /10 would mean it has '10 times' more health

coarse sedge
#

got it, thanks man!

exotic flax
#

"division by zero" incoming

lofty anchor
#

Anyone recommend a good YouTube channel for intermediate and advanced scripting tutorials iv done alot of scripting but mainly either using and implementing others code or modifying code to do what I need but it's time I learn more so I can write code for arma from the ground up

exotic flax
#

If there are any YT videos about SQF/Arma then it's most likely from the Arma 2 times...

urban tiger
#

@exotic flax just noticed that haha

coarse sedge
#

@urban tiger and to reduce the health in half this addEventHandler ["HandleDamage", {(_this select 0.5)/DAMAGEREDUCTION)}]; will work?

exotic flax
#

best source of information is wiki, forums, (this) discord and public repositories of other projects

urban tiger
#

@coarse sedge no. the _this select 2 is selecting the unit. for 'double' the health it would be this addEventHandler ["HandleDamage", {(_this select 2)/2)}];

coarse sedge
#

addEventHandler ["HandleDamage", {(_this select 2)/0.5)}]; to double it's health then?

exotic flax
#

double damage

coarse sedge
#

😬

urban tiger
#

^ doubles the damage

lofty anchor
#

@exotic flax that ashame although some of the arma 2 stuff is still relevant

exotic flax
#

well yes, although a lot of "features" have been fixed or replaced by improved functions.

coarse sedge
#

if i put 0.5 instead of 2 what kind of an effect would that have?

exotic flax
#

damage = value / 0.5 = ?

urban tiger
#

doubles its damage taken

coarse sedge
#

i'm sorry, 2am here. i read the whole thing again and i understand

exotic flax
#

just a pro-tip: always multiply instead of divide, it will make everything much easier:

damage = value * 2; // double damage
damage = value * 0.5; // half damage
damage = value * 0.13; // 13% of damage
damage = value * 0; // no damage, and prevents "division by zero"
coarse sedge
#

this addEventHandler ["HandleDamage", {(_this select 2)/2)}];
could use some more pro tips @exotic flax . I might be placing this in the wrong place...but if it's in vehicle init, then there is an error msg preventing me to even close the atributes menu

robust hollow
#

i believe the editor expect the init code to return nothing, or something like that?

try one of these sqf _a = this addEventHandler ["HandleDamage", {(_this select 2)/2)}];

call {
  this addEventHandler ["HandleDamage", {(_this select 2)/2)}];
};```
#

the second one would technically return something but iirc it does work. idk why it errors exactly 🤷‍♂️

craggy lagoon
#

Hey guys I'm trying to make a trigger with the condition that checks if a player has the "V_RebreatherB" on. I was able to write one checking for items in a vest but can't do it for the vest itself. Any help would be greatly appreciated!!

exotic flax
#

@coarse sedge event handlers shouldn't be added in the init field of a unit/vehicle, since it's global, but in a script like init.sqf in a mission.

fading barn
#

if ((vest <player's reference>) == "V_RebreatherB") then {stuff};

#

So if you just want the condition it's the stuff inside the outer () @craggy lagoon

craggy lagoon
#

@fading barn That worked thank you very much!!

glass zinc
#

how do i delete map objects that only show up with cursorobject but dont show up with either nearobject or nearestterrainobject? Im trying to delete these items at mission start

sharp grotto
#

If i read out a netID for the same object on the server and client, they should be the same or ? 🤔

Because on the server it get this
1bcb9c64100# 1235546: plp_cts_weathcratesmallgreen.p3d

And on the client
1d0fddf6b00# 1226753: plp_cts_weathcratesmallgreen.p3d REMOTE

verbal rivet
#

Is there a way to calculate "simple expression" (rain/forest/meadow etc) for arbirtary position?

#

Ah, getAllEnvSoundControllers does return all the variables, I guess I can just use it

smoky verge
#

any reason why this switchMove "animation"; works in singleplayer but not in multiplayer?

winter rose
#

locality issue?

#

@smoky verge given I see you using this, I assume this is in an init field?

smoky verge
#

yeah I'm using it in the init of the unit

#

something related to init boxes?

winter rose
#

bad Sanchez, bad

smoky verge
#

oh I don't do that on a daily basis, just looking for ways to animate a large amount of units

cosmic lichen
#

Remote exced has global effect so it should work

#

just don't do it in the init

#

Because init is executed for every player

smoky verge
#

yeah guessed that but having it elsewhere defeat the purpose of all this
on a sidenote I must guess that this won't cause any issue in singleplayer?

cosmic lichen
#

singleplayer is fine

#

you can try to do ```sqf
if (local this) do {switchMove stuff};

smoky verge
#

I can try with the hard way and fiddle with a forEach and switchMove

cosmic lichen
#

Oh btw

#

did you disable some of the AI's features? Like move, anim, target etc?

#

That might cause them to exit the animation

smoky verge
#

nope

winter rose
#

I always thought switchMove and playMove needed a little delay

cosmic lichen
#

interesting

urban tiger
#

Looking to make a 'draw3d' nametag that has a variable that is unique only to that unit this variable would constantly be changing for both real and ai units.
anyhow got any idea's for the best overall performance? tried doing it via an mpeventhandler but makes performance issues very quickly as it constantly creating a new handler (while removing the old one)

winter rose
#

12h bump… tolerated 👀 😋

do not mpEventHandler, use a local script to every client

#

you could set the variable from the server via e.g setVariable

urban tiger
#

not sure if im overlooking something very obvious. As the variable would be changing dynamically throughout the mission how would i then define it with setVariable if its an unique value to every ai and client?

#

as the var is going to be visable to every client

winter rose
#

so you mean, unit 1 could be seen as "John" by player1, and "Bob" as player2?

urban tiger
#

no. more along the lines of a draw3d displaying 'john(ai) Points: '100' ', player1 Points:200 and player2 Points: 300. with every unit able to visually see the points for ai and players

winter rose
#
_myUnit setVariable ["PHP_Name", "my unit name"];
_myUnit setVariable ["PHP_Points", 300];
```and in your script,```sqf
private _name = _myUnit getVariable ["PHP_Name", "-no name set-"];
private _points = _myUnit getVariable ["PHP_Points", 0];
// draw3D with this stuff
urban tiger
#

am i overlooking obvious? but thats going to display 300 for every unit. unless you mean this as a local script. however it also the issue of having that be called from a ai unit. [name,500] call fn_points and passing that into a event handler caused the performance issue r. If it call a script with just an draw3d its not visible yet reports no issue.

winter rose
#

I… simply didn't get your question.

#
_myUnit setVariable ["PHP_Name", "my unit name"];
_myUnit setVariable ["PHP_Points", 300];

this ^ means "set your name and score variable from wherever you want"

urban tiger
#

but that would mean the name would have to be defined for every single ai.

winter rose
#

you could do ```sqf
private _name = name _unit;

signal kite
#

Hello! Is it possible that this script clogs up the dedicated servers memory?

_handle = [] spawn {
feuer = 1;
while {feuer == 1} do {
private _allHCs = entities "HeadlessClient_F";
private _humanPlayers = allPlayers - _allHCs;
_humanPlayers = count _humanPlayers; 
if (_humanPlayers > 0) then {
private ["_shelltype", "_shellspread", "_shell", "_delay","_altitude"];    
_shelltype = "Sh_155mm_AMOS";
_shellspread = 1000;
_altitude = 2000;       
_position = [27000, 23200,_altitude];
  _shell = createVehicle [_shelltype, _position, [], _shellspread];    
  _shell setVelocity [0, 0, -50];
  diag_log format ["Feuer %1", time];
  } else {
diag_log "No players present - random artillery fire cancelled";
};
_delay = random [1, 60, 120];
uisleep _delay;
};
};
winter rose
#

I wouldn't use uiSleep on a dedicated server, but I might be wrong
try sleep

it will fill the log yeah, anyway

#

not the RAM (if the sleep works)

urban tiger
#

is _unit a predefined variable like '_this' ?

winter rose
#

no, you have to define it yourself

languid steeple
#

Can someone explain to me why this code doesn't work?

this addAction ["Rifleman", { setUnitLoadout "rifleman" }];

tough abyss
#

I'm having an issue creating an ORBAT, and I'm hoping this is the right channel

winter rose
#

@languid steeple you do not respect the setUnitLoadout syntax

tough abyss
#

Yes

winter rose
#

What is your issue then?

tough abyss
#

I've written up a basic ORBAT, and when I test the scenario I get [BIS_fnc_ORBATGetGroupParams] Class not found

winter rose
#

written in Description.ext/class CfgORBAT?

languid steeple
#

Lou, what do i write in the unit section of the setUnitLoadout syntax if i want that code to apply to any person performing the Action?

tough abyss
#

I'm not sure, I followed a video tutorial that I found on the Bohemia forum

winter rose
#

@tough abyss ¯_(ツ)_/¯

#

compare with the page what is missing

tough abyss
#

Alright

#

I fixed it

#

I think my problem was not putting spaces in-between the "="

#

Thank you, Lou

winter rose
#

That can't be the source of the error, but you may have changed something else in the process 😉

tough abyss
#

Actually it wasn't the sole source of the error, it seems like I put spaces in the CfgORBAT Path on accident

#

In the editor

winter rose
#

oh okay
but really, in config```cs
myValue=1;
// and
myValue = 1;

thorn saffron
#

I have a group and I want to delete all of it: the units, the vehicles and the group itself. I have real problems deleting the vehicles though, I can delete the crew, but the vehicles stay

winter rose
#
params ["_group"];
private _vehicles = [];
{
  private _vehicle = vehicle _x;
  if (_vehicle != _x) then
  {
    _vehicles pushBackUnique _vehicle;
    _vehicle deleteVehicleCrew _x;
  } else {
    deleteVehicle _x;
  };
} forEach units _group;

{ deleteVehicle _x } forEach _vehicles;
deleteGroup _group;
#

@thorn saffron ^

#

there are no checks for locality though, use remoteExec wherever needed (e.g for deleteGroup)

thorn saffron
#

The locality stuff always was a dark magic to me.

winter rose
#

can I recommend a good read about it? ^^

languid steeple
#

So Lou, its still not working. I have defined rifleman in the description.ext correctly from the Wiki, but im still not getting any gear. I dont get any errors either. This is the code:
this addAction ["Rifleman", {params ["_caller"]; _caller setUnitLoadout "rifleman"; }];

jade abyss
#

can I recommend a good read about it? ^^
@winter rose idk, can you?

winter rose
jade abyss
#

empty vehicles are local to the server
@winter rose uhm, you sure? Don't think so.

#

If you were in the Vehicle or the AI commanding it was yours (local to you) -> It should be yours.

winter rose
#

empty vehicles

jade abyss
#

Yes

winter rose
#

I think (thought?) locality was given back to the server 🤔 would have to check

jade abyss
#

nah

#

I am pretty sure

#

Since i made a repairSystem, wich checked the locality 😄

winter rose
#

no, you're pretty sure 😋

jade abyss
#

*no, you're pretty sure 😋

urban tiger
#

@winter rose if i was using private _name = name _unit; it would go back to every unit that is spawned being defined

tough abyss
#

I figured out the reason why there was an issue.
missionconfigfile >> "CfgORBAT" >> "1reg" >> "1b,2b" is why it kept failing, and it started working when I removed the ,2b
I am trying to get multiple subordinate units to appear in the ORBAT, and I guess my real question is how do I get that to happen, because the page on the wiki does not show that, I think

jade abyss
#

execute multiple times?

winter rose
#
private _reg1 = missionconfigfile >> "CfgORBAT" >> "1reg";
private _reg1b = _reg1 >> "1b";
private _reg2b = _reg1 >> "2b";
```yes
#

@urban tiger do you know about our lord and saviour forEach?

jade abyss
#

👋 hi

urban tiger
#

ofcourse but that would then have to be a loop running constantly.

winter rose
#

I… huh… no.

jade abyss
#

don't mix it with while

tough abyss
#

Would that involve me putting down multiple ORBAT group modules?

urban tiger
#

so you're saying the best course of action would be to do a foreach for the name and then have a totally separate function for the points. and then pass them both to draw3d?

winter rose
#

@tough abyss I don't think so

#

@urban tiger

  1. have an independent function dealing with the score and setting it to the unit with setVariable on change
  2. with your drawIcon3D stuff:
    2a) get all the units to be drawn (close & on screen)
    2b) for each these units:
    2ba) get the unit's name
    2bb) get that score variable
    2bc) draw the icon/text
spiral fractal
#

is it possible to remove all ACE interaction menu items from object?

slate cypress
#

Lou you know the script I made before which refuels, rearms and repairs a vehicle that enters the trigger

#

I tested it out in MP with a friend and it didn't work for them

#

It worked for me however they didn't see the vehicleChat messages that were appearing.

#

I have a strong feeling I did something wrong in terms of multiplayer scripting

spiral fractal
#

I think you will have to use remoteExec

slate cypress
#

but it's in an init field

#

i thought remoteExec only applies to sqf scripts in the directory

#

a method to call them.

coarse sedge
#

Hello,

it was advised to me to call an event handler from a sqf file. This is the event handler:

this addEventHandler ["HandleDamage", {(_this select 2)/2)}];

It is supposed to double the health of a BTR 80 vehicle with a variable name teleportFlag2. I made an empty sqf file named Abtr80.sqf.

Since this is my first time implementing an event handler to a specific vehicle, and since it’s such a simple one, it could be a nice opportunity to finnaly learn the basics of making EH work. Unfortunatly all of my attempts so far, after reading and watching videos about it, failed. I am missing something essential for making this work.
Any help would be much apreciated...

urban tiger
#

did you name the tank in the editor?

coarse sedge
#

yep, that is the only place i named it

#

sqf is empty

urban tiger
#

you don't even need to use a sqf

#

just put this addEventHandler ["HandleDamage", {(_this select 2)/2)}]; in the init field on the unit in the editor

coarse sedge
#

@urban tiger yeah, that is what i tried, unfortunatly i get an undefined error msg that prevents me to close the atributes window. I also tried these two with the same result:

_a = this addEventHandler ["HandleDamage", {(_this select 2)/2)}];

call { this addEventHandler ["HandleDamage", {(_this select 2)/2)}]; };

urban tiger
#

you don't need to call it

#

literally just this addEventHandler ["HandleDamage", {(_this select 2)/2)}];

winter rose
#

in an Eden field, you need to do something like 0 = /*moy code */ if the code returns something.

urban tiger
#

@winter rose oh and thanks for pointing me in the right direction. Was me being completely blind to something really simple!. Always is the way 😂

winter rose
#

If I can help ^^

coarse sedge
#

please explain to me like i'm an idiot...this is what i tried just now and again same error msg:

0 = this addEventHandler ["HandleDamage", {(_this select 2)/2)}];

winter rose
#

same error msg
which is… ?

tough abyss
#

What I'm trying to do is to get player's altitude and temperature at that altitude. Both variables, I suppose, are provided by ACE and I want to use it for that purpose. Wrote some code with somebody's help but with no luck, this is part of the script:

_playerAltitude = (getPosASL ACE_player) select 2;
_altitude = EGVAR(common,mapAltitude) + _playerAltitude;
_temperature = _altitude call EFUNC(weather,calculateTemperatureAtHeight);

"Show script errors" throws this:

_altitude = EGVAR#(common,mapAltitude) + _playerAltitude;   // error missing ;

What am I doing wrong in this script?

robust hollow
#

the point was made earlier today that event handlers usually shouldnt be added in an object's global init field. its more important in an mp scenario, but good to keep in mind.

#

@tough abyss EGVAR macror isnt defined i assume

#

it didnt preprocess to the code it represents

coarse sedge
#

@winter rose error missing

tough abyss
#

@robust hollow, ACE is added as a mod. Doesn't ACE define it by itself?

robust hollow
#

@high horizon only draw if the line of sight isnt obstructed. lineIntersectsWith command or something.

winter rose
#

@coarse sedge error missing →(…)← ?

robust hollow
#

@tough abyss you need to include the macro file into your own scripts still

tough abyss
#

will try, thanks

coarse sedge
#

@winter rose it pops out the text from that event handler and at the bottom error missing ;

#

nothing else

winter rose
#

; might be the useful part of the message yes

robust hollow
#

this addEventHandler ["HandleDamage", {(_this select 2)/2 --> ) <--}];

#

extra )

high horizon
#

thx @robust hollow

#

Another thing, i have defined a dialog on a .hpp that is working, but some classes in that dialog are founded and another one not

#

solution?

robust hollow
#

check ur rpt for errors

coarse sedge
#

@robust hollow @winter rose ok this was embarrasing 😅 annoying ).
error msg is gone, im will go and start testing. thank you both

proud carbon
#

When I try to run this
"_pass = true;
while (_pass) then {if (objectParent _Leaderman isEqualType O_Heli_Light_02_unarmed_F) then {sleep 3} else {_pass = False };};"
I get an error saying something like it needs to be a bool.

robust hollow
#

while {} not while ()

winter rose
#

proud carbon
#

Thanks

winter rose
#

aaalso, O_Heli_Light_02_unarmed_F"O_Heli_Light_02_unarmed_F"

proud carbon
#

but then it'll check for a string and not an object

#

I am trying to holt the script while the AI is in a heli

#

or vic

winter rose
#
private _pass = true;
while { _pass } then
{
  if (typeOf objectParent _Leaderman isEqualTo "O_Heli_Light_02_unarmed_F") then   {
    sleep 3;
  } else {
    _pass = False 
  };
};
#

typeOf, isEqualType is for variable type comparison

robust hollow
#

is that just an over complicated waituntil?

proud carbon
#

Maybe

winter rose
#

totally

robust hollow
#
waitUntil {typeOf objectParent _Leaderman != "O_Heli_Light_02_unarmed_F"}```
winter rose
#

\o/

proud carbon
#

Thanks again lol

high horizon
#

check ur rpt for errors
@robust hollow Ok let me check, on arma3 error says "Resource not found"

#

no error on rpt @robust hollow

robust hollow
#

not even a complaint about some bad config property or something?

#

did you even include the displays that are missing in the dialog.hpp

winter rose
#

↑ checks that the unit is on foot.

high horizon
#

@robust hollow of course, with the same name as i call it

#

I can send you the code on dm

robust hollow
#

sure

tough abyss
exotic flax
#
_playerAltitude = (getPosASL player) select 2;
_temperature = _playerAltitude call ace_weather_fnc_calculateTemperatureAtHeight;
#

you can basically replace all FUNC and EFUNC stuff with direct function names and replace ACE_player with player

spark turret
#

where is the script of "on activation" of waypoints executed? all clients or server/host only?

exotic flax
#

marco's will most likely cause some issues, although you can include the macro file(s) of ACE to access them.

tough abyss
#

Oh gosh... Is that simple? If I include the macro, will it change what my numbers are? I mean like if I will get different wind direction than other players on a server?

exotic flax
#

wind direction and speed SHOULD be global (is actually defined by terrain and mission settings)

spark turret
#

ace temperature is quite dumb for a lot of maps. 16 degrees in takistani desert and + 12 on snow maps

tough abyss
#

yeah, but my stuff is going to impact on helo engine performances, so we all need to have an access to the same numbers when pilot call for wind strenght and direction at LZ. Ace is crucial here

#

Anyway, thanks a lot! @exotic flax

exotic flax
#

afaik does ACE not do anything to weather effects other than taking them from vanilla Arma functions (eg. wind and windDir methods)

tough abyss
#

well, it's not only wind strenght/direction I need. Also, ambient temperature at altitude is important. AFAIK, ACE does much more than just pulling out the vanilla data and pusblish it with no change. It would be stupid, to be honest.

spark turret
#

are you sure? i think ace might overwrite windspeeds depending on height terrain, but im not sure

exotic flax
#

it does, and it even modifies it based on terrain and objects (eg. windspeed near trees and buildings is lower than in an open field)

#

but everything that ACE does can be retrieved by calling their functions or accessing their variables directly

#

@spark turret if I'm correct you can use setWaypointStatements for "on activation"

spark turret
#

i meant by default with out scripted behavior. if i just drop code in it in editor, where will it execute

#

it would make sense to only run on the server or the machine the WP is local to, but since its arma i dont trust that lol

exotic flax
#

While Condition code is evaluated on the group owner's machine, OnActivation code is executed globally, a.k.a on every client!

spark turret
#

oh interesting

#

but why lol

winter rose
#

¯_(ツ)_/¯

exotic flax
#

It does make sense in a way, although it would make more sense if it was on every group member (instead of all clients).

#

But having it globally ensures that you can trigger other actions as well, outside of the group with the waypoint

winter rose
#

Hey, go easy on the bumping @high horizon (#rules)

exotic flax
still forum
#

@high horizon when you move to another channel. do MOVE there, not COPY. Aka delete the old post.
It violates our #rules which you already received a warning for.

stuck rivet
#

how can I repair a destroyed building via debug menu?

winter rose
#

not easily I'm afraid

stuck rivet
#

can i delete it and spawn another in its position?

winter rose
#

you cannot delete terrain objects, but you can hide them

#

if you have a reference to the "healthy" building I believe you can setDamage 0 to it

#

(I might absolutely be wrong, though)

stuck rivet
#

i tried cursorObject setDamage 0 but it doesn't work because a destroyed building is a type of its own

winter rose
#

yes, a ruin is spawned
no reference to the previous building though?

stuck rivet
#

no

still forum
#

the previous building is under the ground

#

there are also locality issues and.. ugh..

winter rose
#

can u fix it !1!

stuck rivet
#

maybe if i can get the camera underground but yeah i wont solve it for mp probably

red solar
#

anyone have any cool scripts for a life server or know anywhere to get them

cunning crown
#

Made them yourself, there are a lot of ressources to begin scripting (altough begining with/for L*ife is not a good idea).

exotic flax
#

PS... Don't steal like other "Life" missions/servers

ornate marsh
#
deadshot addAction 
[
    "Get Deadshot Daiquiri", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
    removeAllActions deadshot;
    _caller addEventHandler ["Fired", {if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]}; }];
     _handle = [] spawn {  
  deadshot say3D "open";    
  sleep 0.8;    
  deadshot say3D "swallow";    
  sleep 0.8;    
  deadshot say3D "break";    
  sleep 0.8;    
  deadshot say3D "belch";     
  };
    },
    [],
    1.5, 
    true, 
    true, 
    "",
    "true",
    5,
    false,
    "",
    ""
];

this script is working in SP but not MP Dedicated, does anyone know what could be causing this?

#

basically any bullet that hits an enemies body should hit their head instead

surreal peak
#

wont fix the problem, but use _caller instead of _selector

#

or rename _caller

spark phoenix
#

When working in MP you need to think about the context your code will be executing in.

Does this run on the server? A client? How will you ensure "local effect" commands will be executed on all clients?

In this case, you didn't check that say3d has only local effects. Meaning you need to remote execute those in order for other clients to hear them.

You can check if a command is local or global effects on the wiki.

surreal peak
#

issue isnt playSound

ornate marsh
#

say3d wants to be local anyway, thats not the problem. The EH is the problem

spark phoenix
#

Fired only fires when applied to a local unit

ornate marsh
#

also Fred, if I rename it to _caller i dont need the _this select 1 do I?

surreal peak
#

yes

#

_this select xyz is not necessary cause of params

ornate marsh
#

if its added via an addAction though, it should be added to the person who selected the action, therefore making it local, right?

spark phoenix
#

You are applying it on the target right?

ornate marsh
#

on the caller

#

it should add the EH to whoever clicks the option in the scroll menu

spark phoenix
#

Ah I see it now. The select commnd through me off. On mobile so it's kinda hard to read

ornate marsh
#

one person should be able to have the EH, while another doesn't

#

i'll edit it one sec

#

edited

spark phoenix
#

Try using the parameters in the fired eh instead of cursorTarget

#

Did you check if the fired EH is applied at all by using a systemchat in the handler?

ornate marsh
#

could do, lemme check

#

how could i do that?

surreal peak
#

may also be an issue with weather the target is known or not

ornate marsh
#

yea, saw that on the wiki page

surreal peak
#

if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]; systemChat "hit!"}

ornate marsh
#

player addEventHandler ["FiredMan", {if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]; systemChat "hit!"}};]; is that correct?

surreal peak
#

I believe you have one too many ;

player addEventHandler ["FiredMan", {if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]; systemChat "hit!"}}];
#

try both, although player shouldnt be used for multiplayer testing

spark phoenix
#

Depends on the context but Ideally player wouldn't be used yeah.

ornate marsh
#

im just executing from debug console for now

#

that's working from my testing, also thrown in this line to help

#

["deadshotReveal", "onEachFrame", {{player reveal _x} forEach allUnits;}, [_caller]] call BIS_fnc_addStackedEventHandler;

spark phoenix
#

Ya that works but it's really inefficient. Ideally you wouldnt continue to call reveal like that.

#

For testing however, it will let you know if reveal is the issue.

ornate marsh
#

but if i'm spawning new units that are maybe out of the FOV or are blocked by shrubs, that should help

#

ok, so with some testing, it works at short distance, like <2-3m

#
deadshot addAction 
[
    "Get Deadshot Daiquiri", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
    removeAllActions deadshot;
    deadshot say3D "deadshot_sting";
    ["deadshotReveal", "onEachFrame", {{_caller reveal _x} forEach allUnits;}, [_caller]] call BIS_fnc_addStackedEventHandler;  
    _caller addEventHandler ["Fired", {if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]; systemChat "hit!"}}];
     _handle = [] spawn {  
    deadshot say3D "open";    
    sleep 0.8;    
    deadshot say3D "swallow";    
    sleep 0.8;    
    deadshot say3D "break";    
    sleep 0.8;    
    deadshot say3D "belch";     
  };
    },
    [],
    1.5, 
    true, 
    true, 
    "",
    "true",
    5,
    false,
    "",
    ""
];

thats what im using

#

now it's working at long ranges, it's very confusing

#

its very inconsistent, but works

surreal peak
#

arma in a nutshell

shut kraken
#

    diag_log format ["UTC TIME: %1",_utcTime];

    _justTime = _utcTime select 1;

    diag_log format ["JUST TIME: %1",_justTime];

returns

17:51:45 Error in expression <E: %1",_utcTime];

_justTime = _utcTime select 1;

diag_log format ["JUST TIME: >
17:51:45   Error position: <select 1;

diag_log format ["JUST TIME: >
17:51:45   Error Generic error in expression

So its logging the response then throwing an error at the same line?

robust hollow
#

_utcTime is a string isnt it?

#

cant select from a string like that

#

as in, it would be "[1,[2020,04,24,00,51,45]]"

#

_justTime = (parseSimpleArray _utcTime) select 1; might work

shut kraken
#

damn

#

18:04:09 "_utcTime Type: STRING"

#

this is how you know it is bed time, thank you so much!

#

worked perfectly PeepoClap

high silo
#

When spawning items via createvechile, we have can_collide, None and fly. Is there anyway to get it to spawn directly at the coordinates with collision turned off? Try to build a base which half is built using scripts.

#

But things fly around or just don't go directly on the coordinates given. Idk why

robust hollow
#

it should work if you spawn the object with can_collide and immediately disable simulation

high silo
#

Just add ```sqf

player enableSimulation false;

#

Replace "player" with the handle I want?

robust hollow
#

there is disableCollisionWith but its a bit more fiddley than its worth imo.

#

yea sqf _obj = createvehicle ...; _obj enablesimulation false;

high silo
#

Just as I imagined ^^ will have a look thanks mate. Idk why I forgot about it being a thing

robust hollow
#

you may want to reset the position after disabling simulation, but itl most likely be fine without

high silo
#

Okay

#

Thanks again

robust hollow
#

👍

digital hollow
#

Is there a command to get camera vector or should I just use positionCameraToWorld [0,0,0] vectorFromTo positionCameraToWorld [0,0,1]

fading barn
digital hollow
#

They're... not quite the same. vectorDiff between the two gives [0.000212908,-8.65683e-005,-0.00806219]. Is that rounding error?

fading barn
#

Possibly the difference between Render and Simulation space, if not. In either case, the base unit is meters, so the largest difference is 8 millimeters. Seems acceptable, I'd think.

spiral fractal
#

how can I remove all ace interaction commands from object?

#

[this, this] call ace_common_fnc_claim; seems to work

signal kite
#

Hello!I try to get the Server FPS, but it just returns "" - any ideas?

_fps = remoteExecCall ["diag_fps", 2];
_fps;
robust hollow
#

remoteexec(call) doesnt return the command result to the sender

#
[[],{
    [diag_fps,{systemchat str _this}] remoteExec ["call",remoteExecutedOwner];
}] remoteExec ["call",2]

something like that would get it back to you.

#

could return it with a remoteexec systemchat directly, but i did a call incase you wanted to do something more with it. whatever works for you 🤷‍♂️

signal kite
#

my idea is to make a loop that will tell me on my client via systemChat the current FPS of the server and all connected clients every 60 seconds or so

robust hollow
#

you want to know the fps of connected clients?

signal kite
#

yes. in order to monitor the performance impact of my Zeus missions on the players

#

I have something like this in mind: "Performance: Server: 47, Player 1: 30, Player 2: 60, Player 3: 55, ..." and so on

robust hollow
#

you would run into a character limit after a few players

#

sure you dont want to send it to rpt or something?

#

could systemchat the server fps, max client fps, min client fps and avg client fps, and log them all individually?

signal kite
#

sounds good

robust hollow
#

@signal kite you been writing your own up or did you want my attempt at it?

signal kite
#

Honestly I wasn't really sure following your statement.
I think all the features that you described go way beyond my current skills, but it's probably to much to ask for...

robust hollow
#

a few things to note:

  1. This is not "network friendly". It shouldn't cause too much of a disturbance (if any at all), but I wrote it all lazily using local variables as much as possible because I didnt want to make multiple files, so it sends the code blocks over the network every time it runs.
  2. It uses the clientOwner ID to identify players. Doing this won't list players as P1, P2, etc, but it will allow you to compare specific players over different log batches.
  3. I have not tested it, but it works in my head so I give it a 60% chance of success.
    https://gist.github.com/ConnorAU/c371e1db90c1ed3ab777759bb02df95e
signal kite
#

Wow! Thx - i will try it

#

@robust hollow I now have a 12 million line *rpt file with "Suspending not allowed in this context" Errors 😆

robust hollow
#

gotta run it in scheduled. running it through debug or from a function?

signal kite
#

target debug

robust hollow
#

target debug?

still forum
#

target debug is cba, unscheduled

robust hollow
#

wrap the code in a [] spawn{/* gist code here*/} and try again

#

local execute

signal kite
#

wilco

signal kite
#

systemChat messages work nicely, but the *.rpt logging doesn't.

robust hollow
#

howso?

signal kite
#

no lines are added to the *rpt file

robust hollow
#

😟

#

which rpt r u looking in? urs or the servers?

signal kite
#

servers

robust hollow
#

check urs

signal kite
#

ah there they are

robust hollow
#

so it actually works?

signal kite
#

yes, works perfectly fine - thx a lot!

robust hollow
#

😲 👏 even I'm surprised

signal kite
#

and I learned about unique variable names and scheduled and unscheduled environment on the go! 🎉

robust hollow
#

🥳

#

I guess this undeniably proves that testing code is an unnecessary and complete waste of time. Should just write scripts and push to production 🙂

surreal peak
#

I see no issue with that, it is industry standard

winter rose
#

Testing is doubting

viral basin
#

is there a similar command like ctrlClassName for displays or isn't it possible to get the classname of a display?

high horizon
#

Hi, does anyone know how to add player name to an array, like this array = ["R","u","b","i","o"]

thorn saffron
#
_unitCount = [
    0, // 0 - planes
    0, // 1 - attack helicopters
    0, // 2 - transport and misc helicopters
    0, // 3 - tanks
    0, // 4 - tracked APCs
    0, // 5 - Wheeled APCs
    0, // 6 - Cars
    0, // 7 - soldiers
    0, // 8 - ammo vehicles
    0, // 9 - repair vehicles
    0  // 10 - fuel vehicles
];```
How do I use params on this so every element is its own param?
I tried putting this under the array:
```sqf
_unitCount params ["_planes","_attackHelos","_cargoHelos","_tanks","_trackAPC","_wheelAPC","_cars","_soldiers","_ammo","_repair","_fuel"];

And it didn't work.
I never really used params for array elements, I'm not sure how to go with this.

winter rose
#

@thorn saffron as you did

thorn saffron
#
private _unitCount = [
    0, // 0 - planes
    0, // 1 - attack helicopters
    0, // 2 - transport and misc helicopters
    0, // 3 - tanks
    0, // 4 - tracked APCs
    0, // 5 - Wheeled APCs
    0, // 6 - Cars
    0, // 7 - soldiers
    0, // 8 - ammo vehicles
    0, // 9 - repair vehicles
    0  // 10 - fuel vehicles
];
_unitCount params ["_planes","_attackHelos","_cargoHelos","_tanks","_trackAPC","_wheelAPC","_cars","_soldiers","_ammo","_repair","_fuel"];

Didn't seem to work when I tried _soldiers = _soldiers + 1

winter rose
#
systemChat str _soldiers; // displays what?
high horizon
winter rose
#

@thorn saffron so?

quiet verge
thorn saffron
#

@winter rose On its own it works. When i use it it my script the values do not get updated and stay at 0.

high horizon
#

Hi, does anyone know how to make RscEdit text to text format example: "my text"

unique sundial
#

What exactly do you mean @high horizon ?

high horizon
#

@unique sundial
_msggui = (_ui displayCtrl 1400);
_msg = parseText (ctrlText _msggui);
array pushBack [name player, _msg];

array = [["Rubio", Message]];

#

I wanna make that array pushback be "message", not message

winter rose
#

if you mean "the array is not updated" then yes, it is normal @thorn saffron

unique sundial
#

str _msg then

fervent kettle
#

how exactly is a night vision defined? like, i want to check if player has a specific NVG, and if so remove it

coarse sedge
#

Hello, is it possible to handle damage of each component of a vehicle like we can handle the overall health/armor using this this addEventHandler ["HandleDamage", {(_this select 2)/0.1}];?

unique sundial
#

hmd player == "whatever" @fervent kettle

high horizon
#

@unique sundial not working

unique sundial
#

Remove parseText

high horizon
#

@unique sundial Okey let me try, then i have another error on my server, five minutes passed joined it kicks all players out, nothing on server rtp and client rtp it says: 0:05:00 Creation of 2:3836 ignored, state GAME FINISHED
0:05:00 Creation of 2:3837 ignored, state GAME FINISHED
0:05:00 Creation of 2:3838 ignored, state GAME FINISHED
0:05:01 Creation of 2:3839 ignored, state GAME FINISHED

still forum
#

like you were already told in tfar discord yesterday or so, send full rpt

high horizon
#

Yep cause i thought it was TFAR bug but it isnt

unique sundial
#

So the mission is finished and everyone is kicked

high horizon
#

@unique sundial Still not working _msggui = (_ui displayCtrl 1400);
_msg = str (ctrlText _msggui);

#

@unique sundial I think mission is not finished but it kicks all players out

unique sundial
#

What is not working, what message look like?

#

Game finished means mission ended

high horizon
#

Yep

#

But sometimes it lets you enter again @unique sundial

unique sundial
#

Make sure mission is running

high horizon
#

Yep yep i can enter and do everything on it

#

life_server working and mission and extdb too

#

Could be executed by one addon? @unique sundial

unique sundial
#

So mission is running but rpt says game finished? What server console says?

#

What could be executed by one addon?

high horizon
#

Any command to finish the mission

What could be executed by one addon?
@unique sundial

#

So mission is running but rpt says game finished? What server console says?
@unique sundial Anything, just player has disconnect

unique sundial
#

If mission is ended it should say so in server console too

high horizon
#

no it doesnt, weird but true

#

can i send you photos and rtp by dm?

unique sundial
#

No make FT ticket

high horizon
#

where

unique sundial
high horizon
#

tx

thorn wraith
#

Here's one: Is there a way around the sound being played stopping when the player leaves the radio channel?

#

as in, If I

_ch  radioChannelAdd [player];
player customRadio [_ch, "jammer"];
_ch radioChannelremove [player];
_ch  radioChannelAdd [player];

is there a way to have the sound play upon rejoin?

#

I mean, keep playing on rejoin?

high horizon
winter rose
#

there is a New to Feedback Tracker or just not sure what to do? link… 👀

high horizon
#

Edit query? @winter rose

winter rose
#

see the star next to your profile pic? (:

high horizon
#

Sorry my blindness

grim wing
#

can someone tell me how to add sirens to certain vehicles based off classname

winter rose
#

@high horizon nah it's really not obvious I admit

round scroll
#

is there a scripted/scriptable vehicle spawner I can add to the Nimitz elevators? E.g. player shall use a console, select a vehicle, elevator goes down, vehicle spawns, elevator goes up. I probably need mostly the interface part of this

#

probably Zeus would work too, but it's maybe too unrestricted

#

seems it likes to spawn in the water 🙂

robust hollow
#

@grim wing sqf if (typeof veh == "some_veh") then { playSound3D ["sound\file\path.wav", veh] };

potent depot
#

So, apparently setGroupOwner causes the squad leader of the group do dismount its vehicle if the vehicle is stationary. Does anyone know a good way to counter or prevent this behavior? I believe this behavior is due to the ai receiving a temp waypoint on its position during transfer. The ai remount if given a move order but I do not want them to dismount at all when transferring. @ me please.

ornate marsh
#

Wanting to make this activate a trigger. I know it wants to go in the Condition box, but don't know how to make it work in there

if (currentWeapon _x == "hgun_esd_01_antenna_02_F")
crude vigil
#

@potent depot You may use the local event handler(https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Local) and when setGroupOwner is called, with this event you can call moveInXXX commands (ex for driver.. https://community.bistudio.com/wiki/moveInDriver)
@ornate marsh Just remove the if part, condition segment requires a bool value, which is returned by == operator in here, you dont need an if. It is enough to have this in condition segment of ur trigger:

currentWeapon _x == "hgun_esd_01_antenna_02_F"
ornate marsh
#

ah right, thanks

potent depot
#

Ty Talya will try that

ebon ridge
#

Hey, any chance someone knows how to either a) embed CBA settings editor into my own control, or b) open CBA settings via SQF from anywhere?

spring lodge
#

anyone know if ctrlCommit/ctrlSetFade can be called on the server? Its not updating for the player

robust hollow
#

what? you call it on the same machine that has the control.

grim wing
astral dawn
#

Is script call sequence within frame described somewhere at the wiki?
For instance 1. Various event handlers 2. OnEachFrame 3. Draw3D 4. Scheduled scripts ?
I could find it out with the profiler. Do you think that such wiki article would be useful?

robust hollow
#

would be nice to know, but i cant think of many situations where i'd need to know.

#

as in, knowing wouldnt change how i personally do things, i dont think.

astral dawn
#

yeah I don't think it will change anything as well, just good to know maybe

vernal mural
#

I just saw that in ACE medical_treatment code : params ["", "_patient"];
Is that correct ? Can we use an empty string to switch a parameter ? It will prevent linters and tools to display a warning about unused variables

robust hollow
#

yes, you can use empty strings to skip elements in the array

fervent kettle
#

hmd player == "whatever" @fervent kettle
@unique sundial I have put into a trigger condition hmd player == "O_NVGoggles_urb_F" and _nvg = execVM "removenvg.sqf"; into on activation. In my removenvg.sqf i have put player removeItem "O_NVGoggles_urb_F"; but it doesnt work

winter rose
#

@fervent kettle unlinkItem

round scroll
#

the wiki page entry by Larrow says //[ namespace event is stored in, event name, passed variables ] [ missionnamespace, "garageOpened", [ _display, _toggleSpace ] ] [ missionNamespace, "garageClosed", [ displaynull, uinamespace getvariable [ "BIS_fnc_arsenal_toggleSpace", false ] ] ]

#

does this mean there's a garageClosed event I can check instead?

#

seems this works: ```sqf

[missionNamespace, "garageClosed",{
systemChat "Garage closed";
}]call BIS_fnc_addScriptedEventHandler;```

round scroll
verbal saddle
round scroll
#

thanks!

tough abyss
#

I'm working on a script/fnc that adds some weather related effects on an addon. It uses output data from ACE3. It works well but spam with error like this:

if (#_windGradientEnabled) then [ ....
File z\ace\addons\weather\functions\fnc_calculateWindSpeed.sqf ..., line 34
blablabla
Error undefined variable in expression: _windgradientenabled

Have all the ACE Weather and ACE AdvancedBallistic options enabled. I call for the data in my script like this:

_windspeed = [getPosASL _veh, true, true, true] call ace_weather_calculateWindSpeed;

What am I missing?

winter rose
#

Well, _windGradientEnabled variable is not defined
Try checking ACE documentation on this function?

tough abyss
still forum
#

no

#

you need to pass the correct parameters

tough abyss
#

Yeah... I overlooked the example syntax from the function you've linked above.
Instead the old call, I used the one below and now it's not spamming with the error:

_windspeed = [eyePos ACE_player, false, true, true] call ace_weather_fnc_calculateWindSpeed;

Thank you @still forum !

astral dawn
#

How can I check what is currently selected by zeus? The "CuratorObjectSelectionChanged" event handler doesn't report multiple selection and it doesn't report when I deselect everything.

astral dawn
#

Damn how did I miss it, thanks!

thin goblet
#

how can i change this to ace arsenal ? this addAction["Virtual Ammobox", "VAS\open.sqf"];

high horizon
#

Any memory point on player leg different to "leftfoot"??

winter rose
exotic flax
smoky verge
#

trying to disable player movement but leave turning, aiming and shooting active
any way to do that?

#

would an eventhandler on wasd help?

crude vigil
#

setPos till u are done?

smoky verge
#

how would that work?
like a looping setPos?

crude vigil
#

Could work.

#

But animation wise, can cause some weirdness.

smoky verge
#

yeah

crude vigil
#

u can put an event handler for animation change

#

I am not sure if this event works for animations like movement though.

smoky verge
#

wouldn't that break shooting, reloading and etc?

#

so the setPos seems to work quite well

#

but sometimes the player twitches a bit

crude vigil
#

you ll check if the animation is the anim used in move format in 3 stances(stand, crouch, prone) and change the animation to what you want.

#

you may also want to handle stuff like the anims that are used to get over fences and roll left/right when you are proning.

#

if you dont want to bother with these, maybe you can find something to prevent WASD movement but I doubt it is possible , I doubt you will be able to prevent movement at all. (ie. you will still need to deal with animations)

smoky verge
#

standing crouching and proning seems to work well
only problem is the ghost walk and the vaulting

#

which I'm willing to ignore to an extent

crude vigil
#

Did you apply animChanged?

smoky verge
#

not yet, still learning how it works
not good with eventhandler

exotic flax
#

Why not simply use _unit disableAI "PATH";?
This will simply prevent AI/player from moving around, but everything else will still work

crude vigil
#

Because it is a player.

#

As far as I know , disableAI does not work for player.

#

Otherwise, certainly the better option.

#

After all, it works by affecting the AI's brain.

exotic flax
crude vigil
#

Yeah it works as well, I forgot there was a way to override default behavior for keyDown event.

high horizon
#

Does anyone know why this is not working on script but it does in debug?

_idx = 1600;
while {_idx < 1605} do {
    _parte = _ui displayCtrl _idx;
    posboton = 0;
    
    switch {_idx} do {
        case "1600": {posboton = quien selectionPosition "head"};
        case "1601": {posboton = quien selectionPosition "rightforearm"};
        case "1602": {posboton = quien selectionPosition "leftforearm"};
        case "1603": {posboton = quien selectionPosition "leftfoot"};
        case "1604": {posboton = quien selectionPosition "rightfoot"};
    };
    _headWorldPos = quien modelToWorld posboton;
    _headScreenPos = worldToScreen _headWorldPos;
    _parte ctrlSetPosition _headScreenPos;
    _idx = _idx + 1;
};
crude vigil
#

@smoky verge You can block behaviours by using keyDown event. https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onKeyDown
To block certain keys you need to check if _key value is equal to DIK_Codes https://community.bistudio.com/wiki/DIK_KeyCodes
You will need to apply this event to Mission display which idd's is 46.

So an example is:

blockMovementEH = (findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_ctrl","_button","_BtnShift","_BtnCtrl","_BtnAlt"];
if (_button == 17 || _button == 30 || _button == 31 || _button 32) then { //W, A, S, D ids in order, found in DIK_Codes page.
true; //Returning true prevents default action to be applied, in this scenario, it prevents movement.
};

}];

To properly make this a useful code which detects what the inputs of movement of player are, you may wanna combine this example with actionKeys command:
https://community.bistudio.com/wiki/actionKeys
https://community.bistudio.com/wiki/inputAction/actions

To remove this EH later on, simply use this:

(findDisplay 46) displayRemoveEventHandler ["KeyDown", blockMovementEH];
smoky verge
#

yeah grasped the concept of how it works
still a bit confused on the params
but thanks

crude vigil
#

Each event handler to access stuff quicker return you data related to that event. Only thing you need in this scenario is _button. (which is 2nd output of the event handler). Alternatively , you could do _button = _this select 1; too.

high horizon
#

Does anyone know why this is not working on script but it does in debug?
@high horizon you mean this? @smoky verge

smoky verge
#

@high horizon no
was speaking about my problem
maybe your script is in the wrong file format?

high horizon
#

@smoky verge Nooop .sqf... it doesnt do anythin

ornate marsh
#

How would I go about adding an image to the HUD? as in when a script executes, an image is added to the ui in the bottom left?

cunning crown
high silo
#

Anyone know if ORBAT, only works in single player. I loaded my mission onto a dedicated server and it isn't working.

winter rose
#

@ornate marsh

ornate marsh
#

oh sorry, didn't see that was a room, my mistake

winter rose
#

np

exotic flax
#

What? Please give a bit more information on what you want to do and how you're currently doing it. Because "Any chest selection?" isn't giving us enough information to work with...

high horizon
young current
#

how are you trying to use that

#

and where

high horizon
#

player selectionPosition "chest"; @young current

#

At the moment im using "head" position and changing pos with code

#

using them for a dialog

young current
#

you could get better results if you define a different lod for the selection

compact maple
#

Hi, why currentWeapon player return the string "Put" ? Is it a known bug ?

young current
#

also you probably would want to turn that selectionPosition into WorldPosition

#

"Put" is used to put down mines and bombs

#

and "throw" to throw grenades

high horizon
#

Y

also you probably would want to turn that selectionPosition into WorldPosition
@young current yep, modeltoworld and worldtoscreen

young current
#

is it vanilla character?

#

also I recall the selection names are caseSensitive

#

so check that your actual name is right

compact maple
#

Yes but why would it return "Put" if I have a gun ?

#

It is really strange, in my debug console, currentWeapon player returns "hgun_P07_snds_F"
But in the HandleDamage EH, it returns "Put"

high horizon
#

is it vanilla character?
@young current Yes

young current
#

@compact maple that I dont know of.

high horizon
#

@young current i cannot define a lod

compact maple
#

Mh alright thanks

young current
#

@high horizon yes you can

high horizon
#

@young current True, I thought you were saying something else. The "chest" selection in which lod is it?

young current
#

dunno

#

maybe there is no such selection

#

if selecetion is not there it gives out the 0,0,0 coordinates

#

of the model

high horizon
#

@young current No chest in any lod

young current
#

then you need to try something else.

#

use selectionNames to figure out what the names are

high horizon
#

I think im gonna use "head" selection and then move with ctrlsetPosition

young current
#

also note that it might be "head" or "Head"

#

not sure if they are case sensitive

burnt cobalt
#

does anybody know how exactly a waypointscript is executed? Is it on every machine (as is ie waypointStatements) or only on the machine owning the group?

winter rose
#

it is explained on the wiki somewhere, check the "waypoint" page @burnt cobalt

#

While Condition code is evaluated on the group owner's machine, OnActivation code is executed globally, a.k.a on every client!

hm, as for the

waypointscript
, I don't know… tests should be made

tough abyss
#

is there a guide to remoteExec

robust hollow
tough abyss
#

I mean a bit more indepth, I get the gist but I'm pretty slow to this stuff

robust hollow
#

what kind of depth are you looking for?

glass zinc
#
 _vegs = nearestTerrainObjects [player, ["tree"], 50];  
{  
 _x hideobjectglobal true;  
 _x setDamage 1;  
} foreach _vegs;

will allow me to remove the tree I want, but when i put in the trees classname I cannot remove it. Why? im trying to remove only specific trees from Tanoa. but every known method i try will not work

#

I have used all methods i could find on the BI forums, but when i try to remove the tree type by its classname or ID number it will not remove.

#

i dont want to delete all the trees I just want to trim the forest.

#

I have tested my remove method vs other objects on the map IE benches and scrubs etc

#

and the scripts will remove those objects just fine

#

but the trees will not go if i try to remove them by type

robust hollow
#

i dont know about tree classnames, but in my limited tree experience, this is how i would do it (changing the string to the model you want, of course)

private _vegs = nearestTerrainObjects [player, ["tree"], 50];  
{  
    if ((getModelInfo _x#0) == "t_cyathea_f.p3d") then {
        _x hideobjectglobal true;  
        _x setDamage 1;  
    };
} foreach _vegs;
grim wing
#

for CfgSounds is the max volume 1 or can you go past 1

robust hollow
#

i dont know for sure, but i imagine you can go above 1 because the playSound3D command (which takes a filepath instead of a class) allows going up to 5.
https://community.bistudio.com/wiki/playSound3D
Since A3 v1.91.145537 the maximum volume allowed is 5. Exceeding this will result in sound not being played when executed remotely.

glass zinc
#

@robust hollow thank you that works, gives me a good place to start

upper seal
smoky verge
#

having an hard time disabling eventhandlers

addMissionEventHandler ["Draw3D", {call {
if (cameraOn == player ) exitWith {player switchCamera "Internal"};
if (vehicle player != player) exitWith {player switchCamera "gunner"};
}}];```

I though the correct way to disable this would be 
```sqf
player removeEventHandler ["Draw3D", 0];

but it doesn't recognize Draw3D

robust hollow
#
removeMissionEventHandler ["Draw3D", 0];
#

it is a mission event, not a player event

tidal ferry
#

Righto, so!

#

I've been toying around for the past 3 hours trying to make a James Bond-style submersible car

#

I've managed to get it so that it either works as an amphibious car (with simulation = "car";) or that it works as a submersible (with simulation="submarinex";)

#

But not both

#

Any way to get an amphibious car to sink using normal functionality?

#

I started looking into it as a meme with my unit but now I'm curious to see if I could get one working

glass zinc
#

make it a vtol that cant fly and does not die from water dmg? :S

#

or has a max alt of ground level or something, whatever you do its gonna be complicated

hallow mortar
#

try looking at how amphibious IFVs are configured?

glass zinc
#

I was able to get me tree removal script working well. is there any way I can add a % method so that I can choose to remove only a % of the trees in question instead of having to remove them all?

if (isServer) then {  
if (worldName isEqualTo "Tanoa") then { {      
if (      
(toLower(str _x) find "t_ficus_medium_f.p3") >= 0 ||      
{(toLower(str _x) find "t_palaquium_f.p3d") >= 0} ||        
{(toLower(str _x) find "t_ficus_big_f.p3d") >= 0}     
) then {_x hideObjectGlobal true; _x enableSimulationGlobal False; }      
} foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree"], worldSize, false]);   
};  
};
robust hollow
#

something like this perhaps

if (isServer) then {
    if (worldName isEqualTo "Tanoa") then {
        private _trees = nearestTerrainObjects[[worldSize / 2, worldSize / 2], ["HIDE", "tree"], worldSize, false] select {
            tolower(getModelInfo _x # 0) in ["t_ficus_medium_f.p3d","t_palaquium_f.p3d","t_ficus_big_f.p3d"]
        };
        _trees = _trees call BIS_fnc_arrayShuffle; // randomize so it isnt the closest x% that get removed
        _trees = _trees select [0,ceil(count _trees * 0.70)] // 70%
        {
            _x hideObjectGlobal true;
            _x enableSimulationGlobal False;
        } count _trees;
    };
};
glass zinc
#

ok thanks ill give that a go

opal sand
#

Guys, let me ask you all a question here, so, (it may not come out so articulate, so please bear with, as knowledge is limited)

#

AI and Scripting, or AI enhancement is possible to get to the 'preferred utopian state', so ive heard, but what causes all of the limitations in dev? is it engine side? arguments? FSM? can someone explain to me in laymans terms plz?

hollow pier
#

Guys anyone have a COOP script on ready ?

#

@robust hollow I saw your script buddy, do you have a COOP script in ready ?

#

and sorry for the tag

robust hollow
#

which script? i have more than one.

hollow pier
#

ohh

#

there we go

spiral fractal
#

what is the right way to override mod? I made some changes to the advanced sling load script and I want to replace 2 functions there

#

btw, is there fixed version for this script that can lift wrecks?

lost copper
#

Guys anyone have a COOP script on ready ?
@hollow pier sounds like a car script 🤔

robust hollow
#

sounds like the car script

lost copper
#

or anything, @robust hollow

sage flume
#

in other words (for an old timer) what exactly does .....

#

mode: Number - (Optional, default -1) position check mode (ALWAYS USE DEFAULT VALUE)

#

mean

#

regarding

robust hollow
#

The second element must be -1 (≤ 0 really) at all times, otherwise command becomes unusable

sage flume
#

ok, 👍 ....so I'm using this....

#

_fe = (count (_pos isflatempty [0,0,0.25,35,0,false,objNull])) > 0;

#

which is a bit different,

#

still the same?

robust hollow
#

change the second element to -1

#

_fe = (count (_pos isflatempty [0,-1,0.25,35,0,false,objNull])) > 0;

sage flume
#

good deal, the first number if I want this array to tell a small group of objects to spawn and I need an area of about 25', I should enter 25 (or 30) to it room?

#

like a check point composition

#

lastly, in my array, how can I divert from objnull to say no object closer that 1m

#

from the biki the first number says "object no closer than ? from player, but the objNull seems to say the same thing...

#

🧐

winter rose
#
_pos isFlatEmpty [
  0,      // minDistance
  -1,     // mode
  0.25,   // maxGradient
  35,     // maxGradientRadius
  0,      // overLandOrWater
  false,  // shoreLine
  objNull // ignoreObject
];
#

from the biki the first number says "object no closer than ? from player, but the objNull seems to say the same thing...
the wiki does not mention player at all for the first parameter. ignoreObject is here to say "don't consider this specific object to check if the area is empty"
@sage flume

sage flume
#

@winter rose ok, so really it's the first number looking for an empty space that's doing all the work so to speak

winter rose
#

minDistance should perhaps be named "emptyRadius" yes

sage flume
#

very nice. sorry to continue on and on about this but I am working with Cambodia and I'm being my OCD self with as much accuracy as possible

#

thanks a lot

#

helpfull

winter rose
#

np, this channel is made for that after all ^^

sage flume
#

I know but you seem to be here 24 hours a day,....grateful

loud python
#

I'm totally lost

_target playMoveNow "AmovPercMstpSsurWnonDnon";
_target playMove "AmovPercMstpSnonWnonDnon";

This works as expected

_target playMoveNow "AmovPercMstpSsurWnonDnon";

for "_second" from 1 to _robberyTime / _tick do {
    private _progress = _second / _robberyTime;

    if (!alive _target) then {
        // Some cleanup stuff
    };

    sleep _tick;
};

_target playMoveNow "AmovPercMstpSnonWnonDnon";
hint "got here"

This, however, doesn't work for some reason; The NPC just stays in the animation and the hint gets shown.

#

am I missing something?

#

Replacing the whole loop with just

sleep _robberyTime;

also causes the NPC to stay with his hands up

winter rose
#

I'm totally lost
mandatory "Hi lost, I'm dad!"

#

if _robberyTime equals 0, you get a division by 0 error. where are your variables defined? when is it supposed to fire? what are you expecting it to do? who killed JFK?? SO MANY QUESTIONS

loud python
#

nope, it's 10 seconds

winter rose
#

did you tick the show script errors launcher checkbox?

loud python
#

dunno; it's been showing me errors so far though, so I assume yes

#

also the script continues to run, as the hint gets executed

#

a simpler example that still doesn't work:

_target playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; // Hands up
sleep 3;
_target playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; // Hands down
#

_target being the NPC, of course

winter rose
#

mods?

loud python
#

nope

winter rose
#

where do you execute this last example?

loud python
#

part of a function that gets spawned as a hold-action

winter rose
#

dunno; it's been showing me errors so far though, so I assume yes
fix the errors first 😑

loud python
#

I did

#

I mean it's been showing me errors as I was building this script and I fixed them as they appeared

winter rose
loud python
#

like the commented-out if statement below the loop; just ignore that

winter rose
#

a simpler example that still doesn't work:

_target playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; // Hands up
sleep 3;
_target playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; // Hands down

works for me - except that you may have to switchMove to get out of the surrender animation @loud python

#

that's your simplest example??

loud python
#

_target switchMove "" kinda fixes it, but then the NPC is instantly standing still and the animation doesn't do what it should

winter rose
#

no, switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"

loud python
#

🤔 I'm probably reaching the point where I should eat something before I continue coding, but right now that seems like it would make sense...

#

doesn't explain why the sleep breaks things

#

but I'mma go with "if it works, don't question it" in this case

winter rose
#

I'm probably reaching the point where I should eat something before I continue coding
yes. don't code while sleepy/hungry/angry

also, try to boil it down to the smallest reproducible issue, so we don't have to get what works and what doesn't

loud python
#

well, the simplest example was that 3-liner up there

winter rose
#

and the 3 lines stuff works for me

if the sleep breaks things, you may be running your code in an unscheduled environment.

use sqf hintC format ["can suspend: %1", canSuspend]; to see if you can use sleep or waitUntil

loud python
#

there's a 10 second delay in the script (for sleep 10), so I'm pretty sure that's not the case (also I know that I'm spawning the code)

#
_ = this spawn {
  sleep 1;
  _this playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
  sleep 3; 
  _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
};

Putting that in a units init field has the same effect; hands go up and never come down again

winter rose
#

that's what I told you,

you may have to switchMove to get out of the surrender animation

#
this spawn {
  sleep 1;
  _this playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
  sleep 3; 
  _this switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
};```
loud python
#

yes, I just don't understand why 😂

#

btw. I tried it in the actual script and it works, thanks for the help 😄

#

but isn't playMoveNow supposed to do exactly that? End whatever animation is going on and play the new one? 🤔

winter rose
#

playMove* need a configured transition animation
the hands up anim seems to not have any exit animation configured, maybe so AI would stay in it whatever happens.

loud python
#

hmmm... makes sense, I guess

#

one more (unrelated) question: is there something similar to an elseif, or do I have to put an if inside the else block?

fading dock
#

Any one have the script to prevent termination due to DLC on a modded map?

still forum
#

@loud python if inside else block, no elseif

loud python
#

ouch

winter rose
#

but @still forum will add that in the next hotfix.

still forum
#

I added that in Intercept-CBA

#

but its horrid

winter rose
#

I was already running away

@loud python if you have ten thousand cases, use a switch

loud python
#

I know, in most cases that's an option; it just seems like there might be cases where an elseif construct is the only reasonably simple way to express something

winter rose
#

rarely, but yes

loud python
#

unless your switch-statements are as versatile as in Ruby, it's not that uncommon in my experience, but game scripting might just be a domain where it's much less common than elsewhere

winter rose
#

you usually cut down your functions for each of them to have a single responsibility (first SOLID principle); I do, but rarely encounter the need for an else if

loud python
#

well, SOLID principles are only really meant for OOP anyway; but yeah, the single-responsibility-principle should be applied here too

#

but just because it doesn't happen often doesn't mean it never happens 😉

winter rose
#

yep, I admit encountering a case sometimes
but rarely

#

if it doesn't exist, heh

if () then {

} else {
  if () then {
  };
};```
urban tiger
#

Very odd question, anyone know a way to disable the ability to 'aim' and most importantly the ability to look up and down in general

smoky verge
#

@urban tiger you still plan to move around?

urban tiger
#

@smoky verge Yeah, kinda like 'resident evil' style. want to try something

smoky verge
#

maybe some keydown eventhandler for mouse up and mouse down

urban tiger
#

actually metal gear solid is a better example

smoky verge
#
can6 = _grp createUnit ["B_RangeMaster_F", position ass];

I'm getting an error
2 element provided, 5 expected
what does that mean exactly?

winter rose
#

none are optional, unlike createVehicle

#

@smoky verge ^

smoky verge
#

and creteVehicles is not for units I guess

winter rose
#

we have a winner!

#

yep, nope - unless you want a brainless unit of course

smoky verge
#

technically I do

#

I just need it to be able to die

winter rose
#

well then, if you don't need it to move you can just do that 😄

finite sail
#

morning guys, does anyone have experience with forcing animations on players?

#

when I use switchmove (into the hostage anims) the player sometimes becomes invisible to himself

#

sometimes not

#

the switchmove is run from a client side script

#

hes visible on host/player

#

other clients can see him, he's just invisble to himself

#

ive tried remoteexecing the switch move everywhere, doesnt seem to make any difference

winter rose
#

and in Eden Editor, does the player become invisible?

young current
#

is hostage animation vanilla?

winter rose
#

oh yeah that too
@finite sail ↑ ?

finite sail
#

yes

#

Acts_AidlPsitMstpSsurWnonDnon_loop

winter rose
#

yes to both?

finite sail
#

cant check in edeneditor, tis is all done in script in mission

young current
#

it is possible its not meant to be played on player so it might have issue where the animation gets too far from the origin of the character

winter rose
#

then boot an eden session and use the debug console, you will know

#

because ^ what HC said

finite sail
#

yeah

#

its the occasional aspect of the issue that annoys me, sometimes it works, sometimes not

#

when you say, do it in EE.. load the mission into the editor, and in debug, exec the switchmove command

#

should i watch for the unit to animate immediately,

#

or start the mission?

#

mission loaded into ee, execd the switchmove on the unit, nothing happens

winter rose
#

no, just play the animation on player

#

just that, debugging is "strip the issue to its simplest and figure out what's wrong"

sage flume
#

so I spawn in with random headgear, not always appropriate for the mission theme, I have this removeHeadgear _unit; to remove headgear. How can I write another line to force me to wear a certain item such as a bandana?

winter rose
sage flume
#

removeHeadgear _unit; something something proper grammar

winter rose
#

linkItem?

finite sail
#

it works when locally execd on player

winter rose
#

and you don't get invisible to yourself?

finite sail
#

no

winter rose
#

in 3rd person?

finite sail
#

yes, still visible in 3rd

#

and 1st

winter rose
#

first person will always be visible
3rd person, try multiple times with multiple animations,
but I don't think the remoteExec is at fault here.

finite sail
#

i agree, i dont suspect the remoteexec either

winter rose
#

perhaps it depends on terrain slope too (character moving further away from the camera)

finite sail
#

mmm yah, that could explain the occasional aspect of the issue

#

player is setpos'd to a distant building

#

then anim'd

#

(other players are tasked with rescuing him)

#

hes put inside the building, always a floor above ground floor

#

so he's on level surface

winter rose
#

walls, perhaps

finite sail
#

yeah could be, the script chooses a tall building, then chooses a buildingpos that it not outside or on ground floor

#

so it is often a little tight for space

#

but ive always seen anims very happy to clip through wall geo

#

without any problems

#

im gonna try playmove, see if letting the character do the whole anim will help. though playmove isn't affectsglobal, so i will have to remoteexec it

#

switchmove claims to be arguments global and effects global

#

playmove is effects local

winter rose
#

no

finite sail
#

correction, swtichmove is args local

#

effects global

winter rose
#

yup

finite sail
#

🙂

winter rose
#

We work the wiki enough, dang it! :v

finite sail
#

hehe

#

the script is run from a client side script, not remoteexecd, not that I suspect that is the issue as I was having it when I WAS remoteexecing it from the server

#

its more likely to be a netcode unsync issue

#

anyway, ill try playmove

#

brb

surreal peak
#

Just want to check, since im helping a friend optimise some code, having a

while {true} do {};

statement is not a good thing, he's having trouble with only having like 1 FPS on the server

#

Also someone told me a while ago that using spawn to delay things with sleep is also not the best idea

winter rose
#

well, just sqf while {true} do {}; is obviously and useless and resourceful yes 😅
it all depends what is inside the do

surreal peak
#

he was having an if condition checking for a variable and then acting on that variable

finite sail
#

bah, playmove is no better.. will try the setpos before the anim

winter rose
#

@surreal peak while { sleep 1 ; true } if possible

sage flume
#

removeGoggles _unit; so this actually covers all facewear?

finite sail
#

not nvg

sage flume
#

or should I say "removes all facewear"?

finite sail
#

nvg is different

sage flume
#

it always is for some reason. I hate those cause I can't get rid of them on some of my ports

winter rose
#

removeGoggles removes everything defined as goggles yes

sage flume
#

This project is working ok but I will work on my other one later

#

Tk's

rotund aurora
#

anyone has a kind of "login camera skript" so the camera moves from above into the char like gta does?

surreal peak
#

How would I go about stopping animals from walking through objects like walls?

winter rose
#
animal setDamage 1
rotund aurora
#

thx :)!

finite sail
#

ok, i got it sussed 🙂

#

its the setpos of the player to the buildingpos.. that must happen before the anim

#

if switchmove .. setpos... player becomes invisible to himself

#

if setpos (short sleep) switchmove.. he can see his own model in both 3rd and 1st

#

we were rigth not to suspect the remoteexec 🙂

winter rose
#

oooh, neat to know indeed

finite sail
#

yeah

surreal peak
#

@winter rose D:< Is there a function which says if there is a wall infront of someone?

jagged wing
#

So ive got a cargo plane that i want to take off only when its full, but i dont know how many players are going to be in the server. Any advice

surreal peak
#

when the cargo plane is full? Or when all players available are inside of it

jagged wing
#

When all availible are in

winter rose
#
private _isEveryoneAboard = allPlayers findIf { !(_x in _myPlane) } == -1;
```@jagged wing
#

@surreal peak it's all about AI and detection, you could check something with lineIntersects though

jagged wing
#

@winter rose and that goes in the init

surreal peak
#

ty Lou, Time to make the worst AI imaginable

jagged wing
#

How would I set a Boolean to be true when a certain npc dies

loud python
#

quick question: Can I do something like this?

private _variable = "I'm in outer scope ;P";
private _subroutine = { _variable = "I'm still visible here" };
[_some, _other, _arguments] call _subroutine;
winter rose
#

yep

#

it will edit the outer scope variable

loud python
#

hmmm...

#

there's no real lexical scoping though, is there?

winter rose
#

what do you mean?

loud python
#

I assumed that was mostly for if, for and other such commands

#

dunno, is there even a distinction between those and call?

#

in many languages subroutines and blocks are clearly distinct

winter rose
#

C#, JS, Java, all have sub-scopes using upper-scope variables

#

if you want the same name but define a new variable, use private

#

call executes the code in the current scope
to have a new scope (and a new handle), use spawn

loud python
#

Yes, they're all dynamically scoped languages

winter rose
#

now if we are talking about Pascal… :p

#

I can only speak for the languages I have used (…and PHP)

loud python
#

oh pascal has pretty much the same scoping model as C as far as I remember, except that you can define parameters as call-by-reference

#

SQF though... I don't know, maybe I just need a good tutorial

winter rose
loud python
#

it doesn't do closures though, right?

private "_subroutine";
call {
  private _inner = 3;
  _subroutine = { hint _inner };
};
call _subroutine;

This doesn't work, right?

winter rose
#

I suppose it should, _inner might be defined in the upper-scope

#

it's like doing```sqf
private "_subroutine";
private _inner = 3;
_subroutine = { hint _inner };
call _subroutine;

loud python
#

shouldn't _inner just be defined in the scope of the code block being called though?

#

so after call returns, _inner should be out of scope

winter rose
#

call doesn't create a scope; it uses the one it has been called from

loud python
#

Example 4 disagrees though 🤔

winter rose
#

it's… special.
I think that's the very distinction we are hitting here
let me check in Arma before asserting other things

#
private "_subroutine";
call {
  private _inner = 3;
  _subroutine = { hint _inner };
};
call _subroutine;
```doesn't work indeed @loud python
#

undefined variable _inner

loud python
#

hmmm... sort of looks like dynamic scoping

winter rose
#

(and of course, the following works)```sqf
private "_subroutine";
call {
private _inner = 3;
_subroutine = { hint str _inner };
call _subroutine;
};

winter rose
smoky verge
#

yeah that was my second question
I guess that only works in configs and not inits?

winter rose
#

yup, you would only be defining a global variable here