#arma3_scripting
1 messages · Page 773 of 1
because actions are local
UI is local
so UI is client-side, logic is server-side - that's always a good way to think
I know but, in the code there is
[_target ,[_actionId, "Turn on screen"]] remoteExec ["setUserActionText",0];
shouldn't that be enough?
no, because again, action IDs are local, so it would be expecting action ID on server to be the same as on client (which can technically differ)
you're just taking the risk it could work 😄
hmm
what adds to my confusion is that its a single action, so index should always be 0
you're forgetting about mods
we shall try your method Mister Lou
obviously it will work but I thought I could make it more elegant and such
but functionality over looks they say
Multiple actions with different conditions works out a lot cleaner tbh.
Yep
im playing with cruisemissiles, is there a way to make them ignore damage and collision during "starting"?
if they collide with anything, they explode right after spawning, very annoying.
allowDamage and disableCollision didnt do anything
you can create a simple object and fake the flight
does anybody know how to use this function?
BIS_fnc_moduleCuratorAddPoints
I want to be able to deduct resources upon placing ai but the one set costs module appears broken with modded units
what is the best way to spawn a light source underneath the water?
fixed it
Hello,
I'm trying to create a DLL able to communicate with a distant server using c# ssl stream socket SSLStream. Everything goes fine with SSLStream.Write but every time i try to read data from the stream the game freezes for 3 seconds and crashes giving me this error:
Exit code: 0xE0434F4D - STATUS_CLR_EXCEPTION
I tried to set a read timeout to 1 second on the SSLStream but it doesn't change anything. Anyone has a workaround ?
I've a seemingly contradictory question:
I am trying to play a sound file (using playSound) at the start of my mission. In order to remove noises, I use fadeSound. However, fadeSound also affects my playSound. Is there a way around this?
This channel is for Arma 3 scripting (SQF) questions. Problems in dlls don't count (unless related to SQF ofc).
Also your problem doesn't seem to be related to Arma at all. I'd say it's related to your extension. You might want to try it in a normal exe first before testing it in the game
Ok, Thanks anyway I got it working,
Use the alternative syntax of playSound with the flag to use the speech channel instead of sound channel. Or use playMusic, or wait until 2.10 and use playSoundUI
https://community.bistudio.com/wiki/setLightDayLight
this doesn't work when spawned on a client?
light works in night time but not in day time
Hello, I need some help with Regex, this is my string : ""2",":","28"".
Im trying to to make it look like 2:28
The furthest I've gotten is making it look like this ""3":"22"", essentially just removing the commas and one set of quotations.
I used this regex to get that: ","""
Any help is greatly appreciated!
splitstring by " and ,
then joinString by ""
removes all quotes and commas, without regex
Thanks Dedmen, it looks like I cant use splitString with just one " because it wants a second and tries to turn all the code after it into a string. When using two "" it gives the same output that I got previously
Trying to use ' on either end gives me Error Invalid Expression on the next commented line after it
This is the code chunk
_tst = str _timeArray;
_tst = _tst splitString '",';
_tst = _tst joinString """";
this is my string : ""2",":","28"".
that's not a valid string
what is the exact string?
Im turning an array into a string, so it shows up in game with a systemchat as ["2",":","28"]
Jeez scripting continues to make me feel stupid on the stuff that should be easy. Thankyou so much both of you :) That works great Leopard
waitUntil {!(isNull (findDisplay 46))};
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
_handled = false;
switch (_key) do {
case (actionKeys "MoveForward") :{
systemChat "Standing!";
[player] spawn vFNC_standFromChair;
}; // Key assigned to the Forward Movement (W)
};
_handled
}]; ```
☝️ Is there a way to remove this displayAddEventHandler after the player is no longer sitting and just add it back again when the players sits?
I mean, I know how to add it but not how to remove it... something like BIS_fnc_holdActionRemove but for displayAddEventHandler
DisplayRemoveEventHandler
switch (_key) do {
case (actionKeys "MoveForward") :{
useaddUserActionEventHandlerinstead
private _standEhId = addUserActionEventHandler ["MoveForward", "Activate", {
systemChat "Standing!";
[player] spawn vFNC_standFromChair;
removeUserActionEventHandler ["MoveForward", "Activate", _standEhId];
}]; ```
no
_standEhId is not defined in the EH code
just use the magic var _thisEventHandler
Perfect! And that works for DisplayRemoveEventHandler too?
Thank you very much! Testing now
addUserActionEventHandler is very new, very few scripts and mods using it
yes. but it's better
unless you need to override a key
It is indeed better! Gonna be replacing most if not all my Keydown Eh for that one 😉
Working like a charm! https://drive.google.com/drive/folders/1v9CNen6QnWhgE1NYdqrrIi4tRdWaHK_v?usp=sharing
I can now make units sit on a chair even if the chair is high on a building... the only weird thing is that getDir gets a wrong dir for chairs that are not at ground level...
what is that link supposed to be?
it needs permission to access
making things simple is very complicated. So no worries ;-)
If you try it, sit on the chairs on top of the building and then the chairs downstairs
all that code for sitting on a chair? 
getDir should work the same on all heights
but you use several inconsistent commands
and you also use setPos.... 
the only weird thing is that getDir gets a wrong dir for chairs that are not at ground level...
it has nothing to do with getDir. it's related to your own code:
if (_pos select 2 > 1) then {
_agentCamera attachTo [_chair,[0,0,-1]];
[player] spawn vFNC_CheckForFORWARDkeyPress;
};
I know but that is only the invisible agent I use as a camera. The unit visibly sitting on the chairs is the real unit the player normally handles. (And that visible unit is the one that gets the wrong dir if the chairs are not touching the ground. As soon as you try to seat on a chair at ground level the unit is aligned properly to the chairs
When the chair is up in the air I must use the attachTo command but since that removes the "stand up" holdaction I had to do it with the addUserActionEventHandler
Gonna optimise and test the script some more 😉
Hahaha, yes, sitting on any chair and not loosing "FREELOOK" and also not being able to spin your character in weird ways. That is why I spawn an invisible agent behind and set the camera to that unit instead of the regular unit sitting on the chair
you can do that with a simple per frame loop and setVelocityTransformation
which roughly has the same performance cost as attachTo
Yeah but wouldn't a per frame loop be more performance intensive than an invisible agent?
but you also get to keep the free look
no
well unless it's MP
not sure about MP
AttachTo is only used on chairs higher than ground level
To be honest I made this script because no other script out there offers these functionalities. Most lock you in place, do not allow you to move your camera like doing a Freelook or use the attachTo command on all chairs regardless it is needed or not and also most do not work on ALL arma 3 chairs, this one does.
And now it is working perfectly except for that setDir issue
i just let them spin 😂
well said
also to add, making things is relatively easy. making things work as intended under all circumstances, is very complicated
for instance, what happens if someone puts a quad bike beside the chair, and the seated person uses the “get in” action?
or if a second person tries to get into the same chair. or if the seated person gets incapacitated and then revived
or if a physx collision/explosion pushes the not-attached-to person away from the chair
or pushes the chair away
or player disconnects while seated
etc etc etc 😂
How to change the vectorUp of an object via angle?
Tried:
findDisplay 46 displayAddEventHandler ["KeyDown", {
params ["", "_key"];
private _vectorUp = vectorUpVisual object;
switch (_key) do {
case 17: {
angleUp = (angleUp + 1) min 360;
_vectorUp = [_vectorUp, angleUp, 2] call BIS_fnc_rotateVector3D;
systemChat "vectoring";
};
};
object setVectorUp _vectorUp;
}];
angleUp = 0;
But it didn't work
you're rotating a vector which is probably already pointing towards Z around Z
which obviously is impossible and won't work (it returns the same vector)
also you're incrementing the rotation angle each time, which is wrong
plus, your code is extremely inefficient. it changes the vectorUp of the object when ANY key is pressed.
// set exact yaw, pitch, and roll
_y = 45; _p = -80; _r = 0;
BRICK setVectorDirAndUp [
[sin _y * cos _p, cos _y * cos _p, sin _p],
[[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D
];
this is uhhh in a friends of mines script document (read the comments)
setFriend
resistance setFriend [east, 1];
east setFriend [resistance, 1]; // they're fwiends UwU
resistance setFriend [east, 0];
east setFriend [resistance, 0]; // they're not fwiends anymore /w\```
help
This appears to be largely valid. What's the problem?
He's probably just worried that his friend is a furry :P
read the comments
That seems to be an accurate description of what the code does.
Unfortunately, being scared of the word "fwiends" is a you problem, not a scripting problem, so I can't help with that.
my god dude, ✨ its a joke ✨
Yes, I got that, I just didn't think it was funny
ok mr humor police, anyways im off
Do you guys think that turning each destroyed vehicle into simple objects at the time they are destroyed will help to ease the performance impact they cause on the server? Because right now each destroyed vehicle on my scene takes from 5-10 FPS toll on my overall FPS... so if I have 60 FPS and then 3 or more vehicles are destroyed and burning nearby I hover between 30-35 FPS and that is too noticeable... Don't know if it is the particle effects or what
yes, do it, also dont turn off sim and turn on simple objects, do either or or the game will turn off simple objects if you have sim off (if you get me)
HERESY
flamethrower ready.
.
it's a significant difference
I had to make a ticket about this, because no matter what it is impossible to sinc the unit direction to the chair direction under all circumstances when using the AttachTo command, unlike when not using it when such thing (proper chair/unit alignment) is very easy to achieve no matter the direction the chair is facing. https://feedback.bistudio.com/T165747
I believe the engine still processes a crispy car as a car
In my experience, disabled (destroyed) vehicles tank my FPS far more than functioning ones, even with Ai units inside
again, not my graph, but in my own experiences generally true
and also, its the smoke
You may be right about it being the particles maybe your pc doesn't like them
not the models
yep
I am thinking about doing a "KilledEH" for vehicles that turns them into simple objects as soon as destroyed, and also add a custom smoke and fire effect not so demanding...
Don't know why we have to "hack" our way into stable FPSs but heck, at least there is a way...
honestly dont bother, its the particles that kills it (if its destroyed), and theres nothing you can do about that except deleting them entirely
Definitely doable but you'll have to deal with the occupants
part of converting to a simple object is deleting the original
rephrased, slightly
The occupants of the destroyed vehicle? I will just trow all the bodies out
yeah that'll do
honestly a good thing you can do is: just delete the stuff the players have already seen and done, so it keeps lag down
and have garbage collection so bodies gets auto deleted, and maybe if you have any, tune down the decor
but at this point this isnt about scripting its more #arma3_scenario territory but you get me
scripting isnt gonna help much when its only gonna fix 1 out of the 10 things thats lagging your ops (which is everything, its doing a little but it adds up)
Yeah but I want to keep the burning wreck for a while for immersion. This is just a work around for the immediate massive loss of FPS when in presence of a destroyed vehicle
getDir is relative to the parent object
It'll be the particles that cost, so not much point unless you're removing those.
wouldn't deleting the original vehicle remove the particle source anyway?
That would be the chairs right?
i had that same thought but think this what would players want more, between having their immersion preserved or running the game at a stable fps, sometimes sacrifices has to be made, and when that aspect is lost you can make up for that lost immersion in say…atmosphere
Yes, but the suggestion was to put the particles back on a simple object.
i think yes
yeah but it can still make a difference if he only puts back, say, one resource-light particle effect instead of the multiple originally present
Maybe if the original burning effect was particularly bad and you could arrange a cheaper one, but I can't say I noticed...
yes
Yes, but lesser particles... like half of the regular smoke grenade... can be done easily and consumes less FPS
again, we’re basically building a script that will only solve 1 of the problems out of the possible 10-20, i dont think this is an efficient way to use your time, when really its about how you make your mission, and sacrificing certain aspects for mission stability
but thats about it from one zeus to another, if you guys wanna continue knock yourself out
Well, in my testings I found out that is not the case. Because if I attach a unit to a chair that is facing north the direction of the character (unit) in relation to north is XX while if I attach the unit on the same chair (but this time the chair pointing south) the direction of the unit in relation to that chair is YY which is not the same correlation to the behaviour seen on the chair pointing north... ergo the ticket
yes and it doesnt turn the same way as the thing you’re attaching it to
that's not even applicable here
I have no idea what you just said
as I said the dir of attached objects should be relative
welp, i tried 
e.g. if you do _unit setDir (getDir _chair + 180) that's wrong
it should be _unit setDir 180
If it is relative then this would happen: Chair Direction = 360, attached unit direction = 30. So on the second chair facing 30 the attached unit should be facing 60. But it doesn't! That is why I said that there is no correlation.
I also tried that... same outcome
If you check the ticked, I don't even need to use the _unit setDir... just by attaching the unit to the same chair facing different directions will already exhibit the wrong behaviour... because in the chair facing XX the unit is attached sitting straight and on the chair facing YY the unit is attached sitting sideways... where if the direction was trully relative to the chair the unit would always be attached straight no matter the direction of the chair
because in the chair facing XX the unit is attached sitting straight and on the chair facing YY the unit is attached sitting sideways...
that's not possible at all
you're doing something wrong
Just tested blowing up vehicles in the editor, no mods. I had to go above eight visible burning vehicles to drop fps below 60 on my trash hardware, and after that it's maybe cutting it by 1-2fps each.
So you may have a mod or display setting problem there.
_unit = player;
_chair = createVehicle ["Land_ChairPlastic_F", screenToWorld [0.5, 0.5]];
_unit attachTo [_chair,[0,0,-0.5]];
call {
if (typeOf _chair in ["Land_ChairWood_F","Land_CampingChair_V2_F","Land_CampingChair_V2_white_F"]) exitWith {_unit setdir 180;};
if (typeOf _chair in ["Land_ChairPlastic_F"]) exitWith {_unit setDir 90};
};
there. fixed
well your own code is wrong in the first place. the dirs are wrong
👏 Ohhhh, that means that when you setDir 10 for example you are already taking the chair direction into account?
as much as i love blastcore, its probably blastcore or real engine, or splendid smoke, literally any visual fx mod really
You are probably right...
that's what relative means. the dir of the chair is not important
if its that fps intensive mission, and theres nothing in the mission you can afford to change && you can change the mods in the modset, consider removing those + dependencies, or atleast try it
but if you’re like my unit, and you cant remove those cause they’re core mods, you just gotta start deleting stuff behind players
In my latest try I was doing this:
if (typeOf _chair in ["Land_ChairPlastic_F"]) exitWith {_faceDir = (getdir _unit) +10; _unit setdir _faceDir;};
But it wasn't working of course
OH and @wind hedge make sure you’re testing in mp, in singleplayer fps is usually 2/3s and consider screwing with view distance and ace view distance to get better frames
something something, the sp forces certain higher quality graphics settings to be always on vs in mp. for example: grass
I didn't know about the SP/MP difference, I used to always work on hosted MP editor but lately have been using the SP editor...
Going back to MP
Thanks!
but still remember this!
Yes of course, never going to forget 😉
As always you are a godsend, completely fixed now! I was never going to figure it out on my own! THANKS!
if !(_shapeParams isEqualTypeArray [5] && (_shapeParams#0 > 0)) then {
["invalid circle parameters"] call BIS_fnc_error;
_legal = false;
}
this code thorows a "unexpected type error on the second condition when _shapeParams = ["hello"].
why?
lazy eval should abort the checking if the first condition fails. does arma not have lazy eval ?
19:04:53 Error in expression <isEqualTypeArray [5] && (_shapeParams#0 > 0)) then {
["invalid circle parame>
19:04:53 Error position: <> 0)) then {
["invalid circle parame>
19:04:53 Error >: Type String, expected Number,Not a Number
Lazy eval is done with {}, e.g. if ((condition1) && {condition2})
It didn't exist at all until halfway through A2OA
If you knew how SQF syntax worked you'd know that it cannot be by default with ()
i didnt know at all that lazy eval was optional. i thought every language uses it by default
SQF needs to evaluate arguments before being able to execute a command.
It has to evaluate your conditions and the && before it can possibly call the if command
This has been asked many times by other people so sorry for not focusing,
Best way to find a gun's muzzle position?
Player's gun muzzle position
@drifting portal Did you try currentMuzzle?
oops bad wording on my part
let me edit the question
yes sir?
@drifting portal
I pinged the wrong message 
damn sir that's a lot but thanks
muzzlePos is the mem point of the muzzle in weapon coords
it has nothing to do with player
isn't there a way to get the weapon object of the player?
no
damn
if you use cursorobject on a unit's weapon it returns the object
but yeah alas
it's a proxy
it's completely useless
you can't even get its position (getPosXXX _wpn returns [0,0,0])
that's mad where is my feedback tracker
it's not a bug
no I meant as in a feature implementation
it's been asked many times before and the devs said it's not gonna happen
I'm not creating it every frame
misread the if statement my bad
and the onEachFrame is (was) just for drawing (I removed the draw part)
using drawLine3D between _p1 and _p2
I put it back again
oh ok
The or statement in this is busted and I cant for the life of me figure out why, I know its the or statement because deleting everything after the or statement makes it work. I use or statements elsewhere with no problem... Anyone have any suggestions?
if (_playerRole select 0 == "driver" || (_playerRole select 0 == "turret" && ((_playerRole select 1) select 0 == 0))) then
^if the or statement is true then this calls just fine
what is the part after || supposed to mean?
turret with turret path [0]?
ya, it gets the co-pilot seat
Heli's seem to class that role as a turret role, but its only difference to other turret roles is that its turretpath is 0, so I was getting it like that
if your _playerRole array has only 1 element or the second element is not an array or it's an empty array it can fail
the question is how do you generate it
Oh interesting... I get it with assignedVehicleRole, which if its anything but the turret, only outputs an array with one value
So it can't find the second part of the array and gets upset and just... fails?
well you can simply do this then:
if (_playerRole in [["driver"], ["turret", [0]]]) then
or if you want to keep yours, use lazy eval
if (_playerRole select 0 == "driver" || {_playerRole select 0 == "turret" && {(_playerRole select 1) select 0 == 0}}) then
also turret path [0] doesn't necessarily mean copilot
The first one is much cleaner, I wasnt aware of the "in" option, will definitely be using that more often
I couldn't test everything, but the helis I did test gave that result. If there's a more consistent way to get the co-pilot seat then id use it, but I cant find one
the consistent way is thru the turret config
This script doesn't run anything important enough for it to be that consistent, I will note that for future things though
it's not that complicated. all you need is:
_cfg = configOf _veh >> "Turrets";
{_cfg = _cfg select _x} forEach _turretPath;
getNumber(_cfg >> "isCopilot") == 1
Does that last line give me the turretpath of the co-pilot?
no
it checks if the turret path you provided is copilot
if you want to get the copilot path(s) you can do:
_copilotPaths = allTurrets _veh select {
_cfg = configOf _veh >> "Turrets";
{_cfg = _cfg select _x} forEach _x;
getNumber(_cfg >> "isCopilot") == 1
}
Second one works brilliantly! Thanks for the help Leopard, you continue to come through the fast and reliable solutions
you can combine it with the last code I posted to get reliable results:
private _copilotPaths = allTurrets _veh select {
private _cfg = configOf _veh >> "Turrets";
{_cfg = _cfg select _x} forEach _x;
getNumber(_cfg >> "isCopilot") == 1
};
if (_playerRole select 0 == "driver" || {_playerRole select 0 == "turret" && {(_playerRole select 1) in _copilotPaths}}) then
you need to define _veh ofc
And that if statement you did there would run through every option in _copilotPaths? If for some reason there were more than 1 copilot?
yeah
Im not understanding this section
(_playerRole select 1) in _copilotPaths
Just like in a technical sense
Its selecting the turretpath part of the array from my _playerRole, but then how does using "in" in this sense make it check for every value in _copilotPaths?
read the wiki page for in
Syntax 4? the haystack stuff?
_playerRole select 1 is a turret path
_copilotPaths is an array of turret paths
in searches the _copilotPaths array to see if _playerRole select 1 is in it
no. 1st one
Ohhhh
Since _playerRole select 1 is a parent array with the actual values being stored in nested arrays
no, copilotPaths is the "parent array"
see example 1 on wiki:
1 in [0, 1, 2]; // true
yes, but I was lost at how _playerRole select 1 was getting each possible turretpath available in the heli, I was missing that it wasnt actually selecting the individual turretPath, but all of them
yeah in can search recursively. as I showed you here
ok, im trying to combine it with this cleaner method. Give me a moment to try
since you have an array of paths now the second one is already clean
Im silly, that line gives a boolean, so ofcourse it wouldnt work with this
it can but it'll be messy and slower...
private _validRoles = allTurrets _veh select {
private _cfg = configOf _veh >> "Turrets";
{_cfg = _cfg select _x} forEach _x;
getNumber(_cfg >> "isCopilot") == 1
} apply {["turret", _x]};
_validRoles pushBack ["driver"];
if (_playerRole in _validRoles) then
haha, ill pass
Is toLower implemented to Cyrillic?
class sand {
amount = 2;
zones[] = { "sand_mine","sand_mine_2" };
item = "pickaxe";
mined[] = { "sand" };
zoneSize = 30;
};
How could I loop through items in "zones[]" and see if the player is near any of them?
- Where is
sandin the config tree? - What are the entries in zones[]?
I have a better idea I think
either setting a variable on the player when they enter a trigger zone, or adding the action then instead of on start
I had it adding the action just fine but it was finicky about removing it once the player left
I am trying to make a Ace Pylons whitelist with this https://ace3.acemod.org/wiki/framework/pylons-framework.html and I can't figure it out I want to be able to use classnames. Any help is appreciated completely new to arma scripting.
so for example this vehicle cwr3_b_a10
How are you spawning the vehicle?
You'd need to edit the code where KP Liberation spawns the vehicle then.
If it's multiplayer you'll need to broadcast the whitelists, like this:
_vehicle setVariable ["ace_pylons_magazineWhitelist", _arrayOfMags, true];
I was assuming I could use the kp_objectinits.sqf
This isn't necessary in an editor init statement because those run globally.
yeah, looks possible.
My main problem so far is getting the vehicle as a variable
I tried something like this
["cwr3_b_a10",{ params ["_veh"]; _veh setVariable ["ace_pylons_magazineWhitelist", ["PylonRack_3Rnd_Missile_AGM_02_F"]]; }, true];
You can do it directly, I think:
[["cwr3_b_a10"], {_this setVariable ["ace_pylons_magazineWhitelist", _arrayOfMags, true]}],
But the params method should also work.
You have the true in the wrong array there.
Make sure you have the correct case on the classname too. Might matter.
copied it from the editor with right click
Any way for me to see what its putting _this as like hint it out?
From the other examples it's clearly the object created.
Cause its still not working and not sure why
Have you successfully changed anything else in the mission?
would this work in a init.sqf on a test vr world
and I haven't changed anything script wise no
Usually people trip up on trying to edit steam missions in-place
and then steam just repairs them
I copied the mission file from our server to my pc
Run KPLIB_objectInits in the debug console to check that your edits are actually being applied.
otherwise hint typename _this;
To check that it's actually installing the whitelist you can also look at the vehicle and run cursorObject getVariable "ace_pylons_magazineWhitelist"
No idea still doesnt want to work
_arrayofMags = ["PylonRack_3Rnd_Missile_AGM_02_F","PylonRack_1Rnd_Missile_AGM_02_F"]; ["cwr3_b_a10", { params ["_veh"]; _veh setVariable ["ace_pylons_magazineWhitelist", _arrayofMags, true]; } ];
_arrayOfMags likely needs to go in that code.
At least, I don't know what KPLib is actually doing with the code.
Did you run either of those debug console checks?
How do I actually do that just put kp_objectinits into console?
KPLIB_objectInits, yes
atm Im testing on a vr test world using a init.sqf just to see if I can get it to work
Just to be sure:
it's not just that, right? because that array alone won't do anything
Atm this is all I have in init.sqf
["cwr3_b_a10",
{
params ["_veh"];
_arrayofMags = ["PylonRack_3Rnd_Missile_AGM_02_F"];
_veh setVariable ["ace_pylons_magazineWhitelist", _arrayofMags, true];
}
];
Yeah, that's a misunderstanding. kp_objectInits.sqf doesn't do anything itself. It's just data that the rest of KPLib is using somewhere.
should this work in a init.sqf?
No.
And because there's no general object init event, you can't make a general version without polling.
Potentially, yes.
That's what CBA does, it polls the object list every frame looking for new objects.
But yeah I thought that kp_objectinit might work cause it can change camo of vehicles when you first build them according to the kp lib discord
It might well work, but you haven't even done anything to check that your edits are actually sticking yet.
I did try that cursorobject and it returned nothing
what about the KPLIB_objectInits?
Testing now
Also When ever I press the play button when I load in I see this at first https://imgur.com/a/kiEycmZ
nothing happens when I put kp_objectInits
in debug
Right, so the edits are sticking but you broke the syntax :P
I think all your examples had a semicolon on the end of the array you added, which is incorrect.
Should be either a comma if it's the last element of the parent array, or nothing if it's the last element.
so this isnt correct? _arrayofMags = ["PylonRack_3Rnd_Missile_AGM_02_F","PylonRack_1Rnd_Missile_AGM_02_F"];
Anyone know why I can't use this function at all?
I can copy paste the example and get no notification in my mission. If I make a different mission file it works fine.
Idk how a built in function is possible corrupted on my server
Post the code you are using for the server
["TaskSucceeded", ["", "Disable the nuke"]] call BIS_fnc_showNotification;
works in editor, works in a different mission on my server
does not work in my main mission.
Hi guys, I have a question how to make a bot shoot while playing an animation, here is an example of the animation "Acts_CrouchingFiringLeftRifle03" how to implement it, someone can make a script as an example and show me.
You need a proper config for it, so not a vanilla thing/can be done only with a script. Also due to the #rules you can't post the same post all around the place
I apologize for this, but I really want to solve this issue with these animations, I can't
If there is an opportunity to throw off the script to test to understand what's what.
Not sure if it works
Try this too
https://community.bistudio.com/wiki/BIS_fnc_fire
Again that's because the config prevents it, you can't do anything only with scripts but with #arma3_config
Yeah, I just have a really vauge memory of me making units shoot their weapons while its on their back using one of these
I'm probably wrong
[] spawn {
s1 switchmove "AadjPknlMstpSrasWrflDright_Hgun_enablefiring";
sleep 5;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 8;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 5;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 8;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 5;
s1 forceWeaponFire ["rhs_weap_m4a1_grip3", "fullauto"];
sleep 8;
};
I did this in the sqs script, but the bot does not come out, does not play the animation and shoots single
Okay but he said that switchmove didn't work? Why is that
Did the fire action just override the animation or something?
Yes..... the campaign I'm not destined to comprehend it all, it's a pity, of course.
Because the animation doesn't exist?
If anyone has seen the youtuber's nicknames Flawless Warhammer in his videos, animations are played with shooting, I want to do about the same in the introductory video for the mission.
Make a Mod
that's why I'm asking for a ready-made script, I just don't really understand these scripts, I'm just learning.
Once, Again, you need a Mod for it, script isn't a concern
you mean the RHS mod I use it bots and weapons from there
Whaaat
I am saying that, you need a Mod that tweaks the animations' config, not anything else, not even RHS
that is, it is necessary to talk about this topic with the developers of this mod, do I understand correctly or not?
I don't know what this means, but most unlikely you understand it correctly
understand that it's hard for a beginner for me, no offense
It's not beginner or veteran thing, it's just impossible in vanilla environment, you need a Mod that edit the animations' config so the animations can fire something
Okay, I understand you, thank you for listening, I will look for such a person.
sqs? Are you even trying the script in Arma 3?
Assumed it was just a typo of sqf
There was another guy a few days ago who also wrote sqs and he actually meant sqs (he was testing a script on OFP
)
yes. because in sqf all expressions are evaluated
unless they're codes, which only execute with a "caller" command e.g. call, then, do, etc.
if you don't want condition to be evaluated use lazy eval
if (true || {condition}) then
condition will never be evaluated
so you should to apply lazy eval even for OR conditions (if the nth conditions are more complex) ?
yes
if (c1 || {c2 || {c3}})
this is also possible:
if (c1 || {c2} || {c3})
the 1st one is faster
you sure? I'm pretty sure the 1st one is always faster (or same)
yes
The code brackets themselves have a cost, so with simple conditions it's usually faster without the lazy eval.
@little raptor thanks a lot 👍
any suggestions on how to use https://community.bistudio.com/wiki/BIS_fnc_moduleSector
like, is there an explanation on how to use this somewhere lol
i'm trying to do it in script instead of having to place them
oh right this wont work for me anyway rip
_map ctrlAddEventHandler ["draw"
how to not draw temporarily best
to remove the draw event altogether [annoying would be to re-add without events] or just to resize the map control/move off screen?
using a variable
if (_map getVariable ["Don't Draw", false]) exitWith {};
I don't get it. What are you trying not to draw?
is it possible to set setVectorDirAndUp on attached objects?
yes
But how? I attached first object to second, and tried to set the pitchBank to the attached object.
b1 attachTo [b2, [0, 0, 0.5]];
[b1, 45, 0] call BIS_fnc_setPitchBank;
As a result, the attached object absolutely does not react to this
idk how that function works. but it is absolutely possible to use setVectorDirAndUp
it looks like you're trying to pitch the object at 45 degrees
you can just use this then:
b1 attachTo [b2, [0, 0, 0.5]];
_dir = [0, cos 45, sin 45];
_up = [0,-sin 45, cos 45];
b1 setVectorDirAndUp [_dir, _up];
'll try, thanks!
Hi - I'm work on porting a Helicopter Landing Practice Mission to the different CDLC Terrains (and more), i talked with the author and he is cool with it, but busy.
The Mission uses a "Virtual Vehicle Spawner" script from 2015 to register and spawn the desired helicopter via an ingame menu.
Sadly it doesnt detect the GlobalMobilisation Vehicles, because GM uses a different VehicleClass or sth?
Here is the link to the file where i think i need to add the right config name but im just not familiar with that kind of stuff.
https://github.com/1337zorn/A3_HeliLandingPractice/blob/main/%23copy this inside the mission folder/VVS/functions/fn_buildCfg.sqf
i know the basics of sqf but never had a chance to dive into configs and classes n stuff, so im not very familiar with that, so any help here would be appreciated.
Alternatively, if people can point me towards an alternative script/module/solution to spawn a vehicle/helicopter by choice via a menu or sth, that would be great as well.
If i understand right, the GM Vehicles are already children of Air and Helicopter , but it still doesnt show up.
["gm_ge_army_bo105p1m_vbh_swooper_base","gm_bo105p1m_vbh_swooper_base","gm_bo105p1m_vbh_base","gm_bo105p1m_base","gm_bo105p_base","gm_bo105_base","gm_helicopter_base","Helicopter_Base_H","Helicopter_Base_F","Helicopter","Air","AllVehicles","All"]
yeah that's a terribly naive and slow script. I don't think anyone here is willing to help you fix it 😅
Its what came with the box ^^ and it does the job thats needed for that scenario ^^
ahm in this case yes
it does the job thats needed for that scenario ^^
really? then you're good to go then
well
Well it spawns everything as much as i could see, it works with vanilla, RHS, CUP, CSLA, SOG:PF, WS c.dlc's but only Glob Mob helicopters wont be shown in the list.
sorry was gone for a while
this is the group indicator
but you dont want that visible during cutscenes, subtitles, black out etc
option 1) create and destroy all the time
option 2) just "hide" when not desired
I personally prefer not to remove/destroy something temporarily
plus how are you gonna check if cutscenes, etc. are visible?
you still need a loop that runs every frame
exitWith
{
missionNamespace setVariable ["LIB_GroupIndicatorPosition",ctrlMapPosition _map];
_map ctrlMapSetPosition [0,0,0,0];
};
if ((missionNamespace getVariable ["LIB_GroupIndicatorPosition",[]] isNotEqualTo []) then
{
_map ctrlMapSetPosition (missionNamespace getVariable "LIB_GroupIndicatorPosition");
};```
this is what i want to try now
if
(
(missionNamespace getVariable ["LIB_CDA_isCutscene",false])
||
((count _allActiveTitleEffects) > 0)
||
(visibleMap)
||
(cameraOn != (vehicle player))
||
(!(isNull (findDisplay 602)))
||
(!isNil "LIB_fnc_showSubtitle_Subtitle" && {!isNull LIB_fnc_showSubtitle_Subtitle})
||
("arsenal" in (toLower missionName))
)```
KK also provided a sqf command to check for that
_map ctrlAddEventHandler ["draw","with uiNamespace do {['Draw',_this] call LIB_MissionUtilityFunctions_fnc_GroupIndicator;};"];
yep
you might as well not remove anything and do the check in the draw EH
thats why i want to try to reposition or hide the control by other means
above is inside the EH
well if your ctrls are in a controls group you can just setFade it and the entire "group indicator" will hide
RscMapControl seems special. havent tested yet what works and doesnt with it
afaik setFade works with everything
RscMapControl
I don't recommend drawing a whole map just for some group icons...
its BI's system 😛
i guess its a prototype they wanted to merge into engine later, but then scrapped it
how do mods do it instead?
idk how mods do it, but I'd personally just draw some ctrls on the screen instead 
that circle can be drawn in Photoshop or something similar
and the unit icons can just be RscPictures
is there something homologous to saveProfileNamespace but for server variables?
basically a file save operation on a dedicated server so I can store variables after restart?
seems how DUI Radar does it
need to do more legwork yourself that way tho
how does this work exactly ?
for example profile variables are stored in a file in the profile folder
which file has these variables stored in it?
the variables are saved into missionName.vars
https://community.bistudio.com/wiki/saveMissionProfileNamespace
Oops
it says its stored on the client's pc?
burden me but kinda confused
can't you just set profileNamespace variables on only the dedicated server?
How
Do you have an example?
I basically don't want them stored on client PC
profileNamespace setVariable ["myVariable",_myValue];
just run this on the server, by default it won't be broadcasted
the dedicated server will create a file just like the clients do
Hmmm, which directory?
Like where will it be saved
Oh damn
Well what does missionprofilenamespace do then
I think it just makes a separate file to store variables for a specific mission or group of missions
RemoteExec with paramter 2?
Remoteexec ["servariable", 2]?
you dont need to remoteExec setVariable
profileNamespace setVariable ["myVariable",_myValue,2];
Damn, exquisite
Thanks
yw
that's wrong
https://community.bistudio.com/wiki/setVariable
Number - the variable is only set on the client with the given Machine network ID. If the number is negative, the variable is set on every client except for the one with the given ID.
am I misunderstanding this?
I haven't found any notes on the profileNamespace or setVariable page on that though
Greetings. i am trying to make some new tasks via scripts via BIS_fnc_taskCreate however it keeps throwing my newly made task into the debug corner. my code is[west, "Check the location", ["Move to the given location and if there are indeed soldiers. Steal the weapon cache","Check the location", getMarkerPos "mission_02"], [0,0,0]] call BIS_fnc_taskCreate; So basically i have a preplaced marker that i have called mission_02 but it doesnt seem to recognize it. Am i overlooking as to how it works? I have also tried it without the getMarkerPos since that's how the example is showing it. From what i understand from the wiki. it is asking for an xyz position which getMarkerPos gets from the location as far as i know.
edit: typo error
https://community.bistudio.com/wiki/BIS_fnc_taskCreate is the wiki i am using
I have been deceived then?
is there a way to put HUD elements behind other HUD elements?
do I just have to create them first?
create them first
some will still be displayed above anything else like RscPicture
Is it possible to pass a local variable into a function?
Example:
_test = 5;
call Function;
Function =
{
_thing = _test +2;
};
Hmm, ive used params before, didnt know it was possible to be used when calling an entirely different function though... Ill give it a try I guess, despite the examples not being super suggestive
Function =
{
params ["_test"];
_thing = _test +2;
};
_test = 5;
[_test] call Function;
thanks
You may also notice this function does nothing effective lol
It doesn't have a return value
ik lol, it was purely as an example
what you wrote is already correct
I supposed it would work for the example I posted, but it wouldn't for this example would it?
Example:
_test = 0;
call Function1;
Function1 =
{
_test = 7;
call Function2;
};
Function2 =
{
"_test would equal 0 here because its definition in Function1 would be local to that Function Right?"
};
no
it will be 7
oh really eh
I believe my understanding of it has been very flawed up until this point then....
call simply executes the code you provide, in the current script. just like how you do:
_var = 0;
if (bla) then {
if (blabla) then {
if (blablabla) then {
_var = 1;
}
}
}
in that case then is executing the code (subject to the if condition ofc). and all codes still see _var. no matter how deep you nest them
Hmm, switching my global variables broke the script... hold on while I find out exactly where
your code either branches off (due to if for example) or it's executing elsewhere (e.g. due to spawn or EH code or ...)
I do have EH in the code, whats the rules like for setting variables inside of it? Do they gotta be global for that?
depends on the type of EH
GetInMan
but in any case they can't be from the script that adds the EH
for that you have to pass them in thru the object the EH was added to
That EH adds to the player
player is just an object
it can change at any minute
If only globals weren't bad smh
by bad I mean they're not suitable for that case
since an EH can be added to thousands of objs
each with the same code
how are you gonna be able to use global vars without having a new global var for each object?
which is messy ofc
gotcha
ya I learned passing them into functions and stuff a little bit ago because of that reason
Is passing them to the object different or pretty much the same as passing it into a function?
instead you just store the var in the obj:
_obj setVariable ["myVar", _bla];
_obj addEventHandler ["GetInMan", {
params ["_obj"];
_bla = _obj getVariable ["myVar", -1];
}
what I posted above ^
interesting
GetInMan has params of its own that im using, so does "_obj" for example go to the end of the line automatically?
wat? _obj is just the first of GetInMan params
err, that's the first param of GetInMan. Called "_unit" in the wiki but you can call it what you like.
I just skipped the rest
You don't have to define all the params.
Oh I see what you did there, it worked out that I was assigning the variable to the player, and it already gets the player as part of the GetInMan thing. I get it I get it
Can I assign multiple variables in the same setVariable?
Like just nest it? [[],[],]
Well, you can set a variable to an array.
Or you can set multiple variables with different names.
player setVariable [["var1", var1],["var2",var2]];
Is this ok? Could I still get the variable like Leopard did?
No.
You can do either:
player setVariable ["var1", _var1];
player setVariable ["var2", _var2];
or:
player setVariable ["vars", [_var1, _var2]];
To get say var2 in the second example, could I do this?
getVariable ["vars" select 1, -1];
Or is it impossible to select the individuals
No, player getVariable ["vars", [-1, -1]] select 1
SQF isn't a fancy language. You gotta break things up into steps.
Ah ok, thankyou! I think ill stick to the first example you gave in this case, one more line of code for the sake of comprehension is better I think. Its super handy to know the second example though
Thanks for the help again tonight Leopard and John :)
I don't recommend using player directly
it's bad practice
the player may have changed
Is it bad to use the player in general, or just for getVariable out of a player?
Ok so I have 2 roadblocks implementing all this stuff, the first being that the local variable defined as 0 at the start is then being increased in a function, however when I try and systemchat it, it comes out as ScalarNAN or any. The value doesnt save... (Ill mention the second issue after)
Here is an example showing the structure:
_myVar = 0;
Function =
{
"_myVar returns any here"
};
onEachFrame {
call Function
};
It depends on the use case.
In this case you're adding an EH to an object that happens to be a player
But the EH doesn't execute here, so the player may not be the same when the EH code executes
Again same problem with EHs
You don't pay any attention to where a code executes
First of all remember that a code never captures variables
It's the caller that defines variables for the code
In your code, the EH is executing "somewhere else"
What does it see?
A global variable called Function
And in function you're referencing a var called _myVar
But it was never defined
If your EH code was like this it would work:
_myVar = 0;
call Function
Now the caller (call command in this case) defines _myVar for Function
I think im following, since both onEachFrame and EH's are seperate "environments" than the rest of my code, I have to define the variable in that environment as well?
Yes
onEachFrame doesn't have a good way to get non-global vars into it. However, there's a better version (addMissionEventHandler with "EachFrame") which does.
I was about to ask that haha
addEventHandler is always applied to an object (well, or group with 2.10), so setVariable on that object is the natural method.
Would the only way to get local vars into that mission event handler be to set them to an object?
addMissionEventHandler has a third parameter for vars that are passed into the EH.
But note that in SQF, most variables are passed by value, not reference.
All variables are passed by reference
But you can't modify most of them by reference
Not sure I see the distinction :P
The distinction is in mem usage
E.g. you can't modify a string by ref, but when you do _newStr = _oldStr you're not copying the string
It's the exact same string. You simply don't have any commands that can modify strings by ref (e.g. like pushBack for arrays)
_myVar = 5;
addMissionEventHandler ["EachFrame", {
"_myVar returns as 5 here and is referenced by _myVar"
},[_myVar]];
The wiki for addMissionEventHandler implies that this would work, is that correct?
Oh right, because you build an array when creating the parameters, and that gets passed by reference.
No
You still have to define it
oh right, sorry, it would be with [_thisArgs, _myVar]
No, it would be with
_thisArgs params ["_myVar"]
How does this example get it then?
_id = addMissionEventHandler ["EachFrame", { systemChat str [_thisArgs, time] }, [time]];
It's just printing both the current time and _thisArgs variable
time is a command
Not a variable
oh ok
Ok, now that second issue was getting a local variable that's being set in a standard eventHandler out of it and into this missionEventHandler. I know it works by using setVariable, but as you said Leopard, I dont want to be using that with Player. Would the other option be to either use a global variable or create a dummy object to attach that variable to?
Well, you have to attach the EHs to objects anyway, so setting variables on those same objects is fine. You just have to consider that your mission hangs together with whatever player object switches you allow.
Obviously inside the EH you should use the unit parameter rather than player.
I see that mentioned a lot, but the wiki says very little on it apart from cutscenes. When could/does the player object actually change?
Respawns, although those actually transfer setVariables at some point, and some EHs.
And selectPlayer.
Do you know of anywhere I could read up on how it affects it for respawns?
Ah so thats what that meant under GetInMan
ok
It looks like im going to have to use setVariable for all the variables I want to pass into the missionEventHandler. Since its EachFrame, its setting the value in that environment to what it is outside, so that aint gonna work and brings me back to where I was before this bit
Ah nope, that wont work either. Since the variable is being used in a timer. Guess that will just have to be a global variable
RscNoise_color = [1,1,1,0.5];
123 cutRsc ["RscNoise", "PLAIN", 1e-6];
```Sometimes when I `call` above script from editor's vehicle init field (my mission scripts origin), `RscNoise_color` is not initialized and `nil`. I can't figure out why this might happen, I never nil it anywhere myself, I searched through all game scripts and nothing nils it either. My assumption was that game clears mission namespace variables on mission start and I somehow set the variable before that, but I *think* my other variables are fine? (Didn't test them last time this issue happened, it happens very rarely) Any ideas what might happen here?
why not just use pre init function for mission script origin
No, the game doesn't clear namespace variables since pre Init and onward
You say it's nil, but where?
If in another object's init, or at pre-init ofc it can be
But if neither of those two, then your script is not executing (e.g. you're not calling it as you said, but it's spawn which might take some time to execute if scheduler is busy, or you're calling a non-existing function)
Both lines are right next to each other, I see standard noise but it uses default [1,1,1,1] color (white static) and when I ran isNil"RscNoise_color" it returned true. Sadly I can't reproduce this issue, but I had it happen several times out of hundred runs.
Just an old pre-CfgFunctions habit
Welp, I guess at this point I need to see it happen again to do proper testing to see what's up.
Hi, is there a way to stop playing a sound which was started with playSound?
And another question, is there a way to increase the volume of a sound which is defined in CfgSounds?
yes. deleteVehicle
if ( !isPlayer _x ) then {
_x setdamage 1;
} foreach units delete1;```
what the problem? Error...
incorrect brackets
{
if ( !isPlayer _x ) then {
_x setdamage 1;
}
} forEach units delete1;
alright its weird code but:
https://sqfbin.com/enotuyohagoregixadax
why does this disable my user input whenever I eject?
I have to manually alt + f4 my way out
_Code = str ...
_Code = _Code trim ["{}", 0];
wat? usetoString
How to correct add multiple groups (delete1, delete2...) for this? Doesnt work, tried many ways
{
if ( !isPlayer _x ) then {
_x setdamage 1;
}
} forEach units [delete1, delete2, delete3];```
first of all:
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
second of all, you can do either of these:
{
{
if ( !isPlayer _x ) then {
_x setdamage 1;
}
} forEach units _x;
} forEach [delete1, delete2, delete3];
{
if ( !isPlayer _x ) then {
_x setdamage 1;
}
} forEach (units delete1 + units delete2 + units delete3);
Completely forgot this existed
Is this possibly what causing the user input disable?
is there a way to place a progressBar vertical?
im using this but it is horizontal by default (wiki example)
with uiNamespace do {
bar = findDisplay 46 ctrlCreate ["RscProgress", -1];
bar ctrlSetPosition [0,0,1,0.01];
bar ctrlCommit 0;
bar progressSetPosition 0.75;
};
if it removes your ending bracket yes
you're trimming all {}s
which can happen if you had something like }}
if not that make sure you return false at the end of the code
your false is currently in the if
Well
make a vertical class in your description.ext or config.cpp
not sure if there's a default vanilla one
So that's why
yes
params returns true
but your if is after it 
I don't see why it would override anything
are you forced to do it through sqf? Or can you do it with description
Yeah idk why it disables the game entirely
Like I can't escape etc, have to alt +f4
try the stuff I said first
Yes sir
If you are forced with sqf, you can be a little cheeky where you can create RscPicture and increase its height to make seem like a vertical progress bar
what do you mean by increase its height?
there is a vanilla one:
"RscIGProgress"
nvm that
interesting, let me tell my friend then lol
https://sqfbin.com/efacawanakaketozotem
my input is still disabled, is it because I moved false outside of the if?
there shouldn't be any problem anymore 

unless there's a problem in that code you spawn 
remove that spawn, see what happens
tried before, input doesn't get disabled
but why would the spawn disable input is what is confusing me
alright
but I'm pretty sure that works fine too
Thank you
yep input is fine with empty spawn
they were asking their own question...
Is there a way to increase the volume of a sound which is defined in CfgSounds?
Or do I have to manipulate it with a sound editor?
well there's a problem with the part you move the _caller into stuff then
params?
no, I mean moveIn/out
try long sleeps between different parts to see where input is bugging out
seems like lines 16 and 17
moveOut _caller;
_caller moveInAny _EjectSeat;
is it because I'm instantly moving out/in the caller?
EDIT: yep that's it, put sleep 0.5; in between and its fixed
what am I suppose to add in waitUntil condition, to execute after briefing ends and game starts?
no. maybe the seat you're moving him into is invalid
putting sleep 0.5; in between fixed it
no because he moves in it still?
I've never run into any issues moving units out then in
I guess because in my use case the game moves me into the parachute while I move into the new eject seat, but that's just a short sighted speculation from me
¯_(ツ)_/¯
Well have a bool variable that is false at the start of the briefing, then run waituntil on that bool, and when the meeting is finished make the bool true
try isNil
wat? I mean run it unschd:
isNil {
moveOut _bla;
_bla moveInAny _blabla
}
Oh alright
I'm aiming to play an introduction sound, without background noise. However, fadeSound interferes with playSound. Is there another way of playing a custom sound?
play it as speech
nope same thing, don't worry I already got a workaround that worked for me anyways
Aye, I really should read the BIKI more closely. Thank you.
I should too
I know, but which bool variable?
waitUntil {!isNull findDisplay 46}
20:08:45 Wrong color format #000ÿ
20:08:45 XML parsing error in 't', code: <t ><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t colo...
20:08:45 ➥ Context: [] L189 (A3\functions_f\GUI\fn_typeText2.sqf)
[] L187 (A3\functions_f\GUI\fn_typeText2.sqf)```
tried to add some logging, but the string gets too long that BI function constructs for diag_log (would need to log char by char)
does index out of bound access exist in RV engine?
20:08:45 ["_frameMerged","<t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>r</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>a</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>v</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>e</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'> </t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>m</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>n</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>a</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>r</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' sha 20:08:45 ["_frames",[Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol,Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol]] 20:08:45 ["_rootFormat","<t >%1</t>"]
thats my logging
happens here the first time
20:08:44 ["_frameMerged - _x","<t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>l</t>"]
20:08:44 ["_frameMerged","<t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>r</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>a</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>v</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>m</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>n</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>a</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>r</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'>e</t><t color = '#00000000' shadow = '0' align = 'center' size = '0.7'> </t><t color = '#000
20:08:44 ["_frames",[Brave men are all vertebrates, they havetheir softness on the surface and theirtoughness in the middle.Lewis Carrol]]
20:08:44 ["_rootFormat","<t >%1</t>"]
20:08:44 Unknown attribute col
20:08:44 ➥ Context: [] L189 (A3\functions_f\GUI\fn_typeText2.sqf)
[] L187 (A3\functions_f\GUI\fn_typeText2.sqf)
20:08:44 XML parsing error in 't', code: <t ><t color = '#ffffff' shadow = '1' align = 'center' size = '0.7'>B</t><t colo...
20:08:44 ➥ Context: [] L189 (A3\functions_f\GUI\fn_typeText2.sqf)
[] L187 (A3\functions_f\GUI\fn_typeText2.sqf)```
its the quote feed into fn_typeText2.sqf
the function adds the structured text formatting automatically to it
wait I thought by briefing he meant a cutscene my bad
//pre-process the frames
private["_frame","_frames","_frameId","_charId","_frameMerged"];
_frames = [];
{
_frame = [];
_frameId = _forEachIndex;
//diag_log ["_frameId",_frameId];
//diag_log ["_charsShown 2",_charsShown];
//combine the characters into frames
{
_charId = _forEachIndex;
if (_charId <= _frameId) then
{
_frame set [count _frame,_x];
}
else
{
_frame set [count _frame,_charsHidden select _charId];
};
//diag_log ["_charsShown 3",_charId,_x,_charsHidden select _charId];
}
forEach _charsShown;
//merge frame characters into a string
_frameMerged = "";
//diag_log ["_frame",_frame];
{
//diag_log ["_frameMerged - _x",_x];
//diag_log ["_frameMerged",_frameMerged];
_frameMerged = _frameMerged + _x;
}
forEach _frame;
//diag_log ["_frames",_frames];
//diag_log ["_rootFormat",_rootFormat];
_frames set [count _frames, parseText format[_rootFormat,_frameMerged]];
}
forEach _charsShown;```
forEach _charsShown twice stacked doesnt look right
no it's correct
as far as I see it's just constructing each "frame" of the text (one frame per character)
the algorithm is extremely inefficient but looks fine
the problem appears to be due to using format
it can't handle strings longer than 8 KB
(total size after format)
ok so its index out of bound essentially
probably cuts the remaining bits which leads to a different character
which then the xml parser doesnt like
not sure which index you mean, but the code itself doesn't have that problem
format could be breaking the text tho
making it incomplete (e.g. the ending could be <t>blabla<" which is wrong ofc)
I have three different sound files. Is there a way to pick one randomly with the say3D command?
They are all defined in description.ext
selectRandom
Works. Thank you Leopard.
loop = true;
while {loop} do {
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep (5 + random 10);
};
player addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
deleteVehicle object;
}];```
This is producing an error
Seems it is related to the sleep?
But how can I add a random delay to a loop?
It would help to know what the error actually says.
Also, this loop is creating a new bucket every time it runs and not removing the existing one. Over time this will add up to quite a lot of buckets.
Try defining "object" outside the scope of the loop and the EH
You could try something like this
loop = true;
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;
while {loop} do {
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep (5 + random 10);
};
player addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
deleteVehicle object;
}];
^Doing this might affect the script elsewhere though since it will never be created again once its deleted
The reference to "seems it is related to the sleep" - which I wish they would elaborate on by posting the actual error - leads me to suspect this is being done in a context where sleep is not allowed, such as an init field
The reload deletes the bucket
what if they never reload..?
Yes, but before you reload a bucket is created every cycle, there could be thousands
Ah, i see what you mean
Only the last-created bucket is referenced by the object variable. Every previously created bucket is still out there and does not get deleted.
@modern meteor What is the actual error that is displaying?
Where are you calling this code?
20:08:45 Wrong color format #000ÿ
it produces non standard characters
From the console
I tried
loop = true;
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;
while {loop} do {
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep (5 + random 10);
deleteVehicle object;
};
player addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
deleteVehicle object;
}];```
Is that just for testing, or will you be calling it somewhere else in the future?
hello, i have a bunch of VR arrows outlining an area. i would like the arrows to dissapear when ZEUS presses backspace, like if they are HUD overlays.
Is there an easy way to do that or is it not worth the trouble?
ok, your gonna have to use spawn in your code then itraxx
one sec
loop = true;
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;
spawn {
while {loop} do {
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep (5 + random 10);
deleteVehicle object;
};
};
player addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
deleteVehicle object;
}];
@modern meteor Try that, it incorporates "spawn" which is an environment you can call sleep in
whats the error....
Error missing ;
what line
oh sorry, add this infront of spawn []
I just tried it locally and it seems to run fine
Still testing
Would this script play one of each file on repeat during a mission with random sleep?
It looks like it would only do it once because you are deleting the object after it does it
Is this the whole script or is there more?
This is the whole script
And what is it exactly that you want to be happening?
yup
because we spawn the object outside the loop
Do you want audio files to play and then stop when you reload?
yes exactly
When do you want them to start playing again?
or delte the object after the random sleep
random
like evey 4-7 min
ok, you have no code setup to be doing that bit
the sound files are 1 min each
no, i don't have any other code for this
This is all i have so far
Do you know what you should be doing for it to have the audio file play ever 4-7 minutes?
Another thing, the way the code is ordered, im not sure your event handler is coming into effect until after the object has alredy been deleted following the sleep
Unfortunately i don't know a better solution. The idea is to play 1 out of 3 files every 4-7 minutes with the option to stop the transmission manually but not deleting the loop (i use reload for that)
In testing are your audio files finishing? It looks like the code would force them to end after 5 to 15 seconds
despite them being a minute lol
Yea, this is just for testing
to see if it stops and loops to the next one
once it works i will extend the loop
i guess thats the problem
so you want to randomly play a sound every couple seconds for the player, until some outside event happens?
mm I dont think its a problem, since deleting it is the only way to play a new sound. The issue is that its not being created again
how about this?
spawn {
while {!isNull object} do {
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep (5 + random 10);
};
};
are you sure you need to tdelete the object to play a new sound? sounds sketchy
loop = true;
[] spawn{
while {loop} do {
object = "Land_Bucket_F" createvehicle (getpos player);
object attachTo [player,[0,0,0],"head"];
hideObject object;
object say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep (5 + random 10);
deleteVehicle object;
hint "deleted";
};
};
player addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
deleteVehicle object;
}];```
this seems to be working
is there any disadvantage to it
should only have one bucket attaached at time
well itraxx really shouldnt be using the attachobject as the sound source, however the wiki says that only one sound can be played at a time, and the only way to stop the sound is to delete the vehicle
delete it before attaching new one
seems to be the only solutuion
cannot stop the sound otherwise
I know, one sec
can always teleport the object on a loop instead of attaching it, if thats an issue
0.1 setPosWorld getPosWorld
Does reloading here cancel the sound?
yes
[]spawn {
_loop = true;
player addEventHandler ["Reloaded", {
deleteVehicle sound;
}];
while {_loop} do {
sleep (240 + random 180);
sound = player say3D selectRandom ["P_GenK_Chatter_1","P_GenK_Chatter_2","P_GenK_Chatter_3"];
sleep 62;
deleteVehicle sound;
};
};
This is how I would write it, I believe it should work. This way your just deleting the sound "object" and not the actual object that you were using to attach to the player. Ive subbed that object out with the player itself
The way thats written, every 4-7 minutes a sound file is played, after 62 seconds the sound is deleted. If at any point during that time you press reload then it deletes the sound
any suggestions on how to place a flag on top of a building via script?
How do you want to determine the building? By its type, location, or something else?
Completely arbitrary buildings possible, or can you make a list?
I would just createVehicle with your flag, and then move it up to the top of the building
assuming its the same building each time
If its any type of building being entered, you could maybe use boundingBoxReal in combo with boundingCenter to get the vertical height of the building, and then use that to put the flag on top
Except that the highest point of the building isn't necessarily a suitable surface, and isn't necessarily in the center.
got it its actually simpler than I thought
I thought i'd have to do attachto
yeah, but that's fine. if it doesn't work perfectly on all building w/e
_flag = "Flag_VZ_F";
_house = cursorObject;
_obj = _flag createVehicle position _house;
_newpos = (position _house) select [0, 2];
_newpos pushBack (_house call alive_fnc_getrelativetop);
_obj setpos _newpos``` this works fine
well enough anyway. going to test it more on more houses
alive_fnc_getrelativetop is ```sqf
ALiVE_fnc_getRelativeTop = {
_object = _this;
_bbr = boundingBoxReal _object;
_p1 = _bbr select 0; _p2 = _bbr select 1;
_height = abs((_p2 select 2)-(_p1 select 2));
_height/2;
};```
no it doesn't work fine
Thank you. I'll try this
I have a system where the player can type in a grid reference and get artillery dropped on the centre of that grid square. Thus:
if ((count ((toLower _text) regexFind ["\d{6}"])) > 0) then {
_fsGrid = (((_text regexFind ["\d{6}"]) select 0) select 0);
_fsGridPos = (_fsGrid call BIS_fnc_gridToPos) select 0;
_fsGridCentre = _fsGridPos vectorAdd [50,50];
_responseText = "Roger, message received. Stand by for fire support.";
_newEvent = "SUPPORT";
// gm_shell_155mm_he_m795
// sh_155mm_amos
// gm_shell_155mm_he_dm111
missionNamespace setVariable ["njt_story_support_cooldown",true,true];
[_fsGridCentre] spawn {
sleep 20;
[_this select 0,"sh_155mm_amos",100,6,3,{false},0,350,1] spawn BIS_fnc_fireSupportVirtual;
sleep 200;
missionNamespace setVariable ["njt_story_support_cooldown",false,true];
};
} else {```
(there is a proper else case but it doesn't matter here)
The problem: in local MP, everything works as expected. Plug in your own grid ref and get shells on your face. However, on DS, the artillery never arrives. Everything up to that works - the "stand by for fire support" message is sent. But, no explosions.
This script is executed on the server.
A valid grid ref must be received since it checks that in order to accept the request. Everything after that is fairly simple and I can't see anything that would be different between local and DS. And the bis_fnc_firesupportvirtual spawn does work when server executed in the debug console with a dummy position.
you mean aside from putting them in an array and doing hideObject on all of them?
what's text?
The content of a chat message from a handleChatMessage EH (string)
is that code being executed on the server?
The handleChatMessage EH is not (custom channels aren't detected by EHs on the server for some reason). That EH does this:
[_text,_person] remoteExec ["njt_fnc_storyResponse",2];```
and the code above is in njt_fnc_storyResponse.
The if check at the top ensures the string contains a valid 6 digit grid reference (or, well, a 6 digit number, but I definitely typed in a valid reference). If it doesn't, it would never get to the _responseText part. That's tested. So...the only thing I can think of is maybe BIS_fnc_gridToPos not working on DS. But that doesn't make any sense to me.
well yeah that function does some UI stuff 
ctrlMap = finddisplay 12 displayctrl 51;
_mapPos1 = _ctrlMap ctrlmapscreentoworld [0,0];
_mapPos2 = _ctrlMap ctrlmapscreentoworld [1,0];
_mapPos1 set [2,0];
_mapPos2 set [2,0];
_mapSize = round ((_mapPos1 vectordistance _mapPos2) / ctrlmapscale _ctrlMap);
oh for f...
thanks BI
Okay, I guess I have to move the grid reference check into the local EH. What a pain.
Anyone know a way to get AI squads a bit keener about following move waypoints without completely ignoring enemies?
have you tried setting the group behavior to aware and disabling "AUTOCOMBAT"?
Nope. I'll give it a shot.
Still weird but probably an improvement, thx.
Hmm. Until one squad turned around and walked 700m back towards me despite knowsAbout 0.
Welcome to the hell that every Zeus player faces every game
If you use LAMBS Danger, that might have some waypoints or functions that might be useful. Rush or Assault or something IIRC
I have a trouble with CfgFunctions for compiled scripts. Maybe here can't help?
There my message #arma3_config message
typical, and I always get scolded for that when I'm zeusing players
I think I may have actually bugged out waypoints such that the ones shown on Zeus and returned by waypoint commands are not the ones they're actually following.
you are doing addwaypoint right?
Yeah, but I'm deleting all the previous ones first with:
while {count waypoints _group > 0} do { deleteWaypoint [_group, 0] };
And I suspect that's desyncing them.
This is all dynamically created.
But I figured it's cleaner to clear out obsolete waypoints.
well yeah I can see the zeus units still wonder around despite being given waypoints
they usually like to be like 100m away from the waypoint actual location
Thing is, one of the waypoints is clearly marked in the wrong place but the units are going the right way :P
hmmm
well I hope you don't get the [0,0,0] waypoint glitch in zeus
where units decided to seek out [0,0,0] for sake of being AI
That's partly why I delete the things. Sometimes units spawn with a [0,0,0] for some reason.
I don't think deleting them matters
even added waypoints sometimes get overridden by [0,0,0]
well if you are stuck you can always use lambs
No, I really can't :P
well just saying, I had to spend 6 hours to make an AI drive to a point in zeus, so best of luck
is there any way to force a static turret to fire without a gunner?
Right, this works far better without the waypoint clearout.
I wonder if I can replicate this well enough for someone to actually bother poking the AI code :P
@pulsar bluff I'm not aware of any way of making an unmanned vehicle fire, and the table here only lists manned vehicles as options: https://community.bistudio.com/wiki/fireAtTarget
Depending on the turret you could maybe fake it by spawning ammo...
You could fake it by creating an invisible unit to use as the gunner
Do the UAV AIs work?
yep, because I already tried that before (setting waypoints with dynamically created units) in zeus
Like can you put the AI crew from UAVs into other vehicles.
Simpler way is probably to just use normal crew and hide them, but I'm curious.
will they have hitboxes when hidden? or you don't care about them missing a hitbox?
Wasn't my question in the first place. I have no personal interest in invisible gunners :P
my bad
kinda reminded me of something with the hidden units since somebody in pub zeus kept trolling me by attaching a brick to my player model and hiding the player model.
couldn't play against enemies since my hitbox was nonexistent
Anyone know why the bis_fnc_showNotification from this shows nothing? https://github.com/AsYetUntitled/Framework/blob/v5.X.X/Altis_Life.Altis/core/actions/fn_getDPMission.sqf
not even a placeholder box, the function just does like nothing
didn't you say it ran on certain missions?
@little raptor any idea...?
Where do you test it?
my server
I tried in debug console too its something with my mission but I dont know how.
works with different missions
Does anything work in the debug console at all?
Also I assume you mean the vanilla debug console right?
infistar
?
I mean does any code work at all?
Have you put its description.ext in your mission folder?
I mean that framework's description.ext
it is
Does biki example work on server?

What you say just doesn't make sense
Yep
My guess was busy scheduler but you said other scripts work, so... 
exactly makes no sense.
The
at it again
It has nothing to do with the game
Functions are not part of the game to begin with
They're just scripts
Plus you said yourself that it doesn't work in only one of your missions. It's pretty obvious its your own mission's fault
Its the server icon

Alright nvm I was addressing the wrong message
8am and its consequences
How could he alter the function tho?
I never said he modified the function
You can break things in many ways
I can't look at the function rn to tell what could be wrong
But even examples are not working for him, doesn't that involve source code for function doing something wrong?
Yeah true it might be a condition actually
Or something else not running due to something
No, I mean like breaking a display or cutRsc or sth
Cant break the built in ones
Not the function itself
You might be breaking something which the function relies on
Has anyone ever used SandStorm script on Mulitplayer?
this script
ROS Sandstorm
does anyone knows the parent class for wheels ?
there is wheel_1_1, wheel_1_2 ...etc and goes endlessly especially for 8x8 APCs
.. nvm i will use getText
Using parent classes is nonsense. the game doesn't care about parent classes. it cares about the values defined in the configs
is there a way to prevent a shell from exploding?
well, I need to add more info
prevent it from exploding upon hitting something
I'm basically using a rocket to lift an object, and I don't want something unexpected to make the rocket explode during gameplay
do you have to use a rocket?
yes