Hi all, i picked up arma scripting not long ago, and i noticed that although scripts are executed as independent threads, there seems to be no native support for thread safety? im aware there are c++ extensions like Intercept, but for things like BIS event handlers sqf is still needed. So is there certain mechanisms that mitigate race conditions that i didnt know of, or is sharing global variables simply a no-go for arma3?
#arma3_scripting
1 messages ยท Page 476 of 1
as in any language you can share global variables on a machine. Many scripts and mods use this. Race conditions are a sad reality in any language and in arma they exist as well, especially in an MP environment.
In arma there are Scheduled and unscheduled scopes. Scheduled scopes cannot be interruppted and try to run on the same frame, unsheduled scopes can be interrupted and the runtime can be over several frames.
// *** non-scheduled origin ***
[] spawn {
// *** scheduled scope ***
[] call {
// *** scheduled scope ***
sleep 3; // <- OK
hintSilent "Hello World!";
};
};
Commands like sleep only work in non scheduled environment. Calling a scheduled scope in an unscheduled one like the example above makes it essentially also an unscheduled scope.
But for things like BIS event handlers sqf is still needed Intercept has abstraction for the BIS eventhandlers. You don't have to see them.
Threads are not independent real threads. They are all scheduled on the main thread
scheduled scripts are paused after a max of 3ms
http://sqf.ovh/ite/2018/01/21/ITE-the-scheduler.html
@digital jacinth you mixed up scheduled/unscheduled. scheduled can be paused
ah damn i always mix them up...
@still forum thanks for the info! so scripts and event handlers are guaranteed to run only once per frame?
there will never be scripts running in parallel.
"once per frame" well... If you run them multiple times sequentially then they will run multiple times per frame
@tough abyss only event handlers and unscheduled scripts
You can get race conditions with scheduled scripts. As the script can pause at any time. If you copy a global variable into a local one. Then the script get's paused. When the script resumes and the global variable has changed. Your local variable will have the old state. So things like this can happen in unscheduled
_myVar = MyGlobalVariable;
_myVar == MyGlobalVariable //false
That can't happen in unscheduled scripts.
@tough abyss if you need not-inyeruptable code inside scheduler, you can use isNil <CODE>
thats a bummer.. glad to hear Intercept has event handlers though!
The eventhandlers are SQF code in the backend. But you don't see that as a user
is isNil test-and-set?
@tough abyss isNil CODE check if code return nil value
@tough abyss this code will be executed as unscheduled from start to end without interrupts
isNil { if (!aquired) then { aquired = true; true } else { false } }; can this hypothetically be used as a lock?
you'd have to return nil to get the returned value out
I have a lock script lying around
yea true but aside from that is my code semantically correct?
https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/1.0/addons/core/script_macros.hpp#L95
That's not perfect though. The
waitUntil {if (!name) exitWith {name = true; true};false;} would optimally be
waitUntil {isNil {if (!name) exitWith {name = true; nil};false;}}
Guess that should work
@still forum thanks for your help! thats one funny way to implement locks for sure lmao
thank you @strong shard @digital jacinth as well!
๐
Yeah, you can 't make includes from your own addons in description.ext even if you use a 3rd party packer
Its a real shame that BI didn't proceed a bit forward with that system, there's a whole crapton of stuff that you can do with it
I think it's just a bug that it got broken. Fixing it just doesn't have any priority. As few people use that. And these people can just use workarounds
@still forum just a follow up question are sqf commands themselves like isNil atomic?
yes
any exceptions?
ForEach/while/count (the count {} variant)
all things that loop through stuff
if/else are atomic themselves. But the code they execute on condition is not atomic
I think isNil is the only command that executes the code in it's parameter atomically.
So.. Commands are generally atomic. But the code that you pass as a argument is generally not executed atomically
Code inside FSM also atomic
I know there are other ways to get code to execute unscheduled. But I and everyone I know only uses isNil because it's the simplest
๐
some mod vehicles dont appear in zeus, they are loaded since i can see them in virtual garage and spawn with createvehicle. how to make them appear in the list?
set it in the curator module that all addons including unofficial ones are available.
if that still does not does it then it means they are scoped out in their configs for zeus
@digital jacinth so i have to do something like this? (foreaching allcurators array)
curatorObj addCuratorAddons ["veh_classname1","veh_classname2"];
oh it is a zus module that is added via script`?
its a vehicle mod like hafm submarines (and a few others), they just dont appear anywhere in zeus
(right side list of vehicles and units)
no i mean you are creating the curator module with script, it is not added in the editor
yeah def in mission script not editor
iirc all you need to do is set a variable on the module
moduleZeus setVariable ["Addons", 3, true];
where do i get that modulezeus object while mission is running? clients are telling me stuff is missing when they are inside zeus.
you also should check the config of the vehicle, see if it has a "scopecurator" value
so i just cant script them in realtime? (like debug console script?) i dont want to inherit stuff and make a new addon just to change the scopecurator bit
you can get your own current curator object with this
getAssignedCuratorLogic player;
you can only change config entries with mods sadly
the reason why I am asking this is because with zeus vehicles can now have 2 scopes, one for editor and one for zeus
so for the part I meant you can do this:
(getAssignedCuratorLogic player) setVariable ["Addons", 3, true];
as the unit which has zeus
so that statement will bypass the scopecurator attribute?
Do you still need to addCuratorAddons if you set that variable?
I didn't know that it existed. Need to update all my curator scripts immediately ๐
so i set that var and magically my zeus list will have everything in there?
atleast everything that doesnt have explicit scopecurator cockblock?
@still forum try it out, I made some dynamic zeus script, but it was too unreliable so i went back to normal editor placed ones
@lusty canyon iirc yes
and now i regret not uploading that code snippet to github so i could reference it directly
@digital jacinth thanks heaps ill try them out, curator stuff is hurting my peanut brain
or just take a look at belbos template to create dynamic zeuses
@still forum
https://github.com/Pergor/ADV_MissionTemplate/blob/8fdd0e11e19b6f6320335d8d0ef964cc42578ea8/adv_missiontemplate.altis/functions/server/fn_createZeus.sqf
https://gist.github.com/dedmen/3fa5f648631dd14a4173edea7580045e#file-makemecurator-sqf-L30 This is mine. And I think the addCuratorAddons is causing a huge lag. Will test for sure
Code inside FSM also atomic correct. When in doubt canSuspend
"When in doubt" > check wiki ๐
also fsm states scripts is just unscheduled environments, there are no magic...๐
sometimes i wished there would be some magic in sqf
(โฉ๏ฝ-ยด)โโโ๏พ.*๏ฝฅ๏ฝก๏พ
FSM scripts are scheduled, this is exactly the reason why not to trust wiki completely. Also it might not get updated with changes to the engine unfortunately
Well. Changes to the engine in the FSM/SQF area are...... Rare.
Basically nothing change in the last like.. 10 years
But something in FSM's is executed in unscheduled manner. Maybe the conditions?
I think the conditions are based on what I saw in the broprofiler the other day.
Conditions, preconditions and states cannot be suspended but FSM scripts, .fsm are added to the global script scheduler
How does one transfer scripts to be executed from an additional file rather than directly from initPlayerLocal.sqf? I'd like to move some eventHandlers away from the aforementioned file but for some reason the scripts/EH's won't work if I just move them to let's say folder/file.sqf in the mission PBO (and use []execVM "folder/file.sqf" to call the file from initPlayerLocal.sqf)
any errors you're getting? that stuff should work
no errors so that's one thing
Oh yeah.. pieces coming back together since I was wondering the same thing already quite some time ago. Obfuscation might have had something to do with the fact that the scripts placed in an additional file sort of don't work anymore
hey, how would i start xcam from the debug console?
path is E:\Steam\steamapps\common\Arma 3\@xCam
Erm
What do you mean exactly?
Like how to make a vehicle play an animation (open door etc)?
Or how to animate the object (add side seats to hummingbird etc)?
Can't in vanilla I don't think
As you don't get to 'stand' in any aircraft
Remnants of War IS vanilla
I think this was produced by just making the plane static, adding lights, and positioning the characters to make it appear as if they are standing inside the plane
IIRC the state was executed scheduled while the conditions where not in FSM
well, there are many ways. easiest is to use a trigger, and set the condition to PRESENT. Then ied1 setDamage 1 in the on activation box
where ied1 is the name of the explosive
Why would it? You're just making it a parent object of the one you are attaching it to.
setDamage will detonate IEDs iirc
That's interesting ๐ค
i mean, i would expect it to
Make sure you're actually in the trigger?
It could be something specific to aircraft, dunno
what's the present condition, again?
what?
no i mean
yes but which side is set to present
i mean
who is it checking for
and you are OPFOR, correct?
erm
Otan?
oh, well then it won't work
switch it to BLUFOR
yeah then it would work
you can make it "Anybody"
and then it'll trigger for any side
cheers ๐๐ฝ
Don't get hooked on using triggers though, bad practice for mission expansion and readability. But if you are making a small mission it should not matter
what would be a good way to make sure stuff that is saved locally on a player unit (setVariable) survives that player disconnecting? i'm unsure about the timing of it all.
it would be important to have it be local though before the player disconnects
@polar folio HandleDisconnect EH + either profileNamepsace (local to player's profile) or server profile
server profile is not local to player, so profileNamespace might be what you're looking for
i'm not trying to save player state on the server for persistence. i'm just wondering, when a player has their game crash for example, if the variables on their unit will get lost since making the stuff global or transfering it needs to happen on that player's machine, right? i should probably just debug this with someone
You have to save into profile namespace if you want it to survive crash on client
oh i see what you mean. but i need it instantly. you mean so i can retrieve it once the client reconnects.
it's fine. i thought maybe it was stored somewhere for a sec. wishful thinking. i'll just have to broadcast stuff in intervals
Depends what stuff
yea i know it's vague and abstract. it's just too interconnected to show examples. was more of a general question anyways. thx
how do i take a string "myvar" and turn it into a variable?
@exotic tinsel missionNamespace setVariable ["myvar", _dta]; if i understood you correctly
@polar folio Save stuff in intervals, I think with SQF Layer it's impossible to save right before crash, the best you can do is save frequently and make sure it gets saved in enough time
yea, that is what i wanted to avoid and only do it on request/event. but yea should be fine. thx though
Yeah. You can do it for event, just not crash event
where do you set addMissionEventHandlers? i mean what file
In any file or script, I think. In init.sqf for instance.
So I was using the ArmaDebugEngine and I like how it dumps all my local variables into the .rpt, it's very helpful. Can I cause it to dump the variables through some script command? Sometimes I just want to see what data is passing at some point without making a specific diag_log for it. I could make a scripting error of course to cause it to dump everything but it is kind of... ugly.
how do i go about making the "player" ai controlled and uncontrollable like in the first mission of arma 3 campaign?
@fair drum BIS uses a string of animations to do most of the cutscenes in arma 3's campaign
I'm just talking about the first part in the campaign when you're walking forward you have no control of your character and it eventually pants away and then you have control again
I want to do the same thing except the player is a driver of a vehicle and I don't want the player to have any input until a certain point
Okay I've used that before I didn't know you can use it as a player entity
Sure
player switchMove "Acts_welcomeOnHUB01_PlayerWalk";
``` ^ into the console
probably unitcapture/play or cameras better option... you will have to "adjust everything" for that one animation... ๐ค
Yep, both work perfectly. Just depends on what you want to use it for
@polar folio Deleted Eventhandler. Fires just before unit is deleted. If unit is not deleted then variables won't be lost. BUT the variables have to be public.
Saving them on the crashing player obviously doesn't work ^^
@astral dawn I am VERY sure that I had a command to just dump the stack somewhere... I can't find it now.. wtf :D
Probably didn't commit that change -.-
Okey.. Reimplementing that now and I'm now 100% sure I already implemented that somewhere.
https://s.sqf.ovh/firefox_2018-08-01_09-12-18.png HAH! There it is.. Wonder what happened to that code ๐ค
Hello everyone, what would be the good syntax to search " and ' in a string ?
could be this ?
private _badChartoSpot = ["/", "\", """"", ""'""];
@astral dawn https://ci.appveyor.com/project/dedmen/armadebugengine/build/artifacts Here. Build with that command
@compact maple find command
you'd need to repeat for every string though. there isn't a find any string in array command
I know, this is what i did :
params [
["_stringToInspect","",[""]],
["_badChartoSpot",[],[[]]]
];
private _badCharSpotted = [];
private _isStringOk = true;
{
private _find = _stringToInspect find _x;
if (_find != -1) then
{
_badChar = _stringToInspect select _find;
if !(_badChar in _badCharSpotted) then
{
_badCharSpotted pushback _badChar;
};
_isStringOk = false;
};
} forEach _badChartoSpot;
[_isStringOk, _badCharSpotted]
but what if i want to search a " or a ' ?
in my case, the player will have to enter a text, but i do not want him to type " or ' or / or \
not sure about quotes but for the characters we have BIS_fnc_inString and BIS_fnc_filterString
Don't understand the question. If you want to search a " then.. just do it?
just findit ๐
thanks didnt know theses functions.
yea then just do it, but how do i escape this " ? as string get two " "..
oh btw about strings and stuff... i have two arrays with a strings, one with constant number of elements and the second one with unknown/random, the task is to count elements in the second array and replace the same number of elements in first one, i'm doing it like this
_arrayA = ["one", "two"...];
_arrayB = ["a", "b"...];
_arrayA deleteRange [0, count _arrayB];
_arrayA append _arrayB;
```is there any better options for that ? ^ ๐ค
That way you end up with A+B. But if you wanted to replace you'd want B+A
simplest would be just a forEach loop
{_arrayA set [_forEachIndex, _x]} forEach _arrayB
yeah, i need replace elements in the first one with the elements from the second
that's why there is append
you are not replacing though
you are removing X elements from the start. And then adding new elements to the back
ABC
and XY
would end up as
CXY
and not XYC
@compact maple Add [ and ] to string and do parseSimpleArray on it, if it is bad it will fail
those ^ replacements >https://gyazo.com/400799ea817d5c90d808fd97731cfbf0
there is ranks + names
I've looked at drawing lines and such on the map, drawLine looks too thin and i think i would need multiple drawRectangle filled. But there is fps warnings in the wiki on both of those, so i guess it is a bad way to go about. Is there a better way? I recon some sort of map marker? Wondering how ACE map tool does it?
I've been thinking about my use of triggers in game missions. I'm wondering how many triggers it really takes to slow down a server that has many AI running. SInce triggers are checked many times very fast, I'm wondering if its better to make a sleep on the server that checks conditions every like 10 seconds or so. The mission I'm making would require somewhere around 15 triggers to work otherwise.
SInce triggers are checked many times very fast 0.5 seconds isn't thaat fast
@still forum Thanks i looked at the wrong files in that pbo :/
So dedmen do you think if I have 15 or so triggers running server only checking inconsequential things that its gonna have a neglible effect on the server? We'll have around 25 or so people playing and 200 AI using the BI dynamic simulation
@Dedmen if trigger is attached to frequently simulated object it will be checked each simulation
15 triggers shouldn't be a problem. As long as they don't span over the whole map
also depends on condition
@tough abyss what could fail exactly ?
Parsing of array containing 1 element which is your string
Actually never mind you might need to add more " for it to work, might get complicated.
@tough abyss you need only one playMove or playMoveNow. playMove - add animation to queue, playMoveNow - clear queue and play this animation
@tough abyss yes if you need play two animation
check description: https://community.bistudio.com/wiki/playMove
Question: SQM placed vehicles in MP are owned by server?
yes. Until entered by a driver
player spawn {sleep 0.5; _this switchMove ""};
player playMove "AovrPercMstpSrasWrflDf";
๐
how i make an animation to end?
player switchMove "";
you have example ^ above with spawn ๐
player spawn {_this switchMove "Acts_SupportTeam_Left_Move"; sleep 5; _this switchMove "";};
what for ?
lol
@still forum Thanks for sharing this build, it seems to be working!
๐ค
I only had to add the _x64 to the end of the dll name
oh.. oops
@tough abyss Also use this when using init field, since it might be not a player at all.
is there a way to find all seats in a vehicle and see if they are occupied? I am trying to move a dog into a vehicle and want to make it as dynamic as possible without fixing the position for the unit.
i am already looking around the vehicles config but i cannot spot how to get the seat information
getNumber (_vehCfg >> "transportSoldier");
I think this one returns the amount of vehicle's cargo seats
Non-fire-in-vehicle ones
any chance also to get the position of those?
Then you need to find FIV turrets separately... I have a script for that somewhere if you want
Position?
Do you mean ID?
or mem point, does not matter. I want to attach a dog there and lock the seat
Oh this position... sorry I have no idea
0_o
Don't know what these numbers you're throwing around are supposed to be ๐
From diag_captureFrame any idea what the numbers (103x151) mean? visUA; 20.88727; 0.21092;"~~ 29.77 ms, 103x151"
Just a comment to scope
I think that's a pixel size
I'll look again
observersXtargets
actually.. Now I'm not sure if it's culling anymore.. Might be AI visibility checking
Check your number of local AI's and compare that to the observers number
Two HCs, the game offloads to them and I had a script that would run per AI that wasn't there. You sure it is AI visibility? Why would that be running a place where there wasn't any AI?
no I'm not sure
๐
observers x targets just sounds like AI
I stand by my original assertion, no one knows what this is ๐
Makes sense sort of in the context of the game but it also ought not be doing anything on the client for that
I'll take if off to the profiler chat and see if I can get an answer from the man himself
@digital jacinth https://community.bistudio.com/wiki/fullCrew
Hello. I'm trying to this :
I'm in a Server-executed script and I want that script to tell a specified player to localy execute a selectWeapon
Is that even possible ?
remoteExec
but if I RemoteExec it'll go to all players not just the one I want
No it won't
The target parameter isn't there to always enter the same value
the target parameter is there to specify the target
you can just pass an object as target. And it will execute the code where the object is local.
Aka on the player itself. If you pass a player's soldier
hoouuouououou .... thanks !
I still ain't getting this right
I can't understand which way to write my remoteExec ....
I would have wrote it like this ...
player is local. Server will just ignore that, since it always has objNull for player.
For client with occupied unit - will send that packet to himself
Sorry I wrote it too fast, I put the player's name instead
Name? target argument doesn't accept names. Maybe you meant unit's variable?
.... hold one, i'll go back to reading the wiki, I most be missunderstanding it
Object - the function will be executed only where unit is local
WTF is this Chinese??? I don't understand this ! ๐ฎ
Nothing Chinese tbh.
This packet will be remotely executed only on PC where that object is local.
All I wan't is for the script to be executed for a local player not any player, the one I want and no other ! Why is it so complicated ..............
If you send unit occupied by a player as a target, it will only executed on that very PC, since player occupied unit is only local to himself.
local to himself ๐
holly fuck I don't understand basic English now .....
This script shit is making me go dumb
Show me the remoteExec line
"OPTRE_M6G_Scope" remoteExec ["selectWeapon", u11];
"OPTRE_M6G_Scope" remoteExec ["selectWeapon", u11];
^
I just copied ๐
Ok, i'll go and read and come back ok ?
proper one is:
[player,"OPTRE_M6G_Scope"] remoteExec ["selectWeapon", u11];
๐
๐
:(((
I need to learn m8, don't do it for me ๐ฆ
anyways this ain't working eather
Oh right
@unborn ether wrong too ๐
Remember what @unborn ether told you before about player
hold on ! eveyone shut up i'll go and study this and come back before
10 min expires
xD
holly shit this is chinese sorry
If you send unit occupied by a player as a target, it will only executed on that very PC, since player occupied unit is only local to himself.
[player,"OPTRE_M6G_Scope"] remoteExec ["selectWeapon", u11];
->
[left argument, right argument] remoteExec [command, target];
where did you get this information ????
[left argument, right argument] remoteExec [command, target];
remoteExec wiki
-_-
written in chinese ๐
Well I can't understand shit on this wiki
Player returns the local player. Meaning the unit that is being controlled on the computer that you exec player on.
But on a dedicated server
there is no human controlling a unit.
A server doesn't have a player
which is why player just doesn't work on server
you need to use a different way to access the unit. Like it's variable name
I tryed !
I guessed that was the problem so I wrote this :
``` but didn't work eather
should work tho ._.
OPTRE_M6G_Scope where did you get that?
the _Scope part doesn't sound right
oh damn @still forum you are right, i forgot that player is local to a sender at this point, so yes it should be a global unit variable.
Indeed that was it !
Thanks again man
I really wish I could have a really conversation with someone one day, learning from typewriting is hard as fuck
plus i'm dumb when it comes to learning by reading
@still forum maybe you could help me on this completely different thing :
I'm detaching an object from the player and making it fall slowly to the ground. It works but I can only make it wall in a precise direction from the player. what i'd like is for it to fall only in front of the player : always where the player is looking.
detach _OBJ;
_Z = 1;
for "_i" from 1 to 10 step 1 do
{
_OBJ setPosATL [getPos player select 0, (getPos player select 1)+3, _Z];
_Z = _Z - 0.1;
sleep 0.1;
};
_newPos = (getPos player) vectorAdd (getCameraViewDirection player)
That will make it spawn 1m away from the player. In the direction his camera is facing
oooohhhh .... great !
i'll try this
thanks
wonderfull its working
but how do I make it fall 2 or 3m away and not 1m away
@still forum
vectorAdd (getCameraViewDirection player) vectorMultiply [2, 2, 0]
2m
ouuuuh .... science fiction
hey guys. having trouble remoteExec ing this. cant find anything on the web. can it be done and if so would you be willing to provide the syntax.
unit disableUAVConnectability [uav,true];
//i tried this
[uav , true] remoteExec ["disableUAVConnectability", _unit];
It tikes two arguments
one on left. one on right
you just threw the left one away. And gave it the right side one.
That's not gonna work of course
(getPos ownerR) vectorAdd (getCameraViewDirection ownerR) vectorMultiply [2, 2, 0];
Error : Type Array, Expected Number ...
I ALWAYS make that mistake
it only takes a single number ๐คฆ
(getPos ownerR) vectorAdd (getCameraViewDirection ownerR) vectorMultiply 2 then
I tryed with 2, 3 and 4 and my object just disappears like it's gone too far away
as if it was multiplaying the getpos Aray
Arma does
((getPos ownerR) vectorAdd (getCameraViewDirection ownerR)) vectorMultiply 2;
instead of what I want it to do which is
(getPos ownerR) vectorAdd ((getCameraViewDirection ownerR) vectorMultiply 2);
Correct answer :
(getPos ownerR) vectorAdd ((getCameraViewDirection ownerR) vectorMultiply 2);
setPos
im trying to apply this to a UAV from the server. it works only for a few shots when a player connects to it. then it goes back to firing without the server removing the event handler. what am i doing wrong. yes i already know im a noob.
[_uav, ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
deleteVehicle _projectile;
private _ammocount = _unit ammo _weapon;
_unit setVehicleAmmo (_ammocount + 1);
}]] remoteExec ["addEventHandler"], 2;
remoteExec ["addEventHandler"], 2; to remoteExec ["addEventHandler",2];?
shit lol, thanks im tarded.
still not working. anything else im doing wrong?
[_uav, ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
deleteVehicle _projectile;
private _ammocount = _unit ammo _weapon;
_unit setVehicleAmmo (_ammocount + 1);
}]] remoteExec ["addEventHandler", 2];
ive also tried remoteExec it everywhere, still no luck.
setVehicleAmmo is local args
https://community.bistudio.com/wiki/setVehicleAmmo
maybe try
[_unit, (_ammoCount + 1)] remoteExecCall ["setVehicleAmmo", _unit];```
addAction, + setDamage
almost everything is SQF ๐
but i guess you mean a separate script file
all three can work, init is good to just try it out
otherwise separate file (although you'll still have to start it from somewhere, either unit init or init.sqf)
separate file is easier to edit though
no... ๐
for starters i don't know what C1 and E1 are, i'm assuming the charge and vehicle, respectively
but look up the addAction syntax on the wiki
or if you wait a bit maybe someone here decides to write it out
but would recommend looking at the addAction syntax in the meanwhile
they're explained
also there are examples
Now look at the setDamage like SuicideKing said. Also try not to think in the chat.
Compare what you have to the 3rd line of Example 1 on the addAction page.
Then why has the code gone out the []
yes
that's not what you're doing though
look at the syntax description, see where the code goes, compare to the examples
๐
closer - i think
whats the differences?
Well
object = player
BOOM
Needs surrounding ""
Round the word BOOM?
Closer ๐
Another difference to example 3? ๐
Closer. What are the allowed data types for the 2nd argument in the array (i.e, script)?
The wiki is your friend
What difference do you see?
// Example
player addAction ["Hint Hello!", { hint format ["Hello %1!", name player] }];
// Munarmunar
player addAction ["BOOM",Explosive 1 setDamage 1]
{}
Also explosive 1 won't work as a variable
Explosive_1 maybe
The gap makes it 2 different things
@tough abyss script: String or Code
@tough abyss https://community.bistudio.com/wiki/Identifier
Explosive 1 setDamage 1 is not a string, nor is it code.
I think it would help a lot if you read this stuff first https://community.bistudio.com/wiki/Category:Syntax
String:
"Explosive_1 setDamage 1;"
``` or the better option ```
Code:
{Explosive_1 setDamage 1;}``` are what you need.
wot
๐ช rage quit
๐
thats not different?
now it is
but worse?
the code bit - the {} bit - goes inside the 2nd parameter of the []
๐
Great! Now please try using commas instead of pressing Enter xD
If you want to find commands that do what you want, these pages are great.
https://community.bistudio.com/wiki/Scripting_Commands_by_Functionality
https://community.bistudio.com/wiki/All_Arma_Commands_Pages
https://community.bistudio.com/wiki/Functions_by_Functionality
this is better for A3: https://community.bistudio.com/wiki/Category:Arma_3:_Editing
@tough abyss you see any UAV in this video? https://www.youtube.com/watch?v=5aHxziH5l0g
at 00:27?
guh ... use a paste service for that @tough abyss !
and make sure syntax highlighting is set to sqf
or at least use the code style
```sqf
code-goes-here
```
Hey there. Exploring the new USS Liberty I remembered that it was promised the vehicle-in-vehicle capability. But I'm unable to make it work, either by trying to get a boat in, or by script way. Any clue ?
Use the Boat Rack object.
Is there a discord or slack for CBA development?
Why?
what am i messing up?
{!alive _x;} foreach [units hostagepatrol]
That depends. What is it you think you're doing?
i want the game to check to see if a group is dead, then exec a trigger
All your code is going to do there is return the status of the last member of the group error out because [units hostagepatrol] just returns an array of objects within an array, use (units hostagepatrol) instead.
mk so i need something like a IF then statement?
well it is in the condition box so that statement if it returns true should trigger it
the main error im getting is type array expected object
in the alive command
Several ways to go about it. for example ```sqf
(((units hostagepatrol) select {alive _x}) isEqualTo []) //all units within the group are dead
Probably also a better way with apply, but it's too late for me to think that through
mk might need an explaination on the select command. im looking at the wiki for it and im kinda lost so far on it
(units hostagepatrol) select {alive _x} will return an array of all elements which satisfy the condition. In this case, it scans an array of objects and returns all alive objects
if that output is merely [], it means nothing satisfied the condition (in this case, nothing was alive)
okay so units hostagepatrol is my group to array conversion and select is selecting all alive units in that array
correct
private _num = 5;
while { true } do {
.... _num ...
};
The _num in while { } stat. is not 5, because of different scope?
So fwiw I did a quick test, none of these finished all cycles.
Using a group of ~1200 dead units
(((units thisGroup) select {alive _x}) isEqualTo []) //0.976563 ms
(units thisGroup) findIf {alive _x} == -1 //0.761035 ms
{alive _x} count (units thisGroup) == 0 //0.777605 ms
{if (alive _x) exitWith {false}; true} forEach (units thisGroup) //1.35821 ms
I did your first suggestion gnashes. it works well for the 8 units i have
could you explain this code to me?
for "_i" from 1 to 2 do {_x addItemToVest "30Rnd_556x45_Stanag";};
especially the 1 to 2 part
1 to 2 is just arbitrary there. Just means it'll loop through the given code using the variable _i with a beginning value of 1, incrementing by 1 until _i reaches 2
For example, if it were 1 to 10; the code block would be executed 10 times.
why use that instead of just adding 2 magazines to the vest? this was just copied from an exported arsenal
Because if you're going to add more than a few mags, that is cleaner than repeating the same line of code 10+ times
ok i see cause the only command that allows multiple magazine placement is addmagazines [mag, count] but this wants to put it in the vest so it cant use that
@quasi rover it stills 5 in the while
Oh.. TBE thx.
@fringe yoke no public one. ACE Slack has a cba channel tho
Is there any way to replicate a vehicle namespace data to another vehicle, like something set with setVariable?
allVariables iterate through and copy each one
@still forum in several places you are mentionning static radios in TFAR, after v1.0. I do have this version, but I can't find anything like a static radio. Do I have to use a standard radio and configure it as static with some functions ?
Double click a radio in 3DEN
Doesn't work as good as I want it to with LR Radios though.
You can place a radio on a table. Double click it and pre-define it's frequencies
Oh great, thanks. Short range should be enough. What's wrong with LR ?
Backpacks are backpacks in 3DEN. but they are put into a weapon holder on game start.. which messes up things. As I'm no longer manipulating a vehicle. But a vehicle that's stored inside another vehicles container
Atleast I think it doesn't work right. I remember it being broken. Not sure if I fixed it in the meantime
Okay, I'll investigate, thx !
Is there a way to hide only the 3D model in A3 ? The hideObject commands also disable the simulation, which is not wanted in my case. Any idea ?
^ hideObject don't disable simulation, it only "removes" GEOM and VIEW LODs
Any object hidden is still moving, shooting, dying, getting destroyed etc.
If it only removes GEOM.. Is fire GEO and physx GEO still there then?
as player you can walk through solid object, but you still walk up stairs of buildings
it is weird
Actually it does disable simulation. I was trying to create a floating plateform, so I attached several parts to a simple jetski. So far, so good, everything behave as expected. But the jetski is visible in the structure. Using hideObject on it would effectively hide the jetski, but the plateform instantly stop behaving as a floating thing, moving along the waves.
Also when you try to attach a rope to a hidden object, the rope behave weirdly, mostly becoming stuck and unusable, and sometimes it's impossible to attach it to the hidden object
you cannot disable simulation on a player
@digital jacinth yes you can
Since when?
@digital jacinth you can
it stuck the player
huh, weird it never worked for me..
@digital jacinth as player you can walk through solid object, but you still walk up stairs of buildings Geometry vs Roadway
i only know you can get stuck in vehicles which have simulation disabled
hideObject doesn't disable simulation. Dot.
So why things get messed up when an object with attached parts gets hidden ?
and how to avoid it ?
hey, i dont remember how can i setVariable on a player and make that variable unchangeable until he dc and variable get destroyed?
thanks you.
thank*
thank then
Hey anyone free?
@brave jungle Just ask your question. You don't need to get someone's attention to get a response
Is there a way to return the currenttimestamp that music is playing via playMusic?
^
I can add a magazine with addprimaryweaponitem, but not grenade rounds?
Can you delete map objects (say, a rock) with a script?
Hm yes i just found that. But collision seems to be headache?
HideObject also disables collision
we just talked about that in this channel 2 hours ago
Anyone know if it's possible VIA scripts to make the new MK41 VLS fire a Cruise Missile at a remote target without manually controlling it with UAV Terminal?
There any special tricks to detecting keyDown EH in display 312? I've tried waituntil {!(IsNull (findDisplay 312))}; but it's sorta hit and miss
Any without Laser designator
@still forum thx will try it out. I'm not always reading this channel when my head is deep in the script sorry.
@storm sierra try reportRemoteTarget and then fire?
nearObject like command still see hidden objects or they disappear from that as well?
@inner swallow Thanks, that works
Is there any simple way to get all ammo classes a given vehicle can use?
Kinda like getCompatiblePylonMagazines but for vehicles without pylons.
If you want to filter out hidden objects - isObjectHidden
https://community.bistudio.com/wiki/configSourceMod + configFile and path to config of an object
thanks
I am trying to draw a line between two "areas" on the map that is defined by cities belonging to a different faction. Something like this: https://i.imgur.com/bZgquaB.jpg
The only way i can come up with is find pairs of opposite sided city locations and then find the inbetween position and use that point as a node on the line. But how do i find these pairs? Only thing i came up with was check distance between every single spot which is like 137*137
Is each marker a position that can be taken by a faction?
kind of
To be fair I only know of ways to do that in systems where each node has a set amount of connections to other nodes
Is it possible to allow sling loading for only certain types of vehicles?
But your system sounds like it's supposed to be very dynamic
I believe you can disable slingloading manually via script if the vehicle allows it, but I don't know what properties a vehicle needs to allow that in the first place
@tender fossil
Idk why I tagged the other guy
Thanks!
array_1 = ["test"];
array_2 = array_1;
array_2 deleteAt 0;
systemChat format ["%1", array_1]; // []
systemChat format ["%1", array_2]; // []
wait ... what?
nvm .. but seriously caught me off guard.
wow ..... thanks!
That arrays are passed by reference catches everyone off guard
Although it's kind of logical
good thing i started to check every step i code immediately with debug outputs before even attempting step 2.
good old SQF Debugging
it's part of my "write some code, figure out what it does, proceed" approach.
Everything in arma is passed by reference ๐คทโโ๏ธ
I wonder why they didn't add pointers to sqf then. Have to use arrays as pointer replacement. ๐คท
@waxen tide https://i.imgur.com/39lhP2G.jpg
Not really sure where to ask this, but.... I am making a mission where the players start off as civilans (blue units in "disguise") but on respawn I want them to respawn with the loadout they have at the mission start.
if you are using respawn templates, you can just disable respawn on start, give them some "base" loadout and in respawn menu players will select they "another" loadout
@tulip smelt
thankks
@queen cargo only arrays, other types is passed by value
Nope @strong shard
Everything
Literally everything is passed by reference
Just that there are no commands to modify them ๐คทโโ๏ธ๐คทโโ๏ธ
@astral dawn because too complicated ๐ Would basically need to add another type for each type
Why, in SQF we have dynamic types. We could just have a type known as 'pointer to something', should be enough?
Ah yeah.. probably ๐ค
@queen cargo ok, what about numbers? also reference? ๐
What's so hard to understand on Literally everything ?
The fact that it seems to the observer like those number are not passed by reference I guess ๐คทโโ๏ธ
Dont know
Is anything wrong with this?
"siren1",
"siren2",
"light1",
"light2",
"light3",
"light4",
"light5",
"light6",
"light7",
"light8",
"light9",
"light10",
"light11"
];
publicVariable "Config_Firecall_StationObjects";```
no
Lol, for some reason my mission is being a bitch about it..
if you get a error message you maybe should show it to us
admires Dedmens patience
Whenever my mission has something wrong with it, it always shows it as 'Task Force Radio is not deployed on this server'
Hold on checking RPT
carefully avoids looking over to the editor window
The good thing is, the more obscure bugs you create yourself, the better you get at finding them.
Hi guys. I would like to make a missilelauncher that locks on and fires at multiple targets at once. Anyone know if it can be done? In case, which functions would be used for this?
lets say I have 20 missiles and 10 enemies withing range, I would like 10 missiles to lock on to individual targets
Is there a way to call an sqf file in scheduled environment and recieve a return value from it without declaring it a function ?
call compile preprocessFileLineNumbers
Why no worky?
_map_array = _map_array call preprocessFileLineNumbers "conquer_10k.sqf";
_map_array = _map_array call preprocessFileLineNumbers "conquer_...'
Error call: Type String, expected Code
does hideObjectGlobal work all the time (vs hideObject: "When used on player, it only has an effect on third person mode. First person LOD is still visible. (A3 Dev 1.33)")
kinda sounds like if you hide yourself
the problem is this in SP
in camera scenes you need to be nearby to hear conversations
so the approach was to move an unit ontop one of the convo guys
selectPlayer that
but hideObject it to not see the floating dude from the camera
in A3 that no longer works due to above bug
but havent tried the global variant yet
oh I see, you asked if hideObjectGlobal is better
my bad ^^
I guess it should work
it's because the first person model is rendered seperately if you are inside it
but when you are in the camera, that shouldnt be the case, or doesnt have to?
(camCreate)
correct
well it may be also a different bug. at least it no longer works in A3
Hi, i'm having a problem with ForceWeaponFire, i'm trying to make a dude fire full auto while playing an animation but it doesn't fire anything :[
bao switchMove "Acts_CrouchingFiringLeftRifle01";
sleep 1;
bao forceWeaponFire ["arifle_SUD_AK74", "FullAuto"];
("bao" is the unit i want to force fire,)
null = [] execVM "scrotum.sqf" (i put this in a trigger)
bao forceWeaponFire [primaryWeapon bao, "FullAuto"];
You could try this, maybe the gun class was wrong
Giving it a try now
Nothing
I checked the list of the weapon's firing modes and FullAuto is in it
does the animation work?
does the unit fire without the animation?
I'll check
It does but not in FullAuto ๐ค
I'll try and change rifle
Nothing, let me try another animation
Doesn't seem to work on anims
Although i saw some machinimakers managed to use it
[] spawn {
for '_i' from 0 to 30 do {
player forceWeaponFire [currentWeapon player,(weaponState player)#2];
sleep 0.1;
};
};
does this not work in all animations?
Tried, doesn't work ๐ฆ
hmm
It only works if you're not using anims
@velvet merlin You can just move player camera there, the audio streams from where camera is. Could place an object at location even hide it, then switchCamera obj after youโre done switchCamera player
well this makes the audio not sound right as its from the wrong position, no?
How do you mean?
The sound is stereo and depends on camera direction which depends on object direction
the camera is somewhat off in most situations
the player is far off
currently the "player" is above the conversation via AI dummy and selectPlayer
and you hear via direct speech
aka 3d positioning dependent
Still not 100%. The audio would be from location as if player is there while player is elsewhere.
so do you mean to use another object, instead of an infantry, to be nearby?
It would be simpler and you could achieve the same result as you are getting currently
Hello, stupid question incoming
I am using my own script to spawn infantry in an area, and I use CBA_fnc_taskDefend to make them patrol around.
Is there a way to prevent CBA_fnc_taskDefend from forcing the AI to take a swim and become impossible to find?
(Have a task that autocompletes as soon as enough infantry has been killed, but the infantry become impossible to find in a 500m radius area when half of them are hidden in the water)
Or should I just take CBA_fnc_taskDefend and make my own variant out of it with some "failsafes" to prevent it from placing waypoints into the Ocean?
(Thanks for Answers in advance)
Hello, is there anyway to make a local variable on the client, public to the server without using publicVariableServer?
What would be the command to set the weather to sunny?
you first have to put it in a global variable.
Why don't you want to use publicVariableServer? That is literally the way to make a variable "public to the server" which is exactly what you asked
The reason I dont want to use publicVariableServer is because the variable is changing. The variable is being overwritten by other clients.
If you want to transmit it you have to transmit it
To answer your question, I don't think there's a way to make a "local variable on the client, public to the server without using publicVariableServer", unless you make a function and execute it using remoteExec, but you'd get the same result as publicVariableServer that way anyway
If you want Clients to be able to update the variable for all other clients, use publicVariable
You are probably doing something wrong and there is a different/better way to do what you are actually trying to accomplish by sending that variable to the server
It might help us abit, if you tell us what you're trying to do with the local variable
mine returns xyz
๐ฎ ehhhh... Really really sure?
that would've been a apocalypse ^^
But why ๐ค
cuz it's been xzy since forever
What do you think F in SQF stands for
function
Yeah fucktion
@tough abyss the problem is the units in the scene are moving at times. would need to move the object alongside
is there any ez way to set EG spectator params/options (allowed sides, allow free camera, allow 3PP etc) without "initializing" it ?
so players can just start spectator from the respawn screen with "custom options" ? ๐ค
If I execute this line: ["SpawnNotification",["Rewards spawned on maps. Check markers."]] remoteExec ["BIS_fnc_showNotification",0,true]; with multiple people on server, let's say 3, it will execute the code on server and all those 3 people, right?
It should from my understanding
the second parameter in the remoteExec function designated the client you want to execute that on
if 0 it's global
Right.
So, if I will, instead of showing notification, create a marker on map, there will be 4 markers on map?
I think so
I actually have very little knowledge in arma3 scripting, i just did a little bit yesterday modifying a scenario off of github
So, to make sure that there would be only one marker, visible for all, what would the parameter value have to be?
Took me a while to pickup on the keyword after if(condition) soooo ๐
I'd assume call a script that checks if it's the server
if(isServer) then {
[] execVM "TestServerSide\init.sqf";
};
[["Wow! It works!"],"sample_log",false] call BIS_fnc_MP;
hint "Done!";
Found from a google
Arent markers local though?
You'd want this
https://community.bistudio.com/wiki/createMarkerLocal
Let's you create a marker local to a player
use remoteExec, not BIS_fnc_MP
Yea that's 4 years old now
createMarker is global
The post i got it from
createMarkerLocal is local
This is where i say thanks capt
Would be a little less passive aggressive if there wasnt a documentation link a few posts above
I don't follow you
i just saw talk about remoteExecing createMarkerLocal ๐คท๐ฝ
anyway
carry on
Thought you were responding to my question
Which i already answered
So yea as established you should just need to use createMarker
Atleast i think ๐
So, let me explain what I'm trying to achieve:
I work on a mission with sectors to control. In each sector I have a trigger that's set this way: https://snag.gy/pQXbYB.jpg
This is the file executed in On Activation: https://pastebin.com/0h1TWVpJ
Problem is that when I tested and captured the sector it created everything two times.
Use hatebin or hastebin for code sharing
It's a much nicer experience
I dont know the API enough to actually help
Things I'm considering:
- Ticking the "Server Only" checkbox in trigger
- Changing the
remoteExecparameter
@high marsh i mean when you start it from respawn menu, all of those option will be default from BIS_fnc_EGSpectator
for example "free and 3PP" cameras will be allowed by default, so it's possible to change it,
^ if someone need it just check BIS_fnc_EGSpectator file there is all the answers... ๐
FYI: 1st option did the trick. No duplicated spawns anymore
[_sector, "ownerChanged", {
params ["_sector", "_owner", "_oldOwner"];
/* code */
}] call BIS_fnc_addScriptedEventHandler;
more info > https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
@formal vigil
oh also...
//--- How to return all sectors
private _allSectors = missionnamespace getvariable ["BIS_fnc_moduleSector_sectors", []];
great stuff, thanks @meager heart
yeah, now the problem is that people cannot join when the mission already started
Is it possible to make the I key inventory while inside a vehicle only show the gear side of things and make it so you can't put stuff inside the trunk while inside but you can move a gun from your bag to your primray spot? sorry for my english
I am working on a playable dog script right now, i want to be able to leap forward, but arma is kinda refusing when usint setVelocity or addForce. anyone got an idea?
current progress is here
https://github.com/diwako/playabledog/tree/master/dog.VR
_dog setPosWorld (getPosWorld _dog vectorAdd [0, 0, 1]);
```๐ค
gah, nah. if you setpos the dog just cannot move for a few seconds. all these drawbacks because it does not inherit from camanbase
Hello, regarding the Zeus ping function, i'd like to keep the functionality that it offers, however slow down the amount of times it can be pressed. For example, detect when it was used, then sleep it for 30 seconds before allowing it to be pressed again.
Just not sure on a way to go about it. I tried the event handle but I'm not sure on how to delay the ability to spam it.
looks like you can disable the key for it,
https://www.reddit.com/r/armadev/comments/2yfzsc/any_way_to_disable_players_ability_to_ping_zeus/
probably better if you catch the key with in actionKeys "TacticalPing"
hmmm
findDisplay 46 addEventHandler ["KeyDown",{if ((_this select 1) == 44) then {TRUE}}];
```bad example there that is the same as `if (true) then {true}`
```sqf
findDisplay 46 displayAddEventHandler ["KeyDown", {(_this select 1) == 44}];
``` ^ ๐
addEventHandler also does not allow keydown, so that example is actually not working
maybe this?
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_control", "_key", "_shift", "_ctrl", "_alt"];
private _ret = false;
if(_key in actionKeys "TacticalPing" && {(missionNamespace getVariable ["diw_lastping",time - 1) < time}) exitWith {
diw_lastping = time + 1;
_ret = true;
};
_ret
}];
lol now it does not work because of my german keyboard
actually the whole thing does not owkr as it looks like youc annot overwrite that action.
actionKeys not reliable and inputAction too (both will fail with custom keybinds/macro/controllers... etc ๐คท)
hah, funny i found a pist by dedmen. turns out it is bound by a missionnamespace variable
missionnamespace setvariable ["bis_fnc_curatorPinged_time", 99999999, true];
with this it would be possible to attach an eh to the curator which sets that variable for the unit remotely.
Just adding this to the init field of the curator module might work.
this addEventHandler ["CuratorPinged", {
params ["_curator", "_unit"];
systemChat format ["%1 pinged for zeus",name _unit];
[0,{missionnamespace setvariable ["bis_fnc_curatorPinged_time",time + 5];systemChat "Ping received!"}] remoteExec ["call", _unit];
}];
Do one of you have any idea if it is possible to retexture the different screens spread all over the new USS Liberty ? I tried browsing all namespaces of the ship with
{
_str pushBack allVariables (_x select 0);
} forEach (dest getVariable "bis_carrierparts");
copyToClipboard str _str;```
where "dest" is the reference object of the destroyer in Eden, but the result is simply ``[[],[],[],[],[],[],[],[],[],[]]``. However all parts are correctly accessed, it just seems that there is no variables set otherwise. Is there another way to access those screens and eventually retexture them ?
Hi guys, just a quick question, wondering if anyone could help:
Iam trying to hunt down a weird bug in Antistasi Lord Golias edit:
//this sets up the Faction specific template
[_dict, "static_mg", "rhs_KORD_high_VDV"] call DICT_fnc_set;
[_dict, "static_mg_low", "rhs_KORD_VDV"] call DICT_fnc_set;
[_dict, "static_mortar", "rhs_2b14_82mm_vdv"] call DICT_fnc_set;
// compute lists of statics
{
private _statics = [];
private _type = _x;
{
if not ((_type == "static_mg_low") and (_x == "FIA")) then {
// FIA does use "static_mg_low".
private _static = [_x, _type] call AS_fnc_getEntity;
if not isNil "_static" then {
_statics pushBackUnique _static;
};
};
} forEach ["CSAT", "NATO", "AAF", "FIA"];
if (_type == "static_at") then {
AS_allATstatics = +_statics;
};
if (_type == "static_aa") then {
AS_allAAstatics = +_statics;
};
if (_type in ["static_mg", "static_mg_low"]) then {
AS_allMGstatics = +_statics;
};
if (_type == "static_mortar") then {
AS_allMortarStatics = +_statics;
};
} forEach ["static_aa", "static_at", "static_mg", "static_mg_low", "static_mortar"];
AS_allStatics = AS_allATstatics + AS_allAAstatics + AS_allMGstatics + AS_allMortarStatics;```
At this point if I copy AS_allMGstatics into clipboard during the mission it gives me an array thats missing the "static_mg", "rhs_KORD_high_VDV" only has "static_mg_low", "rhs_KORD_VDV". Why is that? I would expect it to put both the static_mg and static_mg_low as per the code.
```sqf
if (typeOf _x in AS_allStatics) exitWith {_stcs pushBack _x;};```
Pushes back only the mortar but the composition has the MGs in it.
{
_vehiculos pushBack _x;
{
private _unit = ([_posicion, 0, _crewType, _grupoCSAT] call bis_fnc_spawnvehicle) select 0;
_unit moveInAny _x;
_gns pushBack _unit;
} forEach ([typeof _x, false] call BIS_fnc_crewCount);
} forEach _stcs;```
And finally this throws a script error stating that the forEach _stcs is a number not an array.. it somehow changes to "Any".
All of this happens when Antistasi spawns in a composition from a template and tries to populate the static guns with infantry.
} forEach _stcs;) That bracket at the end? What's it doing there? Also where is _stcs defined?
that bracket was me just fighting the discord code formatting.. sorry will edit it out.. its not in the code itself
and private _stcs = []; is defined like this all the way at the top of the script
should be populated if (typeOf _x in AS_allStatics) exitWith {_stcs pushBack _x;}; here
the _x in this is every element thats in a composition built by BIS_fnc_objectsGrabber and saved into a usable template
was me just fighting the discord code formatting
```sqf
code
```
if not isNil "_static" then
```you have there ^
sorry? not sure I understand
use three ` instead of one
and write sqf in front of it
and three to close
it will give you a colour coded code block
do you have -showScriptErrors startup param, SomethingSimple ?
yeah
no errors ?
12:27:17 Error in expression <it moveInAny _x;
_gns pushBack _unit;
} forEach ([typeof _x, false] call BIS_fnc>
12:27:17 Error position: <forEach ([typeof _x, false] call BIS_fnc>
12:27:17 Error foreach: Type Number, expected Array
12:27:17 File location\spawns\fnc_AAFhillAA.sqf [AS_location_fnc_AAFhillAA], line 63
only error I get
Yes.. That makes sense
BIS_fnc_crewCount would return the.. crew.. count.
which is a number. And you can't forEach through a number
ok, so the point of that block is to spawn a unit into every available slot within the vehicles as far as I understand it
should I just ditch the crewCount then?
ok, just tested without the BIS_fnc_crewCount and it does work.. no errors thrown around. The thing is that the script only picks up the mortar, not the static guns though.
if (_type in ["static_mg", "static_mg_low"]) then { AS_allMGstatics = +_statics; };
This part for whatever reason only counts the static_mg_low not the static_mg
can anyone see if I have put something wrong here? brig playAction "Acts_B_M03_briefing";
Doesnt appear to be doing anything, i have it in a sqm file. the full code looks like this: ``` titlecut ["", "BLACK",0.2];
sleep 5;
titleCut ["", "BLACK in", 3];
brig playAction "Acts_B_M03_briefing";
JHF commandChat "DEBUG TEST";
titlecut ["", "BLACK",0.2];
sleep 5;
titleCut ["", "BLACK in", 3];
if (local this) then {[A1,"SIT_AT_TABLE","ASIS",seat1] call BIS_fnc_ambientAnim};```
I'm having a hard time with script-spawning weapon systems on the USS Liberty. Weapons are considered as physx objects, so making them spawn on the deck products impredictable results. To the least, very imprecise placement. At worse, weapons are ejected in the sky because of small collisions with the deck. Using attachTo command, the object is not ejected, but it makes the AI in the weapon completely mad, and the turret stuttering. Ideas ? Is there already designed scripts for this ?
Hey, is there anyone here to help me out with some scripting in Zeus? I'm using the Iron Front mod in a single player Zeus scenario, and I'm trying to find a way to make the LCVP drop its ramp when it hits the beach. I went into the config file and found the statement of script to drop the ramp, but it wouldn't work in either vehicle init. or debug console, so I had someone design a new script for me that does work, but it relies on CursorObject and CursorTarget, so it doesn't work in Zeus, only first person. Does anyone know of a way to edit the vehicle name of an object in Zeus mode, or how to apply something to it directly?
This was the script that I pulled from the config file
"this say3d 'LIB_LCVP_Ramp_Open_1'; {this animate _x} forEach [['ramp_rotate',1],['roller_L0_rotate',1],['roller_L1_rotate',1],['roller_R0_rotate',1],['roller_R1_rotate',1],['shutter_rotate',0],['shutter_latch_L_translate',0],['shutter_latch_L_rotate',0],['shutter_latch_R_translate',0],['shutter_latch_R_rotate',0]]; if ([this,'LIB_LCVP_Fast_Landing',true] call LIB_Get_Variable) then {[this,'Ramp'] call LIB_LCVP_Fast_Landing}";
This is the script that works in first person
cursorTarget say3d "LIB_LCVP_Ramp_Open_1";
{
cursorTarget animate _x;
} forEach [
["ramp_rotate",1],
["roller_L0_rotate",1],
["roller_L1_rotate",1],
["roller_R0_rotate",1],
["roller_R1_rotate",1],
["shutter_rotate",0],
["shutter_latch_L_translate",0],
["shutter_latch_L_rotate",0],
["shutter_latch_R_translate",0],
["shutter_latch_R_rotate",0]
];
if ([cursorTarget,"LIB_LCVP_Fast_Landing",true] call LIB_Get_Variable) then {
[cursorTarget,"Ramp"] call LIB_LCVP_Fast_Landing;
};
But beyond that, I don't know what I can do.
And I know just about nothing about scripting, so the dumber you can make it the happier I'll be.
@halcyon creek I can't check right now, but I think it should be playMove
Hey guys! How would I go about overwriting a mod function in a mission file?
Swore you could. I think Exile supports it, but maybe that's a special feature?
I need to extend functionality to this and I'd prefer not to require a new mod
You could try to create the function first by doing it in preInit
But I'd think mission preInit should fire after mod preInit
be the first to compile the function.
Without making a rebuild of the whole module
Ah...
Just need to append _nearThrowables , really.
But it's a private var
Is this possible?
don't see how.. In this case
Anybody know how to fix ACE not returning the right killer with the medical system, because it's handled via script?
Take a look at acex kill tracker. the last damage variable is used and it is local to the unit only
Yeah, no luck. Replaced the _killer with it, works for getting AI kills against player (Returns player properly) but player deaths complain about an array instead of something else. @digital jacinth
That's working directly with the ace_medical_lastDamageSource var.
Is there any way how to make a explosion that when killed by it gives a killmessage like "Player1 killed player2" like normal explosions?
@lean estuary do you need an answer to your question still regarding "Player X killed Player Y"?
I have a headache trying to read this code... lol https://gyazo.com/e3be09e796fa58ddac99a7e711e78e14
The red line, it says an Array cannot have an empty element. I literally have no idea what the intention was with the extra numbers and stuff... Where did the original port dude mess up? Array structure? extra elements?
["wep", >
22:26:32 Error position: <(2,5), RANDOM_BETWEEN(1,2)],
["wep", >
22:26:32 Error Missing ]
22:26:32 Error in expression < "launch_Titan_short_F"], RANDOM_BETWEEN(2,5), RANDOM_BETWEEN(1,2)],
["wep", >
22:26:32 Error position: <(2,5), RANDOM_BETWEEN(1,2)],
["wep", >
22:26:32 Error Missing ]
Wasn't sure how to format it on here, so I took a picture with all the wonderful highlighting and erroring
it happens further down in the scripting too with grenades or someting like that
How are you guys testing this btw?
yeah i noticed too that some of the i guess "Options" for the script were not in arrays
im not testing, just eyeballing the script for poss errors
@unreal siren If you see RANDOM_BETWEEN in your error means that macro didn't work
thats what i was thinking too when the error was showing that but wasn't sure
You actually have RANDOM_BETWEEN(2,5) in your script which is meaningless
I've never used macros personally
Some more useful info
Says a bracket is missing... and everything is wrong, lol
if the script isn't getting Precompiled thats probably whats causing that issue too
Line 33 is suspect, why are there are there 4 elements instead of 3?
Your macros are not processed, they are not defined in your script.
is the script getting defined with compile preprocessFileLineNumbers?
Likely, the rest of the framework seems to- let me check
CompileFinal
fn_refillbox = compileFinal preprocessFileLineNumbers "scripts\server\a3w\scripts\fn_refillbox.sqf";
Inside init_missions.sqf, which in turn, is called the same way in initserver.sqf
Which is called in the init.sqf with the same, with an isserver check
oh you have a screenshot in the post, I just looked at the error message
seems like they should be getting compiled then unless that init_missions.sqf isn't geting called
Yeah you're compiling the script wrong, macros are ignored
I'm not sure the guy knew how the wasteland sidemission system worked lol
Do copyToClipboard str fn_refillbox and you'll have final look on the script after preprocessor
Gotcha
Maybe your script gets put into variable elsewhere differently, overwriting this proper compile
Obviously this guy ported the sidemission system and tried to match the file structure without understanding how it's set up, neither do I, hence why I tend not to port stuff until I do, lol
Though it should be compileFinal so it means its not compileFinal'd at all
i know the feeling, i feel its easier sometimes to write my own system vs trying to port another in
Gotta pastebin, it's large.
Well just see for yourself that macros weren't turned into code
Oh they are turned into code
How do you execute the code where you get that error?
fn_refillbox is compiled properly, looks like you're not using it
It gets called when it's time to queue a new sidemission, but I don't remember if that's when it errors, or if it errors when the sidemission pops up.
Check what side mission code does then
Not that, where that script is actually used
// * This project is licensed under the GNU Affero GPL v3. Copyright ยฉ 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Name: sideMissionProcessor.sqf
// @file Author: AgentRev
#define MISSION_PROC_TYPE_NAME "Side"
#define MISSION_PROC_TIMEOUT 45*60 // Time in seconds that a Side Mission will run for, unless completed
#define MISSION_PROC_COLOR_DEFINE sideMissionColor
#include "sideMissions\sideMissionDefines.sqf"
#include "missionProcessor.sqf";
Just search for all mentions of fn_refillbox
Literally just the sidemissions that call it, and the function itself. That and the compile
๐ค
Well somehow, somewhere your script gets compiled without being preprocessed (through loadFile?)
Are you sure you didn't fix the script (lack of macros) and now trying to solve the issue that no longer exists?
but that compileFinal should prevent that though, right?
Maybe you just didn't have macros defined before and got the error, added macros and now trying to fix it?
Well if they try to save improperly compiled function into same variable
I assumed maybe he has something like call loadFile "...\fn_refillbox.sqf" somewhere
The thing is, the script definitely fires
I'm not too familiar with the mission, but id say try launching it, and if you can, try forcing a side mission to fire and see if it pops the error in your test
And two-three boxes pop up which use those macros
are their contents correct?
My guess is that he already fixed the error, probably didn't have macro defined before and had the error
Also what's the point in maintaining CfgFunctions required file names and dir structure but still do all compileFinal manually ๐ค
I have no idea, lol
(unrelated to error here)
If there's something I can improve on for my own stuff, please let me know
not gonna lie, im lazy like that and just inLine all my functions too instead of cfgFunctions
I don't use CfgFunctions at all
I believe you already have your error fixed @unreal siren just try the mission again I don't think it will error out.
I'll double check, I copy from my ssource to my missions folder for testing.
Same errors in sqllint
Typesqf*
Missing bracket
Basically as you can see fn_refillbox has all macros replaced with actual code
Yeah
But error had macro in it, meaning it didn't in that test where error fired.
Could the bracket also be around that same area?
if a macro isn't defined, it shows up as a nil global var correct?
Nope, missions folder is same
I've also only experienced it at mission start...
So... That could be a big hint.
I think once I've seen it midgame
even if the macro didn't fire, i dont think it would have affected a misplaced bracket, would it?
Line 73 [ needs closing bracket...
hell, @meager granite could it even possibly be a namespace switch? I've only ever read about them but maybe the code is getting started in one namespace and continued in another?
i read about it on a killzonekid article once, i'd have to look it up again
I've got no dice, could the linter be wrong?
but anytime i've experienced issues of a similar nature, when i couldn't find what was actually causing the problem of a variable going undefined, i would wrap my code in with missionnamespace do {} and sometimes it would fix the issue of variables going undefined
Can you confirm the brackets are correct?
PM me the pastebin again for fn_boxrefill.sqf please, i lost it in the conversation
Done
@meager granite the comments in front of the Macros were included in the macro... lol
Also, my linter for Atom IO doesn't understand Macros, hence the empty array error.
Scratch, still errors.
Both still show errors in-editor (haven't tested the latest change), but what's the differene between ```sqf
#define RANDOM_BETWEEN(START,END) ((START) + floor random ((END) - (START) + 1))
#define RANDOM_BETWEEN(START,END) (START + floor random ((END - START) + 1))
#define RANDOM_BETWEEN(A,B) (floor (random [1, A, B]))
also >
#define RAND(A) (selectRandom A)
#define CRAND(A,B,C) (ceil (random [A, B, C]))
#define FRAND(A,B,C) (floor (random [A, B, C]))
first one is broken ๐
random [1, 100, 200] < will return less than 100 too
#define RANDOM_BETWEEN(A,B) ((A + floor (random B)) + 1)
```something like that
idk why you need + 1 tho
Second one is broken too, you just confuse everyone with those.
Been working on an Air support mission and had this script working perfectly, now all of a sudden it has stopped anyone see anything obvious as to why? ```sleep 60;
bomber sideChat "Bone-One-One is off hot, twenty six seconds to impact.";
sleep 26;
bomb="Bomb_04_F" createVehicle (getPos B11);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_1);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_2);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_3);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_4);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_5);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_6);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_7);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_8);
sleep 1;
bomb="Bomb_04_F" createVehicle (getPos B11_9);
sleep 4;
JTAC commandChat "Ugly callsigns, Knight Rider-Five-Six. You are cleared hot to engage any leakers on the bombs' impact.";
sleep 2;
CO sideChat "Ugly-Five-Zero, Copy That. Time on Target 30 seconds.";```
there is more code before and after but its just more sideChat and commandChat so im fairly sure its not that
what is B11 ? some objects ?
if yes >
{
private _bomb = "Bomb_04_F" createVehicle getPosWorld _x;
sleep 1;
} forEach [B11, B11_1, B11_2, B11_3....];
```also check this https://community.bistudio.com/wiki/forEach
looks like 3d Narnia map ๐
@peak plover super cool stuff, i have a great idea how to use that
Good, that's why I posted it ๐ Maybe someone can get ideas or find it useful
probably in all csi/star wars/future mods
hey guys, do you know of any wonderous one-for-all script to persistently save and load a zeus mission including player state, vehicle state, container state, ai state and building state?
I've found this https://github.com/gruppe-adler/grad-persistence/wiki but it seems to not work with loading 100%
well @mortal yoke might know
hey guys, I'm working on a vanilla mission where a 4-man team inserts by HALO, and when they have landed, they swap their chute for a backpack with their required gear. Right now, I'm using an addAction on the leader, that calls the following script:
// DEFINE _UNIT ARRAY
_unit = [X1,X2,X3,X4];
// REMOVE ALL BACKPACKS, REPLACE WITH KITBAG (MTP)
{removeBackpack _x;} forEach _unit;
sleep 2;
{_x addBackpack "B_Kitbag_mcamo";} forEach _unit;
// FILL KITBAG WITH 10x FAK and 1x MEDKIT
{(unitBackpack _x) addItemCargoGlobal ["firstAidKit", 10];} forEach _unit;
{(unitBackpack _x) addItemCargoGlobal ["mediKit",1];} forEach _unit;
// REMOVE ACTION
removeAllActions X1;
it works, but the problem is that everyone needs to wait until the last guy is on the ground, so I was thinking of swapping it around for a unitsBelowHeight or an isTouchingGround check
but how would I call / run the script only for the player that activates the trigger?
obviously I need to get rid of the forEach, but the only solution I can come up with is to put down 4 separate triggers, link them to each individual player, and have them all call the same script .. I'm hoping there's a cleaner option?
thisList select 0 maybe
@fading yarrow i`m not the maintainer of grad-persistence, you could either create an issue on github or ask @next parrot directly
@meager heart like this?
if (isTouchingGround _unit) then {removeBackpack (thisList select 0)
and so on
no... i mean in your trigger, thisList select 0 < that is player who activated the trigger
ah, okay
in that case, I'd need an extra check to see if the player that activated the trigger is part of the array, right?
player spawn {
waitUntil {
sleep 2;
_this distance <something>
};
_this call tag_fnc_yourFunction;
};
``` "triggerless" option ^ into initPlayerLocal.sqf
_this distance <something> < or some "condition"
what's the tag_fnc_yourFunction exactly? (pretty new at this whole scripting stuff ๐ผ )
I'm guessing that's where I put the file location of the script?
kinda... check this > https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
I will, thanks
can https://community.bistudio.com/wiki/inputAction or https://community.bistudio.com/wiki/inGameUISetEventHandler used to block a given key action in all cases? (key combos ,mouse, joystick)
That EH fires only on action list manipulation so the answer is probably no
What are you trying to block, maybe there are other ways
we used it to block "target/locking" actions, as well as GL "selectAll" to stop abuse in PvP play
You can use inputAction to detect pretty much any combo including mouse, but you can only block key presses. So my suggestion, check if player has unusual bindings to overcome your restrictions and kick them out
what is a non key press - joystick and mouse movement+wheel?
is setObjectMaterialGlobal persistent in MP?
It should be @polar folio
just wondering because according to the wiki it's not a server side command like hideObjectGlobal
Worth retesting, you never know ๐
Does this new export to SQF function preserve dynamic simulation settings for groups?
hi everyone, I just made a fresh installation of a server, I just installed ACE3 and CBA_A3, i want to configure all of theses ace 3 option with the new CBA Settings System, but i dont really know where to start
Connect to the server with any mission
Log in as admin
PRes ESC, go to configure, addon options,
Select SERVER tab,
Save settings when doen
Thank you, seems easy. i read https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System#mission-settings but my english is not so good..
@polar folio being server-sided doesn't say anything about it being JIP persistent
@leaden venture Seems i can do it in 3den editor
someone know why this is not working properly?
private _map = _display ctrlCreate ["RscMapControl", 8200];
_map ctrlSetPosition [0.61125 * safezoneW + safezoneX,0.19 * safezoneH + safezoneY,0.198125 * safezoneW,0.28555556 * safezoneH];
_map ctrlCommit 0;
(_display displayCtrl 8200) ctrlMapAnimAdd [1, 0.1, [_mappos # 0, _mappos # 1, 0]];
ctrlMapAnimCommit (_display displayCtrl 8200);
The position is absolutly wrong
You don't show how you compute _mappos.
@still forum yea obviously. i was just comparing to hideObjectGlobal because of similar naming
mappos are just position players cooridnates
only thing what i found is
Map control created with ctrlCreate have a weird behaviour. Control doesn't respect the aspects of Controls Group or Display itself. Results of ctrlMapAnimAdd applied to this control are also shifted for some reason.
In the wiki
Yeah its apparently some mod I'm running @compact maple
i'm using ctrlMapAnimAddwith object and with coordinates... was no issues
(with RscMapControl created with ctrlCreate also ๐)

and i have just mapAnimAdd also works
maybe you can try ctrlCommitted b4 ctrlMapAnimAdd ๐คท
you mean
ctrlCommitted (_display displayCtrl 8200);
(_display displayCtrl 8200) ctrlMapAnimAdd [1, 0.1, [_mappos # 0, _mappos # 1, 0]];
ctrlMapAnimCommit (_display displayCtrl 8200);
`?
no
waitUntil {ctrlCommitted _ctrlMap};
_ctrlMap ctrlMapAnimAdd [1, 0.1, _position];
ctrlMapAnimCommit _ctrlMap;
@junior stone After some testing: if you imagine your map control actually being part of a fullscreen map, and with the top-left of your control, being the top-left of this "imaginary" fullscreen map, then it seems to fit.
Though you would probably need some tricky calculation between the GUI sizes and the zoom you want to workaround it.
hm
probably such thing
If animating the editor map (via the global variable "map") the desired position must be offset by a correction value, which can be calculated the following way (<V1.63):
// the offset depends on the screen ratio and the current map scale
_ratio = aspectRatio select 0;
_scale = ctrlMapScale map;
_offset = if (_ratio > 1) then {400} else {1224};
// apply the correction value to the desired position
_pos set [0,(_pos select 0)+(_offset*_scale)];
// then move the map to that position
map ctrlMapAnimAdd [1, _scale, _pos];
Thats a part from the bisimulations
this shows me manually aligning the main map. If the smaller was as large as the fullscreen one, you can see how the center would fit my position (where the cursor is). https://imgur.com/a/THWjUEE
hm^^
I guess you have to:
- Compute how much your gui map takes up of the screen.
- Find out how much "gui" it would have to be shifted
- Convert the gui shift to coordinate shift to modify the "real" coordinate of the players into one that works with the dynamic map.
....
Here's a good one!
Shooting an AI (At least on a local host dedi, I think this doesn't work with headless clients) I get:
10:40:58 "[KP LIBERATION] [KILL] _unit is local to SturmFalke"``` Which is weird... It's reporting myself?
The following happens when a player either dies to AI, or dies to self.
```10:41:20 "[KP LIBERATION] [KILL] Kill Manager executed - _unit: O_G_Soldier_GL_F (O Alpha 1-1:1) - _killer: (<NULL-object>)"
10:41:20 "[KP LIBERATION] [KILL] _unit is local to SturmFalke"
No error for first, but error for second.
10:41:13 Error position: <typeOf _unit, _unit, typeOf _killer, _ki>
10:41:13 Error typeof: Type Array, expected Object
https://pastebin.com/dVtuNUrK
https://github.com/acemod/ACEX/blob/c3cb614d1a367f082ceca82adeca55b13a740346/addons/killtracker/XEH_postInit.sqf info on ace_medical_lastDamageSource
I'm probably not using it right... But there's nowhere else to look
I'm not getting any other diag either
So it's all kinds of fun