#arma3_scripting
1 messages · Page 582 of 1
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.
hmm will com back to that gotta go for now thanks for help tho
if I want to execute moveInCargo in remoteExec what number should I set in target param?
believe it is where the unit is local
so, [unit,veh] remoteExec ["moveInCargo",unit];
everything works but when I test on dedicated, its not, and idk how to debug it 😐
check ur server rpt file for errors or warnings
What does the CFUNC macro do?
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
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
Terrain making? whole other beast, nothing to do with scripting
I am really after recreating the darkrp small map experience in arma ngl
Modding capabilities >>> gmod
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
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
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
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.
//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)
?
Is that in the base script_component?
Thanks @robust hollow didn't think to trawl the GitHub, just went through the linked documentation from there.
👌
@jaunty dock re: the scripting language
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
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
You'll need to enable filepatching
and you cannot edit .pbo files while they're in use.
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
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.
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.
could loadFile help?
Just tried - also locked. It may be easiest to use the extension to reload scripts in my case.
yep. That or database
ok little help here if i place an ai unit in the editor what is its group name
Alpha 1:1 usually
if you click on the leader, there is a symbol over his head - you can double-click that
so that is the group name for scripting purpouses then
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
so in its init field of group i put group _name_goes_here
no.
What do you want to do? in human words
i just want to know the name of the group so i can use it for part of a script
open the group properties, and in variable name, put "mySuperGroup"
this will be the reference name to this group from now on
yw.
will a detected by trigger not loop ?
if you set it to repeated, perhaps
hmmm for some reason its not re triggering
maybe it needs to not know about enemies first, before re-triggering.
ahh i see im not deactivating the trigger
wildlife affect fps? will it help if I disable it in mission enableEnvironment [false, true];?
well yes, they have to be calculated
they don't cost much in term of performance though
see https://community.bistudio.com/wiki/Mission_Optimisation for the most impactful settings @spiral fractal
Thank you!
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.
whats the script command that i would use if i wanted to have a task complete by having the player look at a location
@vague geode see getPlayerUID for Steam ID
@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?]
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 ^
You could save information to the players profile
not recommended, prone to player's edition
@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?
I don't know. I only know that extdb2 or 3 are used solutions for Arma permanent servers
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
Welcome to the wonderful world of scripting… there is no exit
I shall call it the recon script cansee=[objNull, "VIEW"] checkVisibility [eyePos player, eyePos unit1]; if(cansee==1) then {true};
You could save them server-side (something like missionNamespace setVariable ["%PlayerID_CP", 0, ...] and then send that to the client if it reconnects
your code returns true or nil @tough abyss
([objNull, "VIEW"] checkVisibility [eyePos player, eyePos unit1]) == 1 // returns true or false
hmm me no understand all i know is it worked when i tested it
Just wanted to share:
Working on a script to export activity in a mission, into Tacview. Great progress so far
Simply place your description with your link @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
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?
Sure, https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting @steel star
@winter rose Thanks!
@steel star KillZoneKid's blog also has a few in depth posts on things like variables that are broadly useful.
Yeah i had a look at it i don't think I'm smart enough for scripting aha thanks anyway though
Basically, the article I posted above and (already listed in it)
- https://community.bistudio.com/wiki/Variables
- https://community.bistudio.com/wiki/Identifier
First paragraphs of https://community.bistudio.com/wiki/Code_Optimisation - https://community.bistudio.com/wiki/Code_Best_Practices
and some code examples:
https://community.bistudio.com/wiki/Category:Example_Code
with that (each day a bit) you are very fine. and of course, practice makes it perfect!
@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.
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
any suggestions for a practical use of the pseudo random noise texture (https://community.bistudio.com/wiki/random Alternative Syntax 3)?
spawn chances of grass patches for example
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
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
This is how the items are added to the unit, in case it helps https://pastebin.com/pqc0XZxe
#include "autoEquip.sqf"
```_holy molly…_
@radiant spindle maybe try to addMagazine handgrenades instead of addItem?
(uniformContainer _unit) addItemCargoGlobal ...
``` `addItemToUniform`/`addItemToVest`
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? 😅
it's awful?
either make one file, or make another function that returns the loadout but don't do that ^^"""
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 😅
one of you deserves a paddlin', decide quickly whom 😄
first thing first, make it work properly
cleaning up is when everything is in place
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
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?
the official forums are open yes, as well as the wiki
Forums: https://forums.bohemia.net/forums/forum/161-arma-3-editing/
Wiki: https://community.bistudio.com/wiki/
@light moat
Thank you!
Hello! Is it possible to use diag_activeSQFScripts to find and terminate a script execVMed from a specific filename?
Understood, thanks)
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
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
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
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
I see. Not sure there's an easy way to do that.
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.
Possibly you could use the sideEnemy and use setFriend to make them friendly with BLUFOR
That might just break stuff, also.
That might just work.
I'll report back once I try it
Hmm, sideEnemy is enemy of sideEnemy
Damn sideEnemy
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
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
@sage flume have you tried ```sqf
clearItemCargoGlobal _ammoCrate
bruh what did you just make me watch
It's either a spambot or an idiot. It's posted in pretty much every channel.
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
Like I said, might break something, or otherwise result in unexpected behavior, but it's probably worth a shot.
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 😄
But it looks so dirty 😭
be sure to check https://community.bistudio.com/wiki/Side_relations
@potent dirge do I put this in the init of my mission?
clearItemCargoGlobal _ammoCrate
No
init fields exec for every player connecting, so it would clear your box mid-mission if someone were to connect
@winter rose The mission is a SP,...does that matter?
not at all then 🙂
Thanks !
Sorry, coding reflexes
I get an error when I try this...
17:41:21 Error position: <_ammoCrate>
17:41:21 Error Undefined variable in expression: _ammocrate
😟
clearItemCargo this
I'm such a rookie,
that's how one learns!
DO I need a ;
nope
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?
it might very well be possible that it's impossible, yes
I could totally see sideEnemy not being changeable like that.
Best bet's probably to use Civ
also, sideEnemy is enemy to sideEnemy, too
yeah I tried messing with setFriend to see if that could fix that, but can't change any relations to and from sideEnemy
https://community.bistudio.com/wiki?title=Side&oldid=137006
maybe "Special sides" are not as scriptable as the normal ones (blufor/opfor/indep/civ)
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
be sure to check if the group is created before joining it
you may need to createCenter manually, if it works
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
with pleasure
but yeah a "new side" is some kind of unreachable Eldorado… and a Pandora's box as well
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)
Hello,
can anyone recommend a nice clean script that can reduce damage to a single vehicle, or increase it's health?
@coarse sedge this addEventHandler ["HandleDamage", {(_this select 2)/DAMAGEREDUCTION)}];
ty, and is there a way to tune it up and down abit?
. /1 is 'defualt' /10 would mean it has '10 times' more health
got it, thanks man!
"division by zero" incoming
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
If there are any YT videos about SQF/Arma then it's most likely from the Arma 2 times...
@exotic flax just noticed that haha
@urban tiger and to reduce the health in half this addEventHandler ["HandleDamage", {(_this select 0.5)/DAMAGEREDUCTION)}]; will work?
best source of information is wiki, forums, (this) discord and public repositories of other projects
@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)}];
addEventHandler ["HandleDamage", {(_this select 2)/0.5)}]; to double it's health then?
double damage
😬
^ doubles the damage
@exotic flax that ashame although some of the arma 2 stuff is still relevant
well yes, although a lot of "features" have been fixed or replaced by improved functions.
if i put 0.5 instead of 2 what kind of an effect would that have?
damage = value / 0.5 = ?
doubles its damage taken
i'm sorry, 2am here. i read the whole thing again and i understand
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"
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
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 🤷♂️
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!!
@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.
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
@fading barn That worked thank you very much!!
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
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
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
any reason why this switchMove "animation"; works in singleplayer but not in multiplayer?
locality issue?
@smoky verge given I see you using this, I assume this is in an init field?
bad Sanchez, bad
oh I don't do that on a daily basis, just looking for ways to animate a large amount of units
Remote exced has global effect so it should work
just don't do it in the init
Because init is executed for every player
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?
singleplayer is fine
you can try to do ```sqf
if (local this) do {switchMove stuff};
I can try with the hard way and fiddle with a forEach and switchMove
Oh btw
did you disable some of the AI's features? Like move, anim, target etc?
That might cause them to exit the animation
nope
interesting
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)
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
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
so you mean, unit 1 could be seen as "John" by player1, and "Bob" as player2?
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
_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
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.
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"
but that would mean the name would have to be defined for every single ai.
you could do ```sqf
private _name = name _unit;
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;
};
};
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)
is _unit a predefined variable like '_this' ?
no, you have to define it yourself
Can someone explain to me why this code doesn't work?
this addAction ["Rifleman", { setUnitLoadout "rifleman" }];
I'm having an issue creating an ORBAT, and I'm hoping this is the right channel
@languid steeple you do not respect the setUnitLoadout syntax
@tough abyss it may
Have you checked this page?
https://community.bistudio.com/wiki/Arma_3_ORBAT_Viewer
Yes
What is your issue then?
I've written up a basic ORBAT, and when I test the scenario I get [BIS_fnc_ORBATGetGroupParams] Class not found
written in Description.ext/class CfgORBAT?
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?
I'm not sure, I followed a video tutorial that I found on the Bohemia forum
@languid steeple use the addAction script parameters shown in https://community.bistudio.com/wiki/addAction:
{ params ["_target"]; _target setUnitLoadout "rifleman"; }
@tough abyss ¯_(ツ)_/¯
compare with the page what is missing
Alright
I fixed it
I think my problem was not putting spaces in-between the "="
Thank you, Lou
That can't be the source of the error, but you may have changed something else in the process 😉
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
oh okay
but really, in config```cs
myValue=1;
// and
myValue = 1;
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
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)
The locality stuff always was a dark magic to me.
can I recommend a good read about it? ^^
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"; }];
can I recommend a good read about it? ^^
@winter rose idk, can you?
See https://community.bistudio.com/wiki/Multiplayer_Scripting#Locality @thorn saffron
basically, AIs are local to the group leader's machine (server if leader is AI)
players are local to their machines
empty vehicles are local to the server
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.
empty vehicles
Yes
I think (thought?) locality was given back to the server 🤔 would have to check
no, you're pretty sure 😋
*no, you're pretty sure 😋
@winter rose if i was using private _name = name _unit; it would go back to every unit that is spawned being defined
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
execute multiple times?
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?
👋 hi
ofcourse but that would then have to be a loop running constantly.
I… huh… no.
don't mix it with while
Would that involve me putting down multiple ORBAT group modules?
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?
@tough abyss I don't think so
@urban tiger
- have an independent function dealing with the score and setting it to the unit with
setVariableon change - with your drawIcon3D stuff:
2a) get all the units to be drawn (close & on screen)
2b)for eachthese units:
2ba) get the unit's name
2bb) get that score variable
2bc) draw the icon/text
is it possible to remove all ACE interaction menu items from object?
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
I think you will have to use remoteExec
but it's in an init field
i thought remoteExec only applies to sqf scripts in the directory
a method to call them.
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...
did you name the tank in the editor?
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
@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)}]; };
you don't need to call it
literally just this addEventHandler ["HandleDamage", {(_this select 2)/2)}];
in an Eden field, you need to do something like 0 = /*moy code */ if the code returns something.
@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 😂
If I can help ^^
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)}];
same error msg
which is… ?
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?
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
@winter rose error missing
@robust hollow, ACE is added as a mod. Doesn't ACE define it by itself?
@high horizon only draw if the line of sight isnt obstructed. lineIntersectsWith command or something.
@coarse sedge error missing →(…)← ?
@tough abyss you need to include the macro file into your own scripts still
will try, thanks
@winter rose it pops out the text from that event handler and at the bottom error missing ;
nothing else
; might be the useful part of the message yes
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?
check ur rpt for errors
@robust hollow @winter rose ok this was embarrasing 😅 annoying ).
error msg is gone, im will go and start testing. thank you both
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.
while {} not while ()
↑
Thanks
aaalso, O_Heli_Light_02_unarmed_F → "O_Heli_Light_02_unarmed_F"
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
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
is that just an over complicated waituntil?
Maybe
totally
waitUntil {typeOf objectParent _Leaderman != "O_Heli_Light_02_unarmed_F"}```
\o/
Thanks again lol
check ur rpt for errors
@robust hollow Ok let me check, on arma3 error says "Resource not found"
no error on rpt @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
@proud carbon https://community.bistudio.com/wiki/objectParent#Examples
waitUntil { sleep 1 ; isNull objectParent _leaderman };
↑ checks that the unit is on foot.
@robust hollow of course, with the same name as i call it
I can send you the code on dm
sure
Any ACE dev onboard by any chance? I use ACE in my mission and need to know how to get numbers from variables stored in Kestrel item for my own script, for example this one:
private _temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
It's taken from here:
https://github.com/acemod/ACE3/blob/master/addons/kestrel4500/functions/fnc_generateOutputData.sqf
Is it even possible?
_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
where is the script of "on activation" of waypoints executed? all clients or server/host only?
marco's will most likely cause some issues, although you can include the macro file(s) of ACE to access them.
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?
wind direction and speed SHOULD be global (is actually defined by terrain and mission settings)
ace temperature is quite dumb for a lot of maps. 16 degrees in takistani desert and + 12 on snow maps
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
afaik does ACE not do anything to weather effects other than taking them from vanilla Arma functions (eg. wind and windDir methods)
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.
are you sure? i think ace might overwrite windspeeds depending on height terrain, but im not sure
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)
all "features" can be found in https://github.com/acemod/ACE3/tree/master/addons/weather/functions
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"
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
While Condition code is evaluated on the group owner's machine, OnActivation code is executed globally, a.k.a on every client!
¯_(ツ)_/¯
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
and since it's not a scripting issue, but #arma3_config or #arma3_gui (afaik)
@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.
how can I repair a destroyed building via debug menu?
not easily I'm afraid
can i delete it and spawn another in its position?
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)
i tried cursorObject setDamage 0 but it doesn't work because a destroyed building is a type of its own
yes, a ruin is spawned
no reference to the previous building though?
no
the previous building is under the ground
there are also locality issues and.. ugh..
can u fix it !1!
maybe if i can get the camera underground but yeah i wont solve it for mp probably
anyone have any cool scripts for a life server or know anywhere to get them
Made them yourself, there are a lot of ressources to begin scripting (altough begining with/for L*ife is not a good idea).
PS... Don't steal like other "Life" missions/servers
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
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.
issue isnt playSound
say3d wants to be local anyway, thats not the problem. The EH is the problem
Fired only fires when applied to a local unit
also Fred, if I rename it to _caller i dont need the _this select 1 do I?
if its added via an addAction though, it should be added to the person who selected the action, therefore making it local, right?
You are applying it on the target right?
Ah I see it now. The select commnd through me off. On mobile so it's kinda hard to read
one person should be able to have the EH, while another doesn't
i'll edit it one sec
edited
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?
may also be an issue with weather the target is known or not
yea, saw that on the wiki page
if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]; systemChat "hit!"}
player addEventHandler ["FiredMan", {if (cursorTarget iskindof "man") then {cursorTarget setHit ["head", 1]; systemChat "hit!"}};]; is that correct?
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
Depends on the context but Ideally player wouldn't be used yeah.
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;
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.
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
arma in a nutshell
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?
_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
damn
18:04:09 "_utcTime Type: STRING"
this is how you know it is bed time, thank you so much!
worked perfectly 
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
it should work if you spawn the object with can_collide and immediately disable simulation
Just add ```sqf
player enableSimulation false;
Replace "player" with the handle I want?
there is disableCollisionWith but its a bit more fiddley than its worth imo.
yea sqf _obj = createvehicle ...; _obj enablesimulation false;
Just as I imagined ^^ will have a look thanks mate. Idk why I forgot about it being a thing
you may want to reset the position after disabling simulation, but itl most likely be fine without
👍
Is there a command to get camera vector or should I just use positionCameraToWorld [0,0,0] vectorFromTo positionCameraToWorld [0,0,1]
They're... not quite the same. vectorDiff between the two gives [0.000212908,-8.65683e-005,-0.00806219]. Is that rounding error?
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.
For sim vs. render see:
https://community.bistudio.com/wiki/Simulation_vs_Render_Time_Scope
how can I remove all ace interaction commands from object?
[this, this] call ace_common_fnc_claim; seems to work
Hello!I try to get the Server FPS, but it just returns "" - any ideas?
_fps = remoteExecCall ["diag_fps", 2];
_fps;
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 🤷♂️
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
you want to know the fps of connected clients?
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
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?
sounds good
@signal kite you been writing your own up or did you want my attempt at it?
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...
a few things to note:
- 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.
- 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.
- 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
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 😆
gotta run it in scheduled. running it through debug or from a function?
target debug
target debug?
target debug is cba, unscheduled
wilco
systemChat messages work nicely, but the *.rpt logging doesn't.
howso?
no lines are added to the *rpt file
servers
check urs
ah there they are
so it actually works?
yes, works perfectly fine - thx a lot!
😲 👏 even I'm surprised
and I learned about unique variable names and scheduled and unscheduled environment on the go! 🎉
🥳
I guess this undeniably proves that testing code is an unnecessary and complete waste of time. Should just write scripts and push to production 🙂
I see no issue with that, it is industry standard
Testing is doubting
is there a similar command like ctrlClassName for displays or isn't it possible to get the classname of a display?
Hi, does anyone know how to add player name to an array, like this array = ["R","u","b","i","o"]
_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.
@high horizon see https://community.bistudio.com/wiki/splitString
@thorn saffron as you did
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
systemChat str _soldiers; // displays what?
@high horizon see https://community.bistudio.com/wiki/splitString
@winter rose thx!
@thorn saffron so?
Idk if anyone could help in here but here is my problem https://forums.bohemia.net/forums/topic/228876-move-if-players-are-in-vehicle/?tab=comments#comment-3404350
@winter rose On its own it works. When i use it it my script the values do not get updated and stay at 0.
Hi, does anyone know how to make RscEdit text to text format example: "my text"
What exactly do you mean @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
if you mean "the array is not updated" then yes, it is normal @thorn saffron
str _msg then
how exactly is a night vision defined? like, i want to check if player has a specific NVG, and if so remove it
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}];?
hmd player == "whatever" @fervent kettle
@unique sundial not working
Remove parseText
@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
like you were already told in tfar discord yesterday or so, send full rpt
Yep cause i thought it was TFAR bug but it isnt
So the mission is finished and everyone is kicked
@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
Make sure mission is running
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
So mission is running but rpt says game finished? What server console says?
What could be executed by one addon?
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
If mission is ended it should say so in server console too
No make FT ticket
where
tx
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?
https://feedback.bistudio.com/project/view/1/
@unique sundial where the hell is Open ticket button??? 😆 😆 😆
there is a New to Feedback Tracker or just not sure what to do? link… 👀
Edit query? @winter rose
see the star next to your profile pic? (:
Sorry my blindness
can someone tell me how to add sirens to certain vehicles based off classname
@high horizon nah it's really not obvious I admit
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
is this worth investigating? https://community.bistudio.com/wiki/BIS_fnc_garage
seems it likes to spawn in the water 🙂
@grim wing sqf if (typeof veh == "some_veh") then { playSound3D ["sound\file\path.wav", veh] };
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.
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")
@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"
ah right, thanks
Ty Talya will try that
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?
anyone know if ctrlCommit/ctrlSetFade can be called on the server? Its not updating for the player
what? you call it on the same machine that has the control.
can someone help me out and tell me why my server keeps rereading the mission file?
https://www.dropbox.com/s/5f40hox5tl1p42v/arma3server_x64_2020-04-24_22-43-34.rpt?dl=0
i fixed a bunch of errors
but still rereading it
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?
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.
yeah I don't think it will change anything as well, just good to know maybe
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
yes, you can use empty strings to skip elements in the array
hmd player == "whatever" @fervent kettle
@unique sundial I have put into a trigger conditionhmd player == "O_NVGoggles_urb_F"and_nvg = execVM "removenvg.sqf";into on activation. In my removenvg.sqf i have putplayer removeItem "O_NVGoggles_urb_F";but it doesnt work
@fervent kettle unlinkItem
here a work around for spawning on the carrier (Nimitz or Freedom) if the player is in the middle of the deck: https://pastebin.ubuntu.com/p/JRFx6cJmjg/
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;```
working sample code: https://pastebin.ubuntu.com/p/rN7kt76nQV/
@round scroll
This is what your looking for
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/ScriptedEventHandlers#Events
thanks!
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?
Well, _windGradientEnabled variable is not defined
Try checking ACE documentation on this function?
Is it something among those in the website? Cannot find anything more about that...
https://ace3mod.com/wiki/feature/advanced-ballistics.html
no
https://github.com/acemod/ACE3/blob/master/addons/weather/functions/fnc_calculateWindSpeed.sqf#L34
you are calling calculateWindspeed yourself right?
you need to pass the correct parameters
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 !
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.
Damn how did I miss it, thanks!
how can i change this to ace arsenal ? this addAction["Virtual Ammobox", "VAS\open.sqf"];
Any memory point on player leg different to "leftfoot"??
see https://community.bistudio.com/wiki/selectionNames @high horizon ?
@thin goblet check https://ace3mod.com/wiki/framework/arsenal-framework.html
trying to disable player movement but leave turning, aiming and shooting active
any way to do that?
would an eventhandler on wasd help?
setPos till u are done?
how would that work?
like a looping setPos?
yeah
u can put an event handler for animation change
I am not sure if this event works for animations like movement though.
wouldn't that break shooting, reloading and etc?
so the setPos seems to work quite well
but sometimes the player twitches a bit
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)
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
Did you apply animChanged?
not yet, still learning how it works
not good with eventhandler
Why not simply use _unit disableAI "PATH";?
This will simply prevent AI/player from moving around, but everything else will still work
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.
a quick search gave me this forum post which looks promising: https://forums.bohemia.net/forums/topic/170670-blocking-certain-movement-keys/
Yeah it works as well, I forgot there was a way to override default behavior for keyDown event.
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; };
@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];
yeah grasped the concept of how it works
still a bit confused on the params
but thanks
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.
Does anyone know why this is not working on script but it does in debug?
@high horizon you mean this? @smoky verge
@high horizon no
was speaking about my problem
maybe your script is in the wrong file format?
@smoky verge Nooop .sqf... it doesnt do anythin
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?
With https://community.bistudio.com/wiki/cutRsc (or any similar command)
Anyone know if ORBAT, only works in single player. I loaded my mission onto a dedicated server and it isn't working.
oh sorry, didn't see that was a room, my mistake
np
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...
player selectionPosition "chest"; @young current
At the moment im using "head" position and changing pos with code
using them for a dialog
you could get better results if you define a different lod for the selection
Hi, why currentWeapon player return the string "Put" ? Is it a known bug ?
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
Y
also you probably would want to turn that selectionPosition into WorldPosition
@young current yep, modeltoworld and worldtoscreen
is it vanilla character?
also I recall the selection names are caseSensitive
so check that your actual name is right
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"
is it vanilla character?
@young current Yes
@compact maple that I dont know of.
@young current i cannot define a lod
Mh alright thanks
@young current True, I thought you were saying something else. The "chest" selection in which lod is it?
dunno
maybe there is no such selection
if selecetion is not there it gives out the 0,0,0 coordinates
of the model
@young current No chest in any lod
then you need to try something else.
use selectionNames to figure out what the names are
I think im gonna use "head" selection and then move with ctrlsetPosition
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?
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
is there a guide to remoteExec
I mean a bit more indepth, I get the gist but I'm pretty slow to this stuff
what kind of depth are you looking for?
here is some more stuff, sort of explained on the first page but will link anyway
https://community.bistudio.com/wiki/Arma_3_Remote_Execution#Using_remoteExec_and_remoteExecCall
isnt too complicated
_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
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;
for CfgSounds is the max volume 1 or can you go past 1
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.
@robust hollow thank you that works, gives me a good place to start
how would i make these targets respawn after say 30 seconds after being shot
https://cdn.discordapp.com/attachments/490973894421905438/703814109153591336/unknown.png
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
removeMissionEventHandler ["Draw3D", 0];
it is a mission event, not a player event
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
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
try looking at how amphibious IFVs are configured?
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]);
};
};
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;
};
};
ok thanks ill give that a go
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?
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
which script? i have more than one.
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?
Guys anyone have a COOP script on ready ?
@hollow pier sounds like a car script 🤔
sounds like the car script
or anything, @robust hollow
in other words (for an old timer) what exactly does .....
mode: Number - (Optional, default -1) position check mode (ALWAYS USE DEFAULT VALUE)
mean
regarding
The second element must be -1 (≤ 0 really) at all times, otherwise command becomes unusable
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?
change the second element to -1
_fe = (count (_pos isflatempty [0,-1,0.25,35,0,false,objNull])) > 0;
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...
🧐
_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 mentionplayerat all for the first parameter.ignoreObjectis here to say "don't consider this specific object to check if the area is empty"
@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
minDistance should perhaps be named "emptyRadius" yes
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
np, this channel is made for that after all ^^
I know but you seem to be here 24 hours a day,....grateful
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
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
nope, it's 10 seconds
did you tick the show script errors launcher checkbox?
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
mods?
nope
where do you execute this last example?
part of a function that gets spawned as a hold-action
dunno; it's been showing me errors so far though, so I assume yes
fix the errors first 😑
I did
I mean it's been showing me errors as I was building this script and I fixed them as they appeared
ok
paste your simplest example in https://sqfbin.com/ and put the link here
I'm in the middle of reworking it, so there might be some weird things going on 😜
https://sqfbin.com/muduhibavepexisohiqi
like the commented-out if statement below the loop; just ignore that
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??
_target switchMove "" kinda fixes it, but then the NPC is instantly standing still and the animation doesn't do what it should
no, switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"
🤔 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
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
well, the simplest example was that 3-liner up there
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
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
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";
};```
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? 🤔
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.
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?
Any one have the script to prevent termination due to DLC on a modded map?
@loud python if inside else block, no elseif
ouch
but @still forum will add that in the next hotfix.
I was already running away
@loud python if you have ten thousand cases, use a switch
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
rarely, but yes
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
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
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 😉
yep, I admit encountering a case sometimes
but rarely
if it doesn't exist, heh
if () then {
} else {
if () then {
};
};```
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
@urban tiger you still plan to move around?
@smoky verge Yeah, kinda like 'resident evil' style. want to try something
maybe some keydown eventhandler for mouse up and mouse down
actually metal gear solid is a better example
can6 = _grp createUnit ["B_RangeMaster_F", position ass];
I'm getting an error
2 element provided, 5 expected
what does that mean exactly?
it's expecting all the rest of the arguments, as stated here
https://community.bistudio.com/wiki/createUnit
none are optional, unlike createVehicle
@smoky verge ^
and creteVehicles is not for units I guess
well then, if you don't need it to move you can just do that 😄
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
and in Eden Editor, does the player become invisible?
is hostage animation vanilla?
oh yeah that too
@finite sail ↑ ?
yes to both?
cant check in edeneditor, tis is all done in script in mission
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
then boot an eden session and use the debug console, you will know
because ^ what HC said
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
no, just play the animation on player
just that, debugging is "strip the issue to its simplest and figure out what's wrong"
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?
@finite sail (see https://community.bistudio.com/wiki/Debugging_Techniques)
removeHeadgear _unit; something something proper grammar
it works when locally execd on player
and you don't get invisible to yourself?
no
in 3rd person?
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.
i agree, i dont suspect the remoteexec either
perhaps it depends on terrain slope too (character moving further away from the camera)
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
walls, perhaps
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
no
yup
🙂
We work the wiki enough, dang it! :v
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
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
well, just sqf while {true} do {}; is obviously and useless and resourceful yes 😅
it all depends what is inside the do
he was having an if condition checking for a variable and then acting on that variable
bah, playmove is no better.. will try the setpos before the anim
@surreal peak while { sleep 1 ; true } if possible
removeGoggles _unit; so this actually covers all facewear?
not nvg
or should I say "removes all facewear"?
nvg is different
it always is for some reason. I hate those cause I can't get rid of them on some of my ports
removeGoggles removes everything defined as goggles yes
anyone has a kind of "login camera skript" so the camera moves from above into the char like gta does?
How would I go about stopping animals from walking through objects like walls?
animal setDamage 1
@rotund aurora you can do it easily with https://community.bistudio.com/wiki/Camera_Tutorial and this channel 😉
thx :)!
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 🙂
oooh, neat to know indeed
yeah
@winter rose D:< Is there a function which says if there is a wall infront of someone?
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
when the cargo plane is full? Or when all players available are inside of it
When all availible are in
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
@winter rose and that goes in the init
ty Lou, Time to make the worst AI imaginable
How would I set a Boolean to be true when a certain npc dies
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;
what do you mean?
this case you present is the exact reason why there is the red box in https://community.bistudio.com/wiki/private
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
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
Yes, they're all dynamically scoped languages
now if we are talking about Pascal… :p
I can only speak for the languages I have used (…and PHP)
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
https://community.bistudio.com/wiki/private#Examples
Example 4 should help?
it doesn't do closures though, right?
private "_subroutine";
call {
private _inner = 3;
_subroutine = { hint _inner };
};
call _subroutine;
This doesn't work, right?
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;
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
call doesn't create a scope; it uses the one it has been called from
Example 4 disagrees though 🤔
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
hmmm... sort of looks like dynamic scoping
(and of course, the following works)```sqf
private "_subroutine";
call {
private _inner = 3;
_subroutine = { hint str _inner };
call _subroutine;
};
if in config, #arma3_config
yeah that was my second question
I guess that only works in configs and not inits?
yup, you would only be defining a global variable here