#arma3_scripting
1 messages Β· Page 35 of 1
you have your answer then, biki is your friend
what is QGVAR()?
#include "script_component.hpp"
params ["_source", "_url"];
private _ret = "";
private _existing = _source getVariable [QGVAR(active), []];
if !(_existing isEqualTo []) then {
if ((_existing select 1) isEqualTo _url) then {
_ret = _existing select 0;
} else {
[QGVAR(stop), [_existing select 0]] call CBA_fnc_globalEvent;
};
};
If you follow the #include chain for long enough you'll get to it
Q means quote, GVAR means TAG_x more or less.
where TAG is PREFIX_COMPONENT
hmm alright, im following it then. I am trying to "fix" the Live Radio mod so that the radio stops playing when players leave the server lol so I am trying to see how this mod works first
typically script_component.hpp has COMPONENT defined and script_mod.hpp has PREFIX
The actual defines like QGVAR are a couple of levels deeper
gotcha, I am mostly looking for these active and stop functions then
They're vars, not functions.
globalEvent is just throwing a string out there and anything can trigger on it.
If you're lucky then all the other references are using the same QGVAR(x) define.
hopefully that is so
would I be looking for script_macros at all?
the script component seems to lead back to a script_mod and script_macros
One more level. script_macros_common IIRC
im not finding any script_macros_common scripts in this github for the mod, but I am seeing it reference a script_macros_common in CBA
yeah, it's using the CBA one directly.
a way to make this for opfor and blufor? not specific unit but entire side?
{ _x addEventHandler ["GestureChanged", {
//rest of your code here
} forEach units side west;```
or ((units side west) + (units side east)) or something like that if you want to cover more sides
appreciate you! i had something similar but wasnt working. π
thank you again!
{
if ((side _x == BLUFOR) || (side _x == OPFOR)) then
{
_x addEventHandler ["GestureChanged", {
//rest of your code here
}; ];
};
} forEach allUnits;``` seen something like this too
ill try them both π thank you!
just make sure brackets are okay, I might have missed something or added too many of them
definitely will do π
How do i remove/edit the second tag when using the sideChat command?
the first tag is the group name
you can't hide unit name from the sidechat and using group ID for names isn't that good either, try using this setName [YourName, Your, Name] in your unit's init instead
i still show up as Wojtek
what else should i use for names?
player setName ["Dude Dudowski","Dude","Dudowski"]; works for me 
yeah but with sideChat i mean
Setting player name doesn't work in MP btw
In MP you always have your profile name
Also, for sideChat AI unit names don't appear, only their group name, so watch out for that
noticed that
setting a different group name doesn't really bother me
Is it possible to animate PAA's on transparent textures?
Like the water puddle objects?
use customChat it allows for many options
Hey there, it's me again.
I am trying to create an option for some people to choose their spawn. The way I want to achieve this by adding the same number of spawns to the player action menu.
What I am having trouble with is "remembering" which spawn I chose, as all the vars are no longer available when executing the code inside the addAction
What I have so far
params ["_points"];
[_points] spawn {
params ["_points"];
// Not needed when on dedi, but well, I am testing on local
waitUntil {!isNil "IMF_warmup_state"};
if (IMF_warmup_state == 2) exitWith {};
private _ids = [];
private _spawnLoc = -1;
private _cntr = 0;
{
private _nbr = _cntr;
private _id = player addAction ["Spawn: " + _x, {_spawnLoc = _nbr}]; // <----- PROBLEM
_ids pushBack _id;
_cntr = _cntr + 1;
} forEach _points;
// Wait for warmup end
waitUntil {sleep 0.5; IMF_warmup_state == 2};
// Teleport
//hint _spawnLoc;
// Remove the actions
{
player removeAction _x;
} forEach _ids;
};
The _nbr is no longer available when I click in game on the action. How would you tackle this problem? Can't think of anything right now.
use a global variable, for the value, you can pass it via parameter "arguments" https://community.bistudio.com/wiki/addAction
Alright, changing it to
private _ids = [];
spawnLoc = -1;
private _cntr = 0;
{
private _id = player addAction ["Spawn: " + _x, {spawnLoc = _this select 3;}, _cntr];
_ids pushBack _id;
_cntr = _cntr + 1;
} forEach _points;
did exactly what I needed it to, thank you!
I usually do with "IMF" (totally not ilbinek mission framework)
But this variable is player only, no need to make it "global global"
I should save it in the player varSpace, if I want to be proper
whether its a ui namespace, object namespace, mission namespace, always tag. you never know, especially if you run mods
Alright, will do, thanks for the advise.
Yep, mods... Plenty of mods
Anyone know of an exile function that will get helmets from cargo? I was able to get mags, vests, backpacks, weapons using get*****cargo, but I have not been able to find a function for headgear. Any ideas?
@feral zodiac Does getItemCargo not work for headgear?
could also try just itemCargo
No, getItemCargo isn't working. It seems there a function for all items except headgear. I'll try itemCargo tomorrow and see what it does
Does anyone know if it's possible to animate textures on the puddle BI textures?
What do you mean?
if they are in the mission yes, not if they are a serverside mod
Is there documentation on making a mod serverside?
make a mod, load it with -servermod start parameter
Sounds easy enough
does
isFlatEmpty
still use the radius of the bounding sphere for surrounding objects?
have you checked https://community.bistudio.com/wiki/isFlatEmpty ?
is this valid?
TAG_forSomething setVariable [{"TAG_" + _var/* string */}, _someOtherVar]
no
name: String - variable name (Identifier)
https://community.bistudio.com/wiki/setVariable
you're trying to pass code there
not sure what you mean by that
"make" an identifier, instead of explicitly giving a string. Make sense?
"TAG_" + _var?
nice thx, i'll give it try
so the name in ```sqf
varspace setVariable [name, value, public]
may be any string, and this string becomes the identifier?
not any string, there are some limitations
yes, commands
for example you can't assign to a command name, or some other "reserved variable"
you can in object namespace iirc, but let's say that's still bad practice
got it
they are allowed, but trees are hidden from the 3den editor menu.
so you can either use scripts to place hidden objects or get a mod that changes config to re-enable these trees (this makes a dependency tho)
WTF is the deal with BIS_fnc_trackMissionTime does it save a specific time value and can delete what ever time will output on the server?
Or does it only export time to profileNamespace?
Also why profileNamespace if it says missionTime? Shouldn't that be a queriable value from missionNamespace?
looks like it's for tracking the total mission run time across saves/loads or something like that π€·ββοΈ
screw that, I'm gonna build my own function for a queriable missionTime xD
ty!
I sort of expected, that a queriable value would already exist, Especially in MP environment.
_time = profilenamespace getvariable [VAR_TIME,0];
_timeLoad = missionnamespace getvariable ["BIS_fnc_missionHandlers_time",time];
_timeAdd = time - _timeLoad;
_time = _time + _timeAdd;``` the entire time-related logic of that function
"get saved value, add current time, subtract whatever time was spent on loading currently running mission" or something like that
that... looks very complicated for something, that is only supposed to do something like this:
// isDedi
missionNamespace setVariable [MISSIONTIME, time, false];
sleep 1;
there's more. From what i see in code it doesn't look working at all π€
ok, in that case I will just stay far away from it π
because "BIS_fnc_missionHandlers_time" doesn't seem to be set anywhere (it's commented wherever it was before). And if it isn't there - BIS_fnc_trackMissionTime effectively uses time - time π€
seems to always return 0 in my test runs as well
thats dividing by zero and will make mommy universe implode like a bubble, so it had to delete itself from the wiki and the devs gave up on retyping it
another day, another broken piece of code found in Arma
I don't see time - time anywhere in fn_trackMissionTime.sqf?
what i posted. Line 2. "BIS_fnc_missionHandlers_time" isn't set anywhere, so _timeLoad is set to time.
Line 3 is equivalent to _timeAdd = time - time; then.
yeah it's like "first call of this, define the variable"?
this function doesn't set "BIS_fnc_missionHandlers_time" anywhere, it only nils it on delete
the only place i've found that had set "BIS_fnc_missionHandlers_time" before has it commented now
correct, BIS_fnc_missionHandlers_time vs VAR_TIME indeed
is there a way for force load a specific mission on a dedicated server via sqf / aside from the mission cycle definition?
If the #mission command works with serverCommand, then that
what's the best way to save player backpack , remove it and then give it back to the player?
why?
I want to give player a parachute. but then he looses all backpack items
oh, I think I did something like that at one point
β¦or use getUnitLoadout/setUnitLoadout π
Usually just save backpack _unit and backpackItems _unit, then removeBackpack _unit, then addBackpack and addItemToBackpack
interesting thanks. wasnt aware it supported #mission - that said the BIKI isnt quite clear if it supports cfgMissions class names or namespace/prefix to sqm
but that doesn't save ammo count
neither does getUnitLoadout. In fact, the only way to do that is to use magazinesDetailBackpack and parse the ammo count for each magazine - then you have to use addMagazine to replace them with the correct count, which doesn't allow you to target the backpack specifically
hmmm setUnitLoadout is restoring the ammo count to at least for the main weapon
Oh, it seems it does, you just have to go into a different page to see where it says that, not the main one
seems #mission[s] can only be done by the admin - not the server π
you need to use the second syntax in order to top mags, default behaviour returns partials
So yes, you can do that, I suppose. If restoring the whole loadout doesn't break anything else or cause a noticeable visual effect.
SP is good, never know about MP
my concern is not that it might not work, I know it works, it's that it might cause a brief flash of the unit being naked while the loadout is being changed, which may be undesirable. It might also reset any custom uniform texture applied to the unit.
the unit doesnt get naked, it just pass from one uniform to another, however textures are reset indeed
Q: re: ParticleArray object (18) ...
https://community.bistudio.com/wiki/ParticleArray
Object - If this parameter isn't objNull, the particle source will be attached to the object. The source will stop to generate its particles when the distahce between the object and the source is further than Object View Distance.
We're talking about Object View Distance optimizations here, correct?
It seems that the "#particlesource" object attaches to this object. Check.
But what does this have to do with distances between object and source (i.e. "#particlesource")?
If I simply attach it to a target object i.e. let's say "Land_Wreck_Heli_Attack_01_F", then the player Object View Distance governs whether particles are generated in proximity of that object?
I don't know who wrote that but seems like they got wrapped around that axel somewhat. Besides which the spelling gaffes "distahce "...
Attaching an object can be done at any distance and doesn't necessarily imply that the objects are near each other.
Let's say you have an object view distance of 1600m. You have a reference object, and you place your particle source 1800m away from the reference, and attach it. The particle source is still 1800m away but it's attached. What this says is that since the distance between object and source is larger than the view distance, the source will stop emitting particles. I suspect this is due to simulation stuff. I also suspect this might not be phrased 100% correctly - I think it's probably that if the reference object is outside of your view distance, while the source is inside it, the source won't emit because its simulation is tied to an object that's not being simulated due to being out of range. But you'd want to test that.
this is not attachTo AFAIK, this is ParticleArrays
and which the #ps appears then to move with that object, as would somewhat be expected. but this is not what I think is implied by the verbiage. or perhaps I read that incorrectly.
...how do you think it's attached if not by the same engine process as attachTo?
well, I don't care how it is attached; I am using setParticleParams as my interface, not attachTo. how the engine handles that internally is not my concern. what is, is the confusing verbiage of the object language.
again if we're talking Object View Distance, that seems in relation to player, but I do not think that is the intent with object to provide player as the object.
Well, I'm trying to explain the verbiage to you, but it seems like you're not listening.
I also did not say you were using attachTo, nor did I mention attachTo anywhere in my message.
no, but you seem to think I have a white box looking glass into the engine implementation, which I do not. "if not by the same engine process as attachTo" ...
That was a rhetorical question to demonstrate that the behaviour of an attachment created with attachTo is highly likely to be the same as the behaviour of an attachment created with this. Not that it really matters, because my original message never mentioned attachTo and I don't know why you brought it up.
okay fair enough, enough about that axel please. still, I think I understand how it works, but player is never mentioned, which is usually in relation to Object View Distance, maybe that should be clarified in the docs. when object#1 is not the same as object#2 for instance.
in other words, the #ps tracks with the object, which I should think is exactly what you want. i.e. let's say a snow storm, buffeted snow bank, etc... Arrange the #ps then manipulate the buffet accordingly...
the optimization to do with Object View Distance, which is to say distance from buffet to player, in this illustration
Here's a diagram of what I think is going on here: https://i.imgur.com/wXQ1OFG.png
but as I said. Test it.
so to recap, there are three objects in play there, the #ps particle source, the target object to which that #ps shall be attached (however it got so π), and player, in relation to which Object View Distance is the question.
yep that illustrates it.
heck that should be a diagram on the ParticleArray page I think... besides clarifying the verbiage itself.
It shouldn't until it's been tested. At the moment the left half is simply a demonstration of the existing words, which are mildly dubious, and the right half is speculative.
I'll wait until you guys're done btw I don't wanna clog your conversation
No no, go ahead
really?
personally I get anxious when 2 conversations go on simultaneously in the same channel
maybe it's just me
you guys had it first
so i figured I'd be polite
Happens all the time here. I think we were about done anyway.
oh sweet
I have tested in a couple scenarios. assuming player is object, #ps tracks with player. so it cannot be that scenario. I think the diagram is excellent.
lemme check on what you're talking about maybe I can help
lol I have no idea π
sorry can't help
Go ahead and ask your question. Thanks to the magic of the reply function it'll be possible to keep track even if we're still stuck on the other thing.
appreciate your clarity of thought @hallow mortar with the illustration and all. really, that is not what I read in the docs.
Neither of the scenarios demonstrated in the diagram have the player as the reference object; in fact, they are both incompatible with the player being the reference object.
literally this is what the docs say, "The source will stop to generate its particles when the distahce between the object and the source is further than Object View Distance." If one of those objects is not player, then what is the point of involving OVD?
anyway, the illustration clarifies perfectly.
oh ok thanks
That's one of the reasons why I think the left scenario (which is what the documentation describes) is not what actually happens.
I was told by a modder it is possible to make a script where if my character equips a uniform rigged to a different skeleton, the script can instantly change my character's unit to one with that skeleton so I can equip that uniform and not just become naked and bugged. Is this true? How would I go about this?
also he did not provide me said script obviously π
and I myself am an absolute noob at scripting
I mean if it read simply, "The source will stop generating its particles when the distance between the player and the source is further than Object View Distance." okay sweet perfect.
This is kind of a complex question. I'm...somewhat doubtful, but if they've done it then I guess it's possible. Probably a real pain though.
anyway sorry @light nimbus good luck sir
This would be very normal behaviour and not even worth calling out, so I don't think that's what actually happens either. But this is why I'm asking you to test it exactly as described in each of the two scenarios in the diagram.
ππ thanks
I'm fine I just didn't wanna bother you guys
Sure maybe so, then if it is not relevant, or causing confusion otherwise, then drop it. either way.
happy to entertain you bruh π
It's not possible to on-the-fly change the base class of an existing unit. So what you'd have to do is use createUnit to make a new one of the right sort, then getUnitLoadout and setUnitLoadout to give it your gear, then selectPlayer to move you into it, then delete your old unit ....real pain and might break any other scripts that were previously operating on your old unit.
^^
anyway I'm moving on. appreciate the help.
Arma's support for different unit skeletons isn't...extensive, and this is one reason among many why people usually try to avoid doing it.
it's a pain π. Yeah there doesn't seem to be anything like Source's glorious proportion trick
if this is either from TIOW or OB mods, you should ask them for specific solutions. us assuming how their units with custom skeleton works basically guarantees breaking their systems if they are running extra stuff
It used to outright cause a CTD when equipping human skeleton items like vests on other skeletons, but it was fixed. π€
what's a ctd?
Crash to desktop
talk to the TIOW guys I think they have a script for just that
I would strongly recommend just having a Spartan unit and a normal unit and keeping them separate. There might be scripts to get around some of the issues but in my view it's not worth the risk of breaking something.
I would also recommend this
wow thanks. Screenshotted
having tried myself it's not easy
nah long story but it's not practical
but yeah that's what I'm doing for now
I mean I'm not sure of it but I think they do
takes more time and work basically
yeah what you want is doable but kind of a pain
alternatively you could take control of the unit with custom skeleton, but that also breaks unit binded systems π€
I imagine that's the general principle though. Lots of selectPlayer.
doesn't work, i'm using the wiki example
player customChat [1, "customChat"];
did you add the radio channel?
created with radioChannelCreate?
isn't 1 (side) already a radio channel?
https://community.bistudio.com/wiki/Channel_IDs β there is an offset
as described in https://community.bistudio.com/wiki/customChat you need to use https://community.bistudio.com/wiki/radioChannelCreate
Each base channel has their own command for sending on it (e.g. sideChat). customChat is for sending on custom user-created channels (where you can choose what makes up the sender's callsign) and can't be used to send on base channels.
got it, thanks
can i get this color? (using BIS_fnc_sideColor)
passing west to the function gives a dark blue
is there a script to possibly change a unit's faction in game? I hate the idea I may need to create like, 3 spartan units just so the chinese don't shoot me as soon as I get tired of being the dominant faction every single time
like, Hetman war stories
I spawn a spartan II in zeus then possess him while playing CSAT? They all turn around like I was the guy to crash FTX
chat colors are available in config, i.e. getArray (configfile >> "RscChatListDefault" >> "colorSideChannel") for what's on screen π€·ββοΈ
@wary sandal godly profile pic btw ππ
just group them to the csat group so it changes sides
in game or in config?
in game
i dont use Zeus, but i imagine you can group units to groups just as in the Eden Editor, making them change sides in the process
using code you just do:
[yourSpartanUnit] join targetGroup;
and thats it, it can become any faction acording to the group to whom you are making the unit join
Eden allows you to link to an enemy then set their probability to zero (creating the group but not the opfor leader himself)
scripts allow you to join a new group as said above ^ yep
oof, the sheer dirtyness of that hack
just deleting the old leader worked for me just now π€
omg thank you eo much
oh noice
does it return the color in RGBA?
radioChannelCreate takes RGBA values
so I have this mod that opens a command terminal in ny pause menu, do I uust add it in there? Also what do I use as the spartan's uh, [thing], his in-game name? like "Bryce Montgomery" or whatever random stuff pops up? or something like "unit_SpartanII_opTre"?
thanks btw
BTW
i meant btw lol
no, arma configs return whatever they want. This specific entry is array of 3 strings and 1 number that can be converted to rgba array of 4 numbers in the end π€·ββοΈ
too late, you are now branded with the sign of infamy π
π
LOL
π
I would assume Zeus has a built it functionality for doing exactly what you want. But if not, in debug console (or whatever terminal you use)
[yourSpartanUnit] join targetGroup;
Where "yourSpartanUnit" is the object identifier (used to reference your object) and "targetGroup" is the group identifier (used to reference your group). There is no more science behind it
oh ok cool
any of you use VSCode?
sadly yes
with SkaceKachna's SQFLint?
Nope. Is it any good?
I was actually looking answers...
having an issues with sqflint.includePrefixes parameter
can't say
do you use any addons?
Armitxes SQF language. It's not great though.
but then I was using editpad before so whatever.
blackfisch has an updated version blackfisch.sqf-language
can't say it is an improvement... some commands are addded
what do you guys use? Poseidon/sublime or plain notepad++
some detail i have in my mission bothers me, i have some unit set in repair ambient anim with a hammer attached to it (hammer attachTo [unit, [0, 0, 0], "lefthand"]) but the thing is that the hammer only updates at like 15fps unlike the unit which doesn't look all that good
do anyone have a clue why it does it? i think i broke it after changing a setting
hammer:
unit:
This happens with light points as well when you are on a client. The objects position still needs to sync to where it will be over the network, resulting in choppyness
It's smoother if you are the server. Clients it's always choppy. Unfortunately how it works.
i remember seeing the hammer move smoothly
but then i changed something and broke it
Uncheck keep on position. The animation should keep a unit tied down if it's looping anyways. Try that.
this didn't do the trick sadly
||also props to you for reading french||
I don't, I'm just deductive lol
Recreate the unit fresh and start over again is the next troubleshooting step
Hey, anyone here know if there's a way to end a mission but skip the end screen? so an equivalent of endMission "END1"; but it basically throws you out immediately
ForceEnd does that
You can create your own ending sequences with it at the end.
I'm trying forceEnd but it's not doing anything for me, any special thing you need to set up for it to do anything?
Hello there, is there a way to get classname of a vehicle using SQF?
Let's say a have tank that I can reference in code, but need to get it's classname, so I can properly use findEmptyPosition.
Any ideas?
If it's an object then just typeOf _vehicle
Are you in SP or MP
I think it's only MP. Verify that for me as I'm away from home.
I'm in singleplayer, so that might be it
Q: why would I be seeing an error in my particle sources under setParticleParams, shows up repeatedly...
16:26:11 LODShape::Preload: shape '' not found
16:26:11 Warning Message: Cannot open object
smoke particles are working okay.
but fire particles not so much.
working from the fire effects modules, trying to adapt the fire algo
initial error in the log is:
16:56:19 Error in expression <ramsRandDirIntensityMeters = 0.02;
_ps setParticleParams [
_fireParticleShape
,>
16:56:19 Error position: <setParticleParams [
_fireParticleShape
,>
which leads me to believe that somehow _ps is null or nil, but I have a debug sent to systemChat that verifies I have both, _ps (#particlesource) and _lp (#lightpoint) are not null.
by contrast, the light point is showing correctly.
also the smoke algorithm is working correctly as well.
It says "shape not found" which suggests to me that something is wrong with _fireParticleShape
it is set to ["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32], exactly what was in the fire effects module.
is there any way to change the class of an item while retaining its storage (the item is a vest on the ground in my case)
do I need to specify a full path somehow? I'm not sure why it works in the module effects case and not here. perhaps it is getting a path confused with other files with the Universal* prefix?
on the plus side the PE is trying to generate
It looks like the path you've given should be correct
Can I see the full particle array (with the contents of variables) please?
_ps setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,50,[0,0,0],[0,0,0.4],0,0.0565,0.05,0.03,[0.9,0],[[0.5,0.5,0.5,-0],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,-1],[0.5,0.5,0.5,0]],[1],0.01,0.02,"","",18bfdf0d600# 1780478: wreck_heli_attack_01_f.p3d,5.4,false,-1,[[3,3,3]]];
I did find one discrepancy in the _particleLifeTime, but nothing that seemed congruent with the errors:
...
17:58:13 LODShape::Preload: shape '' not found
17:58:13 Warning Message: Cannot open object
17:58:13 LODShape::Preload: shape '' not found
17:58:13 Warning Message: Cannot open object
17:58:13 LODShape::Preload: shape '' not found
17:58:13 Warning Message: Cannot open object
...
What's up with the negative numbers in the array of colours? I don't think you can have negative alpha values
this is what it was from the module effects fire:
_emitter setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,0.4*_particleSpeed],0,0.0565,0.05,0.03,[0.9*_particleSize,0],
[[1*_colorRed,1*_colorGreen,1*_colorBlue,-0],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,0]],
[1], 0.01, 0.02, "", "", "",_orientation,false,-1,[[3,3,3,0]]];
with preceding defaults:
_colorRed = _logic getVariable ["ColorRed",0.5];
_colorGreen = _logic getVariable ["ColorGreen",0.5];
_colorBlue = _logic getVariable ["ColorBlue",0.5];
_timeout = _logic getVariable ["Timeout",0];
_particleLifeTime = _logic getVariable ["ParticleLifeTime",2];
_particleDensity = _logic getVariable ["ParticleDensity",20];
_particleSize = _logic getVariable ["ParticleSize",1];
_particleSpeed = _logic getVariable ["ParticleSpeed",1];
_effectSize = _logic getVariable ["EffectSize",1];
_orientation = _logic getVariable ["ParticleOrientation",5.4];
_damage = _logic getVariable ["FireDamage",1];
interesting
so recently i learnt about #define (courtesy of @copper raven
) but i'm not 100% how it works. I'm trying to enable the simulation of an unit passed through this SIMENABLE macro function but to no avail (it throws me a semicolon error for some reasons?)
#define SIMENABLE(OBJ) OBJ enableSimulation true\ OBJ enableDynamicSimulation true;
...
[] spawn {
SIMENABLE(unit);
};
you got to store the items, remove the bag, add a new bag, re-add the items
when the macro runs, you get 2 semi colons
at the end of line
either remove the semi from the macro, or remove it from the call line
wait so i keep the semicolon at SIMENABLE and remove it from SIMENABLE(unit); ?
for example
either or, cause right now, you'll have two after it replaces SIMENABLE(unit)
i would remove it from the macro
it now tells me that i have a missing ;
a backslash means the linebreak is part of the macro content
#define SIMENABLE(OBJ) OBJ enableSimulation true\ OBJ enableDynamicSimulation true
someVariable = false;
[] spawn {
SIMENABLE(unit1);
SIMENABLE(unit2);
};
you don't put a linebreak after it, so the replacement includes the \
replace \ with ; and the problem will go away
oh i didn't catch that, yeah that's why
thank you very much
also remove the ; at the end of the macro content, it's a "guideline" kinda thing, you want to put a ; after the macro instead, i.e.,
#define MY_MACRO(x) x
^ no semicolon
MY_MACRO(1337);
^ semicolon
yeah @fair drum pointed it out already
The problem is that your emissive colour (last parameter) is missing an alpha value
(you also have some work to do on the velocity, gravity etc but that's up to you)
The emissive colour should be format RGBA - 4 values, you only pass 3. The engine requires that fourth value even if it doesn't do much in this case.
Is it possible to assign 2 variables to 1 player unit?
Do you mean storing multiple variables in a player unit's namespace using setVariable? Yes.
Do you mean giving a player unit 2 variable names that both refer to it? Also yes, actually, but usually better to just use the one if possible
So my scenario is a little complicated. I currently have 4 player slots whitelisted on resistance side (checks using playerSide == resistance) and they are using *isSneaky * variable from INCONTINENTIA'S UNDERCOVER scripts. I am moving those players over to blufor but now require another variable (alongside isSneaky) to whitelist those 4 slots on blufor.
I think I have found a work around and am going to try using roleDescription player == "<role_desc_here>"
furthermore, does anyone know how to whitelist Respawn Positions?
ah I see okay... I wasn't sure since I think it is specified RGB not RGBA ...
in action... https://pasteboard.co/8795zTHiAphc.png
How do I animate a helo's landing gear up or down by script?
You can try this: https://community.bistudio.com/wiki/Arma_3:_Actions#LandGear
apart from that, I believe it's an engine-controlled animation and won't respond to normal animation commands.
(Note: for static screenshot posing ONLY, you can use POLPOX's Artwork Supporter to convert the helo to a simple object and control its animations manually.)
Actually, I just want to spawn it with gear closed so I can simulate a crash
From the editor
you can do that when creating them with BIS_fnc_addRespawnPosition by adding it only to the side/unit/group etc
Okay, well, in theory you can use https://community.bistudio.com/wiki/BIS_fnc_createSimpleObject / https://community.bistudio.com/wiki/BIS_fnc_adjustSimpleObject to create/modify a simple object and adjust its animations. It's similar to what Artwork Supporter does, but it doesn't have a UI so it's rather more complicated.
I see
maybe it would be possible to use the action commands with AI mid air and then delete him, reposition the helo later
Probably sort of possible but seems likely to either lead to unintended consequences or require a lot more work than you might expect. I'd recommend figuring out simple object manipulation; it's awkward to learn but you only need the one command and once you know how it works, it's not too hard.
...Or just leave the gear alone and cover it up with a crater object
Update:
helo action ["LandGearUp", helo]; deleteVehicle (driver helo)
Just spawn it slightly above so gear isn't touching land and this, works like a charm
when adding a new bag, would i use createVehicle?
and with removing the current bag, would i use deleteVehicle?
Yeah, just grab the class names and the amount of each item into an array first
and im assuming that to store the items, i'd have to use a local variable
how would i set the storage of the newly created item? where would i plug that local variable into?
You'd create a function and do everything in that to convert the bag. You can use a local var inside that function. Are you wanting a list of commands you can look up and use?
i think ive come across that page on the wiki, i can probably find it again
Well come up with some stuff and I'll help you through when you get stuck. Just know that it is possible and not too hard. I'm lying in bed though so I won't respond till tomorrow.
alrighty
anyone good with regex here?
trying to do something in text editor, applying to thousands of lines
Would recommend to use this kind of website for your quick test: https://regex101.com/r/cO8lqs/4
And this might be a better resource for you since you're way better to read English, no?
trying to convert this ["o_mrap_02_gmg_f",""], ["o_mrap_02_hmg_f",""], ["o_lsv_02_at_f",""], ["o_lsv_02_armed_f",""], ["o_lsv_02_unarmed_f",""], ["o_quadbike_01_f",""], into this ["o_mrap_02_gmg_f","o_mrap_02_gmg_f"], ["o_mrap_02_hmg_f","o_mrap_02_hmg_f"], ["o_lsv_02_at_f","o_lsv_02_at_f"], ["o_lsv_02_armed_f","o_lsv_02_armed_f"], ["o_lsv_02_unarmed_f","o_lsv_02_unarmed_f"], ["o_quadbike_01_f","o_quadbike_01_f"],
basically pasting across
Or, you might can just use SQF to re-make the array?
_arr apply {[_x#0, _x#0]}
```?
That was I meant to say ye
but only in cases where there exists the ""
there are other lines like this ["b_static_designator_01_f","B_W_Static_Designator_01_F"],
{
if (_x#1 == "") then {_x set [1, _x#0]}
} forEach _arr;
hmm
maybe that is the simplest way π
i was thinking something to paste across where "" exists
No idea if its a script issue or mod issue so not sure where to put it but
Secondary layer not supported here
gets spammed in my RPT and my server crashes
Send me the crash .mdmp file, maybe I can see smth
Ah found it, game should crash right after that message, it shouldn't be able to spam.. Or maybe thats different in retail π€
Well some animation thing does a thing that the engine doesn't support π€
I could really use some advice about building a mod dependent on CBA_A3
Just ask away. Specific questions are best
I'm just not sure where to start...
here's best to start
What is the structure of a mod file?
And what if my mod needs access to data on the server?
For example markers from other players
so you don't know how to make a mod at all then?
I've written scripts etc. But never mods.
https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon regarding mod itself
https://arma2netmysqlplugin.readthedocs.io/en/latest/ regarding connecting your mission with an sql database
A script in a mod operates much like any other script, once it's running
So if you need map markers you retrieve them the same as you would if it wasn't a mod (however that may be)
Ah I thought running client side it would restrict access to data
How can I test the mod before it becomes a pbo?
using a mission for example
unless the mod contains stuff that cannot be changed by a mission, e.g. vehicles
It's only images and scripts right now.
well then you can make a mission
inside the mission folder make a folder as your addon folder (this will be built as the PBO)
then use description.ext to #include "addon\config.cpp" of your addon
Ah so leave the @ off while it's in the mission folder?
what @?
All mods have a @Mod
that's just for the mod folder, not addon folder
Ah k
If it's exclusively clientside and not installed on the server, then its functions and files won't exist on the server, so watch out for that. But anywhere the script is running, it runs like any other script.
Hi,
If i create _groups with for loop,
Lets say 6.
pushBack those is array.
Or something.
How do I check / delete those from array or something when group dies, if i use deletewhenempty , but still it gives with _myAiGroups select {isNull _x} , nothing.
So those aren't null.
maybe a very unclear question but I'll ask anyway
you probably want to use a killed EH on every unit in the group, and manage the groups array from it
we have Group EH now π
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#UnitLeft
inb4 it fires at the same time as old empty group deletion
unit left, but not when they died right?
I guess when the leader realises the loss (just before identity loss)
but use the Empty EH
or use Deleted to know if/when it is by the engine
Awesome! thanks guys!
Anyone know how to pull the ACE3 heart rate data and blood pressure from the player?
_unit getVariable ["ACE_MEDICAL_heartRate", 80];
_unit getVariable ["ACE_MEDICAL_bloodPressure", [80, 120]]
Thank you.
is it possible to load a pbo file via a mission?
use case?
I wanted to flood the altis salt lake and AFAIK that is not possible without a pbo
you can by script
Oh cool, how would I do that and would it be mp compatible?
MP compatible yes
create simple object "water tile", e.g "a3\map_altis\data\Water\water_tile.p3d"
see https://community.bistudio.com/wiki/Arma_3:_createSimpleObject/objects
yes
they will not be simulated, no wind, not destructible etc
create simple object is createSimpleObject, which takes a P3D and not a config-defined vehicle
So i can drive a boat on that water tile?
no idea
iirc yes
you can swim in it at least π
hey guys
I'm having some trouble working on a function to retrieve a value from an array
Possible cases:
myArray = [
["myString1", "myValue1" /* scalar / string / boolean / array */],
["myString2", "myValue2" /* scalar / string / boolean / array */]
];
_myValue = [myArray, "myString1"] call TAG_fnc_myToComplicatedForMyHeadFunction;
_myValue = [myArray, ["myString1"]] call TAG_fnc_myToComplicatedForMyHeadFunction;
or
myArray = [
["myString1", [
["myOtherString1", "myValue1" /* scalar / string / boolean / array */],
["myOtherString2", "myValue2" /* scalar / string / boolean / array */]
]],
["myString2", [
["myOtherString3", "myValue3" /* scalar / string / boolean / array */],
["myOtherString4", "myValue4" /* scalar / string / boolean / array */]
]]
];
_myValue = [myArray, ["myString1", "myOtherString1"]] call TAG_fnc_myToComplicatedForMyHeadFunction;
or
myArray = [
["myString1", [
["myOtherString1", [
["myYetAnotherString1", "myValue1" /* scalar / string / boolean / array */],
["myYetAnotherString2", "myValue2" /* scalar / string / boolean / array */]
]],
["myOtherString2", [
["myYetAnotherString3", "myValue3" /* scalar / string / boolean / array */],
["myYetAnotherString4", "myValue4" /* scalar / string / boolean / array */]
]]
]],
["myString2", [
["myOtherString3", [
["myYetAnotherString5", "myValue5" /* scalar / string / boolean / array */],
["myYetAnotherString6", "myValue6" /* scalar / string / boolean / array */]
]],
["myOtherString4", [
["myYetAnotherString7", "myValue7" /* scalar / string / boolean / array */],
["myYetAnotherString8", "myValue8" /* scalar / string / boolean / array */]
]]
]]
];
_myValue = [myArray, ["myString1", "myOtherString1", "myYetAnotherString1"]] call TAG_fnc_myToComplicatedForMyHeadFunction;
and so on... so far I got this
params [
["_arr", [], [[]]],
["_key", "", ["", []]]
];
// If _arr is empty, or the _key is an empty array or string, I dont think this will work
if (_arr isEqualTo [] || (_key isEqualTo [] || _key isEqualTo "")) exitWith { systemChat "myToComplicatedForMyHeadFunction invalid params"; };
private ["_id"];
// _key is an array and has more then one element
if (_key isEqualType [] && (count _key) > 1) exitWith {
// get the id of the array which has the first element equal to the first element of _key
_id = _arr findIf { (_x select 0) isEqualTo _key select 0; };
// incase nothing comes up
if (_id == -1) exitWith { systemChat format ["There is no value with '%1' as key in '%2'", str _key, str _arr]; nil; };
// call this function again, but with the array found previousely, and without the first element of _key
[_arr select _id, _key - [_key select 0]] call TAG_fnc_myToComplicatedForMyHeadFunction;
};
// _key is an array with only one element, hopefully
if (_key isEqualType [] ) then { _key = _key select 0; };
_id = _arr findIf { (_x select 0) isEqualTo _key; };
if (_id == -1) exitWith { systemChat format ["There is no value with '%1' as key in '%2'", str _key, str _arr]; nil; };
private _return = (_arr select _id) select 1;
_return;
@south swan I know
do you specifically need arrays? Sounds like a hashMap kind of storage to me
you know that hashmaps exist right?
haven't got my head around it
I'll have a read https://community.bistudio.com/wiki/HashMap
and get back to you
uhhh⦠please use https://sqfbin.com/
got it
https://community.bistudio.com/wiki/createSimpleObject
it has a global effect so only server exec is required
well, unles you use the local parameter to create it locally
e.g initServer.sqf if you will yeah
Is there a way to create a flexible joint? Tried ropes but it did not work. Trying to link the RHS Pontoons.
it should work if you simply set the public flag to true
wdym it didn't work?
I've seen people do that
it will set the latest one
why the while?
you don't need to waste performance with that
so?
you're the one changing it
you can just send a "signal"
also I'm not sure if you understood what I meant by public flag: profileNamespace setVariable ["rewardRecieved", false, true]
in other words instead of using a loop, just remoteExec a function that does whatever you want after that var has changed
again, you're changing it
isn't that your variable? or is it coming from a mod?
then you don't need to "check if" it changed.
you KNOW when
let me show you an example:
case 1: using a loop: (slow and wastes performance)
SomeVar = false;
player addAction ["Change var", {
SomeVar = true;
}];
waitUntil {SomeVar};
// do other stuff
case 2: Using a helper function which serves as event handler:
SomeVar = false;
player addAction ["Change var", {
[true] call TAG_fnc_EH_SomeVarChanged
}];
fn_EH_SomeVarChanged.sqf:
params ["_newValue"];
SomeVar = _newValue;
// do other stuff
similar to normal EHs, there's no loop. you execute the "other stuff" exactly when you want it
I don't follow what you mean
addActions have a condition. you can just put SomeVar in its condition and it'll only show when the var is true
The rope did not appear this is the code I used
this enableRopeAttach true;
ropeCreate [A, [0,0,0], p_2, [2,2,0], -1];
what are A and p_2?
A is pontoon 1 and p_2 is the second one
there's a problem with how you've set things up. there's no guarantee that the other pontoon exists before the first one.
try running that in debug console once you're in the game to see if it even works
also not all objects support ropes
thanks
ohhhhhh...
Yes, but it's pretty unlikely. You should use something to round the result, the default precision is something like 4 decimals (e.g. 5.5344)
attempt 2 after being timed out by automod on first. https://community.bistudio.com/wiki/createHashMapFromArray to almost seamlessly convert arrays into maps π€·ββοΈ
what?
Hey all, still relatively new to scripting and trying to use this script/scripts in my mission. What I don't know is HOW to find the scripts he references after I download it. I'm a bit stuck at this point. Any help appreciated. Just in finding how to access the scripts, I'll work on getting them implemented. Thanks!
https://steamcommunity.com/sharedfiles/filedetails/?id=1790486345
what "what"? Your screenshot looks like "nested structures are still arrays, what to do with them?". If not - then i misread and can't say anything more without further explanations π€·ββοΈ
- Un-pbo or Un-zip the mission and read the comments or watch the video tutorial for more information.
once you open the mission you'll have some folder called Scripts or whatever, open any sqf file inside and they should have comments added
I did watch the video tutorial, felt more lost, didn't explain where to find stuff and unfortunately being newer at this, I don't even know what to start searching lol tried though, just got more frustrated. I'll give that a go. Thanks for the direction
Can lazy evaluation be applied to waitUntil and whiles?
Well, it can be applied within the waitUntil condition, since it's part of the and command - if you're using and in the condition then you can use lazy evaluation with it
thanks
A lightpoint is local to the computer where the script has been called; one player could see a light in the dark while another would not have such light "object" created.
So no1 won't see that, only if you host , you see current light effect.
You need remoteExec createVehicleLocal
ideally, put all your light commands in a function and remoteExec that, rather than remoteExecing one at a time
Technically yes you can make a function like that but you shouldn't
let's say i use createVehicle to create a new item
how would i store the object i just created as a variable to use commands like addItemToVest?
variables
private _myStuff = createVehicle ["abc", etc];
_myStuff setDamage 1; // boom, destroyed
i just preface this by saying my scripting knowledge is like a caveman discovering fire for the first time
then no worries, we're here to guide π
holy moly that looks easier than i was fearing, tyvm
note that local variables (the ones starting with an underscore) are local to the scope in which they are created
a scope is more or less a { } bracket area
see https://community.bistudio.com/wiki/Variables#Scopes for more info
luckily ive figured that much out
when i finish doing commands on the object, is there a way to unassign it as a variable?
no need, the variable is deleted when the code exits the scope
(note: not the object itself, just the var)
thats awesome
Did you get correct way do handle lights to shown everybody? π€
im assuming since a vest is defined as a weapon in the config, i would use createWeapon to spawn in things like vests?
HashMaps 
createWeapon?
is that even a thing?
nope, that's why I ask
what would the command be to create a vest? would i still use createVehicle?
you would have to createVehicle a WeaponHolder_scripted, and addItem to it iirc
Yeah, weapons are unfortunately not objects in Arma, but proxies
heyo, I am planning to modify our invade and annex mission to re-enable pathing on garrisoned troops when there is a certain number left alive and I wanted some opinions from you guys who know more about what your doing than I do.
so in the spawner script they disable the ais pathing on spawn:
{
private _unitType = ([(selectRandom _unitTypes), _enemyFactionHash] call AW_fnc_getUnitsFromHash);
private _unit = _garrisongroup createUnit [_unitType, _x, [], 0, "CAN_COLLIDE"];
_unit disableAI "PATH";
_unit setUnitPos "UP";
_units pushBack _unit;
_unitCount = _unitCount + 1;
sleep 0.1;
if (_forEachIndex >= 8) then {break};
if (_unitCount >= _maxUnits) then {break};
if ((count (units _garrisongroup)) >= (ceil ((count _infbuildingpos) / 2))) then {break};
} forEach _infbuildingpos;
I was thinking I push _unit to a global variable and in another script I have a forever running while loop, in the while loop I every like second I check which units are alive and pop the dead units in the array.
And basically once the array of units is less than say 15 units alive I re-enable pathing for each unit and set a waypoint to the nearest player.
What do you guys think? How should I go about this?
This already creates a _units array containing all the units it creates.
After the forEach you can do things with that array. For example:
_units spawn {
waitUntil { sleep 5; (count (_this select {alive _x})) < 15 };
{ _x enableAI "PATH" } forEach _this;
};```
thank you, that is a much better idea ill toy with this instead and see what I can get for a result
and enableAI wont error at all if path is already enabled on some units right?
Anyone know how to get ACRE2's current frequency and channel number etc?
Hey all!
Trying to learn how to call params for scripts/functions. My first time with this.
Got stuck on how to call /change these in a script/trigger. I struggle to wrap my head around this π
Would appreciate some advice!
//PARAMS
params [
["_IDArray",[]],
["_settingsArray",[]]
];
//PARAM PARAMS
_IDArray params [
["_spotterGroup",grpNull],
["_artyID",objNull]
];
_settingsArray params [
["_debug",false],
["_artyChance",50],
["_targetting","side"],
["_artyVirtual",true],
["_zeroing",true],
["_zeroingCoef",0.5],
["_setuptime",20],
["_flightTime",15],
["_timeBtweenShells",10],
["_rounds",10]
];
what function/script is that?
Well... I tried to make a arty script to the best of my ability π
And I am trying to call it from a trigger.
I just don't know how to set up the call function.
A friend of mine made something similar like this:
if (isServer) then
{[ [(group GroupName),units EAST], MortarName, ["",true], 1, [true,false], [25,10,7],[12,64]] remoteExec ["pr_fnc_artySpotter", [0, 2] select isDedicated];
};
But it makes no sense how the arrays are separated...
This is his params that matches with the call above:
//PARAMS
params [
["_grpArray",[]],
["_arty",objNull],
["_typeArray",[]],
["_numShells",1],
["_hitTargetArray",[]],
["_sleepArray",[]],
["_roundsArray",[]],
["_shellTime",300] // only instance, want to keep?
];
// PARAM-PARAMS
_grpArray params [
["_spotterGroup",grpNull],
["_grpToChase",playableUnits],
["_whoToWatch",objNull]
];
_typeArray params [
["_typeShell",""],
["_unlimited",false]
];
_hitTargetArray params [
["_hitTarget",true],
["_giveAfuck", false],
["_dangerCloseDist",150],
["_kaFriendly",1],
["_error",500],
["_zeroRounds",4]
];
_sleepArray params [
["_sleep",(30 + random 15)],
["_random",0],
["_zeroedSleep",7]
];
_roundsArray params [
["_requestedRounds",4 + random 6],
["_maxRounds",32]
];
it matches up fine
Question is whats the logic - how does it fit?
all params does is assigns values from an array, fx, they pass [12,64] as _roundsArray, then they params from it which assigns _requestedRounds and _maxRounds
And the mortar name and the numShells aren't in [] because the main param doesnt have ["",[]]?
I think I get it now
_numShells is assigned 1 there
mortar name?
Yeah - it's mentioned in the exec above - Mortar/arty is _arty
that'd be the object which would do the firing
and yes, _arty
Is there a script that would give an aircraft infinite amount of flares/chaff?
is there a way to use filePatching on the server without windows locking the files?
is there any event to detect armament changes in the arsenal?
event? no
but the player is in Arsenal, so you can just run a per-frame check of inventory for changes
something like this
TAG_items = [];
TAG_GearChangeEvent = addMissionEventHandler [
'EachFrame',
{
_items = toArray (uniqueUnitItems player);
if (TAG_items isNotEqualTo _items) then {
TAG_items = _items;
// Event code below
};
}
];```
"cleaner" but more complex way would be to hook into listboxes of the arsenal with event handlers
there are key events to handle too in that case ... like [ctrl]+[r] applies random gear
@velvet merlin what is the best way to check if a particular mod is running
isClass cfgPatches
for instance im using this for GM
if (isClass (configFile >> 'CfgAddons' >> 'PreloadAddons' >> 'gm_core')) exitWith {
these days its not as important as clients have to have the same pbos too
only optional mods are somewhat special
ahh for my use its for server to determine what units/vehicles to spawn π
in the end checking for something actually to be use (ie cfgVehicles) would be safest
also to run a mod properly, does mission.sqm need anything in it? using GM as example
thinking addons[]={} class AddonsMetaData {}; dlcs[]={}
listboxes?
Thing where you select your weapons/equipment/whatevers
no idea how to use them haha
with an event
That's why sharp. mentioned it is complex
the engine probably does some data preloading based on these entries
activateAddons command is likely doing something similar
alternatively i would spawn the to be used assets away from the mission area at mission start
@copper raven I assume the issue is that I need to know the name of the magazine aswell. I tried:
this setMagazineTurretAmmo ["300Rnd_CMFlare_Chaff_Magazine", 100, [0]];
And it doesnt change anything
the fired EH gives you the magazine used
it also gives you the vehicle which fired
i don't know why are you using this
, [0] turret path also seems wrong, it should be the driver's turret, which is [-1]
why does my black background disappear after like 15 seconds? cutText ["Press the SPACE key", "BLACK FADED", 2]
i just realized
because I will be using it in zeus, so it will actually will be _this
Thanks I completely forget, love u
if you run that once, it will not result in infinite chaffs
you need to use a fired EH like i told you
_this/this whatever addEventHandler ["Fired", {
params ["_unit", "", "", "", "", "_magazine", "", "_gunner"];
if (_magazine != "300Rnd_CMFlare_Chaff_Magazine") exitWith {};
_unit setMagazineTurretAmmo [_magazine, 300, _unit unitTurret _gunner];
}];
Luckily found the issue, I believe it maybe something with mikeros new pboproject. It was a mod on the server causing it, I just put the old version back in and fixed it. Packed with PBOProject and it crashes, Addonbuilder it doesn't no obfuscation. Possibly was a different issue the layer bug.
hey guys, ran into a issue with a script .was wondering if someone could tell me where iam going wrong.iam trying to define the script ,Without the defines it runs.,but if i define it i get a wait untill error
private["_grp","_crew","_heli","_this"];
_grp = grp1;
_crew = copilot;
_heli = h1;
_this = this;
{unassignvehicle _x;_x action ["Eject", vehicle _x]} foreach units _this;
0 = [] spawn {waitUntil {{!(alive _x) || _x in _heli} count units _grp == 0};
_crew vehicleRadio "RadioMsg_boots_on_the_ground3";};
task1 setTaskState "Succeeded";
activate2 = true;
}; ```
Any help would be great.Thnx.
{!(alive _x) || _x in _heli} count units _grp == 0}
This gives error.
So you want check is _x in heli or _x is not alive, from which group?
That doesn't make sense.
If you want check that _x is in heli or _x is not alive AND in group is 0?
I didn't get what you are trying get checked before task1 completed.
And when you spawn, you need pass yours _heli, _crew and group there.
[_heli,_grp,_crew] spawn {
params ["_heli","_grp","_crew"];
// Your code here
};
foreach units _this also doesn't make too much sense.
_this = this sounds fishy if we start at that π€·ββοΈ
// anzac_fnc_gf_eject1 defined in cfgFunctions like a civilised person
// defining local variables just to hardcode them as references to global variables is silly, use function arguments
// [grp1,copilot,h1] call anzac_fnc_gf_eject1
// the distinction between _grp and _this is unclear, it seems like they should be the same thing.
params ["_grp","_crew","_heli"];
{
unassignVehicle _x;
_x action ["Eject",vehicle _x];
} forEach units _grp;
[_heli,_grp,_crew] spawn {
// this is dubious, it waits until there are no dead members of _grp, so if one dies during the unload process for any reason, the script won't complete until they get cleaned up from the group
waitUntil { ({!(alive _x) || _x in _heli} count units _grp) == 0 };
_crew vehicleRadio "RadioMsg_boots_on_the_ground3";
};
// properly tag your global vars to avoid conflicts
anzac_task1 setTaskState "Succeeded";
anzac_activate2 = true;```
any ideas?
this is the code that triggers the fade
waitUntil {!isNull findDisplay 46};
[findDisplay 46, 57, 1, {
introCinematicHandle = execVM "scripts\introCinematic.sqf";
publicVariable "introCinematicHandle";
[1, "BLACK", 1.5, 1, "EventTrack02_F_EPA"] spawn BIS_fnc_fadeEffect;
sleep 1.5;
["USS Liberty", "Task Force AEGIS", format ["Year %1", date select 0]] spawn BIS_fnc_infoText;
}] call BIS_fnc_holdKey;
sometimes, like 1/4 of the time the cutscene cinematic "bars" disappear too
i'm confused as to why
Does it also happen if you use cutText (or equivalent) directly instead of using BIS_fnc_fadeEffect?
well the thing is that this hold key event isn't fired, so it has probably to do wth cuttext
I don't understand.
the background created using cuttext disappears after like 10-15 seconds
CfgPatches entry for every pbo is mandatory, so that's the best to check, not cfgAddons
how can i check whether a mission handler is null or not?
my attempt:
if (!wjtk_gearChangedEvent isEqualTo objNull) then {```
if (isnull wjtk_gearChangedEvent) then {
Type number, ... Location expected
it means wjtk_gearChangedEvent is number
but it isn't lol
wjtk_gearChangedEvent = addMissionEventHandler ["EachFrame",
{
private _items = toArray (uniqueUnitItems player);
if (wjtk_items isNotEqualTo _items) then {
wjtk_items = _items;
player sideChat str (_items call wjtk_fnc_isIncognito);
};
}];
It is
it should return an handle?
addEH Returns the Id of the EH, which is number
Handle is a number
You want is is isNil "varname" to check if the variable has been set
thanks
i thought it returned an event handle
It does, but an event handler's handle is just a numerical ID. It doesn't have a special reference type, it just has a number.
another question can a forEach loop be broken?
Broken? break works yes
exitWith
We have break (we do right? Next to continue?)
what about breakWith?
would that return the value inside the {}?
Well if you need that, that should work
Hi! I'm trying to use Sector Capture module. I want to reward side when one side capture all of the sectors and then lock capture of this sectors for 30minutes. After that time re-enable sector capture. I don't know how to prevent sector capture. enableSimulation =false locks it forever and it can't be captured after I set enableSimulation =true. Any ideas?
Is there any real point to obfuscating your ArmA code?
I mean KOTH even already has bootleg versions...
no.
there is at the server/community level
i did in 2016
when tanoa launched, i wanted 24/7 full server to dev on. if i open souced, other existing communities simply re-host and then you find server is not 24/7 full as players spread out.
immediately after i shut my server down i published to public repo
it prevents a good amount of people from reading your code. but if one tries harder, it won't be a problem for them π
hey guys,
In SQF, you can use the typename keyword to define a new type, which can then be used to create variables and arrays of that type. You can use the typename keyword to define a data structure that is similar to a struct in C++ or other programming languages.
is this true?
Who said so?
Well it definitely wouldn't be similar to a struct
A struct is stored on the heap.
Nothing to do with structs.
https://community.bistudio.com/wiki/typeName
typeName indeed is a command, but it is a getter not a setter
Arma doesn't allow binary files apart from SQFC in terms of code or you can use an extension.
But definitely nothing like a struct.
SQF is a purely procedural language.
just checking guys.
lol
ChatGPT needs to die
Doesn't even generate the correct code.
Stack overflow has banned it's use in coding questions.
ML models for text are horrendous they aren't able to determine intention and they certainly don't understand common sense.
The future of AI is less data not more.
I get your point, but at least he doesn't respond with snide comments
snide huh? Just stating facts.
it wasn't a reference to you
Oh.
If people give you snide comments meh just ignore them, focus on getting help (scripting, GUI etc)
but there names are in green and blue xD
Meh, I work on my own projects. Like a working IVAS UI
it does interpret my code pretty well, but then again it's my code... simple and buggy...
ML models have a lot of problems, like they don't deal with ambiguity well. Humans can work out something with incomplete information ML models just can't. They also can't be trained in real time and updated in real time either.
hum... I gave it snippets, and it made a nice complete picture.... but then again, my code...
I can see how it didn't understand what TypeName was.
It probably assumed that was a data type declaration.
Like int, double , struct etc.
Let's focus on real SQF, not how the AI's horrible?
right, cuz I use this page a lot
https://community.bistudio.com/wiki/typeName
and never saw any reference to creating a data type
If it had getTypeName. it probably wouldn't have messed up just food for thought agreed back to SQF
Ever messed with cfgBrains.hpp ? Just curious it's a config entry in the samples file
Huh?
cfgBrains.hpp
Do not think have ever did
Lots of interesting stuff in the examples files
A lot of it wasn't there what 2 years ago I think
Even custom fonts.
I don't think there's anything interesting
What exactly are you talking about? A font does nothing to do with CfgBrains
Just mentioning the random stuff in the Samples folder
Then it is not a question?
k nvm
I don't mean you can't chat so, but I've expected to be a question
Can description.exts take cfgPatches.hpp ?
Never think so
Why you'd ask in the first place? CfgPatches exists to manage the load orders of an addon/config
So just comment out the cfgPatches section and just include the UI headers? Functions etc?
It's for testing a mod.
What UI headers? What's the situation?
I've got a mod which is basically the Integrated Visual Augmentation System
The UI functionality for it, I use someone elses already made mod to act like the initializer.
And it has functions, the usual.
How can I test most of it's functionality within a mission?
A UI entry can be included into a description.ext indeed
Yeah so can the cfgFunctions.hpp
A hpp more like #include does mean nothing, but it is just a text file
#include does only a dumb copy and paste
Ahhhh. Okay so it's just copying everything in the path back to that file?
Yes. Not even mandatory to do, but it makes somewhat easy to debug or manage
Just a practice, nothing more or less
Build System for Arma 3. Contribute to BrettMayson/HEMTT development by creating an account on GitHub.
Thats HEMTT
And what is
build
?
Configures dependencies, file paths, things a bit like CBA_A3's build system for addons?
I don't know the build system that CBA has you say
can you make marker visible in map but not in GPS?
Use drawIcon instead
isnt that slow?
Unfortunately
π΅βπ«
at times CBA console looses the stores code for the watcher fields - is it known what causes this? too much code? "unclean" game exit?
@proven charm GPS has its own UI classes you can modify - pretty sure there is also a parameter for marker display now
however if you are mission/game mode only, doesnt help - alternative is to make your own GPS/minimap UI
I'm probably just going to use addMissionEventHandler ["Map", ... and hide those markers
yes it does and I'm not sure about the cause but along with CBA I also have other mods reseted
doesn't it store it in profileNamespace?
so if that gets corrupted, as you said, by a bad game exit/whatever, the data will be lost
well its not all fields necessarily - can be, but can be also just one of the four
actually, for the watch fields cba doesn't do anything
it's all vanilla
https://github.com/CBATeam/CBA_A3/blob/da4539095ca62836c555b38523918a1c36e9eb1a/addons/diagnostic/fnc_initExtendedDebugConsole.sqf#L307-L315 just something with pausing
Q: is there a function, scripting command or BIS function, that converts degree direction to cardinal directions? i.e. 0 'N', 15 'N NE' and so on
not that I know of. but it's not hard to write one yourself:
[
"N",
"NE",
"E",
...
"NW",
"N"
] select (_angle / 45)
_angle must be between 0 and 360 ofc
do a % 8 π so it's "safe"
if not make sure it is (this supports angles in range [-360, INF))
(_angle + 360) % 360
i meant if angle is something out of "range"
nice. I elaborated a bit, supports a couple different divisions if more precision is required.
private _cardinals = switch (_divisions) do {
case 0: {
[
Q(N)
, Q(E)
, Q(S)
, Q(W)
, Q(N)
];
};
case 1: {
[
Q(N)
, Q(NE)
, Q(E)
, Q(SE)
, Q(S)
, Q(SW)
, Q(W)
, Q(NW)
, Q(N)
];
};
default {
[
Q(N)
, Q(NNE)
, Q(NE)
, Q(ENE)
, Q(E)
, Q(ESE)
, Q(SE)
, Q(SSE)
, Q(S)
, Q(SSW)
, Q(SW)
, Q(WSW)
, Q(W)
, Q(WNW)
, Q(NW)
, Q(NNW)
, Q(N)
];
};
};
private _divAngle = 360 / (count _cardinals - 1);
_cardinals select ((_dir % 360) / _divAngle);
excuse the macro script component stuff
initially I started with algo to calculate the gaps in the "NESW" but this is straightforward enough.
Can someone tell me how https://community.bistudio.com/wiki/terminate works exactly? I want to terminate a already running function and somehow it just does not work.
and how do you do that exactly?
terminate simply tells the scheduler to remove a script from the processing queue using its handle
Hmmm, so is there a other way in killing a running function? Like I got a function that runs about 10m changing stamina and so on. but when you respawn it just keeps running like nothing happened. So I need to kill that function now somehow.
you didn't answer this question
how do you run the function, and how do you terminate it?
I run the function upon respawn. The function is not terminated.
Like if you respawn this function will reset all the values.
I mean show me some code
That is what I've tried so far but it only resets the stamina, it does not remove the chroma effect or stops that "PervitinLocal" function from continuing executing.
/// Clear Stamina
if (ACEGVAR(advanced_fatigue,enabled)) then {
["PDF"] call ace_advanced_fatigue_fnc_removeDutyFactor;
["EDF"] call ace_advanced_fatigue_fnc_removeDutyFactor;
} else {
params ["_patient"];
_patient enableStamina true;
_patient setAnimSpeedCoef 1;
};
/// Clear chroma effect
params ["_handle"];
ppEffectDestroy _handle;
/// Terminate script
_script = [] execVM "fnc_treatmentAdvanced_PervitinLocal.sqf";
terminate _script;
That is the whole file.
the last part is only important cause that is the one I added.
here is my PR for the integration I wanna do. https://github.com/Tomcat-SG/KAM/pull/219
/// Terminate script
_script = [] execVM "fnc_treatmentAdvanced_PervitinLocal.sqf";
terminate _script;
``` you're executing the script then immediately terminating it?
Ohhh, well I need to execute a already running script. Is there a way to do that?
store the script handle to a variable when you first execute it
then terminate it with that variable later
How do I do that exactly? Sry, I'm kinda new to arma coding and lack a lot of things (started 2 weeks ago)
//execute the script
my_global_variable = [] execVM "...";
//terminate it later
terminate my_global_variable
variables that start with a _ underscore are local and can only be referenced within that scope. If you want to store a variable in one script and reference it in another you can name it without an underscore at the beginning and it will automatically be stored in the mission namespace (persisting as long as the mission is running)
can bounding box data be obtained through config?
I don't think so. It's only present in the models, and you have to create an object to get bounding box data for it in scripts.
It's faster to map it into an array
Doesn't need all that.
Map your 360 degree into a range of 0 - 15
Then select each element based on an
_headings = ["N","S","E","W"] ;
_index = round(((getDir player) % 360) / 22.5);
_compassDir = _headings select _index;
Much faster than multi level case select code
Is there a line of script or smth I can put into a character to double their health? Ace Medicalβs pretty annoying when it comes to concussions and headshots and Iβd rather not have to use Zeus every time.
Hey, I tried that but so far I'm not really getting it to work. :/ Can you maybe give me a hand on where I should put it in so it works properly.
Reduce the pain uncon chance to 0 & increase the player damage threshold to 25. IDK if you can change that mid mission for just one unit but it's worth a try. Maybe ask at the ace Discord cause it's their mod and they know that stuff.
I can't help right now, sorry
heyo, 2 questions. Is there a better way of setting event handlers for CBA? can i provide an array of classes to set the event handler to?
And is there a better way to check if the vehicle is disabled? It is a pain when vehicles in ace survive 5 rockets and the mission requires that they die.
["rhs_t80ue1", "HandleDamage", {
if ((_this select 2) < 20) then {
_this setDamage 100;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_t72be_tv", "HandleDamage", {
if ((_this select 2) < 20) then {
_this setDamage 100;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_t90sm_tv", "HandleDamage", {
if ((_this select 2) < 20) then {
_this setDamage 100;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_t14_tv", "HandleDamage", {
if ((_this select 2) < 20) then {
_this setDamage 100;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
["rhs_zsu234_aa", "HandleDamage", {
if ((_this select 2) < 20) then {
_this setDamage 100;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
does this imply it is possible to, in singleplayer campaign, switch the player character to another unit without decompiling the entire mission and switching said unit to be the player?
I tried using it, but it didn't seem to work. Also is the name of a unit simply what it reads off as in Zeus? the wiki didn't seem clear on this
unit name on this page means the unit variable I believe
this means you can just use createUnit to create that particular unit after mission starts
so.. ok actually I should just ask, is it possible to change the player character's unit in an arma 3 mission like east wind without decompiling the entire mission then changing it manually?
I know almost nothing about scripting in arma 3
i don't even know how to get the name of a specific character in-game
is it possible, yes, but not really. you'll need a good amount of work arounds. you'll have to grab the variable name of the unit you want to change to (BIS typically names all their units - you'll have to decompile to easily grab the one you want). Then you'll have to gather all event handlers/effects on that unit + the unit variable, delete the unit, then recreate the unit all in post init (which then that can cause problems with any scripts that will run on that unit because the object variable will become nil/null and mess that up). then you'll have to store that unit as the variable from before and apply all events/effects on that unit after its creation. And that's if you really take that warning to heart on the wiki page - you can risk it as well and ignore it.
so for for you at your current knowledge level, no its not possible.
oh.. ouch
so just for clarification, my problem is basically, whenever I spawn an OpTre spartan with Zeus then possess him with the possession mod, I can play as him, but none of the level triggers respond to him like, for example I can't trigger cutscenes and stuff unless I'm in the base-mission's unit. Is it possible to make this new possessed unit trigger the mission scripts and stuff, or is that impossible?
Is there a better way of setting event handlers for CBA? can i provide an array of classes to set the event handler to?
use apply or forEach and an array of all your classes
yes, you can add variables to units spawned in zeus. easiest is using zeus enhanced because you get a script box you can put custom scripts in for that particular unit when you double click
then you can have in a particular trigger to wait until that variable exists, then continue with evaluating the trigger
like, East Wind for example. I can get on the buzzard as my spartan, but the chopper doesn't move until Kerry specifically hops on
how would I make the chopper leave when only the spartan hops on, without decompiling?
I'm gonna stop you right now, this undertaking that you want to do of converting east wind into a optre mission, its not going to be worth your time. it would be faster to just recreate your version of the mission itself
π
you're gonna hit a bunch of walls
well I mean, to be fair, if you think I'm...
to keep things short for clarification it's just that one spartan
still too hard?
you have to make your spartan the same variable as kerry... its BIS_something i don't remember
oh perfect so just change that one variable?
you know what would be easier?
(also thabks for the help btw. I literally know like 0 of this)
just giving the equipment you want to the default character
I literally don't ππ
oh i wish. I tried that but my gear won't work on em. Different skeleton
infact the spartan itself is irrelevant. I just wanna play as my model from gmod, but he's too big for the normal skeleton, so I have to spawn a whole spartan just to play as him
π
okay so try these steps:
- get zeus enhanced
- spawn your unit
- double click unit and open up its interface, look at bottom for script box
- put in (now remember i can't remember the variable BIS uses for the player/kerry)
BIS_something = _thisand run it
And is there a better way to check if the vehicle is disabled? It is a pain when vehicles in ace survive 5 rockets and the mission requires that they die.
canFire and canMove
screenshotted. Thank you SOOOOOO much man you'll've saved me ages of effort if this works
uh... anywhere you think of I could look for that code liney thing Bohemia used on Kerry?
Thank you so much, like this correct?
{
// Current result is saved in variable _x
[_x, "HandleDamage", {
if !(canFire _this && canMove _this) then {
_this setDamage 100;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
} forEach ["rhs_zsu234_aa", "rhs_t14_tv", "rhs_t90sm_tv", "rhs_t72be_tv", "rhs_t80ue1"];
well your condition is wrong
but the foreach setup is correct
remember, the parameters for HandleDamage is
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
and setDamage is on a 0-1 scale
and also your condition as is, will blow it up if either of the canX is false
not if both are false
yes I understand that, the enemy doesnt try to repair so as long it cant fire I dont mind total destruction
!(true && false) is !(false)
vehicles cant be captured either so it doesnt matter too much
would anyone know what variable Bohemia used to like, make Kerry's presence trigger events in the East Wind missions?
like, what variable would I add to another unit if I wanted another unit to trigger all the cutscenes and stuff like Kerry does?
I strongly doubt it's that simple
You're trying to replace yourself with a Spartan, right? That's probably going to break stuff. BI campaign missions do a lot of things like playing specific animations on the player, and those won't work with the Spartan skeleton
is there a possibility that canFire and canMove do not work with ace? I just hit a ZSU with 3 heat rounds, every part is read but it still lives.
{
// Current result is saved in variable _x
[_x, "HandleDamage", {
if !(canFire (_this select 0) && canMove (_this select 0)) then {
(_this select 0) setDamage 1;
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
} forEach ["rhs_zsu234_aa", "rhs_t90sm_tv", "rhs_t72be_tv", "rhs_t80ue1"];
it certainly worked in old man atleast. The only problem with east wind is the helicopter won't move unless kerry specifically sits in it
well did you hop in it and see if it could still fire?
why are you using _this select blah anyways, params is cleaner
forgot again, will do that.
yes for some reason it can still fire, I checked in zeus enhanced though and Gun, Turret, and both tracks are 100% damaged
well canFire looks to have some wonky results in the last note posted. might want to do a damage check on the selection (second param)
anyone remember the hex role playing mat... LOL
No need to drawPolygon, use negative X and Y for a Ellipse marker
It does make it hex somehow, perhaps it is just a bug but still alive
looks too intentional, tbh
interesting, will certainly help not drawing 6 triangles with drawTriangle, since drawPolygon does not support color fill
lol nice
Or 6 triangles or 2 Isosceles Trapeziums
The 6 triangles would probably be much neater
for "_iTri" from 0 to 5 do{
_Dir0 = -30 + _iTri*60;
_Dirf = _Dir0 + 60;
_cMap drawTriangle [
[
_Center,
(_Center vectorAdd ([sin _Dir0, cos _Dir0, 0] vectorMultiply _EXRad)),
(_Center vectorAdd ([sin _Dirf, cos _Dirf, 0] vectorMultiply _EXRad))
],
[1,1,1,1],
(format ["#(rgb,1,1,1)color(%1,0.20)", _Color])
];
};
true
Reason it works the point of a triangle overlaps the interior of a hexagon at 60 degrees equilateral triangle. starting at 0. When they meet at the point the 60 * 6 = 360 degrees in the center.
would 3 triangles work? cut the baselines across opposite corners. and the third point any of the others, walk that around three times.
It's messy but yes.
and the overlapping fills.
With the 6 triangles you can treat them like a sort of quadrant system.
Allowing you to detect if it's in each triangle.
More specifically you can use polar representation for it.
And check the angle using 2D dot product.
Take the inverse cosine there you go got your angle.
@gaunt tendon Best way to determine your spawn able area would be to check if certain objects intersect with those locations, Check for things that would cause collisions, Trees, rocks, buildings, or terrains with too sharper gradients. Then probably store that as a precomputed array
ty
for now Im using findEmptyPosition along with nearestTerrainObjects
You can use the surface normals to check the gradient which is basically the vector facing away from the tangent intersection at the terrain if you want to run your own
yea, was thinking to get an average of multiple samples of a small area to get an idea of the terrain gradient
At least you don't have to take the derivative of any parametric curves, or partial derivatives.
Unless you really want to get a vector valued function then plot multiple points on the surface normal.
The number of samples would determine the accuracy of your gradient.
As graphics environments are subject to aliasing on data.
maybe I should π€
Bare in mind anything in terms of real analysis, will be subject to computational restrictions.
Might also be useful
thanks mate π
Is there any way to make AI weapon control more precisely?
Context: I'm trying to make an AI on a Praetorian more robotic so should move the turret precisely
It is okay if is a vehicle/turret or probably the AI unit config related
With 1st Google search to question
"Does eh get removed when unit get deletes"
Was "yes", but some comments was
"Soο»Ώ it is betterο»Ώ to remove all ehs to be sure"
So if i build eh where current unit get delete, i should remove eventhandler there too? Right?
If an EH is assigned to a unit that gets deleted, you don't need to worry about removing the EH.
Good to know! Thanks
Is there a lazy evaluation solution for this block of code?
All_Map_Vehicles = nearestObjects [GF_VRC_centerPosition, ["Landvehicle","Air","Ship"], worldSize];
{
_Vehicle = _x;
if (
(!(typeof _Vehicle in GF_VRC_tpw_radio_carlist))
&& {!(_Vehicle iskindof "StaticWeapon")}
&& {!(_Vehicle iskindof "ParachuteBase")}
&& (isNull (attachedTo _Vehicle))
&& (!((typeOf _x) in Vehicle_Exclude_List))
) then {
All_Map_Vehicles = All_Map_Vehicles - [_x];
};
} forEach All_Map_Vehicles;
Basically define All_Map_Vehicles with the conditions in the if statement
So I want to place an ACE Arsenal on a vehicle that can be accessed only by OPFOR alongside being a respawn truck of sorts for them (I know how to do the latter half). How do I make the ACE Arsenal only allowed to be accessed by OFPOR?
This is for a multiplayer pvp scenario btw
Where is the laziness supposed to be if you check all the vehicles anyways?
the laziness being not defining an array, running an if else loop inside a foreach that subtracts from the original array
select
That's it, thanks Lou
All_Map_Vehicles select {condition} to not re-create array a thousand times over is the only obvious optimisation π€·ββοΈ
yes, thats what I was looking for. Apologise for mischaracterizing that was lazy eval
@agile pumice you may also be better useing vehicles, no? (+ excluding weapon holders)
Probably. I was asked to make this code run better and I'm not sure of what the exact edge cases they want to consider are
Is there an eventhandler that handles vehicles created mid-mission via sqf or otherwise? (excluding zeus placed as I know that has its own event handler)
or maybe https://github.com/CBATeam/CBA_A3/wiki/Adding-Event-Handlers-to-Classes-of-Objects on the base class(es) of what you're trying to track if you're willing to go dependency way
Thank you
whats the best way to find the closest player within 800 meters? I was thinking nearestObjects [_unit, ["player"], 800]; but im not sure yet if there is a player classname like that
There is not
You can use https://community.bistudio.com/wiki/BIS_fnc_nearestPosition with playableUnits and then do an additional check to see if it's within 800m
Anyone know if in vanilla or even CBA/ACE there is something like a funeral director, i.e. that watches corpses, and after time time, does an automatic GC?
Ah perfect, thanks! conversely, addToRemainsCollector, assuming that is not the default disposition.
something like, [_objects, [], {_x distance player}] call BIS_fnc_sortBy params [['_nearest',objnull,[objnull]]]. assuming what your _objects i.e. nearest to what, are, on local client player or corresponding _player instance.
the only think nearestObjects is doing is telling you ALL those objects in the radius, not necessarily qualitatively what proximity.
I run a similar sort of calculation on secondary objectives, establish nearest player in proximity of that objective, and then shade a gradient circle shape lighter or darker, depending on proximity.
sort of like that childhood game, marco polo, colder warmer, etc.
hmm, that does look to do what I need but I believe the code is running on the server so I am about to try Nikkos suggestion of nearestPosition
private _nearestPlayer = [playableUnits, _x] call BIS_fnc_nearestPosition;
if (_nearestPlayer distance2D _x <= 800) then {
(group _x) addWaypoint [position _nearestPlayer, 10];
} else {
(group _x) addWaypoint [position _x, 10];
};
interesting, did not know about that one.
if it is a terrain object, I think that can even sort the objects for you.
https://community.bistudio.com/wiki/nearestTerrainObjects
I'm trying to write a new FSM, but I cannot save anything in .fsm format. I get an error "No Compile Config Specified" and I have no idea how to fix it. Where are those compile config files?
see https://community.bistudio.com/wiki/FSM_Editor_Manual
you need to define a config
they are in⦠the FSM Editor install dir iirc
derp
use near(est)Entities not objects. it's way faster for that
faster than this? [playableUnits, _x] call BIS_fnc_nearestPosition; and then doing a distance2D check
depends how many players there are
what you wrote should be slower when there are many players. If we had nearestEntities it would be no question but now... 
Well, if you want to optimise that code then you should do inAreaArray before BIS_fnc_nearestPosition, although if all the players are usually within 800m it won't help.
In some cases it's actually worth it to chain inAreaArray calls with different distances.
probably not here, although it depends on typical player count/distribution.
BIS_fnc_nearestPosition could really do with an engine solution :P
Or just think about how frequently that search is performed and if it's rare enough - just write whatever and don't touch unless it creates a noticeable performance problems π
well it wouldnt be rare for players to be all over the map, there is 1 main ao that is 800 meters wide and then multiple sub objectives around the map. Currently the playercount is low around 5-10 a day but I would likely forget about this in the future so its better to do what is most performant now. I will attempt that, I see there is a "man" class I assume that will get players, but it will also get ai wont it? that could be an issue due to a constant large-ish number of ai on map
in spawn code executed at the start of every AO
_units spawn {
waitUntil { sleep 5; (count (_this select {alive _x})) < 25 };
{
_x enableAI "PATH";
private _nearestPlayer = [playableUnits, _x] call BIS_fnc_nearestPosition;
if (_nearestPlayer distance2D _x <= 800) then {
(group _x) addWaypoint [position _nearestPlayer, 10];
} else {
(group _x) addWaypoint [position _x, 10];
};
} forEach _this;
};
but it shouldnt execute till near the end of each main ao
There is no classname that can only get players, because any unit class that could be a player could also be an AI. Player isn't a class, it's a state.
Are these 1-unit groups?
That is of course unless, as the mission designer, you know exactly what classes the playable units are, and specify those. That's very mission-specific though and not futureproof.
nope, yes I know of the issue where a 6 man group has 6 waypoints set, will fix it in a few lol
Well, i'd say move the player search outside of forEach loop so ot is once per "ao" and not 25 times in a row and don't bother optimising that further π
If you can check against AO position rather than unit position, sure.
yeah for low player count it's not worth optimizing
also the code is not running in any "critical" place so that makes it even less worthwhile
alright I understand, well ill fix the many waypoint issue and leave it for now
I think ill leave the player search in the for each loop though cause if I dont then all ai in the zone would go to one player, whereas now they should go to whichever player is nearest to them id hope
and this
hmm is it affecting performance alot to do the search?
its not a huge deal just thought it would be interesting to have the ai act like that
well at least move playableUnits out of it
25 searches without any sleeps are 25x more likely to cause a lag spike
gotcha alright ill fix it
in schd it won't cause any lag
Well, okay, i'm overexagerrating
I'd be very careful with N-squared code in SQF, but if the worst case here is 25x10 and you're only running one of those at a time (not clear here) then it won't be a problem.
HELP WITH ropeCreate:
how to cut ropeCreate when it's a certain length and then destroy it? or just destroy it when it gets pulled at certain length?
mycode:
myRope = ropeCreate [cnn, "usti hlavne", player, "Righthand", 2, "usti hlavne", "RightHand", "Rope"];
anyone got experience with dev build and Text/UI on Texture, as described as WIP in https://community.bistudio.com/wiki/Procedural_Textures ? Currently trying to add a LSO camera to the Nimitz and it has all kind of text info on the camera - Date, Time, Airspeed, Distance, Descent Rate, Deck Status, Carrier Number and Wind Over Deck. Some of this is static, but for example time of course changes every second. I wonder what's a good approach there, maybe make a UI out of it and then try #(rgb,Width,Height,MipCount)ui("DisplayClassName","UniqueName","texType") on the hiddenselection for the face in front of the camera?
check https://community.bistudio.com/wiki/ropeLength . For example for the ropes as arresting wires on Nimitz I use this to cut them when the wire snaps. For the complete sample, check the code in https://steamcommunity.com/sharedfiles/filedetails/?id=2774907999
how could i assign a faction to independent forces?
i tried side=2; however upon loading the game the faction is still BLUFOR
That's probably a question for #arma3_config
Check all the conditions and find an equivalent Boolean expression solution. Pretty sure I can see DeMorgans law more than once in there.
See if you need to evalulate certain things or could you reduce it in any possible way.
Why does bi, constantly add new commands that are basically almost the same functionality as others, then give them new names, when they do the same thing if not better? Why not just internally redesign the code to behave in the same manner?
Example?
findif vs foreach etc
I am pretty sure I know why, backward compatibility?
So the new updates don't catastrophically break everything else?
For each could have been adapted to behave like findif
if you just did say.
{} foreach ["true"];
Things like that.
Or it could have been generalised to
{} forEach ["delete"];
{} forEach["Insert"];
etc?
blinks
I have no idea what your syntax is supposed to do.
People used to use forEach as a findIf because there wasn't one, but it was hacky and slow.
well {_x] forEach ["operation",_array];
{_x} forEach ["delete",_array,_element];
Then again I can definitely see this getting out of hand and for brevitivity is probably why by BI never goes this route. Just food for thought.
My point is why create new commands when you could simply adapt existing ones? I mean as a scripting language ArmA 3 is very.... verbose?
over 2000+ different commands. Conventional scripting languages say powershell, or python, or even Ruby have neat and tidy limit on how many commands exist.
Uh, because it's the API not the language.
Isn't the scripting language even if conditions also commands themselves?
Yes, there's no distinction in SQF. But hence you can't compare the command count to general-purpose programming languages.
Fair enough.
The core actual "language" features of SQF aren't that verbose; you have your basic set of conditionals, loops, etc. that every language has, plus some SQF-ified equivalents of things like foreach and find/indexOf
95% of the verbosity of SQF is due to the fact that SQF also functions as the API for doing... almost everything in the game
hence it's necessary for there to be a command for almost everything, and generalizing it down to commands taking string inputs isn't exactly the cleanest way to go about handling it
imo bigger issue in my eyes in that the language still features a plethora of broken commands of varying usefulness, many of which it's uncertain will ever be fixed
does find work with two arrays?
In what sense?
let's say i have this array:
_testArray1 = ["AAA","BBB","CCC","DDD","EEE"];
with how find usually works, it'd return position 0 if I wanted to find "AAA"
i'm trying to do the same thing, but instead of a single string i want to find anything within another array, like this:
_testArray2 = ["BBB","EEE"];
and return 1
i tried
_testArray2 = ["BBB","EEE"];
_output = {_testArray1 find _x}forEach _testArray2;```
but unsurprisingly it didn't work and returned with 4
wait
you're not storing the return for the first iteration so it's overwritten by the second one
am i stupid
i would do arrayIntersect but i need the position of the search target in the array im looking in
ah, disregard then
Heli1 addAction ["open Jukebox", {
_display = (findDisplay 46) createDisplay 'RscDisplayEmpty';
_RscListbox_1500 = _display ctrlCreate ["RscListbox", 1500];
_RscListbox_1500 ctrlSetPosition [13 * GUI_GRID_W + GUI_GRID_X, 6 * GUI_GRID_H + GUI_GRID_Y, 11.5 * GUI_GRID_W, 11.5 * GUI_GRID_H];
_RscListbox_1500 ctrlCommit 0;
_RscListbox_1500 = lbAdd ["Fortunate sun"];
_RscListbox_1500 = lbAdd ["ride of the valkyries"];
_RscListbox_1500 = lbAdd ["for what it's worth"];
_RscListbox_1500 = lbAdd ["house of the rising sun"];
_RscListbox_1500 = lbAdd ["i was only 19"];
_RscListbox_1500 lbSetCurSel 0;
_RscText_1000 = _display ctrlCreate ["RscText", 1000];
_RscText_1000 ctrlSetText "Radio Jukebox";
_RscText_1000 ctrlSetPosition [13.5 * GUI_GRID_W + GUI_GRID_X, 4.5 * GUI_GRID_H + GUI_GRID_Y, 11 * GUI_GRID_W, 1.5 * GUI_GRID_H];
_RscText_1000 ctrlCommit 0;
_RscButton_1600 = _display ctrlCreate ["RscButton", 1600];
_RscButton_1600 ctrlSetPosition [13 * GUI_GRID_W + GUI_GRID_X, 17.5 * GUI_GRID_H + GUI_GRID_Y, 11.5 * GUI_GRID_W, 1.5 * GUI_GRID_H];
_RscButton_1600 ctrlCommit 0;
_RscButton_1600 ctrlAddEventHandler["ButtonClick",{
params ["_control"];
_display = ctrlParent _control;
_listBox = _display displayCtrl 1500;
_index = lbCurSel _listBox;
systemChat format['Song is: %1',_listBox lbText _index];
playSound3D ["", Heli1];
}]
}];
```giving me an error undefined variable at ```#[13.5 * GUI_GRID_W + GUI_GRID_X, 4.5 * GUI_GRID_H + ```
have i messed up the gui?
no, the vars are just not defined
setPylonLoadout is local effect. If a player JIPs, will they see the vehicle's default config loadout, or the vehicle's loadout as the server sees it?
If they see the default loadout, what's a good way of applying setPylonLoadout for JIP clients so that they see the current loadout (i.e. minus expended ammunition) rather than the initial full load?
Well, I had a look at some previous discussion and it seems like the answer is "JIP gets the server configuration". Here's hopin'.
I'm under the impression that is correct. IIRC trying to JIP the command just caused problems and I'm now not JIPing
Why it's a local-effect command in the first place is baffling to me.
My guess would be "designed for SP, didn't think about MP"
is there some way that vehicle wrecks differ to vehicles as an object? I'm trying to find a way to get Enhanced Sling Loading to let me attach ropes to a wreck. it recognizes that I can, but then the ropes just get dropped when I actually hit the button
Question: In terms of performance, how expensive is this operation.
Every n seconds, iterate through 300-400 AI, and disable their path ability
It's a somewhat crude solution, but I can't think of any better way to ensure that AI transferred to headless keep their disabled path trait
Like, if I ran that every 5 seconds, how much is that going to suck
depends on a lot of factors, why not just disable the trait once transfered? Most of the stuff need to be reconfig when transfering locality anyways.
Whats preventing you to create the AI directly in the HC and avoid having issues instead?
@kindred zephyr
Not entirely sure how to do that. Even if I set ownership as part of unit init, I'm still transferring it aren't I? I know I could run a spawn script as part of the headless client's init.sqf, but given the number of AI and how precisely they are all placed, I'm not sure how practical it is to do that.
We use Zulu Headless Client to transfer things, but obviously we wouldn't know when the AI transfers as it does balancing over time. That was why my hope was to iterate through and just keep disabling pathing to account for rebalancing.
The mission takes place in a massive interior. A lot of units have fixed positions, and if they wander around for more than a second, they'll probably clip through the floor or walk through a wall, etc
are these enemies being constantly spawn in? or just a one time spawn thing?
Dont do work in units inits, or atleast create them and then execute whatever you want the unit to execute when creating them instead of doing it by default.
Depending on third party tools is never great unless they are properly documented anyway.
If the units must not move even for a sec, its better if you create them and immediately disable their pathing AI, as locality transfer and how quick will the AI be disabled is not guaranteed as it depends on both bandwith and processing speed.
Its better if you prepare a script that precisely do what you want directly over HC, at least it seems much more convenient that constantly checking if the AI has pathing disabled.
edit: For 400 units, are you fighting them all at the same time too? Or are they just there standing waiting their turn for engagement? If this is the case, you might have a mission design issue then because having 400 AI doing nothing at all time even transfered its not good.
400 AI is a lot. You should look into some kind of dynamic spawning or at very least aggressive caching. I accidentally put 400 AI in a mission recently and that was causing a sFPS crunch even before they went active (don't worry, that version never went to the live server...).
^ once you figure out how you want to spawn you units instead of preplacing them, just remote execute to the HC
So im trying to create a unit by an action, Give the player control of them, then by another action delete the unit and then go back to controling the actual player.
I have it good up to the going back to the player part, For some reason it switches my camera back correctly but it wont give me control, any idea?
this addAction ["Control a Hunter", {
params ["_caller"];
"WBK_HunterSynth_1" createUnit [position hunter_pad1, group player, "hunter = this"];
player remoteControl hunter;
hunter switchCamera "Internal";
removeAllActions hunter;
hunter addAction ["Exit the hunter", {
selectPlayer kilo1;
removeAllActions hunter;
player switchCamera "Internal";
objNull remoteControl player;
deleteVehicle hunter;
}];
}];
its probably because you are trying to change control back to "player", as "player" its not the object itself, but you as an entity in the game, assign it an identifier and use that instead of player, and then first change the control to the unit/object and then change the camera to that unit, not to player
also, objNull remoteControl player;? What?
So use the variable name of the one i start as, IE the one im going back to
Its what the wiki says to use Β―_(γ)_/Β―
objNull remoteControl hunter; should return control to player, according to ex.2 at https://community.bistudio.com/wiki/remoteControl
^ its most likely that by using objNull as the left side parameter you cancel the remoteControl