#arma3_scripting
1 messages Β· Page 782 of 1
how about you show in a video or image what you're trying to do? maybe you're going all wrong about it 
you can't. I think they use the side defined in their configs
but if you're willing to you can make your own system
assembling and disassembling can be scripted
terminals can't but you can just give them terminals of whichever side the UAV belongs to
I've given the civs the terminal, UAV backpack, and tripod/hmg backpacks
Right, here I want the cargo containers to be connected to the yellow orbs right? except this is when my script looks like
private _fromTo = _prevPointPos vectorFromTo _nextPointPos;
// private _fromToCorrected = [_fromTo, 90, 2] call BIS_fnc_rotateVector3D;
_x setPosWorld _centre;
_x setVectorDirAndUp [
_fromTo,
[0,0,1]
];
I meant the side the UAV belongs to. my bad
they are unable to open the terminal (they can assemble the drone), and they are unable to assemble the weapon
ok
When I change my script to
private _fromTo = _prevPointPos vectorFromTo _nextPointPos;
private _fromToCorrected = [_fromTo, 90, 2] call BIS_fnc_rotateVector3D;
_x setPosWorld _centre;
_x setVectorDirAndUp [
_fromToCorrected,
[0,0,1]
];
This is what I get https://imgur.com/a/7CFWaqY
yeah I see what you're doing wrong
you want the container's right/left to be along _fromTO
you can't just rotate it by 90 degrees
let me fix it for you
I am giving them terminals and UAV bags of the same side, but they are unable to open the terminal
private _fromTo = _prevPointPos vectorFromTo _nextPointPos;
private _right = [_fromTo#1, _fromTo#0 * -1, 0];
private _up = _right vectorCrossProduct _fromTo;
_x setPosWorld _centre;
_x setVectorDirAndUp [_up vectorCrossProduct _fromTo, _up];
try that
_dir being?
that works!
it only works as long as fromTo doesn't point towards the sky [0,0,1] (or the earth, [0,0,-1]) 
what if needs to work for any angle?
well the problem is if fromTo points to [0,0,1] there is no unique "up" anymore
it can rotate freely around [0,0,1]
you can just make your own convention
e.g.
if (_dir#0 == 0 && _dir#1 == 0) then {_right = [0,1,0]}
I mean I could just add a check for that right?
yes
the joys of gimbal lock
this is one of the things quaternions solves right
yes
yeah clamping it is the best and fastest way
for SQF at least
if you make your own quats in SQF it's gonna be slow af and not worth it for per frame applications
I should go test the performance of mine, IIRC they're not that bad
you're right the game doesn't let you use those
how can I enable civilians to open UAV terminals?
Is there a way to draw pathfinding so that the units will follow a specific parh
instead of trying to accomplish their βbestβ path
I think you can chain together some doMoves
yes
that's possible
but it won't be good
the only practical way is using animations
What does this do
read the wiki
Well how would I get units to move to cover programmatically
this
no way as far as I see
How does LAMBS danger do it??
they dont deem to use unique animations
also animations
huh
How do you use animations to move?
doesn't have to be unique
you just play the movement animation
and make the unit face the correct way
I see
and they just move
is there a way to smoothly turn them so it doesnt snap
animations always play smoothly
I meant facing the unit
in that wiki category theres commands like MoveTo, do those play anims automatically?
no
they just tell the AI to move
like I said there's no way to give AI a path
you should trust a guy who's making an AI himself
you can
Does the AI not face the direction it needs to move?
Thats what I mean by pathfinding
I can use this in a FSM and some logic to find locations for cover, and use doMove to work right?
basically micromanaging the AI
you can but vanilla pathfinding is aweful
you can't just make them "move to cover"
they may not move inside the bounding box of the object (unless the object has a path LOD)
which is quite a headache
Just ran some performance tests
quaternions aren't that slow, multiplication averages 0.01ms, "division" 0.02ms, and rotation 0.06ms
How would I work with this though? Even if I had anims
and vectors 0.001 
if 10x is not slow I don't know what is 
I mean yeah but we're talking one operation doing the same thing as a large handful of vector operations
and even 0.06ms is a fraction of frame time even at 144fps
with anims you can
with moveTo/doMove you can't
with anims you just do a disableAI "MOVE"
and play the anim and the unit moves wherever he's facing. you then make him stop when he's close enough
So I would use vanilla move anims and then start/stop the anims depending on the position?
cause whst ur saying is the anims also move the character forward
right
yes
or backward, etc.
depends on anim
How would I determine what is close enough? A list of objects and their radius?
Is there a way for an AI using this system to take orders from waypoints (process them at all)?
you use the bounding box to determine that the AI is in an object
by "close enough" I meant to the end point. and for that you can use lineIntersectsSurfaces for example
to determine where they should take cover
well for 1 object maybe but for several no
you easily go beyond 1 ms
Not sure how bounding box works
That's fair, I'm not suggesting that they're ideal for per-frame applications
just that they're not horrendously slow
main tradeoff being that unlike BIS_fnc_rotateVector3D you can rotate around arbitrary axes
(plus, to be honest, my quaternion code could be further optimized)
does anyone know the bis for the ace arsenal
do you mean the function for ACE arsenal?
If you just need to open it on the player you can use [player, player, true] call ace_arsenal_fnc_openBox
ok ty
why can't I remoteExec cutText?
This works fine: cutText ["", "BLACK OUT", 1];
But this does nothing: ["", "BLACK OUT", 1] remoteExec ["cutText"];
is remoteExec restrictred in your server or mission config
CfgRemoteExec or battleye
that'll only be an issue if you're using a template where someone set that stuff up
no
I'm just testing in a singleplayer mission
nevermind, I just needed double brackets
yup because it takes an array of 3 arguments, not 3 individual arguments
yup
let's say I have two missionNamespace variables.
tOneDone and tTwoDone
I do the classic
private _tOneDone = missionNamespace getVariable("tOneDone", false);
private _tTwoDone = missionNamespace getVariable("tTwoDone", false);
waitUntil (_tOneDone && _tTwoDone) do {
...
};
(Given the docs are down and I don't remember the syntax exactly, consider it rather pseudocode)
Given I [] spawn {}; this,
will this work like I want it to?
Wait until both the variables are true (or negatet, not sure, docs are down
), the starts to execute the code that will be inside
TLDR:
Are private references updated when missionNamespace variable get's updated? That's the core of the question.
If no, should I add handlers on them?
I suspect it will be esier on the CPU, but it's only one loop, will be run only on server. (sleep 1 added somewhere in there ofc, docs down
)
(I'll probably solve it by checking it in the function setting the vars, but I still wonder if the references get updated)
waitUntil takes code {} for its condition but that would work
however
it'll just be stuck if the variable returns false
since it's not going to go back and check again
One of the things I would do if the docs worked and I was able to look at the examples
(They are up
)
So the reference does not get updated once the missionNamespace one does
if you're running the script in mission context you can just write the global variable
it will be in a file ran by init.sqf
but I think I'll go with the one time check once on of the variables is being set (they are simple toogle from false to true)
You would need to pull the variable each time to get the latest value, also don't forget to put sleeps in waitUntil conditions since otherwise they will hog the scheduler by trying to check the condition constantly
So, it's a not. The private reference is not a reference, but a copy.
Copy that, thank you!
waitUntil {!(isNil "tOneDone") && !(isNil "tTwoDone")};
``` will effectively suspend the code until both variables are defined
For your reference, everything in sqf is copy-by-value except for arrays which are copy-by-reference
which is why arrays have an explicit + operator for copying by value instead of reference
Got it. I just love switching languages, where all this changes. Lazy evaluation, left to right, right to left
Who's supposed to remember it all 
Speaking of lazy evaluation, are you aware of how to do so in SQF?
&& and || are not lazy-evaluated by default
No, I am not.
That was just one of the things that came up to my mind when thinking about language differences.
How does it work in SQF? Like it's gonna help something, but I am a optimisation freak
Basic idea is that SQF only lazy-evaluates booleans if one of the conditions is code, for whatever reason
you're not gonna like the answer
hence to lazy evaluate if (cond1 || cond2)
you actually need
if (cond1 || {cond2})
if (a && { b && { c } }) then {};
then it will lazy-eval
yup and if you have more conditions
you need to nest concurrent ones in more code
alright, fuck it, I am going back to ASM
i lvoe sqf me and sqf are homies
It's like this because lazy evaluation didn't exist at all until Arma 3 1.62, so it had to be added as an alternate syntax
Alright, thanks for the lecture!
(goes away with tears and dreams about C++)
Meh seems like a sorry excuse considering I know of hardly any modern code that doesn't benefit from lazy-eval
you could still do nested if statements before 1.62 and those are very cool and fun
That was an explanation, not an excuse
I'm not saying it's an excuse from you
don't get me started on else if 
rather an excuse in general avoiding just making it the standard
iirc that is not supported by sqf, right? 
Correct
you already know the answer
you know what else isn't supported π
so my spaghetti code to decide who won... is not wrong
I miss those guys. I really do
have fun writing i = i+1
i was devastated when i learned that switch statements are also not lazy eval
switch statements in interpreted languages are always trash
Guys, there's hope on the horizon 
main benefit of switch statements comes from the way they're compiled differently which obviously doesn't apply for non-compiled langs
switch
I forgot my break and it... worked?
I was expecting everything to break and it... didn't? 
guess fall-through is allowed
Oh and not to mention the not-so-subtle but important differences between
Any/ObjNull/Null/nil/Empty/etc.
I am a simple man. Creating fun mission for TvT events and I want them to be different than what we usually play, so I script some things into it (mainly new objective types).
I hope I'll never deal with these
generally just knowing where to put isNull and isNil is sufficient for avoiding disaster
No idea.
Got simple cheatsheet?
tuesday night tanks capture the flag please
oh, obj vs var, got it
yup
It was meant for isNull vs isNil
But thanks anyway
It's alright, keeping up with XY message conversation is a tough task.
Thanks for these links, but managed to find them before. They answered my question. Obj vs Var. Simple as that.
Now that the docs work again, I can calmly continue my journey to insanity
Now that the docs work again
how were they broken before π
Didn't load, timeout.
augh
thanks for the report, glad it solved itself
sure thing
for sector control logic i cant change the marker type with the marker type cmd do i have to do it with set variable?
How are you trying to do it? @worthy igloo
"ModuleSector_F" createUnit [ rumb_hp, createGroup sideLogic, "
this setVariable[ 'DefaultOwner', '0' ];
this setVariable[ 'OnOwnerChange', '' ];
this setVariable[ 'OwnerLimit', '0' ];
this setVariable[ 'ScoreReward', '0' ];
this setVariable[ 'TaskOwner', '3' ];
this setVariable[ 'sides', [ east, west ] ];
this setVariable[ 'Name', '' ];
this setVariable[ 'BIS_fnc_initModules_disableAutoActivation', false, true ];
_nul = [ this ] spawn {
params[ '_logic' ];
waitUntil {
!isNil { _logic getVariable [ 'finalized', nil ] } &&
{ !( _logic getVariable [ 'finalized', true ] ) }
};
private _trgSize = 200;
_logic setVariable [ 'size', _trgSize ];
[ _logic, [], true, 'area' ] call BIS_fnc_moduleSector;
private _trg = ( _logic getVariable 'areas' ) select 0;
private _mrk = ( _trg getVariable 'markers' ) select 0;
_mrk setMarkerSize [200, 200];
_mrk setMarkerDir 30;
};
" ];
Yeah that needs some cleaning
regardless, how were you trying to do it with setMarkerType?
instead of typing a wall of strings, just use toString
"ModuleSector_F" createUnit [ rumb_hp, createGroup sideLogic, toString {
this setVariable[ 'DefaultOwner', '0' ];
this setVariable[ 'OnOwnerChange', '' ];
this setVariable[ 'OwnerLimit', '0' ];
this setVariable[ 'ScoreReward', '0' ];
this setVariable[ 'TaskOwner', '3' ];
this setVariable[ 'sides', [ east, west ] ];
this setVariable[ 'Name', '' ];
this setVariable[ 'BIS_fnc_initModules_disableAutoActivation', false, true ];
_nul = [ this ] spawn {
params[ '_logic' ];
waitUntil {
!isNil { _logic getVariable [ 'finalized', nil ] } &&
{ !( _logic getVariable [ 'finalized', true ] ) }
};
private _trgSize = 200;
_logic setVariable [ 'size', _trgSize ];
[ _logic, [], true, 'area' ] call BIS_fnc_moduleSector;
private _trg = ( _logic getVariable 'areas' ) select 0;
private _mrk = ( _trg getVariable 'markers' ) select 0;
_mrk setMarkerSize [200, 200];
_mrk setMarkerDir 30;
};
} ];
^
yes that is one way i tried i dont remember the other but it didnt work
also you're going to want to put a sleep in that waitUntil unless you want to torture the scheduler
yes but I'm asking how you were trying to do it because it should've worked
Unfortunately the server hosting SQFBin is offline after the host migrated it.
I am awaiting their response for SQFBin's return π’
~ Imthatguyhere
@winter rose
_mrk setMarkerType 'KIA';
ah well. temp RIP then.
@finite dirge good luck w/ them π¬
Anyone know if its possible to extract an array of the whitelisted items from an arsenal or ace arsenal?
Or even just get the list of all items
It should be
Just read the function. If it has a whitelist you should be able to "extract it" (if it's a variable)
And if not you should be able to recreate it yourself
Im looking at the BIS_fnc_arsenal page and it has a param call "allItems", but its a boolean. It makes all items available in the arsenal. I want to know where it gets its list from
And the ace arsenals page only mentions the ability to copy it manually via the editor, not where that list is stored after the arsenal is created
Well I didn't say read the wikis. I said read the functions themselves
Their contents
Ok, ill try and find the vanilla one
I said almost the same thing today xD
does anyone know why this might not be working? It's being executed on the server, but it is only putting the server host into the vehicle when there are 2 players:
{
_x moveInCargo [_plane, _forEachIndex + 2];
} forEach allPlayers;
it takes a local attribute
you have to remoteExec it or run the script on both machines
{
[_x, [_plane, _forEachIndex + 2]] remoteExec ["moveInCargo",_x];
} forEach allPlayers;
try this
Can someone tell me why the following gives me an Error Generic error in expression when I have the following set as the Condition for a trigger?
trg == 1
It doesn't go away until it's called
is trg defined
It works when I call it, which is the vexing thing
Meaning?
is it undefined before it is 1
How would I tell? I have kludged together a working script from three separate forum pages, including the community wiki. I do not know what I am doing.
Should a bit of script say that trg = 0 on mission start?
Well, doing that makes the error go away in two seconds instead of staying there forever, so that's my interim solution
try this
!isNil "trg"
in your condition
it will activate the trigger when trg exists
however i suspect it might be activating triggers sequentially based on the trg value
which, tbh, kind of weird and pointless
That activates the trigger instantly
a lot of code from random forum pages is a bit shit, you can go to pastebin and send a link here if you want someone to look at it
it's this then
ugh
why
what does the trigger do
Complete a player objective
It is activated by a Hold Action, which was a much larger pain in the ass
you had the right idea
write trg = -1
if it's a server only trigger put it at the top of initServer.sqf
otherwise put it in init.sqf
That's part of the mission file, isn't it?
if you arent sure go with init.sqf
yeah next to mission.sqm
make a file called init.sqf
make sure it's init.sqf and not init.sqf.txt
if the file is already there then make a line at the top
No file there, need to make it
Anything else it should include, or will trg = -1 at the top suffice?
it'll fix the issue of the variable being undefined
i highly encourage you to send a pastebin link to that code, it smells funny
targ1,
"Sabotage Comms Array",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 7",
"_caller distance _target < 7",
{},
{},
{trg = 1},
{},
[],
30,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, targ1];```
targ1 is the object Variable Name
The full extent of the scripting in my mission is above
Everything else is triggers, modules, and syncing things together
can someone explain to me why this code in onPlayerKilled.sqf isn't working? It's supposed to give the killer a notification that they killed an enemy. Nothing shows up....
params ["_player", "_killer"];
if (_killer in allPlayers) then {
[name _player + " was killed by " + name _killer + "!"] remoteExec ["systemChat"];
[[
parseText ("<t font='PuristaBold' size='1.3' color='#ff0000'>Enemy Killed:<br/><t font='PuristaBold' size='1.3' color='ffffff'>" + name _player),
[1, 0.5, 1, 1],
nil,
7,
0.7,
0
]] remoteExec ["BIS_fnc_textTiles", _killer];
} else {
[name _player + " was killed!"] remoteExec ["systemChat"];
};
systemChat takes a string not an array
you should define a function for that
an array works for remoteExec. the systemChat shows up fine, it isnt the problem... just the BIS_fnc_titleText
that's not bad, I feared the worst when you said forum posts
Like I said, most is from the wiki, the forum posts got me to know the difference between = and ==
why?
it's already compiled and ready to go from config if you define it in description.ext
I'd have used the wiki exclusively but it's terrible at explaining things to absolute scripting noobs
on every machine
then you only have to use remoteExec once to have the target player call your function
ok
it's a lot more straightforward than other docs out there. It's only when you get into the niche stuff that it can be a little brief
Trouble is, it assumes you know what it's going on about
wdym
If I want to drop in this one thing, I have to go through this whole course. The page is not self-contained for a noob
can you name specifics
... wait, that was the other wiki
there are a few people in here daily who will take the time to explain it in detail if you signal that you're willing to learn
I'm willing, but I don't have the time is the problem. Two years ago I would have had plenty of time
I just want to do the one thing when I need it, knowing everything about the scripting language feels superfluous for that need
Hm, I must be misremembered then. Disregard
all good
Or, more of an overinvestment
That's a better word
Learning a lot to do very little
one day you might get that itch to do something no one's done before, that's why I fell down the rabbit hole
I just want my friends to have fun, without kludging things in the moment with Zeus quite as much
I've done one mission that works without a Zeus, and it took sooooooooooo much longer to make
It also doesn't work for anyone other than me because the music breaks for some reason
So I'd have to rescore it for anyone to actually play the blasted thing
zeusing is my personal hell
I love it man, watching people in the moment react to things is wonderful
So much catharsis when they hit your traps
My current style is a blend of editor and Zeus in concert, with everything placed in advance while the Zeus adjusts things that I didn't expect
Also, making sure the AI pulls their punches more by RCing them and deliberately missing
I like having control over everything in the editor to balance the mission out and not feel guilty about removing respawns entirely
My players are far too bad at the game for that to work lol
{
_x moveInCargo [_plane, _forEachIndex + 2];
} forEach allPlayers;
```If this code is executed on the server, will it move all players into the vehicle? Because it isn't working for me.... only the server host gets put in. The plane is a Blackfish and has like 30 cargo seats. The first two are turret seats in the back, which I want to skip when putting players in...
I'll let you get back to it
i feel like i've answered this already
^
if you check the wiki page it says local argument***
which means you have to run it on each player's machine
like the example I wrote
ohh I somehow missed that... I guess when you first responded I thought you were talking to someone else lol. sorry and thank you for the explanation!
yw
Before I go to sleep, I just want to say that I am very grateful for the help
I'm just frustrated that this took me two hours, when if the object could have been blown up I could have made the objective in twelve minutes
But I keep telling myself I want each mission to contain something new, in terms of how it was created, so getting a Hold Action to work was part of that
Thanks
G'day scripters.
I"m looking to use the respawn loadout menu in my next mission to allow players to select different loadouts depending on what role they chose.
However I do not want all players to be able to see the same loadouts.
For example. Unit A is a rifleman, I want to give him 4 loadouts to chose from within the loadout menu = Easy enough.
Unit B is a sniper, I want him to only have his own, seperate sets of loadouts separate from the ones available to Unit A.
I don't want them to be able to see each others loadouts or be able to select each others loadouts.
Is this something that someone could lend some assistance with?
Cheers,
when you reply can you use the reply function or @ me
@balmy raven you will need to reference https://community.bistudio.com/wiki/Description.ext#CfgRespawnInventory, https://community.bistudio.com/wiki/Description.ext#CfgRoles, https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory, and know how to use the MenuInventory spawn template in your mission as described here https://community.bistudio.com/wiki/Arma_3:_Respawn#MenuInventory
The actual code involved is simple but you'll want to familiarize yourself with those
In order to have distinct loadout menus on an individual basis, you'll need to either make separate roles for each individual and limit the number of players in each role to 1, or create a manual role selection system that shows/hides loadouts
Its like this because due to how SQF syntax works it has to be
everything is by reference in sqf
i have a trigger and in its onActivate event, i have the following :
["INTERN_fnc_onActiv", thisTrigger] call (missionNamespace getVariable "mission_arsenal_core");
hint "Activated";
mission_arsenal_core is script, that gets compiled and stored :
//init.sqf
missionNamespace setVariable ["mission_arsenal_core", compile preprocessFileLineNumbers "scripts\arsenal.sqf"];
now my problem is, the first time you enter this trigger, the call function doesn't do anything. but when you go out of the trigger, and re-enter it, it works. its like you need to call it atleast once to get it to work. how can i fix this? i think it has something to do with the way i'm compiling and storing the script.
I guess the term reference is confusing. maybe we should call them shared pointers 
or maybe "ref-counted value" 
first of all, if you don't intend to provide a default value, there's no point to using getVariable with missionNamespace. so either use mission_arsenal_core directly, or use missionNamespace getVariable ["mission_arsenal_core", {}]
same goes for setVariable. unless you intend to broadcast it, there's no point to it. just do mission_arsenal_core = compile ...
second of all,
the call function doesn't do anything
do you mean the hint is displayed correctly?
if so it means your function is not defined. or it has an error somewhere
i guess π
For some reason this single trigger out of about 12 doesn't work
D3 switchMove "Acts_Peering_Back";
The ai's variable name is D3 and no matter what i do it wont work
what's its condition?
this
also when you do switchmove, always use playMoveNow afterwards
D3 switchMove "Acts_Peering_Back";
D3 playMoveNow "Acts_Peering_Back";
like that
A reference is just a pointer.
But the word "reference" is easier to understand than "by shared pointer" and has the same end result
That would have no information about whether values are copied or not. refcounted values can still be copied

and has the same end result
I mean like:
int b = 1;
int& a = b;
a = c; // b changed
int b = 1;
int* a = &b;
a = &c; //b didn't change
what I mean is that assigning refs changes the value but with pointers it doesn't
which is why I say calling SQF values "references" can be a bit confusing
I do understand the code as I have loadouts working.
What I want to do is stop specific a set of loadouts for unit a that unit b canβt see
in most languages "reference" is not c++ reference really
for example reference in C# has pretty much the same meaning as SQF reference
never done C# so 
this discussion is pointless then
see what I did βοΈ β here? a pointer joke's pointer joke!
Hello lads, I've got a question for you all. I hope you can help me.
https://www.youtube.com/watch?v=JoJU4GwKpLY
I found this amazing video which shows obtainable loadouts from the interaction menu, I love the concept and would love to implement this into my server, but with so many files, so much scripting, im just lost as i've never done this before.
Is there perhaps an easier way to do this? I know you can Export loadouts and get a long line of code which is correlated to that loadout, any way to just give that a title, plop that text and simply say if you select this, you get that long line of code put into you?
yes. with addAction
if you got some spare time to explain that I'd love to learn how to do it)
this addAction ["Give Loadout 1", {
params ["", "_caller"];
_caller setUnitLoadout [
... //loadout you copied from Arsenal
];
}];
put that in the init field of some object
e.g. a crate
if you want this for multiple objects or multiple loadouts just make a script file to save yourself some copy paste
right, and I rename "loadout 1" with a loadout from my saved loadouts?
it's just a name, so yes
so i have a loadout in my saved loadouts called "rifleman", therefor i'd do
this addAction ["Give Rifleman", {
params ["", "_caller"];
_caller setUnitLoadout [
... //loadout you copied from Arsenal
];
}];
actually wait I noticed that the loadout you get from Arsenal is something else 
do you mind if we do this in dm's? I cant send screenshots here for some reason
it gives you a full code itself
you can DM me the screenshot but I prefer to stay here
so to make it easier and more readable, just do it this way:
- create a folder in your mission folder called
loadouts - in the folder make some text files, change their names to
loadoutName.sqf(e.g.rifleman.sqf) - in each file put this:
params ["", "_caller"];
_caller setUnitLoadout ...
instead of the 3 dots just paste the loadout from ACE Arsenal
- in the box's init, add:
this addAction ["Rifleman Kit", "loadouts\rifleman.sqf"];
this addAction ["AT Kit", "loadouts\AT.sqf"];
```etc.
just copy each line like that and make sure they're ended with ;
that looks too simple to work π if it works i'll be SO HAPPY, im gonna try it and get back to you. Thanks a million!
btw make sure file extensions are on in Explorer
all done, thank you very much β€οΈ
np. if you want to make them colorful you can do this:
this addAction ["<t color='#ff0000'>Rifleman Kit</t>", "loadouts\rifleman.sqf"];
that makes it red for example
if you want to make your own color, just type: rgb to hex in google
it gives you a tool to create hex colors
@spiral zealot
perfect, thank you very much
actually remove parseText 
edited the code
I've used both C and C++ rather extensively and I get the difference between shared pointers and references, but sometimes it's simply easier to say that everything aside from arrays are pass-by-value in SQF given that the behavior is almost indistinguishable from if they were
And getting into the concept of pointers in a language that doesn't explicitly use them for the sake of semantics seems a bit moot
I don't want people to belive that assigning a variable or calling functions has to be expensive because every value is copied.
Everything is by ref and I don't see why one would want to state the opposite of whats true because its simply easier?
That's perfectly fair and I'm perfectly willing to not explain it that way in the future, just explaining why I did so
this is the arsenal.sqf script file :
params["_internal", ["_argument", nil]];
private _debugMode = missionNamespace getVariable "mission_debug_mode";
switch (_internal) do {
case "INTERN_fnc_onActiv": { [_argument] call INTERN_fnc_onActiv };
case "INTERN_fnc_onDeAct": { [_argument] call INTERN_fnc_onDeact };
case "INTERN_fnc_debug" : { [_argument] call INTERN_fnc_debug };
default { };
};
INTERN_fnc_debug = {
params["_text"];
if (_debugMode) then { systemChat ("[SYS-DEBUG] " + _text); }
};
INTERN_fnc_onActiv = {
params ["_thisTrigger"];
hint "Inside onActive";
for "_i" from 0 to 2 do {
private _light = missionNamespace getVariable ("arsenal_lamp" + str _i);
if !(isNil "_light") then {
_light switchLight "ON";
[format ["Arsenal lamp %1 activated!", _i]] call INTERN_fnc_debug;
};
};
_ahm = createHashMap;
for "_i" from 0 to 2 do {
private _obj = missionNamespace getVariable ("arsenal_obj" + str _i);
if !(isNil "_obj") then {
private _actionIndex = _obj addAction["<t color='#FF0061' size='4'>Open Arsenal</t>", "['open', [true]] call BIS_fnc_arsenal",nil, 6, true];
_ahm set [str _obj, _actionIndex];
[format ["[DEBUG-ArsenalT] Arsenal added to obj %1, ahm value set!", _i]] call INTERN_fnc_debug;
};
};
_thisTrigger setVariable ["ahm", _ahm];
};
...
if it had any errors, it would've failed the second time i called it too.
what i mean is first time i call it, the hint in onActiv won't work, meaning the function is not actually called (or something is failing it)
P.S the hint in triggers onActivate event works fine evertime.
also, how can i know if players have continued the briefing part in multiplayer?
(briefing part, meaning the part when you go into the game, and the game shows you the map until you hit continue)
Everything I said already described how to do so. You can either limit each loadout to one person, or you'll need to rig up a custom role selection system if you want to hide all of the other loadouts from the beginning. Either way, those links I provided are the systems you'll need to use.
If unit A picks a loadout under a role that's limited to one person, no further units will be able to select loadouts under that role
obviously that means that the loadouts won't be "hidden" until someone has chosen that loadout, so if that doesn't fit what you desire, you require an alternative way to actually set who gets what loadout
Like Leopard said, you would firstly do well to remove a lot of your unnecessary missionNamespace getVariables unless you plan on providing a default value. That being said, your issue is that the first time the trigger is activated, you don't get a Inside onActive hint?
@balmy raven
You can add custom loadouts with BIS_fnc_addRespawnInventory by setting the target parameter to the specific unit.
Although you still have to figure out which player gets which loadout(s)
@marsh trench The issue is that INTERN_fnc_onActiv and the other functions defined in that file aren't actually defined until the first time the function is run. Just compiling the code doesn't actually cause those functions to be defined.
One way you could fix that is by either defining the functions separately or just defining them before the switch statement, but note that the latter will be having them be re-defined every time the function is run.
Overall the issue here relates to how you're trying to do things, it'd be cleaner and cause less issues like this to just define the functions separately or with a function library rather than having them all in a file together being called by a switch statement.
if it had any errors, it would've failed the second time i called it too.
I meant semantic errors
as for why it only works the second time, Sysroot already explained it
Is there any particular reason that AFAIK we can't work with the model of held weapons? Would be great to be able to work with weapon memory points and such via SQF.
Or, if there is a way to do so, it certainly seems to have evaded me
depends on what you want to do
with namedProperties, selectionNames and selectionPosition you should be able to find the named properties of a model and get the position of each property to be used in SQF
Yeah I know you can approximate weapon positions with the player's selection positions, but that's the closest you can get AFAIK
I mean getting selectionPositions of memory points on the actual gun model which I don't see how to do
this is something I've wanted to be able to do for a long time so if it's doable and I just didn't realize how to do it I'm going to be awed
currentWeapon returns the name of the weapon, and unless you create a new object it's not possible to get the actual weapon object.
Perhaps you could try nearestObject, but I'm not sure how weapons behave to that π€
As far as I've seen the weapons held by the player basically don't exist in the world as far as SQF is concerned
no command to get them as an object or anything similar
How do I know the name of the ammunition that the artillery shoots to record in the script?
You can look them up in config or use a Fired event handler.
Thank/ΠΡΠΊΡΡ
because they're not objects
they're proxies
as for how, you have to create a simple object using the weapon model
Can you give me an example of what it looks like in the configuration?
honestly that's pretty hard work. What exactly is your use case here?
If you just want to know magazines for specific artillery as a one-off, just spawn one and do magazines _vehicle
Indeed, it just seems weird that we don't have any control over the model used by said proxy and the closest thing we can do is manipulating a simple object in its place
I don't suppose there's any clean way to overlay a simple object of the weapon over the proxied one so it doesn't really help the situation
lol well yeah that's where the clean part becomes a problem
not to mention I'd suppose you'd need attachTo with bone rotation which is already janky when it comes to players
well attachTo works to some extend as well
it works ok as long as the player isn't looking all the way up or down
yeah so I've noticed
it's understandable if it's not something you're intended to be able to do, would just be nice
seems like a strange limitation
well if it followed the res lod's bone axis instead of the mem point it would work
but I guess the reason they don't do that is that res lods, as the name suggests, change (depending on distance)
yeah
which btw is how you make the each frame method work
yeah I've set up models to follow weapon movement smoothly, and it works well enough for some things
just annoying that I can't just use weapon model mempoints
for reference, my present use case is that my portal gun needs to have some different changing things on it
I already have some UVanimated energy beams that "attach" to the front of the gun when you pick something up, and that works decently enough where I don't much mind
but I also am trying to have a light source which changes color in the top of the gun which is a pain to pull off with just attaching and such
either way, will find a way to do it, just wanted to make sure I wasn't missing something
I'm just gonna put this here (again)
Thanks, I'll see about applying it
One workaround we've found is using weapon attachments, which works decently well for the portal gun seeing as it has no need for scopes, flashlights, etc.
Which will probably still be necessary since per-frame updates aren't really gonna fly well especially in MP
I'll write more about what I mean tomorrow
On public servers, I have some compositions with ambient animations set in the init values, and whether they work or not seem kind of hit or miss depending on which server I'm on. Only 4 servers allow scripts like ZAM (in the US anyway, numbers 02, 02e, 02w and 04). which ones allow compositions with custom init values for things like ambient animations or vehicle color?
Is there away to get the locked on target for like a jet or like the cwis? afaik there isnt any EH or a command to get that
I guess missileTarget might work, but not for bullets for cwis I guess
Trying to make a vehicle move about 5m forward out of a tree line for a ambush via a trigger, it refuses to do so, ive tried disableAI"Move" enableAI"Move" stuff and skipping hold way points after trigger activation to move but it wont just go forward a few meters
Yeah, that's really something that you need to do with the hacky fine-control mechanisms. setVelocity, setVelocityTransformation or those direct command-movement controls that I can't remember how to find.
doMove has basically the same behaviour as waypoints IME
so a 5m one is probably just gonna complete. Depends on the vehicle type though.
cant get it to work, the offroad just refuses
ill try, guessing its just too short to work
can anyone tell me why my quadbikes might be spawning in with a random color even though I set their texture with this script?
private _civCars = [
["C_Hatchback_01_F", ["a3\soft_f_gamma\hatchback_01\data\hatchback_01_ext_base09_co.paa"]], 2,
["C_Hatchback_01_sport_F", ["a3\soft_f_gamma\hatchback_01\data\hatchback_01_ext_sport05_co.paa"]], 1,
["C_Offroad_01_F", ["a3\soft_f_enoch\offroad_01\data\offroad_01_ext_grn_co.paa", "a3\soft_f_enoch\offroad_01\data\offroad_01_ext_grn_co.paa"]], 2,
["C_Offroad_01_covered_F", []], 1,
["I_C_Offroad_02_unarmed_F", []], 2,
["C_Quadbike_01_F", ["a3\soft_f_beta\quadbike_01\data\quadbike_01_civ_black_co.paa", "a3\soft_f_beta\quadbike_01\data\quadbike_01_wheel_civblack_co.paa"]], 2
];
private _carTypeArray = selectRandomWeighted _civCars;
_carTypeArray params ["_carType", "_textures"];
private _car = createVehicle [_carType, _location];
_car setDir _direction;
{
_car setObjectTextureGlobal [_forEachIndex, _x];
} forEach _textures;
``` Setting the textures is working fine for the hatchbacks and offroads, but not for the quad bikes...
I got these textures by doing getObjectTextures on the vehicles with the paint jobs I wanted, so it should be exactly correct.
_car setVariable ["BIS_disableRandomization",true]``` will do IIRC
isn't it randomized when it's created, though? Or if I do that right after it's created, will it override it?
also, I still need to get it set to a specific texture. it's working fine for the other vehicles, but not quadbikes for some reason
After the randomized will do but in order to do that you'll need a bit of spawn
what do i do to make units renegade BESIDES shooting them? I want to make it so that we will be attacked by all 3 factions rather than just 2. i say this because we are an indfor group but some of our enemy units are on indfor as well (bandits, zombies, etc.). but since we are both indfor we cant attack each other.
i have been surfing the wiki for the script combo, but i cant seem to get it to work. I tried addRating followed by -2000 but im still indfor. can anyone help me? simply reply to this message so i get pinged
my character is a lt. in the editor
Lieutenant you mean?
yes
It does not even matter
so even when renegade, my player name when aimed at will still be Lt.?
like Lt. Jackson
Ey, why it does matter? A nameplate won't be changed
And it turns out -2001 does work
well, the name playe tells my friends not to shoot at me
logically speaking, if all player units are renegades, we are on the same side
we will still keep our group right?
I just tested. Everyone shoots each other so no problem
even my own player controlled units?
Why? A player won't shoot by the character itself, you shoot someone
sorry im just trying to understand this side of scripting
it will open up my mind to new ideas
sideEnemy already is enemy, even for sideEnemy itself
if i could, i'd show you a screenshot of what i have set up
DM me so I can post it
I meant you should just post the picture not the question. I only answer it here... and what exactly is your goal? You want to make it so this group will behave like an alternative side alongside with BLUFOR, OPFOR and Independent?
no my goal here is to make it so that ALL playable units (as shown), that are grouped together (as shown), will be attacked by fellow indfor units instead of just red and blue
yes
alternate side
What
Perhaps you can make the groups civilian and make civilian hostile so possible to make, if civilian doesn't present on your mission
thats my goal here. to make those grouped units attackable by all factions
oh
but wont making civilians hostile mean that they will attack us?
I meant, civilian is you
So BLUFOR, OPFOR and Independent can attack you at the same time
ok that makes sense, but i have tried it and nobody attacks us (cause we are civilian, regardless if armed or not) so they dont consider us an enemy
so what youre saying is, if i set us to civilian, drop our rating, we will be shot at by all 3 factions?
including armed AI civilians?
Oh wait disregard, I just tested and looks they're forced not to shoot civilians even if I use setFriend command, unless do addRating
yeah thats what i was thinking
the arma campaign works like that. the geurilla group Kerry joins in East Wind are against opfor, blufor, and indfor
When it does?
thats essentially what im aiming for. kerry is still grouped up with geurilla fighters against all 3 factions. given this logic, i am assuming that all those groups shown are all lead by a "Kerry"
I don't even remember The East Wind does that
yes it does
In Game Over?
no, the whole east wind campaign
from the moment kerry lands on the beach
to him meeting with that geurilla leader stravos
A faction is not a side
then if thats the case, then BI must have made the AAF redfor, or blufor for them to attack kerry and the rebels
A faction, like CTRG, FIA, Gendarmerie, NATO are in side BLUFOR. They are not meant to shoot each other
No I don't
in the campaign "east wind" kerry joins a band of anti-AAF rebels, lead by stravos
I know the lore
yes, so what im essentially trying to do here is recreate that kind of logic. a group of player against all 3 factions. i will try with your civilian idea and see where that goes
it MAY work based on my past experiments
Again I don't even remember when FIA got attacked by BLUFOR, OPFOR and Independent at the same time in The East Wind
well the FIA were/are classified as greenfor. AAF is greenfor. how were they able to shoot each other
thats the million dollar question here
i hacked the mission using a zeus mod (so i can zeus the units around), and noticed that the AAF units are greenfor, and so are the FIA
clever bastards
More like FIA was existed as BLUFOR for all the time
...In Arma 3 I meant and IIRC as well
i dont actually recall the east wind campaign prior to game over having blufor units
it was you against red and green
Attacked by both you mean?
It is always possible, I don't recall if Game Over does that
no it doesnt
game over is you against everyone
which is another thing im trying to make
But Game Over has some buddies
yeah but they are recruited and join your side, whatever your side may be
so when they join you, their side may be changing to renegade
because "kerry" in game over is considered renegade
i feel like civilian would probably be my best course of action in this whole scenario. i mean, they are a neutral/configurable faction. they can be armed civilians against everyone, or passive civilians that just stand idle or roam around
No, Kerry in Game Over is BLUFOR
to be fair, in all that drama, i dont even recall who was shooting me. i just ran for the ocean lol
Apparently I got shot both by OPFOR and Independent, not BLUFOR
ok so my whole "kerry" logic is voided. so that means my only option, to reach my end goal here of making all playable characters enemies of all factions, is to set them to civilian with a negative rating, or keep them indfor, but still give them a negative rating
those 2 options are all what i have understood from this
Well, I guess be attacked by all three sides but keep your group organized still is impossible it seems
so all group members when set to renegade, will disband and become their own individual unit?
i guess that works too
Won't disband, but still renegaded, group members can shoot the renegaded, regardless of if the shooter is renegade already or not
so a whole group can be renegade?
Yes, but the whole group can shoot the group members
ok that makes sense
so i dont have to set them to civilian
im trying to keep civilian strictly to passive AI
Well if the players never meant to be an AI, this is your choice
ok so my options still stand. i can either make all players civilian renegades, or indfor renegades.
im leaning more towards renegade indfor, so we can have an excuse to attack armed civilian AI, in addition to OPFOR, BLUFOR, and other INDFOR ai units
ill just test both of these logics, see which one matches my goal here
Well, good luck anyways
thanks
if i stumble uppon any pebbles along the way, ill post here soon
i hope in arma 4 they will add the ability to create a custom side and set its parameters to attack all factions (except civilians)
already in Reforger
nice! i cant wait to make a mission where you play as bandits against all factions
I hate the game engine that from 20th Century π©
also i think my issue has been resolved. i set my indfor character rating to a good negative number, and now im attacked by not only indfor, but armed civilians too. i think i just found my holy grail
and my name plate and rank are still kept as if im still a friendly
Good
i can work with this twisted logic
yeah i run a group/unit, and we play as a PMC working for the highest bidder. so that means we need to be an enemy of all factions, including civilians.
anyways, thanks for the help!
I actually hope if Dedmen can add a few more sides to play with... π
The Good, The Bad, The Ugly π
essentially
also i dont know if this is possible, but out of my own laziness, can i set a group to renegade instead of giving every player unit a rating script?
{_x addRating -10000} forEach units <put the group>```
<group variable> right?
Ayup. Without the <> of course
btw does the negative level of the renegade matter?
like those less renegade wont be prioritized
nope afaik
good to know
how can i find A3\music_f\Music\ folder? or see its content..
In Arma 3\addons\music_f_music.pbo
how can i know if players have continued the briefing part in multiplayer?
(briefing part, meaning the part when you go into the game, and the game shows you the map until you hit continue)
thankyou
why doesn't fadeMusic work here?
playMusic "vn_another_life";
waitUntil {scriptDone _script1}; // music must be played until _script1 is done
5 fadeMusic 0; // slowly fade out.
sleep 5; // wait until the fade is completed
playMusic ""; // reset music.
it just stops without fading. just suddenly stops.
i removed the playMusic "" to see if any kind of fade is happening, but no, the music continues to be played without it. no fade, no stop.
waitUntil {scriptDone _script1};
that's a bad way to do things
waiting in a scheduled envm for another script to finish is never right
but anyway I have no idea why fadeMusic doesn't work for you
maybe it's broken
looking for some insight onto this error
11:37:37 Bad conversion: array
11:37:37 Error in expression <rName = "marker" + str _forEachIndex;
createMarker [_markerName, _unit]; >
11:37:37 Error position: <createMarker [_markerName, _unit]; >
11:37:37 Error 0 elements provided, 3 expected
11:37:37 File AJ_Cache2\functions\fn_moduleNuke.sqf..., line 13
line 13 is:
private _markerName = "marker" + str _forEachIndex; // gets the index of the current unit
in my head that makes sense as "marker0, marker1, marker2, etc." but apparently thats not what's happening
it means it expected an array of 3 elements
but you provided 0
or _unit is not defined
is that actually referring to line 13 then?
it's line 14
it's usually +1 on the line, unless you use bytecode and properly provide positional info
arma's parser indexes lines from 0
+1 on what line?
anyway, you're passing _unit, you actually want position
+1 from what the diag is showing
wiki says object is ok. so that means _unit is not defined
I thought you could (as of 2.1) just do that
ohhhh I see what you mean, kinda like everything else I've debugged in C++
exception always throws just after
sigh yeah you are right, I'm thinking about it too much π
I think the source of my issue is getting the units sync'd to the module, I'll have to do some reading and figure that out
thanks for the help!
your issue is _unit being undefined, as Leo said
_unit is derived from _units at _x
can you send entire code with the loop?
I absolutely would if I didnβt just get pulled away to deal with some other stuff. Iβll send it when I get back
how can i convert a hpp gui to sqf if the converter thing doesnt work
To get an AI to move without vanilla systems I need to:
-
Orient the AI in the movement direction
-
Start a movement animation
-
Stop the movement animation when the objective is reached
Correct?
there is an animation in the animation viewer, that shows the name of driver_boat01 and its file is \A3\cargoposes_F\Anim\driver_boat_01_mocap.rtm. how can i set a units animation to this?
this animate ["driver_boat01", 1];
doesn't work on the unit. is the name wrong, or am i doing it wrong?
yes
playMoveNow
{
[_x, [_plane, _forEachIndex + 2]] remoteExec ["moveInCargo", _x];
} forEach allPlayers;
This is only putting the server host into the plane. Why isn't it working for all players?
does it even have enough cargo space?
when should I use call vs execVM
at first I used this code:
{
_x moveInCargo [_plane, _forEachIndex + 2];
} forEach allPlayers;
```And that didnt work, so someone told me to change it to the current one...
execVM is spawned and recompiled every time
generally speaking you should NEVER use execVM
that wasn't even my question
the code is correct
are you sure the cargo index is valid?
look in config viewer
also when do you execute that?
are you sure all players are present?
In init.sqf:
myVariable = 0;
_myLocalVariable = 3;
null = [_myLocalVariable] execVM "test.sqf";
in test.sqf
_myArgument = {_this select 0};
hint str _myArgument;
And yet it is printing "_this select 0"
What am I missing
its executed on the server during the mission, not right at the start
you're converting a code into string
so you get the code itself
How do I evaluate _this select 0 and set _myArgument to the Result then?
Oh, use ()
I already told you sqf doesn't have functions
there is no ()
you call the code
hint str call _myArgument
This is not needed, I just used () instead of {} because () is evaluating the code whereas {} is defining it
https://community.bistudio.com/wiki/Function
I understand there is no "explicit" function but this is definitely the idea of a function
I thought you said you wanted to do _myArguments()
I had no idea why you were wrapping things in {} in the first place
I thought you're just testing things
Haha! no
I accidentally wrapped them in {}
is there a reason not to if it's just one-time execution on the server? or is this just generally speaking since you don't lose anything by defining it in config
I said generally speaking
just remove the {} ?
it should be "unit local"
but might be vehicle local 
try both
ohh
got it
ok
I have another question. Does initPlayerLocal run locally for the server host when they start the mission?
yes
Can you make a FSM for civilian faction?
I want that to be a project I do in a few months, as a intro to AI
is it possible to rotate a Leaflets picture?
the picture i took is horizontal and the leaflet is showing it vertically and stretched.
civilian is a side not a faction
FSMs don't have specific sides on their own
but you can run the FSM for only civilians yourself
Okay
How do I set up an FSM for a mission
properly
execFSM
i've created a task using the Create Task module (ModuleTaskCreate_F), and given it a variable name of mission_task_talk.
when i try to set its state using setTaskState in a holdAction, it gives me an error saying mission_task_talk in an object type and not a task type. what must i do?
mission_task_talk setTaskState "Assigned";
nvm, found a solution https://forums.bohemia.net/forums/topic/231218-set-task-state-through-add-action-with-create-task-module/
Overview I was trying to create an ArmA 3 OPTRE mission, where the player needs to trace data from a communications relay/tower and get the locations of two additional objectives they need to complete in order to extract and complete the mission. The mission is single-player (so far) but will hav...
What is the easiest way to get a random location that is not blocked by an obstacle
// forever
while {true} do {
a = nearestObjects [p, ["house"], 200];
b = 0;
{
_marker = createMarker[(str (b + 1)), _x];
_marker setMarkerShape "ELLIPSE";
_marker setMarkerSize [3, 3];
sleep 2;
} forEach a;
};
This stops at the first building marked, why is that?
You didn't redefined b after
Oh hey thanks
I'm curious why is it not changing the marker every time then
since wouldn't it just override it
But you don't even need b at this context, _forEachIndex is enough
_marker = createMarker[str _forEachIndex, _x]; works?
I'm learning SQF, I was just trying to mark building positions to see how they worked
I am curious though it is marking stuff other than building positions with ellipses
Along the splines of power lines it seems and some tree areas
Mm. Any static thing can be a house, like a fusebox or...
I se
https://community.bistudio.com/wiki/buildingPos it seems to only be drawing one marker per building why is that?
if buildings are made up of multiple positions
How's your code?
// forever
while {true} do {
a = nearestObjects [p, ["house"], 200];
{
_marker = createMarker[str _forEachIndex, _x];
_marker setMarkerShape "ELLIPSE";
_marker setMarkerSize [3, 3];
sleep 2;
} forEach a;
};
Am I missing something
Where is buildingPos?
Since a is an array you can't. But buildingPos _x
You can nest forEach as many as you want
How do I get each building position since a building has multiple?
I need to do building buildingPosition index
building buildingPos -1
_units = param [1, [], [[]]];
//// init stuff
// private _unitMap = createHashMap;
private _markers = [];
{
// Current result is saved in variable _x
private _unit = _x; // gets the current unit
private _markerName = "marker" + str _forEachIndex; // gets the index of the current unit
_newMarker = createMarker [_markerName, _unit]; // create marker for current unit //UNIT IS UNDEFINED, FOR SOME REASON ITS NOT DETECTING SYNC'D UNITS!!!
_markerName setMarkerType "b_inf";
_markers pushBack _newMarker;
} forEach _units;
sorry for the delay
print _units before the loop, maybe it has some nil values
_units is what I think it is right? units sync'd to the module?
I was afraid that I had a major misunderstanding in what that was
well i don't know what arguments callee passes to this
I guess your _unit is not an object
The script works now, but for some reason its stopped after like 20 markers
and it wont mark this other building
// forever
while {true} do {
// get the nearest objects
a = nearestObjects [p, ["house", "building"], 200];
// for each object
{
apos = _x buildingPos -1;
// for each building position
{
// create a marker
_marker = createMarker[str _forEachIndex, _x];
_marker setMarkerShape "ELLIPSE";
_marker setMarkerSize [3, 3];
sleep 2;
} forEach apos;
} forEach a;
};
here is the code
you have to delete the old markers
You can't reuse marker name
duplicate marker names are not allowed
class Attributes: AttributesBase
{
// Arguments shared by specific module type (have to be mentioned in order to be present)
//THIS IS THE "Applies to: groups of synced objects" thing
class Units: Units
{
property = "myTag_ModuleNuke_Units";
};
// Module specific arguments
class ModuleDescription: ModuleDescription{}; // Module description should be shown last
};
this was from my CfgVehicles.hpp
suspend the while loop for some time aswell
It has a 2 secnd suspension
it doesn't. that suspension is in the forEach loop
You can probably just name those with random command
sleep 2 affects the whole loop since it goes through it each time
which is from the Wiki on the module framework. I thought that's what their class Units: Units thing was but I might be wrong.
yes, inside the foreach, if there is a case where nearestObjects returns an empty array, it will just keep on going
there's no guarantee that it does
or if none of the objects have building positions
I got it
// forever
while {true} do {
// get the nearest objects
a = nearestObjects [p, ["house", "building"], 200];
// for each object
{
apos = _x buildingPos -1;
// for each building position
{
// create a marker
_marker = createMarker[str _x, _x];
_marker setMarkerShape "ELLIPSE";
_marker setMarkerSize [3, 3];
} forEach apos;
} forEach a;
sleep 2;
};
Just named it the position itselfl ol
i think the easiest would be to just print the array, diag_log [_units, _units apply { typename _x }]
see what you get
is there actually a string I can pull out of _units? It should be an array of objects if I understand me c- oh
that works lmao
Do I need to use buildingPos for moving AI units through buildings?
does the engine know how to path between buildingPos
this will dump to the RPT right?
yes
the engine does, but the object might not
I am having some problems when my friend hosts a mission for me.
- This code still doesn't work: (it only puts the server host in the plane, not other players)```sqf
{
[_x, [_plane, _forEachIndex + 2]] remoteExec ["moveInCargo", _plane];
} forEach allPlayers;
I this is the third revision of the code I have tried, and it worked for me in the editor (replacing allPlayers with allUnits. But for SOME reason, it STILL will not work with multiple players. I am at my wit's end here.
2)initPlayerLocal.sqf is not running for all players. Sometimes it doesn't run for the server host, and sometimes it doesn't run for me. Here is the code:```sqf
waitUntil { !isnull player };
waitUntil { !isNull findDisplay 46 };
( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
params ["", "_key"];
if ( _key == 60 ) then {
if ( soundVolume == 1 ) then {
0.1 fadeSound 0.1;
hintSilent "Earplugs in";
} else {
0.1 fadeSound 1;
hintSilent "Earplugs out"
};
};
}];
player addEventHandler ["InventoryOpened", {
if (typeOf vehicle player == "B_T_VTOL_01_infantry_F" || player distance aircraftCarrier < 1000) then {
true
};
}];
player addHeadGear selectRandom [ //THIS CODE IS NOT ALWAYS RUNNING FOR EVERY PLAYER
"H_Cap_red",
"H_Cap_blu",
"H_Cap_oli",
"H_Cap_tan",
"H_Cap_blk",
"H_Cap_grn",
"H_Cap_brn_SPECOPS",
"H_Cap_tan_specops_US",
"H_Cap_blk_Raven",
"H_Cap_grn_BI",
"H_Cap_khaki_specops_UK",
"H_Cap_usblack",
"H_Cap_blk_CMMG",
"H_Cap_surfer",
"H_Cap_police"
];```
I can immediately tell that the script did not run correctly because either me or my friend do not have the random hat at the start of the mission.... What could be causing it to fail?
then I guess using _x as target was correct?
how many players did it move before?
and still 1?
yep
but it worked in the editor
with AI
but it still wont put me in the damn plane when my friend hosts the mission
well AI have the same locality as the host, so no surprise there
moveInCargo takes local arg, i suppose the server owns the _plane, thus only the server player is moved
well I have tried remoteExec'ing it both for the plane and for the player
there has to be a way to move every player in the mission into a plane lmfao
right?
initPlayerLocal.sqf is not running for all players
it always runs. the question is what part of it doesn't work?
well
I know for a fact it isn't always making it to the part where I randomly assign hats
I marked it in the code. sometimes I dont have a hat, and somtimes my friend (the host) doesnt have a hat....
I'm also pretty sure its not just the hats
well the problem is you're using player directly. player might not be null when the script begins, but it might become null due to respawn
what if you try moveInAny?
doesn't player return the player that is local on the connected client?
Done this, it's weird it seems like something ends up in there. Bravo 2-2, but it is in there 4 times?
19:38:40 [[L Bravo 2-2:1],["OBJECT"]]
19:38:46 [[L Bravo 2-2:1],["OBJECT"]]
19:38:46 [[L Bravo 2-2:1],["OBJECT"]]
19:38:49 [[L Bravo 2-2:1],["OBJECT"]]
19:38:50 Starting mission:
19:38:50 Mission file: tempMissionSP
19:38:50 Mission world: Stratis
19:38:50 Mission directory: C:\Users\Aj\Documents\Arma 3 - Other Profiles\Ajdj100\missions\tempMissionSP.Stratis\
19:38:52 "BIS_fnc_log: [preInit] ""DeltaTime computation started"""
19:38:52 Speaker ACE_NoVoice not found in CfgVoiceTypes
19:38:52 [[L Alpha 1-2:1,true,false],["OBJECT","BOOL","BOOL"]]
19:38:52 Bad conversion: array
19:38:52 Error in expression <ker" + str _forEachIndex;
_newMarker = createMarker [_markerName, _unit];
_ma>
19:38:52 Error position: <createMarker [_markerName, _unit];
_ma>
19:38:52 Error 0 elements provided, 3 expected
19:38:52 File AJ_Cache2\functions\fn_moduleNuke.sqf..., line 17
19:38:52 Bad conversion: array
19:38:52 Error in expression <ker" + str _forEachIndex;
_newMarker = createMarker [_markerName, _unit];
_ma>
19:38:52 Error position: <createMarker [_markerName, _unit];
_ma>
19:38:52 Error 0 elements provided, 3 expected
19:38:52 File AJ_Cache2\functions\fn_moduleNuke.sqf..., line 17
I don't know, but I definitely need to get them into the cargo space, specifically
what does it have to do with what I said?
player might not be null when the script begins, but it might become null due to respawn
"bool", "bool"
yeah I just noticed that, Alpha 1-2 "object","bool",'bool"
then add some sleep before it
I already do ```sqf
waitUntil { !isnull player };
waitUntil { !isNull findDisplay 46 };
I dont really know enough about this log to know where those bool's are coming from. The only place I could think would be that I am misusing the Units paramater
change private _unit = _x to _x params ["_unit"];
do forEach (_units select { _x isEqualType objNull }) instead, and yeah, i don't know how the module/whatever parameter stuff works, but you can use the above for some "hacky" solution
add sleep
where? just at the start?
before the set head gear
this is just using the temp variable directly instead of creating a whole extra variable to do the same job, correct?
what temp variable?
_x
I don't understand the question
magic variable, temp is the wrong word I guess
it's kind of the same as:
private _unit = _x select 0;
that's not the issue, i think you missread 
oh you diag_logged the whole units array 
π
then yeah that won't help
@ocean folio you should fix the parameter stuff to work properly
so the "units" array is 1 unit + 2 bools which I have no idea what they do...
what i sent is an ugly fix
I will have to do some reading on how the sync'd units get passed through to a module
its a pain that the documentation for the module framework is.... a bit light
Can I get some help writing a script that moves all players into the cargo space of a vehicle?
did you try moveInAny like sharp said?
lol even with sharp's fix I get the map marker at the module's position and not on the sync'd units. There's definitely something bigger in here that I'm doing wrong. Time for the wiki deep dive
albeit no errors this time
if only the caller gets moved in maybe your server is blocking moveInCargo
there's no other explanation here
does only the caller get moved in?
seeing as it is completely global, it probably would work, but that doesnt help. I specifically need my players in the cargo
its called by the server and only the host gets moved in, so yeah
the point was to test it
I cant test it rn
CfgRemoteExec
how does that work?
"CfgRemoteExec moveInCargo blocked arma 3"?
try doing diag_log (_units select 0 getVariable ["myTag_ModuleNuke_Units", []])
just google cfgRemoteExec 
I also found this wiki page which.... sigh https://community.bistudio.com/wiki/synchronizedObjects
woulda been nice to know about earlier lol
yeah but what i sent should give you the units iirc
assuming the units param is doing what I think it is
actually server has no limits according to that page so it can't be that then
how does it get blocked? how do I check if it's blocked?
and how do I unblock it?
oh
as I said if the server is executing the command there's no limit and it's not blocked
yeah
empty
19:59:13 Loading movesType CfgMovesMaleSdr
19:59:13 Reading cached action map data
19:59:13 Warning: looped for animation: a3\anims_f_epa\data\anim\sdr\cts\hubcleaned\briefing\hubbriefing_loop.rtm differs (looped now 0)! MoveName: hubbriefing_ext
19:59:13 Warning: looped for animation: a3\anims_f_epa\data\anim\sdr\cts\hubcleaned\spectator\hubspectator_stand.rtm differs (looped now 1)! MoveName: hubspectator_stand_contact
19:59:13 MovesType CfgMovesMaleSdr load time 920.0 ms
19:59:18 No more slot to add connection at 033057 (3386.8,5735.4)
19:59:20 Strange convex component145 in a3\plants_f\tree\t_pinuss2s_b_f.p3d:geometryView
19:59:20 Strange convex component149 in a3\plants_f\tree\t_pinuss2s_b_f.p3d:geometryView
19:59:22 Fresnel k must be >0, given n=2.51,k=0
19:59:29 []
19:59:33 []
19:59:33 []
19:59:33 []
19:59:34 Starting mission:
19:59:34 Mission file: tempMissionSP
19:59:34 Mission world: Stratis
19:59:34 Mission directory: C:\Users\Aj\Documents\Arma 3 - Other Profiles\Ajdj100\missions\tempMissionSP.Stratis\
19:59:36 "BIS_fnc_log: [preInit] ""DeltaTime computation started"""
19:59:36 Speaker ACE_NoVoice not found in CfgVoiceTypes
19:59:36 []
19:59:37 Mission id: 4326a3297ab0517ea578bca66aba34f9d63c7b7d
19:59:39 Loading movesType CfgMovesSnakes_F
19:59:39 Reading cached action map data
has no one else ever tried to move multiple players into the cargo space of a vehicle before?
heh, guess not 
but those property var fields have something in common with that
well I know for a fact it worked before
there has been a change since some updates ago
looks like it was update 2.08...
oh right uhhhh.... my module logic also throws an error lmao
I just commented it out and ignored it but I probably will need that
_logic = param [0, objNull, [objNull]];
it throws something about expecting a string but getting objNull, or the opposite
idk. just to be safe try it like this next time:
{
[_x, [_plane, _forEachIndex + 2, true]] remoteExec ["moveInCargo", _x];
} forEach allPlayers;
[[_plane, _forEachIndex + 2], { player moveInCargo _this }] remoteExec ["call", _x] also try something like that
this is also 100% ripped from the wiki, I noticed that right away when I was trying the example code they had there that it threw that error
ok, thanks
there's a note by KK that says this:
so I guess it is kinda broken
and it's known 
that's for AI i think, no?
it looks like it
but apparently does the same thing as moveInCargo with index 
@past wagon ~~try this one too just for fun π¬ ~~
{
[[_x, _plane, 2 + _forEachIndex], {
params ["_unit", "_plane", "_index"];
_unit assignAsCargoIndex [_plane, _index]; _unit moveInCargo _plane;
}] remoteExec ["call", _x];
} forEach allPlayers;
try getvariable "Units" instead
with the config you sent previously
nvm just tested and indeed it's for AI...
the problem is I cant get the logic namespace for the module because of whatever error that code has
20:13:30 Error in expression <\functions\fn_moduleNuke.sqf"
_logic = param [0, objNull, [objNull]];
_units =>
20:13:30 Error position: <param [0, objNull, [objNull]];
_units =>
20:13:30 Error Type String, expected Object
good god this wiki code is borked lmao
nvm it's not broken
I was using plane as target
like his code
but it should've been _x, as I guessed
but he said he tried it and it still didn't work
atleast i hope he meant the remoteExec target not the command 
it's not
so I guess the cargo index is invalid for him then
I told him to look at config to confirm but I guess he didn't
if you have is3den set to 1, then args are string and array
bro its valid
I have tested it out by moving myself into all the different cargo indexes
so 2 and 3 are valid then?
I just want to skip 0 and 1. those are turret positions
yes, and so on
its a blackfish. it has like 30 cargo seats
Ohβ¦. Iβm just borked lmao. So should I be pulling from different parameters than 0 and 1?
I think this is the right channel does anyone know if you can use unit capture to make just a regular person walk a certain path / distance then hop into a vehicle that's already been placed or is that impossible with unit capture?
I've derived all of this from the is3DEN = 0 code. I feel like such an idiot rn lol
well I just tested and it works fine for me
ok
i don't think you can record the unit moving into a turret, what you can do, is record up until the point where they get in the turret, play that, and move them in via a script command yourself
so what is the code that will successfully put all the players into cargo seats again?
this
ok
wait. I've already tried that. didnt work
works fine
yeah, then after you've sorted the code out, the units should be in the "Units" var in logic's namespace (assuming you haven't changed the config)
just tested
with multiple players?
ofc yes 
maybe you didn't update the code properly on the server
when you said you tried _x as target, were you referring to the remoteExec target?
maybe he screwed up somewhere 
pretty sure I had him double check the code
guess I'll wait until hes back to test it again
just start two clients
start Arma twice...
no
who even uses Steam...
just use the exe
from the launcher
ok
idk if my pc will be able to take this
wow
it works
only took like 2 whole days to put all the players in the damn plane
welp now I got another error
20:40:50 Error in expression <ll]];
_units = _logic getVariable Units;
diag_log [_units, _units apply { typ>
20:40:50 Error position: <;
diag_log [_units, _units apply { typ>
20:40:50 Error Invalid number in expression
20:40:50 File AJ_Cache2\functions\fn_moduleNuke.sqf..., line 8
20:40:50 Error in expression <ll]];
_units = _logic getVariable Units;
diag_log [_units, _units apply { typ>
20:40:50 Error position: <;
I dont think this is actually coming from the line it says, unless _logic is for some reason a number
idk lol
learning is fun π
currently its pretty bare bones, just getting the params and the debug
_mode = param [0,"",[""]];
_input = param [1,[],[[]]];
switch _mode do {
case "init": {
_logic = _input param [0,objNull,[objNull]]; //get module logic
_units = _logic getVariable Units;
diag_log [_units, _units apply { typename _x }];
};
};
I guess it really was line 8, since commenting it out got rid of the error
god this makes me feel silly sometimes. I forgot my quotations
another question for unit capture say you're using a multi crew vehicle like the vanilla arma 3 merkava with unit capture can you unit capture the merkava say driving slow down a road whilst also unit capturing somehow the gunner turning the barrel towards a certain point and firing?
the following code in initPlayerLocal is only working for the server host, not connected players:
cutRsc ["RscBRHUD", "PLAIN"];
[] spawn {
while { alive player } do {
(uiNamespace getVariable ["BRHUD", displayNull]) displayCtrl 1000 ctrlSetText ("Player Health: " + str round ((1 - damage player) * 100) + "%");
(uiNamespace getVariable ["BRHUD", displayNull]) displayCtrl 1001 ctrlSetText ("Players Remaining: " + str ({ alive _x } count allPlayers));
sleep 1;
};
};
the GUI is only opening for the server host
and this code that is executed on the server is also only working for the server host:
[_zoneMarker] spawn {
params ["_zoneMarker"];
PP_wetD = ppEffectCreate ["WetDistortion", 300];
PP_wetD ppEffectAdjust [3, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.05, 0.01, 0.05, 0.01, 0.1, 0.1, 0.2, 0.2];
PP_wetD ppEffectCommit 0;
PP_film = ppEffectCreate ["FilmGrain", 2000];
PP_film ppEffectAdjust [0.5, 1, 1.5, 0.5, 0.5, true];
PP_film ppEffectCommit 0;
while { true } do {
sleep 1;
{
[_zoneMarker, _x] spawn {
params ["_zoneMarker", "_player"];
if !(_player inArea _zoneMarker) then {
_zoneDamage = if (typeOf vehicle _player in ["B_MRAP_01_F", "O_MRAP_02_F"]) then {
3 / (getMarkerSize _zoneMarker select 0)
} else {
5 / (getMarkerSize _zoneMarker select 0)
};
[PP_wetD, true] remoteExec ["ppEffectEnable", _player];
[PP_film, true] remoteExec ["ppEffectEnable", _player];
sleep 1;
if !(_player inArea _zoneMarker) then {
_player setDamage (damage _player + _zoneDamage);
};
} else {
[PP_wetD, false] remoteExec ["ppEffectEnable", _player];
[PP_film, false] remoteExec ["ppEffectEnable", _player];
};
};
} forEach allPlayers;
};
};
what am I doing wrong? everything works great when I test it in multiplayer by myself, but nothing works for players other than the host. is there something I'm not considering? I don't see anything wrong with this code
vanilla unitcapture can't do that no
the effects are only created locally
remove alive player condition from while
just use true
ok
so I just need to remoteExec the creation and adjustment of them?
you need to remoteExec the whole code
ok...
shouldn't it just work in initPlayerLocal? So long as while {true} is used
[_zoneMarker, {
[_this select 0] spawn {
params ["_zoneMarker"];
PP_wetD = ppEffectCreate ["WetDistortion", 300];
PP_wetD ppEffectAdjust [3, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.05, 0.01, 0.05, 0.01, 0.1, 0.1, 0.2, 0.2];
PP_wetD ppEffectCommit 0;
PP_film = ppEffectCreate ["FilmGrain", 2000];
PP_film ppEffectAdjust [0.5, 1, 1.5, 0.5, 0.5, true];
PP_film ppEffectCommit 0;
while { true } do {
sleep 1;
{
[_zoneMarker, _x] spawn {
params ["_zoneMarker", "_player"];
if !(_player inArea _zoneMarker) then {
_zoneDamage = if (typeOf vehicle _player in ["B_MRAP_01_F", "O_MRAP_02_F"]) then {
3 / (getMarkerSize _zoneMarker select 0)
} else {
5 / (getMarkerSize _zoneMarker select 0)
};
PP_wetD ppEffectEnable true;
PP_film ppEffectEnable true;
sleep 1;
if !(_player inArea _zoneMarker) then {
_player setDamage (damage _player + _zoneDamage);
};
} else {
PP_wetD ppEffectEnable false;
PP_film ppEffectEnable false;
};
};
} forEach allPlayers;
};
};
}] remoteExec ["call"];
``` Is this better @little raptor ?